Skip to content

Commit

Permalink
Rename stake-pool-related record fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Jul 3, 2020
1 parent ce6a478 commit c3cd20c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions lib/shelley/src/Cardano/Wallet/Shelley/Pools.hs
Expand Up @@ -189,8 +189,8 @@ data PoolLsqData = PoolLsqData

-- | Stake pool-related data that has been read from the database.
data PoolDbData = PoolDbData
{ regCert :: PoolRegistrationCertificate
, retCert :: Maybe PoolRetirementCertificate
{ registrationCert :: PoolRegistrationCertificate
, retirementCert :: Maybe PoolRetirementCertificate
, nProducedBlocks :: Quantity "block" Word64
, metadata :: Maybe StakePoolMetadata
}
Expand Down Expand Up @@ -230,14 +230,19 @@ combineDbAndLsqData sp =
, Api.producedBlocks = maybe (Quantity 0)
(fmap fromIntegral . nProducedBlocks) dbData
}
, Api.metadata = dbData >>= metadata >>= (return . ApiT)
, Api.cost = fmap fromIntegral . poolCost . regCert <$> dbData
, Api.pledge = fmap fromIntegral . poolPledge . regCert <$> dbData
, Api.margin = Quantity . poolMargin . regCert <$> dbData
, Api.metadata =
dbData >>= metadata >>= (return . ApiT)
, Api.cost =
fmap fromIntegral . poolCost . registrationCert <$> dbData
, Api.pledge =
fmap fromIntegral . poolPledge . registrationCert <$> dbData
, Api.margin =
Quantity . poolMargin . registrationCert <$> dbData
-- TODO: Report the actual retirement status of a pool.
-- For the moment, we always report that a pool will never retire.
-- See https://github.com/input-output-hk/cardano-wallet/milestone/89
, Api.retirement = toApiEpochInfo . retiredIn <$> (retCert =<< dbData)
, Api.retirement =
toApiEpochInfo . retiredIn <$> (retirementCert =<< dbData)
}

toApiEpochInfo ep =
Expand Down

0 comments on commit c3cd20c

Please sign in to comment.