mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Replaced hardcoded error messages on ReserveLogic.
This commit is contained in:
parent
0f086a8a27
commit
693576f853
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user