Due to arithmetic mistake the GMXReader.additionalCapacity
misestimates the additional capacity that can be deposited to vault based on available lending liquidity for Neutral strategies for tokenB.
The GMXReader.additionalCapacity
calculates the additional capacity that can be deposited to the vault. In case of Neutral strategies the function takes into account the tokens weight and the leverage in the way which is described in the comments. But the formula for the _maxTokenBLending
variable uses _tokenAWeight
instead of 1e18 - _tokenAWeight
and subtracts 1e18
from the whole value instead of divider only.
This issue can cause unexpected errors and financial losses for small values.
Manual Review
I suggest fixing the mistake this way:
Impact: Medium Likelihood: High GMXReader::additionalCapacity calculation is wrong for a neutral case. Severity could be discussed further but because it is an evident logic error, likely to end as High.
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.