Skip to main content
Version: 2.0.2

Tokens

Tokens are an important part of the simulation. This field allows you to configure tokens that have to instantiated in the simulator, without adding them here there it won't be available to use within the simulation at all. But if you do add them here you can use environment.get_client().get_chain().get_token() to retrieve a class for the token (EVMToken).

This class has several functions available.

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

These functions will all be available for that token.

Please only use ERC20 and native tokens, other tokens are not supported. The easiest way to find the address for a token is to use an explorer of your choice and find the token there. It will have the address listed somewhere on that page or in the URL.

To use native tokens, please specify their ticker name and an address to associate with the token. If you don't need to use a specific address (which you might sometimes for interactions with certain contracts) you can use the 0 address 0x0000000000000000000000000000000000000000.

The reason for this field is that certain projects have a separate field for the native token that runs on the chain they're using. For example bancor uses the address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in their contracts which means Native ETH. Sometimes when performing a function you will need to use these addresses to call contracts.

Example

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