Skip to content

Latest commit

 

History

History
211 lines (185 loc) · 6.72 KB

errorreporter.md

File metadata and controls

211 lines (185 loc) · 6.72 KB
layout title
default
ErrorReporter

ErrorReporter.sol

View Source: contracts/ErrorReporter.sol

↘ Derived Contracts: CarefulMath, Exponential, Liquidator, SafeToken

****

Enums

Error

enum Error {
 NO_ERROR,
 OPAQUE_ERROR,
 UNAUTHORIZED,
 INTEGER_OVERFLOW,
 INTEGER_UNDERFLOW,
 DIVISION_BY_ZERO,
 BAD_INPUT,
 TOKEN_INSUFFICIENT_ALLOWANCE,
 TOKEN_INSUFFICIENT_BALANCE,
 TOKEN_TRANSFER_FAILED,
 MARKET_NOT_SUPPORTED,
 SUPPLY_RATE_CALCULATION_FAILED,
 BORROW_RATE_CALCULATION_FAILED,
 TOKEN_INSUFFICIENT_CASH,
 TOKEN_TRANSFER_OUT_FAILED,
 INSUFFICIENT_LIQUIDITY,
 INSUFFICIENT_BALANCE,
 INVALID_COLLATERAL_RATIO,
 MISSING_ASSET_PRICE,
 EQUITY_INSUFFICIENT_BALANCE,
 INVALID_CLOSE_AMOUNT_REQUESTED,
 ASSET_NOT_PRICED,
 INVALID_LIQUIDATION_DISCOUNT,
 INVALID_COMBINED_RISK_PARAMETERS,
 ZERO_ORACLE_ADDRESS,
 CONTRACT_PAUSED,
 KYC_ADMIN_CHECK_FAILED,
 KYC_ADMIN_ADD_OR_DELETE_ADMIN_CHECK_FAILED,
 KYC_CUSTOMER_VERIFICATION_CHECK_FAILED,
 LIQUIDATOR_CHECK_FAILED,
 LIQUIDATOR_ADD_OR_DELETE_ADMIN_CHECK_FAILED,
 SET_WETH_ADDRESS_ADMIN_CHECK_FAILED,
 WETH_ADDRESS_NOT_SET_ERROR,
 ETHER_AMOUNT_MISMATCH_ERROR
}

FailureInfo

