atlas-cardano-0.4.0: Application backend for Plutus smart contracts on Cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellSafe-Inferred
LanguageGHC2021

GeniusYield.Test.Utils

Description

 
Synopsis

Documentation

data Run a Source #

State monad wrapper to run blockchain.

Instances

Instances details
MonadFail Run

Dummy instance to be able to use partial pattern matching in do-notation

Instance details

Defined in Plutus.Model.Mock

Methods

failStringRun a Source #

Applicative Run 
Instance details

Defined in Plutus.Model.Mock

Methods

pure ∷ a → Run a Source #

(<*>)Run (a → b) → Run a → Run b Source #

liftA2 ∷ (a → b → c) → Run a → Run b → Run c Source #

(*>)Run a → Run b → Run b Source #

(<*)Run a → Run b → Run a Source #

Functor Run 
Instance details

Defined in Plutus.Model.Mock

Methods

fmap ∷ (a → b) → Run a → Run b Source #

(<$) ∷ a → Run b → Run a Source #

Monad Run 
Instance details

Defined in Plutus.Model.Mock

Methods

(>>=)Run a → (a → Run b) → Run b Source #

(>>)Run a → Run b → Run b Source #

return ∷ a → Run a Source #

MonadState Mock Run 
Instance details

Defined in Plutus.Model.Mock

Methods

getRun Mock Source #

putMockRun () Source #

state ∷ (Mock → (a, Mock)) → Run a Source #

testRunString → (WalletsRun a) → TestTree #

Given a test name, runs the trace for every wallet, checking there weren't errors.

data Wallet #

Testing Wallet representation.

Instances

Instances details
Show Wallet # 
Instance details

Defined in GeniusYield.TxBuilder.Run

Eq Wallet # 
Instance details

Defined in GeniusYield.TxBuilder.Run

Methods

(==)WalletWalletBool Source #

(/=)WalletWalletBool Source #

Ord Wallet # 
Instance details

Defined in GeniusYield.TxBuilder.Run

HasAddress Wallet # 
Instance details

Defined in GeniusYield.TxBuilder.Run

data Wallets #

Available wallets.

Constructors

Wallets 

Fields

Instances

Instances details
Show Wallets # 
Instance details

Defined in GeniusYield.Test.Utils

Eq Wallets # 
Instance details

Defined in GeniusYield.Test.Utils

Methods

(==)WalletsWalletsBool Source #

(/=)WalletsWalletsBool Source #

Ord Wallets # 
Instance details

Defined in GeniusYield.Test.Utils

newWalletStringGYValueRandT StdGen Run Wallet #

Given a name and an initial fund, create a testing wallet.

runWalletWalletGYTxMonadRun a → Run (Maybe a) #

Runs a GYTxMonadRun action using the given wallet.

runWallet'WalletGYTxMonadRun a → Run a #

Version of runWallet that fails if Nothing is returned by the action.

walletAddressWalletGYAddress #

Gets a GYAddress of a testing wallet.

walletPubKeyHashWalletGYPubKeyHash #

Gets a GYPubKeyHash of a testing wallet.

balanceHasAddress a ⇒ a → GYTxMonadRun GYValue #

Gets the balance from anything that HasAddress. The usual case will be a testing wallet.

withBalanceHasAddress a ⇒ String → a → GYTxMonadRun b → GYTxMonadRun (b, GYValue) #

Computes a GYTxMonadRun action and returns the result and how this action changed the balance of some Address.

withWalletBalancesCheck ∷ [(Wallet, GYValue)] → GYTxMonadRun a → GYTxMonadRun a #

Computes a GYTxMonadRun action, checking that the Wallet balances change according to the input list.

Notes: * An empty list means no checks are performed. * The GYValue should be negative to check if the Wallet lost those funds.

withWalletBalancesCheckSimple ∷ [(Wallet, GYValue)] → GYTxMonadRun a → GYTxMonadRun a #

Computes a GYTxMonadRun action, checking that the Wallet balances change according to the input list. This is a simplified version of withWalletBalancesCheck where the input list need not consider lovelaces required for fees & to satisfy the min ada requirements as these are added automatically. It is therefore recommended to use this function over withWalletBalancesCheck to avoid hardcoding the lovelaces required for fees & min ada constraints.

Notes: * An empty list means no checks are performed. * The GYValue should be negative to check if the Wallet lost those funds.

getBalanceHasCallStackWalletRun GYValue #

Given a wallet returns its balance.

getBalancesHasCallStack ⇒ [Wallet] → Run [GYValue] #

Given a list of wallets returns its balances.

runWithWalletBalancesCheckHasCallStackWallets → [(WalletsWallet, GYValue)] → Run a → Run a #

Computes a Run action, checking that the Wallet balances change according to the input list.

Notes: * An empty list means no checks are performed. * The GYValue should be negative to check if the Wallet lost those funds.

waitUntilSlotGYSlotGYTxMonadRun () #

Waits until a certain GYSlot. Fails if the given slot is greater than the current slot.

waitNSlotsGYTxMonadIntegerGYTxMonadRun () #

Waits N slots.

findLockedUtxosInBodyNum a ⇒ GYNetworkIdGYAddressTxMaybe [a] #

Returns the list of outputs of the transaction for the given address. Returns Nothing if it fails to decode an address contained in the transaction outputs.

utxosInBodyGYTxQueryMonad m ⇒ TxGYTxId → m [Maybe GYUTxO] #

Given PSM transaction and the corresponding transaction id, gives the list of UTxOs generated by that body provided they still exist. This function is usually expected to be called immediately after the transaction's submission.

addRefScriptGYAddressGYValidator 'PlutusV2GYTxMonadRun (Maybe GYTxOutRef) #

Adds the given script to the given address and returns the reference for it.

expectInsufficientFundsWalletGYTxSkeleton v → Run () #

Expect the transaction building to fail with a BalancingErrorInsufficientFunds error

addRefInput #

Arguments

Bool

Whether to inline this datum?

GYAddress

Where to place this output?

GYDatum

Our datum.

GYTxMonadRun (Maybe GYTxOutRef) 

Adds an input (whose datum we'll refer later) and returns the reference to it.

fakeGold ∷ FromFakeCoin a ⇒ a #

Fake "Gold" coin to use during tests. Can represent a GYAssetClass or a Plutus AssetClass

fakeIron ∷ FromFakeCoin a ⇒ a #

Fake "Iron" coin to use during tests Can represent a GYAssetClass or a Plutus AssetClass

afterAllSucceedTestTreeTestTreeTestTree #

Runs the second TestTree after all tests in the first TestTree succeed

feesFromLovelaceIntegerGYValue #

Abstraction for explicitly building a Value representing the fees of a transaction.

withMaxQCTestsIntTestTreeTestTree #

Adjust the number of QuickCheck cases to generate.

pattern (:=) ∷ x → y → (x, y) infix 0 #

Pattern to create pairs easily.