atlas-cardano
Copyright(c) 2023 GYELD GMBH
LicenseApache 2.0
Maintainer[email protected]
Stabilitydevelop
Safe HaskellNone
LanguageGHC2021

GeniusYield.Test.Utils

Description

 
Synopsis

Documentation

data TestInfo #

General information about the test environment to help in running polymorphic tests.

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

(==) :: Wallets -> Wallets -> Bool #

(/=) :: Wallets -> Wallets -> Bool #

Ord Wallets # 
Instance details

Defined in GeniusYield.Test.Utils

createUserWithLovelace :: GYTxGameMonad m => User -> Natural -> m User #

Create an user and fund them with the given amount of lovelace provided by the given funder user.

createUserWithAssets :: GYTxGameMonad m => User -> Natural -> [(FakeCoin, Natural)] -> m User #

`createUserWithAssets funder lovelaces tokens` is equivalent to `createUserWithLovelace funder lovelace', followed by 'mintTestAssets tokens' as the newly created user.

Note: This will obviously require the user to have enough lovelace to cover the fees and min ada deposits for the mints.

createUserFull :: GYTxGameMonad m => User -> Natural -> [(FakeCoin, Natural)] -> m User #

This is a combination of createUserWithAssets and generateCollateral. It creates a user with ada, non-ada assets, and a collateral. Thereby making a user ready to participate in smart contracts.

withBalance :: GYTxQueryMonad m => String -> User -> m b -> m (b, GYValue) #

Computes a `GYTx*Monad` action and returns the result and how this action changed the balance of some Address.

withWalletBalancesCheck :: GYTxQueryMonad m => [(User, GYValue)] -> m a -> m a #

Computes a `GYTx*Monad` 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.

findLockedUtxosInBody :: Num a => GYAddress -> GYTx -> Maybe [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.

getRefInfos :: GYTxQueryMonad m => GYAddress -> m (Map GYAnyScript GYTxOutRef) #

Find reference scripts at given address.

findRefScriptsInBody :: GYTxBody -> Map GYAnyScript GYTxOutRef #

Find reference scripts in transaction body.

addRefScript :: forall m (v :: PlutusVersion). GYTxMonad m => GYAddress -> GYScript v -> m GYTxOutRef #

Adds the given script to the given address and returns the reference for it. Note: The new utxo is given an inline unit datum.

addRefInput #

Arguments

:: GYTxMonad m 
=> Bool

Whether to inline this datum?

-> GYAddress

Where to place this output?

-> GYDatum

Our datum.

-> m GYTxOutRef 

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

mintTestAssets :: GYTxMonad m => [(FakeCoin, Natural)] -> m () #

Mint given amount of test tokens.

generateCollateral :: GYTxMonad m => m GYTxOutRef #

Create a collateral utxo out of the existing ada within a user wallet. Returns the collateral reference.

fakeCoin :: FakeCoin -> GYAssetClass #

Fake coin class generated from fixed tag.

fakeGold :: FakeCoin #

Fake "Gold" coin to use during tests.

fakeIron :: FakeCoin #

Fake "Iron" coin to use during tests

afterAllSucceed :: TestTree -> TestTree -> TestTree #

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

feesFromLovelace :: Integer -> GYValue #

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

withMaxQCTests :: Int -> TestTree -> TestTree #

Adjust the number of QuickCheck cases to generate.

pattern (:=) :: x -> y -> (x, y) infix 0 #

Pattern to create pairs easily.