{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Cardano.Ledger.Mary.Translation where
import Cardano.Ledger.Binary (DecoderError)
import Cardano.Ledger.CertState (CommitteeState (..))
import Cardano.Ledger.Genesis (NoGenesis (..))
import Cardano.Ledger.Mary.Core
import Cardano.Ledger.Mary.Era (MaryEra)
import Cardano.Ledger.Mary.Scripts (Timelock, translateTimelock)
import Cardano.Ledger.Mary.TxAuxData (AllegraTxAuxData (..))
import Cardano.Ledger.Shelley.LedgerState (
CertState (..),
DState (..),
EpochState (..),
LedgerState (..),
NewEpochState (..),
PState (..),
UTxOState (..),
VState (..),
)
import Cardano.Ledger.Shelley.PParams (ProposedPPUpdates (..), Update (..))
import Cardano.Ledger.Shelley.Tx (ShelleyTx)
import Cardano.Ledger.Shelley.TxOut (ShelleyTxOut)
import Cardano.Ledger.Shelley.TxWits (ShelleyTxWits)
import Cardano.Ledger.UTxO (UTxO (..))
import Data.Coerce (coerce)
import qualified Data.Map.Strict as Map
instance TranslateEra MaryEra NewEpochState where
translateEra :: TranslationContext MaryEra
-> NewEpochState (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra NewEpochState) (NewEpochState MaryEra)
translateEra TranslationContext MaryEra
ctxt NewEpochState (PreviousEra MaryEra)
nes =
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$
NewEpochState
{ nesEL :: EpochNo
nesEL = forall era. NewEpochState era -> EpochNo
nesEL NewEpochState (PreviousEra MaryEra)
nes
, nesBprev :: BlocksMade
nesBprev = forall era. NewEpochState era -> BlocksMade
nesBprev NewEpochState (PreviousEra MaryEra)
nes
, nesBcur :: BlocksMade
nesBcur = forall era. NewEpochState era -> BlocksMade
nesBcur NewEpochState (PreviousEra MaryEra)
nes
, nesEs :: EpochState MaryEra
nesEs = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. NewEpochState era -> EpochState era
nesEs NewEpochState (PreviousEra MaryEra)
nes
, nesRu :: StrictMaybe PulsingRewUpdate
nesRu = forall era. NewEpochState era -> StrictMaybe PulsingRewUpdate
nesRu NewEpochState (PreviousEra MaryEra)
nes
, nesPd :: PoolDistr
nesPd = forall era. NewEpochState era -> PoolDistr
nesPd NewEpochState (PreviousEra MaryEra)
nes
, stashedAVVMAddresses :: StashedAVVMAddresses MaryEra
stashedAVVMAddresses = ()
}
instance TranslateEra MaryEra ShelleyTx where
type TranslationError MaryEra ShelleyTx = DecoderError
translateEra :: TranslationContext MaryEra
-> ShelleyTx (PreviousEra MaryEra)
-> Except (TranslationError MaryEra ShelleyTx) (ShelleyTx MaryEra)
translateEra TranslationContext MaryEra
_ctx = forall era (ti :: * -> *) (to :: * -> *).
(Era era, ToCBOR (ti (PreviousEra era)),
DecCBOR (Annotator (to era))) =>
Text -> ti (PreviousEra era) -> Except DecoderError (to era)
translateEraThroughCBOR Text
"ShelleyTx"
instance TranslateEra MaryEra PParams
instance TranslateEra MaryEra PParamsUpdate
instance TranslateEra MaryEra FuturePParams where
translateEra :: TranslationContext MaryEra
-> FuturePParams (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra FuturePParams) (FuturePParams MaryEra)
translateEra TranslationContext MaryEra
ctxt = \case
FuturePParams (PreviousEra MaryEra)
NoPParamsUpdate -> forall (f :: * -> *) a. Applicative f => a -> f a
pure forall era. FuturePParams era
NoPParamsUpdate
DefinitePParamsUpdate PParams (PreviousEra MaryEra)
pp -> forall era. PParams era -> FuturePParams era
DefinitePParamsUpdate forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall era (f :: * -> *).
TranslateEra era f =>
TranslationContext era
-> f (PreviousEra era) -> Except (TranslationError era f) (f era)
translateEra TranslationContext MaryEra
ctxt PParams (PreviousEra MaryEra)
pp
PotentialPParamsUpdate Maybe (PParams (PreviousEra MaryEra))
mpp -> forall era. Maybe (PParams era) -> FuturePParams era
PotentialPParamsUpdate forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (forall era (f :: * -> *).
TranslateEra era f =>
TranslationContext era
-> f (PreviousEra era) -> Except (TranslationError era f) (f era)
translateEra TranslationContext MaryEra
ctxt) Maybe (PParams (PreviousEra MaryEra))
mpp
instance TranslateEra MaryEra EpochState where
translateEra :: TranslationContext MaryEra
-> EpochState (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra EpochState) (EpochState MaryEra)
translateEra TranslationContext MaryEra
ctxt EpochState (PreviousEra MaryEra)
es =
forall (m :: * -> *) a. Monad m => a -> m a
return
EpochState
{ esAccountState :: AccountState
esAccountState = forall era. EpochState era -> AccountState
esAccountState EpochState (PreviousEra MaryEra)
es
, esSnapshots :: SnapShots
esSnapshots = forall era. EpochState era -> SnapShots
esSnapshots EpochState (PreviousEra MaryEra)
es
, esLState :: LedgerState MaryEra
esLState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. EpochState era -> LedgerState era
esLState EpochState (PreviousEra MaryEra)
es
, esNonMyopic :: NonMyopic
esNonMyopic = forall era. EpochState era -> NonMyopic
esNonMyopic EpochState (PreviousEra MaryEra)
es
}
instance TranslateEra MaryEra DState where
translateEra :: TranslationContext MaryEra
-> DState (PreviousEra MaryEra)
-> Except (TranslationError MaryEra DState) (DState MaryEra)
translateEra TranslationContext MaryEra
_ DState {Map FutureGenDeleg GenDelegPair
InstantaneousRewards
UMap
GenDelegs
dsUnified :: forall era. DState era -> UMap
dsFutureGenDelegs :: forall era. DState era -> Map FutureGenDeleg GenDelegPair
dsGenDelegs :: forall era. DState era -> GenDelegs
dsIRewards :: forall era. DState era -> InstantaneousRewards
dsIRewards :: InstantaneousRewards
dsGenDelegs :: GenDelegs
dsFutureGenDelegs :: Map FutureGenDeleg GenDelegPair
dsUnified :: UMap
..} = forall (f :: * -> *) a. Applicative f => a -> f a
pure DState {Map FutureGenDeleg GenDelegPair
InstantaneousRewards
UMap
GenDelegs
dsUnified :: UMap
dsFutureGenDelegs :: Map FutureGenDeleg GenDelegPair
dsGenDelegs :: GenDelegs
dsIRewards :: InstantaneousRewards
dsIRewards :: InstantaneousRewards
dsGenDelegs :: GenDelegs
dsFutureGenDelegs :: Map FutureGenDeleg GenDelegPair
dsUnified :: UMap
..}
instance TranslateEra MaryEra CommitteeState where
translateEra :: TranslationContext MaryEra
-> CommitteeState (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra CommitteeState) (CommitteeState MaryEra)
translateEra TranslationContext MaryEra
_ CommitteeState {Map (Credential 'ColdCommitteeRole) CommitteeAuthorization
csCommitteeCreds :: forall era.
CommitteeState era
-> Map (Credential 'ColdCommitteeRole) CommitteeAuthorization
csCommitteeCreds :: Map (Credential 'ColdCommitteeRole) CommitteeAuthorization
..} = forall (f :: * -> *) a. Applicative f => a -> f a
pure CommitteeState {Map (Credential 'ColdCommitteeRole) CommitteeAuthorization
csCommitteeCreds :: Map (Credential 'ColdCommitteeRole) CommitteeAuthorization
csCommitteeCreds :: Map (Credential 'ColdCommitteeRole) CommitteeAuthorization
..}
instance TranslateEra MaryEra VState where
translateEra :: TranslationContext MaryEra
-> VState (PreviousEra MaryEra)
-> Except (TranslationError MaryEra VState) (VState MaryEra)
translateEra TranslationContext MaryEra
ctx VState {Map (Credential 'DRepRole) DRepState
CommitteeState (PreviousEra MaryEra)
EpochNo
vsDReps :: forall era. VState era -> Map (Credential 'DRepRole) DRepState
vsCommitteeState :: forall era. VState era -> CommitteeState era
vsNumDormantEpochs :: forall era. VState era -> EpochNo
vsNumDormantEpochs :: EpochNo
vsCommitteeState :: CommitteeState (PreviousEra MaryEra)
vsDReps :: Map (Credential 'DRepRole) DRepState
..} = do
CommitteeState MaryEra
committeeState <- forall era (f :: * -> *).
TranslateEra era f =>
TranslationContext era
-> f (PreviousEra era) -> Except (TranslationError era f) (f era)
translateEra TranslationContext MaryEra
ctx CommitteeState (PreviousEra MaryEra)
vsCommitteeState
forall (f :: * -> *) a. Applicative f => a -> f a
pure VState {vsCommitteeState :: CommitteeState MaryEra
vsCommitteeState = CommitteeState MaryEra
committeeState, Map (Credential 'DRepRole) DRepState
EpochNo
vsDReps :: Map (Credential 'DRepRole) DRepState
vsNumDormantEpochs :: EpochNo
vsNumDormantEpochs :: EpochNo
vsDReps :: Map (Credential 'DRepRole) DRepState
..}
instance TranslateEra MaryEra PState where
translateEra :: TranslationContext MaryEra
-> PState (PreviousEra MaryEra)
-> Except (TranslationError MaryEra PState) (PState MaryEra)
translateEra TranslationContext MaryEra
_ PState {Map (KeyHash 'StakePool) PoolParams
Map (KeyHash 'StakePool) Coin
Map (KeyHash 'StakePool) EpochNo
psStakePoolParams :: forall era. PState era -> Map (KeyHash 'StakePool) PoolParams
psFutureStakePoolParams :: forall era. PState era -> Map (KeyHash 'StakePool) PoolParams
psRetiring :: forall era. PState era -> Map (KeyHash 'StakePool) EpochNo
psDeposits :: forall era. PState era -> Map (KeyHash 'StakePool) Coin
psDeposits :: Map (KeyHash 'StakePool) Coin
psRetiring :: Map (KeyHash 'StakePool) EpochNo
psFutureStakePoolParams :: Map (KeyHash 'StakePool) PoolParams
psStakePoolParams :: Map (KeyHash 'StakePool) PoolParams
..} = forall (f :: * -> *) a. Applicative f => a -> f a
pure PState {Map (KeyHash 'StakePool) PoolParams
Map (KeyHash 'StakePool) Coin
Map (KeyHash 'StakePool) EpochNo
psStakePoolParams :: Map (KeyHash 'StakePool) PoolParams
psFutureStakePoolParams :: Map (KeyHash 'StakePool) PoolParams
psRetiring :: Map (KeyHash 'StakePool) EpochNo
psDeposits :: Map (KeyHash 'StakePool) Coin
psDeposits :: Map (KeyHash 'StakePool) Coin
psRetiring :: Map (KeyHash 'StakePool) EpochNo
psFutureStakePoolParams :: Map (KeyHash 'StakePool) PoolParams
psStakePoolParams :: Map (KeyHash 'StakePool) PoolParams
..}
instance TranslateEra MaryEra CertState where
translateEra :: TranslationContext MaryEra
-> CertState (PreviousEra MaryEra)
-> Except (TranslationError MaryEra CertState) (CertState MaryEra)
translateEra TranslationContext MaryEra
ctxt CertState (PreviousEra MaryEra)
ls =
forall (f :: * -> *) a. Applicative f => a -> f a
pure
CertState
{ certDState :: DState MaryEra
certDState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. CertState era -> DState era
certDState CertState (PreviousEra MaryEra)
ls
, certPState :: PState MaryEra
certPState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. CertState era -> PState era
certPState CertState (PreviousEra MaryEra)
ls
, certVState :: VState MaryEra
certVState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. CertState era -> VState era
certVState CertState (PreviousEra MaryEra)
ls
}
instance TranslateEra MaryEra LedgerState where
translateEra :: TranslationContext MaryEra
-> LedgerState (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra LedgerState) (LedgerState MaryEra)
translateEra TranslationContext MaryEra
ctxt LedgerState (PreviousEra MaryEra)
ls =
forall (m :: * -> *) a. Monad m => a -> m a
return
LedgerState
{ lsUTxOState :: UTxOState MaryEra
lsUTxOState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. LedgerState era -> UTxOState era
lsUTxOState LedgerState (PreviousEra MaryEra)
ls
, lsCertState :: CertState MaryEra
lsCertState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. LedgerState era -> CertState era
lsCertState LedgerState (PreviousEra MaryEra)
ls
}
instance TranslateEra MaryEra ProposedPPUpdates where
translateEra :: TranslationContext MaryEra
-> ProposedPPUpdates (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra ProposedPPUpdates)
(ProposedPPUpdates MaryEra)
translateEra TranslationContext MaryEra
ctxt (ProposedPPUpdates Map (KeyHash 'Genesis) (PParamsUpdate (PreviousEra MaryEra))
ppup) =
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall era.
Map (KeyHash 'Genesis) (PParamsUpdate era) -> ProposedPPUpdates era
ProposedPPUpdates forall a b. (a -> b) -> a -> b
$ forall a b k. (a -> b) -> Map k a -> Map k b
Map.map (forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt) Map (KeyHash 'Genesis) (PParamsUpdate (PreviousEra MaryEra))
ppup
instance TranslateEra MaryEra ShelleyGovState where
translateEra :: TranslationContext MaryEra
-> ShelleyGovState (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra ShelleyGovState)
(ShelleyGovState MaryEra)
translateEra TranslationContext MaryEra
ctxt ShelleyGovState (PreviousEra MaryEra)
ps =
forall (m :: * -> *) a. Monad m => a -> m a
return
ShelleyGovState
{ sgsCurProposals :: ProposedPPUpdates MaryEra
sgsCurProposals = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. ShelleyGovState era -> ProposedPPUpdates era
sgsCurProposals ShelleyGovState (PreviousEra MaryEra)
ps
, sgsFutureProposals :: ProposedPPUpdates MaryEra
sgsFutureProposals = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. ShelleyGovState era -> ProposedPPUpdates era
sgsFutureProposals ShelleyGovState (PreviousEra MaryEra)
ps
, sgsCurPParams :: PParams MaryEra
sgsCurPParams = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. ShelleyGovState era -> PParams era
sgsCurPParams ShelleyGovState (PreviousEra MaryEra)
ps
, sgsPrevPParams :: PParams MaryEra
sgsPrevPParams = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. ShelleyGovState era -> PParams era
sgsPrevPParams ShelleyGovState (PreviousEra MaryEra)
ps
, sgsFuturePParams :: FuturePParams MaryEra
sgsFuturePParams = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. ShelleyGovState era -> FuturePParams era
sgsFuturePParams ShelleyGovState (PreviousEra MaryEra)
ps
}
instance TranslateEra MaryEra UTxOState where
translateEra :: TranslationContext MaryEra
-> UTxOState (PreviousEra MaryEra)
-> Except (TranslationError MaryEra UTxOState) (UTxOState MaryEra)
translateEra TranslationContext MaryEra
ctxt UTxOState (PreviousEra MaryEra)
us =
forall (m :: * -> *) a. Monad m => a -> m a
return
UTxOState
{ utxosUtxo :: UTxO MaryEra
utxosUtxo = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. UTxOState era -> UTxO era
utxosUtxo UTxOState (PreviousEra MaryEra)
us
, utxosDeposited :: Coin
utxosDeposited = forall era. UTxOState era -> Coin
utxosDeposited UTxOState (PreviousEra MaryEra)
us
, utxosFees :: Coin
utxosFees = forall era. UTxOState era -> Coin
utxosFees UTxOState (PreviousEra MaryEra)
us
, utxosGovState :: GovState MaryEra
utxosGovState = forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b. (a -> b) -> a -> b
$ forall era. UTxOState era -> GovState era
utxosGovState UTxOState (PreviousEra MaryEra)
us
, utxosStakeDistr :: IncrementalStake
utxosStakeDistr = forall era. UTxOState era -> IncrementalStake
utxosStakeDistr UTxOState (PreviousEra MaryEra)
us
, utxosDonation :: Coin
utxosDonation = forall era. UTxOState era -> Coin
utxosDonation UTxOState (PreviousEra MaryEra)
us
}
instance TranslateEra MaryEra ShelleyTxOut where
translateEra :: TranslationContext MaryEra
-> ShelleyTxOut (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra ShelleyTxOut) (ShelleyTxOut MaryEra)
translateEra TranslationContext MaryEra
NoGenesis MaryEra
NoGenesis = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era.
(EraTxOut era, EraTxOut (PreviousEra era)) =>
TxOut (PreviousEra era) -> TxOut era
upgradeTxOut
instance TranslateEra MaryEra UTxO where
translateEra :: TranslationContext MaryEra
-> UTxO (PreviousEra MaryEra)
-> Except (TranslationError MaryEra UTxO) (UTxO MaryEra)
translateEra TranslationContext MaryEra
ctxt UTxO (PreviousEra MaryEra)
utxo =
forall (m :: * -> *) a. Monad m => a -> m a
return forall a b. (a -> b) -> a -> b
$ forall era. Map TxIn (TxOut era) -> UTxO era
UTxO (forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctxt forall a b k. (a -> b) -> Map k a -> Map k b
`Map.map` forall era. UTxO era -> Map TxIn (TxOut era)
unUTxO UTxO (PreviousEra MaryEra)
utxo)
instance TranslateEra MaryEra ShelleyTxWits where
type TranslationError MaryEra ShelleyTxWits = DecoderError
translateEra :: TranslationContext MaryEra
-> ShelleyTxWits (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra ShelleyTxWits) (ShelleyTxWits MaryEra)
translateEra TranslationContext MaryEra
_ctx = forall era (ti :: * -> *) (to :: * -> *).
(Era era, ToCBOR (ti (PreviousEra era)),
DecCBOR (Annotator (to era))) =>
Text -> ti (PreviousEra era) -> Except DecoderError (to era)
translateEraThroughCBOR Text
"ShelleyTxWits"
instance TranslateEra MaryEra Update where
translateEra :: TranslationContext MaryEra
-> Update (PreviousEra MaryEra)
-> Except (TranslationError MaryEra Update) (Update MaryEra)
translateEra TranslationContext MaryEra
_ (Update ProposedPPUpdates (PreviousEra MaryEra)
pp EpochNo
en) = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall era. ProposedPPUpdates era -> EpochNo -> Update era
Update (coerce :: forall a b. Coercible a b => a -> b
coerce ProposedPPUpdates (PreviousEra MaryEra)
pp) EpochNo
en
instance TranslateEra MaryEra Timelock where
translateEra :: TranslationContext MaryEra
-> Timelock (PreviousEra MaryEra)
-> Except (TranslationError MaryEra Timelock) (Timelock MaryEra)
translateEra TranslationContext MaryEra
_ = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall era1 era2.
(Era era1, Era era2) =>
Timelock era1 -> Timelock era2
translateTimelock
instance TranslateEra MaryEra AllegraTxAuxData where
translateEra :: TranslationContext MaryEra
-> AllegraTxAuxData (PreviousEra MaryEra)
-> Except
(TranslationError MaryEra AllegraTxAuxData)
(AllegraTxAuxData MaryEra)
translateEra TranslationContext MaryEra
ctx (AllegraTxAuxData Map Word64 Metadatum
md StrictSeq (Timelock AllegraEra)
as) =
forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall era.
Era era =>
Map Word64 Metadatum
-> StrictSeq (Timelock era) -> AllegraTxAuxData era
AllegraTxAuxData Map Word64 Metadatum
md forall a b. (a -> b) -> a -> b
$ forall era (f :: * -> *).
(TranslateEra era f, TranslationError era f ~ Void) =>
TranslationContext era -> f (PreviousEra era) -> f era
translateEra' TranslationContext MaryEra
ctx forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> StrictSeq (Timelock AllegraEra)
as