Deposit

With this function a user can deposit funds into one of our vaults in return for our vault LP tokens. When a user deposits funds the funds will be locked in the vault smart contract first. After a rebalance has been triggered (once in two weeks) these funds, together with all the other deposits during that time, will be allocated among the different DeFi applications that are whitelisted in the vault according to the allocations set by the game. Note that the user will be generating yield with our vault LP tokens from the moment of depositing funds.

To deposit the user will have to call the following function in one of our deployed vaults:

function deposit(uint256 _amount) external nonReentrant returns(uint256 shares)

This can be done via our front-end application or directly via one of our deployed vault contracts. The _amount here is the amount in the underlying vault currency in their scale (so $1 = 10^6 in case of USDC) that the user wants to deposit.

The amount of shares (LP tokens) the user will get in return is calculated by the following line of code:

shares = amount * LPScale / exchangeRate;

Where the exchangeRate is expressed in underlying/ LPtoken in the scale of the underlying vault currency and LPScale is the amount of decimals of the LP token in the same scale (10^6). For example, if the exchangeRate is $2/LPtoken and the user deposits $10, it will receive

10*10^6 * 10^6/ 2 * 10^6 = 5*10^6 LP tokens (5 LP tokens)

The exchangeRate is calculated based on the exposures on all the underlyings on all the different chains and layer 2s. Therefore, it's not feasible to calculate the actual exchangeRate every time a deposit is made. Instead, the exchangeRate is calculated and stored during rebalancing.

Last updated