mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fixed compounded interest approximation
This commit is contained in:
parent
413b648b41
commit
9b0b190019
|
@ -57,7 +57,8 @@ library MathUtils {
|
|||
}
|
||||
|
||||
uint256 expMinusOne = exp.sub(1);
|
||||
uint256 expMinusTwo = exp.sub(2);
|
||||
|
||||
uint256 expMinusTwo = exp > 2 ? exp.sub(2) : 0;
|
||||
|
||||
uint256 ratePerSecond = _rate.div(31536000);
|
||||
|
||||
|
|
|
@ -1265,8 +1265,12 @@ const calcCompoundedInterest = (
|
|||
|
||||
const timeDifference = currentTimestamp.minus(lastUpdateTimestamp);
|
||||
|
||||
if(timeDifference.eq(0)){
|
||||
return new BigNumber(RAY);
|
||||
}
|
||||
|
||||
const expMinusOne = timeDifference.minus(1);
|
||||
const expMinusTwo = timeDifference.minus(2);
|
||||
const expMinusTwo = timeDifference.gt(2) ? timeDifference.minus(2) : 0;
|
||||
|
||||
const ratePerSecond = rate.div(ONE_YEAR);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user