KittyVault.sol::getTotalMeowllateralInAave
Does not correctly calculate the collateral and collateral earned by interest from Aave.
The line below does not correctly calculate the collateral returned from Aave. This causes an incorrect calculation of the amount of total collateral in the protocol to be returned anytime getTotalMeowllateral
is called
The line above calculates like this:
PRECISION = 1e18EXTRA_DECIMALS = 1e10
uint256(collateralToUsdPrice) = 2e8
totalCollateralBase = 3e18
(3e18 * 1e18) / (2e8 * 1e10)
Which equals = 1.5e18
But this is how it should calculate:
((2e8 * 1e10) / 1e18) * 3e18
Which equals = 6e18
The line below is the code that should be used
return totalCollateralBase.mulDiv(uint256(collateralToUsdPrice) * EXTRA_DECIMALS, PRECISION);
The test below fails showing that the calculation is not correct
--Foundry
It is recommended to change the return line in KittyVault.sol::getTotalMeowllateralInAave
to the correct equation.
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.