The slippage on deposits is enforced by the minMarketTokenAmt
parameter. But in the calculation of minMarketTokenAmt
, the slippage is factored on the user's deposit value and not the leveraged amount which is actually being deposited to GMX.
https://github.com/Cyfrin/2023-10-SteadeFi/blob/0f909e2f0917cb9ad02986f631d622376510abec/contracts/strategy/gmx/GMXDeposit.sol#L54-L146
But vaults with leverage greater than 1 will be adding more than _dc.depositValue
worth of liquidity in which case the calculated minMarketTokenAmt
will result in a much higher slippage.
The vault is a 3x leveraged vault
User deposits 1 usd worth tokenA and sets slippage to 1%.
The minMarketTokenAmt
calculated is worth 0.99 usd
The actual deposit added is worth 3 usd due to leverage
The deposit receives 2.90 worth of LP token which is more than 1% slippage
Depositors can loose value
Use the actual deposit value instead of the user's initial deposit value when calculating the minMarketTokenAmt
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.