From 479aa3ef8e1172aa9c43e3d2151e1e884a8c2180 Mon Sep 17 00:00:00 2001 From: David Racero Date: Thu, 15 Oct 2020 09:38:46 +0200 Subject: [PATCH] Updated numbers --- contracts/libraries/helpers/Errors.sol | 60 +++++++++++++------------- helpers/types.ts | 46 +++++++++++++------- 2 files changed, 60 insertions(+), 46 deletions(-) diff --git a/contracts/libraries/helpers/Errors.sol b/contracts/libraries/helpers/Errors.sol index 75d23dc2..19ec4619 100644 --- a/contracts/libraries/helpers/Errors.sol +++ b/contracts/libraries/helpers/Errors.sol @@ -45,36 +45,36 @@ library Errors { string public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = '26'; // 'The actual balance of the protocol is inconsistent' string public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = '27'; // 'The actual balance of the protocol is inconsistent' string public constant AT_CALLER_MUST_BE_LENDING_POOL = '28'; // 'The caller of this function must be a lending pool' - string public constant AT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself' - string public constant AT_TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero' - string public constant RL_RESERVE_ALREADY_INITIALIZED = '34'; // 'Reserve has already been initialized' - string public constant LPC_CALLER_NOT_AAVE_ADMIN = '35'; // 'The caller must be the aave admin' - string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = '36'; // 'The liquidity of the reserve needs to be 0' - string public constant LPAPR_PROVIDER_NOT_REGISTERED = '37'; // 'Provider is not registered' - string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38'; // 'Health factor is not below the threshold' - string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '39'; // 'The collateral chosen cannot be liquidated' - string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '40'; // 'User did not borrow the specified currency' - string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '41'; // "There isn't enough liquidity available to liquidate" - string public constant LPCM_NO_ERRORS = '42'; // 'No errors' - string public constant LP_INVALID_FLASHLOAN_MODE = '43'; //Invalid flashloan mode selected - string public constant MATH_MULTIPLICATION_OVERFLOW = '44'; - string public constant MATH_ADDITION_OVERFLOW = '45'; - string public constant MATH_DIVISION_BY_ZERO = '46'; - string public constant RL_LIQUIDITY_INDEX_OVERFLOW = '47'; // Liquidity index overflows uint128 - string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = '48'; // Variable borrow index overflows uint128 - string public constant RL_LIQUIDITY_RATE_OVERFLOW = '49'; // Liquidity rate overflows uint128 - string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = '50'; // Variable borrow rate overflows uint128 - string public constant RL_STABLE_BORROW_RATE_OVERFLOW = '51'; // Stable borrow rate overflows uint128 - string public constant AT_INVALID_MINT_AMOUNT = '53'; //invalid amount to mint - string public constant LP_FAILED_REPAY_WITH_COLLATERAL = '53'; - string public constant AT_INVALID_BURN_AMOUNT = '54'; //invalid amount to burn - string public constant LP_BORROW_ALLOWANCE_ARE_NOT_ENOUGH = '54'; // User borrows on behalf, but allowance are too small - string public constant LP_FAILED_COLLATERAL_SWAP = '55'; - string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '56'; - string public constant LP_REENTRANCY_NOT_ALLOWED = '57'; - string public constant P_IS_PAUSED = '58'; // 'Pool is paused' - string public constant LP_NO_MORE_RESERVES_ALLOWED = '59'; - string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '60'; + string public constant AT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '29'; // 'User cannot give allowance to himself' + string public constant AT_TRANSFER_AMOUNT_NOT_GT_0 = '30'; // 'Transferred amount needs to be greater than zero' + string public constant RL_RESERVE_ALREADY_INITIALIZED = '31'; // 'Reserve has already been initialized' + string public constant LPC_CALLER_NOT_AAVE_ADMIN = '32'; // 'The caller must be the aave admin' + string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = '33'; // 'The liquidity of the reserve needs to be 0' + string public constant LPAPR_PROVIDER_NOT_REGISTERED = '34'; // 'Provider is not registered' + string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '35'; // 'Health factor is not below the threshold' + string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '36'; // 'The collateral chosen cannot be liquidated' + string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '37'; // 'User did not borrow the specified currency' + string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '38'; // "There isn't enough liquidity available to liquidate" + string public constant LPCM_NO_ERRORS = '39'; // 'No errors' + string public constant LP_INVALID_FLASHLOAN_MODE = '40'; //Invalid flashloan mode selected + string public constant MATH_MULTIPLICATION_OVERFLOW = '41'; + string public constant MATH_ADDITION_OVERFLOW = '42'; + string public constant MATH_DIVISION_BY_ZERO = '43'; + string public constant RL_LIQUIDITY_INDEX_OVERFLOW = '44'; // Liquidity index overflows uint128 + string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = '45'; // Variable borrow index overflows uint128 + string public constant RL_LIQUIDITY_RATE_OVERFLOW = '46'; // Liquidity rate overflows uint128 + string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = '47'; // Variable borrow rate overflows uint128 + string public constant RL_STABLE_BORROW_RATE_OVERFLOW = '48'; // Stable borrow rate overflows uint128 + string public constant AT_INVALID_MINT_AMOUNT = '49'; //invalid amount to mint + string public constant LP_FAILED_REPAY_WITH_COLLATERAL = '50'; + string public constant AT_INVALID_BURN_AMOUNT = '51'; //invalid amount to burn + string public constant LP_BORROW_ALLOWANCE_ARE_NOT_ENOUGH = '52'; // User borrows on behalf, but allowance are too small + string public constant LP_FAILED_COLLATERAL_SWAP = '53'; + string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '54'; + string public constant LP_REENTRANCY_NOT_ALLOWED = '55'; + string public constant P_IS_PAUSED = '56'; // 'Pool is paused' + string public constant LP_NO_MORE_RESERVES_ALLOWED = '57'; + string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '58'; enum CollateralManagerErrors { NO_ERROR, NO_COLLATERAL_AVAILABLE, diff --git a/helpers/types.ts b/helpers/types.ts index 4a271acd..4897bbb8 100644 --- a/helpers/types.ts +++ b/helpers/types.ts @@ -99,22 +99,36 @@ export enum ProtocolErrors { LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = '26', // 'The actual balance of the protocol is inconsistent' LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = '27', // 'The actual balance of the protocol is inconsistent' AT_CALLER_MUST_BE_LENDING_POOL = '28', // 'The caller of this function must be a lending pool' - AT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30', // 'User cannot give allowance to himself' - AT_TRANSFER_AMOUNT_NOT_GT_0 = '31', // 'Transferred amount needs to be greater than zero' - RL_RESERVE_ALREADY_INITIALIZED = '34', // 'Reserve has already been initialized' - LPC_CALLER_NOT_AAVE_ADMIN = '35', // 'The caller must be the aave admin' - LPC_RESERVE_LIQUIDITY_NOT_0 = '36', // 'The liquidity of the reserve needs to be 0' - LPAPR_PROVIDER_NOT_REGISTERED = '37', // 'Provider is not registered' - LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '38', // 'Health factor is not below the threshold' - LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '39', // 'The collateral chosen cannot be liquidated' - LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '40', // 'User did not borrow the specified currency' - LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '41', // "There isn't enough liquidity available to liquidate" - LPCM_NO_ERRORS = '42', // 'No errors' - LP_INVALID_FLASHLOAN_MODE = '43', //Invalid flashloan mode - LP_INVALID_EQUAL_ASSETS_TO_SWAP = '56', // User can't use same reserve as destination of liquidity swap - P_IS_PAUSED = '58', // Pool is paused - LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '60', // The flash loan received returned 0 (EOA) - + AT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '29', // 'User cannot give allowance to himself' + AT_TRANSFER_AMOUNT_NOT_GT_0 = '30', // 'Transferred amount needs to be greater than zero' + RL_RESERVE_ALREADY_INITIALIZED = '31', // 'Reserve has already been initialized' + LPC_CALLER_NOT_AAVE_ADMIN = '32', // 'The caller must be the aave admin' + LPC_RESERVE_LIQUIDITY_NOT_0 = '33', // 'The liquidity of the reserve needs to be 0' + LPAPR_PROVIDER_NOT_REGISTERED = '34', // 'Provider is not registered' + LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '35', // 'Health factor is not below the threshold' + LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '36', // 'The collateral chosen cannot be liquidated' + LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '37', // 'User did not borrow the specified currency' + LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '38', // "There isn't enough liquidity available to liquidate" + LPCM_NO_ERRORS = '39', // 'No errors' + LP_INVALID_FLASHLOAN_MODE = '40', //Invalid flashloan mode selected + MATH_MULTIPLICATION_OVERFLOW = '41', + MATH_ADDITION_OVERFLOW = '42', + MATH_DIVISION_BY_ZERO = '43', + RL_LIQUIDITY_INDEX_OVERFLOW = '44', // Liquidity index overflows uint128 + RL_VARIABLE_BORROW_INDEX_OVERFLOW = '45', // Variable borrow index overflows uint128 + RL_LIQUIDITY_RATE_OVERFLOW = '46', // Liquidity rate overflows uint128 + RL_VARIABLE_BORROW_RATE_OVERFLOW = '47', // Variable borrow rate overflows uint128 + RL_STABLE_BORROW_RATE_OVERFLOW = '48', // Stable borrow rate overflows uint128 + AT_INVALID_MINT_AMOUNT = '49', //invalid amount to mint + LP_FAILED_REPAY_WITH_COLLATERAL = '50', + AT_INVALID_BURN_AMOUNT = '51', //invalid amount to burn + LP_BORROW_ALLOWANCE_ARE_NOT_ENOUGH = '52', // User borrows on behalf, but allowance are too small + LP_FAILED_COLLATERAL_SWAP = '53', + LP_INVALID_EQUAL_ASSETS_TO_SWAP = '54', + LP_REENTRANCY_NOT_ALLOWED = '55', + P_IS_PAUSED = '56', // 'Pool is paused' + LP_NO_MORE_RESERVES_ALLOWED = '57', + LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '58', // old INVALID_FROM_BALANCE_AFTER_TRANSFER = 'Invalid from balance after transfer',