mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Changed 1 << 128
to type(uint128).max
This commit is contained in:
parent
4fb10f8b10
commit
0f086a8a27
|
@ -166,7 +166,7 @@ library ReserveLogic {
|
||||||
uint256 result = amountToLiquidityRatio.add(WadRayMath.ray());
|
uint256 result = amountToLiquidityRatio.add(WadRayMath.ray());
|
||||||
|
|
||||||
result = result.rayMul(reserve.liquidityIndex);
|
result = result.rayMul(reserve.liquidityIndex);
|
||||||
require(result < (1 << 128), Errors.RL_LIQUIDITY_INDEX_OVERFLOW);
|
require(result < type(uint128).max, Errors.RL_LIQUIDITY_INDEX_OVERFLOW);
|
||||||
|
|
||||||
reserve.liquidityIndex = uint128(result);
|
reserve.liquidityIndex = uint128(result);
|
||||||
}
|
}
|
||||||
|
@ -247,9 +247,9 @@ library ReserveLogic {
|
||||||
vars.avgStableRate,
|
vars.avgStableRate,
|
||||||
reserve.configuration.getReserveFactor()
|
reserve.configuration.getReserveFactor()
|
||||||
);
|
);
|
||||||
require(vars.newLiquidityRate < (1 << 128), 'ReserveLogic: Liquidity rate overflow');
|
require(vars.newLiquidityRate < type(uint128).max, 'ReserveLogic: Liquidity rate overflow');
|
||||||
require(vars.newStableRate < (1 << 128), 'ReserveLogic: Stable borrow rate overflow');
|
require(vars.newStableRate < type(uint128).max, 'ReserveLogic: Stable borrow rate overflow');
|
||||||
require(vars.newVariableRate < (1 << 128), 'ReserveLogic: Variable borrow rate overflow');
|
require(vars.newVariableRate < type(uint128).max, 'ReserveLogic: Variable borrow rate overflow');
|
||||||
|
|
||||||
reserve.currentLiquidityRate = uint128(vars.newLiquidityRate);
|
reserve.currentLiquidityRate = uint128(vars.newLiquidityRate);
|
||||||
reserve.currentStableBorrowRate = uint128(vars.newStableRate);
|
reserve.currentStableBorrowRate = uint128(vars.newStableRate);
|
||||||
|
@ -367,7 +367,7 @@ library ReserveLogic {
|
||||||
timestamp
|
timestamp
|
||||||
);
|
);
|
||||||
newLiquidityIndex = cumulatedLiquidityInterest.rayMul(liquidityIndex);
|
newLiquidityIndex = cumulatedLiquidityInterest.rayMul(liquidityIndex);
|
||||||
require(newLiquidityIndex < (1 << 128), Errors.RL_LIQUIDITY_INDEX_OVERFLOW);
|
require(newLiquidityIndex < type(uint128).max, Errors.RL_LIQUIDITY_INDEX_OVERFLOW);
|
||||||
|
|
||||||
reserve.liquidityIndex = uint128(newLiquidityIndex);
|
reserve.liquidityIndex = uint128(newLiquidityIndex);
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ library ReserveLogic {
|
||||||
timestamp
|
timestamp
|
||||||
);
|
);
|
||||||
newVariableBorrowIndex = cumulatedVariableBorrowInterest.rayMul(variableBorrowIndex);
|
newVariableBorrowIndex = cumulatedVariableBorrowInterest.rayMul(variableBorrowIndex);
|
||||||
require(newVariableBorrowIndex < (1 << 128), Errors.RL_VARIABLE_BORROW_INDEX_OVERFLOW);
|
require(newVariableBorrowIndex < type(uint128).max, Errors.RL_VARIABLE_BORROW_INDEX_OVERFLOW);
|
||||||
reserve.variableBorrowIndex = uint128(newVariableBorrowIndex);
|
reserve.variableBorrowIndex = uint128(newVariableBorrowIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase {
|
||||||
.add(vars.amountInRay.rayMul(rate))
|
.add(vars.amountInRay.rayMul(rate))
|
||||||
.rayDiv(currentBalance.add(amount).wadToRay());
|
.rayDiv(currentBalance.add(amount).wadToRay());
|
||||||
|
|
||||||
require(vars.newStableRate < (1 << 128), 'Debt token: stable rate overflow');
|
require(vars.newStableRate < type(uint128).max, 'Debt token: stable rate overflow');
|
||||||
_usersStableRate[onBehalfOf] = vars.newStableRate;
|
_usersStableRate[onBehalfOf] = vars.newStableRate;
|
||||||
|
|
||||||
//updating the user and supply timestamp
|
//updating the user and supply timestamp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user