Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- getUTxO :: NewEpochState era -> UTxO era
- getUTxOSubset :: NewEpochState era -> Set ( TxIn ( Crypto era)) -> UTxO era
- getFilteredUTxO :: Era era => NewEpochState era -> Set ( Addr ( Crypto era)) -> UTxO era
- getPools :: NewEpochState era -> Set ( KeyHash ' StakePool ( Crypto era))
- getPoolParameters :: NewEpochState era -> Set ( KeyHash ' StakePool ( Crypto era)) -> Map ( KeyHash ' StakePool ( Crypto era)) ( PoolParams ( Crypto era))
- getTotalStake :: Globals -> NewEpochState era -> Coin
- poolsByTotalStakeFraction :: forall era. Globals -> NewEpochState era -> PoolDistr ( Crypto era)
-
data
RewardInfoPool
=
RewardInfoPool
{
- stake :: Coin
- ownerPledge :: Coin
- ownerStake :: Coin
- cost :: Coin
- margin :: UnitInterval
- performanceEstimate :: Double
-
data
RewardParams
=
RewardParams
{
- nOpt :: Natural
- a0 :: NonNegativeInterval
- rPot :: Coin
- totalStake :: Coin
- getRewardInfoPools :: ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => Globals -> NewEpochState era -> ( RewardParams , Map ( KeyHash ' StakePool ( Crypto era)) RewardInfoPool )
- getRewardProvenance :: forall era. ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_d" ( PParams era) UnitInterval , HasField "_nOpt" ( PParams era) Natural , HasField "_protocolVersion" ( PParams era) ProtVer , HasField "_rho" ( PParams era) UnitInterval , HasField "_tau" ( PParams era) UnitInterval ) => Globals -> NewEpochState era -> ( RewardUpdate ( Crypto era), RewardProvenance ( Crypto era))
- getNonMyopicMemberRewards :: ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => Globals -> NewEpochState era -> Set ( Either Coin ( Credential ' Staking ( Crypto era))) -> Map ( Either Coin ( Credential ' Staking ( Crypto era))) ( Map ( KeyHash ' StakePool ( Crypto era)) Coin )
-
class
(
Era
era,
HasField
"_minfeeA" (
PParams
era)
Natural
,
HasField
"_keyDeposit" (
PParams
era)
Coin
,
HasField
"_poolDeposit" (
PParams
era)
Coin
,
HasField
"certs" (
TxBody
era) (
StrictSeq
(
DCert
(
Crypto
era)))) =>
CLI
era
where
- evaluateMinFee :: PParams era -> Tx era -> Coin
- evaluateConsumed :: PParams era -> UTxO era -> TxBody era -> Value era
- addKeyWitnesses :: Tx era -> Set ( WitVKey ' Witness ( Crypto era)) -> Tx era
- evaluateTransactionBalance :: PParams era -> UTxO era -> ( KeyHash ' StakePool ( Crypto era) -> Bool ) -> TxBody era -> Value era
- evaluateTransactionFee :: PParams era -> Tx era -> Word -> Coin
- evaluateMinLovelaceOutput :: PParams era -> TxOut era -> Coin
- addShelleyKeyWitnesses :: ( Era era, Witnesses era ~ WitnessSet era, AnnotatedData ( Script era), ToCBOR ( AuxiliaryData era), ToCBOR ( TxBody era)) => Tx era -> Set ( WitVKey ' Witness ( Crypto era)) -> Tx era
-
data
AdaPots
=
AdaPots
{
- treasuryAdaPot :: Coin
- reservesAdaPot :: Coin
- rewardsAdaPot :: Coin
- utxoAdaPot :: Coin
- depositsAdaPot :: Coin
- feesAdaPot :: Coin
- totalAdaES :: UsesValue era => EpochState era -> Coin
- totalAdaPotsES :: UsesValue era => EpochState era -> AdaPots
UTxOs
getUTxO :: NewEpochState era -> UTxO era Source #
Get the full UTxO.
getUTxOSubset :: NewEpochState era -> Set ( TxIn ( Crypto era)) -> UTxO era Source #
getFilteredUTxO :: Era era => NewEpochState era -> Set ( Addr ( Crypto era)) -> UTxO era Source #
Get the UTxO filtered by address.
Stake Pools
getPools :: NewEpochState era -> Set ( KeyHash ' StakePool ( Crypto era)) Source #
Get the current registered stake pools.
getPoolParameters :: NewEpochState era -> Set ( KeyHash ' StakePool ( Crypto era)) -> Map ( KeyHash ' StakePool ( Crypto era)) ( PoolParams ( Crypto era)) Source #
Get the current registered stake pool parameters for a given set of stake pools. The result map will contain entries for all the given stake pools that are currently registered.
getTotalStake :: Globals -> NewEpochState era -> Coin Source #
Calculate the current total stake.
poolsByTotalStakeFraction :: forall era. Globals -> NewEpochState era -> PoolDistr ( Crypto era) Source #
Get pool sizes, but in terms of total stake
The stake distribution uses active stake (so that the leader schedule is not affected by undelegated stake), but the wallet wants to display pool saturation for rewards purposes. For that, it needs the fraction of total stake.
This is not based on any snapshot, but uses the current ledger state.
data RewardInfoPool Source #
Information about a stake pool
RewardInfoPool | |
|
Instances
data RewardParams Source #
Global information that influences stake pool rewards
RewardParams | |
|
Instances
getRewardInfoPools :: ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => Globals -> NewEpochState era -> ( RewardParams , Map ( KeyHash ' StakePool ( Crypto era)) RewardInfoPool ) Source #
Retrieve the information necessary to calculate stake pool member rewards from the current stake distribution.
This information includes the current stake distribution aggregated
by stake pools and pool owners,
the
current
pool costs and margins,
and performance estimates.
Also included are global information such as
the total stake or protocol parameters.
getRewardProvenance :: forall era. ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_d" ( PParams era) UnitInterval , HasField "_nOpt" ( PParams era) Natural , HasField "_protocolVersion" ( PParams era) ProtVer , HasField "_rho" ( PParams era) UnitInterval , HasField "_tau" ( PParams era) UnitInterval ) => Globals -> NewEpochState era -> ( RewardUpdate ( Crypto era), RewardProvenance ( Crypto era)) Source #
Calculate stake pool rewards from the snapshot labeled
go
.
Also includes information on how the rewards were calculated
(
RewardProvenance
).
For a calculation of rewards based on the current stake distribution,
see
getRewardInfoPools
.
TODO: Deprecate
getRewardProvenance
, because wallets are more
likely to use
getRewardInfoPools
for up-to-date information
on stake pool rewards.
getNonMyopicMemberRewards :: ( HasField "_a0" ( PParams era) NonNegativeInterval , HasField "_nOpt" ( PParams era) Natural ) => Globals -> NewEpochState era -> Set ( Either Coin ( Credential ' Staking ( Crypto era))) -> Map ( Either Coin ( Credential ' Staking ( Crypto era))) ( Map ( KeyHash ' StakePool ( Crypto era)) Coin ) Source #
Calculate the Non-Myopic Pool Member Rewards for a set of credentials. For each given credential, this function returns a map from each stake pool (identified by the key hash of the pool operator) to the non-myopic pool member reward for that stake pool.
This is not based on any snapshot, but uses the current ledger state.
Transaction helpers
class ( Era era, HasField "_minfeeA" ( PParams era) Natural , HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era)))) => CLI era where Source #
A collection of functons to help construction transactions from the cardano-cli.
evaluateMinFee :: PParams era -> Tx era -> Coin Source #
The minimum fee calculation.
Used for the default implentation of
evaluateTransactionFee
.
evaluateConsumed :: PParams era -> UTxO era -> TxBody era -> Value era Source #
The consumed calculation.
Used for the default implentation of
evaluateTransactionBalance
.
addKeyWitnesses :: Tx era -> Set ( WitVKey ' Witness ( Crypto era)) -> Tx era Source #
evaluateTransactionBalance Source #
:: PParams era |
The current protocol parameters. |
-> UTxO era |
The UTxO relevant to the transaction. |
-> ( KeyHash ' StakePool ( Crypto era) -> Bool ) |
A predicate that a stake pool ID is new (i.e. unregistered). Typically this will be: (
|
-> TxBody era |
The transaction being evaluated for balance. |
-> Value era |
The difference between what the transaction consumes and what it produces. |
Evaluate the difference between the value currently being consumed by a transaction and the number of lovelace being produced. This value will be zero for a valid transaction.
evaluateTransactionFee Source #
:: PParams era |
The current protocol parameters. |
-> Tx era |
The transaction. |
-> Word |
The number of key witnesses still to be added to the transaction. |
-> Coin |
The required fee. |
Evaluate the fee for a given transaction.
evaluateMinLovelaceOutput :: PParams era -> TxOut era -> Coin Source #
Evaluate the minimum lovelace that a given transaciton output must contain.
Instances
Crypto c => CLI ( ShelleyEra c) Source # | |
Defined in Cardano.Ledger.Shelley.API.Wallet evaluateMinFee :: PParams ( ShelleyEra c) -> Tx ( ShelleyEra c) -> Coin Source # evaluateConsumed :: PParams ( ShelleyEra c) -> UTxO ( ShelleyEra c) -> TxBody ( ShelleyEra c) -> Value ( ShelleyEra c) Source # addKeyWitnesses :: Tx ( ShelleyEra c) -> Set ( WitVKey ' Witness ( Crypto ( ShelleyEra c))) -> Tx ( ShelleyEra c) Source # evaluateTransactionBalance :: PParams ( ShelleyEra c) -> UTxO ( ShelleyEra c) -> ( KeyHash ' StakePool ( Crypto ( ShelleyEra c)) -> Bool ) -> TxBody ( ShelleyEra c) -> Value ( ShelleyEra c) Source # evaluateTransactionFee :: PParams ( ShelleyEra c) -> Tx ( ShelleyEra c) -> Word -> Coin Source # evaluateMinLovelaceOutput :: PParams ( ShelleyEra c) -> TxOut ( ShelleyEra c) -> Coin Source # |
addShelleyKeyWitnesses :: ( Era era, Witnesses era ~ WitnessSet era, AnnotatedData ( Script era), ToCBOR ( AuxiliaryData era), ToCBOR ( TxBody era)) => Tx era -> Set ( WitVKey ' Witness ( Crypto era)) -> Tx era Source #
AdaPots | |
|
totalAdaES :: UsesValue era => EpochState era -> Coin Source #
Calculate the total ada in the epoch state
totalAdaPotsES :: UsesValue era => EpochState era -> AdaPots Source #
Calculate the total ada pots in the epoch state