quickcheck-contractmodel-0.1.4.1
Safe HaskellNone
LanguageHaskell2010

Test.QuickCheck.ContractModel.ThreatModel.TxModifier

Synopsis

Documentation

data Output Source #

A transaction output paired with its index in the transaction.

Constructors

Output 

Fields

data Input Source #

A transaction input reference togheter with the corresponding TxOut from the UTxO set.

Constructors

Input 

Fields

class IsInputOrOutput t where Source #

Functions common to both Inputs and Outputs.

Methods

changeAddressOf :: t -> AddressAny -> TxModifier Source #

Change the target address of an input or an output. For outputs this means redirecting an output to a different address, and for inputs it means modifying the UTxO set, changing the owner of the given input.

Note: Does not work for script inputs.

changeValueOf :: t -> Value -> TxModifier Source #

Change the value of an input or an output.

changeDatumOf :: t -> Datum -> TxModifier Source #

Change the datum on an input or an output.

addressOf :: t -> AddressAny Source #

Get the address (pubkey or script address) of an input or an output.

valueOf :: t -> Value Source #

Get the value at an input or an output.

type Datum = TxOutDatum CtxTx Era Source #

Type synonym for datums. The CtxTx context means that the actual datum value can be present, not just the hash.

type Redeemer = ScriptData Source #

Redeemers are plain ScriptData.

newtype TxModifier Source #

The type of transaction modifiers. When combined using the monoid instance, individual modifications are applied in left-to-right order.

Constructors

TxModifier [TxMod] 

data TxMod where Source #

Constructors

RemoveInput :: TxIn -> TxMod 
RemoveOutput :: TxIx -> TxMod 
ChangeOutput :: TxIx -> Maybe AddressAny -> Maybe Value -> Maybe Datum -> TxMod 
ChangeInput :: TxIn -> Maybe AddressAny -> Maybe Value -> Maybe Datum -> TxMod 
ChangeScriptInput :: TxIn -> Maybe Value -> Maybe Datum -> Maybe Redeemer -> TxMod 
ChangeValidityRange :: Maybe (TxValidityLowerBound Era) -> Maybe (TxValidityUpperBound Era) -> TxMod 
AddOutput :: AddressAny -> Value -> Datum -> TxMod 
AddInput :: AddressAny -> Value -> Datum -> TxMod 
AddPlutusScriptInput :: PlutusScript PlutusScriptV2 -> Value -> Datum -> Redeemer -> TxMod 
AddSimpleScriptInput :: SimpleScript SimpleScriptV2 -> Value -> TxMod 
ReplaceTx :: Tx Era -> UTxO Era -> TxMod 

Instances

Instances details
Show TxMod Source # 
Instance details

Defined in Test.QuickCheck.ContractModel.ThreatModel.TxModifier

applyTxModifier :: Tx Era -> UTxO Era -> TxModifier -> (Tx Era, UTxO Era) Source #

applyTxMod :: Tx Era -> UTxO Era -> TxMod -> (Tx Era, UTxO Era) Source #

addOutput :: AddressAny -> Value -> Datum -> TxModifier Source #

Add a new output of any type (public key or script)

removeOutput :: Output -> TxModifier Source #

Remove an output of any type.

addKeyInput :: AddressAny -> Value -> Datum -> TxModifier Source #

Add a new public key input.

removeInput :: Input -> TxModifier Source #

Remove an input of any type.

addPlutusScriptInput :: PlutusScript PlutusScriptV2 -> Value -> Datum -> Redeemer -> TxModifier Source #

Add a plutus script input.

addSimpleScriptInput :: SimpleScript SimpleScriptV2 -> Value -> TxModifier Source #

Add a simple script input.

changeRedeemerOf :: Input -> Redeemer -> TxModifier Source #

Change the redeemer of a script input.

changeValidityRange :: (TxValidityLowerBound Era, TxValidityUpperBound Era) -> TxModifier Source #

Change the validity range of the transaction.

changeValidityLowerBound :: TxValidityLowerBound Era -> TxModifier Source #

Change the validity lower bound of the transaction.

changeValidityUpperBound :: TxValidityUpperBound Era -> TxModifier Source #

Change the validity upper bound of the transaction.

replaceTx :: Tx Era -> UTxO Era -> TxModifier Source #

The most general transaction modifier. Simply replace the original transaction and UTxO set by the given values. In most cases the modifiers above should be sufficient.