diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol index 43bf1a5b..2dff6ced 100644 --- a/contracts/libraries/helpers/Errors.sol +++ b/contracts/libraries/helpers/Errors.sol @@ -22,7 +22,7 @@ library Errors { string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small //contract specific errors - string public constant VL_AMOUNT_NOT_GREATER_THAN_0 = '1'; // 'Amount must be greater than 0' + string public constant VL_INVALID_AMOUNT = '1'; // 'Amount must be greater than 0' string public constant VL_NO_ACTIVE_RESERVE = '2'; // 'Action requires an active reserve' string public constant VL_RESERVE_FROZEN = '3'; // 'Action cannot be performed because the reserve is frozen' string public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = '4'; // 'The current liquidity is not enough' diff --git a/contracts/libraries/logic/ValidationLogic.sol b/contracts/libraries/logic/ValidationLogic.sol index 9ee38df3..a08c5420 100644 --- a/contracts/libraries/logic/ValidationLogic.sol +++ b/contracts/libraries/logic/ValidationLogic.sol @@ -36,7 +36,7 @@ library ValidationLogic { function validateDeposit(ReserveLogic.ReserveData storage reserve, uint256 amount) external view { (bool isActive, bool isFrozen, , ) = reserve.configuration.getFlags(); - require(amount > 0, Errors.VL_AMOUNT_NOT_GREATER_THAN_0); + require(amount != 0, Errors.VL_INVALID_AMOUNT); require(isActive, Errors.VL_NO_ACTIVE_RESERVE); require(!isFrozen, Errors.VL_RESERVE_FROZEN); } @@ -62,7 +62,7 @@ library ValidationLogic { uint256 reservesCount, address oracle ) external view { - require(amount > 0, Errors.VL_AMOUNT_NOT_GREATER_THAN_0); + require(amount != 0, Errors.VL_INVALID_AMOUNT); require(amount <= userBalance, Errors.VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE); @@ -139,6 +139,7 @@ library ValidationLogic { require(vars.isActive, Errors.VL_NO_ACTIVE_RESERVE); require(!vars.isFrozen, Errors.VL_RESERVE_FROZEN); + require(amount != 0, Errors.VL_INVALID_AMOUNT); require(vars.borrowingEnabled, Errors.VL_BORROWING_NOT_ENABLED); @@ -232,7 +233,7 @@ library ValidationLogic { require(isActive, Errors.VL_NO_ACTIVE_RESERVE); - require(amountSent > 0, Errors.VL_AMOUNT_NOT_GREATER_THAN_0); + require(amountSent > 0, Errors.VL_INVALID_AMOUNT); require( (stableDebt > 0 && diff --git a/helpers/types.ts b/helpers/types.ts index df6f4afc..75e64f5b 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -83,7 +83,7 @@ export enum ProtocolErrors { CALLER_NOT_POOL_ADMIN = '33', // 'The caller must be the pool admin' //contract specific errors - VL_AMOUNT_NOT_GREATER_THAN_0 = '1', // 'Amount must be greater than 0' + VL_INVALID_AMOUNT = '1', // 'Amount must be greater than 0' VL_NO_ACTIVE_RESERVE = '2', // 'Action requires an active reserve' VL_RESERVE_FROZEN = '3', // 'Action requires an unfrozen reserve' VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = '4', // 'The current liquidity is not enough'