Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension of PoolCurrentPaydayInfo/PoolInfoResponse #587

Merged
merged 4 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion concordium-grpc-api
3 changes: 3 additions & 0 deletions haskell-src/Concordium/GRPC2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,7 @@ instance ToProto QueryTypes.BakerPoolStatus where
ProtoFields.maybe'equityPendingChange .= toProto abpsBakerStakePendingChange
ProtoFields.maybe'currentPaydayInfo .= fmap toProto psCurrentPaydayStatus
ProtoFields.allPoolTotalCapital .= toProto psAllPoolTotalCapital
ProtoFields.maybe'isSuspended .= psIsSuspended

instance ToProto QueryTypes.PassiveDelegationStatus where
type Output QueryTypes.PassiveDelegationStatus = Proto.PassiveDelegationInfo
Expand Down Expand Up @@ -1731,6 +1732,8 @@ instance ToProto QueryTypes.CurrentPaydayBakerPoolStatus where
ProtoFields.bakerEquityCapital .= toProto bpsBakerEquityCapital
ProtoFields.delegatedCapital .= toProto bpsDelegatedCapital
ProtoFields.commissionRates .= toProto bpsCommissionRates
ProtoFields.maybe'isPrimedForSuspension .= bpsIsPrimedForSuspension
ProtoFields.maybe'missedRounds .= bpsMissedRounds

instance ToProto QueryTypes.RewardStatus where
type Output QueryTypes.RewardStatus = Proto.TokenomicsInfo
Expand Down
17 changes: 14 additions & 3 deletions haskell-src/Concordium/Types/Queries.hs
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,19 @@ data CurrentPaydayBakerPoolStatus = CurrentPaydayBakerPoolStatus
-- | The effective delegated capital to the pool for the current reward period.
bpsDelegatedCapital :: !Amount,
-- | The commission rates that apply for the current reward period.
bpsCommissionRates :: !CommissionRates
bpsCommissionRates :: !CommissionRates,
-- | A flag indicating whether the baker is primed for suspension the
-- coming snapshot epoch. Present from protocol version P8.
bpsIsPrimedForSuspension :: !(Maybe Bool),
-- | The missed rounds of the baker. Present from protocol version P8.
bpsMissedRounds :: !(Maybe Word64)
}
deriving (Eq, Show)

$( deriveJSON
defaultOptions
{ fieldLabelModifier = firstLower . dropWhile isLower
{ fieldLabelModifier = firstLower . dropWhile isLower,
omitNothingFields = True
}
''CurrentPaydayBakerPoolStatus
)
Expand All @@ -525,7 +531,10 @@ data BakerPoolStatus = BakerPoolStatus
-- for the current reward period.
psCurrentPaydayStatus :: !(Maybe CurrentPaydayBakerPoolStatus),
-- | Total capital staked across all pools, including passive delegation.
psAllPoolTotalCapital :: !Amount
psAllPoolTotalCapital :: !Amount,
-- | A flag indicating Whether the pool owner is suspended or not. Present
-- from protocol version P8.
psIsSuspended :: !(Maybe Bool)
}
deriving (Eq, Show)

Expand All @@ -538,6 +547,7 @@ instance ToJSON BakerPoolStatus where
"currentPaydayStatus" .= psCurrentPaydayStatus,
"allPoolTotalCapital" .= psAllPoolTotalCapital
]
++ ["isSuspended" .= isSuspended | Just isSuspended <- [psIsSuspended]]
++ activeStatusFields
where
activeStatusFields = case psActiveStatus of
Expand Down Expand Up @@ -568,6 +578,7 @@ instance FromJSON BakerPoolStatus where
abpsBakerStakePendingChange <- obj .: "bakerStakePendingChange"
return ActiveBakerPoolStatus{..}
psActiveStatus <- optional activeStatusFields
psIsSuspended <- optional $ obj .: "isSuspended"
drsk0 marked this conversation as resolved.
Show resolved Hide resolved
return BakerPoolStatus{..}

-- | Status of the passive delegators.
Expand Down
Loading