πŸ¦”
Liqui
  • πŸ’»Overview
  • πŸ¦”Hedgehog Strategy
    • Math
    • Procedures
      • Deposit
      • Withdraw
      • Rebalance
    • Parameters
    • Contract addresses
  • Resources
    • FAQ
    • Links
    • Blog
    • Twitter
    • Discord
    • Github
Powered by GitBook
On this page
  1. Hedgehog Strategy
  2. Procedures

Deposit

The deposit function takes tokens and returns ownership claims for a certain fraction of the assets held in the strategy.

The flow is next:

  1. Pull in tokens (ETH, USDC, and oSQTH) from the sender in a proportion same as the current strategy holdings

  2. Poke positions so the vault's current holdings are up to date

  3. Calculate shares to mint

shares=depositorValuesharePriceshares = \frac{depositorValue}{sharePrice} shares=sharePricedepositorValue​

where share price calculated as:

sharePrice=totalValuetotalSupplysharePrice = \frac{totalValue}{totalSupply} sharePrice=totalSupplytotalValue​

and Value calculated in ETH terms as:

value=ethAmount+usdcAmountEthUsdcPrice+osqthAmountβ‹…OsqthEthPricevalue = ethAmount + \frac{usdcAmount}{EthUsdcPrice} + osqthAmount\cdot OsqthEthPricevalue=ethAmount+EthUsdcPriceusdcAmount​+osqthAmountβ‹…OsqthEthPrice

​4. Check deposit cap

5. Mint shares to user

Example

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:

ratio=EthToDepositEthBalance=1053.4=0.1872ratio = \frac{EthToDeposit}{EthBalance}=\frac{10}{53.4}=0.1872ratio=EthBalanceEthToDeposit​=53.410​=0.1872
UsdcToDeposit=UsdcBalanceβˆ—ratio=45681βˆ—0.1872=8551.5UsdcToDeposit=UsdcBalance*ratio=45681*0.1872=8551.5UsdcToDeposit=UsdcBalanceβˆ—ratio=45681βˆ—0.1872=8551.5
OsqthToDeposit=OsqthBalanceβˆ—ratio=216.3βˆ—0.1872=40.49OsqthToDeposit = OsqthBalance*ratio=216.3*0.1872=40.49 OsqthToDeposit=OsqthBalanceβˆ—ratio=216.3βˆ—0.1872=40.49

​At the current prices of ETH/USDC 1500 and oSQTH/ETH 0.085, with the total supply of shares = 100, there will be minted:​

depositorValue=10+8551.5/1500+40.49β‹…0.085=19.14totalValue=63.4+45681/1500+216.3β‹…0.085=112.24Β shares=totalSupplyβ‹…depositorValueTotalValue=100β‹…19.14112.24=17.053depositorValue = 10+8551.5/1500+40.49\cdot 0.085=19.14 \\ totalValue = 63.4 + 45681/1500+216.3\cdot 0.085=112.24 \\ \ \\ shares = totalSupply \cdot \frac{depositorValue}{TotalValue} =100\cdot \frac{19.14}{112.24}=17.053depositorValue=10+8551.5/1500+40.49β‹…0.085=19.14totalValue=63.4+45681/1500+216.3β‹…0.085=112.24Β shares=totalSupplyβ‹…TotalValuedepositorValue​=100β‹…112.2419.14​=17.053

​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.

PreviousProceduresNextWithdraw

Last updated 2 years ago

πŸ¦”