create_token
Documentation for eth_defi.token.create_token function.
- create_token(web3, deployer, name, symbol, supply, decimals=18)[source]
Deploys a new test token.
Uses ERC20Mock contract for the deployment.
See Web3.py documentation on Contract instances.
Example:
# Deploys an ERC-20 token where 100,000 tokens are allocated ato the deployer address token = create_token(web3, deployer, "Hentai books token", "HENTAI", 100_000 * 10**18) print(f"Deployed token contract address is {token.address}") print(f"Deployer account {deployer} has {token.functions.balanceOf(user_1).call() / 10**18} tokens")
TODO: Add support for tokens with non-18 decimals like USDC.
- Parameters
- Returns
Instance to a deployed Web3 contract.
- Return type
web3.contract.contract.Contract