cardano-ledger-shelley-0.1.0.0
Safe Haskell None
Language Haskell2010

Cardano.Ledger.Shelley.Rewards

Synopsis

Documentation

newtype StakeShare Source #

StakeShare type

Instances

Instances details
Eq StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Ord StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Show StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Generic StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NFData StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NoThunks StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep StakeShare Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep StakeShare = D1 (' MetaData "StakeShare" "Cardano.Ledger.Shelley.Rewards" "cardano-ledger-shelley-0.1.0.0-4LNBTpyKcsy6EW18a3tTt2" ' True ) ( C1 (' MetaCons "StakeShare" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "unStakeShare") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Rational )))

data PoolRewardInfo crypto Source #

Stake Pool specific information needed to compute the rewards for its members.

Constructors

PoolRewardInfo

Fields

Instances

Instances details
Eq ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Ord ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Show ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Generic ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Associated Types

type Rep ( PoolRewardInfo crypto) :: Type -> Type Source #

NFData ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Crypto crypto => ToCBOR ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Crypto crypto => FromCBOR ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NoThunks ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep ( PoolRewardInfo crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

data RewardType Source #

Instances

Instances details
Eq RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Ord RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Show RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Generic RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NFData RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

ToCBOR RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

FromCBOR RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NoThunks RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep RewardType Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep RewardType = D1 (' MetaData "RewardType" "Cardano.Ledger.Shelley.Rewards" "cardano-ledger-shelley-0.1.0.0-4LNBTpyKcsy6EW18a3tTt2" ' False ) ( C1 (' MetaCons "MemberReward" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "LeaderReward" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data LeaderOnlyReward crypto Source #

Instances

Instances details
Eq ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Ord ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Show ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Generic ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Associated Types

type Rep ( LeaderOnlyReward crypto) :: Type -> Type Source #

NFData ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Crypto crypto => ToCBOR ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Crypto crypto => FromCBOR ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NoThunks ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep ( LeaderOnlyReward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep ( LeaderOnlyReward crypto) = D1 (' MetaData "LeaderOnlyReward" "Cardano.Ledger.Shelley.Rewards" "cardano-ledger-shelley-0.1.0.0-4LNBTpyKcsy6EW18a3tTt2" ' False ) ( C1 (' MetaCons "LeaderOnlyReward" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "lRewardPool") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( KeyHash ' StakePool crypto)) :*: S1 (' MetaSel (' Just "lRewardAmount") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin )))

data Reward crypto Source #

Instances

Instances details
Eq ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Ord ( Reward crypto) Source #

Note that this Ord instance is chosen to align precisely with the Allegra reward aggregation, as given by the function aggregateRewards so that findMax returns the expected value.

Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Show ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Generic ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Associated Types

type Rep ( Reward crypto) :: Type -> Type Source #

NFData ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Methods

rnf :: Reward crypto -> () Source #

Crypto crypto => ToCBOR ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

Crypto crypto => FromCBOR ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

NoThunks ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

type Rep ( Reward crypto) Source #
Instance details

Defined in Cardano.Ledger.Shelley.Rewards

filterRewards :: forall crypto pp. HasField "_protocolVersion" pp ProtVer => pp -> Map ( Credential ' Staking crypto) ( Set ( Reward crypto)) -> ( Map ( Credential ' Staking crypto) ( Set ( Reward crypto)), Map ( Credential ' Staking crypto) ( Set ( Reward crypto))) Source #

Filter the reward payments to those that will actually be delivered. This function exists since in Shelley, a stake credential earning rewards from multiple sources would only receive one reward.

sumRewards :: forall crypto pp. HasField "_protocolVersion" pp ProtVer => pp -> Map ( Credential ' Staking crypto) ( Set ( Reward crypto)) -> Coin Source #

rewardOnePoolMember Source #

Arguments

:: HasField "_protocolVersion" pp ProtVer
=> pp

The protocol parameters

-> Coin

The total amount of stake in the system

-> Set ( Credential ' Staking c)

The set of registered stake credentials

-> PoolRewardInfo c

Stake pool specific intermediate values needed to compute member rewards.

-> Credential ' Staking c

The stake credential whose reward is being calculated.

-> Coin

The stake controlled by the stake credential in the previous parameter above.

-> Maybe Coin

The reward for the given stake credential. This could be Nothing if the credential is no longer registered, if it is an owner, or if the reward is zero.

The stake pool member reward calculation

mkPoolRewardInfo :: ( HasField "_d" ( PParams era) UnitInterval , HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => PParams era -> Coin -> BlocksMade ( Crypto era) -> Natural -> Stake ( Crypto era) -> VMap VB VB ( Credential ' Staking ( Crypto era)) ( KeyHash ' StakePool ( Crypto era)) -> Map ( KeyHash ' StakePool ( Crypto era)) Coin -> Coin -> Coin -> PoolParams ( Crypto era) -> Either StakeShare ( PoolRewardInfo ( Crypto era)) Source #

Calculate single stake pool specific values for the reward computation.

Note that if a stake pool has made no blocks in the given epoch, it will get no rewards, and so we do not need to return PoolRewardInfo . We do, however, need to return the relative stake of the pool in order to compute data for the stake pool ranking. Eventually we will remove the ranking information out of the ledger code and into a separate service, and at that point we can simplify this function to not care about ranking.