The Liquidity Index is supposed to be calculated using linear interest, but the current implementation introduces compounding effects due to the way it updates the index.
The function calculateLiquidityIndex
calls calculateLinearInterest
, which computes (1 + r * t)
, but then incorrectly multiplies it with the last index.
Multiplying by lastIndex makes it behave like compound interest over multiple periods:
ReserveLibrary.sol :
Each time calculateLiquidityInterest
is called, it applies a new cumulatedInterest
factor to lastIndex. Over multiple periods, this results in:
This is the compound interest formula. Linear interest would be like this:
The increase is not depend on last index.
Liquidity Index will increase with a compounding effect which is more than intended and as a result Liquidity providers will get more funds.
vscode
Modify calculateLiquidityIndex to ensure the new index follows a linear formula:
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.