Deposit/Withdrawal Examples
These examples follow a user's end-to-end cycle through GMI.
Depositing
The Index has been operating for a while and has the following system snapshot:
Total Index Value = $3,000,000
Total GMI Supply = 2,000,000 (@ $1.50 each)
Total gmETH Value in Index = $1,100,000
gmETH Price = $1.32 / token
gmETH Target Weight / Total Token Weights = gmETH Target Weight Ratio = 0.4
Tax Bps = 60 basis points (0.6%)
Fee Bps = 100 basis points (1%)
Minimum Fee Bps = 33 basis points (0.33%)
A user buys $20,000 worth of gmETH from GMX , which is roughly 15,152 tokens. The user then deposits the 15,152 gmETH tokens into the GMI Index.
Deposit Fee
Upon deposit, the GMI smart contracts determine if the deposit benefits the Index or not. A transaction benefits the Index when it brings the GM asset closer to it's target weighting:
Initial gmETH Bank Balance = Total gmETH Value in Index / gmETH Price = $1,100,00 / $1.32 = 833,333.33 tokens
gmETH Target Balance = Total Index Value (including new deposit) * gmETH Target Weight Ratio / price = $3,020,000 * 0.4 / $1.32 = 915,151.52 tokens
Initial Difference = gmETH Target Balance - Initial gmETH Bank Balance = 81,818.18 tokens
New Bank Balance = Initial gmETH Bank Balance + New gmETH Deposit = 833,333.33 + 15,152 = 848,485.33 tokens
New Difference = gmETH Target Balance - New Bank Balance = 915,151.52 - 848,485.33 = 66,666.19.
Since the New Difference is less than the Initial Difference, the transaction benefits the Index, and the user sees a rebate on the normal fees:
Rebate Bps = (Tax Bps * Initial Difference) / gmETH Target Balance = (60 * 81,818.18) / 915,151.52 = 5.364.
If the Rebate Bps is greater than the Fee Bps (100 basis points or 1%), then the user is charged the Minimum Fee Bps. If the Rebate Bps is less than the Fee Bps, but higher than the Minimum Fee Bps, the transaction incurs a fee of Fee Bps - Rebate Bps. For this transaction, we have:
Final Fee Bps = Fee Bps - Rebate Bps = 100 - 5.364 = 94.64
The GMI mint amount is then determined by equivalent ratios: multiplying the Total GMI Supply by the ratio of the user's GM token deposit value to the Total Value in the Index. The Final Fee Bps is then multiplied by the GMI mint amount and divided by the FEE_DIVISOR
(10,000):
GMI Mint Amount = Total GMI Supply * (gmETH Deposit Value / Total Value) = 2,000,000 * ($20,000 / $3,000,000) = 13,333.33 tokens
Fee Amount = (GMI Mint Amount * Final Fee Bps) / Fee Divisor = (13,333.33 * 94.64) / 10,000 = $126.20 (or 0.63% of the deposit amount)
Deposit Reflection
Once the fee is determined, the protocol splits it into two buckets: 60% for reflection, 40% for USDC lending/looping liquidity.
$126.20 * 0.6 = $75.72 -> Reflection
$126.20 * 0.4 = $50.48 -> USDC lending/looping liquidity
So $75.2 of the user's GM tokens stay within the Index contract and $50.48 in minted GMI tokens gets sent to the protocolFeeRecipient
and earmarked for future USDC lending/looping liquidity.
During Index Liquidity Provision (Holding GMI)
While the depositor's GM assets are in the Index and they hold their GMI tokens, they are exposed to the reflection portion of each deposit and withdrawal fee accrued thereafter. As asset transfer volumes increase, the Index sees a net gain of GM asset tokens, due to the reflection portion of the fees.
Let's say the above depositor returns after a certain time period to see the status of the initial deposit. The protocol's snapshot is:
Total Index Value = $50,000,000
Total GMI Supply = 25,000,000 (@ $2.00 each)
Total gmETH Value in Index = $10,000,000 (gmETH has increased to $1.50 per token)
GMI Volume since user's initial deposit = $300,000,000
Average user fee = 0.96%
Total fee reflections = $300,000,000 * 0.0096 * 0.6 (60% reflections) = $1,609,157
Since the depositor still holds their 13,333.33 GMI tokens (0.053% of the entire pool), the tokens are now worth $26,666.67 ($2 per GMI). By multiplying the total fee reflections by the depositor's share of the pool ($1,609,157 * 0.053%), we can calculate that the user experiences an $858.22 gain derived purely from reflections.
Withdrawing
The depositor now wants to withdraw their gmETH tokens. Similar to depositing, the Withdraw Value is calculated using equivalent ratios (see below). The GMI smart contracts then determine if the withdrawal benefits the Index or not. The above snapshot will be used in the fee calculation.
Withdrawal Fee
The target weight for gmETH is still 0.4, and with the above snapshot, the current weight is 0.2. The depositor's withdrawal will take gmETH's weight further away from the target weight, so a tax will be assessed on this transaction.
gmETH Withdraw Value = Total Index Value (excluding withdrawal) * (GMI Amount / Total GMI Supply) = $50,000,000 * (13,333 GMI tokens / 25,000,000 total GMI) = $26,666.67
gmETH Withdraw Amount = gmETH Withdraw Value / gmETH Price = $26,666.67 / $1.50 = 17,777.78 tokens
gmETH Bank Balance = Total gmETH Value in Index / gmETH Price = $10,000,000 / $1.50 = 6,666,666.67 tokens
gmETH Target Balance = (Total Index Value - gmEth Withdrawal) * gmETH Target Weight Ratio / Price = ($50,000,000 - $26,666.67) * 0.4 / $1.50 = 13,326,222.2 tokens
Initial Difference = gmETH Target Balance - Initial gmETH Bank Balance = 6,659,555.55 tokens
New Bank Balance = Initial gmETH Bank Balance - New gmETH Withdrawal = 6,666,666.67 - 17,777.78 = 6,648,888.89 tokens
New Difference = gmETH Target Balance - New Bank Balance = 13,326,222.2 - 6,648,888.89 = 6,677,333.31
Since the New Difference is more than the Initial Difference, the transaction hurts the Index, and the user sees a tax on top of the nominal 1% fee:
Average Difference = (Initial Difference + New Difference) / 2 = (6,659,555.55 + 6,677,333.31) /2 = 6,668,444.43
Tax Bps = (Tax Bps * Average Difference) / gmETH Target Balance = (60 * 6,668,444.43) / 13,326,222.2 = 30.024 basis points
Final Fee Bps = Fee Bps + Tax Bps = 100 + 30.024 = 130.324
The Fee Bps is then multiplied by the gmETH Withdraw Amount and divided by the Fee Divisor (10,000):
Fee Amount = (gmETH Withdraw Amount * Final Fee Bps) / Fee Divisor = (17,777.78 * 130.324) / 10,000 = $231.69 (or 0.86% of the withdrawal amount)
Withdrawal Reflection
Once the fee is determined, the protocol again splits it into two buckets: 60% for reflection, 40% for USDC lending/looping liquidity.
$231.69 * 0.6 = $139.01 -> Reflection
$231.69 * 0.4 = $92.68 -> USDC lending/looping liquidity
$139.01 worth of gmETH tokens stays within the Index contract and $92.68 in gmETH tokens gets sent to the protocolFeeRecipient
and earmarked for future USDC lending/looping liquidity.
Last updated