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