Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class EraTxCert era ⇒ ShelleyEraTxCert era where
- mkRegTxCert ∷ StakeCredential (EraCrypto era) → TxCert era
- getRegTxCert ∷ TxCert era → Maybe (StakeCredential (EraCrypto era))
- mkUnRegTxCert ∷ StakeCredential (EraCrypto era) → TxCert era
- getUnRegTxCert ∷ TxCert era → Maybe (StakeCredential (EraCrypto era))
- mkDelegStakeTxCert ∷ StakeCredential (EraCrypto era) → KeyHash 'StakePool (EraCrypto era) → TxCert era
- getDelegStakeTxCert ∷ TxCert era → Maybe (StakeCredential (EraCrypto era), KeyHash 'StakePool (EraCrypto era))
- mkGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ GenesisDelegCert (EraCrypto era) → TxCert era
- getGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe (GenesisDelegCert (EraCrypto era))
- mkMirTxCert ∷ ProtVerAtMost era 8 ⇒ MIRCert (EraCrypto era) → TxCert era
- getMirTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe (MIRCert (EraCrypto era))
- pattern MirTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ MIRCert (EraCrypto era) → TxCert era
- pattern GenesisDelegTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ KeyHash 'Genesis (EraCrypto era) → KeyHash 'GenesisDelegate (EraCrypto era) → VRFVerKeyHash 'GenDelegVRF (EraCrypto era) → TxCert era
- pattern RegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential (EraCrypto era) → TxCert era
- pattern UnRegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential (EraCrypto era) → TxCert era
- pattern DelegStakeTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential (EraCrypto era) → KeyHash 'StakePool (EraCrypto era) → TxCert era
- data ShelleyDelegCert c
- = ShelleyRegCert !(StakeCredential c)
- | ShelleyUnRegCert !(StakeCredential c)
- | ShelleyDelegCert !(StakeCredential c) !(KeyHash 'StakePool c)
- getVKeyWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe (KeyHash 'Witness (EraCrypto era))
- getScriptWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe (ScriptHash (EraCrypto era))
- data ShelleyTxCert era
- = ShelleyTxCertDelegCert !(ShelleyDelegCert (EraCrypto era))
- | ShelleyTxCertPool !(PoolCert (EraCrypto era))
- | ShelleyTxCertGenesisDeleg !(GenesisDelegCert (EraCrypto era))
- | ShelleyTxCertMir !(MIRCert (EraCrypto era))
- upgradeShelleyTxCert ∷ EraCrypto era1 ~ EraCrypto era2 ⇒ ShelleyTxCert era1 → ShelleyTxCert era2
- data GenesisDelegCert c = GenesisDelegCert !(KeyHash 'Genesis c) !(KeyHash 'GenesisDelegate c) !(VRFVerKeyHash 'GenDelegVRF c)
- genesisCWitness ∷ GenesisDelegCert c → KeyHash 'Genesis c
- genesisKeyHashWitness ∷ GenesisDelegCert c → KeyHash 'Witness c
- data MIRCert c = MIRCert {
- mirPot ∷ !MIRPot
- mirRewards ∷ !(MIRTarget c)
- data MIRPot
- data MIRTarget c
- = StakeAddressesMIR !(Map (Credential 'Staking c) DeltaCoin)
- | SendToOppositePotMIR !Coin
- 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 ∷ Crypto c ⇒ ShelleyDelegCert c → Encoding
- encodePoolCert ∷ Crypto c ⇒ PoolCert c → Encoding
- encodeGenesisDelegCert ∷ Crypto c ⇒ GenesisDelegCert c → Encoding
- shelleyTotalDepositsTxCerts ∷ (EraPParams era, Foldable f, EraTxCert era) ⇒ PParams era → (KeyHash 'StakePool (EraCrypto era) → Bool) → f (TxCert era) → Coin
- shelleyTotalRefundsTxCerts ∷ (EraPParams era, Foldable f, EraTxCert era) ⇒ PParams era → (StakeCredential (EraCrypto era) → 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 (EraCrypto era))
- getScriptWitnessTxCert ∷ TxCert era → Maybe (ScriptHash (EraCrypto era))
- mkRegPoolTxCert ∷ PoolParams (EraCrypto era) → TxCert era
- getRegPoolTxCert ∷ TxCert era → Maybe (PoolParams (EraCrypto era))
- mkRetirePoolTxCert ∷ KeyHash 'StakePool (EraCrypto era) → EpochNo → TxCert era
- getRetirePoolTxCert ∷ TxCert era → Maybe (KeyHash 'StakePool (EraCrypto era), EpochNo)
- lookupRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking (EraCrypto era))
- lookupUnRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking (EraCrypto era))
- getTotalDepositsTxCerts ∷ Foldable f ⇒ PParams era → (KeyHash 'StakePool (EraCrypto era) → Bool) → f (TxCert era) → Coin
- getTotalRefundsTxCerts ∷ Foldable f ⇒ PParams era → (Credential 'Staking (EraCrypto era) → Maybe Coin) → (Credential 'DRepRole (EraCrypto era) → Maybe Coin) → f (TxCert era) → Coin
- pattern RegPoolTxCert ∷ EraTxCert era ⇒ PoolParams (EraCrypto era) → TxCert era
- pattern RetirePoolTxCert ∷ EraTxCert era ⇒ KeyHash 'StakePool (EraCrypto era) → EpochNo → TxCert era
- data PoolCert c
- = RegPool !(PoolParams c)
- | RetirePool !(KeyHash 'StakePool c) !EpochNo
- isRegStakeTxCert ∷ EraTxCert era ⇒ TxCert era → Bool
- isUnRegStakeTxCert ∷ EraTxCert era ⇒ TxCert era → Bool
Documentation
class EraTxCert era ⇒ ShelleyEraTxCert era where Source #
mkRegTxCert ∷ StakeCredential (EraCrypto era) → TxCert era Source #
getRegTxCert ∷ TxCert era → Maybe (StakeCredential (EraCrypto era)) Source #
mkUnRegTxCert ∷ StakeCredential (EraCrypto era) → TxCert era Source #
getUnRegTxCert ∷ TxCert era → Maybe (StakeCredential (EraCrypto era)) Source #
mkDelegStakeTxCert ∷ StakeCredential (EraCrypto era) → KeyHash 'StakePool (EraCrypto era) → TxCert era Source #
getDelegStakeTxCert ∷ TxCert era → Maybe (StakeCredential (EraCrypto era), KeyHash 'StakePool (EraCrypto era)) Source #
mkGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ GenesisDelegCert (EraCrypto era) → TxCert era Source #
getGenesisDelegTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe (GenesisDelegCert (EraCrypto era)) Source #
mkMirTxCert ∷ ProtVerAtMost era 8 ⇒ MIRCert (EraCrypto era) → TxCert era Source #
getMirTxCert ∷ ProtVerAtMost era 8 ⇒ TxCert era → Maybe (MIRCert (EraCrypto era)) Source #
Instances
pattern MirTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ MIRCert (EraCrypto era) → TxCert era Source #
pattern GenesisDelegTxCert ∷ (ShelleyEraTxCert era, ProtVerAtMost era 8) ⇒ KeyHash 'Genesis (EraCrypto era) → KeyHash 'GenesisDelegate (EraCrypto era) → VRFVerKeyHash 'GenDelegVRF (EraCrypto era) → TxCert era Source #
pattern RegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential (EraCrypto era) → TxCert era Source #
pattern UnRegTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential (EraCrypto era) → TxCert era Source #
pattern DelegStakeTxCert ∷ ShelleyEraTxCert era ⇒ StakeCredential (EraCrypto era) → KeyHash 'StakePool (EraCrypto era) → TxCert era Source #
data ShelleyDelegCert c Source #
ShelleyRegCert !(StakeCredential c) | A stake credential registration certificate. |
ShelleyUnRegCert !(StakeCredential c) | A stake credential deregistration certificate. |
ShelleyDelegCert !(StakeCredential c) !(KeyHash 'StakePool c) | A stake delegation certificate. |
Instances
getVKeyWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe (KeyHash 'Witness (EraCrypto era)) Source #
getScriptWitnessShelleyTxCert ∷ ShelleyTxCert era → Maybe (ScriptHash (EraCrypto era)) Source #
data ShelleyTxCert era Source #
A heavyweight certificate.
ShelleyTxCertDelegCert !(ShelleyDelegCert (EraCrypto era)) | |
ShelleyTxCertPool !(PoolCert (EraCrypto era)) | |
ShelleyTxCertGenesisDeleg !(GenesisDelegCert (EraCrypto era)) | |
ShelleyTxCertMir !(MIRCert (EraCrypto era)) |
Instances
upgradeShelleyTxCert ∷ EraCrypto era1 ~ EraCrypto era2 ⇒ ShelleyTxCert era1 → ShelleyTxCert era2 Source #
GenesisDelegCert
data GenesisDelegCert c Source #
Genesis key delegation certificate
GenesisDelegCert !(KeyHash 'Genesis c) !(KeyHash 'GenesisDelegate c) !(VRFVerKeyHash 'GenDelegVRF c) |
Instances
genesisCWitness ∷ GenesisDelegCert c → KeyHash 'Genesis c Source #
MIRCert
Move instantaneous rewards certificate
MIRCert | |
|
Instances
Crypto c ⇒ ToJSON (MIRCert c) Source # | |
Generic (MIRCert c) Source # | |
Show (MIRCert c) Source # | |
Crypto c ⇒ DecCBOR (MIRCert c) Source # | |
Crypto c ⇒ EncCBOR (MIRCert c) Source # | |
NFData (MIRCert c) Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
Eq (MIRCert c) Source # | |
Ord (MIRCert c) Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
NoThunks (MIRCert c) Source # | |
type Rep (MIRCert c) Source # | |
Defined in Cardano.Ledger.Shelley.TxCert type Rep (MIRCert c) = D1 ('MetaData "MIRCert" "Cardano.Ledger.Shelley.TxCert" "cardano-ledger-shelley-1.15.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 c)))) |
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
Crypto c ⇒ ToJSON (MIRTarget c) Source # | |
Generic (MIRTarget c) Source # | |
Show (MIRTarget c) Source # | |
Crypto c ⇒ DecCBOR (MIRTarget c) Source # | |
Crypto c ⇒ EncCBOR (MIRTarget c) Source # | |
NFData (MIRTarget c) Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
Eq (MIRTarget c) Source # | |
Ord (MIRTarget c) Source # | |
Defined in Cardano.Ledger.Shelley.TxCert | |
NoThunks (MIRTarget c) Source # | |
type Rep (MIRTarget c) Source # | |
Defined in Cardano.Ledger.Shelley.TxCert type Rep (MIRTarget c) = D1 ('MetaData "MIRTarget" "Cardano.Ledger.Shelley.TxCert" "cardano-ledger-shelley-1.15.0.0-inplace" 'False) (C1 ('MetaCons "StakeAddressesMIR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map (Credential 'Staking c) 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 #
encodeShelleyDelegCert ∷ Crypto c ⇒ ShelleyDelegCert c → Encoding Source #
encodeGenesisDelegCert ∷ Crypto c ⇒ GenesisDelegCert c → Encoding Source #
Deposits and Refunds
shelleyTotalDepositsTxCerts Source #
∷ (EraPParams era, Foldable f, EraTxCert era) | |
⇒ PParams era | |
→ (KeyHash 'StakePool (EraCrypto era) → 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 (EraCrypto era) → 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 (EraCrypto era)) Source #
Return a witness key whenever a certificate requires one
getScriptWitnessTxCert ∷ TxCert era → Maybe (ScriptHash (EraCrypto era)) Source #
Return a ScriptHash for certificate types that require a witness
mkRegPoolTxCert ∷ PoolParams (EraCrypto era) → TxCert era Source #
getRegPoolTxCert ∷ TxCert era → Maybe (PoolParams (EraCrypto era)) Source #
mkRetirePoolTxCert ∷ KeyHash 'StakePool (EraCrypto era) → EpochNo → TxCert era Source #
getRetirePoolTxCert ∷ TxCert era → Maybe (KeyHash 'StakePool (EraCrypto era), EpochNo) Source #
lookupRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking (EraCrypto era)) Source #
Extract staking credential from any certificate that can register such credential
lookupUnRegStakeTxCert ∷ TxCert era → Maybe (Credential 'Staking (EraCrypto era)) Source #
Extract staking credential from any certificate that can unregister such credential
getTotalDepositsTxCerts Source #
∷ Foldable f | |
⇒ PParams era | |
→ (KeyHash 'StakePool (EraCrypto era) → 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 (EraCrypto era) → Maybe Coin) | Lookup current deposit for Staking credential if one is registered |
→ (Credential 'DRepRole (EraCrypto era) → 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 (EraCrypto era) → TxCert era Source #
pattern RetirePoolTxCert ∷ EraTxCert era ⇒ KeyHash 'StakePool (EraCrypto era) → EpochNo → TxCert era Source #
RegPool !(PoolParams c) | A stake pool registration certificate. |
RetirePool !(KeyHash 'StakePool c) !EpochNo | A stake pool retirement certificate. |
Instances
Crypto c ⇒ ToJSON (PoolCert c) | |
Generic (PoolCert c) | |
Show (PoolCert c) | |
Crypto c ⇒ EncCBOR (PoolCert c) | |
NFData (PoolCert c) | |
Defined in Cardano.Ledger.Core.TxCert | |
Eq (PoolCert c) | |
Ord (PoolCert c) | |
Defined in Cardano.Ledger.Core.TxCert | |
NoThunks (PoolCert c) | |
type Rep (PoolCert c) | |
Defined in Cardano.Ledger.Core.TxCert type Rep (PoolCert c) = D1 ('MetaData "PoolCert" "Cardano.Ledger.Core.TxCert" "cardano-ledger-core-1.16.0.0-inplace" 'False) (C1 ('MetaCons "RegPool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (PoolParams c))) :+: C1 ('MetaCons "RetirePool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (KeyHash 'StakePool c)) :*: 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