Pytest fixtures used in Curve's test suite.
accounts.py: Convenience fixtures to aid readability when accessing specific accountscoins.py: Deployment fixtures for stablecoins and LP tokensdeployments.py: Deployment fixtures for pools, depositors and other contractsfunctions.py: Functions-as-fixtures, used to standardize contract interactions or to access commonly needed functionalitypooldata.py: Pool dependent data fixturessetup.py: Test setup fixtures, used for common processes such as adding initial liquidity or approving token transfers
Session scoped convenience fixtures providing access to specific unlocked accounts. These are used to aid readability within the test suite.
alice: Yieldsweb3.eth.accounts[0]. This is also the deployer address for all contracts.bob: Yieldsweb3.eth.accounts[1].charlie: Yieldsweb3.eth.accounts[2].
Module scoped deployment fixtures for stablecoins and pool LP tokens.
pool_token:CurveTokendeployment for the active pool.underlying_coins: A list of mocked token contracts representing the underlying coins in the active pool. When the pool being tested is a metapool, this list includes the underlying assets for the base pool - NOT the base pool LP token.wrapped_coins: A list of mocked token contracts representing the wrapped coins in the active pool. The contract used is determined based onpooldata.jsonfor the active pool. For pools without lending, these are the same deployments asunderlying_coins.
Module scoped contract deployment fixtures.
All deployment fixtures are parametrized to work with every pool in contracts/pools. To add a new pool to the test suite, create a pooldata.json in the same subdirectory. You can read about the structure of this JSON file here.
swap:StableSwapdeployment for the pool being tested.zap:Depositdeployment for the pool being tested.
Fixtures-as-functions that are used to standardize contract interafces or access commonly needed functionality.
approx: Comparison function for confirming that two numbers are equal within a relative precision.get_admin_balances: Function for querying the current admin balances of the activeswapdeployment. This is required because some older pool contracts do not include anadmin_balancesfunction.set_fees: Commits and applies a fee and admin fee change to the activeswapdeployment. Because the fee change has a time delay, calling this method advances time by three days.
Data fixtures for accessing information about the pool currently being tested.
underlying_decimals: A list of decimal values for each deployment inunderlying_coins.wrapped_decimals: A list of decimal values for each deployment inwrapped_coins.base_amount: The base amount of each coin that is minted when providing initial liquidity, given without any decimal places.initial_amounts: A list of values equivalent tobase_amount * 10**decimalsfor each deployment inwrapped_coins. Used for minting and providing initial liquidity.n_coins: The number of coins in the activeswapdeployment.
Module scoped setup fixtures, used for common processes such as adding initial liquidity or approving token transfers.
Setup fixtures are commonly applied using pytestmark and the usefixtures marker:
pytestmark = pytest.mark.usefixtures("add_initial_liquidity", "mint_bob")add_initial_liquidity: Mints and approvesinitial_amountscoins foraliceand adds them toswapto provide initial liquidity.approve_alice: Approvesswapfor unlimited transfers of all underlying and wrapped coins fromalice.approve_bob:Approvesswapfor unlimited transfers of all underlying and wrapped coins frombob.approve_zap: Approveszapfor unlimited transfers ofpool_tokenand all coins and fromaliceandbob.mint_alice: Mintsinitial_amountsof each underlying and wrapped coin foralice.mint_bob: Mintsinitial_amountsof each underlying and wrapped coin forbob.