diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol index 3f044b17..61f5aaf6 100644 --- a/contracts/libraries/helpers/Errors.sol +++ b/contracts/libraries/helpers/Errors.sol @@ -98,6 +98,8 @@ library Errors { string public constant LP_INCONSISTENT_PARAMS_LENGTH = '74'; string public constant UL_INVALID_INDEX = '77'; string public constant LP_NOT_CONTRACT = '78'; + string public constant AT_STABLE_DEBT_OVERFLOW = '79'; + string public constant AT_BURN_EXCEEDS_BALANCE = '80'; enum CollateralManagerErrors { NO_ERROR, diff --git a/contracts/libraries/logic/ReserveLogic.sol b/contracts/libraries/logic/ReserveLogic.sol index 559c13d1..6774cd6e 100644 --- a/contracts/libraries/logic/ReserveLogic.sol +++ b/contracts/libraries/logic/ReserveLogic.sol @@ -247,9 +247,9 @@ library ReserveLogic { vars.avgStableRate, reserve.configuration.getReserveFactor() ); - require(vars.newLiquidityRate < type(uint128).max, 'ReserveLogic: Liquidity rate overflow'); - require(vars.newStableRate < type(uint128).max, 'ReserveLogic: Stable borrow rate overflow'); - require(vars.newVariableRate < type(uint128).max, 'ReserveLogic: Variable borrow rate overflow'); + require(vars.newLiquidityRate < type(uint128).max, Errors.RL_LIQUIDITY_RATE_OVERFLOW); + require(vars.newStableRate < type(uint128).max, Errors.RL_STABLE_BORROW_RATE_OVERFLOW); + require(vars.newVariableRate < type(uint128).max, Errors.RL_VARIABLE_BORROW_RATE_OVERFLOW); reserve.currentLiquidityRate = uint128(vars.newLiquidityRate); reserve.currentStableBorrowRate = uint128(vars.newStableRate); diff --git a/contracts/tokenization/StableDebtToken.sol b/contracts/tokenization/StableDebtToken.sol index e593c188..1184be79 100644 --- a/contracts/tokenization/StableDebtToken.sol +++ b/contracts/tokenization/StableDebtToken.sol @@ -5,6 +5,7 @@ import {DebtTokenBase} from './base/DebtTokenBase.sol'; import {MathUtils} from '../libraries/math/MathUtils.sol'; import {WadRayMath} from '../libraries/math/WadRayMath.sol'; import {IStableDebtToken} from './interfaces/IStableDebtToken.sol'; +import {Errors} from '../libraries/helpers/Errors.sol'; /** * @title contract StableDebtToken @@ -122,7 +123,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { .add(vars.amountInRay.rayMul(rate)) .rayDiv(currentBalance.add(amount).wadToRay()); - require(vars.newStableRate < type(uint128).max, 'Debt token: stable rate overflow'); + require(vars.newStableRate < type(uint128).max, Errors.AT_STABLE_DEBT_OVERFLOW); _usersStableRate[onBehalfOf] = vars.newStableRate; //updating the user and supply timestamp @@ -342,7 +343,7 @@ contract StableDebtToken is IStableDebtToken, DebtTokenBase { uint256 oldTotalSupply ) internal { uint256 oldAccountBalance = _balances[account]; - _balances[account] = oldAccountBalance.sub(amount, 'ERC20: burn amount exceeds balance'); + _balances[account] = oldAccountBalance.sub(amount, Errors.AT_BURN_EXCEEDS_BALANCE); if (address(_incentivesController) != address(0)) { _incentivesController.handleAction(account, oldTotalSupply, oldAccountBalance);