Deposit
Last updated
Last updated
The deposit
function takes tokens and returns ownership claims for a certain fraction of the assets held in the strategy.
The flow is next:
Pull in tokens (ETH, USDC, and oSQTH) from the sender in a proportion same as the current strategy holdings
Poke positions so the vault's current holdings are up to date
Calculate shares to mint
where share price calculated as:
and Value calculated in ETH terms as:
β4. Check deposit cap
5. Mint shares to user
Suppose that Alice would like to deposit 10 ETH and match it with the necesasary amount of USDC and oSQTH.
The current strategy holdings are 53.4 ETH, 45681 USDC, and 216.3 oSQTH.
After the Alice's deposit there will be 63.4 ETH, that need to be matched with:
βAt the current prices of ETH/USDC 1500 and oSQTH/ETH 0.085, with the total supply of shares = 100, there will be minted:β
βTo simplify the deposit we introduce a deposit helper, that takes the user's wETH and automatically swaps it to a set of wETH, USDC, and oSQTH targeting the required strategy proportion.