Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class EraTxCert era ⇒ ShelleyEraTxCert era where
- mkRegTxCert ∷ StakeCredential → TxCert era
- getRegTxCert ∷ TxCert era → Maybe StakeCredential
- mkUnRegTxCert ∷ StakeCredential → TxCert era
- getUnRegTxCert ∷ TxCert era → Maybe StakeCredential
- mkDelegStakeTxCert ∷ StakeCredential → KeyHash 'StakePool → TxCert era
- getDelegStakeTxCert ∷ TxCert era → Maybe (StakeCredential, KeyHash 'StakePool)
- mkGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ GenesisDelegCert → TxCert era
- getGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe GenesisDelegCert
- mkMirTxCert ∷ ProtVerAtMost era 8 ⇒ MIRCert → TxCert era
- getMirTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe MIRCert
- pattern MirTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ MIRCert → TxCert era
- pattern GenesisDelegTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ KeyHash 'Genesis → KeyHash 'GenesisDelegate → VRFVerKeyHash 'GenDelegVRF → TxCert era
- pattern RegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential → TxCert era
- pattern UnRegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential → TxCert era
- pattern DelegStakeTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential → KeyHash 'StakePool → TxCert era
- data ShelleyDelegCert
- getVKeyWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe (KeyHash 'Witness)
- getScriptWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe ScriptHash
- data ShelleyTxCert era
- upgradeShelleyTxCert ∷ ShelleyTxCert era1 → ShelleyTxCert era2
- data GenesisDelegCert = GenesisDelegCert !(KeyHash 'Genesis) !(KeyHash 'GenesisDelegate) !(VRFVerKeyHash 'GenDelegVRF)
- genesisCWitness ∷ GenesisDelegCert → KeyHash 'Genesis
- genesisKeyHashWitness ∷ GenesisDelegCert → KeyHash 'Witness
- data MIRCert = MIRCert {
- mirPot ∷ !MIRPot
- mirRewards ∷ !MIRTarget
- data MIRPot
- data MIRTarget
- isDelegation ∷ ShelleyEraTxCert era ⇒ TxCert era → Bool
- isRegPool ∷ EraTxCert era ⇒ TxCert era → Bool
- isRetirePool ∷ EraTxCert era ⇒ TxCert era → Bool
- isGenesisDelegation ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool
- isInstantaneousRewards ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool
- isReservesMIRCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool
- isTreasuryMIRCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool
- shelleyTxCertDelegDecoder ∷ ShelleyEraTxCert era ⇒ Word → Decoder s (Int, TxCert era)
- poolTxCertDecoder ∷ EraTxCert era ⇒ Word → Decoder s (Int, TxCert era)
- encodeShelleyDelegCert ∷ ShelleyDelegCert → Encoding
- encodePoolCert ∷ PoolCert → Encoding
- encodeGenesisDelegCert ∷ GenesisDelegCert → Encoding
- shelleyTotalDepositsTxCerts ∷ (EraPParams era, Foldable f, EraTxCert era) ⇒ PParams era → (KeyHash 'StakePool → Bool) → f (TxCert era) → Coin
- shelleyTotalRefundsTxCerts ∷ (EraPParams era, Foldable f, EraTxCert era) ⇒ PParams era → (StakeCredential → Maybe Coin) → f (TxCert era) → Coin
- class (Era era, ToJSON (TxCert era), DecCBOR (TxCert era), EncCBOR (TxCert era), ToCBOR (TxCert era), FromCBOR (TxCert era), NoThunks (TxCert era), NFData (TxCert era), Show (TxCert era), Ord (TxCert era), Eq (TxCert era)) ⇒ EraTxCert era where
- type TxCert era = (r ∷ Type) | r → era
- type TxCertUpgradeError era
- upgradeTxCert ∷ TxCert (PreviousEra era) → Either (TxCertUpgradeError era) (TxCert era)
- getVKeyWitnessTxCert ∷ TxCert era → Maybe (KeyHash 'Witness)
- getScriptWitnessTxCert ∷ TxCert era → Maybe ScriptHash
- mkRegPoolTxCert ∷ PoolParams → TxCert era
- getRegPoolTxCert ∷ TxCert era → Maybe PoolParams
- mkRetirePoolTxCert ∷ KeyHash 'StakePool → EpochNo → TxCert era
- getRetirePoolTxCert ∷ TxCert era → Maybe (KeyHash 'StakePool, EpochNo)
- lookupRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking)
- lookupUnRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking)
- getTotalDepositsTxCerts ∷ Foldable f ⇒ PParams era → (KeyHash 'StakePool → Bool) → f (TxCert era) → Coin
- getTotalRefundsTxCerts ∷ Foldable f ⇒ PParams era → (Credential 'Staking → Maybe Coin) → (Credential 'DRepRole → Maybe Coin) → f (TxCert era) → Coin
- pattern RegPoolTxCert ∷ EraTxCert era ⇒ PoolParams → TxCert era
- pattern RetirePoolTxCert ∷ EraTxCert era ⇒ KeyHash 'StakePool → EpochNo → TxCert era
- data PoolCert
- = RegPool !PoolParams
- | RetirePool !(KeyHash 'StakePool) !EpochNo
- isRegStakeTxCert ∷ EraTxCert era ⇒ TxCert era → Bool
- isUnRegStakeTxCert ∷ EraTxCert era ⇒ TxCert era → Bool
Documentation
class EraTxCert era ⇒ ShelleyEraTxCert era where Source #
mkRegTxCert ∷ StakeCredential → TxCert era Source #
getRegTxCert ∷ TxCert era → Maybe StakeCredential Source #
mkUnRegTxCert ∷ StakeCredential → TxCert era Source #
getUnRegTxCert ∷ TxCert era → Maybe StakeCredential Source #
mkDelegStakeTxCert ∷ StakeCredential → KeyHash 'StakePool → TxCert era Source #
getDelegStakeTxCert ∷ TxCert era → Maybe (StakeCredential, KeyHash 'StakePool) Source #
mkGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ GenesisDelegCert → TxCert era Source #
getGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe GenesisDelegCert Source #
mkMirTxCert ∷ ProtVerAtMost era 8 ⇒ MIRCert → TxCert era Source #
getMirTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe MIRCert Source #
Instances
pattern MirTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ MIRCert → TxCert era Source #
pattern GenesisDelegTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ KeyHash 'Genesis → KeyHash 'GenesisDelegate → VRFVerKeyHash 'GenDelegVRF → TxCert era Source #
pattern RegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential → TxCert era Source #
pattern UnRegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential → TxCert era Source #
pattern DelegStakeTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential → KeyHash 'StakePool → TxCert era Source #
data ShelleyDelegCert Source #
ShelleyRegCert !StakeCredential | A stake credential registration certificate. |
ShelleyUnRegCert !StakeCredential | A stake credential deregistration certificate. |
ShelleyDelegCert !StakeCredential !(KeyHash 'StakePool) | A stake delegation certificate. |
Instances
getVKeyWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe (KeyHash 'Witness) Source #
data ShelleyTxCert era Source #
A heavyweight certificate.
ShelleyTxCertDelegCert !ShelleyDelegCert | |
ShelleyTxCertPool !PoolCert | |
ShelleyTxCertGenesisDeleg !GenesisDelegCert | |
ShelleyTxCertMir !MIRCert |
Instances
upgradeShelleyTxCert ∷ ShelleyTxCert era1 → ShelleyTxCert era2 Source #
GenesisDelegCert
data GenesisDelegCert Source #
Genesis key delegation certificate
Instances
MIRCert
Move instantaneous rewards certificate
MIRCert | |
|
Instances
ToJSON MIRCert Source # | |
Generic MIRCert Source # | |
Show MIRCert Source # | |
DecCBOR MIRCert Source # | |
EncCBOR MIRCert Source # | |
NFData MIRCert Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
Eq MIRCert Source # | |
Ord MIRCert Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
NoThunks MIRCert Source # | |
type Rep MIRCert Source # | |
Defined in Cardano.Ledger.Shelley.TxCert type Rep MIRCert = D1 ('MetaData "MIRCert" "Cardano.Ledger.Shelley.TxCert" "cardano-ledger-shelley-1.16.0.0-inplace" 'False) (C1 ('MetaCons "MIRCert" 'PrefixI 'True) (S1 ('MetaSel ('Just "mirPot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MIRPot) :*: S1 ('MetaSel ('Just "mirRewards") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MIRTarget))) |
Instances
ToJSON MIRPot Source # | |
Bounded MIRPot Source # | |
Enum MIRPot Source # | |
Defined in Cardano.Ledger.Shelley.TxCert succ ∷ MIRPot → MIRPot Source # pred ∷ MIRPot → MIRPot Source # toEnum ∷ Int → MIRPot Source # fromEnum ∷ MIRPot → Int Source # enumFrom ∷ MIRPot → [MIRPot] Source # enumFromThen ∷ MIRPot → MIRPot → [MIRPot] Source # enumFromTo ∷ MIRPot → MIRPot → [MIRPot] Source # enumFromThenTo ∷ MIRPot → MIRPot → MIRPot → [MIRPot] Source # | |
Generic MIRPot Source # | |
Show MIRPot Source # | |
DecCBOR MIRPot Source # | |
EncCBOR MIRPot Source # | |
NFData MIRPot Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
Eq MIRPot Source # | |
Ord MIRPot Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
NoThunks MIRPot Source # | |
type Rep MIRPot Source # | |
MIRTarget specifies if funds from either the reserves or the treasury are to be handed out to a collection of reward accounts or instead transfered to the opposite pot.
Instances
ToJSON MIRTarget Source # | |
Generic MIRTarget Source # | |
Show MIRTarget Source # | |
DecCBOR MIRTarget Source # | |
EncCBOR MIRTarget Source # | |
NFData MIRTarget Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
Eq MIRTarget Source # | |
Ord MIRTarget Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
NoThunks MIRTarget Source # | |
type Rep MIRTarget Source # | |
Defined in Cardano.Ledger.Shelley.TxCert type Rep MIRTarget = D1 ('MetaData "MIRTarget" "Cardano.Ledger.Shelley.TxCert" "cardano-ledger-shelley-1.16.0.0-inplace" 'False) (C1 ('MetaCons "StakeAddressesMIR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Credential 'Staking) DeltaCoin))) :+: C1 ('MetaCons "SendToOppositePotMIR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin))) |
isDelegation ∷ ShelleyEraTxCert era ⇒ TxCert era → Bool Source #
Check for ShelleyDelegCert
constructor
isRetirePool ∷ EraTxCert era ⇒ TxCert era → Bool Source #
Check for RetirePool
constructor
isGenesisDelegation ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool Source #
Check for GenesisDelegate
constructor
isInstantaneousRewards ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool Source #
isReservesMIRCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool Source #
isTreasuryMIRCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ TxCert era → Bool Source #
Serialization helpers
shelleyTxCertDelegDecoder ∷ ShelleyEraTxCert era ⇒ Word → Decoder s (Int, TxCert era) Source #
Deposits and Refunds
shelleyTotalDepositsTxCerts Source #
∷ (EraPParams era, Foldable f, EraTxCert era) | |
⇒ PParams era | |
→ (KeyHash 'StakePool → Bool) | Check whether a pool with a supplied PoolStakeId is already registered. |
→ f (TxCert era) | |
→ Coin |
Determine the total deposit amount needed from a TxBody. The block may (legitimately) contain multiple registration certificates for the same pool, where the first will be treated as a registration and any subsequent ones as re-registration. As such, we must only take a deposit for the first such registration. It is even possible for a single transaction to have multiple pool registration for the same pool, so as we process pool registrations, we must keep track of those that are already registered, so we do not add a Deposit for the same pool twice.
Note that this is not an issue for key registrations since subsequent registration certificates would be invalid.
shelleyTotalRefundsTxCerts Source #
∷ (EraPParams era, Foldable f, EraTxCert era) | |
⇒ PParams era | |
→ (StakeCredential → Maybe Coin) | Function that can lookup current deposit, in case when the stake key is registered. |
→ f (TxCert era) | |
→ Coin |
Compute the key deregistration refunds in a transaction
Re-exports
class (Era era, ToJSON (TxCert era), DecCBOR (TxCert era), EncCBOR (TxCert era), ToCBOR (TxCert era), FromCBOR (TxCert era), NoThunks (TxCert era), NFData (TxCert era), Show (TxCert era), Ord (TxCert era), Eq (TxCert era)) ⇒ EraTxCert era where Source #
type TxCert era = (r ∷ Type) | r → era Source #
type TxCertUpgradeError era Source #
type TxCertUpgradeError era = Void
upgradeTxCert ∷ TxCert (PreviousEra era) → Either (TxCertUpgradeError era) (TxCert era) Source #
Every era, except Shelley, must be able to upgrade a TxCert
from a previous
era. However, not all certificates can be upgraded, because some eras lose some of
the certificates, thus return type is an Either
. Eg. from Babbage to Conway: MIR
and Genesis certificates were removed.
getVKeyWitnessTxCert ∷ TxCert era → Maybe (KeyHash 'Witness) Source #
Return a witness key whenever a certificate requires one
getScriptWitnessTxCert ∷ TxCert era → Maybe ScriptHash Source #
Return a ScriptHash for certificate types that require a witness
mkRegPoolTxCert ∷ PoolParams → TxCert era Source #
getRegPoolTxCert ∷ TxCert era → Maybe PoolParams Source #
mkRetirePoolTxCert ∷ KeyHash 'StakePool → EpochNo → TxCert era Source #
getRetirePoolTxCert ∷ TxCert era → Maybe (KeyHash 'StakePool, EpochNo) Source #
lookupRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking) Source #
Extract staking credential from any certificate that can register such credential
lookupUnRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking) Source #
Extract staking credential from any certificate that can unregister such credential
getTotalDepositsTxCerts Source #
∷ Foldable f | |
⇒ PParams era | |
→ (KeyHash 'StakePool → Bool) | Check whether stake pool is registered or not |
→ f (TxCert era) | |
→ Coin |
Compute the total deposits from a list of certificates.
getTotalRefundsTxCerts Source #
∷ Foldable f | |
⇒ PParams era | |
→ (Credential 'Staking → Maybe Coin) | Lookup current deposit for Staking credential if one is registered |
→ (Credential 'DRepRole → Maybe Coin) | Lookup current deposit for DRep credential if one is registered |
→ f (TxCert era) | |
→ Coin |
Compute the total refunds from a list of certificates.
Instances
pattern RegPoolTxCert ∷ EraTxCert era ⇒ PoolParams → TxCert era Source #
RegPool !PoolParams | A stake pool registration certificate. |
RetirePool !(KeyHash 'StakePool) !EpochNo | A stake pool retirement certificate. |
Instances
ToJSON PoolCert | |
Generic PoolCert | |
Show PoolCert | |
EncCBOR PoolCert | |
NFData PoolCert | |
Defined in Cardano.Ledger.Core.TxCert | |
Eq PoolCert | |
Ord PoolCert | |
NoThunks PoolCert | |
type Rep PoolCert | |
Defined in Cardano.Ledger.Core.TxCert type Rep PoolCert = D1 ('MetaData "PoolCert" "Cardano.Ledger.Core.TxCert" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "RegPool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PoolParams)) :+: C1 ('MetaCons "RetirePool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool)) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 EpochNo))) |
isRegStakeTxCert ∷ EraTxCert era ⇒ TxCert era → Bool Source #
Check if supplied TxCert is a stake registering certificate
isUnRegStakeTxCert ∷ EraTxCert era ⇒ TxCert era → Bool Source #
Check if supplied TxCert is a stake un-registering certificate