{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
module Test.Cardano.Ledger.Conway.Examples (
ledgerExamples,
exampleConwayBasedTx,
exampleConwayBasedTopTx,
exampleAnchor,
exampleProposalProcedure,
exampleProposalProcedureHardForkInitiation,
exampleProposalProcedureNewConstitution,
exampleProposalProcedureNoConfidence,
exampleProposalProcedureParameterChange,
exampleProposalProcedureTreasuryWithdrawals,
exampleProposalProcedureUpdateCommittee,
) where
import Cardano.Ledger.Alonzo.Plutus.Context (EraPlutusTxInfo)
import Cardano.Ledger.Alonzo.Scripts (ExUnits (..))
import Cardano.Ledger.Alonzo.TxWits (Redeemers (..))
import Cardano.Ledger.BaseTypes
import Cardano.Ledger.Coin (Coin (..))
import Cardano.Ledger.Conway (ApplyTxError (ConwayApplyTxError), ConwayEra)
import Cardano.Ledger.Conway.Core
import Cardano.Ledger.Conway.Governance (
Constitution (..),
GovAction (..),
GovActionId (..),
GovActionIx (..),
GovPurposeId (..),
ProposalProcedure (..),
Vote (..),
Voter (..),
VotingProcedure (..),
VotingProcedures (..),
)
import Cardano.Ledger.Conway.Rules (ConwayDelegPredFailure (..))
import Cardano.Ledger.Conway.TxCert
import Cardano.Ledger.Credential (Credential (..))
import Cardano.Ledger.DRep (DRep (..))
import Cardano.Ledger.Mary.Value (MaryValue (..))
import Cardano.Ledger.Plutus.Data (
Data (..),
Datum (..),
dataToBinaryData,
)
import Cardano.Ledger.Plutus.Language (Language (..), plutusBinary)
import Cardano.Ledger.State (StakePoolParams (sppId))
import Cardano.Ledger.TxIn (TxId (..))
import qualified Data.List.NonEmpty as NE
import qualified Data.Map.Strict as Map
import qualified Data.MapExtras as Map
import Data.Maybe (fromJust)
import qualified Data.OSet.Strict as OSet
import Data.Sequence.Strict (StrictSeq)
import qualified Data.Sequence.Strict as StrictSeq
import Data.Typeable (Typeable)
import Lens.Micro
import qualified PlutusLedgerApi.Common as P
import Test.Cardano.Ledger.Alonzo.Arbitrary (alwaysSucceeds)
import Test.Cardano.Ledger.Alonzo.Examples (
addAlonzoToConwayExampleReqSigners,
exampleDatum,
mkAlonzoBasedLedgerExamples,
)
import Test.Cardano.Ledger.Babbage.Examples (
exampleBabbageBasedTopTx,
exampleBabbageBasedTx,
exampleBabbageNewEpochState,
)
import Test.Cardano.Ledger.Conway.Era ()
import Test.Cardano.Ledger.Conway.Genesis (expectedConwayGenesis)
import Test.Cardano.Ledger.Core.KeyPair (mkAddr)
import Test.Cardano.Ledger.Core.Rational (IsRatio (..))
import Test.Cardano.Ledger.Core.Utils (mkDummySafeHash)
import Test.Cardano.Ledger.Mary.Examples (exampleMultiAssetValue)
import Test.Cardano.Ledger.Plutus (alwaysSucceedsPlutus)
import Test.Cardano.Ledger.Shelley.Examples (
LedgerExamples (..),
addShelleyBasedTopTxExampleFee,
addShelleyToConwayTxCerts,
examplePayKey,
exampleStakeKey,
exampleStakePoolParams,
mkKeyHash,
mkScriptHash,
)
ledgerExamples :: LedgerExamples ConwayEra
ledgerExamples :: LedgerExamples ConwayEra
ledgerExamples =
ApplyTxError ConwayEra
-> NewEpochState ConwayEra
-> Tx TopTx ConwayEra
-> TranslationContext ConwayEra
-> LedgerExamples ConwayEra
forall era.
AlonzoEraPParams era =>
ApplyTxError era
-> NewEpochState era
-> Tx TopTx era
-> TranslationContext era
-> LedgerExamples era
mkAlonzoBasedLedgerExamples
( NonEmpty (ConwayLedgerPredFailure ConwayEra)
-> ApplyTxError ConwayEra
ConwayApplyTxError (NonEmpty (ConwayLedgerPredFailure ConwayEra)
-> ApplyTxError ConwayEra)
-> NonEmpty (ConwayLedgerPredFailure ConwayEra)
-> ApplyTxError ConwayEra
forall a b. (a -> b) -> a -> b
$
ConwayLedgerPredFailure ConwayEra
-> NonEmpty (ConwayLedgerPredFailure ConwayEra)
forall a. a -> NonEmpty a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ConwayLedgerPredFailure ConwayEra
-> NonEmpty (ConwayLedgerPredFailure ConwayEra))
-> ConwayLedgerPredFailure ConwayEra
-> NonEmpty (ConwayLedgerPredFailure ConwayEra)
forall a b. (a -> b) -> a -> b
$
ConwayDelegPredFailure ConwayEra
-> EraRuleFailure "LEDGER" ConwayEra
forall (rule :: Symbol) (t :: * -> *) era.
InjectRuleFailure rule t era =>
t era -> EraRuleFailure rule era
injectFailure (ConwayDelegPredFailure ConwayEra
-> EraRuleFailure "LEDGER" ConwayEra)
-> ConwayDelegPredFailure ConwayEra
-> EraRuleFailure "LEDGER" ConwayEra
forall a b. (a -> b) -> a -> b
$
forall era. KeyHash StakePool -> ConwayDelegPredFailure era
DelegateeStakePoolNotRegisteredDELEG @ConwayEra (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)
)
NewEpochState ConwayEra
forall era.
(BabbageEraTest era, Value era ~ MaryValue) =>
NewEpochState era
exampleBabbageNewEpochState
Tx TopTx ConwayEra
exampleConwayTx
TranslationContext ConwayEra
ConwayGenesis
expectedConwayGenesis
where
exampleConwayTx :: Tx TopTx ConwayEra
exampleConwayTx :: Tx TopTx ConwayEra
exampleConwayTx =
Tx TopTx ConwayEra
forall era.
(AlonzoEraTx era, ConwayEraTxBody era, AlonzoEraTxAuxData era,
EraPlutusTxInfo 'PlutusV1 era, EraPlutusTxInfo 'PlutusV2 era,
EraPlutusTxInfo 'PlutusV3 era, Value era ~ MaryValue) =>
Tx TopTx era
exampleConwayBasedTopTx
Tx TopTx ConwayEra
-> (Tx TopTx ConwayEra -> Tx TopTx ConwayEra) -> Tx TopTx ConwayEra
forall a b. a -> (a -> b) -> b
& Tx TopTx ConwayEra -> Tx TopTx ConwayEra
forall era. EraTx era => Tx TopTx era -> Tx TopTx era
addShelleyBasedTopTxExampleFee
Tx TopTx ConwayEra
-> (Tx TopTx ConwayEra -> Tx TopTx ConwayEra) -> Tx TopTx ConwayEra
forall a b. a -> (a -> b) -> b
& Tx TopTx ConwayEra -> Tx TopTx ConwayEra
forall era (l :: TxLevel).
(EraTx era, ShelleyEraTxCert era) =>
Tx l era -> Tx l era
addShelleyToConwayTxCerts
Tx TopTx ConwayEra
-> (Tx TopTx ConwayEra -> Tx TopTx ConwayEra) -> Tx TopTx ConwayEra
forall a b. a -> (a -> b) -> b
& Tx TopTx ConwayEra -> Tx TopTx ConwayEra
forall era (l :: TxLevel).
(AlonzoEraTxBody era, AtMostEra "Conway" era, EraTx era) =>
Tx l era -> Tx l era
addAlonzoToConwayExampleReqSigners
exampleConwayBasedTopTx ::
forall era.
( AlonzoEraTx era
, ConwayEraTxBody era
, AlonzoEraTxAuxData era
, EraPlutusTxInfo 'PlutusV1 era
, EraPlutusTxInfo 'PlutusV2 era
, EraPlutusTxInfo 'PlutusV3 era
, Value era ~ MaryValue
) =>
Tx TopTx era
exampleConwayBasedTopTx :: forall era.
(AlonzoEraTx era, ConwayEraTxBody era, AlonzoEraTxAuxData era,
EraPlutusTxInfo 'PlutusV1 era, EraPlutusTxInfo 'PlutusV2 era,
EraPlutusTxInfo 'PlutusV3 era, Value era ~ MaryValue) =>
Tx TopTx era
exampleConwayBasedTopTx =
Tx TopTx era
forall era.
(AlonzoEraTx era, BabbageEraTxBody era, AlonzoEraTxAuxData era,
Value era ~ MaryValue, EraPlutusTxInfo 'PlutusV1 era,
EraPlutusTxInfo 'PlutusV2 era) =>
Tx TopTx era
exampleBabbageBasedTopTx
Tx TopTx era -> (Tx TopTx era -> Tx TopTx era) -> Tx TopTx era
forall a b. a -> (a -> b) -> b
& Tx TopTx era -> Tx TopTx era
forall era (l :: TxLevel).
(EraTx era, ConwayEraTxBody era, Value era ~ MaryValue,
EraPlutusTxInfo 'PlutusV3 era, AlonzoEraTxAuxData era,
AlonzoEraTxWits era) =>
Tx l era -> Tx l era
addConwayBasedTxFeatures
exampleConwayBasedTx ::
forall era l.
( AlonzoEraTx era
, ConwayEraTxBody era
, AlonzoEraTxAuxData era
, EraPlutusTxInfo 'PlutusV1 era
, EraPlutusTxInfo 'PlutusV2 era
, EraPlutusTxInfo 'PlutusV3 era
, Value era ~ MaryValue
, Typeable l
) =>
Tx l era
exampleConwayBasedTx :: forall era (l :: TxLevel).
(AlonzoEraTx era, ConwayEraTxBody era, AlonzoEraTxAuxData era,
EraPlutusTxInfo 'PlutusV1 era, EraPlutusTxInfo 'PlutusV2 era,
EraPlutusTxInfo 'PlutusV3 era, Value era ~ MaryValue,
Typeable l) =>
Tx l era
exampleConwayBasedTx =
Tx l era
forall era (l :: TxLevel).
(AlonzoEraTx era, BabbageEraTxBody era, AlonzoEraTxAuxData era,
Value era ~ MaryValue, EraPlutusTxInfo 'PlutusV1 era,
EraPlutusTxInfo 'PlutusV2 era, Typeable l) =>
Tx l era
exampleBabbageBasedTx
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& Tx l era -> Tx l era
forall era (l :: TxLevel).
(EraTx era, ConwayEraTxBody era, Value era ~ MaryValue,
EraPlutusTxInfo 'PlutusV3 era, AlonzoEraTxAuxData era,
AlonzoEraTxWits era) =>
Tx l era -> Tx l era
addConwayBasedTxFeatures
addConwayBasedTxFeatures ::
forall era l.
( EraTx era
, ConwayEraTxBody era
, Value era ~ MaryValue
, EraPlutusTxInfo PlutusV3 era
, AlonzoEraTxAuxData era
, AlonzoEraTxWits era
) =>
Tx l era ->
Tx l era
addConwayBasedTxFeatures :: forall era (l :: TxLevel).
(EraTx era, ConwayEraTxBody era, Value era ~ MaryValue,
EraPlutusTxInfo 'PlutusV3 era, AlonzoEraTxAuxData era,
AlonzoEraTxWits era) =>
Tx l era -> Tx l era
addConwayBasedTxFeatures Tx l era
tx =
Tx l era
tx
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxWits era -> Identity (TxWits era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxWits era)
forall (l :: TxLevel). Lens' (Tx l era) (TxWits era)
witsTxL
((TxWits era -> Identity (TxWits era))
-> Tx l era -> Identity (Tx l era))
-> TxWits era -> Tx l era -> Tx l era
forall a s t. Monoid a => ASetter s t a a -> a -> s -> t
<>~ ( TxWits era
forall era. EraTxWits era => TxWits era
mkBasicTxWits
TxWits era -> (TxWits era -> TxWits era) -> TxWits era
forall a b. a -> (a -> b) -> b
& (Map ScriptHash (Script era)
-> Identity (Map ScriptHash (Script era)))
-> TxWits era -> Identity (TxWits era)
forall era.
EraTxWits era =>
Lens' (TxWits era) (Map ScriptHash (Script era))
Lens' (TxWits era) (Map ScriptHash (Script era))
scriptTxWitsL ((Map ScriptHash (Script era)
-> Identity (Map ScriptHash (Script era)))
-> TxWits era -> Identity (TxWits era))
-> Map ScriptHash (Script era) -> TxWits era -> TxWits era
forall a s t. Monoid a => ASetter s t a a -> a -> s -> t
<>~ (Script era -> ScriptHash)
-> [Script era] -> Map ScriptHash (Script era)
forall (f :: * -> *) k v.
(Foldable f, Ord k) =>
(v -> k) -> f v -> Map k v
Map.fromElems Script era -> ScriptHash
forall era. EraScript era => Script era -> ScriptHash
hashScript [forall (l :: Language) era.
(HasCallStack, EraPlutusTxInfo l era) =>
Natural -> Script era
alwaysSucceeds @'PlutusV3 Natural
3]
TxWits era -> (TxWits era -> TxWits era) -> TxWits era
forall a b. a -> (a -> b) -> b
& (Redeemers era -> Identity (Redeemers era))
-> TxWits era -> Identity (TxWits era)
forall era.
AlonzoEraTxWits era =>
Lens' (TxWits era) (Redeemers era)
Lens' (TxWits era) (Redeemers era)
rdmrsTxWitsL ((Redeemers era -> Identity (Redeemers era))
-> TxWits era -> Identity (TxWits era))
-> Redeemers era -> TxWits era -> TxWits era
forall a s t. Monoid a => ASetter s t a a -> a -> s -> t
<>~ Redeemers era
redeemers
)
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxAuxData era -> TxAuxData era) -> Tx l era -> Tx l era
forall era (l :: TxLevel).
EraTx era =>
(TxAuxData era -> TxAuxData era) -> Tx l era -> Tx l era
modifyTxAuxData
( (Map Language (NonEmpty PlutusBinary)
-> Identity (Map Language (NonEmpty PlutusBinary)))
-> TxAuxData era -> Identity (TxAuxData era)
forall era.
AlonzoEraTxAuxData era =>
Lens' (TxAuxData era) (Map Language (NonEmpty PlutusBinary))
Lens' (TxAuxData era) (Map Language (NonEmpty PlutusBinary))
plutusScriptsTxAuxDataL
((Map Language (NonEmpty PlutusBinary)
-> Identity (Map Language (NonEmpty PlutusBinary)))
-> TxAuxData era -> Identity (TxAuxData era))
-> (Map Language (NonEmpty PlutusBinary)
-> Map Language (NonEmpty PlutusBinary))
-> TxAuxData era
-> TxAuxData era
forall s t a b. ASetter s t a b -> (a -> b) -> s -> t
%~ (NonEmpty PlutusBinary
-> NonEmpty PlutusBinary -> NonEmpty PlutusBinary)
-> Language
-> NonEmpty PlutusBinary
-> Map Language (NonEmpty PlutusBinary)
-> Map Language (NonEmpty PlutusBinary)
forall k a. Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
Map.insertWith
NonEmpty PlutusBinary
-> NonEmpty PlutusBinary -> NonEmpty PlutusBinary
forall a. Semigroup a => a -> a -> a
(<>)
Language
PlutusV3
(PlutusBinary -> NonEmpty PlutusBinary
forall a. a -> NonEmpty a
NE.singleton (Plutus 'PlutusV3 -> PlutusBinary
forall (l :: Language). Plutus l -> PlutusBinary
plutusBinary (forall (l :: Language). Natural -> Plutus l
alwaysSucceedsPlutus @'PlutusV3 Natural
3)))
)
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL ((TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era))
-> ((StrictSeq (TxOut era) -> Identity (StrictSeq (TxOut era)))
-> TxBody l era -> Identity (TxBody l era))
-> (StrictSeq (TxOut era) -> Identity (StrictSeq (TxOut era)))
-> Tx l era
-> Identity (Tx l era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictSeq (TxOut era) -> Identity (StrictSeq (TxOut era)))
-> TxBody l era -> Identity (TxBody l era)
forall era (l :: TxLevel).
EraTxBody era =>
Lens' (TxBody l era) (StrictSeq (TxOut era))
forall (l :: TxLevel). Lens' (TxBody l era) (StrictSeq (TxOut era))
outputsTxBodyL
((StrictSeq (TxOut era) -> Identity (StrictSeq (TxOut era)))
-> Tx l era -> Identity (Tx l era))
-> StrictSeq (TxOut era) -> Tx l era -> Tx l era
forall a s t. Monoid a => ASetter s t a a -> a -> s -> t
<>~ [TxOut era] -> StrictSeq (TxOut era)
forall a. [a] -> StrictSeq a
StrictSeq.fromList
[ Addr -> Value era -> TxOut era
forall era.
(EraTxOut era, HasCallStack) =>
Addr -> Value era -> TxOut era
mkBasicTxOut
(KeyPair Payment -> KeyPair Staking -> Addr
forall p s.
(MakeCredential p Payment, MakeStakeReference s) =>
p -> s -> Addr
mkAddr KeyPair Payment
examplePayKey KeyPair Staking
exampleStakeKey)
(Int -> MaryValue
exampleMultiAssetValue Int
2)
TxOut era -> (TxOut era -> TxOut era) -> TxOut era
forall a b. a -> (a -> b) -> b
& (Datum era -> Identity (Datum era))
-> TxOut era -> Identity (TxOut era)
forall era. BabbageEraTxOut era => Lens' (TxOut era) (Datum era)
Lens' (TxOut era) (Datum era)
datumTxOutL ((Datum era -> Identity (Datum era))
-> TxOut era -> Identity (TxOut era))
-> Datum era -> TxOut era -> TxOut era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ BinaryData era -> Datum era
forall era. BinaryData era -> Datum era
Datum (Data era -> BinaryData era
forall era. Data era -> BinaryData era
dataToBinaryData Data era
forall era. Era era => Data era
exampleDatum)
TxOut era -> (TxOut era -> TxOut era) -> TxOut era
forall a b. a -> (a -> b) -> b
& (StrictMaybe (Script era) -> Identity (StrictMaybe (Script era)))
-> TxOut era -> Identity (TxOut era)
forall era.
BabbageEraTxOut era =>
Lens' (TxOut era) (StrictMaybe (Script era))
Lens' (TxOut era) (StrictMaybe (Script era))
referenceScriptTxOutL ((StrictMaybe (Script era) -> Identity (StrictMaybe (Script era)))
-> TxOut era -> Identity (TxOut era))
-> StrictMaybe (Script era) -> TxOut era -> TxOut era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Script era -> StrictMaybe (Script era)
forall a. a -> StrictMaybe a
SJust (forall (l :: Language) era.
(HasCallStack, EraPlutusTxInfo l era) =>
Natural -> Script era
alwaysSucceeds @'PlutusV3 Natural
3)
]
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL ((TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era))
-> ((StrictSeq (TxCert era) -> Identity (StrictSeq (TxCert era)))
-> TxBody l era -> Identity (TxBody l era))
-> (StrictSeq (TxCert era) -> Identity (StrictSeq (TxCert era)))
-> Tx l era
-> Identity (Tx l era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictSeq (TxCert era) -> Identity (StrictSeq (TxCert era)))
-> TxBody l era -> Identity (TxBody l era)
forall era (l :: TxLevel).
EraTxBody era =>
Lens' (TxBody l era) (StrictSeq (TxCert era))
forall (l :: TxLevel).
Lens' (TxBody l era) (StrictSeq (TxCert era))
certsTxBodyL ((StrictSeq (TxCert era) -> Identity (StrictSeq (TxCert era)))
-> Tx l era -> Identity (Tx l era))
-> StrictSeq (TxCert era) -> Tx l era -> Tx l era
forall a s t. Monoid a => ASetter s t a a -> a -> s -> t
<>~ StrictSeq (TxCert era)
forall era. ConwayEraTxCert era => StrictSeq (TxCert era)
exampleConwayCerts
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL ((TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era))
-> ((VotingProcedures era -> Identity (VotingProcedures era))
-> TxBody l era -> Identity (TxBody l era))
-> (VotingProcedures era -> Identity (VotingProcedures era))
-> Tx l era
-> Identity (Tx l era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (VotingProcedures era -> Identity (VotingProcedures era))
-> TxBody l era -> Identity (TxBody l era)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (VotingProcedures era)
forall (l :: TxLevel). Lens' (TxBody l era) (VotingProcedures era)
votingProceduresTxBodyL ((VotingProcedures era -> Identity (VotingProcedures era))
-> Tx l era -> Identity (Tx l era))
-> VotingProcedures era -> Tx l era -> Tx l era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ VotingProcedures era
forall era. VotingProcedures era
exampleVotingProcedures
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL ((TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era))
-> ((OSet (ProposalProcedure era)
-> Identity (OSet (ProposalProcedure era)))
-> TxBody l era -> Identity (TxBody l era))
-> (OSet (ProposalProcedure era)
-> Identity (OSet (ProposalProcedure era)))
-> Tx l era
-> Identity (Tx l era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (OSet (ProposalProcedure era)
-> Identity (OSet (ProposalProcedure era)))
-> TxBody l era -> Identity (TxBody l era)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (OSet (ProposalProcedure era))
forall (l :: TxLevel).
Lens' (TxBody l era) (OSet (ProposalProcedure era))
proposalProceduresTxBodyL
((OSet (ProposalProcedure era)
-> Identity (OSet (ProposalProcedure era)))
-> Tx l era -> Identity (Tx l era))
-> OSet (ProposalProcedure era) -> Tx l era -> Tx l era
forall a s t. Monoid a => ASetter s t a a -> a -> s -> t
<>~ [ProposalProcedure era] -> OSet (ProposalProcedure era)
forall a. Ord a => [a] -> OSet a
OSet.fromList
[ ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedure
, ProposalProcedure era
forall era. EraPParams era => ProposalProcedure era
exampleProposalProcedureParameterChange
, ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureHardForkInitiation
, ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureTreasuryWithdrawals
, ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureNoConfidence
, ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureUpdateCommittee
, ProposalProcedure era
forall era. ProposalProcedure era
exampleProposalProcedureNewConstitution
]
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL ((TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era))
-> ((StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> TxBody l era -> Identity (TxBody l era))
-> (StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> Tx l era
-> Identity (Tx l era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> TxBody l era -> Identity (TxBody l era)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) (StrictMaybe Coin)
forall (l :: TxLevel). Lens' (TxBody l era) (StrictMaybe Coin)
currentTreasuryValueTxBodyL ((StrictMaybe Coin -> Identity (StrictMaybe Coin))
-> Tx l era -> Identity (Tx l era))
-> StrictMaybe Coin -> Tx l era -> Tx l era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Coin -> StrictMaybe Coin
forall a. a -> StrictMaybe a
SJust (Integer -> Coin
Coin Integer
867530900000)
Tx l era -> (Tx l era -> Tx l era) -> Tx l era
forall a b. a -> (a -> b) -> b
& (TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era)
forall era (l :: TxLevel).
EraTx era =>
Lens' (Tx l era) (TxBody l era)
forall (l :: TxLevel). Lens' (Tx l era) (TxBody l era)
bodyTxL ((TxBody l era -> Identity (TxBody l era))
-> Tx l era -> Identity (Tx l era))
-> ((Coin -> Identity Coin)
-> TxBody l era -> Identity (TxBody l era))
-> (Coin -> Identity Coin)
-> Tx l era
-> Identity (Tx l era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Coin -> Identity Coin) -> TxBody l era -> Identity (TxBody l era)
forall era (l :: TxLevel).
ConwayEraTxBody era =>
Lens' (TxBody l era) Coin
forall (l :: TxLevel). Lens' (TxBody l era) Coin
treasuryDonationTxBodyL ((Coin -> Identity Coin) -> Tx l era -> Identity (Tx l era))
-> Coin -> Tx l era -> Tx l era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Integer -> Coin
Coin Integer
1000000
where
redeemers :: Redeemers era
redeemers =
Map (PlutusPurpose AsIx era) (Data era, ExUnits) -> Redeemers era
forall era.
AlonzoEraScript era =>
Map (PlutusPurpose AsIx era) (Data era, ExUnits) -> Redeemers era
Redeemers (Map (PlutusPurpose AsIx era) (Data era, ExUnits) -> Redeemers era)
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
-> Redeemers era
forall a b. (a -> b) -> a -> b
$
[(PlutusPurpose AsIx era, (Data era, ExUnits))]
-> Map (PlutusPurpose AsIx era) (Data era, ExUnits)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
[ (AsIx Word32 Voter -> PlutusPurpose AsIx era
forall era (f :: * -> * -> *).
ConwayEraScript era =>
f Word32 Voter -> PlutusPurpose f era
VotingPurpose (AsIx Word32 Voter -> PlutusPurpose AsIx era)
-> AsIx Word32 Voter -> PlutusPurpose AsIx era
forall a b. (a -> b) -> a -> b
$ Word32 -> AsIx Word32 Voter
forall ix it. ix -> AsIx ix it
AsIx Word32
0, (Data era
redeemerData, Natural -> Natural -> ExUnits
ExUnits Natural
5000 Natural
5001))
, (AsIx Word32 (ProposalProcedure era) -> PlutusPurpose AsIx era
forall era (f :: * -> * -> *).
ConwayEraScript era =>
f Word32 (ProposalProcedure era) -> PlutusPurpose f era
ProposingPurpose (AsIx Word32 (ProposalProcedure era) -> PlutusPurpose AsIx era)
-> AsIx Word32 (ProposalProcedure era) -> PlutusPurpose AsIx era
forall a b. (a -> b) -> a -> b
$ Word32 -> AsIx Word32 (ProposalProcedure era)
forall ix it. ix -> AsIx ix it
AsIx Word32
0, (Data era
redeemerData, Natural -> Natural -> ExUnits
ExUnits Natural
6000 Natural
6001))
]
redeemerData :: Data era
redeemerData = Data -> Data era
forall era. Era era => Data -> Data era
Data (Integer -> [Data] -> Data
P.Constr Integer
1 [[Data] -> Data
P.List [Integer -> Data
P.I Integer
1], [(Data, Data)] -> Data
P.Map [(Integer -> Data
P.I Integer
2, ByteString -> Data
P.B ByteString
"2")]])
exampleConwayCerts :: ConwayEraTxCert era => StrictSeq (TxCert era)
exampleConwayCerts :: forall era. ConwayEraTxCert era => StrictSeq (TxCert era)
exampleConwayCerts =
[TxCert era] -> StrictSeq (TxCert era)
forall a. [a] -> StrictSeq a
StrictSeq.fromList
[ Credential Staking -> Coin -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Coin -> TxCert era
RegDepositTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2)) (Integer -> Coin
Coin Integer
2000000)
, Credential Staking -> Coin -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Coin -> TxCert era
UnRegDepositTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2)) (Integer -> Coin
Coin Integer
2000000)
, Credential Staking -> Delegatee -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> TxCert era
DelegTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
3)) (KeyHash StakePool -> Delegatee
DelegStake (StakePoolParams -> KeyHash StakePool
sppId StakePoolParams
exampleStakePoolParams))
, Credential Staking -> Delegatee -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> TxCert era
DelegTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
4)) (DRep -> Delegatee
DelegVote (KeyHash DRepRole -> DRep
DRepKeyHash (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
5)))
, Credential Staking -> Delegatee -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> TxCert era
DelegTxCert
(KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
6))
(KeyHash StakePool -> DRep -> Delegatee
DelegStakeVote (StakePoolParams -> KeyHash StakePool
sppId StakePoolParams
exampleStakePoolParams) (KeyHash DRepRole -> DRep
DRepKeyHash (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
7)))
, Credential Staking -> Delegatee -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> TxCert era
DelegTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
13)) (DRep -> Delegatee
DelegVote (ScriptHash -> DRep
DRepScriptHash (Int -> ScriptHash
mkScriptHash Int
1)))
, Credential Staking -> Delegatee -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> TxCert era
DelegTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
14)) (DRep -> Delegatee
DelegVote DRep
DRepAlwaysAbstain)
, Credential Staking -> Delegatee -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> TxCert era
DelegTxCert (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
15)) (DRep -> Delegatee
DelegVote DRep
DRepAlwaysNoConfidence)
, Credential Staking -> Delegatee -> Coin -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential Staking -> Delegatee -> Coin -> TxCert era
RegDepositDelegTxCert
(KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
8))
(KeyHash StakePool -> Delegatee
DelegStake (StakePoolParams -> KeyHash StakePool
sppId StakePoolParams
exampleStakePoolParams))
(Integer -> Coin
Coin Integer
2000000)
, Credential DRepRole -> Coin -> StrictMaybe Anchor -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential DRepRole -> Coin -> StrictMaybe Anchor -> TxCert era
RegDRepTxCert (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
9)) (Integer -> Coin
Coin Integer
500000) (Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor)
, Credential DRepRole -> Coin -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential DRepRole -> Coin -> TxCert era
UnRegDRepTxCert (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
9)) (Integer -> Coin
Coin Integer
500001)
, Credential DRepRole -> StrictMaybe Anchor -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential DRepRole -> StrictMaybe Anchor -> TxCert era
UpdateDRepTxCert (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
9)) (Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor)
, Credential ColdCommitteeRole
-> Credential HotCommitteeRole -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential ColdCommitteeRole
-> Credential HotCommitteeRole -> TxCert era
AuthCommitteeHotKeyTxCert (KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
10)) (KeyHash HotCommitteeRole -> Credential HotCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash HotCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
11))
, Credential ColdCommitteeRole -> StrictMaybe Anchor -> TxCert era
forall era.
ConwayEraTxCert era =>
Credential ColdCommitteeRole -> StrictMaybe Anchor -> TxCert era
ResignCommitteeColdTxCert (KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
10)) (Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor)
]
exampleAnchor :: Anchor
exampleAnchor :: Anchor
exampleAnchor =
Anchor
{ anchorUrl :: Url
anchorUrl = Maybe Url -> Url
forall a. HasCallStack => Maybe a -> a
fromJust (Maybe Url -> Url) -> Maybe Url -> Url
forall a b. (a -> b) -> a -> b
$ Int -> Text -> Maybe Url
forall (m :: * -> *). MonadFail m => Int -> Text -> m Url
textToUrl Int
99 Text
"https://example.com"
, anchorDataHash :: SafeHash AnchorData
anchorDataHash = Int -> SafeHash AnchorData
forall a. Int -> SafeHash a
mkDummySafeHash Int
0
}
exampleVotingProcedures :: VotingProcedures era
exampleVotingProcedures :: forall era. VotingProcedures era
exampleVotingProcedures =
Map Voter (Map GovActionId (VotingProcedure era))
-> VotingProcedures era
forall era.
Map Voter (Map GovActionId (VotingProcedure era))
-> VotingProcedures era
VotingProcedures (Map Voter (Map GovActionId (VotingProcedure era))
-> VotingProcedures era)
-> Map Voter (Map GovActionId (VotingProcedure era))
-> VotingProcedures era
forall a b. (a -> b) -> a -> b
$
[(Voter, Map GovActionId (VotingProcedure era))]
-> Map Voter (Map GovActionId (VotingProcedure era))
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
[
( KeyHash StakePool -> Voter
StakePoolVoter (Int -> KeyHash StakePool
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)
, GovActionId
-> VotingProcedure era -> Map GovActionId (VotingProcedure era)
forall k a. k -> a -> Map k a
Map.singleton GovActionId
exampleGovActionId (Vote -> StrictMaybe Anchor -> VotingProcedure era
forall era. Vote -> StrictMaybe Anchor -> VotingProcedure era
VotingProcedure Vote
VoteYes (StrictMaybe Anchor -> VotingProcedure era)
-> StrictMaybe Anchor -> VotingProcedure era
forall a b. (a -> b) -> a -> b
$ Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor)
)
,
( Credential DRepRole -> Voter
DRepVoter (KeyHash DRepRole -> Credential DRepRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash DRepRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
2))
, GovActionId
-> VotingProcedure era -> Map GovActionId (VotingProcedure era)
forall k a. k -> a -> Map k a
Map.singleton GovActionId
exampleGovActionId (Vote -> StrictMaybe Anchor -> VotingProcedure era
forall era. Vote -> StrictMaybe Anchor -> VotingProcedure era
VotingProcedure Vote
VoteNo (StrictMaybe Anchor -> VotingProcedure era)
-> StrictMaybe Anchor -> VotingProcedure era
forall a b. (a -> b) -> a -> b
$ Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor)
)
,
( Credential HotCommitteeRole -> Voter
CommitteeVoter (KeyHash HotCommitteeRole -> Credential HotCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash HotCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
3))
, GovActionId
-> VotingProcedure era -> Map GovActionId (VotingProcedure era)
forall k a. k -> a -> Map k a
Map.singleton GovActionId
exampleGovActionId (Vote -> StrictMaybe Anchor -> VotingProcedure era
forall era. Vote -> StrictMaybe Anchor -> VotingProcedure era
VotingProcedure Vote
Abstain (Anchor -> StrictMaybe Anchor
forall a. a -> StrictMaybe a
SJust Anchor
exampleAnchor))
)
]
exampleGovActionId :: GovActionId
exampleGovActionId :: GovActionId
exampleGovActionId =
GovActionId
{ gaidTxId :: TxId
gaidTxId = SafeHash EraIndependentTxBody -> TxId
TxId (Int -> SafeHash EraIndependentTxBody
forall a. Int -> SafeHash a
mkDummySafeHash Int
1)
, gaidGovActionIx :: GovActionIx
gaidGovActionIx = Word16 -> GovActionIx
GovActionIx Word16
0
}
exampleProposalProcedure :: ProposalProcedure era
exampleProposalProcedure :: forall era. ProposalProcedure era
exampleProposalProcedure =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
1000000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))
, pProcGovAction :: GovAction era
pProcGovAction = GovAction era
forall era. GovAction era
InfoAction
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}
exampleProposalProcedureParameterChange :: EraPParams era => ProposalProcedure era
exampleProposalProcedureParameterChange :: forall era. EraPParams era => ProposalProcedure era
exampleProposalProcedureParameterChange =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
1000000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))
, pProcGovAction :: GovAction era
pProcGovAction =
StrictMaybe (GovPurposeId 'PParamUpdatePurpose)
-> PParamsUpdate era -> StrictMaybe ScriptHash -> GovAction era
forall era.
StrictMaybe (GovPurposeId 'PParamUpdatePurpose)
-> PParamsUpdate era -> StrictMaybe ScriptHash -> GovAction era
ParameterChange
(GovPurposeId 'PParamUpdatePurpose
-> StrictMaybe (GovPurposeId 'PParamUpdatePurpose)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'PParamUpdatePurpose
forall (p :: GovActionPurpose). GovActionId -> GovPurposeId p
GovPurposeId GovActionId
exampleGovActionId))
(PParamsUpdate era
forall era. EraPParams era => PParamsUpdate era
emptyPParamsUpdate PParamsUpdate era
-> (PParamsUpdate era -> PParamsUpdate era) -> PParamsUpdate era
forall a b. a -> (a -> b) -> b
& (StrictMaybe Word32 -> Identity (StrictMaybe Word32))
-> PParamsUpdate era -> Identity (PParamsUpdate era)
forall era.
EraPParams era =>
Lens' (PParamsUpdate era) (StrictMaybe Word32)
Lens' (PParamsUpdate era) (StrictMaybe Word32)
ppuMaxBBSizeL ((StrictMaybe Word32 -> Identity (StrictMaybe Word32))
-> PParamsUpdate era -> Identity (PParamsUpdate era))
-> StrictMaybe Word32 -> PParamsUpdate era -> PParamsUpdate era
forall s t a b. ASetter s t a b -> b -> s -> t
.~ Word32 -> StrictMaybe Word32
forall a. a -> StrictMaybe a
SJust Word32
65536)
(ScriptHash -> StrictMaybe ScriptHash
forall a. a -> StrictMaybe a
SJust (Int -> ScriptHash
mkScriptHash Int
1))
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}
exampleProposalProcedureHardForkInitiation :: ProposalProcedure era
exampleProposalProcedureHardForkInitiation :: forall era. ProposalProcedure era
exampleProposalProcedureHardForkInitiation =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
1000000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))
, pProcGovAction :: GovAction era
pProcGovAction =
StrictMaybe (GovPurposeId 'HardForkPurpose)
-> ProtVer -> GovAction era
forall era.
StrictMaybe (GovPurposeId 'HardForkPurpose)
-> ProtVer -> GovAction era
HardForkInitiation
(GovPurposeId 'HardForkPurpose
-> StrictMaybe (GovPurposeId 'HardForkPurpose)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'HardForkPurpose
forall (p :: GovActionPurpose). GovActionId -> GovPurposeId p
GovPurposeId GovActionId
exampleGovActionId))
(Version -> Natural -> ProtVer
ProtVer (forall (v :: Natural).
(KnownNat v, MinVersion <= v, v <= MaxVersion) =>
Version
natVersion @10) Natural
0)
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}
exampleProposalProcedureTreasuryWithdrawals :: ProposalProcedure era
exampleProposalProcedureTreasuryWithdrawals :: forall era. ProposalProcedure era
exampleProposalProcedureTreasuryWithdrawals =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
1000000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))
, pProcGovAction :: GovAction era
pProcGovAction =
Map AccountAddress Coin -> StrictMaybe ScriptHash -> GovAction era
forall era.
Map AccountAddress Coin -> StrictMaybe ScriptHash -> GovAction era
TreasuryWithdrawals
(AccountAddress -> Coin -> Map AccountAddress Coin
forall k a. k -> a -> Map k a
Map.singleton (Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))) (Integer -> Coin
Coin Integer
1000000000))
(ScriptHash -> StrictMaybe ScriptHash
forall a. a -> StrictMaybe a
SJust (Int -> ScriptHash
mkScriptHash Int
2))
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}
exampleProposalProcedureNoConfidence :: ProposalProcedure era
exampleProposalProcedureNoConfidence :: forall era. ProposalProcedure era
exampleProposalProcedureNoConfidence =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
1000000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))
, pProcGovAction :: GovAction era
pProcGovAction = StrictMaybe (GovPurposeId 'CommitteePurpose) -> GovAction era
forall era.
StrictMaybe (GovPurposeId 'CommitteePurpose) -> GovAction era
NoConfidence (GovPurposeId 'CommitteePurpose
-> StrictMaybe (GovPurposeId 'CommitteePurpose)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'CommitteePurpose
forall (p :: GovActionPurpose). GovActionId -> GovPurposeId p
GovPurposeId GovActionId
exampleGovActionId))
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}
exampleProposalProcedureUpdateCommittee :: ProposalProcedure era
exampleProposalProcedureUpdateCommittee :: forall era. ProposalProcedure era
exampleProposalProcedureUpdateCommittee =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
500000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
1)))
, pProcGovAction :: GovAction era
pProcGovAction =
StrictMaybe (GovPurposeId 'CommitteePurpose)
-> Set (Credential ColdCommitteeRole)
-> Map (Credential ColdCommitteeRole) EpochNo
-> UnitInterval
-> GovAction era
forall era.
StrictMaybe (GovPurposeId 'CommitteePurpose)
-> Set (Credential ColdCommitteeRole)
-> Map (Credential ColdCommitteeRole) EpochNo
-> UnitInterval
-> GovAction era
UpdateCommittee
(GovPurposeId 'CommitteePurpose
-> StrictMaybe (GovPurposeId 'CommitteePurpose)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'CommitteePurpose
forall (p :: GovActionPurpose). GovActionId -> GovPurposeId p
GovPurposeId GovActionId
exampleGovActionId))
Set (Credential ColdCommitteeRole)
forall a. Monoid a => a
mempty
(Credential ColdCommitteeRole
-> EpochNo -> Map (Credential ColdCommitteeRole) EpochNo
forall k a. k -> a -> Map k a
Map.singleton (KeyHash ColdCommitteeRole -> Credential ColdCommitteeRole
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash ColdCommitteeRole
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
12)) (Word64 -> EpochNo
EpochNo Word64
10))
(Integer
3 Integer -> Integer -> UnitInterval
forall r. (IsRatio r, HasCallStack) => Integer -> Integer -> r
%! Integer
5)
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}
exampleProposalProcedureNewConstitution :: ProposalProcedure era
exampleProposalProcedureNewConstitution :: forall era. ProposalProcedure era
exampleProposalProcedureNewConstitution =
ProposalProcedure
{ pProcDeposit :: Coin
pProcDeposit = Integer -> Coin
Coin Integer
1000000000
, pProcReturnAddr :: AccountAddress
pProcReturnAddr = Network -> AccountId -> AccountAddress
AccountAddress Network
Testnet (Credential Staking -> AccountId
AccountId (KeyHash Staking -> Credential Staking
forall (kr :: KeyRole). KeyHash kr -> Credential kr
KeyHashObj (Int -> KeyHash Staking
forall (discriminator :: KeyRole). Int -> KeyHash discriminator
mkKeyHash Int
0)))
, pProcGovAction :: GovAction era
pProcGovAction =
StrictMaybe (GovPurposeId 'ConstitutionPurpose)
-> Constitution era -> GovAction era
forall era.
StrictMaybe (GovPurposeId 'ConstitutionPurpose)
-> Constitution era -> GovAction era
NewConstitution
(GovPurposeId 'ConstitutionPurpose
-> StrictMaybe (GovPurposeId 'ConstitutionPurpose)
forall a. a -> StrictMaybe a
SJust (GovActionId -> GovPurposeId 'ConstitutionPurpose
forall (p :: GovActionPurpose). GovActionId -> GovPurposeId p
GovPurposeId GovActionId
exampleGovActionId))
Constitution
{ constitutionAnchor :: Anchor
constitutionAnchor = Anchor
exampleAnchor
, constitutionGuardrailsScriptHash :: StrictMaybe ScriptHash
constitutionGuardrailsScriptHash = ScriptHash -> StrictMaybe ScriptHash
forall a. a -> StrictMaybe a
SJust (Int -> ScriptHash
mkScriptHash Int
3)
}
, pProcAnchor :: Anchor
pProcAnchor = Anchor
exampleAnchor
}