2020-09-04 08:27:32 +00:00
// SPDX-License-Identifier: agpl-3.0
2020-11-20 10:45:20 +00:00
pragma solidity 0 . 6 . 12 ;
2020-09-04 08:27:32 +00:00
/**
* @ title Errors library
* @ author Aave
2020-11-25 17:33:49 +00:00
* @ notice Defines the error messages emitted by the different contracts of the Aave protocol
2020-10-14 09:03:32 +00:00
* @ dev Error messages prefix glossary :
* - VL = ValidationLogic
* - MATH = Math libraries
2020-11-12 12:54:23 +00:00
* - CT = Common errors between tokens ( AToken , VariableDebtToken and StableDebtToken )
* - AT = AToken
* - SDT = StableDebtToken
* - VDT = VariableDebtToken
2020-10-14 09:03:32 +00:00
* - LP = LendingPool
* - LPAPR = LendingPoolAddressesProviderRegistry
* - LPC = LendingPoolConfiguration
* - RL = ReserveLogic
* - LPCM = LendingPoolCollateralManager
* - P = Pausable
2020-09-04 08:27:32 +00:00
* /
library Errors {
2020-11-02 11:54:56 +00:00
//common errors
2020-11-05 11:35:50 +00:00
string public constant CALLER_NOT_POOL_ADMIN = ' 33 ' ; // 'The caller must be the pool admin'
2020-11-03 18:47:57 +00:00
string public constant BORROW_ALLOWANCE_NOT_ENOUGH = ' 59 ' ; // User borrows on behalf, but allowance are too small
2020-11-02 11:54:56 +00:00
//contract specific errors
2020-11-10 13:11:01 +00:00
string public constant VL_INVALID_AMOUNT = ' 1 ' ; // 'Amount must be greater than 0'
2020-10-14 09:03:32 +00:00
string public constant VL_NO_ACTIVE_RESERVE = ' 2 ' ; // 'Action requires an active reserve'
2020-10-31 12:47:16 +00:00
string public constant VL_RESERVE_FROZEN = ' 3 ' ; // 'Action cannot be performed because the reserve is frozen'
2020-10-14 09:03:32 +00:00
string public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = ' 4 ' ; // 'The current liquidity is not enough'
string public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = ' 5 ' ; // 'User cannot withdraw more than the available balance'
string public constant VL_BORROWING_NOT_ENABLED = ' 7 ' ; // 'Borrowing is not enabled'
string public constant VL_INVALID_INTEREST_RATE_MODE_SELECTED = ' 8 ' ; // 'Invalid interest rate mode selected'
string public constant VL_COLLATERAL_BALANCE_IS_0 = ' 9 ' ; // 'The collateral balance is 0'
string public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = ' 10 ' ; // 'Health factor is lesser than the liquidation threshold'
string public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = ' 11 ' ; // 'There is not enough collateral to cover a new borrow'
string public constant VL_STABLE_BORROWING_NOT_ENABLED = ' 12 ' ; // stable borrowing not enabled
2020-10-31 12:10:26 +00:00
string public constant VL_COLLATERAL_SAME_AS_BORROWING_CURRENCY = ' 13 ' ; // collateral is (mostly) the same currency that is being borrowed
2020-10-14 09:03:32 +00:00
string public constant VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = ' 14 ' ; // 'The requested amount is greater than the max loan size in stable rate mode
string public constant VL_NO_DEBT_OF_SELECTED_TYPE = ' 15 ' ; // 'for repayment of stable debt, the user needs to have stable debt, otherwise, he needs to have variable debt'
string public constant VL_NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = ' 16 ' ; // 'To repay on behalf of an user an explicit amount to repay is needed'
string public constant VL_NO_STABLE_RATE_LOAN_IN_RESERVE = ' 17 ' ; // 'User does not have a stable rate loan in progress on this reserve'
string public constant VL_NO_VARIABLE_RATE_LOAN_IN_RESERVE = ' 18 ' ; // 'User does not have a variable rate loan in progress on this reserve'
string public constant VL_UNDERLYING_BALANCE_NOT_GREATER_THAN_0 = ' 19 ' ; // 'The underlying balance needs to be greater than 0'
string public constant VL_DEPOSIT_ALREADY_IN_USE = ' 20 ' ; // 'User deposit is already being used as collateral'
string public constant LP_NOT_ENOUGH_STABLE_BORROW_BALANCE = ' 21 ' ; // 'User does not have any stable rate loan for this reserve'
string public constant LP_INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = ' 22 ' ; // 'Interest rate rebalance conditions were not met'
string public constant LP_LIQUIDATION_CALL_FAILED = ' 23 ' ; // 'Liquidation call failed'
string public constant LP_NOT_ENOUGH_LIQUIDITY_TO_BORROW = ' 24 ' ; // 'There is not enough liquidity available to borrow'
string public constant LP_REQUESTED_AMOUNT_TOO_SMALL = ' 25 ' ; // 'The requested amount is too small for a FlashLoan.'
string public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = ' 26 ' ; // 'The actual balance of the protocol is inconsistent'
2020-11-05 11:35:50 +00:00
string public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = ' 27 ' ; // 'The caller of the function is not the lending pool configurator'
2020-10-30 12:40:06 +00:00
string public constant LP_INCONSISTENT_FLASHLOAN_PARAMS = ' 28 ' ;
2020-11-12 12:54:23 +00:00
string public constant CT_CALLER_MUST_BE_LENDING_POOL = ' 29 ' ; // 'The caller of this function must be a lending pool'
string public constant CT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = ' 30 ' ; // 'User cannot give allowance to himself'
string public constant CT_TRANSFER_AMOUNT_NOT_GT_0 = ' 31 ' ; // 'Transferred amount needs to be greater than zero'
2020-10-30 12:40:06 +00:00
string public constant RL_RESERVE_ALREADY_INITIALIZED = ' 32 ' ; // 'Reserve has already been initialized'
string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = ' 34 ' ; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_ATOKEN_POOL_ADDRESS = ' 35 ' ; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = ' 36 ' ; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = ' 37 ' ; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = ' 38 ' ; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = ' 39 ' ; // 'The liquidity of the reserve needs to be 0'
string public constant LPC_INVALID_ADDRESSES_PROVIDER_ID = ' 40 ' ; // 'The liquidity of the reserve needs to be 0'
2020-10-31 12:10:26 +00:00
string public constant LPC_INVALID_CONFIGURATION = ' 75 ' ; // 'Invalid risk parameters for the reserve'
2020-11-05 11:35:50 +00:00
string public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = ' 76 ' ; // 'The caller must be the emergency admin'
2020-10-30 12:40:06 +00:00
string public constant LPAPR_PROVIDER_NOT_REGISTERED = ' 41 ' ; // 'Provider is not registered'
string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = ' 42 ' ; // 'Health factor is not below the threshold'
string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = ' 43 ' ; // 'The collateral chosen cannot be liquidated'
string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = ' 44 ' ; // 'User did not borrow the specified currency'
string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = ' 45 ' ; // "There isn't enough liquidity available to liquidate"
string public constant LPCM_NO_ERRORS = ' 46 ' ; // 'No errors'
string public constant LP_INVALID_FLASHLOAN_MODE = ' 47 ' ; //Invalid flashloan mode selected
string public constant MATH_MULTIPLICATION_OVERFLOW = ' 48 ' ;
string public constant MATH_ADDITION_OVERFLOW = ' 49 ' ;
string public constant MATH_DIVISION_BY_ZERO = ' 50 ' ;
string public constant RL_LIQUIDITY_INDEX_OVERFLOW = ' 51 ' ; // Liquidity index overflows uint128
string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = ' 52 ' ; // Variable borrow index overflows uint128
string public constant RL_LIQUIDITY_RATE_OVERFLOW = ' 53 ' ; // Liquidity rate overflows uint128
string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = ' 54 ' ; // Variable borrow rate overflows uint128
string public constant RL_STABLE_BORROW_RATE_OVERFLOW = ' 55 ' ; // Stable borrow rate overflows uint128
2020-11-12 12:54:23 +00:00
string public constant CT_INVALID_MINT_AMOUNT = ' 56 ' ; //invalid amount to mint
2020-10-30 12:40:06 +00:00
string public constant LP_FAILED_REPAY_WITH_COLLATERAL = ' 57 ' ;
2020-11-12 12:54:23 +00:00
string public constant CT_INVALID_BURN_AMOUNT = ' 58 ' ; //invalid amount to burn
2020-10-30 12:40:06 +00:00
string public constant LP_FAILED_COLLATERAL_SWAP = ' 60 ' ;
string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = ' 61 ' ;
string public constant LP_REENTRANCY_NOT_ALLOWED = ' 62 ' ;
2021-05-31 08:34:10 +00:00
string public constant VL_CALLER_MUST_BE_AN_ATOKEN = ' 63 ' ;
2020-10-31 12:55:19 +00:00
string public constant LP_IS_PAUSED = ' 64 ' ; // 'Pool is paused'
2020-10-30 12:40:06 +00:00
string public constant LP_NO_MORE_RESERVES_ALLOWED = ' 65 ' ;
string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = ' 66 ' ;
string public constant RC_INVALID_LTV = ' 67 ' ;
string public constant RC_INVALID_LIQ_THRESHOLD = ' 68 ' ;
string public constant RC_INVALID_LIQ_BONUS = ' 69 ' ;
string public constant RC_INVALID_DECIMALS = ' 70 ' ;
string public constant RC_INVALID_RESERVE_FACTOR = ' 71 ' ;
string public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = ' 72 ' ;
2020-10-30 15:52:44 +00:00
string public constant VL_INCONSISTENT_FLASHLOAN_PARAMS = ' 73 ' ;
string public constant LP_INCONSISTENT_PARAMS_LENGTH = ' 74 ' ;
2020-11-10 16:21:59 +00:00
string public constant UL_INVALID_INDEX = ' 77 ' ;
2020-11-10 16:50:13 +00:00
string public constant LP_NOT_CONTRACT = ' 78 ' ;
2020-11-12 12:54:23 +00:00
string public constant SDT_STABLE_DEBT_OVERFLOW = ' 79 ' ;
string public constant SDT_BURN_EXCEEDS_BALANCE = ' 80 ' ;
2021-04-27 16:26:08 +00:00
string public constant VL_BORROW_CAP_EXCEEDED = ' 81 ' ;
2021-04-23 15:32:07 +00:00
string public constant RC_INVALID_BORROW_CAP = ' 82 ' ;
2021-04-30 14:14:59 +00:00
string public constant VL_SUPPLY_CAP_EXCEEDED = ' 83 ' ;
string public constant RC_INVALID_SUPPLY_CAP = ' 84 ' ;
2021-05-05 08:16:09 +00:00
string public constant LPC_CALLER_NOT_EMERGENCY_OR_POOL_ADMIN = ' 85 ' ;
string public constant VL_RESERVE_PAUSED = ' 86 ' ;
2020-10-28 09:54:09 +00:00
2020-09-16 12:09:42 +00:00
enum CollateralManagerErrors {
2020-09-14 08:52:31 +00:00
NO_ERROR ,
NO_COLLATERAL_AVAILABLE ,
COLLATERAL_CANNOT_BE_LIQUIDATED ,
CURRRENCY_NOT_BORROWED ,
HEALTH_FACTOR_ABOVE_THRESHOLD ,
NOT_ENOUGH_LIQUIDITY ,
2020-09-15 07:56:41 +00:00
NO_ACTIVE_RESERVE ,
HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD ,
2020-09-16 07:22:46 +00:00
INVALID_EQUAL_ASSETS_TO_SWAP ,
2021-05-10 08:01:50 +00:00
FROZEN_RESERVE ,
PAUSED_RESERVE
2020-09-14 08:52:31 +00:00
}
2020-09-04 08:27:32 +00:00
}