Skip to main content

Tokens

Tokens are an essential part of the simulation. This field allows you to configure tokens that must be instantiated in the simulator. Without adding them here, they will not be available for use within the simulation. However, if you do include them, you can use environment.get_client().get_chain().get_token() to retrieve a class for the token (EVMToken).

The EVMToken class provides several functions:

  • mint(address: str, amount: float)
  • transfer(from_address: str, to_address: str, amount: float)
  • approve(wallet: str, spender: str, amount: float)
  • get_balance(address: str)
  • get_allowance(address: str)
  • get_token_quantity_as_decimal(quantity: int)

These functions are available for any token you configure.

Please only use ERC20 and native tokens, as other types are not supported. The easiest way to find a token's address is to use a blockchain explorer and locate the token there. The address will be listed either on the page or in the URL.

To use native tokens, specify their ticker name and an associated address. If you don't need to use a specific address (which may be necessary for interactions with certain contracts), you can use the zero address 0x0000000000000000000000000000000000000000.

This field exists because some projects have a separate field for the native token on the chain they use. For example, Bancor uses the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in their contracts to represent native ETH. When performing certain functions, you may need to use these addresses to interact with contracts.

Example

tokens:
- name: "DAI"
address: "0x6B175474E89094C44Da98b954EedeAC495271d0F"
- name: "BNT"
address: "0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C"
- name: "ETH"
address: "0x0000000000000000000000000000000000000000"