Safe Haskell | None |
---|---|
Language | Haskell98 |
Shelley.Spec.Ledger.Rewards
Synopsis
- desirability :: PParams era -> Coin -> PoolParams (Crypto era) -> PerformanceEstimate -> Coin -> Double
- newtype PerformanceEstimate = PerformanceEstimate {}
- data NonMyopic crypto = NonMyopic {
- likelihoodsNM :: !(Map (KeyHash 'StakePool crypto) Likelihood)
- rewardPotNM :: !Coin
- emptyNonMyopic :: NonMyopic crypto
- getTopRankedPools :: Coin -> Coin -> PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Map (KeyHash 'StakePool (Crypto era)) PerformanceEstimate -> Set (KeyHash 'StakePool (Crypto era))
- newtype StakeShare = StakeShare {}
- mkApparentPerformance :: UnitInterval -> Rational -> Natural -> Natural -> Rational
- reward :: PParams era -> BlocksMade (Crypto era) -> Coin -> Set (Credential 'Staking (Crypto era)) -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Stake (Crypto era) -> Map (Credential 'Staking (Crypto era)) (KeyHash 'StakePool (Crypto era)) -> Coin -> ActiveSlotCoeff -> EpochSize -> (Map (Credential 'Staking (Crypto era)) Coin, Map (KeyHash 'StakePool (Crypto era)) Likelihood)
- nonMyopicStake :: PParams era -> StakeShare -> StakeShare -> StakeShare -> KeyHash 'StakePool (Crypto era) -> Set (KeyHash 'StakePool (Crypto era)) -> StakeShare
- nonMyopicMemberRew :: PParams era -> Coin -> PoolParams (Crypto era) -> StakeShare -> StakeShare -> StakeShare -> Set (KeyHash 'StakePool (Crypto era)) -> PerformanceEstimate -> Coin
- percentile' :: Likelihood -> PerformanceEstimate
- newtype Histogram = Histogram {}
- newtype LogWeight = LogWeight {
- unLogWeight :: Float
- likelihood :: Natural -> Double -> EpochSize -> Likelihood
- applyDecay :: Float -> Likelihood -> Likelihood
- newtype Likelihood = Likelihood {}
- leaderProbability :: ActiveSlotCoeff -> Rational -> UnitInterval -> Double
- leaderRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin
- memberRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin
Documentation
desirability :: PParams era -> Coin -> PoolParams (Crypto era) -> PerformanceEstimate -> Coin -> Double Source #
Desirability calculation for non-myopic utily, corresponding to f^~ in section 5.6.1 of "Design Specification for Delegation and Incentives in Cardano"
newtype PerformanceEstimate Source #
This is a estimate of the proportion of allowed blocks a pool will make in the future. It is used for ranking pools in delegation.
Constructors
PerformanceEstimate | |
Fields |
Instances
data NonMyopic crypto Source #
Constructors
NonMyopic | |
Fields
|
Instances
Eq (NonMyopic crypto) Source # | |
Show (NonMyopic crypto) Source # | |
Generic (NonMyopic crypto) Source # | |
NFData (NonMyopic crypto) Source # | |
Defined in Shelley.Spec.Ledger.Rewards | |
Crypto crypto => ToCBOR (NonMyopic crypto) Source # | |
Defined in Shelley.Spec.Ledger.Rewards | |
Crypto crypto => FromCBOR (NonMyopic crypto) Source # | |
NoThunks (NonMyopic crypto) Source # | |
type Rep (NonMyopic crypto) Source # | |
Defined in Shelley.Spec.Ledger.Rewards type Rep (NonMyopic crypto) = D1 ('MetaData "NonMyopic" "Shelley.Spec.Ledger.Rewards" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'False) (C1 ('MetaCons "NonMyopic" 'PrefixI 'True) (S1 ('MetaSel ('Just "likelihoodsNM") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (KeyHash 'StakePool crypto) Likelihood)) :*: S1 ('MetaSel ('Just "rewardPotNM") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin))) |
emptyNonMyopic :: NonMyopic crypto Source #
getTopRankedPools :: Coin -> Coin -> PParams era -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Map (KeyHash 'StakePool (Crypto era)) PerformanceEstimate -> Set (KeyHash 'StakePool (Crypto era)) Source #
Computes the top ranked stake pools corresponding to section 5.6.1 of "Design Specification for Delegation and Incentives in Cardano"
mkApparentPerformance :: UnitInterval -> Rational -> Natural -> Natural -> Rational Source #
Calculate pool reward
reward :: PParams era -> BlocksMade (Crypto era) -> Coin -> Set (Credential 'Staking (Crypto era)) -> Map (KeyHash 'StakePool (Crypto era)) (PoolParams (Crypto era)) -> Stake (Crypto era) -> Map (Credential 'Staking (Crypto era)) (KeyHash 'StakePool (Crypto era)) -> Coin -> ActiveSlotCoeff -> EpochSize -> (Map (Credential 'Staking (Crypto era)) Coin, Map (KeyHash 'StakePool (Crypto era)) Likelihood) Source #
nonMyopicStake :: PParams era -> StakeShare -> StakeShare -> StakeShare -> KeyHash 'StakePool (Crypto era) -> Set (KeyHash 'StakePool (Crypto era)) -> StakeShare Source #
Compute the Non-Myopic Pool Stake
This function implements non-myopic stake calculation in section 5.6.2 of "Design Specification for Delegation and Incentives in Cardano". Note that the protocol parameters are implicit in the design document. Additionally, instead of passing a rank r to compare with k, we pass the top k desirable pools and check for membership.
nonMyopicMemberRew :: PParams era -> Coin -> PoolParams (Crypto era) -> StakeShare -> StakeShare -> StakeShare -> Set (KeyHash 'StakePool (Crypto era)) -> PerformanceEstimate -> Coin Source #
Compute the Non-Myopic Pool Member Reward
This function implements equation (3) in section 5.6.4 of "Design Specification for Delegation and Incentives in Cardano". Note that the protocol parameters and the reward pot are implicit in the design document. Additionally, instead of passing a rank r to compare with k, we pass the top k desirable pools and check for membership.
Constructors
Histogram | |
Fields |
Instances
Eq Histogram Source # | |
Show Histogram Source # | |
Generic Histogram Source # | |
type Rep Histogram Source # | |
Defined in Shelley.Spec.Ledger.Rewards type Rep Histogram = D1 ('MetaData "Histogram" "Shelley.Spec.Ledger.Rewards" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'True) (C1 ('MetaCons "Histogram" 'PrefixI 'True) (S1 ('MetaSel ('Just "unHistogram") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StrictSeq LogWeight)))) |
Constructors
LogWeight | |
Fields
|
Instances
Eq LogWeight Source # | |
Num LogWeight Source # | |
Defined in Shelley.Spec.Ledger.Rewards | |
Ord LogWeight Source # | |
Show LogWeight Source # | |
Generic LogWeight Source # | |
NFData LogWeight Source # | |
Defined in Shelley.Spec.Ledger.Rewards | |
ToCBOR LogWeight Source # | |
FromCBOR LogWeight Source # | |
NoThunks LogWeight Source # | |
type Rep LogWeight Source # | |
Defined in Shelley.Spec.Ledger.Rewards |
likelihood :: Natural -> Double -> EpochSize -> Likelihood Source #
applyDecay :: Float -> Likelihood -> Likelihood Source #
Decay previous likelihood
newtype Likelihood Source #
Constructors
Likelihood | |
Fields |
Instances
leaderProbability :: ActiveSlotCoeff -> Rational -> UnitInterval -> Double Source #
leaderRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin Source #
Calculate pool leader reward
memberRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin Source #
Calculate pool member reward