Token Banks

How the token banks work

Before an asset is added to the Index, a bank contract for the token needs to be deployed. At deployment, the constructor stores the _manager address and the IERC20 interface type of the _token. The _manager address will normally be the address of the GM Index. The constructor then approves the manager to spend any amount of the token on behalf of the Bank. Once the token’s bank contract has been deployed, and a GM market and price oracle contract exist for the token, the token can be added to the Index (see main GM Index section for adding tokens).

migrate

function migrate(address newVault) external

Transfers all tokens in the Bank contract to a new Bank contract. This function can only be called by the manager, which is normally the GM Index contract.

Parameters:

NameTypeDescription

newVault

address

The address of the new Bank contract that all tokens will be transferred to

deposit

function deposit(uint256 _amount) external

Deposits an _amount of tokens into the Bank contract. This function can only be called by the manager, which is normally the GM Index contract. The tokens are sent from the depositor to the GM Index and then immediately sent to the token’s Bank contract.

Parameters:

NameTypeDescription

_amount

uint256

The amount of tokens to deposit

Last updated