creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n"
      },
      "contracts/mainnet/interfaces/IAaveIncentivesController.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\npragma experimental ABIEncoderV2;\n\ninterface IAaveIncentivesController {\n\tevent RewardsAccrued(address indexed user, uint256 amount);\n\n\tevent RewardsClaimed(address indexed user, address indexed to, uint256 amount);\n\n\tevent RewardsClaimed(address indexed user, address indexed to, address indexed claimer, uint256 amount);\n\n\tevent ClaimerSet(address indexed user, address indexed claimer);\n\n\t/*\n\t * @dev Returns the configuration of the distribution for a certain asset\n\t * @param asset The address of the reference asset of the distribution\n\t * @return The asset index, the emission per second and the last updated timestamp\n\t **/\n\tfunction getAssetData(address asset) external view returns (uint256, uint256, uint256);\n\n\t/**\n\t * @dev Whitelists an address to claim the rewards on behalf of another address\n\t * @param user The address of the user\n\t * @param claimer The address of the claimer\n\t */\n\tfunction setClaimer(address user, address claimer) external;\n\n\t/**\n\t * @dev Returns the whitelisted claimer for a certain address (0x0 if not set)\n\t * @param user The address of the user\n\t * @return The claimer address\n\t */\n\tfunction getClaimer(address user) external view returns (address);\n\n\t/**\n\t * @dev Configure assets for a certain rewards emission\n\t * @param assets The assets to incentivize\n\t * @param emissionsPerSecond The emission for each asset\n\t */\n\tfunction configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond) external;\n\n\t/**\n\t * @dev Called by the corresponding asset on any update that affects the rewards distribution\n\t * @param user The address of the user\n\t **/\n\tfunction handleActionBefore(address user) external;\n\n\t/**\n\t * @dev Called by the corresponding asset on any update that affects the rewards distribution\n\t * @param user The address of the user\n\t * @param userBalance The balance of the user of the asset in the lending pool\n\t * @param totalSupply The total supply of the asset in the lending pool\n\t **/\n\tfunction handleActionAfter(address user, uint256 userBalance, uint256 totalSupply) external;\n\n\t/**\n\t * @dev Returns the total of rewards of an user, already accrued + not yet accrued\n\t * @param user The address of the user\n\t * @return The rewards\n\t **/\n\tfunction getRewardsBalance(address[] calldata assets, address user) external view returns (uint256);\n\n\t/**\n\t * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards\n\t * @param amount Amount of rewards to claim\n\t * @param to Address that will be receiving the rewards\n\t * @return Rewards claimed\n\t **/\n\tfunction claimRewards(address[] calldata assets, uint256 amount, address to) external returns (uint256);\n\n\t/**\n\t * @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must\n\t * be whitelisted via \"allowClaimOnBehalf\" function by the RewardsAdmin role manager\n\t * @param amount Amount of rewards to claim\n\t * @param user Address to check and claim rewards\n\t * @param to Address that will be receiving the rewards\n\t * @return Rewards claimed\n\t **/\n\tfunction claimRewardsOnBehalf(\n\t\taddress[] calldata assets,\n\t\tuint256 amount,\n\t\taddress user,\n\t\taddress to\n\t) external returns (uint256);\n\n\t/**\n\t * @dev returns the unclaimed rewards of the user\n\t * @param user the address of the user\n\t * @return the unclaimed user rewards\n\t */\n\tfunction getUserUnclaimedRewards(address user) external view returns (uint256);\n\n\t/**\n\t * @dev returns the unclaimed rewards of the user\n\t * @param user the address of the user\n\t * @param asset The asset to incentivize\n\t * @return the user index for the asset\n\t */\n\tfunction getUserAssetData(address user, address asset) external view returns (uint256);\n\n\t/**\n\t * @dev for backward compatibility with previous implementation of the Incentives controller\n\t */\n\tfunction REWARD_TOKEN() external view returns (address);\n\n\t/**\n\t * @dev for backward compatibility with previous implementation of the Incentives controller\n\t */\n\tfunction PRECISION() external view returns (uint8);\n\n\t/**\n\t * @dev Gets the distribution end timestamp of the emissions\n\t */\n\tfunction DISTRIBUTION_END() external view returns (uint256);\n}\n"
      },
      "contracts/mainnet/interfaces/IInitializableDebtToken.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\n\nimport {ILendingPool} from \"./ILendingPool.sol\";\nimport {IAaveIncentivesController} from \"./IAaveIncentivesController.sol\";\n\n/**\n * @title IInitializableDebtToken\n * @notice Interface for the initialize function common between debt tokens\n * @author Aave\n **/\ninterface IInitializableDebtToken {\n\t/**\n\t * @dev Emitted when a debt token is initialized\n\t * @param underlyingAsset The address of the underlying asset\n\t * @param pool The address of the associated lending pool\n\t * @param incentivesController The address of the incentives controller for this aToken\n\t * @param debtTokenDecimals the decimals of the debt token\n\t * @param debtTokenName the name of the debt token\n\t * @param debtTokenSymbol the symbol of the debt token\n\t * @param params A set of encoded parameters for additional initialization\n\t **/\n\tevent Initialized(\n\t\taddress indexed underlyingAsset,\n\t\taddress indexed pool,\n\t\taddress incentivesController,\n\t\tuint8 debtTokenDecimals,\n\t\tstring debtTokenName,\n\t\tstring debtTokenSymbol,\n\t\tbytes params\n\t);\n\n\t/**\n\t * @dev Initializes the debt token.\n\t * @param pool The address of the lending pool where this aToken will be used\n\t * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)\n\t * @param incentivesController The smart contract managing potential incentives distribution\n\t * @param debtTokenDecimals The decimals of the debtToken, same as the underlying asset's\n\t * @param debtTokenName The name of the token\n\t * @param debtTokenSymbol The symbol of the token\n\t */\n\tfunction initialize(\n\t\tILendingPool pool,\n\t\taddress underlyingAsset,\n\t\tIAaveIncentivesController incentivesController,\n\t\tuint8 debtTokenDecimals,\n\t\tstring memory debtTokenName,\n\t\tstring memory debtTokenSymbol,\n\t\tbytes calldata params\n\t) external;\n}\n"
      },
      "contracts/mainnet/interfaces/ILendingPool.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\npragma experimental ABIEncoderV2;\n\nimport {ILendingPoolAddressesProvider} from \"./ILendingPoolAddressesProvider.sol\";\nimport {DataTypes} from \"../lending/libraries/types/DataTypes.sol\";\n\ninterface ILendingPool {\n\t/**\n\t * @dev Emitted on deposit()\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param user The address initiating the deposit\n\t * @param onBehalfOf The beneficiary of the deposit, receiving the aTokens\n\t * @param amount The amount deposited\n\t * @param referral The referral code used\n\t **/\n\tevent Deposit(\n\t\taddress indexed reserve,\n\t\taddress user,\n\t\taddress indexed onBehalfOf,\n\t\tuint256 amount,\n\t\tuint16 indexed referral\n\t);\n\n\t/**\n\t * @dev Emitted on withdraw()\n\t * @param reserve The address of the underlyng asset being withdrawn\n\t * @param user The address initiating the withdrawal, owner of aTokens\n\t * @param to Address that will receive the underlying\n\t * @param amount The amount to be withdrawn\n\t **/\n\tevent Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount);\n\n\t/**\n\t * @dev Emitted on borrow() and flashLoan() when debt needs to be opened\n\t * @param reserve The address of the underlying asset being borrowed\n\t * @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just\n\t * initiator of the transaction on flashLoan()\n\t * @param onBehalfOf The address that will be getting the debt\n\t * @param amount The amount borrowed out\n\t * @param borrowRateMode The rate mode: 1 for Stable, 2 for Variable\n\t * @param borrowRate The numeric rate at which the user has borrowed\n\t * @param referral The referral code used\n\t **/\n\tevent Borrow(\n\t\taddress indexed reserve,\n\t\taddress user,\n\t\taddress indexed onBehalfOf,\n\t\tuint256 amount,\n\t\tuint256 borrowRateMode,\n\t\tuint256 borrowRate,\n\t\tuint16 indexed referral\n\t);\n\n\t/**\n\t * @dev Emitted on repay()\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param user The beneficiary of the repayment, getting his debt reduced\n\t * @param repayer The address of the user initiating the repay(), providing the funds\n\t * @param amount The amount repaid\n\t **/\n\tevent Repay(address indexed reserve, address indexed user, address indexed repayer, uint256 amount);\n\n\t/**\n\t * @dev Emitted on swapBorrowRateMode()\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param user The address of the user swapping his rate mode\n\t * @param rateMode The rate mode that the user wants to swap to\n\t **/\n\tevent Swap(address indexed reserve, address indexed user, uint256 rateMode);\n\n\t/**\n\t * @dev Emitted on setUserUseReserveAsCollateral()\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param user The address of the user enabling the usage as collateral\n\t **/\n\tevent ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);\n\n\t/**\n\t * @dev Emitted on setUserUseReserveAsCollateral()\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param user The address of the user enabling the usage as collateral\n\t **/\n\tevent ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);\n\n\t/**\n\t * @dev Emitted on rebalanceStableBorrowRate()\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param user The address of the user for which the rebalance has been executed\n\t **/\n\tevent RebalanceStableBorrowRate(address indexed reserve, address indexed user);\n\n\t/**\n\t * @dev Emitted on flashLoan()\n\t * @param target The address of the flash loan receiver contract\n\t * @param initiator The address initiating the flash loan\n\t * @param asset The address of the asset being flash borrowed\n\t * @param amount The amount flash borrowed\n\t * @param premium The fee flash borrowed\n\t * @param referralCode The referral code used\n\t **/\n\tevent FlashLoan(\n\t\taddress indexed target,\n\t\taddress indexed initiator,\n\t\taddress indexed asset,\n\t\tuint256 amount,\n\t\tuint256 premium,\n\t\tuint16 referralCode\n\t);\n\n\t/**\n\t * @dev Emitted when the pause is triggered.\n\t */\n\tevent Paused();\n\n\t/**\n\t * @dev Emitted when the pause is lifted.\n\t */\n\tevent Unpaused();\n\n\t/**\n\t * @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via\n\t * LendingPoolCollateral manager using a DELEGATECALL\n\t * This allows to have the events in the generated ABI for LendingPool.\n\t * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation\n\t * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation\n\t * @param user The address of the borrower getting liquidated\n\t * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover\n\t * @param liquidatedCollateralAmount The amount of collateral received by the liiquidator\n\t * @param liquidator The address of the liquidator\n\t * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants\n\t * to receive the underlying collateral asset directly\n\t **/\n\tevent LiquidationCall(\n\t\taddress indexed collateralAsset,\n\t\taddress indexed debtAsset,\n\t\taddress indexed user,\n\t\tuint256 debtToCover,\n\t\tuint256 liquidatedCollateralAmount,\n\t\taddress liquidator,\n\t\tbool receiveAToken\n\t);\n\n\t/**\n\t * @dev Emitted when the state of a reserve is updated. NOTE: This event is actually declared\n\t * in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal,\n\t * the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it\n\t * gets added to the LendingPool ABI\n\t * @param reserve The address of the underlying asset of the reserve\n\t * @param liquidityRate The new liquidity rate\n\t * @param stableBorrowRate The new stable borrow rate\n\t * @param variableBorrowRate The new variable borrow rate\n\t * @param liquidityIndex The new liquidity index\n\t * @param variableBorrowIndex The new variable borrow index\n\t **/\n\tevent ReserveDataUpdated(\n\t\taddress indexed reserve,\n\t\tuint256 liquidityRate,\n\t\tuint256 stableBorrowRate,\n\t\tuint256 variableBorrowRate,\n\t\tuint256 liquidityIndex,\n\t\tuint256 variableBorrowIndex\n\t);\n\n\tfunction initialize(ILendingPoolAddressesProvider provider) external;\n\n\t/**\n\t * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.\n\t * - E.g. User deposits 100 USDC and gets in return 100 aUSDC\n\t * @param asset The address of the underlying asset to deposit\n\t * @param amount The amount to be deposited\n\t * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user\n\t *   wants to receive them on his own wallet, or a different address if the beneficiary of aTokens\n\t *   is a different wallet\n\t * @param referralCode Code used to register the integrator originating the operation, for potential rewards.\n\t *   0 if the action is executed directly by the user, without any middle-man\n\t **/\n\tfunction deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n\n\tfunction depositWithAutoDLP(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;\n\n\t/**\n\t * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned\n\t * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC\n\t * @param asset The address of the underlying asset to withdraw\n\t * @param amount The underlying amount to be withdrawn\n\t *   - Send the value type(uint256).max in order to withdraw the whole aToken balance\n\t * @param to Address that will receive the underlying, same as msg.sender if the user\n\t *   wants to receive it on his own wallet, or a different address if the beneficiary is a\n\t *   different wallet\n\t * @return The final amount withdrawn\n\t **/\n\tfunction withdraw(address asset, uint256 amount, address to) external returns (uint256);\n\n\t/**\n\t * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower\n\t * already deposited enough collateral, or he was given enough allowance by a credit delegator on the\n\t * corresponding debt token (StableDebtToken or VariableDebtToken)\n\t * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet\n\t *   and 100 stable/variable debt tokens, depending on the `interestRateMode`\n\t * @param asset The address of the underlying asset to borrow\n\t * @param amount The amount to be borrowed\n\t * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable\n\t * @param referralCode Code used to register the integrator originating the operation, for potential rewards.\n\t *   0 if the action is executed directly by the user, without any middle-man\n\t * @param onBehalfOf Address of the user who will receive the debt. Should be the address of the borrower itself\n\t * calling the function if he wants to borrow against his own collateral, or the address of the credit delegator\n\t * if he has been given credit delegation allowance\n\t **/\n\tfunction borrow(\n\t\taddress asset,\n\t\tuint256 amount,\n\t\tuint256 interestRateMode,\n\t\tuint16 referralCode,\n\t\taddress onBehalfOf\n\t) external;\n\n\t/**\n\t * @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned\n\t * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address\n\t * @param asset The address of the borrowed underlying asset previously borrowed\n\t * @param amount The amount to repay\n\t * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`\n\t * @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable\n\t * @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the\n\t * user calling the function if he wants to reduce/remove his own debt, or the address of any other\n\t * other borrower whose debt should be removed\n\t * @return The final amount repaid\n\t **/\n\tfunction repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) external returns (uint256);\n\n\t/**\n\t * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa\n\t * @param asset The address of the underlying asset borrowed\n\t * @param rateMode The rate mode that the user wants to swap to\n\t **/\n\tfunction swapBorrowRateMode(address asset, uint256 rateMode) external;\n\n\t/**\n\t * @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.\n\t * - Users can be rebalanced if the following conditions are satisfied:\n\t *     1. Usage ratio is above 95%\n\t *     2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been\n\t *        borrowed at a stable rate and depositors are not earning enough\n\t * @param asset The address of the underlying asset borrowed\n\t * @param user The address of the user to be rebalanced\n\t **/\n\tfunction rebalanceStableBorrowRate(address asset, address user) external;\n\n\t/**\n\t * @dev Allows depositors to enable/disable a specific deposited asset as collateral\n\t * @param asset The address of the underlying asset deposited\n\t * @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise\n\t **/\n\tfunction setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;\n\n\t/**\n\t * @dev Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1\n\t * - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives\n\t *   a proportionally amount of the `collateralAsset` plus a bonus to cover market risk\n\t * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation\n\t * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation\n\t * @param user The address of the borrower getting liquidated\n\t * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover\n\t * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants\n\t * to receive the underlying collateral asset directly\n\t **/\n\tfunction liquidationCall(\n\t\taddress collateralAsset,\n\t\taddress debtAsset,\n\t\taddress user,\n\t\tuint256 debtToCover,\n\t\tbool receiveAToken\n\t) external;\n\n\t/**\n\t * @dev Allows smartcontracts to access the liquidity of the pool within one transaction,\n\t * as long as the amount taken plus a fee is returned.\n\t * IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration.\n\t * For further details please visit https://developers.aave.com\n\t * @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface\n\t * @param assets The addresses of the assets being flash-borrowed\n\t * @param amounts The amounts amounts being flash-borrowed\n\t * @param modes Types of the debt to open if the flash loan is not returned:\n\t *   0 -> Don't open any debt, just revert if funds can't be transferred from the receiver\n\t *   1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address\n\t *   2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address\n\t * @param onBehalfOf The address  that will receive the debt in the case of using on `modes` 1 or 2\n\t * @param params Variadic packed params to pass to the receiver as extra information\n\t * @param referralCode Code used to register the integrator originating the operation, for potential rewards.\n\t *   0 if the action is executed directly by the user, without any middle-man\n\t **/\n\tfunction flashLoan(\n\t\taddress receiverAddress,\n\t\taddress[] calldata assets,\n\t\tuint256[] calldata amounts,\n\t\tuint256[] calldata modes,\n\t\taddress onBehalfOf,\n\t\tbytes calldata params,\n\t\tuint16 referralCode\n\t) external;\n\n\t/**\n\t * @dev Returns the user account data across all the reserves\n\t * @param user The address of the user\n\t * @return totalCollateral the total collateral in USD to 8 decimals of the user\n\t * @return totalDebt the total debt in USD to 8 decimals of the user\n\t * @return availableBorrows the borrowing power left of the user\n\t * @return currentLiquidationThreshold the liquidation threshold of the user\n\t * @return ltv the loan to value of the user\n\t * @return healthFactor the current health factor of the user\n\t **/\n\tfunction getUserAccountData(\n\t\taddress user\n\t)\n\t\texternal\n\t\tview\n\t\treturns (\n\t\t\tuint256 totalCollateral,\n\t\t\tuint256 totalDebt,\n\t\t\tuint256 availableBorrows,\n\t\t\tuint256 currentLiquidationThreshold,\n\t\t\tuint256 ltv,\n\t\t\tuint256 healthFactor\n\t\t);\n\n\tfunction initReserve(\n\t\taddress reserve,\n\t\taddress aTokenAddress,\n\t\taddress stableDebtAddress,\n\t\taddress variableDebtAddress,\n\t\taddress interestRateStrategyAddress\n\t) external;\n\n\tfunction setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress) external;\n\n\tfunction setConfiguration(address reserve, uint256 configuration) external;\n\n\t/**\n\t * @dev Returns the configuration of the reserve\n\t * @param asset The address of the underlying asset of the reserve\n\t * @return The configuration of the reserve\n\t **/\n\tfunction getConfiguration(address asset) external view returns (DataTypes.ReserveConfigurationMap memory);\n\n\t/**\n\t * @dev Returns the configuration of the user across all the reserves\n\t * @param user The user address\n\t * @return The configuration of the user\n\t **/\n\tfunction getUserConfiguration(address user) external view returns (DataTypes.UserConfigurationMap memory);\n\n\t/**\n\t * @dev Returns the normalized income normalized income of the reserve\n\t * @param asset The address of the underlying asset of the reserve\n\t * @return The reserve's normalized income\n\t */\n\tfunction getReserveNormalizedIncome(address asset) external view returns (uint256);\n\n\t/**\n\t * @dev Returns the normalized variable debt per unit of asset\n\t * @param asset The address of the underlying asset of the reserve\n\t * @return The reserve normalized variable debt\n\t */\n\tfunction getReserveNormalizedVariableDebt(address asset) external view returns (uint256);\n\n\t/**\n\t * @dev Returns the state and configuration of the reserve\n\t * @param asset The address of the underlying asset of the reserve\n\t * @return The state of the reserve\n\t **/\n\tfunction getReserveData(address asset) external view returns (DataTypes.ReserveData memory);\n\n\tfunction finalizeTransfer(\n\t\taddress asset,\n\t\taddress from,\n\t\taddress to,\n\t\tuint256 amount,\n\t\tuint256 balanceFromAfter,\n\t\tuint256 balanceToBefore\n\t) external;\n\n\tfunction getReservesList() external view returns (address[] memory);\n\n\tfunction getAddressesProvider() external view returns (ILendingPoolAddressesProvider);\n\n\tfunction setPause(bool val) external;\n\n\tfunction paused() external view returns (bool);\n}\n"
      },
      "contracts/mainnet/interfaces/ILendingPoolAddressesProvider.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\n\n/**\n * @title LendingPoolAddressesProvider contract\n * @dev Main registry of addresses part of or connected to the protocol, including permissioned roles\n * - Acting also as factory of proxies and admin of those, so with right to change its implementations\n * - Owned by the Aave Governance\n * @author Aave\n **/\ninterface ILendingPoolAddressesProvider {\n\tevent MarketIdSet(string newMarketId);\n\tevent LendingPoolUpdated(address indexed newAddress);\n\tevent ConfigurationAdminUpdated(address indexed newAddress);\n\tevent EmergencyAdminUpdated(address indexed newAddress);\n\tevent LendingPoolConfiguratorUpdated(address indexed newAddress);\n\tevent LendingPoolCollateralManagerUpdated(address indexed newAddress);\n\tevent PriceOracleUpdated(address indexed newAddress);\n\tevent LendingRateOracleUpdated(address indexed newAddress);\n\tevent ProxyCreated(bytes32 id, address indexed newAddress);\n\tevent AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);\n\n\tfunction getMarketId() external view returns (string memory);\n\n\tfunction setMarketId(string calldata marketId) external;\n\n\tfunction setAddress(bytes32 id, address newAddress) external;\n\n\tfunction setAddressAsProxy(bytes32 id, address impl) external;\n\n\tfunction getAddress(bytes32 id) external view returns (address);\n\n\tfunction getLendingPool() external view returns (address);\n\n\tfunction setLendingPoolImpl(address pool) external;\n\n\tfunction getLendingPoolConfigurator() external view returns (address);\n\n\tfunction setLendingPoolConfiguratorImpl(address configurator) external;\n\n\tfunction getLendingPoolCollateralManager() external view returns (address);\n\n\tfunction setLendingPoolCollateralManager(address manager) external;\n\n\tfunction getPoolAdmin() external view returns (address);\n\n\tfunction setPoolAdmin(address admin) external;\n\n\tfunction getEmergencyAdmin() external view returns (address);\n\n\tfunction setEmergencyAdmin(address admin) external;\n\n\tfunction getPriceOracle() external view returns (address);\n\n\tfunction setPriceOracle(address priceOracle) external;\n\n\tfunction getLendingRateOracle() external view returns (address);\n\n\tfunction setLendingRateOracle(address lendingRateOracle) external;\n\n\tfunction getLiquidationFeeTo() external view returns (address);\n\n\tfunction setLiquidationFeeTo(address liquidationFeeTo) external;\n}\n"
      },
      "contracts/mainnet/interfaces/IScaledBalanceToken.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\n\ninterface IScaledBalanceToken {\n\t/**\n\t * @dev Returns the scaled balance of the user. The scaled balance is the sum of all the\n\t * updated stored balance divided by the reserve's liquidity index at the moment of the update\n\t * @param user The user whose balance is calculated\n\t * @return The scaled balance of the user\n\t **/\n\tfunction scaledBalanceOf(address user) external view returns (uint256);\n\n\t/**\n\t * @dev Returns the scaled balance of the user and the scaled total supply.\n\t * @param user The address of the user\n\t * @return The scaled balance of the user\n\t * @return The scaled balance and the scaled total supply\n\t **/\n\tfunction getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);\n\n\t/**\n\t * @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)\n\t * @return The scaled total supply\n\t **/\n\tfunction scaledTotalSupply() external view returns (uint256);\n}\n"
      },
      "contracts/mainnet/interfaces/IStableDebtToken.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\n\nimport {IInitializableDebtToken} from \"./IInitializableDebtToken.sol\";\nimport {IAaveIncentivesController} from \"./IAaveIncentivesController.sol\";\n\n/**\n * @title IStableDebtToken\n * @notice Defines the interface for the stable debt token\n * @dev It does not inherit from IERC20 to save in code size\n * @author Aave\n **/\n\ninterface IStableDebtToken is IInitializableDebtToken {\n\t/**\n\t * @dev Emitted when new stable debt is minted\n\t * @param user The address of the user who triggered the minting\n\t * @param onBehalfOf The recipient of stable debt tokens\n\t * @param amount The amount minted\n\t * @param currentBalance The current balance of the user\n\t * @param balanceIncrease The increase in balance since the last action of the user\n\t * @param newRate The rate of the debt after the minting\n\t * @param avgStableRate The new average stable rate after the minting\n\t * @param newTotalSupply The new total supply of the stable debt token after the action\n\t **/\n\tevent Mint(\n\t\taddress indexed user,\n\t\taddress indexed onBehalfOf,\n\t\tuint256 amount,\n\t\tuint256 currentBalance,\n\t\tuint256 balanceIncrease,\n\t\tuint256 newRate,\n\t\tuint256 avgStableRate,\n\t\tuint256 newTotalSupply\n\t);\n\n\t/**\n\t * @dev Emitted when new stable debt is burned\n\t * @param user The address of the user\n\t * @param amount The amount being burned\n\t * @param currentBalance The current balance of the user\n\t * @param balanceIncrease The the increase in balance since the last action of the user\n\t * @param avgStableRate The new average stable rate after the burning\n\t * @param newTotalSupply The new total supply of the stable debt token after the action\n\t **/\n\tevent Burn(\n\t\taddress indexed user,\n\t\tuint256 amount,\n\t\tuint256 currentBalance,\n\t\tuint256 balanceIncrease,\n\t\tuint256 avgStableRate,\n\t\tuint256 newTotalSupply\n\t);\n\n\t/**\n\t * @dev Mints debt token to the `onBehalfOf` address.\n\t * - The resulting rate is the weighted average between the rate of the new debt\n\t * and the rate of the previous debt\n\t * @param user The address receiving the borrowed underlying, being the delegatee in case\n\t * of credit delegate, or same as `onBehalfOf` otherwise\n\t * @param onBehalfOf The address receiving the debt tokens\n\t * @param amount The amount of debt tokens to mint\n\t * @param rate The rate of the debt being minted\n\t **/\n\tfunction mint(address user, address onBehalfOf, uint256 amount, uint256 rate) external returns (bool);\n\n\t/**\n\t * @dev Burns debt of `user`\n\t * - The resulting rate is the weighted average between the rate of the new debt\n\t * and the rate of the previous debt\n\t * @param user The address of the user getting his debt burned\n\t * @param amount The amount of debt tokens getting burned\n\t **/\n\tfunction burn(address user, uint256 amount) external;\n\n\t/**\n\t * @dev Returns the average rate of all the stable rate loans.\n\t * @return The average stable rate\n\t **/\n\tfunction getAverageStableRate() external view returns (uint256);\n\n\t/**\n\t * @dev Returns the stable rate of the user debt\n\t * @return The stable rate of the user\n\t **/\n\tfunction getUserStableRate(address user) external view returns (uint256);\n\n\t/**\n\t * @dev Returns the timestamp of the last update of the user\n\t * @return The timestamp\n\t **/\n\tfunction getUserLastUpdated(address user) external view returns (uint40);\n\n\t/**\n\t * @dev Returns the principal, the total supply and the average stable rate\n\t **/\n\tfunction getSupplyData() external view returns (uint256, uint256, uint256, uint40);\n\n\t/**\n\t * @dev Returns the timestamp of the last update of the total supply\n\t * @return The timestamp\n\t **/\n\tfunction getTotalSupplyLastUpdated() external view returns (uint40);\n\n\t/**\n\t * @dev Returns the total supply and the average stable rate\n\t **/\n\tfunction getTotalSupplyAndAvgRate() external view returns (uint256, uint256);\n\n\t/**\n\t * @dev Returns the principal debt balance of the user\n\t * @return The debt balance of the user since the last burn/mint action\n\t **/\n\tfunction principalBalanceOf(address user) external view returns (uint256);\n\n\t/**\n\t * @dev Returns the address of the incentives controller contract\n\t **/\n\tfunction getIncentivesController() external view returns (IAaveIncentivesController);\n}\n"
      },
      "contracts/mainnet/interfaces/IVariableDebtToken.sol": {
        "content": "// SPDX-License-Identifier: agpl-3.0\npragma solidity 0.8.12;\n\nimport {IScaledBalanceToken} from \"./IScaledBalanceToken.sol\";\nimport {IInitializableDebtToken} from \"./IInitializableDebtToken.sol\";\nimport {IAaveIncentivesController} from \"./IAaveIncentivesController.sol\";\n\n/**\n * @title IVariableDebtToken\n * @author Aave\n * @notice Defines the basic interface for a variable debt token.\n **/\ninterface IVariableDebtToken is IScaledBalanceToken, IInitializableDebtToken {\n\t/**\n\t * @dev Emitted after the mint action\n\t * @param from The address performing the mint\n\t * @param onBehalfOf The address of the user on which behalf minting has been performed\n\t * @param value The amount to be minted\n\t * @param index The last index of the reserve\n\t **/\n\tevent Mint(address indexed from, address indexed onBehalfOf, uint256 value, uint256 index);\n\n\t/**\n\t * @dev Mints debt token to the `onBehalfOf` address\n\t * @param user The address receiving the borrowed underlying, being the delegatee in case\n\t * of credit delegate, or same as `onBehalfOf` otherwise\n\t * @param onBehalfOf The address receiving the debt tokens\n\t * @param amount The amount of debt being minted\n\t * @param index The variable debt index of the reserve\n\t * @return `true` if the the previous balance of the user is 0\n\t **/\n\tfunction mint(address user, address onBehalfOf, uint256 amount, uint256 index) external returns (bool);\n\n\t/**\n\t * @dev Emitted when variable debt is burnt\n\t * @param user The user which debt has been burned\n\t * @param amount The amount of debt being burned\n\t * @param index The index of the user\n\t **/\n\tevent Burn(address indexed user, uint256 amount, uint256 index);\n\n\t/**\n\t * @dev Burns user variable debt\n\t * @param user The user which debt is burnt\n\t * @param index The variable debt index of the reserve\n\t **/\n\tfunction burn(address user, uint256 amount, uint256 index) external;\n\n\t/**\n\t * @dev Returns the address of the incentives controller contract\n\t **/\n\tfunction getIncentivesController() external view returns (IAaveIncentivesController);\n}\n"
      },
      "contracts/mainnet/lending/AaveProtocolDataProvider.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity 0.8.12;\npragma experimental ABIEncoderV2;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\nimport {ILendingPoolAddressesProvider} from \"../interfaces/ILendingPoolAddressesProvider.sol\";\nimport {ILendingPool} from \"../interfaces/ILendingPool.sol\";\nimport {IStableDebtToken} from \"../interfaces/IStableDebtToken.sol\";\nimport {IVariableDebtToken} from \"../interfaces/IVariableDebtToken.sol\";\nimport {ReserveConfiguration} from \"./libraries/configuration/ReserveConfiguration.sol\";\nimport {UserConfiguration} from \"./libraries/configuration/UserConfiguration.sol\";\nimport {DataTypes} from \"./libraries/types/DataTypes.sol\";\n\ncontract AaveProtocolDataProvider {\n\tusing ReserveConfiguration for DataTypes.ReserveConfigurationMap;\n\tusing UserConfiguration for DataTypes.UserConfigurationMap;\n\n\taddress constant MKR = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2;\n\taddress constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n\tstruct TokenData {\n\t\tstring symbol;\n\t\taddress tokenAddress;\n\t}\n\n\tILendingPoolAddressesProvider public immutable ADDRESSES_PROVIDER;\n\n\tconstructor(ILendingPoolAddressesProvider addressesProvider) {\n\t\tADDRESSES_PROVIDER = addressesProvider;\n\t}\n\n\tfunction getAllReservesTokens() external view returns (TokenData[] memory) {\n\t\tILendingPool pool = ILendingPool(ADDRESSES_PROVIDER.getLendingPool());\n\t\taddress[] memory reserves = pool.getReservesList();\n\t\tTokenData[] memory reservesTokens = new TokenData[](reserves.length);\n\t\tfor (uint256 i = 0; i < reserves.length; ) {\n\t\t\tif (reserves[i] == MKR) {\n\t\t\t\treservesTokens[i] = TokenData({symbol: \"MKR\", tokenAddress: reserves[i]});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (reserves[i] == ETH) {\n\t\t\t\treservesTokens[i] = TokenData({symbol: \"ETH\", tokenAddress: reserves[i]});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treservesTokens[i] = TokenData({symbol: IERC20Metadata(reserves[i]).symbol(), tokenAddress: reserves[i]});\n\t\t\tunchecked {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\treturn reservesTokens;\n\t}\n\n\tfunction getAllATokens() external view returns (TokenData[] memory) {\n\t\tILendingPool pool = ILendingPool(ADDRESSES_PROVIDER.getLendingPool());\n\t\taddress[] memory reserves = pool.getReservesList();\n\t\tTokenData[] memory aTokens = new TokenData[](reserves.length);\n\t\tfor (uint256 i = 0; i < reserves.length; ) {\n\t\t\tDataTypes.ReserveData memory reserveData = pool.getReserveData(reserves[i]);\n\t\t\taTokens[i] = TokenData({\n\t\t\t\tsymbol: IERC20Metadata(reserveData.aTokenAddress).symbol(),\n\t\t\t\ttokenAddress: reserveData.aTokenAddress\n\t\t\t});\n\t\t\tunchecked {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\treturn aTokens;\n\t}\n\n\tfunction getReserveConfigurationData(\n\t\taddress asset\n\t)\n\t\texternal\n\t\tview\n\t\treturns (\n\t\t\tuint256 decimals,\n\t\t\tuint256 ltv,\n\t\t\tuint256 liquidationThreshold,\n\t\t\tuint256 liquidationBonus,\n\t\t\tuint256 reserveFactor,\n\t\t\tbool usageAsCollateralEnabled,\n\t\t\tbool borrowingEnabled,\n\t\t\tbool stableBorrowRateEnabled,\n\t\t\tbool isActive,\n\t\t\tbool isFrozen\n\t\t)\n\t{\n\t\tDataTypes.ReserveConfigurationMap memory configuration = ILendingPool(ADDRESSES_PROVIDER.getLendingPool())\n\t\t\t.getConfiguration(asset);\n\n\t\t(ltv, liquidationThreshold, liquidationBonus, decimals, reserveFactor) = configuration.getParamsMemory();\n\n\t\t(isActive, isFrozen, borrowingEnabled, stableBorrowRateEnabled) = configuration.getFlagsMemory();\n\n\t\tusageAsCollateralEnabled = liquidationThreshold > 0;\n\t}\n\n\t/**\n\t * @notice Returns the caps parameters of the reserve\n\t * @custom:borrow-and-supply-caps\n\t */\n\tfunction getReserveCaps(address asset) external view returns (uint256 borrowCap, uint256 supplyCap) {\n\t\tDataTypes.ReserveConfigurationMap memory configuration = ILendingPool(ADDRESSES_PROVIDER.getLendingPool())\n\t\t\t.getConfiguration(asset);\n\t\tborrowCap = configuration.getBorrowCap();\n\t\tsupplyCap = configuration.getSupplyCap();\n\t}\n\n\tfunction getReserveData(\n\t\taddress asset\n\t)\n\t\texternal\n\t\tview\n\t\treturns (\n\t\t\tuint256 availableLiquidity,\n\t\t\tuint256 totalStableDebt,\n\t\t\tuint256 totalVariableDebt,\n\t\t\tuint256 liquidityRate,\n\t\t\tuint256 variableBorrowRate,\n\t\t\tuint256 stableBorrowRate,\n\t\t\tuint256 averageStableBorrowRate,\n\t\t\tuint256 liquidityIndex,\n\t\t\tuint256 variableBorrowIndex,\n\t\t\tuint40 lastUpdateTimestamp\n\t\t)\n\t{\n\t\tDataTypes.ReserveData memory reserve = ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getReserveData(asset);\n\n\t\treturn (\n\t\t\tIERC20Metadata(asset).balanceOf(reserve.aTokenAddress),\n\t\t\tIERC20Metadata(reserve.stableDebtTokenAddress).totalSupply(),\n\t\t\tIERC20Metadata(reserve.variableDebtTokenAddress).totalSupply(),\n\t\t\treserve.currentLiquidityRate,\n\t\t\treserve.currentVariableBorrowRate,\n\t\t\treserve.currentStableBorrowRate,\n\t\t\tIStableDebtToken(reserve.stableDebtTokenAddress).getAverageStableRate(),\n\t\t\treserve.liquidityIndex,\n\t\t\treserve.variableBorrowIndex,\n\t\t\treserve.lastUpdateTimestamp\n\t\t);\n\t}\n\n\tfunction getUserReserveData(\n\t\taddress asset,\n\t\taddress user\n\t)\n\t\texternal\n\t\tview\n\t\treturns (\n\t\t\tuint256 currentATokenBalance,\n\t\t\tuint256 currentStableDebt,\n\t\t\tuint256 currentVariableDebt,\n\t\t\tuint256 principalStableDebt,\n\t\t\tuint256 scaledVariableDebt,\n\t\t\tuint256 stableBorrowRate,\n\t\t\tuint256 liquidityRate,\n\t\t\tuint40 stableRateLastUpdated,\n\t\t\tbool usageAsCollateralEnabled\n\t\t)\n\t{\n\t\tDataTypes.ReserveData memory reserve = ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getReserveData(asset);\n\n\t\tDataTypes.UserConfigurationMap memory userConfig = ILendingPool(ADDRESSES_PROVIDER.getLendingPool())\n\t\t\t.getUserConfiguration(user);\n\n\t\tcurrentATokenBalance = IERC20Metadata(reserve.aTokenAddress).balanceOf(user);\n\t\tcurrentVariableDebt = IERC20Metadata(reserve.variableDebtTokenAddress).balanceOf(user);\n\t\tcurrentStableDebt = IERC20Metadata(reserve.stableDebtTokenAddress).balanceOf(user);\n\t\tprincipalStableDebt = IStableDebtToken(reserve.stableDebtTokenAddress).principalBalanceOf(user);\n\t\tscaledVariableDebt = IVariableDebtToken(reserve.variableDebtTokenAddress).scaledBalanceOf(user);\n\t\tliquidityRate = reserve.currentLiquidityRate;\n\t\tstableBorrowRate = IStableDebtToken(reserve.stableDebtTokenAddress).getUserStableRate(user);\n\t\tstableRateLastUpdated = IStableDebtToken(reserve.stableDebtTokenAddress).getUserLastUpdated(user);\n\t\tusageAsCollateralEnabled = userConfig.isUsingAsCollateral(reserve.id);\n\t}\n\n\tfunction getReserveTokensAddresses(\n\t\taddress asset\n\t) external view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress) {\n\t\tDataTypes.ReserveData memory reserve = ILendingPool(ADDRESSES_PROVIDER.getLendingPool()).getReserveData(asset);\n\n\t\treturn (reserve.aTokenAddress, reserve.stableDebtTokenAddress, reserve.variableDebtTokenAddress);\n\t}\n}\n"
      },
      "contracts/mainnet/lending/libraries/configuration/ReserveConfiguration.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity 0.8.12;\n\nimport {Errors} from \"../helpers/Errors.sol\";\nimport {DataTypes} from \"../types/DataTypes.sol\";\n\n/**\n * @title ReserveConfiguration library\n * @author Aave\n * @notice Implements the bitmap logic to handle the reserve configuration\n */\nlibrary ReserveConfiguration {\n\tuint256 constant LTV_MASK =                   0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000; // prettier-ignore\n\tuint256 constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF; // prettier-ignore\n\tuint256 constant LIQUIDATION_BONUS_MASK =     0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF; // prettier-ignore\n\tuint256 constant DECIMALS_MASK =              0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF; // prettier-ignore\n\tuint256 constant ACTIVE_MASK =                0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFF; // prettier-ignore\n\tuint256 constant FROZEN_MASK =                0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFF; // prettier-ignore\n\tuint256 constant BORROWING_MASK =             0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFF; // prettier-ignore\n\tuint256 constant STABLE_BORROWING_MASK =      0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF; // prettier-ignore\n\tuint256 constant RESERVE_FACTOR_MASK =        0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF; // prettier-ignore\n\n\t///@custom:borrow-and-supply-caps\n\tuint256 internal constant BORROW_CAP_MASK =   0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFF; // prettier-ignore\n\tuint256 internal constant SUPPLY_CAP_MASK =   0xFFFFFFFFFFFFFFFFFFFFFFFFFF000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // prettier-ignore\n\n\t/// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed\n\tuint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16;\n\tuint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32;\n\tuint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48;\n\tuint256 constant IS_ACTIVE_START_BIT_POSITION = 56;\n\tuint256 constant IS_FROZEN_START_BIT_POSITION = 57;\n\tuint256 constant BORROWING_ENABLED_START_BIT_POSITION = 58;\n\tuint256 constant STABLE_BORROWING_ENABLED_START_BIT_POSITION = 59;\n\tuint256 constant RESERVE_FACTOR_START_BIT_POSITION = 64;\n\n\t///@custom:borrow-and-supply-caps\n\tuint256 internal constant BORROW_CAP_START_BIT_POSITION = 80;\n\tuint256 internal constant SUPPLY_CAP_START_BIT_POSITION = 116;\n\n\tuint256 constant MAX_VALID_LTV = 65535;\n\tuint256 constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535;\n\tuint256 constant MAX_VALID_LIQUIDATION_BONUS = 65535;\n\tuint256 constant MAX_VALID_DECIMALS = 255;\n\tuint256 constant MAX_VALID_RESERVE_FACTOR = 65535;\n\n\t///@custom:borrow-and-supply-caps\n\tuint256 internal constant MAX_VALID_BORROW_CAP = 68719476735;\n\tuint256 internal constant MAX_VALID_SUPPLY_CAP = 68719476735;\n\n\t/**\n\t * @dev Sets the Loan to Value of the reserve\n\t * @param self The reserve configuration\n\t * @param ltv the new ltv\n\t **/\n\tfunction setLtv(DataTypes.ReserveConfigurationMap memory self, uint256 ltv) internal pure {\n\t\trequire(ltv <= MAX_VALID_LTV, Errors.RC_INVALID_LTV);\n\n\t\tself.data = (self.data & LTV_MASK) | ltv;\n\t}\n\n\t/**\n\t * @dev Gets the Loan to Value of the reserve\n\t * @param self The reserve configuration\n\t * @return The loan to value\n\t **/\n\tfunction getLtv(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {\n\t\treturn self.data & ~LTV_MASK;\n\t}\n\n\t/**\n\t * @dev Sets the liquidation threshold of the reserve\n\t * @param self The reserve configuration\n\t * @param threshold The new liquidation threshold\n\t **/\n\tfunction setLiquidationThreshold(DataTypes.ReserveConfigurationMap memory self, uint256 threshold) internal pure {\n\t\trequire(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.RC_INVALID_LIQ_THRESHOLD);\n\n\t\tself.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the liquidation threshold of the reserve\n\t * @param self The reserve configuration\n\t * @return The liquidation threshold\n\t **/\n\tfunction getLiquidationThreshold(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {\n\t\treturn (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION;\n\t}\n\n\t/**\n\t * @dev Sets the liquidation bonus of the reserve\n\t * @param self The reserve configuration\n\t * @param bonus The new liquidation bonus\n\t **/\n\tfunction setLiquidationBonus(DataTypes.ReserveConfigurationMap memory self, uint256 bonus) internal pure {\n\t\trequire(bonus <= MAX_VALID_LIQUIDATION_BONUS, Errors.RC_INVALID_LIQ_BONUS);\n\n\t\tself.data = (self.data & LIQUIDATION_BONUS_MASK) | (bonus << LIQUIDATION_BONUS_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the liquidation bonus of the reserve\n\t * @param self The reserve configuration\n\t * @return The liquidation bonus\n\t **/\n\tfunction getLiquidationBonus(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {\n\t\treturn (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION;\n\t}\n\n\t/**\n\t * @dev Sets the decimals of the underlying asset of the reserve\n\t * @param self The reserve configuration\n\t * @param decimals The decimals\n\t **/\n\tfunction setDecimals(DataTypes.ReserveConfigurationMap memory self, uint256 decimals) internal pure {\n\t\trequire(decimals <= MAX_VALID_DECIMALS, Errors.RC_INVALID_DECIMALS);\n\n\t\tself.data = (self.data & DECIMALS_MASK) | (decimals << RESERVE_DECIMALS_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the decimals of the underlying asset of the reserve\n\t * @param self The reserve configuration\n\t * @return The decimals of the asset\n\t **/\n\tfunction getDecimals(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {\n\t\treturn (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION;\n\t}\n\n\t/**\n\t * @dev Sets the active state of the reserve\n\t * @param self The reserve configuration\n\t * @param active The active state\n\t **/\n\tfunction setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {\n\t\tself.data = (self.data & ACTIVE_MASK) | (uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the active state of the reserve\n\t * @param self The reserve configuration\n\t * @return The active state\n\t **/\n\tfunction getActive(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {\n\t\treturn (self.data & ~ACTIVE_MASK) != 0;\n\t}\n\n\t/**\n\t * @dev Sets the frozen state of the reserve\n\t * @param self The reserve configuration\n\t * @param frozen The frozen state\n\t **/\n\tfunction setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure {\n\t\tself.data = (self.data & FROZEN_MASK) | (uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the frozen state of the reserve\n\t * @param self The reserve configuration\n\t * @return The frozen state\n\t **/\n\tfunction getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {\n\t\treturn (self.data & ~FROZEN_MASK) != 0;\n\t}\n\n\t/**\n\t * @dev Enables or disables borrowing on the reserve\n\t * @param self The reserve configuration\n\t * @param enabled True if the borrowing needs to be enabled, false otherwise\n\t **/\n\tfunction setBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled) internal pure {\n\t\tself.data = (self.data & BORROWING_MASK) | (uint256(enabled ? 1 : 0) << BORROWING_ENABLED_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the borrowing state of the reserve\n\t * @param self The reserve configuration\n\t * @return The borrowing state\n\t **/\n\tfunction getBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {\n\t\treturn (self.data & ~BORROWING_MASK) != 0;\n\t}\n\n\t/**\n\t * @dev Enables or disables stable rate borrowing on the reserve\n\t * @param self The reserve configuration\n\t * @param enabled True if the stable rate borrowing needs to be enabled, false otherwise\n\t **/\n\tfunction setStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled) internal pure {\n\t\tself.data =\n\t\t\t(self.data & STABLE_BORROWING_MASK) |\n\t\t\t(uint256(enabled ? 1 : 0) << STABLE_BORROWING_ENABLED_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the stable rate borrowing state of the reserve\n\t * @param self The reserve configuration\n\t * @return The stable rate borrowing state\n\t **/\n\tfunction getStableRateBorrowingEnabled(\n\t\tDataTypes.ReserveConfigurationMap storage self\n\t) internal view returns (bool) {\n\t\treturn (self.data & ~STABLE_BORROWING_MASK) != 0;\n\t}\n\n\t/**\n\t * @dev Sets the reserve factor of the reserve\n\t * @param self The reserve configuration\n\t * @param reserveFactor The reserve factor\n\t **/\n\tfunction setReserveFactor(DataTypes.ReserveConfigurationMap memory self, uint256 reserveFactor) internal pure {\n\t\trequire(reserveFactor <= MAX_VALID_RESERVE_FACTOR, Errors.RC_INVALID_RESERVE_FACTOR);\n\n\t\tself.data = (self.data & RESERVE_FACTOR_MASK) | (reserveFactor << RESERVE_FACTOR_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @dev Gets the reserve factor of the reserve\n\t * @param self The reserve configuration\n\t * @return The reserve factor\n\t **/\n\tfunction getReserveFactor(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {\n\t\treturn (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION;\n\t}\n\n\t/**\n\t * @notice Sets the borrow cap of the reserve\n\t * @param self The reserve configuration\n\t * @param borrowCap The borrow cap\n\t * @custom:borrow-and-supply-caps\n\t */\n\tfunction setBorrowCap(DataTypes.ReserveConfigurationMap memory self, uint256 borrowCap) internal pure {\n\t\trequire(borrowCap <= MAX_VALID_BORROW_CAP, Errors.INVALID_BORROW_CAP);\n\n\t\tself.data = (self.data & BORROW_CAP_MASK) | (borrowCap << BORROW_CAP_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @notice Gets the borrow cap of the reserve\n\t * @param self The reserve configuration\n\t * @return The borrow cap\n\t * @custom:borrow-and-supply-caps\n\t */\n\tfunction getBorrowCap(DataTypes.ReserveConfigurationMap memory self) internal pure returns (uint256) {\n\t\treturn (self.data & ~BORROW_CAP_MASK) >> BORROW_CAP_START_BIT_POSITION;\n\t}\n\n\t/**\n\t * @notice Sets the supply cap of the reserve\n\t * @param self The reserve configuration\n\t * @param supplyCap The supply cap\n\t * @custom:borrow-and-supply-caps\n\t */\n\tfunction setSupplyCap(DataTypes.ReserveConfigurationMap memory self, uint256 supplyCap) internal pure {\n\t\trequire(supplyCap <= MAX_VALID_SUPPLY_CAP, Errors.INVALID_SUPPLY_CAP);\n\n\t\tself.data = (self.data & SUPPLY_CAP_MASK) | (supplyCap << SUPPLY_CAP_START_BIT_POSITION);\n\t}\n\n\t/**\n\t * @notice Gets the supply cap of the reserve\n\t * @param self The reserve configuration\n\t * @return The supply cap\n\t * @custom:borrow-and-supply-caps\n\t */\n\tfunction getSupplyCap(DataTypes.ReserveConfigurationMap memory self) internal pure returns (uint256) {\n\t\treturn (self.data & ~SUPPLY_CAP_MASK) >> SUPPLY_CAP_START_BIT_POSITION;\n\t}\n\n\t/**\n\t * @dev Gets the configuration flags of the reserve\n\t * @param self The reserve configuration\n\t * @return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled\n\t **/\n\tfunction getFlags(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool, bool, bool, bool) {\n\t\tuint256 dataLocal = self.data;\n\n\t\treturn (\n\t\t\t(dataLocal & ~ACTIVE_MASK) != 0,\n\t\t\t(dataLocal & ~FROZEN_MASK) != 0,\n\t\t\t(dataLocal & ~BORROWING_MASK) != 0,\n\t\t\t(dataLocal & ~STABLE_BORROWING_MASK) != 0\n\t\t);\n\t}\n\n\t/**\n\t * @dev Gets the configuration paramters of the reserve\n\t * @param self The reserve configuration\n\t * @return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals\n\t **/\n\tfunction getParams(\n\t\tDataTypes.ReserveConfigurationMap storage self\n\t) internal view returns (uint256, uint256, uint256, uint256, uint256) {\n\t\tuint256 dataLocal = self.data;\n\n\t\treturn (\n\t\t\tdataLocal & ~LTV_MASK,\n\t\t\t(dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION,\n\t\t\t(dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION,\n\t\t\t(dataLocal & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION,\n\t\t\t(dataLocal & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION\n\t\t);\n\t}\n\n\t/**\n\t * @dev Gets the configuration paramters of the reserve from a memory object\n\t * @param self The reserve configuration\n\t * @return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals\n\t **/\n\tfunction getParamsMemory(\n\t\tDataTypes.ReserveConfigurationMap memory self\n\t) internal pure returns (uint256, uint256, uint256, uint256, uint256) {\n\t\treturn (\n\t\t\tself.data & ~LTV_MASK,\n\t\t\t(self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION,\n\t\t\t(self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION,\n\t\t\t(self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION,\n\t\t\t(self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION\n\t\t);\n\t}\n\n\t/**\n\t * @dev Gets the configuration flags of the reserve from a memory object\n\t * @param self The reserve configuration\n\t * @return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled\n\t **/\n\tfunction getFlagsMemory(\n\t\tDataTypes.ReserveConfigurationMap memory self\n\t) internal pure returns (bool, bool, bool, bool) {\n\t\treturn (\n\t\t\t(self.data & ~ACTIVE_MASK) != 0,\n\t\t\t(self.data & ~FROZEN_MASK) != 0,\n\t\t\t(self.data & ~BORROWING_MASK) != 0,\n\t\t\t(self.data & ~STABLE_BORROWING_MASK) != 0\n\t\t);\n\t}\n}\n"
      },
      "contracts/mainnet/lending/libraries/configuration/UserConfiguration.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity 0.8.12;\n\nimport {Errors} from \"../helpers/Errors.sol\";\nimport {DataTypes} from \"../types/DataTypes.sol\";\n\n/**\n * @title UserConfiguration library\n * @author Aave\n * @notice Implements the bitmap logic to handle the user configuration\n */\nlibrary UserConfiguration {\n\tuint256 internal constant BORROWING_MASK = 0x5555555555555555555555555555555555555555555555555555555555555555;\n\n\t/**\n\t * @dev Sets if the user is borrowing the reserve identified by reserveIndex\n\t * @param self The configuration object\n\t * @param reserveIndex The index of the reserve in the bitmap\n\t * @param borrowing True if the user is borrowing the reserve, false otherwise\n\t **/\n\tfunction setBorrowing(DataTypes.UserConfigurationMap storage self, uint256 reserveIndex, bool borrowing) internal {\n\t\trequire(reserveIndex < 128, Errors.UL_INVALID_INDEX);\n\t\tself.data = (self.data & ~(1 << (reserveIndex * 2))) | (uint256(borrowing ? 1 : 0) << (reserveIndex * 2));\n\t}\n\n\t/**\n\t * @dev Sets if the user is using as collateral the reserve identified by reserveIndex\n\t * @param self The configuration object\n\t * @param reserveIndex The index of the reserve in the bitmap\n\t * @param usingAsCollateral True if the user is usin the reserve as collateral, false otherwise\n\t **/\n\tfunction setUsingAsCollateral(\n\t\tDataTypes.UserConfigurationMap storage self,\n\t\tuint256 reserveIndex,\n\t\tbool usingAsCollateral\n\t) internal {\n\t\trequire(reserveIndex < 128, Errors.UL_INVALID_INDEX);\n\t\tself.data =\n\t\t\t(self.data & ~(1 << (reserveIndex * 2 + 1))) |\n\t\t\t(uint256(usingAsCollateral ? 1 : 0) << (reserveIndex * 2 + 1));\n\t}\n\n\t/**\n\t * @dev Used to validate if a user has been using the reserve for borrowing or as collateral\n\t * @param self The configuration object\n\t * @param reserveIndex The index of the reserve in the bitmap\n\t * @return True if the user has been using a reserve for borrowing or as collateral, false otherwise\n\t **/\n\tfunction isUsingAsCollateralOrBorrowing(\n\t\tDataTypes.UserConfigurationMap memory self,\n\t\tuint256 reserveIndex\n\t) internal pure returns (bool) {\n\t\trequire(reserveIndex < 128, Errors.UL_INVALID_INDEX);\n\t\treturn (self.data >> (reserveIndex * 2)) & 3 != 0;\n\t}\n\n\t/**\n\t * @dev Used to validate if a user has been using the reserve for borrowing\n\t * @param self The configuration object\n\t * @param reserveIndex The index of the reserve in the bitmap\n\t * @return True if the user has been using a reserve for borrowing, false otherwise\n\t **/\n\tfunction isBorrowing(\n\t\tDataTypes.UserConfigurationMap memory self,\n\t\tuint256 reserveIndex\n\t) internal pure returns (bool) {\n\t\trequire(reserveIndex < 128, Errors.UL_INVALID_INDEX);\n\t\treturn (self.data >> (reserveIndex * 2)) & 1 != 0;\n\t}\n\n\t/**\n\t * @dev Used to validate if a user has been using the reserve as collateral\n\t * @param self The configuration object\n\t * @param reserveIndex The index of the reserve in the bitmap\n\t * @return True if the user has been using a reserve as collateral, false otherwise\n\t **/\n\tfunction isUsingAsCollateral(\n\t\tDataTypes.UserConfigurationMap memory self,\n\t\tuint256 reserveIndex\n\t) internal pure returns (bool) {\n\t\trequire(reserveIndex < 128, Errors.UL_INVALID_INDEX);\n\t\treturn (self.data >> (reserveIndex * 2 + 1)) & 1 != 0;\n\t}\n\n\t/**\n\t * @dev Used to validate if a user has been borrowing from any reserve\n\t * @param self The configuration object\n\t * @return True if the user has been borrowing any reserve, false otherwise\n\t **/\n\tfunction isBorrowingAny(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {\n\t\treturn self.data & BORROWING_MASK != 0;\n\t}\n\n\t/**\n\t * @dev Used to validate if a user has not been using any reserve\n\t * @param self The configuration object\n\t * @return True if the user has been borrowing any reserve, false otherwise\n\t **/\n\tfunction isEmpty(DataTypes.UserConfigurationMap memory self) internal pure returns (bool) {\n\t\treturn self.data == 0;\n\t}\n}\n"
      },
      "contracts/mainnet/lending/libraries/helpers/Errors.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity 0.8.12;\n\n/**\n * @title Errors library\n * @author Aave\n * @notice Defines the error messages emitted by the different contracts of the Aave protocol\n * @dev Error messages prefix glossary:\n *  - VL = ValidationLogic\n *  - MATH = Math libraries\n *  - CT = Common errors between tokens (AToken, VariableDebtToken and StableDebtToken)\n *  - AT = AToken\n *  - SDT = StableDebtToken\n *  - VDT = VariableDebtToken\n *  - LP = LendingPool\n *  - LPAPR = LendingPoolAddressesProviderRegistry\n *  - LPC = LendingPoolConfiguration\n *  - RL = ReserveLogic\n *  - LPCM = LendingPoolCollateralManager\n *  - P = Pausable\n */\nlibrary Errors {\n\t//common errors\n\tstring public constant CALLER_NOT_POOL_ADMIN = \"33\"; // 'The caller must be the pool admin'\n\tstring public constant BORROW_ALLOWANCE_NOT_ENOUGH = \"59\"; // User borrows on behalf, but allowance are too small\n\n\t//contract specific errors\n\tstring public constant VL_INVALID_AMOUNT = \"1\"; // 'Amount must be greater than 0'\n\tstring public constant VL_NO_ACTIVE_RESERVE = \"2\"; // 'Action requires an active reserve'\n\tstring public constant VL_RESERVE_FROZEN = \"3\"; // 'Action cannot be performed because the reserve is frozen'\n\tstring public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = \"4\"; // 'The current liquidity is not enough'\n\tstring public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = \"5\"; // 'User cannot withdraw more than the available balance'\n\tstring public constant VL_TRANSFER_NOT_ALLOWED = \"6\"; // 'Transfer cannot be allowed.'\n\tstring public constant VL_BORROWING_NOT_ENABLED = \"7\"; // 'Borrowing is not enabled'\n\tstring public constant VL_INVALID_INTEREST_RATE_MODE_SELECTED = \"8\"; // 'Invalid interest rate mode selected'\n\tstring public constant VL_COLLATERAL_BALANCE_IS_0 = \"9\"; // 'The collateral balance is 0'\n\tstring public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = \"10\"; // 'Health factor is lesser than the liquidation threshold'\n\tstring public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = \"11\"; // 'There is not enough collateral to cover a new borrow'\n\tstring public constant VL_STABLE_BORROWING_NOT_ENABLED = \"12\"; // stable borrowing not enabled\n\tstring public constant VL_COLLATERAL_SAME_AS_BORROWING_CURRENCY = \"13\"; // collateral is (mostly) the same currency that is being borrowed\n\tstring 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\n\tstring 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'\n\tstring 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'\n\tstring public constant VL_NO_STABLE_RATE_LOAN_IN_RESERVE = \"17\"; // 'User does not have a stable rate loan in progress on this reserve'\n\tstring public constant VL_NO_VARIABLE_RATE_LOAN_IN_RESERVE = \"18\"; // 'User does not have a variable rate loan in progress on this reserve'\n\tstring public constant VL_UNDERLYING_BALANCE_NOT_GREATER_THAN_0 = \"19\"; // 'The underlying balance needs to be greater than 0'\n\tstring public constant VL_DEPOSIT_ALREADY_IN_USE = \"20\"; // 'User deposit is already being used as collateral'\n\tstring public constant LP_NOT_ENOUGH_STABLE_BORROW_BALANCE = \"21\"; // 'User does not have any stable rate loan for this reserve'\n\tstring public constant LP_INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = \"22\"; // 'Interest rate rebalance conditions were not met'\n\tstring public constant LP_LIQUIDATION_CALL_FAILED = \"23\"; // 'Liquidation call failed'\n\tstring public constant LP_NOT_ENOUGH_LIQUIDITY_TO_BORROW = \"24\"; // 'There is not enough liquidity available to borrow'\n\tstring public constant LP_REQUESTED_AMOUNT_TOO_SMALL = \"25\"; // 'The requested amount is too small for a FlashLoan.'\n\tstring public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = \"26\"; // 'The actual balance of the protocol is inconsistent'\n\tstring public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = \"27\"; // 'The caller of the function is not the lending pool configurator'\n\tstring public constant LP_INCONSISTENT_FLASHLOAN_PARAMS = \"28\";\n\tstring public constant CT_CALLER_MUST_BE_LENDING_POOL = \"29\"; // 'The caller of this function must be a lending pool'\n\tstring public constant CT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = \"30\"; // 'User cannot give allowance to himself'\n\tstring public constant CT_TRANSFER_AMOUNT_NOT_GT_0 = \"31\"; // 'Transferred amount needs to be greater than zero'\n\tstring public constant RL_RESERVE_ALREADY_INITIALIZED = \"32\"; // 'Reserve has already been initialized'\n\tstring public constant LPC_RESERVE_LIQUIDITY_NOT_0 = \"34\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_ATOKEN_POOL_ADDRESS = \"35\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = \"36\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = \"37\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = \"38\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = \"39\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_ADDRESSES_PROVIDER_ID = \"40\"; // 'The liquidity of the reserve needs to be 0'\n\tstring public constant LPC_INVALID_CONFIGURATION = \"75\"; // 'Invalid risk parameters for the reserve'\n\tstring public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = \"76\"; // 'The caller must be the emergency admin'\n\tstring public constant LPAPR_PROVIDER_NOT_REGISTERED = \"41\"; // 'Provider is not registered'\n\tstring public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = \"42\"; // 'Health factor is not below the threshold'\n\tstring public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = \"43\"; // 'The collateral chosen cannot be liquidated'\n\tstring public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = \"44\"; // 'User did not borrow the specified currency'\n\tstring public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = \"45\"; // \"There isn't enough liquidity available to liquidate\"\n\tstring public constant LPCM_NO_ERRORS = \"46\"; // 'No errors'\n\tstring public constant LP_INVALID_FLASHLOAN_MODE = \"47\"; //Invalid flashloan mode selected\n\tstring public constant MATH_MULTIPLICATION_OVERFLOW = \"48\";\n\tstring public constant MATH_ADDITION_OVERFLOW = \"49\";\n\tstring public constant MATH_DIVISION_BY_ZERO = \"50\";\n\tstring public constant RL_LIQUIDITY_INDEX_OVERFLOW = \"51\"; //  Liquidity index overflows uint128\n\tstring public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = \"52\"; //  Variable borrow index overflows uint128\n\tstring public constant RL_LIQUIDITY_RATE_OVERFLOW = \"53\"; //  Liquidity rate overflows uint128\n\tstring public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = \"54\"; //  Variable borrow rate overflows uint128\n\tstring public constant RL_STABLE_BORROW_RATE_OVERFLOW = \"55\"; //  Stable borrow rate overflows uint128\n\tstring public constant CT_INVALID_MINT_AMOUNT = \"56\"; //invalid amount to mint\n\tstring public constant LP_FAILED_REPAY_WITH_COLLATERAL = \"57\";\n\tstring public constant CT_INVALID_BURN_AMOUNT = \"58\"; //invalid amount to burn\n\tstring public constant LP_FAILED_COLLATERAL_SWAP = \"60\";\n\tstring public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = \"61\";\n\tstring public constant LP_REENTRANCY_NOT_ALLOWED = \"62\";\n\tstring public constant LP_CALLER_MUST_BE_AN_ATOKEN = \"63\";\n\tstring public constant LP_IS_PAUSED = \"64\"; // 'Pool is paused'\n\tstring public constant LP_NO_MORE_RESERVES_ALLOWED = \"65\";\n\tstring public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = \"66\";\n\tstring public constant RC_INVALID_LTV = \"67\";\n\tstring public constant RC_INVALID_LIQ_THRESHOLD = \"68\";\n\tstring public constant RC_INVALID_LIQ_BONUS = \"69\";\n\tstring public constant RC_INVALID_DECIMALS = \"70\";\n\tstring public constant RC_INVALID_RESERVE_FACTOR = \"71\";\n\tstring public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = \"72\";\n\tstring public constant VL_INCONSISTENT_FLASHLOAN_PARAMS = \"73\";\n\tstring public constant LP_INCONSISTENT_PARAMS_LENGTH = \"74\";\n\tstring public constant UL_INVALID_INDEX = \"77\";\n\tstring public constant LP_NOT_CONTRACT = \"78\";\n\tstring public constant SDT_STABLE_DEBT_OVERFLOW = \"79\";\n\tstring public constant SDT_BURN_EXCEEDS_BALANCE = \"80\";\n\n\t/**\n\t * @dev Custom Radiant codes added +200 to avoid conflicts with the AaveV2/V3 ones\n\t * @custom:borrow-and-supply-caps\n\t */\n\tstring public constant INVALID_BORROW_CAP = \"201\"; // Invalid borrow cap value\n\tstring public constant INVALID_SUPPLY_CAP = \"202\"; // Invalid supply cap value\n\tstring public constant BORROW_CAP_EXCEEDED = \"203\"; // Borrow cap is exceeded\n\tstring public constant SUPPLY_CAP_EXCEEDED = \"204\"; // Supply cap is exceeded\n\n\tenum CollateralManagerErrors {\n\t\tNO_ERROR,\n\t\tNO_COLLATERAL_AVAILABLE,\n\t\tCOLLATERAL_CANNOT_BE_LIQUIDATED,\n\t\tCURRRENCY_NOT_BORROWED,\n\t\tHEALTH_FACTOR_ABOVE_THRESHOLD,\n\t\tNOT_ENOUGH_LIQUIDITY,\n\t\tNO_ACTIVE_RESERVE,\n\t\tHEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD,\n\t\tINVALID_EQUAL_ASSETS_TO_SWAP,\n\t\tFROZEN_RESERVE\n\t}\n}\n"
      },
      "contracts/mainnet/lending/libraries/types/DataTypes.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0\npragma solidity 0.8.12;\n\nlibrary DataTypes {\n\t// refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.\n\tstruct ReserveData {\n\t\t//stores the reserve configuration\n\t\tReserveConfigurationMap configuration;\n\t\t//the liquidity index. Expressed in ray\n\t\tuint128 liquidityIndex;\n\t\t//variable borrow index. Expressed in ray\n\t\tuint128 variableBorrowIndex;\n\t\t//the current supply rate. Expressed in ray\n\t\tuint128 currentLiquidityRate;\n\t\t//the current variable borrow rate. Expressed in ray\n\t\tuint128 currentVariableBorrowRate;\n\t\t//the current stable borrow rate. Expressed in ray\n\t\tuint128 currentStableBorrowRate;\n\t\tuint40 lastUpdateTimestamp;\n\t\t//tokens addresses\n\t\taddress aTokenAddress;\n\t\taddress stableDebtTokenAddress;\n\t\taddress variableDebtTokenAddress;\n\t\t//address of the interest rate strategy\n\t\taddress interestRateStrategyAddress;\n\t\t//the id of the reserve. Represents the position in the list of the active reserves\n\t\tuint8 id;\n\t}\n\n\tstruct ReserveConfigurationMap {\n\t\t//bit 0-15: LTV\n\t\t//bit 16-31: Liq. threshold\n\t\t//bit 32-47: Liq. bonus\n\t\t//bit 48-55: Decimals\n\t\t//bit 56: Reserve is active\n\t\t//bit 57: reserve is frozen\n\t\t//bit 58: borrowing is enabled\n\t\t//bit 59: stable rate borrowing enabled\n\t\t//bit 60-63: reserved\n\t\t//bit 64-79: reserve factor\n\t\t///@custom:borrow-and-supply-caps\n\t\t//bit 80-115 borrow cap in whole tokens, borrowCap == 0 => no cap\n\t\t//bit 116-151 supply cap in whole tokens, supplyCap == 0 => no cap\n\t\tuint256 data;\n\t}\n\n\tstruct UserConfigurationMap {\n\t\tuint256 data;\n\t}\n\n\tenum InterestRateMode {\n\t\tNONE,\n\t\tSTABLE,\n\t\tVARIABLE\n\t}\n}\n"
      }
    },
    "settings": {
      "optimizer": {
        "enabled": true,
        "runs": 999999,
        "details": {
          "yul": true
        }
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "metadata": {
        "useLiteralContent": true
      },
      "libraries": {}
    }
  }}