enum FailureInfo {
 ACCEPT_ADMIN_PENDING_ADMIN_CHECK,
 BORROW_ACCOUNT_LIQUIDITY_CALCULATION_FAILED,
 BORROW_ACCOUNT_SHORTFALL_PRESENT,
 BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
 BORROW_AMOUNT_LIQUIDITY_SHORTFALL,
 BORROW_AMOUNT_VALUE_CALCULATION_FAILED,
 BORROW_CONTRACT_PAUSED,
 BORROW_MARKET_NOT_SUPPORTED,
 BORROW_NEW_BORROW_INDEX_CALCULATION_FAILED,
 BORROW_NEW_BORROW_RATE_CALCULATION_FAILED,
 BORROW_NEW_SUPPLY_INDEX_CALCULATION_FAILED,
 BORROW_NEW_SUPPLY_RATE_CALCULATION_FAILED,
 BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
 BORROW_NEW_TOTAL_BORROW_CALCULATION_FAILED,
 BORROW_NEW_TOTAL_CASH_CALCULATION_FAILED,
 BORROW_ORIGINATION_FEE_CALCULATION_FAILED,
 BORROW_TRANSFER_OUT_FAILED,
 EQUITY_WITHDRAWAL_AMOUNT_VALIDATION,
 EQUITY_WITHDRAWAL_CALCULATE_EQUITY,
 EQUITY_WITHDRAWAL_MODEL_OWNER_CHECK,
 EQUITY_WITHDRAWAL_TRANSFER_OUT_FAILED,
 LIQUIDATE_ACCUMULATED_BORROW_BALANCE_CALCULATION_FAILED,
 LIQUIDATE_ACCUMULATED_SUPPLY_BALANCE_CALCULATION_FAILED_BORROWER_COLLATERAL_ASSET,
 LIQUIDATE_ACCUMULATED_SUPPLY_BALANCE_CALCULATION_FAILED_LIQUIDATOR_COLLATERAL_ASSET,
 LIQUIDATE_AMOUNT_SEIZE_CALCULATION_FAILED,
 LIQUIDATE_BORROW_DENOMINATED_COLLATERAL_CALCULATION_FAILED,
 LIQUIDATE_CLOSE_AMOUNT_TOO_HIGH,
 LIQUIDATE_CONTRACT_PAUSED,
 LIQUIDATE_DISCOUNTED_REPAY_TO_EVEN_AMOUNT_CALCULATION_FAILED,
 LIQUIDATE_NEW_BORROW_INDEX_CALCULATION_FAILED_BORROWED_ASSET,
 LIQUIDATE_NEW_BORROW_INDEX_CALCULATION_FAILED_COLLATERAL_ASSET,
 LIQUIDATE_NEW_BORROW_RATE_CALCULATION_FAILED_BORROWED_ASSET,
 LIQUIDATE_NEW_SUPPLY_INDEX_CALCULATION_FAILED_BORROWED_ASSET,
 LIQUIDATE_NEW_SUPPLY_INDEX_CALCULATION_FAILED_COLLATERAL_ASSET,
 LIQUIDATE_NEW_SUPPLY_RATE_CALCULATION_FAILED_BORROWED_ASSET,
 LIQUIDATE_NEW_TOTAL_BORROW_CALCULATION_FAILED_BORROWED_ASSET,
 LIQUIDATE_NEW_TOTAL_CASH_CALCULATION_FAILED_BORROWED_ASSET,
 LIQUIDATE_NEW_TOTAL_SUPPLY_BALANCE_CALCULATION_FAILED_BORROWER_COLLATERAL_ASSET,
 LIQUIDATE_NEW_TOTAL_SUPPLY_BALANCE_CALCULATION_FAILED_LIQUIDATOR_COLLATERAL_ASSET,
 LIQUIDATE_FETCH_ASSET_PRICE_FAILED,
 LIQUIDATE_TRANSFER_IN_FAILED,
 LIQUIDATE_TRANSFER_IN_NOT_POSSIBLE,
 REPAY_BORROW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
 REPAY_BORROW_CONTRACT_PAUSED,
 REPAY_BORROW_NEW_BORROW_INDEX_CALCULATION_FAILED,
 REPAY_BORROW_NEW_BORROW_RATE_CALCULATION_FAILED,
 REPAY_BORROW_NEW_SUPPLY_INDEX_CALCULATION_FAILED,
 REPAY_BORROW_NEW_SUPPLY_RATE_CALCULATION_FAILED,
 REPAY_BORROW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
 REPAY_BORROW_NEW_TOTAL_BORROW_CALCULATION_FAILED,
 REPAY_BORROW_NEW_TOTAL_CASH_CALCULATION_FAILED,
 REPAY_BORROW_TRANSFER_IN_FAILED,
 REPAY_BORROW_TRANSFER_IN_NOT_POSSIBLE,
 SET_ASSET_PRICE_CHECK_ORACLE,
 SET_MARKET_INTEREST_RATE_MODEL_OWNER_CHECK,
 SET_ORACLE_OWNER_CHECK,
 SET_ORIGINATION_FEE_OWNER_CHECK,
 SET_PAUSED_OWNER_CHECK,
 SET_PENDING_ADMIN_OWNER_CHECK,
 SET_RISK_PARAMETERS_OWNER_CHECK,
 SET_RISK_PARAMETERS_VALIDATION,
 SUPPLY_ACCUMULATED_BALANCE_CALCULATION_FAILED,
 SUPPLY_CONTRACT_PAUSED,
 SUPPLY_MARKET_NOT_SUPPORTED,
 SUPPLY_NEW_BORROW_INDEX_CALCULATION_FAILED,
 SUPPLY_NEW_BORROW_RATE_CALCULATION_FAILED,
 SUPPLY_NEW_SUPPLY_INDEX_CALCULATION_FAILED,
 SUPPLY_NEW_SUPPLY_RATE_CALCULATION_FAILED,
 SUPPLY_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
 SUPPLY_NEW_TOTAL_CASH_CALCULATION_FAILED,
 SUPPLY_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
 SUPPLY_TRANSFER_IN_FAILED,
 SUPPLY_TRANSFER_IN_NOT_POSSIBLE,
 SUPPORT_MARKET_FETCH_PRICE_FAILED,
 SUPPORT_MARKET_OWNER_CHECK,
 SUPPORT_MARKET_PRICE_CHECK,
 SUSPEND_MARKET_OWNER_CHECK,
 WITHDRAW_ACCOUNT_LIQUIDITY_CALCULATION_FAILED,
 WITHDRAW_ACCOUNT_SHORTFALL_PRESENT,
 WITHDRAW_ACCUMULATED_BALANCE_CALCULATION_FAILED,
 WITHDRAW_AMOUNT_LIQUIDITY_SHORTFALL,
 WITHDRAW_AMOUNT_VALUE_CALCULATION_FAILED,
 WITHDRAW_CAPACITY_CALCULATION_FAILED,
 WITHDRAW_CONTRACT_PAUSED,
 WITHDRAW_NEW_BORROW_INDEX_CALCULATION_FAILED,
 WITHDRAW_NEW_BORROW_RATE_CALCULATION_FAILED,
 WITHDRAW_NEW_SUPPLY_INDEX_CALCULATION_FAILED,
 WITHDRAW_NEW_SUPPLY_RATE_CALCULATION_FAILED,
 WITHDRAW_NEW_TOTAL_BALANCE_CALCULATION_FAILED,
 WITHDRAW_NEW_TOTAL_SUPPLY_CALCULATION_FAILED,
 WITHDRAW_TRANSFER_OUT_FAILED,
 WITHDRAW_TRANSFER_OUT_NOT_POSSIBLE,
 KYC_ADMIN_CHECK_FAILED,
 KYC_ADMIN_ADD_OR_DELETE_ADMIN_CHECK_FAILED,
 KYC_CUSTOMER_VERIFICATION_CHECK_FAILED,
 LIQUIDATOR_CHECK_FAILED,
 LIQUIDATOR_ADD_OR_DELETE_ADMIN_CHECK_FAILED,
 SET_WETH_ADDRESS_ADMIN_CHECK_FAILED,
 WETH_ADDRESS_NOT_SET_ERROR,
 SEND_ETHER_ADMIN_CHECK_FAILED,
 ETHER_AMOUNT_MISMATCH_ERROR
}

Events

event Failure(uint256  error, uint256  info, uint256  detail);

Functions

  • fail(enum ErrorReporter.Error err, enum ErrorReporter.FailureInfo info)
  • failOpaque(enum ErrorReporter.FailureInfo info, uint256 opaqueError)

fail

use this when reporting a known error from the Alkemi Earn Verified or a non-upgradeable collaborator

function fail(enum ErrorReporter.Error err, enum ErrorReporter.FailureInfo info) internal nonpayable
returns(uint256)

Arguments

Name Type Description
err enum ErrorReporter.Error
info enum ErrorReporter.FailureInfo

failOpaque

use this when reporting an opaque error from an upgradeable collaborator contract

function failOpaque(enum ErrorReporter.FailureInfo info, uint256 opaqueError) internal nonpayable
returns(uint256)

Arguments

Name Type Description
info enum ErrorReporter.FailureInfo
opaqueError uint256