Copyright | (c) 2023 GYELD GMBH |
---|---|
License | Apache 2.0 |
Maintainer | [email protected] |
Stability | develop |
Safe Haskell | None |
Language | GHC2021 |
GeniusYield.Test.Utils
Description
Synopsis
- data TestInfo = TestInfo {}
- data Wallets = Wallets {}
- createUserWithLovelace :: GYTxGameMonad m => User -> Natural -> m User
- createUserWithAssets :: GYTxGameMonad m => User -> Natural -> [(FakeCoin, Natural)] -> m User
- createUserFull :: GYTxGameMonad m => User -> Natural -> [(FakeCoin, Natural)] -> m User
- withBalance :: GYTxQueryMonad m => String -> User -> m b -> m (b, GYValue)
- withWalletBalancesCheck :: GYTxQueryMonad m => [(User, GYValue)] -> m a -> m a
- findLockedUtxosInBody :: Num a => GYAddress -> GYTx -> Maybe [a]
- getRefInfos :: GYTxQueryMonad m => GYAddress -> m (Map GYAnyScript GYTxOutRef)
- findRefScriptsInBody :: GYTxBody -> Map GYAnyScript GYTxOutRef
- addRefScript :: forall m (v :: PlutusVersion). GYTxMonad m => GYAddress -> GYScript v -> m GYTxOutRef
- addRefInput :: GYTxMonad m => Bool -> GYAddress -> GYDatum -> m GYTxOutRef
- mintTestAssets :: GYTxMonad m => [(FakeCoin, Natural)] -> m ()
- generateCollateral :: GYTxMonad m => m GYTxOutRef
- fakeValue :: FakeCoin -> Integer -> GYValue
- fakeCoin :: FakeCoin -> GYAssetClass
- fakeGold :: FakeCoin
- fakeIron :: FakeCoin
- fakePolicy :: FakeCoin -> GYScript 'PlutusV2
- afterAllSucceed :: TestTree -> TestTree -> TestTree
- feesFromLovelace :: Integer -> GYValue
- withMaxQCTests :: Int -> TestTree -> TestTree
- pattern (:=) :: x -> y -> (x, y)
- module GeniusYield.Test.FeeTracker
Documentation
General information about the test environment to help in running polymorphic tests.
Constructors
TestInfo | |
Fields
|
Available wallets.
Constructors
Wallets | |
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.
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.
fakePolicy :: FakeCoin -> GYScript 'PlutusV2 #
afterAllSucceed :: TestTree -> TestTree -> TestTree #
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.
module GeniusYield.Test.FeeTracker