shelley-spec-ledger-0.1.0.0
Safe HaskellNone
LanguageHaskell98

Shelley.Spec.Ledger.Rewards

Synopsis

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.

Instances

Instances details
Eq PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Show PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Generic PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Associated Types

type Rep PerformanceEstimate :: Type -> Type #

ToCBOR PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

FromCBOR PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

NoThunks PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep PerformanceEstimate Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep PerformanceEstimate = D1 ('MetaData "PerformanceEstimate" "Shelley.Spec.Ledger.Rewards" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'True) (C1 ('MetaCons "PerformanceEstimate" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPerformanceEstimate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))

data NonMyopic crypto Source #

Constructors

NonMyopic 

Instances

Instances details
Eq (NonMyopic crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Methods

(==) :: NonMyopic crypto -> NonMyopic crypto -> Bool #

(/=) :: NonMyopic crypto -> NonMyopic crypto -> Bool #

Show (NonMyopic crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Methods

showsPrec :: Int -> NonMyopic crypto -> ShowS #

show :: NonMyopic crypto -> String #

showList :: [NonMyopic crypto] -> ShowS #

Generic (NonMyopic crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Associated Types

type Rep (NonMyopic crypto) :: Type -> Type #

Methods

from :: NonMyopic crypto -> Rep (NonMyopic crypto) x #

to :: Rep (NonMyopic crypto) x -> NonMyopic crypto #

NFData (NonMyopic crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Methods

rnf :: NonMyopic crypto -> () #

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

Defined in Shelley.Spec.Ledger.Rewards

Methods

toCBOR :: NonMyopic crypto -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (NonMyopic crypto) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [NonMyopic crypto] -> Size Source #

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

Defined in Shelley.Spec.Ledger.Rewards

Methods

fromCBOR :: Decoder s (NonMyopic crypto) Source #

label :: Proxy (NonMyopic crypto) -> Text Source #

NoThunks (NonMyopic crypto) Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep (NonMyopic crypto) Source # 
Instance details

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)))

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"

newtype StakeShare Source #

StakeShare type

Constructors

StakeShare 

Instances

Instances details
Eq StakeShare Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Ord StakeShare Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Show StakeShare Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Generic StakeShare Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Associated Types

type Rep StakeShare :: Type -> Type #

NoThunks StakeShare Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep StakeShare Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

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

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.

newtype Histogram Source #

Constructors

Histogram 

Instances

Instances details
Eq Histogram Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Show Histogram Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Generic Histogram Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Associated Types

type Rep Histogram :: Type -> Type #

type Rep Histogram Source # 
Instance details

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))))

newtype LogWeight Source #

Constructors

LogWeight 

Fields

Instances

Instances details
Eq LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Num LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Ord LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Show LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Generic LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Associated Types

type Rep LogWeight :: Type -> Type #

NFData LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Methods

rnf :: LogWeight -> () #

ToCBOR LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Methods

toCBOR :: LogWeight -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy LogWeight -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [LogWeight] -> Size Source #

FromCBOR LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

NoThunks LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep LogWeight Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep LogWeight = D1 ('MetaData "LogWeight" "Shelley.Spec.Ledger.Rewards" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'True) (C1 ('MetaCons "LogWeight" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLogWeight") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Float)))

applyDecay :: Float -> Likelihood -> Likelihood Source #

Decay previous likelihood

newtype Likelihood Source #

Constructors

Likelihood 

Instances

Instances details
Eq Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Show Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Generic Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Associated Types

type Rep Likelihood :: Type -> Type #

Semigroup Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Monoid Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

NFData Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

Methods

rnf :: Likelihood -> () #

ToCBOR Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

FromCBOR Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

NoThunks Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep Likelihood Source # 
Instance details

Defined in Shelley.Spec.Ledger.Rewards

type Rep Likelihood = D1 ('MetaData "Likelihood" "Shelley.Spec.Ledger.Rewards" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'True) (C1 ('MetaCons "Likelihood" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLikelihood") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StrictSeq LogWeight))))

leaderRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin Source #

Calculate pool leader reward

memberRew :: Coin -> PoolParams crypto -> StakeShare -> StakeShare -> Coin Source #

Calculate pool member reward