Use the brownie forked-mainnet feature to interact with live contracts and test basic token transactions.
Run brownie in mainnet fork to interact with contracts deployed to the live blockchain. Requires an Infura API key.
$ export WEB3_INFURA_PROJECT_ID=<your_infura_key>
$ brownie console --network mainnet-fork
Brownie Token Tester provides helper objects for generating ERC20s while testing a Brownie project.
$ pipx inject eth-brownie brownie-token-tester
Mint tokens at will for common ERC20 tokens (ie USDC, DAI...)
> from brownie_tokens import MintableForkToken
> amount = <value> * <token_decimals>
> token = MintableForkToken(<token_address>)
> token._mint_for_testing(<target_address>, amount)
Interact with a deployed contract that is not part of your project
> from brownie import Contract
> contract_object = Contract(<address>)
Provides ten funded and unlocked accounts to interact with in Brownie.
> from brownie import accounts
👑 King of DeFi 👑
The Curve registry is a smart contract used to locate all active Curve contracts and perform high level interactions. The active address may change and can be retrieved from 0x0000000022d53366457f9d5e68ec105046fc4383
Find a pool that allows for transactions between <from> and <to>. You can optionally include the offset <i> to get the i-th pool when multiple pools exist for the given pairing.
> registry = Contract(<registry_address>)
> pool_addr = registry.find_pool_for_coins(<from>, <to>, <i>)
Deposit coins into a Curve pool as a liquidity provider to earn yield. Accepts an ordered list of <coin_i_amount> values for each coin the pool accepts. Reverts if return amount generated is less than <min_amount>.
> pool = Contract(<pool_addr>)
> amounts = [<coin_1_amount>, <coin_2_amount>, ...]
> pool.add_liquidity(amounts, <min_amount>)
Dai is a decentralized stablecoin by MakerDao currently pegged to the value of the US dollar.
A stablecoin pegged to the US dollar launched by Centre, a collaboration of Circle and Coinbase.