Calculated minMarketTokenAmt
is wrong, expose to slippage.
In GMXDeposit.deposit()
while calculating calcMinMarketSlippageAmt()
i.e minimum GM Amount that will receive, while depositing to GMXv2
is using wrong parameter i.e _dc.depositValue
_dc.depositValue
here is the USD price of tokens deposited by Caller
Which then in following code used to calculate borrowAmount(tokenA & tokenB)
from the lendingVault
with respect to corresponding leverage (3x or 5x)
Technically it should be _dc.depositValue + borrowedAmount value
passed to GMXManager.calcMinMarketSlippageAmt()
for calculating minmumMarketToken
received from GMXv2
This particular method already implemented in other contracts like in GMXWithdraw.processWithdrawFailure()
As we passing less depositValue to function then calculated minMarketTokenAmt
will be small, there could be a slippage in received Market Token.
Manual review
Code already have correct implementation in other contract, this instance was exception
Following method could applied here as well
Impact: High Likelihood: High Logic error in the core functionality that can cause loss of user funds.
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.