{-# LANGUAGE LambdaCase #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -Wno-orphans #-} module Cardano.Ledger.Mary.TxCert () where import Cardano.Ledger.Mary.Era (MaryEra) import Cardano.Ledger.Mary.PParams () import Cardano.Ledger.Shelley.TxCert ( EraTxCert (..), PoolCert (..), ShelleyDelegCert (..), ShelleyEraTxCert (..), ShelleyTxCert (..), getScriptWitnessShelleyTxCert, getVKeyWitnessShelleyTxCert, shelleyTotalDepositsTxCerts, shelleyTotalRefundsTxCerts, upgradeShelleyTxCert, pattern RegTxCert, pattern UnRegTxCert, ) instance EraTxCert MaryEra where type TxCert MaryEra = ShelleyTxCert MaryEra upgradeTxCert :: EraTxCert (PreviousEra MaryEra) => TxCert (PreviousEra MaryEra) -> Either (TxCertUpgradeError MaryEra) (TxCert MaryEra) upgradeTxCert = forall a b. b -> Either a b Right forall b c a. (b -> c) -> (a -> b) -> a -> c . forall era1 era2. ShelleyTxCert era1 -> ShelleyTxCert era2 upgradeShelleyTxCert getVKeyWitnessTxCert :: TxCert MaryEra -> Maybe (KeyHash 'Witness) getVKeyWitnessTxCert = forall era. ShelleyTxCert era -> Maybe (KeyHash 'Witness) getVKeyWitnessShelleyTxCert getScriptWitnessTxCert :: TxCert MaryEra -> Maybe ScriptHash getScriptWitnessTxCert = forall era. ShelleyTxCert era -> Maybe ScriptHash getScriptWitnessShelleyTxCert mkRegPoolTxCert :: PoolParams -> TxCert MaryEra mkRegPoolTxCert = forall era. PoolCert -> ShelleyTxCert era ShelleyTxCertPool forall b c a. (b -> c) -> (a -> b) -> a -> c . PoolParams -> PoolCert RegPool getRegPoolTxCert :: TxCert MaryEra -> Maybe PoolParams getRegPoolTxCert (ShelleyTxCertPool (RegPool PoolParams poolParams)) = forall a. a -> Maybe a Just PoolParams poolParams getRegPoolTxCert TxCert MaryEra _ = forall a. Maybe a Nothing mkRetirePoolTxCert :: KeyHash 'StakePool -> EpochNo -> TxCert MaryEra mkRetirePoolTxCert KeyHash 'StakePool poolId EpochNo epochNo = forall era. PoolCert -> ShelleyTxCert era ShelleyTxCertPool forall a b. (a -> b) -> a -> b $ KeyHash 'StakePool -> EpochNo -> PoolCert RetirePool KeyHash 'StakePool poolId EpochNo epochNo getRetirePoolTxCert :: TxCert MaryEra -> Maybe (KeyHash 'StakePool, EpochNo) getRetirePoolTxCert (ShelleyTxCertPool (RetirePool KeyHash 'StakePool poolId EpochNo epochNo)) = forall a. a -> Maybe a Just (KeyHash 'StakePool poolId, EpochNo epochNo) getRetirePoolTxCert TxCert MaryEra _ = forall a. Maybe a Nothing lookupRegStakeTxCert :: TxCert MaryEra -> Maybe (Credential 'Staking) lookupRegStakeTxCert = \case RegTxCert Credential 'Staking c -> forall a. a -> Maybe a Just Credential 'Staking c TxCert MaryEra _ -> forall a. Maybe a Nothing lookupUnRegStakeTxCert :: TxCert MaryEra -> Maybe (Credential 'Staking) lookupUnRegStakeTxCert = \case UnRegTxCert Credential 'Staking c -> forall a. a -> Maybe a Just Credential 'Staking c TxCert MaryEra _ -> forall a. Maybe a Nothing getTotalDepositsTxCerts :: forall (f :: * -> *). Foldable f => PParams MaryEra -> (KeyHash 'StakePool -> Bool) -> f (TxCert MaryEra) -> Coin getTotalDepositsTxCerts = forall era (f :: * -> *). (EraPParams era, Foldable f, EraTxCert era) => PParams era -> (KeyHash 'StakePool -> Bool) -> f (TxCert era) -> Coin shelleyTotalDepositsTxCerts getTotalRefundsTxCerts :: forall (f :: * -> *). Foldable f => PParams MaryEra -> (Credential 'Staking -> Maybe Coin) -> (Credential 'DRepRole -> Maybe Coin) -> f (TxCert MaryEra) -> Coin getTotalRefundsTxCerts PParams MaryEra pp Credential 'Staking -> Maybe Coin lookupStakeDeposit Credential 'DRepRole -> Maybe Coin _ = forall era (f :: * -> *). (EraPParams era, Foldable f, EraTxCert era) => PParams era -> (Credential 'Staking -> Maybe Coin) -> f (TxCert era) -> Coin shelleyTotalRefundsTxCerts PParams MaryEra pp Credential 'Staking -> Maybe Coin lookupStakeDeposit instance ShelleyEraTxCert MaryEra where mkRegTxCert :: Credential 'Staking -> TxCert MaryEra mkRegTxCert = forall era. ShelleyDelegCert -> ShelleyTxCert era ShelleyTxCertDelegCert forall b c a. (b -> c) -> (a -> b) -> a -> c . Credential 'Staking -> ShelleyDelegCert ShelleyRegCert getRegTxCert :: TxCert MaryEra -> Maybe (Credential 'Staking) getRegTxCert (ShelleyTxCertDelegCert (ShelleyRegCert Credential 'Staking c)) = forall a. a -> Maybe a Just Credential 'Staking c getRegTxCert TxCert MaryEra _ = forall a. Maybe a Nothing mkUnRegTxCert :: Credential 'Staking -> TxCert MaryEra mkUnRegTxCert = forall era. ShelleyDelegCert -> ShelleyTxCert era ShelleyTxCertDelegCert forall b c a. (b -> c) -> (a -> b) -> a -> c . Credential 'Staking -> ShelleyDelegCert ShelleyUnRegCert getUnRegTxCert :: TxCert MaryEra -> Maybe (Credential 'Staking) getUnRegTxCert (ShelleyTxCertDelegCert (ShelleyUnRegCert Credential 'Staking c)) = forall a. a -> Maybe a Just Credential 'Staking c getUnRegTxCert TxCert MaryEra _ = forall a. Maybe a Nothing mkDelegStakeTxCert :: Credential 'Staking -> KeyHash 'StakePool -> TxCert MaryEra mkDelegStakeTxCert Credential 'Staking c KeyHash 'StakePool kh = forall era. ShelleyDelegCert -> ShelleyTxCert era ShelleyTxCertDelegCert forall a b. (a -> b) -> a -> b $ Credential 'Staking -> KeyHash 'StakePool -> ShelleyDelegCert ShelleyDelegCert Credential 'Staking c KeyHash 'StakePool kh getDelegStakeTxCert :: TxCert MaryEra -> Maybe (Credential 'Staking, KeyHash 'StakePool) getDelegStakeTxCert (ShelleyTxCertDelegCert (ShelleyDelegCert Credential 'Staking c KeyHash 'StakePool kh)) = forall a. a -> Maybe a Just (Credential 'Staking c, KeyHash 'StakePool kh) getDelegStakeTxCert TxCert MaryEra _ = forall a. Maybe a Nothing mkGenesisDelegTxCert :: ProtVerAtMost MaryEra 8 => GenesisDelegCert -> TxCert MaryEra mkGenesisDelegTxCert = forall era. GenesisDelegCert -> ShelleyTxCert era ShelleyTxCertGenesisDeleg getGenesisDelegTxCert :: ProtVerAtMost MaryEra 8 => TxCert MaryEra -> Maybe GenesisDelegCert getGenesisDelegTxCert (ShelleyTxCertGenesisDeleg GenesisDelegCert c) = forall a. a -> Maybe a Just GenesisDelegCert c getGenesisDelegTxCert TxCert MaryEra _ = forall a. Maybe a Nothing mkMirTxCert :: ProtVerAtMost MaryEra 8 => MIRCert -> TxCert MaryEra mkMirTxCert = forall era. MIRCert -> ShelleyTxCert era ShelleyTxCertMir getMirTxCert :: ProtVerAtMost MaryEra 8 => TxCert MaryEra -> Maybe MIRCert getMirTxCert (ShelleyTxCertMir MIRCert c) = forall a. a -> Maybe a Just MIRCert c getMirTxCert TxCert MaryEra _ = forall a. Maybe a Nothing