The additionalCapacity()
function has been identified to potentially lead to inaccuracies in calculating the maximum borrowable amounts of assets due to the use of identical weights for different tokens.
In the lending protocol, the additionalCapacity() function is responsible for determining the total amounts that users are allowed to borrow depending on the weights of the tokens in the GMX liquidity Pool and leverage.
However, it does not account for the weights of tokenB and uses tokenA's weights for the calculation of this amount.
Also, the use of the magic number -1e18 seems unclear here. It seems like it is been used as a provision.
The best case scenario is that this amount is underestimated which will just slow down the lending. But if the amount is overestimated then the following check will pass :
Manual review
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.