Address Details
contract

0x2cCA742585B39e0538f7cc01Ab8FfA005F1b1F1C

Contract Name
LendingPoolConfigurator
Creator
0x643c57–e72624 at 0xa891eb–6da2f6
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
22341974
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
LendingPoolConfigurator




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
200
EVM Version
istanbul




Verified at
2021-12-15T11:34:55.155346Z

contracts/protocol/lendingpool/LendingPoolConfigurator.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import {SafeMath} from '../../dependencies/openzeppelin/contracts/SafeMath.sol';
import {VersionedInitializable} from '../libraries/aave-upgradeability/VersionedInitializable.sol';
import {
  InitializableImmutableAdminUpgradeabilityProxy
} from '../libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol';
import {ReserveConfiguration} from '../libraries/configuration/ReserveConfiguration.sol';
import {ILendingPoolAddressesProvider} from '../../interfaces/ILendingPoolAddressesProvider.sol';
import {ILendingPool} from '../../interfaces/ILendingPool.sol';
import {IERC20Detailed} from '../../dependencies/openzeppelin/contracts/IERC20Detailed.sol';
import {Errors} from '../libraries/helpers/Errors.sol';
import {PercentageMath} from '../libraries/math/PercentageMath.sol';
import {DataTypes} from '../libraries/types/DataTypes.sol';
import {IInitializableDebtToken} from '../../interfaces/IInitializableDebtToken.sol';
import {IInitializableAToken} from '../../interfaces/IInitializableAToken.sol';
import {IAaveIncentivesController} from '../../interfaces/IAaveIncentivesController.sol';
import {ILendingPoolConfigurator} from '../../interfaces/ILendingPoolConfigurator.sol';

/**
 * @title LendingPoolConfigurator contract
 * @author Aave
 * @dev Implements the configuration methods for the Aave protocol
 **/

contract LendingPoolConfigurator is VersionedInitializable, ILendingPoolConfigurator {
  using SafeMath for uint256;
  using PercentageMath for uint256;
  using ReserveConfiguration for DataTypes.ReserveConfigurationMap;

  ILendingPoolAddressesProvider internal addressesProvider;
  ILendingPool internal pool;

  modifier onlyPoolAdmin {
    require(addressesProvider.getPoolAdmin() == msg.sender, Errors.CALLER_NOT_POOL_ADMIN);
    _;
  }

  modifier onlyEmergencyAdmin {
    require(
      addressesProvider.getEmergencyAdmin() == msg.sender,
      Errors.LPC_CALLER_NOT_EMERGENCY_ADMIN
    );
    _;
  }

  uint256 internal constant CONFIGURATOR_REVISION = 0x1;

  function getRevision() internal pure override returns (uint256) {
    return CONFIGURATOR_REVISION;
  }

  function initialize(ILendingPoolAddressesProvider provider) public initializer {
    addressesProvider = provider;
    pool = ILendingPool(addressesProvider.getLendingPool());
  }

  /**
   * @dev Initializes reserves in batch
   **/
  function batchInitReserve(InitReserveInput[] calldata input) external onlyPoolAdmin {
    ILendingPool cachedPool = pool;
    for (uint256 i = 0; i < input.length; i++) {
      _initReserve(cachedPool, input[i]);
    }
  }

  function _initReserve(ILendingPool pool, InitReserveInput calldata input) internal {
    address aTokenProxyAddress =
      _initTokenWithProxy(
        input.aTokenImpl,
        abi.encodeWithSelector(
          IInitializableAToken.initialize.selector,
          pool,
          input.treasury,
          input.underlyingAsset,
          IAaveIncentivesController(input.incentivesController),
          input.underlyingAssetDecimals,
          input.aTokenName,
          input.aTokenSymbol,
          input.params
        )
      );

    address stableDebtTokenProxyAddress =
      _initTokenWithProxy(
        input.stableDebtTokenImpl,
        abi.encodeWithSelector(
          IInitializableDebtToken.initialize.selector,
          pool,
          input.underlyingAsset,
          IAaveIncentivesController(input.incentivesController),
          input.underlyingAssetDecimals,
          input.stableDebtTokenName,
          input.stableDebtTokenSymbol,
          input.params
        )
      );

    address variableDebtTokenProxyAddress =
      _initTokenWithProxy(
        input.variableDebtTokenImpl,
        abi.encodeWithSelector(
          IInitializableDebtToken.initialize.selector,
          pool,
          input.underlyingAsset,
          IAaveIncentivesController(input.incentivesController),
          input.underlyingAssetDecimals,
          input.variableDebtTokenName,
          input.variableDebtTokenSymbol,
          input.params
        )
      );

    pool.initReserve(
      input.underlyingAsset,
      aTokenProxyAddress,
      stableDebtTokenProxyAddress,
      variableDebtTokenProxyAddress,
      input.interestRateStrategyAddress
    );

    DataTypes.ReserveConfigurationMap memory currentConfig =
      pool.getConfiguration(input.underlyingAsset);

    currentConfig.setDecimals(input.underlyingAssetDecimals);

    currentConfig.setActive(true);
    currentConfig.setFrozen(false);

    pool.setConfiguration(input.underlyingAsset, currentConfig.data);

    emit ReserveInitialized(
      input.underlyingAsset,
      aTokenProxyAddress,
      stableDebtTokenProxyAddress,
      variableDebtTokenProxyAddress,
      input.interestRateStrategyAddress
    );
  }

  /**
   * @dev Updates the aToken implementation for the reserve
   **/
  function updateAToken(UpdateATokenInput calldata input) external onlyPoolAdmin {
    ILendingPool cachedPool = pool;

    DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);

    (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory();

    bytes memory encodedCall = abi.encodeWithSelector(
        IInitializableAToken.initialize.selector,
        cachedPool,
        input.treasury,
        input.asset,
        input.incentivesController,
        decimals,
        input.name,
        input.symbol,
        input.params
      );

    _upgradeTokenImplementation(
      reserveData.aTokenAddress,
      input.implementation,
      encodedCall
    );

    emit ATokenUpgraded(input.asset, reserveData.aTokenAddress, input.implementation);
  }

  /**
   * @dev Updates the stable debt token implementation for the reserve
   **/
  function updateStableDebtToken(UpdateDebtTokenInput calldata input) external onlyPoolAdmin {
    ILendingPool cachedPool = pool;

    DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);
     
    (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory();

    bytes memory encodedCall = abi.encodeWithSelector(
        IInitializableDebtToken.initialize.selector,
        cachedPool,
        input.asset,
        input.incentivesController,
        decimals,
        input.name,
        input.symbol,
        input.params
      );

    _upgradeTokenImplementation(
      reserveData.stableDebtTokenAddress,
      input.implementation,
      encodedCall
    );

    emit StableDebtTokenUpgraded(
      input.asset,
      reserveData.stableDebtTokenAddress,
      input.implementation
    );
  }

  /**
   * @dev Updates the variable debt token implementation for the asset
   **/
  function updateVariableDebtToken(UpdateDebtTokenInput calldata input)
    external
    onlyPoolAdmin
  {
    ILendingPool cachedPool = pool;

    DataTypes.ReserveData memory reserveData = cachedPool.getReserveData(input.asset);

    (, , , uint256 decimals, ) = cachedPool.getConfiguration(input.asset).getParamsMemory();

    bytes memory encodedCall = abi.encodeWithSelector(
        IInitializableDebtToken.initialize.selector,
        cachedPool,
        input.asset,
        input.incentivesController,
        decimals,
        input.name,
        input.symbol,
        input.params
      );

    _upgradeTokenImplementation(
      reserveData.variableDebtTokenAddress,
      input.implementation,
      encodedCall
    );

    emit VariableDebtTokenUpgraded(
      input.asset,
      reserveData.variableDebtTokenAddress,
      input.implementation
    );
  }

  /**
   * @dev Enables borrowing on a reserve
   * @param asset The address of the underlying asset of the reserve
   * @param stableBorrowRateEnabled True if stable borrow rate needs to be enabled by default on this reserve
   **/
  function enableBorrowingOnReserve(address asset, bool stableBorrowRateEnabled)
    external
    onlyPoolAdmin
  {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setBorrowingEnabled(true);
    currentConfig.setStableRateBorrowingEnabled(stableBorrowRateEnabled);

    pool.setConfiguration(asset, currentConfig.data);

    emit BorrowingEnabledOnReserve(asset, stableBorrowRateEnabled);
  }

  /**
   * @dev Disables borrowing on a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  function disableBorrowingOnReserve(address asset) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setBorrowingEnabled(false);

    pool.setConfiguration(asset, currentConfig.data);
    emit BorrowingDisabledOnReserve(asset);
  }

  /**
   * @dev Configures the reserve collateralization parameters
   * all the values are expressed in percentages with two decimals of precision. A valid value is 10000, which means 100.00%
   * @param asset The address of the underlying asset of the reserve
   * @param ltv The loan to value of the asset when used as collateral
   * @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
   * @param liquidationBonus The bonus liquidators receive to liquidate this asset. The values is always above 100%. A value of 105%
   * means the liquidator will receive a 5% bonus
   **/
  function configureReserveAsCollateral(
    address asset,
    uint256 ltv,
    uint256 liquidationThreshold,
    uint256 liquidationBonus
  ) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    //validation of the parameters: the LTV can
    //only be lower or equal than the liquidation threshold
    //(otherwise a loan against the asset would cause instantaneous liquidation)
    require(ltv <= liquidationThreshold, Errors.LPC_INVALID_CONFIGURATION);

    if (liquidationThreshold != 0) {
      //liquidation bonus must be bigger than 100.00%, otherwise the liquidator would receive less
      //collateral than needed to cover the debt
      require(
        liquidationBonus > PercentageMath.PERCENTAGE_FACTOR,
        Errors.LPC_INVALID_CONFIGURATION
      );

      //if threshold * bonus is less than PERCENTAGE_FACTOR, it's guaranteed that at the moment
      //a loan is taken there is enough collateral available to cover the liquidation bonus
      require(
        liquidationThreshold.percentMul(liquidationBonus) <= PercentageMath.PERCENTAGE_FACTOR,
        Errors.LPC_INVALID_CONFIGURATION
      );
    } else {
      require(liquidationBonus == 0, Errors.LPC_INVALID_CONFIGURATION);
      //if the liquidation threshold is being set to 0,
      // the reserve is being disabled as collateral. To do so,
      //we need to ensure no liquidity is deposited
      _checkNoLiquidity(asset);
    }

    currentConfig.setLtv(ltv);
    currentConfig.setLiquidationThreshold(liquidationThreshold);
    currentConfig.setLiquidationBonus(liquidationBonus);

    pool.setConfiguration(asset, currentConfig.data);

    emit CollateralConfigurationChanged(asset, ltv, liquidationThreshold, liquidationBonus);
  }

  /**
   * @dev Enable stable rate borrowing on a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  function enableReserveStableRate(address asset) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setStableRateBorrowingEnabled(true);

    pool.setConfiguration(asset, currentConfig.data);

    emit StableRateEnabledOnReserve(asset);
  }

  /**
   * @dev Disable stable rate borrowing on a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  function disableReserveStableRate(address asset) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setStableRateBorrowingEnabled(false);

    pool.setConfiguration(asset, currentConfig.data);

    emit StableRateDisabledOnReserve(asset);
  }

  /**
   * @dev Activates a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  function activateReserve(address asset) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setActive(true);

    pool.setConfiguration(asset, currentConfig.data);

    emit ReserveActivated(asset);
  }

  /**
   * @dev Deactivates a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  function deactivateReserve(address asset) external onlyPoolAdmin {
    _checkNoLiquidity(asset);

    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setActive(false);

    pool.setConfiguration(asset, currentConfig.data);

    emit ReserveDeactivated(asset);
  }

  /**
   * @dev Freezes a reserve. A frozen reserve doesn't allow any new deposit, borrow or rate swap
   *  but allows repayments, liquidations, rate rebalances and withdrawals
   * @param asset The address of the underlying asset of the reserve
   **/
  function freezeReserve(address asset) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setFrozen(true);

    pool.setConfiguration(asset, currentConfig.data);

    emit ReserveFrozen(asset);
  }

  /**
   * @dev Unfreezes a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  function unfreezeReserve(address asset) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setFrozen(false);

    pool.setConfiguration(asset, currentConfig.data);

    emit ReserveUnfrozen(asset);
  }

  /**
   * @dev Updates the reserve factor of a reserve
   * @param asset The address of the underlying asset of the reserve
   * @param reserveFactor The new reserve factor of the reserve
   **/
  function setReserveFactor(address asset, uint256 reserveFactor) external onlyPoolAdmin {
    DataTypes.ReserveConfigurationMap memory currentConfig = pool.getConfiguration(asset);

    currentConfig.setReserveFactor(reserveFactor);

    pool.setConfiguration(asset, currentConfig.data);

    emit ReserveFactorChanged(asset, reserveFactor);
  }

  /**
   * @dev Sets the interest rate strategy of a reserve
   * @param asset The address of the underlying asset of the reserve
   * @param rateStrategyAddress The new address of the interest strategy contract
   **/
  function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
    external
    onlyPoolAdmin
  {
    pool.setReserveInterestRateStrategyAddress(asset, rateStrategyAddress);
    emit ReserveInterestRateStrategyChanged(asset, rateStrategyAddress);
  }

  /**
   * @dev pauses or unpauses all the actions of the protocol, including aToken transfers
   * @param val true if protocol needs to be paused, false otherwise
   **/
  function setPoolPause(bool val) external onlyEmergencyAdmin {
    pool.setPause(val);
  }

  function _initTokenWithProxy(address implementation, bytes memory initParams)
    internal
    returns (address)
  {
    InitializableImmutableAdminUpgradeabilityProxy proxy =
      new InitializableImmutableAdminUpgradeabilityProxy(address(this));

    proxy.initialize(implementation, initParams);

    return address(proxy);
  }

  function _upgradeTokenImplementation(
    address proxyAddress,
    address implementation,
    bytes memory initParams
  ) internal {
    InitializableImmutableAdminUpgradeabilityProxy proxy =
      InitializableImmutableAdminUpgradeabilityProxy(payable(proxyAddress));

    proxy.upgradeToAndCall(implementation, initParams);
  }

  function _checkNoLiquidity(address asset) internal view {
    DataTypes.ReserveData memory reserveData = pool.getReserveData(asset);

    uint256 availableLiquidity = IERC20Detailed(asset).balanceOf(reserveData.aTokenAddress);

    require(
      availableLiquidity == 0 && reserveData.currentLiquidityRate == 0,
      Errors.LPC_RESERVE_LIQUIDITY_NOT_0
    );
  }
}
        

/contracts/dependencies/openzeppelin/contracts/Address.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
  /**
   * @dev Returns true if `account` is a contract.
   *
   * [IMPORTANT]
   * ====
   * It is unsafe to assume that an address for which this function returns
   * false is an externally-owned account (EOA) and not a contract.
   *
   * Among others, `isContract` will return false for the following
   * types of addresses:
   *
   *  - an externally-owned account
   *  - a contract in construction
   *  - an address where a contract will be created
   *  - an address where a contract lived, but was destroyed
   * ====
   */
  function isContract(address account) internal view returns (bool) {
    // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
    // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
    // for accounts without code, i.e. `keccak256('')`
    bytes32 codehash;
    bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
    // solhint-disable-next-line no-inline-assembly
    assembly {
      codehash := extcodehash(account)
    }
    return (codehash != accountHash && codehash != 0x0);
  }

  /**
   * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
   * `recipient`, forwarding all available gas and reverting on errors.
   *
   * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
   * of certain opcodes, possibly making contracts go over the 2300 gas limit
   * imposed by `transfer`, making them unable to receive funds via
   * `transfer`. {sendValue} removes this limitation.
   *
   * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
   *
   * IMPORTANT: because control is transferred to `recipient`, care must be
   * taken to not create reentrancy vulnerabilities. Consider using
   * {ReentrancyGuard} or the
   * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
   */
  function sendValue(address payable recipient, uint256 amount) internal {
    require(address(this).balance >= amount, 'Address: insufficient balance');

    // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
    (bool success, ) = recipient.call{value: amount}('');
    require(success, 'Address: unable to send value, recipient may have reverted');
  }
}
          

/contracts/dependencies/openzeppelin/contracts/IERC20.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
  /**
   * @dev Returns the amount of tokens in existence.
   */
  function totalSupply() external view returns (uint256);

  /**
   * @dev Returns the amount of tokens owned by `account`.
   */
  function balanceOf(address account) external view returns (uint256);

  /**
   * @dev Moves `amount` tokens from the caller's account to `recipient`.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * Emits a {Transfer} event.
   */
  function transfer(address recipient, uint256 amount) external returns (bool);

  /**
   * @dev Returns the remaining number of tokens that `spender` will be
   * allowed to spend on behalf of `owner` through {transferFrom}. This is
   * zero by default.
   *
   * This value changes when {approve} or {transferFrom} are called.
   */
  function allowance(address owner, address spender) external view returns (uint256);

  /**
   * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * IMPORTANT: Beware that changing an allowance with this method brings the risk
   * that someone may use both the old and the new allowance by unfortunate
   * transaction ordering. One possible solution to mitigate this race
   * condition is to first reduce the spender's allowance to 0 and set the
   * desired value afterwards:
   * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
   *
   * Emits an {Approval} event.
   */
  function approve(address spender, uint256 amount) external returns (bool);

  /**
   * @dev Moves `amount` tokens from `sender` to `recipient` using the
   * allowance mechanism. `amount` is then deducted from the caller's
   * allowance.
   *
   * Returns a boolean value indicating whether the operation succeeded.
   *
   * Emits a {Transfer} event.
   */
  function transferFrom(
    address sender,
    address recipient,
    uint256 amount
  ) external returns (bool);

  /**
   * @dev Emitted when `value` tokens are moved from one account (`from`) to
   * another (`to`).
   *
   * Note that `value` may be zero.
   */
  event Transfer(address indexed from, address indexed to, uint256 value);

  /**
   * @dev Emitted when the allowance of a `spender` for an `owner` is set by
   * a call to {approve}. `value` is the new allowance.
   */
  event Approval(address indexed owner, address indexed spender, uint256 value);
}
          

/contracts/dependencies/openzeppelin/contracts/IERC20Detailed.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {IERC20} from './IERC20.sol';

interface IERC20Detailed is IERC20 {
  function name() external view returns (string memory);

  function symbol() external view returns (string memory);

  function decimals() external view returns (uint8);
}
          

/contracts/dependencies/openzeppelin/contracts/SafeMath.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
  /**
   * @dev Returns the addition of two unsigned integers, reverting on
   * overflow.
   *
   * Counterpart to Solidity's `+` operator.
   *
   * Requirements:
   * - Addition cannot overflow.
   */
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a, 'SafeMath: addition overflow');

    return c;
  }

  /**
   * @dev Returns the subtraction of two unsigned integers, reverting on
   * overflow (when the result is negative).
   *
   * Counterpart to Solidity's `-` operator.
   *
   * Requirements:
   * - Subtraction cannot overflow.
   */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    return sub(a, b, 'SafeMath: subtraction overflow');
  }

  /**
   * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
   * overflow (when the result is negative).
   *
   * Counterpart to Solidity's `-` operator.
   *
   * Requirements:
   * - Subtraction cannot overflow.
   */
  function sub(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b <= a, errorMessage);
    uint256 c = a - b;

    return c;
  }

  /**
   * @dev Returns the multiplication of two unsigned integers, reverting on
   * overflow.
   *
   * Counterpart to Solidity's `*` operator.
   *
   * Requirements:
   * - Multiplication cannot overflow.
   */
  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b, 'SafeMath: multiplication overflow');

    return c;
  }

  /**
   * @dev Returns the integer division of two unsigned integers. Reverts on
   * division by zero. The result is rounded towards zero.
   *
   * Counterpart to Solidity's `/` operator. Note: this function uses a
   * `revert` opcode (which leaves remaining gas untouched) while Solidity
   * uses an invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   * - The divisor cannot be zero.
   */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    return div(a, b, 'SafeMath: division by zero');
  }

  /**
   * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
   * division by zero. The result is rounded towards zero.
   *
   * Counterpart to Solidity's `/` operator. Note: this function uses a
   * `revert` opcode (which leaves remaining gas untouched) while Solidity
   * uses an invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   * - The divisor cannot be zero.
   */
  function div(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    // Solidity only automatically asserts when dividing by 0
    require(b > 0, errorMessage);
    uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold

    return c;
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
   * Reverts when dividing by zero.
   *
   * Counterpart to Solidity's `%` operator. This function uses a `revert`
   * opcode (which leaves remaining gas untouched) while Solidity uses an
   * invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   * - The divisor cannot be zero.
   */
  function mod(uint256 a, uint256 b) internal pure returns (uint256) {
    return mod(a, b, 'SafeMath: modulo by zero');
  }

  /**
   * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
   * Reverts with custom message when dividing by zero.
   *
   * Counterpart to Solidity's `%` operator. This function uses a `revert`
   * opcode (which leaves remaining gas untouched) while Solidity uses an
   * invalid opcode to revert (consuming all remaining gas).
   *
   * Requirements:
   * - The divisor cannot be zero.
   */
  function mod(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b != 0, errorMessage);
    return a % b;
  }
}
          

/contracts/dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import './Proxy.sol';
import '../contracts/Address.sol';

/**
 * @title BaseUpgradeabilityProxy
 * @dev This contract implements a proxy that allows to change the
 * implementation address to which it will delegate.
 * Such a change is called an implementation upgrade.
 */
contract BaseUpgradeabilityProxy is Proxy {
  /**
   * @dev Emitted when the implementation is upgraded.
   * @param implementation Address of the new implementation.
   */
  event Upgraded(address indexed implementation);

  /**
   * @dev Storage slot with the address of the current implementation.
   * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
   * validated in the constructor.
   */
  bytes32 internal constant IMPLEMENTATION_SLOT =
    0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

  /**
   * @dev Returns the current implementation.
   * @return impl Address of the current implementation
   */
  function _implementation() internal view override returns (address impl) {
    bytes32 slot = IMPLEMENTATION_SLOT;
    //solium-disable-next-line
    assembly {
      impl := sload(slot)
    }
  }

  /**
   * @dev Upgrades the proxy to a new implementation.
   * @param newImplementation Address of the new implementation.
   */
  function _upgradeTo(address newImplementation) internal {
    _setImplementation(newImplementation);
    emit Upgraded(newImplementation);
  }

  /**
   * @dev Sets the implementation address of the proxy.
   * @param newImplementation Address of the new implementation.
   */
  function _setImplementation(address newImplementation) internal {
    require(
      Address.isContract(newImplementation),
      'Cannot set a proxy implementation to a non-contract address'
    );

    bytes32 slot = IMPLEMENTATION_SLOT;

    //solium-disable-next-line
    assembly {
      sstore(slot, newImplementation)
    }
  }
}
          

/contracts/dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import './BaseUpgradeabilityProxy.sol';

/**
 * @title InitializableUpgradeabilityProxy
 * @dev Extends BaseUpgradeabilityProxy with an initializer for initializing
 * implementation and init data.
 */
contract InitializableUpgradeabilityProxy is BaseUpgradeabilityProxy {
  /**
   * @dev Contract initializer.
   * @param _logic Address of the initial implementation.
   * @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
   * It should include the signature and the parameters of the function to be called, as described in
   * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
   * This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
   */
  function initialize(address _logic, bytes memory _data) public payable {
    require(_implementation() == address(0));
    assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
    _setImplementation(_logic);
    if (_data.length > 0) {
      (bool success, ) = _logic.delegatecall(_data);
      require(success);
    }
  }
}
          

/contracts/dependencies/openzeppelin/upgradeability/Proxy.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.6.0;

/**
 * @title Proxy
 * @dev Implements delegation of calls to other contracts, with proper
 * forwarding of return values and bubbling of failures.
 * It defines a fallback function that delegates all calls to the address
 * returned by the abstract _implementation() internal function.
 */
abstract contract Proxy {
  /**
   * @dev Fallback function.
   * Implemented entirely in `_fallback`.
   */
  fallback() external payable {
    _fallback();
  }

  /**
   * @return The Address of the implementation.
   */
  function _implementation() internal view virtual returns (address);

  /**
   * @dev Delegates execution to an implementation contract.
   * This is a low level function that doesn't return to its internal call site.
   * It will return to the external caller whatever the implementation returns.
   * @param implementation Address to delegate.
   */
  function _delegate(address implementation) internal {
    //solium-disable-next-line
    assembly {
      // Copy msg.data. We take full control of memory in this inline assembly
      // block because it will not return to Solidity code. We overwrite the
      // Solidity scratch pad at memory position 0.
      calldatacopy(0, 0, calldatasize())

      // Call the implementation.
      // out and outsize are 0 because we don't know the size yet.
      let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      switch result
        // delegatecall returns 0 on error.
        case 0 {
          revert(0, returndatasize())
        }
        default {
          return(0, returndatasize())
        }
    }
  }

  /**
   * @dev Function that is run as the first thing in the fallback function.
   * Can be redefined in derived contracts to add functionality.
   * Redefinitions must call super._willFallback().
   */
  function _willFallback() internal virtual {}

  /**
   * @dev fallback implementation.
   * Extracted to enable manual triggering.
   */
  function _fallback() internal {
    _willFallback();
    _delegate(_implementation());
  }
}
          

/contracts/interfaces/IAaveIncentivesController.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

interface IAaveIncentivesController {
  function handleAction(
    address user,
    uint256 userBalance,
    uint256 totalSupply
  ) external;
}
          

/contracts/interfaces/IInitializableAToken.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {ILendingPool} from './ILendingPool.sol';
import {IAaveIncentivesController} from './IAaveIncentivesController.sol';

/**
 * @title IInitializableAToken
 * @notice Interface for the initialize function on AToken
 * @author Aave
 **/
interface IInitializableAToken {
  /**
   * @dev Initializes the aToken
   * @param pool The address of the lending pool where this aToken will be used
   * @param treasury The address of the Aave treasury, receiving the fees on this aToken
   * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)
   * @param incentivesController The smart contract managing potential incentives distribution
   * @param aTokenDecimals The decimals of the aToken, same as the underlying asset's
   * @param aTokenName The name of the aToken
   * @param aTokenSymbol The symbol of the aToken
   */
  function initialize(
    ILendingPool pool,
    address treasury,
    address underlyingAsset,
    IAaveIncentivesController incentivesController,
    uint8 aTokenDecimals,
    string calldata aTokenName,
    string calldata aTokenSymbol,
    bytes calldata params
  ) external;
}
          

/contracts/interfaces/IInitializableDebtToken.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {ILendingPool} from './ILendingPool.sol';
import {IAaveIncentivesController} from './IAaveIncentivesController.sol';

/**
 * @title IInitializableDebtToken
 * @notice Interface for the initialize function common between debt tokens
 * @author Aave
 **/
interface IInitializableDebtToken {
  /**
   * @dev Initializes the debt token.
   * @param pool The address of the lending pool where this aToken will be used
   * @param underlyingAsset The address of the underlying asset of this aToken (E.g. WETH for aWETH)
   * @param incentivesController The smart contract managing potential incentives distribution
   * @param debtTokenDecimals The decimals of the debtToken, same as the underlying asset's
   * @param debtTokenName The name of the token
   * @param debtTokenSymbol The symbol of the token
   */
  function initialize(
    ILendingPool pool,
    address underlyingAsset,
    IAaveIncentivesController incentivesController,
    uint8 debtTokenDecimals,
    string memory debtTokenName,
    string memory debtTokenSymbol,
    bytes calldata params
  ) external;
}
          

/contracts/interfaces/ILendingPool.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import {ILendingPoolAddressesProvider} from './ILendingPoolAddressesProvider.sol';
import {DataTypes} from '../protocol/libraries/types/DataTypes.sol';

interface ILendingPool {
  /**
   * @dev Emitted on deposit()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address initiating the deposit
   * @param onBehalfOf The beneficiary of the deposit, receiving the aTokens
   * @param amount The amount deposited
   * @param referral The referral code used
   **/
  event Deposit(
    address indexed reserve,
    address user,
    address indexed onBehalfOf,
    uint256 amount,
    uint16 indexed referral
  );

  /**
   * @dev Emitted on withdraw()
   * @param reserve The address of the underlyng asset being withdrawn
   * @param user The address initiating the withdrawal, owner of aTokens
   * @param to Address that will receive the underlying
   * @param amount The amount to be withdrawn
   **/
  event Withdraw(address indexed reserve, address indexed user, address indexed to, uint256 amount);

  /**
   * @dev Emitted on borrow() and flashLoan() when debt needs to be opened
   * @param reserve The address of the underlying asset being borrowed
   * @param user The address of the user initiating the borrow(), receiving the funds on borrow() or just
   * initiator of the transaction on flashLoan()
   * @param onBehalfOf The address that will be getting the debt
   * @param amount The amount borrowed out
   * @param borrowRateMode The rate mode: 1 for Stable, 2 for Variable
   * @param borrowRate The numeric rate at which the user has borrowed
   * @param referral The referral code used
   **/
  event Borrow(
    address indexed reserve,
    address user,
    address indexed onBehalfOf,
    uint256 amount,
    uint256 borrowRateMode,
    uint256 borrowRate,
    uint16 indexed referral
  );

  /**
   * @dev Emitted on repay()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The beneficiary of the repayment, getting his debt reduced
   * @param repayer The address of the user initiating the repay(), providing the funds
   * @param amount The amount repaid
   **/
  event Repay(
    address indexed reserve,
    address indexed user,
    address indexed repayer,
    uint256 amount
  );

  /**
   * @dev Emitted on swapBorrowRateMode()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address of the user swapping his rate mode
   * @param rateMode The rate mode that the user wants to swap to
   **/
  event Swap(address indexed reserve, address indexed user, uint256 rateMode);

  /**
   * @dev Emitted on setUserUseReserveAsCollateral()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address of the user enabling the usage as collateral
   **/
  event ReserveUsedAsCollateralEnabled(address indexed reserve, address indexed user);

  /**
   * @dev Emitted on setUserUseReserveAsCollateral()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address of the user enabling the usage as collateral
   **/
  event ReserveUsedAsCollateralDisabled(address indexed reserve, address indexed user);

  /**
   * @dev Emitted on rebalanceStableBorrowRate()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address of the user for which the rebalance has been executed
   **/
  event RebalanceStableBorrowRate(address indexed reserve, address indexed user);

  /**
   * @dev Emitted on flashLoan()
   * @param target The address of the flash loan receiver contract
   * @param initiator The address initiating the flash loan
   * @param asset The address of the asset being flash borrowed
   * @param amount The amount flash borrowed
   * @param premium The fee flash borrowed
   * @param referralCode The referral code used
   **/
  event FlashLoan(
    address indexed target,
    address indexed initiator,
    address indexed asset,
    uint256 amount,
    uint256 premium,
    uint16 referralCode
  );

  /**
   * @dev Emitted when the pause is triggered.
   */
  event Paused();

  /**
   * @dev Emitted when the pause is lifted.
   */
  event Unpaused();

  /**
   * @dev Emitted when a borrower is liquidated. This event is emitted by the LendingPool via
   * LendingPoolCollateral manager using a DELEGATECALL
   * This allows to have the events in the generated ABI for LendingPool.
   * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
   * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
   * @param user The address of the borrower getting liquidated
   * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
   * @param liquidatedCollateralAmount The amount of collateral received by the liiquidator
   * @param liquidator The address of the liquidator
   * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants
   * to receive the underlying collateral asset directly
   **/
  event LiquidationCall(
    address indexed collateralAsset,
    address indexed debtAsset,
    address indexed user,
    uint256 debtToCover,
    uint256 liquidatedCollateralAmount,
    address liquidator,
    bool receiveAToken
  );

  /**
   * @dev Emitted when the state of a reserve is updated. NOTE: This event is actually declared
   * in the ReserveLogic library and emitted in the updateInterestRates() function. Since the function is internal,
   * the event will actually be fired by the LendingPool contract. The event is therefore replicated here so it
   * gets added to the LendingPool ABI
   * @param reserve The address of the underlying asset of the reserve
   * @param liquidityRate The new liquidity rate
   * @param stableBorrowRate The new stable borrow rate
   * @param variableBorrowRate The new variable borrow rate
   * @param liquidityIndex The new liquidity index
   * @param variableBorrowIndex The new variable borrow index
   **/
  event ReserveDataUpdated(
    address indexed reserve,
    uint256 liquidityRate,
    uint256 stableBorrowRate,
    uint256 variableBorrowRate,
    uint256 liquidityIndex,
    uint256 variableBorrowIndex
  );

  /**
   * @dev Deposits an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
   * - E.g. User deposits 100 USDC and gets in return 100 aUSDC
   * @param asset The address of the underlying asset to deposit
   * @param amount The amount to be deposited
   * @param onBehalfOf The address that will receive the aTokens, same as msg.sender if the user
   *   wants to receive them on his own wallet, or a different address if the beneficiary of aTokens
   *   is a different wallet
   * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
   *   0 if the action is executed directly by the user, without any middle-man
   **/
  function deposit(
    address asset,
    uint256 amount,
    address onBehalfOf,
    uint16 referralCode
  ) external;

  /**
   * @dev Withdraws an `amount` of underlying asset from the reserve, burning the equivalent aTokens owned
   * E.g. User has 100 aUSDC, calls withdraw() and receives 100 USDC, burning the 100 aUSDC
   * @param asset The address of the underlying asset to withdraw
   * @param amount The underlying amount to be withdrawn
   *   - Send the value type(uint256).max in order to withdraw the whole aToken balance
   * @param to Address that will receive the underlying, same as msg.sender if the user
   *   wants to receive it on his own wallet, or a different address if the beneficiary is a
   *   different wallet
   * @return The final amount withdrawn
   **/
  function withdraw(
    address asset,
    uint256 amount,
    address to
  ) external returns (uint256);

  /**
   * @dev Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
   * already deposited enough collateral, or he was given enough allowance by a credit delegator on the
   * corresponding debt token (StableDebtToken or VariableDebtToken)
   * - E.g. User borrows 100 USDC passing as `onBehalfOf` his own address, receiving the 100 USDC in his wallet
   *   and 100 stable/variable debt tokens, depending on the `interestRateMode`
   * @param asset The address of the underlying asset to borrow
   * @param amount The amount to be borrowed
   * @param interestRateMode The interest rate mode at which the user wants to borrow: 1 for Stable, 2 for Variable
   * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
   *   0 if the action is executed directly by the user, without any middle-man
   * @param onBehalfOf Address of the user who will receive the debt. Should be the address of the borrower itself
   * calling the function if he wants to borrow against his own collateral, or the address of the credit delegator
   * if he has been given credit delegation allowance
   **/
  function borrow(
    address asset,
    uint256 amount,
    uint256 interestRateMode,
    uint16 referralCode,
    address onBehalfOf
  ) external;

  /**
   * @notice Repays a borrowed `amount` on a specific reserve, burning the equivalent debt tokens owned
   * - E.g. User repays 100 USDC, burning 100 variable/stable debt tokens of the `onBehalfOf` address
   * @param asset The address of the borrowed underlying asset previously borrowed
   * @param amount The amount to repay
   * - Send the value type(uint256).max in order to repay the whole debt for `asset` on the specific `debtMode`
   * @param rateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
   * @param onBehalfOf Address of the user who will get his debt reduced/removed. Should be the address of the
   * user calling the function if he wants to reduce/remove his own debt, or the address of any other
   * other borrower whose debt should be removed
   * @return The final amount repaid
   **/
  function repay(
    address asset,
    uint256 amount,
    uint256 rateMode,
    address onBehalfOf
  ) external returns (uint256);

  /**
   * @dev Allows a borrower to swap his debt between stable and variable mode, or viceversa
   * @param asset The address of the underlying asset borrowed
   * @param rateMode The rate mode that the user wants to swap to
   **/
  function swapBorrowRateMode(address asset, uint256 rateMode) external;

  /**
   * @dev Rebalances the stable interest rate of a user to the current stable rate defined on the reserve.
   * - Users can be rebalanced if the following conditions are satisfied:
   *     1. Usage ratio is above 95%
   *     2. the current deposit APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too much has been
   *        borrowed at a stable rate and depositors are not earning enough
   * @param asset The address of the underlying asset borrowed
   * @param user The address of the user to be rebalanced
   **/
  function rebalanceStableBorrowRate(address asset, address user) external;

  /**
   * @dev Allows depositors to enable/disable a specific deposited asset as collateral
   * @param asset The address of the underlying asset deposited
   * @param useAsCollateral `true` if the user wants to use the deposit as collateral, `false` otherwise
   **/
  function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;

  /**
   * @dev Function to liquidate a non-healthy position collateral-wise, with Health Factor below 1
   * - The caller (liquidator) covers `debtToCover` amount of debt of the user getting liquidated, and receives
   *   a proportionally amount of the `collateralAsset` plus a bonus to cover market risk
   * @param collateralAsset The address of the underlying asset used as collateral, to receive as result of the liquidation
   * @param debtAsset The address of the underlying borrowed asset to be repaid with the liquidation
   * @param user The address of the borrower getting liquidated
   * @param debtToCover The debt amount of borrowed `asset` the liquidator wants to cover
   * @param receiveAToken `true` if the liquidators wants to receive the collateral aTokens, `false` if he wants
   * to receive the underlying collateral asset directly
   **/
  function liquidationCall(
    address collateralAsset,
    address debtAsset,
    address user,
    uint256 debtToCover,
    bool receiveAToken
  ) external;

  /**
   * @dev Allows smartcontracts to access the liquidity of the pool within one transaction,
   * as long as the amount taken plus a fee is returned.
   * IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept into consideration.
   * For further details please visit https://developers.aave.com
   * @param receiverAddress The address of the contract receiving the funds, implementing the IFlashLoanReceiver interface
   * @param assets The addresses of the assets being flash-borrowed
   * @param amounts The amounts amounts being flash-borrowed
   * @param modes Types of the debt to open if the flash loan is not returned:
   *   0 -> Don't open any debt, just revert if funds can't be transferred from the receiver
   *   1 -> Open debt at stable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
   *   2 -> Open debt at variable rate for the value of the amount flash-borrowed to the `onBehalfOf` address
   * @param onBehalfOf The address  that will receive the debt in the case of using on `modes` 1 or 2
   * @param params Variadic packed params to pass to the receiver as extra information
   * @param referralCode Code used to register the integrator originating the operation, for potential rewards.
   *   0 if the action is executed directly by the user, without any middle-man
   **/
  function flashLoan(
    address receiverAddress,
    address[] calldata assets,
    uint256[] calldata amounts,
    uint256[] calldata modes,
    address onBehalfOf,
    bytes calldata params,
    uint16 referralCode
  ) external;

  /**
   * @dev Returns the user account data across all the reserves
   * @param user The address of the user
   * @return totalCollateralETH the total collateral in ETH of the user
   * @return totalDebtETH the total debt in ETH of the user
   * @return availableBorrowsETH the borrowing power left of the user
   * @return currentLiquidationThreshold the liquidation threshold of the user
   * @return ltv the loan to value of the user
   * @return healthFactor the current health factor of the user
   **/
  function getUserAccountData(address user)
    external
    view
    returns (
      uint256 totalCollateralETH,
      uint256 totalDebtETH,
      uint256 availableBorrowsETH,
      uint256 currentLiquidationThreshold,
      uint256 ltv,
      uint256 healthFactor
    );

  function initReserve(
    address reserve,
    address aTokenAddress,
    address stableDebtAddress,
    address variableDebtAddress,
    address interestRateStrategyAddress
  ) external;

  function setReserveInterestRateStrategyAddress(address reserve, address rateStrategyAddress)
    external;

  function setConfiguration(address reserve, uint256 configuration) external;

  /**
   * @dev Returns the configuration of the reserve
   * @param asset The address of the underlying asset of the reserve
   * @return The configuration of the reserve
   **/
  function getConfiguration(address asset)
    external
    view
    returns (DataTypes.ReserveConfigurationMap memory);

  /**
   * @dev Returns the configuration of the user across all the reserves
   * @param user The user address
   * @return The configuration of the user
   **/
  function getUserConfiguration(address user)
    external
    view
    returns (DataTypes.UserConfigurationMap memory);

  /**
   * @dev Returns the normalized income normalized income of the reserve
   * @param asset The address of the underlying asset of the reserve
   * @return The reserve's normalized income
   */
  function getReserveNormalizedIncome(address asset) external view returns (uint256);

  /**
   * @dev Returns the normalized variable debt per unit of asset
   * @param asset The address of the underlying asset of the reserve
   * @return The reserve normalized variable debt
   */
  function getReserveNormalizedVariableDebt(address asset) external view returns (uint256);

  /**
   * @dev Returns the state and configuration of the reserve
   * @param asset The address of the underlying asset of the reserve
   * @return The state of the reserve
   **/
  function getReserveData(address asset) external view returns (DataTypes.ReserveData memory);

  function finalizeTransfer(
    address asset,
    address from,
    address to,
    uint256 amount,
    uint256 balanceFromAfter,
    uint256 balanceToBefore
  ) external;

  function getReservesList() external view returns (address[] memory);

  function getAddressesProvider() external view returns (ILendingPoolAddressesProvider);

  function setPause(bool val) external;

  function paused() external view returns (bool);
}
          

/contracts/interfaces/ILendingPoolAddressesProvider.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @title LendingPoolAddressesProvider contract
 * @dev Main registry of addresses part of or connected to the protocol, including permissioned roles
 * - Acting also as factory of proxies and admin of those, so with right to change its implementations
 * - Owned by the Aave Governance
 * @author Aave
 **/
interface ILendingPoolAddressesProvider {
  event MarketIdSet(string newMarketId);
  event LendingPoolUpdated(address indexed newAddress);
  event ConfigurationAdminUpdated(address indexed newAddress);
  event EmergencyAdminUpdated(address indexed newAddress);
  event LendingPoolConfiguratorUpdated(address indexed newAddress);
  event LendingPoolCollateralManagerUpdated(address indexed newAddress);
  event PriceOracleUpdated(address indexed newAddress);
  event LendingRateOracleUpdated(address indexed newAddress);
  event ProxyCreated(bytes32 id, address indexed newAddress);
  event AddressSet(bytes32 id, address indexed newAddress, bool hasProxy);

  function getMarketId() external view returns (string memory);

  function setMarketId(string calldata marketId) external;

  function setAddress(bytes32 id, address newAddress) external;

  function setAddressAsProxy(bytes32 id, address impl) external;

  function getAddress(bytes32 id) external view returns (address);

  function getLendingPool() external view returns (address);

  function setLendingPoolImpl(address pool) external;

  function getLendingPoolConfigurator() external view returns (address);

  function setLendingPoolConfiguratorImpl(address configurator) external;

  function getLendingPoolCollateralManager() external view returns (address);

  function setLendingPoolCollateralManager(address manager) external;

  function getPoolAdmin() external view returns (address);

  function setPoolAdmin(address admin) external;

  function getEmergencyAdmin() external view returns (address);

  function setEmergencyAdmin(address admin) external;

  function getPriceOracle() external view returns (address);

  function setPriceOracle(address priceOracle) external;

  function getLendingRateOracle() external view returns (address);

  function setLendingRateOracle(address lendingRateOracle) external;
}
          

/contracts/interfaces/ILendingPoolConfigurator.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

interface ILendingPoolConfigurator {
  struct InitReserveInput {
    address aTokenImpl;
    address stableDebtTokenImpl;
    address variableDebtTokenImpl;
    uint8 underlyingAssetDecimals;
    address interestRateStrategyAddress;
    address underlyingAsset;
    address treasury;
    address incentivesController;
    string underlyingAssetName;
    string aTokenName;
    string aTokenSymbol;
    string variableDebtTokenName;
    string variableDebtTokenSymbol;
    string stableDebtTokenName;
    string stableDebtTokenSymbol;
    bytes params;
  }

  struct UpdateATokenInput {
    address asset;
    address treasury;
    address incentivesController;
    string name;
    string symbol;
    address implementation;
    bytes params;
  }

  struct UpdateDebtTokenInput {
    address asset;
    address incentivesController;
    string name;
    string symbol;
    address implementation;
    bytes params;
  }

  /**
   * @dev Emitted when a reserve is initialized.
   * @param asset The address of the underlying asset of the reserve
   * @param aToken The address of the associated aToken contract
   * @param stableDebtToken The address of the associated stable rate debt token
   * @param variableDebtToken The address of the associated variable rate debt token
   * @param interestRateStrategyAddress The address of the interest rate strategy for the reserve
   **/
  event ReserveInitialized(
    address indexed asset,
    address indexed aToken,
    address stableDebtToken,
    address variableDebtToken,
    address interestRateStrategyAddress
  );

  /**
   * @dev Emitted when borrowing is enabled on a reserve
   * @param asset The address of the underlying asset of the reserve
   * @param stableRateEnabled True if stable rate borrowing is enabled, false otherwise
   **/
  event BorrowingEnabledOnReserve(address indexed asset, bool stableRateEnabled);

  /**
   * @dev Emitted when borrowing is disabled on a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  event BorrowingDisabledOnReserve(address indexed asset);

  /**
   * @dev Emitted when the collateralization risk parameters for the specified asset are updated.
   * @param asset The address of the underlying asset of the reserve
   * @param ltv The loan to value of the asset when used as collateral
   * @param liquidationThreshold The threshold at which loans using this asset as collateral will be considered undercollateralized
   * @param liquidationBonus The bonus liquidators receive to liquidate this asset
   **/
  event CollateralConfigurationChanged(
    address indexed asset,
    uint256 ltv,
    uint256 liquidationThreshold,
    uint256 liquidationBonus
  );

  /**
   * @dev Emitted when stable rate borrowing is enabled on a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  event StableRateEnabledOnReserve(address indexed asset);

  /**
   * @dev Emitted when stable rate borrowing is disabled on a reserve
   * @param asset The address of the underlying asset of the reserve
   **/
  event StableRateDisabledOnReserve(address indexed asset);

  /**
   * @dev Emitted when a reserve is activated
   * @param asset The address of the underlying asset of the reserve
   **/
  event ReserveActivated(address indexed asset);

  /**
   * @dev Emitted when a reserve is deactivated
   * @param asset The address of the underlying asset of the reserve
   **/
  event ReserveDeactivated(address indexed asset);

  /**
   * @dev Emitted when a reserve is frozen
   * @param asset The address of the underlying asset of the reserve
   **/
  event ReserveFrozen(address indexed asset);

  /**
   * @dev Emitted when a reserve is unfrozen
   * @param asset The address of the underlying asset of the reserve
   **/
  event ReserveUnfrozen(address indexed asset);

  /**
   * @dev Emitted when a reserve factor is updated
   * @param asset The address of the underlying asset of the reserve
   * @param factor The new reserve factor
   **/
  event ReserveFactorChanged(address indexed asset, uint256 factor);

  /**
   * @dev Emitted when the reserve decimals are updated
   * @param asset The address of the underlying asset of the reserve
   * @param decimals The new decimals
   **/
  event ReserveDecimalsChanged(address indexed asset, uint256 decimals);

  /**
   * @dev Emitted when a reserve interest strategy contract is updated
   * @param asset The address of the underlying asset of the reserve
   * @param strategy The new address of the interest strategy contract
   **/
  event ReserveInterestRateStrategyChanged(address indexed asset, address strategy);

  /**
   * @dev Emitted when an aToken implementation is upgraded
   * @param asset The address of the underlying asset of the reserve
   * @param proxy The aToken proxy address
   * @param implementation The new aToken implementation
   **/
  event ATokenUpgraded(
    address indexed asset,
    address indexed proxy,
    address indexed implementation
  );

  /**
   * @dev Emitted when the implementation of a stable debt token is upgraded
   * @param asset The address of the underlying asset of the reserve
   * @param proxy The stable debt token proxy address
   * @param implementation The new aToken implementation
   **/
  event StableDebtTokenUpgraded(
    address indexed asset,
    address indexed proxy,
    address indexed implementation
  );

  /**
   * @dev Emitted when the implementation of a variable debt token is upgraded
   * @param asset The address of the underlying asset of the reserve
   * @param proxy The variable debt token proxy address
   * @param implementation The new aToken implementation
   **/
  event VariableDebtTokenUpgraded(
    address indexed asset,
    address indexed proxy,
    address indexed implementation
  );
}
          

/contracts/protocol/libraries/aave-upgradeability/BaseImmutableAdminUpgradeabilityProxy.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import '../../../dependencies/openzeppelin/upgradeability/BaseUpgradeabilityProxy.sol';

/**
 * @title BaseImmutableAdminUpgradeabilityProxy
 * @author Aave, inspired by the OpenZeppelin upgradeability proxy pattern
 * @dev This contract combines an upgradeability proxy with an authorization
 * mechanism for administrative tasks. The admin role is stored in an immutable, which
 * helps saving transactions costs
 * All external functions in this contract must be guarded by the
 * `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
 * feature proposal that would enable this to be done automatically.
 */
contract BaseImmutableAdminUpgradeabilityProxy is BaseUpgradeabilityProxy {
  address immutable ADMIN;

  constructor(address admin) public {
    ADMIN = admin;
  }

  modifier ifAdmin() {
    if (msg.sender == ADMIN) {
      _;
    } else {
      _fallback();
    }
  }

  /**
   * @return The address of the proxy admin.
   */
  function admin() external ifAdmin returns (address) {
    return ADMIN;
  }

  /**
   * @return The address of the implementation.
   */
  function implementation() external ifAdmin returns (address) {
    return _implementation();
  }

  /**
   * @dev Upgrade the backing implementation of the proxy.
   * Only the admin can call this function.
   * @param newImplementation Address of the new implementation.
   */
  function upgradeTo(address newImplementation) external ifAdmin {
    _upgradeTo(newImplementation);
  }

  /**
   * @dev Upgrade the backing implementation of the proxy and call a function
   * on the new implementation.
   * This is useful to initialize the proxied contract.
   * @param newImplementation Address of the new implementation.
   * @param data Data to send as msg.data in the low level call.
   * It should include the signature and the parameters of the function to be called, as described in
   * https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
   */
  function upgradeToAndCall(address newImplementation, bytes calldata data)
    external
    payable
    ifAdmin
  {
    _upgradeTo(newImplementation);
    (bool success, ) = newImplementation.delegatecall(data);
    require(success);
  }

  /**
   * @dev Only fall back when the sender is not the admin.
   */
  function _willFallback() internal virtual override {
    require(msg.sender != ADMIN, 'Cannot call fallback function from the proxy admin');
    super._willFallback();
  }
}
          

/contracts/protocol/libraries/aave-upgradeability/InitializableImmutableAdminUpgradeabilityProxy.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import './BaseImmutableAdminUpgradeabilityProxy.sol';
import '../../../dependencies/openzeppelin/upgradeability/InitializableUpgradeabilityProxy.sol';

/**
 * @title InitializableAdminUpgradeabilityProxy
 * @dev Extends BaseAdminUpgradeabilityProxy with an initializer function
 */
contract InitializableImmutableAdminUpgradeabilityProxy is
  BaseImmutableAdminUpgradeabilityProxy,
  InitializableUpgradeabilityProxy
{
  constructor(address admin) public BaseImmutableAdminUpgradeabilityProxy(admin) {}

  /**
   * @dev Only fall back when the sender is not the admin.
   */
  function _willFallback() internal override(BaseImmutableAdminUpgradeabilityProxy, Proxy) {
    BaseImmutableAdminUpgradeabilityProxy._willFallback();
  }
}
          

/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @title VersionedInitializable
 *
 * @dev Helper contract to implement initializer functions. To use it, replace
 * the constructor with a function that has the `initializer` modifier.
 * WARNING: Unlike constructors, initializer functions must be manually
 * invoked. This applies both to deploying an Initializable contract, as well
 * as extending an Initializable contract via inheritance.
 * WARNING: When used with inheritance, manual care must be taken to not invoke
 * a parent initializer twice, or ensure that all initializers are idempotent,
 * because this is not dealt with automatically as with constructors.
 *
 * @author Aave, inspired by the OpenZeppelin Initializable contract
 */
abstract contract VersionedInitializable {
  /**
   * @dev Indicates that the contract has been initialized.
   */
  uint256 private lastInitializedRevision = 0;

  /**
   * @dev Indicates that the contract is in the process of being initialized.
   */
  bool private initializing;

  /**
   * @dev Modifier to use in the initializer function of a contract.
   */
  modifier initializer() {
    uint256 revision = getRevision();
    require(
      initializing || isConstructor() || revision > lastInitializedRevision,
      'Contract instance has already been initialized'
    );

    bool isTopLevelCall = !initializing;
    if (isTopLevelCall) {
      initializing = true;
      lastInitializedRevision = revision;
    }

    _;

    if (isTopLevelCall) {
      initializing = false;
    }
  }

  /**
   * @dev returns the revision number of the contract
   * Needs to be defined in the inherited class as a constant.
   **/
  function getRevision() internal pure virtual returns (uint256);

  /**
   * @dev Returns true if and only if the function is running in the constructor
   **/
  function isConstructor() private view returns (bool) {
    // extcodesize checks the size of the code stored in an address, and
    // address returns the current address. Since the code is still not
    // deployed when running a constructor, any checks on its code size will
    // yield zero, making it an effective way to detect if a contract is
    // under construction or not.
    uint256 cs;
    //solium-disable-next-line
    assembly {
      cs := extcodesize(address())
    }
    return cs == 0;
  }

  // Reserved storage space to allow for layout changes in the future.
  uint256[50] private ______gap;
}
          

/contracts/protocol/libraries/configuration/ReserveConfiguration.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {Errors} from '../helpers/Errors.sol';
import {DataTypes} from '../types/DataTypes.sol';

/**
 * @title ReserveConfiguration library
 * @author Aave
 * @notice Implements the bitmap logic to handle the reserve configuration
 */
library ReserveConfiguration {
  uint256 constant LTV_MASK =                   0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000; // prettier-ignore
  uint256 constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF; // prettier-ignore
  uint256 constant LIQUIDATION_BONUS_MASK =     0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFF; // prettier-ignore
  uint256 constant DECIMALS_MASK =              0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00FFFFFFFFFFFF; // prettier-ignore
  uint256 constant ACTIVE_MASK =                0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFF; // prettier-ignore
  uint256 constant FROZEN_MASK =                0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDFFFFFFFFFFFFFF; // prettier-ignore
  uint256 constant BORROWING_MASK =             0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFF; // prettier-ignore
  uint256 constant STABLE_BORROWING_MASK =      0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFF; // prettier-ignore
  uint256 constant RESERVE_FACTOR_MASK =        0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFF; // prettier-ignore

  /// @dev For the LTV, the start bit is 0 (up to 15), hence no bitshifting is needed
  uint256 constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16;
  uint256 constant LIQUIDATION_BONUS_START_BIT_POSITION = 32;
  uint256 constant RESERVE_DECIMALS_START_BIT_POSITION = 48;
  uint256 constant IS_ACTIVE_START_BIT_POSITION = 56;
  uint256 constant IS_FROZEN_START_BIT_POSITION = 57;
  uint256 constant BORROWING_ENABLED_START_BIT_POSITION = 58;
  uint256 constant STABLE_BORROWING_ENABLED_START_BIT_POSITION = 59;
  uint256 constant RESERVE_FACTOR_START_BIT_POSITION = 64;

  uint256 constant MAX_VALID_LTV = 65535;
  uint256 constant MAX_VALID_LIQUIDATION_THRESHOLD = 65535;
  uint256 constant MAX_VALID_LIQUIDATION_BONUS = 65535;
  uint256 constant MAX_VALID_DECIMALS = 255;
  uint256 constant MAX_VALID_RESERVE_FACTOR = 65535;

  /**
   * @dev Sets the Loan to Value of the reserve
   * @param self The reserve configuration
   * @param ltv the new ltv
   **/
  function setLtv(DataTypes.ReserveConfigurationMap memory self, uint256 ltv) internal pure {
    require(ltv <= MAX_VALID_LTV, Errors.RC_INVALID_LTV);

    self.data = (self.data & LTV_MASK) | ltv;
  }

  /**
   * @dev Gets the Loan to Value of the reserve
   * @param self The reserve configuration
   * @return The loan to value
   **/
  function getLtv(DataTypes.ReserveConfigurationMap storage self) internal view returns (uint256) {
    return self.data & ~LTV_MASK;
  }

  /**
   * @dev Sets the liquidation threshold of the reserve
   * @param self The reserve configuration
   * @param threshold The new liquidation threshold
   **/
  function setLiquidationThreshold(DataTypes.ReserveConfigurationMap memory self, uint256 threshold)
    internal
    pure
  {
    require(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.RC_INVALID_LIQ_THRESHOLD);

    self.data =
      (self.data & LIQUIDATION_THRESHOLD_MASK) |
      (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION);
  }

  /**
   * @dev Gets the liquidation threshold of the reserve
   * @param self The reserve configuration
   * @return The liquidation threshold
   **/
  function getLiquidationThreshold(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (uint256)
  {
    return (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION;
  }

  /**
   * @dev Sets the liquidation bonus of the reserve
   * @param self The reserve configuration
   * @param bonus The new liquidation bonus
   **/
  function setLiquidationBonus(DataTypes.ReserveConfigurationMap memory self, uint256 bonus)
    internal
    pure
  {
    require(bonus <= MAX_VALID_LIQUIDATION_BONUS, Errors.RC_INVALID_LIQ_BONUS);

    self.data =
      (self.data & LIQUIDATION_BONUS_MASK) |
      (bonus << LIQUIDATION_BONUS_START_BIT_POSITION);
  }

  /**
   * @dev Gets the liquidation bonus of the reserve
   * @param self The reserve configuration
   * @return The liquidation bonus
   **/
  function getLiquidationBonus(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (uint256)
  {
    return (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION;
  }

  /**
   * @dev Sets the decimals of the underlying asset of the reserve
   * @param self The reserve configuration
   * @param decimals The decimals
   **/
  function setDecimals(DataTypes.ReserveConfigurationMap memory self, uint256 decimals)
    internal
    pure
  {
    require(decimals <= MAX_VALID_DECIMALS, Errors.RC_INVALID_DECIMALS);

    self.data = (self.data & DECIMALS_MASK) | (decimals << RESERVE_DECIMALS_START_BIT_POSITION);
  }

  /**
   * @dev Gets the decimals of the underlying asset of the reserve
   * @param self The reserve configuration
   * @return The decimals of the asset
   **/
  function getDecimals(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (uint256)
  {
    return (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION;
  }

  /**
   * @dev Sets the active state of the reserve
   * @param self The reserve configuration
   * @param active The active state
   **/
  function setActive(DataTypes.ReserveConfigurationMap memory self, bool active) internal pure {
    self.data =
      (self.data & ACTIVE_MASK) |
      (uint256(active ? 1 : 0) << IS_ACTIVE_START_BIT_POSITION);
  }

  /**
   * @dev Gets the active state of the reserve
   * @param self The reserve configuration
   * @return The active state
   **/
  function getActive(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
    return (self.data & ~ACTIVE_MASK) != 0;
  }

  /**
   * @dev Sets the frozen state of the reserve
   * @param self The reserve configuration
   * @param frozen The frozen state
   **/
  function setFrozen(DataTypes.ReserveConfigurationMap memory self, bool frozen) internal pure {
    self.data =
      (self.data & FROZEN_MASK) |
      (uint256(frozen ? 1 : 0) << IS_FROZEN_START_BIT_POSITION);
  }

  /**
   * @dev Gets the frozen state of the reserve
   * @param self The reserve configuration
   * @return The frozen state
   **/
  function getFrozen(DataTypes.ReserveConfigurationMap storage self) internal view returns (bool) {
    return (self.data & ~FROZEN_MASK) != 0;
  }

  /**
   * @dev Enables or disables borrowing on the reserve
   * @param self The reserve configuration
   * @param enabled True if the borrowing needs to be enabled, false otherwise
   **/
  function setBorrowingEnabled(DataTypes.ReserveConfigurationMap memory self, bool enabled)
    internal
    pure
  {
    self.data =
      (self.data & BORROWING_MASK) |
      (uint256(enabled ? 1 : 0) << BORROWING_ENABLED_START_BIT_POSITION);
  }

  /**
   * @dev Gets the borrowing state of the reserve
   * @param self The reserve configuration
   * @return The borrowing state
   **/
  function getBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (bool)
  {
    return (self.data & ~BORROWING_MASK) != 0;
  }

  /**
   * @dev Enables or disables stable rate borrowing on the reserve
   * @param self The reserve configuration
   * @param enabled True if the stable rate borrowing needs to be enabled, false otherwise
   **/
  function setStableRateBorrowingEnabled(
    DataTypes.ReserveConfigurationMap memory self,
    bool enabled
  ) internal pure {
    self.data =
      (self.data & STABLE_BORROWING_MASK) |
      (uint256(enabled ? 1 : 0) << STABLE_BORROWING_ENABLED_START_BIT_POSITION);
  }

  /**
   * @dev Gets the stable rate borrowing state of the reserve
   * @param self The reserve configuration
   * @return The stable rate borrowing state
   **/
  function getStableRateBorrowingEnabled(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (bool)
  {
    return (self.data & ~STABLE_BORROWING_MASK) != 0;
  }

  /**
   * @dev Sets the reserve factor of the reserve
   * @param self The reserve configuration
   * @param reserveFactor The reserve factor
   **/
  function setReserveFactor(DataTypes.ReserveConfigurationMap memory self, uint256 reserveFactor)
    internal
    pure
  {
    require(reserveFactor <= MAX_VALID_RESERVE_FACTOR, Errors.RC_INVALID_RESERVE_FACTOR);

    self.data =
      (self.data & RESERVE_FACTOR_MASK) |
      (reserveFactor << RESERVE_FACTOR_START_BIT_POSITION);
  }

  /**
   * @dev Gets the reserve factor of the reserve
   * @param self The reserve configuration
   * @return The reserve factor
   **/
  function getReserveFactor(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (uint256)
  {
    return (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION;
  }

  /**
   * @dev Gets the configuration flags of the reserve
   * @param self The reserve configuration
   * @return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled
   **/
  function getFlags(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (
      bool,
      bool,
      bool,
      bool
    )
  {
    uint256 dataLocal = self.data;

    return (
      (dataLocal & ~ACTIVE_MASK) != 0,
      (dataLocal & ~FROZEN_MASK) != 0,
      (dataLocal & ~BORROWING_MASK) != 0,
      (dataLocal & ~STABLE_BORROWING_MASK) != 0
    );
  }

  /**
   * @dev Gets the configuration paramters of the reserve
   * @param self The reserve configuration
   * @return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals
   **/
  function getParams(DataTypes.ReserveConfigurationMap storage self)
    internal
    view
    returns (
      uint256,
      uint256,
      uint256,
      uint256,
      uint256
    )
  {
    uint256 dataLocal = self.data;

    return (
      dataLocal & ~LTV_MASK,
      (dataLocal & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION,
      (dataLocal & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION,
      (dataLocal & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION,
      (dataLocal & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION
    );
  }

  /**
   * @dev Gets the configuration paramters of the reserve from a memory object
   * @param self The reserve configuration
   * @return The state params representing ltv, liquidation threshold, liquidation bonus, the reserve decimals
   **/
  function getParamsMemory(DataTypes.ReserveConfigurationMap memory self)
    internal
    pure
    returns (
      uint256,
      uint256,
      uint256,
      uint256,
      uint256
    )
  {
    return (
      self.data & ~LTV_MASK,
      (self.data & ~LIQUIDATION_THRESHOLD_MASK) >> LIQUIDATION_THRESHOLD_START_BIT_POSITION,
      (self.data & ~LIQUIDATION_BONUS_MASK) >> LIQUIDATION_BONUS_START_BIT_POSITION,
      (self.data & ~DECIMALS_MASK) >> RESERVE_DECIMALS_START_BIT_POSITION,
      (self.data & ~RESERVE_FACTOR_MASK) >> RESERVE_FACTOR_START_BIT_POSITION
    );
  }

  /**
   * @dev Gets the configuration flags of the reserve from a memory object
   * @param self The reserve configuration
   * @return The state flags representing active, frozen, borrowing enabled, stableRateBorrowing enabled
   **/
  function getFlagsMemory(DataTypes.ReserveConfigurationMap memory self)
    internal
    pure
    returns (
      bool,
      bool,
      bool,
      bool
    )
  {
    return (
      (self.data & ~ACTIVE_MASK) != 0,
      (self.data & ~FROZEN_MASK) != 0,
      (self.data & ~BORROWING_MASK) != 0,
      (self.data & ~STABLE_BORROWING_MASK) != 0
    );
  }
}
          

/contracts/protocol/libraries/helpers/Errors.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

/**
 * @title Errors library
 * @author Aave
 * @notice Defines the error messages emitted by the different contracts of the Aave protocol
 * @dev Error messages prefix glossary:
 *  - VL = ValidationLogic
 *  - MATH = Math libraries
 *  - CT = Common errors between tokens (AToken, VariableDebtToken and StableDebtToken)
 *  - AT = AToken
 *  - SDT = StableDebtToken
 *  - VDT = VariableDebtToken
 *  - LP = LendingPool
 *  - LPAPR = LendingPoolAddressesProviderRegistry
 *  - LPC = LendingPoolConfiguration
 *  - RL = ReserveLogic
 *  - LPCM = LendingPoolCollateralManager
 *  - P = Pausable
 */
library Errors {
  //common errors
  string public constant CALLER_NOT_POOL_ADMIN = '33'; // 'The caller must be the pool admin'
  string public constant BORROW_ALLOWANCE_NOT_ENOUGH = '59'; // User borrows on behalf, but allowance are too small

  //contract specific errors
  string public constant VL_INVALID_AMOUNT = '1'; // 'Amount must be greater than 0'
  string public constant VL_NO_ACTIVE_RESERVE = '2'; // 'Action requires an active reserve'
  string public constant VL_RESERVE_FROZEN = '3'; // 'Action cannot be performed because the reserve is frozen'
  string public constant VL_CURRENT_AVAILABLE_LIQUIDITY_NOT_ENOUGH = '4'; // 'The current liquidity is not enough'
  string public constant VL_NOT_ENOUGH_AVAILABLE_USER_BALANCE = '5'; // 'User cannot withdraw more than the available balance'
  string public constant VL_TRANSFER_NOT_ALLOWED = '6'; // 'Transfer cannot be allowed.'
  string public constant VL_BORROWING_NOT_ENABLED = '7'; // 'Borrowing is not enabled'
  string public constant VL_INVALID_INTEREST_RATE_MODE_SELECTED = '8'; // 'Invalid interest rate mode selected'
  string public constant VL_COLLATERAL_BALANCE_IS_0 = '9'; // 'The collateral balance is 0'
  string public constant VL_HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD = '10'; // 'Health factor is lesser than the liquidation threshold'
  string public constant VL_COLLATERAL_CANNOT_COVER_NEW_BORROW = '11'; // 'There is not enough collateral to cover a new borrow'
  string public constant VL_STABLE_BORROWING_NOT_ENABLED = '12'; // stable borrowing not enabled
  string public constant VL_COLLATERAL_SAME_AS_BORROWING_CURRENCY = '13'; // collateral is (mostly) the same currency that is being borrowed
  string public constant VL_AMOUNT_BIGGER_THAN_MAX_LOAN_SIZE_STABLE = '14'; // 'The requested amount is greater than the max loan size in stable rate mode
  string public constant VL_NO_DEBT_OF_SELECTED_TYPE = '15'; // 'for repayment of stable debt, the user needs to have stable debt, otherwise, he needs to have variable debt'
  string public constant VL_NO_EXPLICIT_AMOUNT_TO_REPAY_ON_BEHALF = '16'; // 'To repay on behalf of an user an explicit amount to repay is needed'
  string public constant VL_NO_STABLE_RATE_LOAN_IN_RESERVE = '17'; // 'User does not have a stable rate loan in progress on this reserve'
  string public constant VL_NO_VARIABLE_RATE_LOAN_IN_RESERVE = '18'; // 'User does not have a variable rate loan in progress on this reserve'
  string public constant VL_UNDERLYING_BALANCE_NOT_GREATER_THAN_0 = '19'; // 'The underlying balance needs to be greater than 0'
  string public constant VL_DEPOSIT_ALREADY_IN_USE = '20'; // 'User deposit is already being used as collateral'
  string public constant LP_NOT_ENOUGH_STABLE_BORROW_BALANCE = '21'; // 'User does not have any stable rate loan for this reserve'
  string public constant LP_INTEREST_RATE_REBALANCE_CONDITIONS_NOT_MET = '22'; // 'Interest rate rebalance conditions were not met'
  string public constant LP_LIQUIDATION_CALL_FAILED = '23'; // 'Liquidation call failed'
  string public constant LP_NOT_ENOUGH_LIQUIDITY_TO_BORROW = '24'; // 'There is not enough liquidity available to borrow'
  string public constant LP_REQUESTED_AMOUNT_TOO_SMALL = '25'; // 'The requested amount is too small for a FlashLoan.'
  string public constant LP_INCONSISTENT_PROTOCOL_ACTUAL_BALANCE = '26'; // 'The actual balance of the protocol is inconsistent'
  string public constant LP_CALLER_NOT_LENDING_POOL_CONFIGURATOR = '27'; // 'The caller of the function is not the lending pool configurator'
  string public constant LP_INCONSISTENT_FLASHLOAN_PARAMS = '28';
  string public constant CT_CALLER_MUST_BE_LENDING_POOL = '29'; // 'The caller of this function must be a lending pool'
  string public constant CT_CANNOT_GIVE_ALLOWANCE_TO_HIMSELF = '30'; // 'User cannot give allowance to himself'
  string public constant CT_TRANSFER_AMOUNT_NOT_GT_0 = '31'; // 'Transferred amount needs to be greater than zero'
  string public constant RL_RESERVE_ALREADY_INITIALIZED = '32'; // 'Reserve has already been initialized'
  string public constant LPC_RESERVE_LIQUIDITY_NOT_0 = '34'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_ATOKEN_POOL_ADDRESS = '35'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_STABLE_DEBT_TOKEN_POOL_ADDRESS = '36'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_POOL_ADDRESS = '37'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_STABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '38'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_VARIABLE_DEBT_TOKEN_UNDERLYING_ADDRESS = '39'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_ADDRESSES_PROVIDER_ID = '40'; // 'The liquidity of the reserve needs to be 0'
  string public constant LPC_INVALID_CONFIGURATION = '75'; // 'Invalid risk parameters for the reserve'
  string public constant LPC_CALLER_NOT_EMERGENCY_ADMIN = '76'; // 'The caller must be the emergency admin'
  string public constant LPAPR_PROVIDER_NOT_REGISTERED = '41'; // 'Provider is not registered'
  string public constant LPCM_HEALTH_FACTOR_NOT_BELOW_THRESHOLD = '42'; // 'Health factor is not below the threshold'
  string public constant LPCM_COLLATERAL_CANNOT_BE_LIQUIDATED = '43'; // 'The collateral chosen cannot be liquidated'
  string public constant LPCM_SPECIFIED_CURRENCY_NOT_BORROWED_BY_USER = '44'; // 'User did not borrow the specified currency'
  string public constant LPCM_NOT_ENOUGH_LIQUIDITY_TO_LIQUIDATE = '45'; // "There isn't enough liquidity available to liquidate"
  string public constant LPCM_NO_ERRORS = '46'; // 'No errors'
  string public constant LP_INVALID_FLASHLOAN_MODE = '47'; //Invalid flashloan mode selected
  string public constant MATH_MULTIPLICATION_OVERFLOW = '48';
  string public constant MATH_ADDITION_OVERFLOW = '49';
  string public constant MATH_DIVISION_BY_ZERO = '50';
  string public constant RL_LIQUIDITY_INDEX_OVERFLOW = '51'; //  Liquidity index overflows uint128
  string public constant RL_VARIABLE_BORROW_INDEX_OVERFLOW = '52'; //  Variable borrow index overflows uint128
  string public constant RL_LIQUIDITY_RATE_OVERFLOW = '53'; //  Liquidity rate overflows uint128
  string public constant RL_VARIABLE_BORROW_RATE_OVERFLOW = '54'; //  Variable borrow rate overflows uint128
  string public constant RL_STABLE_BORROW_RATE_OVERFLOW = '55'; //  Stable borrow rate overflows uint128
  string public constant CT_INVALID_MINT_AMOUNT = '56'; //invalid amount to mint
  string public constant LP_FAILED_REPAY_WITH_COLLATERAL = '57';
  string public constant CT_INVALID_BURN_AMOUNT = '58'; //invalid amount to burn
  string public constant LP_FAILED_COLLATERAL_SWAP = '60';
  string public constant LP_INVALID_EQUAL_ASSETS_TO_SWAP = '61';
  string public constant LP_REENTRANCY_NOT_ALLOWED = '62';
  string public constant LP_CALLER_MUST_BE_AN_ATOKEN = '63';
  string public constant LP_IS_PAUSED = '64'; // 'Pool is paused'
  string public constant LP_NO_MORE_RESERVES_ALLOWED = '65';
  string public constant LP_INVALID_FLASH_LOAN_EXECUTOR_RETURN = '66';
  string public constant RC_INVALID_LTV = '67';
  string public constant RC_INVALID_LIQ_THRESHOLD = '68';
  string public constant RC_INVALID_LIQ_BONUS = '69';
  string public constant RC_INVALID_DECIMALS = '70';
  string public constant RC_INVALID_RESERVE_FACTOR = '71';
  string public constant LPAPR_INVALID_ADDRESSES_PROVIDER_ID = '72';
  string public constant VL_INCONSISTENT_FLASHLOAN_PARAMS = '73';
  string public constant LP_INCONSISTENT_PARAMS_LENGTH = '74';
  string public constant UL_INVALID_INDEX = '77';
  string public constant LP_NOT_CONTRACT = '78';
  string public constant SDT_STABLE_DEBT_OVERFLOW = '79';
  string public constant SDT_BURN_EXCEEDS_BALANCE = '80';

  enum CollateralManagerErrors {
    NO_ERROR,
    NO_COLLATERAL_AVAILABLE,
    COLLATERAL_CANNOT_BE_LIQUIDATED,
    CURRRENCY_NOT_BORROWED,
    HEALTH_FACTOR_ABOVE_THRESHOLD,
    NOT_ENOUGH_LIQUIDITY,
    NO_ACTIVE_RESERVE,
    HEALTH_FACTOR_LOWER_THAN_LIQUIDATION_THRESHOLD,
    INVALID_EQUAL_ASSETS_TO_SWAP,
    FROZEN_RESERVE
  }
}
          

/contracts/protocol/libraries/math/PercentageMath.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

import {Errors} from '../helpers/Errors.sol';

/**
 * @title PercentageMath library
 * @author Aave
 * @notice Provides functions to perform percentage calculations
 * @dev Percentages are defined by default with 2 decimals of precision (100.00). The precision is indicated by PERCENTAGE_FACTOR
 * @dev Operations are rounded half up
 **/

library PercentageMath {
  uint256 constant PERCENTAGE_FACTOR = 1e4; //percentage plus two decimals
  uint256 constant HALF_PERCENT = PERCENTAGE_FACTOR / 2;

  /**
   * @dev Executes a percentage multiplication
   * @param value The value of which the percentage needs to be calculated
   * @param percentage The percentage of the value to be calculated
   * @return The percentage of value
   **/
  function percentMul(uint256 value, uint256 percentage) internal pure returns (uint256) {
    if (value == 0 || percentage == 0) {
      return 0;
    }

    require(
      value <= (type(uint256).max - HALF_PERCENT) / percentage,
      Errors.MATH_MULTIPLICATION_OVERFLOW
    );

    return (value * percentage + HALF_PERCENT) / PERCENTAGE_FACTOR;
  }

  /**
   * @dev Executes a percentage division
   * @param value The value of which the percentage needs to be calculated
   * @param percentage The percentage of the value to be calculated
   * @return The value divided the percentage
   **/
  function percentDiv(uint256 value, uint256 percentage) internal pure returns (uint256) {
    require(percentage != 0, Errors.MATH_DIVISION_BY_ZERO);
    uint256 halfPercentage = percentage / 2;

    require(
      value <= (type(uint256).max - halfPercentage) / PERCENTAGE_FACTOR,
      Errors.MATH_MULTIPLICATION_OVERFLOW
    );

    return (value * PERCENTAGE_FACTOR + halfPercentage) / percentage;
  }
}
          

/contracts/protocol/libraries/types/DataTypes.sol

// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.6.12;

library DataTypes {
  // refer to the whitepaper, section 1.1 basic concepts for a formal description of these properties.
  struct ReserveData {
    //stores the reserve configuration
    ReserveConfigurationMap configuration;
    //the liquidity index. Expressed in ray
    uint128 liquidityIndex;
    //variable borrow index. Expressed in ray
    uint128 variableBorrowIndex;
    //the current supply rate. Expressed in ray
    uint128 currentLiquidityRate;
    //the current variable borrow rate. Expressed in ray
    uint128 currentVariableBorrowRate;
    //the current stable borrow rate. Expressed in ray
    uint128 currentStableBorrowRate;
    uint40 lastUpdateTimestamp;
    //tokens addresses
    address aTokenAddress;
    address stableDebtTokenAddress;
    address variableDebtTokenAddress;
    //address of the interest rate strategy
    address interestRateStrategyAddress;
    //the id of the reserve. Represents the position in the list of the active reserves
    uint8 id;
  }

  struct ReserveConfigurationMap {
    //bit 0-15: LTV
    //bit 16-31: Liq. threshold
    //bit 32-47: Liq. bonus
    //bit 48-55: Decimals
    //bit 56: Reserve is active
    //bit 57: reserve is frozen
    //bit 58: borrowing is enabled
    //bit 59: stable rate borrowing enabled
    //bit 60-63: reserved
    //bit 64-79: reserve factor
    uint256 data;
  }

  struct UserConfigurationMap {
    uint256 data;
  }

  enum InterestRateMode {NONE, STABLE, VARIABLE}
}
          

Contract ABI

[{"type":"event","name":"ATokenUpgraded","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"address","name":"proxy","internalType":"address","indexed":true},{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BorrowingDisabledOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"BorrowingEnabledOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"bool","name":"stableRateEnabled","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"CollateralConfigurationChanged","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"uint256","name":"ltv","internalType":"uint256","indexed":false},{"type":"uint256","name":"liquidationThreshold","internalType":"uint256","indexed":false},{"type":"uint256","name":"liquidationBonus","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveActivated","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveDeactivated","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveDecimalsChanged","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"uint256","name":"decimals","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveFactorChanged","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"uint256","name":"factor","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveFrozen","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ReserveInitialized","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"address","name":"aToken","internalType":"address","indexed":true},{"type":"address","name":"stableDebtToken","internalType":"address","indexed":false},{"type":"address","name":"variableDebtToken","internalType":"address","indexed":false},{"type":"address","name":"interestRateStrategyAddress","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveInterestRateStrategyChanged","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"address","name":"strategy","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"ReserveUnfrozen","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"StableDebtTokenUpgraded","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"address","name":"proxy","internalType":"address","indexed":true},{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"StableRateDisabledOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"StableRateEnabledOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"VariableDebtTokenUpgraded","inputs":[{"type":"address","name":"asset","internalType":"address","indexed":true},{"type":"address","name":"proxy","internalType":"address","indexed":true},{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"activateReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchInitReserve","inputs":[{"type":"tuple[]","name":"input","internalType":"struct ILendingPoolConfigurator.InitReserveInput[]","components":[{"type":"address","name":"aTokenImpl","internalType":"address"},{"type":"address","name":"stableDebtTokenImpl","internalType":"address"},{"type":"address","name":"variableDebtTokenImpl","internalType":"address"},{"type":"uint8","name":"underlyingAssetDecimals","internalType":"uint8"},{"type":"address","name":"interestRateStrategyAddress","internalType":"address"},{"type":"address","name":"underlyingAsset","internalType":"address"},{"type":"address","name":"treasury","internalType":"address"},{"type":"address","name":"incentivesController","internalType":"address"},{"type":"string","name":"underlyingAssetName","internalType":"string"},{"type":"string","name":"aTokenName","internalType":"string"},{"type":"string","name":"aTokenSymbol","internalType":"string"},{"type":"string","name":"variableDebtTokenName","internalType":"string"},{"type":"string","name":"variableDebtTokenSymbol","internalType":"string"},{"type":"string","name":"stableDebtTokenName","internalType":"string"},{"type":"string","name":"stableDebtTokenSymbol","internalType":"string"},{"type":"bytes","name":"params","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureReserveAsCollateral","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"ltv","internalType":"uint256"},{"type":"uint256","name":"liquidationThreshold","internalType":"uint256"},{"type":"uint256","name":"liquidationBonus","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deactivateReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableBorrowingOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"disableReserveStableRate","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableBorrowingOnReserve","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"bool","name":"stableBorrowRateEnabled","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"enableReserveStableRate","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"freezeReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"provider","internalType":"contract ILendingPoolAddressesProvider"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPoolPause","inputs":[{"type":"bool","name":"val","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReserveFactor","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"uint256","name":"reserveFactor","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReserveInterestRateStrategyAddress","inputs":[{"type":"address","name":"asset","internalType":"address"},{"type":"address","name":"rateStrategyAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unfreezeReserve","inputs":[{"type":"address","name":"asset","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateAToken","inputs":[{"type":"tuple","name":"input","internalType":"struct ILendingPoolConfigurator.UpdateATokenInput","components":[{"type":"address","name":"asset","internalType":"address"},{"type":"address","name":"treasury","internalType":"address"},{"type":"address","name":"incentivesController","internalType":"address"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"address","name":"implementation","internalType":"address"},{"type":"bytes","name":"params","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateStableDebtToken","inputs":[{"type":"tuple","name":"input","internalType":"struct ILendingPoolConfigurator.UpdateDebtTokenInput","components":[{"type":"address","name":"asset","internalType":"address"},{"type":"address","name":"incentivesController","internalType":"address"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"address","name":"implementation","internalType":"address"},{"type":"bytes","name":"params","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateVariableDebtToken","inputs":[{"type":"tuple","name":"input","internalType":"struct ILendingPoolConfigurator.UpdateDebtTokenInput","components":[{"type":"address","name":"asset","internalType":"address"},{"type":"address","name":"incentivesController","internalType":"address"},{"type":"string","name":"name","internalType":"string"},{"type":"string","name":"symbol","internalType":"string"},{"type":"address","name":"implementation","internalType":"address"},{"type":"bytes","name":"params","internalType":"bytes"}]}]}]
              

Contract Creation Code

Verify & Publish
0x60806040526000805534801561001457600080fd5b50613e13806100246000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c8063ad4e6432116100a2578063c4d66de811610071578063c4d66de8146101f6578063cef84c5114610209578063eede87c11461021c578063ef1f93731461022f578063f53a2515146102425761010b565b8063ad4e6432146101aa578063b75d6f34146101bd578063bb01c37c146101d0578063bf344183146101e35761010b565b80637641f3d9116100de5780637641f3d91461015e5780637aca76eb146101715780637c4e560b14610184578063a8dc0f45146101975761010b565b80631d2118f9146101105780633e72a454146101255780634b4e6753146101385780637626cde31461014b575b600080fd5b61012361011e366004612f40565b610255565b005b610123610133366004612f01565b6103c7565b610123610146366004612fa9565b6105c2565b6101236101593660046131eb565b6107c1565b61012361016c36600461307d565b610ae5565b61012361017f366004612f01565b610c0a565b610123610192366004612fd4565b610dfc565b6101236101a5366004612f01565b611125565b6101236101b83660046131eb565b611317565b6101236101cb366004612f01565b6115c4565b6101236101de3660046131b3565b6117b6565b6101236101f1366004612f01565b611a75565b610123610204366004612f01565b611c67565b61012361021736600461300e565b611d99565b61012361022a366004612f78565b611ea5565b61012361023d366004612f01565b6120a2565b610123610250366004612f01565b612294565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561029957600080fd5b505afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061031d5760405162461bcd60e51b8152600401610314919061351a565b60405180910390fd5b50603554604051631d2118f960e01b81526001600160a01b0390911690631d2118f99061035090859085906004016132e0565b600060405180830381600087803b15801561036a57600080fd5b505af115801561037e573d6000803e3d6000fd5b50505050816001600160a01b03167f5644b64ebb0ce18c4032248ca52f58355469092ff072866c3dcd8640e817d6a5826040516103bb91906132cc565b60405180910390a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561040b57600080fd5b505afa15801561041f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104439190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906104865760405162461bcd60e51b8152600401610314919061351a565b5061049081612486565b610498612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f7906104c89085906004016132cc565b60206040518083038186803b1580156104e057600080fd5b505afa1580156104f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610518919061309d565b90506105258160006125e7565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916105589186919060040161337b565b600060405180830381600087803b15801561057257600080fd5b505af1158015610586573d6000803e3d6000fd5b50506040516001600160a01b03851692507f6f60cf8bd0f218cabe1ea3150bd07b0b758c35c4cfdf7138017a283e65564d5e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561060657600080fd5b505afa15801561061a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063e9190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906106815760405162461bcd60e51b8152600401610314919061351a565b5061068a612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f7906106ba9086906004016132cc565b60206040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a919061309d565b90506107168183612615565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916107499187919060040161337b565b600060405180830381600087803b15801561076357600080fd5b505af1158015610777573d6000803e3d6000fd5b50505050826001600160a01b03167f2694ccb0b585b6a54b8d8b4a47aa874b05c257b43d34e98aee50838be00d3405836040516107b4919061357b565b60405180910390a2505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561080557600080fd5b505afa158015610819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083d9190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906108805760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b0316610895612e22565b6001600160a01b0382166335ea6a756108b16020860186612f01565b6040518263ffffffff1660e01b81526004016108cd91906132cc565b6101806040518083038186803b1580156108e657600080fd5b505afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e91906130b8565b905060006109b26001600160a01b03841663c44b11f76109416020880188612f01565b6040518263ffffffff1660e01b815260040161095d91906132cc565b60206040518083038186803b15801561097557600080fd5b505afa158015610989573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ad919061309d565b61266c565b50935060609250636111764560e11b91508590506109d36020880188612f01565b6109e36040890160208a01612f01565b856109f160408b018b6135e6565b6109fe60608d018d6135e6565b610a0b60a08f018f61359a565b604051602401610a249a99989796959493929190613467565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610100840151909150610a7990610a7360a0880160808901612f01565b83612697565b610a8960a0860160808701612f01565b6101008401516001600160a01b039182169116610aa96020880188612f01565b6001600160a01b03167f7a943a5b6c214bf7726c069a878b1e2a8e7371981d516048b84e03743e67bc2860405160405180910390a45050505050565b60345460408051636ee554f560e11b8152905133926001600160a01b03169163ddcaa9ea916004808301926020929190829003018186803b158015610b2957600080fd5b505afa158015610b3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b619190612f24565b6001600160a01b031614604051806040016040528060028152602001611b9b60f11b81525090610ba45760405162461bcd60e51b8152600401610314919061351a565b5060355460405163bedb86fb60e01b81526001600160a01b039091169063bedb86fb90610bd5908490600401613394565b600060405180830381600087803b158015610bef57600080fd5b505af1158015610c03573d6000803e3d6000fd5b5050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610c4e57600080fd5b505afa158015610c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c869190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610cc95760405162461bcd60e51b8152600401610314919061351a565b50610cd2612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790610d029085906004016132cc565b60206040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d52919061309d565b9050610d5f8160016126ff565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691610d929186919060040161337b565b600060405180830381600087803b158015610dac57600080fd5b505af1158015610dc0573d6000803e3d6000fd5b50506040516001600160a01b03851692507f85dc710add8a0914461a7dc5a63f6fc529a7700f8c6089a3faf5e93256ccf12a9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610e4057600080fd5b505afa158015610e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e789190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610ebb5760405162461bcd60e51b8152600401610314919061351a565b50610ec4612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790610ef49088906004016132cc565b60206040518083038186803b158015610f0c57600080fd5b505afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f44919061309d565b90508284111560405180604001604052806002815260200161373560f01b81525090610f835760405162461bcd60e51b8152600401610314919061351a565b50821561101457604080518082019091526002815261373560f01b60208201526127108311610fc55760405162461bcd60e51b8152600401610314919061351a565b50612710610fd3848461272d565b111560405180604001604052806002815260200161373560f01b8152509061100e5760405162461bcd60e51b8152600401610314919061351a565b50611056565b604080518082019091526002815261373560f01b6020820152821561104c5760405162461bcd60e51b8152600401610314919061351a565b5061105685612486565b61106081856127a4565b61106a81846127ed565b611074818361283e565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916110a79189919060040161337b565b600060405180830381600087803b1580156110c157600080fd5b505af11580156110d5573d6000803e3d6000fd5b50505050846001600160a01b03167f637febbda9275aea2e85c0ff690444c8d87eb2e8339bbede9715abcc89cb099585858560405161111693929190613584565b60405180910390a25050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561116957600080fd5b505afa15801561117d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a19190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906111e45760405162461bcd60e51b8152600401610314919061351a565b506111ed612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f79061121d9085906004016132cc565b60206040518083038186803b15801561123557600080fd5b505afa158015611249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126d919061309d565b905061127a816000612891565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916112ad9186919060040161337b565b600060405180830381600087803b1580156112c757600080fd5b505af11580156112db573d6000803e3d6000fd5b50506040516001600160a01b03851692507fe9a7e5fd4fc8ea18e602350324bf48e8f05d12434af0ce0be05743e6a5fdcb9e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561135b57600080fd5b505afa15801561136f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113939190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906113d65760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b03166113eb612e22565b6001600160a01b0382166335ea6a756114076020860186612f01565b6040518263ffffffff1660e01b815260040161142391906132cc565b6101806040518083038186803b15801561143c57600080fd5b505afa158015611450573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147491906130b8565b905060006114976001600160a01b03841663c44b11f76109416020880188612f01565b50935060609250636111764560e11b91508590506114b86020880188612f01565b6114c86040890160208a01612f01565b856114d660408b018b6135e6565b6114e360608d018d6135e6565b6114f060a08f018f61359a565b6040516024016115099a99989796959493929190613467565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261012084015190915061155890610a7360a0880160808901612f01565b61156860a0860160808701612f01565b6101208401516001600160a01b0391821691166115886020880188612f01565b6001600160a01b03167f9439658a562a5c46b1173589df89cf001483d685bad28aedaff4a88656292d8160405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561160857600080fd5b505afa15801561161c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116409190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906116835760405162461bcd60e51b8152600401610314919061351a565b5061168c612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f7906116bc9085906004016132cc565b60206040518083038186803b1580156116d457600080fd5b505afa1580156116e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170c919061309d565b90506117198160016125e7565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161174c9186919060040161337b565b600060405180830381600087803b15801561176657600080fd5b505af115801561177a573d6000803e3d6000fd5b50506040516001600160a01b03851692507f35b80cd8ea3440e9a8454f116fa658b858da1b64c86c48451f4559cefcdfb56c9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156117fa57600080fd5b505afa15801561180e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118329190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906118755760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b031661188a612e22565b6001600160a01b0382166335ea6a756118a66020860186612f01565b6040518263ffffffff1660e01b81526004016118c291906132cc565b6101806040518083038186803b1580156118db57600080fd5b505afa1580156118ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191391906130b8565b905060006119366001600160a01b03841663c44b11f76109416020880188612f01565b5093506060925063183fb41360e01b915085905061195a6040880160208901612f01565b6119676020890189612f01565b61197760608a0160408b01612f01565b8661198560608c018c6135e6565b61199260808e018e6135e6565b8e8060c001906119a2919061359a565b6040516024016119bc9b9a9998979695949392919061339f565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260e0840151909150611a0a90610a7360c0880160a08901612f01565b611a1a60c0860160a08701612f01565b60e08401516001600160a01b039182169116611a396020880188612f01565b6001600160a01b03167fa76f65411ec66a7fb6bc467432eb14767900449ae4469fa295e4441fe5e1cb7360405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611ab957600080fd5b505afa158015611acd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af19190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611b345760405162461bcd60e51b8152600401610314919061351a565b50611b3d612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790611b6d9085906004016132cc565b60206040518083038186803b158015611b8557600080fd5b505afa158015611b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbd919061309d565b9050611bca8160016128bf565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691611bfd9186919060040161337b565b600060405180830381600087803b158015611c1757600080fd5b505af1158015611c2b573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8dee2b2f3e98319ae6347eda521788f73f4086c9be9a594942b370b137fb8cb19150600090a25050565b6000611c716128ed565b60015490915060ff1680611c885750611c886128f2565b80611c94575060005481115b611cb05760405162461bcd60e51b81526004016103149061352d565b60015460ff16158015611ccf576001805460ff19168117905560008290555b603480546001600160a01b0319166001600160a01b03858116919091179182905560408051630261bf8b60e01b815290519290911691630261bf8b91600480820192602092909190829003018186803b158015611d2b57600080fd5b505afa158015611d3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d639190612f24565b603580546001600160a01b0319166001600160a01b03929092169190911790558015611d94576001805460ff191690555b505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611ddd57600080fd5b505afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e159190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611e585760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b031660005b82811015611e9f57611e9782858584818110611e8057fe5b9050602002810190611e9291906135fc565b6128f8565b600101611e68565b50505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611ee957600080fd5b505afa158015611efd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f219190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611f645760405162461bcd60e51b8152600401610314919061351a565b50611f6d612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790611f9d9086906004016132cc565b60206040518083038186803b158015611fb557600080fd5b505afa158015611fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fed919061309d565b9050611ffa816001612891565b61200481836128bf565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916120379187919060040161337b565b600060405180830381600087803b15801561205157600080fd5b505af1158015612065573d6000803e3d6000fd5b50505050826001600160a01b03167fab2f7f9e5ca2772fafa94f355c1842a80ae6b9e41f83083098d81f67d7a0b508836040516107b49190613394565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156120e657600080fd5b505afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906121615760405162461bcd60e51b8152600401610314919061351a565b5061216a612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f79061219a9085906004016132cc565b60206040518083038186803b1580156121b257600080fd5b505afa1580156121c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ea919061309d565b90506121f78160006126ff565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161222a9186919060040161337b565b600060405180830381600087803b15801561224457600080fd5b505af1158015612258573d6000803e3d6000fd5b50506040516001600160a01b03851692507f838ecdc4709a31a26db48b0c853212cedde3f725f07030079d793fb0719647609150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156122d857600080fd5b505afa1580156122ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123109190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906123535760405162461bcd60e51b8152600401610314919061351a565b5061235c612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f79061238c9085906004016132cc565b60206040518083038186803b1580156123a457600080fd5b505afa1580156123b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123dc919061309d565b90506123e98160006128bf565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161241c9186919060040161337b565b600060405180830381600087803b15801561243657600080fd5b505af115801561244a573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8bbf35441ac2c607ddecadd3d8ee58636d32f217fad201fb2655581502dd84e39150600090a25050565b61248e612e22565b6035546040516335ea6a7560e01b81526001600160a01b03909116906335ea6a75906124be9085906004016132cc565b6101806040518083038186803b1580156124d757600080fd5b505afa1580156124eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250f91906130b8565b90506000826001600160a01b03166370a082318360e001516040518263ffffffff1660e01b815260040161254391906132cc565b60206040518083038186803b15801561255b57600080fd5b505afa15801561256f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125939190613223565b9050801580156125ae575060608201516001600160801b0316155b604051806040016040528060028152602001610ccd60f21b81525090611e9f5760405162461bcd60e51b8152600401610314919061351a565b6038816125f55760006125f8565b60015b8351670100000000000000191660ff9190911690911b1790915250565b604080518082019091526002815261373160f01b602082015261ffff8211156126515760405162461bcd60e51b8152600401610314919061351a565b50815169ffff0000000000000000191660409190911b179052565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b60405163278f794360e11b815283906001600160a01b03821690634f1ef286906126c7908690869060040161334f565b600060405180830381600087803b1580156126e157600080fd5b505af11580156126f5573d6000803e3d6000fd5b5050505050505050565b60398161270d576000612710565b60015b8351670200000000000000191660ff9190911690911b1790915250565b600082158061273a575081155b156127475750600061279e565b81611388198161275357fe5b0483111560405180604001604052806002815260200161068760f31b815250906127905760405162461bcd60e51b8152600401610314919061351a565b505061271061138882840201045b92915050565b604080518082019091526002815261363760f01b602082015261ffff8211156127e05760405162461bcd60e51b8152600401610314919061351a565b50815161ffff1916179052565b60408051808201909152600281526106c760f31b602082015261ffff8211156128295760405162461bcd60e51b8152600401610314919061351a565b50815163ffff0000191660109190911b179052565b604080518082019091526002815261363960f01b602082015261ffff82111561287a5760405162461bcd60e51b8152600401610314919061351a565b50815165ffff00000000191660209190911b179052565b603a8161289f5760006128a2565b60015b8351670400000000000000191660ff9190911690911b1790915250565b603b816128cd5760006128d0565b60015b8351670800000000000000191660ff9190911690911b1790915250565b600190565b303b1590565b60006129cf61290a6020840184612f01565b63183fb41360e01b8561292360e0870160c08801612f01565b61293360c0880160a08901612f01565b612944610100890160e08a01612f01565b61295460808a0160608b0161323b565b6129626101208b018b6135e6565b6129706101408d018d6135e6565b61297e6101e08f018f61359a565b6040516024016129989b9a99989796959493929190613420565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d1a565b90506000612a636129e66040850160208601612f01565b636111764560e11b866129ff60c0880160a08901612f01565b612a10610100890160e08a01612f01565b612a2060808a0160608b0161323b565b612a2e6101a08b018b6135e6565b612a3c6101c08d018d6135e6565b612a4a6101e08f018f61359a565b6040516024016129989a999897969594939291906134dc565b90506000612ae1612a7a6060860160408701612f01565b636111764560e11b87612a9360c0890160a08a01612f01565b612aa46101008a0160e08b01612f01565b612ab460808b0160608c0161323b565b612ac26101608c018c6135e6565b612ad06101808e018e6135e6565b8e806101e00190612a4a919061359a565b90506001600160a01b038516637a708e92612b0260c0870160a08801612f01565b858585612b1560a08b0160808c01612f01565b6040518663ffffffff1660e01b8152600401612b3595949392919061331d565b600060405180830381600087803b158015612b4f57600080fd5b505af1158015612b63573d6000803e3d6000fd5b50505050612b6f612e0f565b6001600160a01b03861663c44b11f7612b8e60c0880160a08901612f01565b6040518263ffffffff1660e01b8152600401612baa91906132cc565b60206040518083038186803b158015612bc257600080fd5b505afa158015612bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfa919061309d565b9050612c19612c0f608087016060880161323b565b829060ff16612dbc565b612c248160016125e7565b612c2f8160006126ff565b6001600160a01b03861663b8d29276612c4e60c0880160a08901612f01565b83516040516001600160e01b031960e085901b168152612c7292919060040161337b565b600060405180830381600087803b158015612c8c57600080fd5b505af1158015612ca0573d6000803e3d6000fd5b5050506001600160a01b0385169050612cbf60c0870160a08801612f01565b6001600160a01b03167f3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f8585612cfb60a08b0160808c01612f01565b604051612d0a939291906132fa565b60405180910390a3505050505050565b60008030604051612d2a90612e8d565b612d3491906132cc565b604051809103906000f080158015612d50573d6000803e3d6000fd5b5060405163347d5e2560e21b81529091506001600160a01b0382169063d1f5789490612d82908790879060040161334f565b600060405180830381600087803b158015612d9c57600080fd5b505af1158015612db0573d6000803e3d6000fd5b50929695505050505050565b604080518082019091526002815261037360f41b602082015260ff821115612df75760405162461bcd60e51b8152600401610314919061351a565b50815166ff000000000000191660309190911b179052565b6040518060200160405280600081525090565b604051806101800160405280612e36612e0f565b815260006020820181905260408201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101609091015290565b6107738061366b83390190565b805161279e81613643565b600060208284031215612eb6578081fd5b612ec0602061361c565b9151825250919050565b80516001600160801b038116811461279e57600080fd5b805164ffffffffff8116811461279e57600080fd5b805161279e8161365b565b600060208284031215612f12578081fd5b8135612f1d81613643565b9392505050565b600060208284031215612f35578081fd5b8151612f1d81613643565b60008060408385031215612f52578081fd5b8235612f5d81613643565b91506020830135612f6d81613643565b809150509250929050565b60008060408385031215612f8a578182fd5b8235612f9581613643565b915060208301358015158114612f6d578182fd5b60008060408385031215612fbb578182fd5b8235612fc681613643565b946020939093013593505050565b60008060008060808587031215612fe9578182fd5b8435612ff481613643565b966020860135965060408601359560600135945092505050565b60008060208385031215613020578182fd5b823567ffffffffffffffff80821115613037578384fd5b818501915085601f83011261304a578384fd5b813581811115613058578485fd5b866020808302850101111561306b578485fd5b60209290920196919550909350505050565b60006020828403121561308e578081fd5b81358015158114612f1d578182fd5b6000602082840312156130ae578081fd5b612f1d8383612ea5565b60006101808083850312156130cb578182fd5b6130d48161361c565b90506130e08484612ea5565b81526130ef8460208501612eca565b60208201526131018460408501612eca565b60408201526131138460608501612eca565b60608201526131258460808501612eca565b60808201526131378460a08501612eca565b60a08201526131498460c08501612ee1565b60c082015261315b8460e08501612e9a565b60e082015261010061316f85828601612e9a565b9082015261012061318285858301612e9a565b9082015261014061319585858301612e9a565b908201526101606131a885858301612ef6565b908201529392505050565b6000602082840312156131c4578081fd5b813567ffffffffffffffff8111156131da578182fd5b820160e08185031215612f1d578182fd5b6000602082840312156131fc578081fd5b813567ffffffffffffffff811115613212578182fd5b820160c08185031215612f1d578182fd5b600060208284031215613234578081fd5b5051919050565b60006020828403121561324c578081fd5b8135612f1d8161365b565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b818110156132a65760208185018101518683018201520161328a565b818111156132b75782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b6001600160a01b038316815260406020820181905260009061337390830184613281565b949350505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6001600160a01b038c811682528b811660208301528a81166040830152891660608201526080810188905261010060a082018190526000906133e4838201898b613257565b905082810360c08401526133f9818789613257565b905082810360e084015261340e818587613257565b9e9d5050505050505050505050505050565b6001600160a01b038c811682528b811660208301528a811660408301528916606082015260ff8816608082015261010060a082018190526000906133e4838201898b613257565b6001600160a01b038b811682528a81166020830152891660408201526060810188905260e0608082018190526000906134a3908301888a613257565b82810360a08401526134b6818789613257565b905082810360c08401526134cb818587613257565b9d9c50505050505050505050505050565b6001600160a01b038b811682528a811660208301528916604082015260ff8816606082015260e0608082018190526000906134a3908301888a613257565b600060208252612f1d6020830184613281565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b90815260200190565b9283526020830191909152604082015260600190565b6000808335601e198436030181126135b0578283fd5b83018035915067ffffffffffffffff8211156135ca578283fd5b6020019150368190038213156135df57600080fd5b9250929050565b6000808335601e198436030181126135b0578182fd5b600082356101fe19833603018112613612578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561363b57600080fd5b604052919050565b6001600160a01b038116811461365857600080fd5b50565b60ff8116811461365857600080fdfe60a060405234801561001057600080fd5b506040516107733803806107738339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b03166106f36100806000398061022852806102725280610331528061045e528061048752806105af52506106f36000f3fe60806040526004361061004a5760003560e01c80633659cfe6146100545780634f1ef286146100875780635c60da1b14610107578063d1f5789414610138578063f851a440146101ee575b610052610203565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661021d565b6100526004803603604081101561009d57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b509092509050610267565b34801561011357600080fd5b5061011c610324565b604080516001600160a01b039092168252519081900360200190f35b6100526004803603604081101561014e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610371945050505050565b3480156101fa57600080fd5b5061011c610451565b61020b6104ab565b61021b6102166104b3565b6104d8565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561025c57610257816104fc565b610264565b610264610203565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610317576102a1836104fc565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b505090508061031157600080fd5b5061031f565b61031f610203565b505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103665761035f6104b3565b905061036e565b61036e610203565b90565b600061037b6104b3565b6001600160a01b03161461038e57600080fd5b6103978261053c565b80511561044d576000826001600160a01b0316826040518082805190602001908083835b602083106103da5780518252601f1990920191602091820191016103bb565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461043a576040519150601f19603f3d011682016040523d82523d6000602084013e61043f565b606091505b505090508061031f57600080fd5b5050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561036657507f000000000000000000000000000000000000000000000000000000000000000061036e565b61021b6105a4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156104f7573d6000f35b3d6000fd5b6105058161053c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61054581610614565b6105805760405162461bcd60e51b815260040180806020018281038252603b815260200180610683603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561060c5760405162461bcd60e51b81526004018080602001828103825260328152602001806106516032913960400191505060405180910390fd5b61021b61021b565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061064857508115155b94935050505056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122045486fa11a09f93745421e82d8f98aaf61194cad8bf6d90ce8eec654901255f064736f6c634300060c0033a26469706673582212205bf7c86dadc3a1053177324412eef130a0fa579d083588c5eb80e1c9ef2fd5b864736f6c634300060c0033

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061010b5760003560e01c8063ad4e6432116100a2578063c4d66de811610071578063c4d66de8146101f6578063cef84c5114610209578063eede87c11461021c578063ef1f93731461022f578063f53a2515146102425761010b565b8063ad4e6432146101aa578063b75d6f34146101bd578063bb01c37c146101d0578063bf344183146101e35761010b565b80637641f3d9116100de5780637641f3d91461015e5780637aca76eb146101715780637c4e560b14610184578063a8dc0f45146101975761010b565b80631d2118f9146101105780633e72a454146101255780634b4e6753146101385780637626cde31461014b575b600080fd5b61012361011e366004612f40565b610255565b005b610123610133366004612f01565b6103c7565b610123610146366004612fa9565b6105c2565b6101236101593660046131eb565b6107c1565b61012361016c36600461307d565b610ae5565b61012361017f366004612f01565b610c0a565b610123610192366004612fd4565b610dfc565b6101236101a5366004612f01565b611125565b6101236101b83660046131eb565b611317565b6101236101cb366004612f01565b6115c4565b6101236101de3660046131b3565b6117b6565b6101236101f1366004612f01565b611a75565b610123610204366004612f01565b611c67565b61012361021736600461300e565b611d99565b61012361022a366004612f78565b611ea5565b61012361023d366004612f01565b6120a2565b610123610250366004612f01565b612294565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561029957600080fd5b505afa1580156102ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102d19190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b8152509061031d5760405162461bcd60e51b8152600401610314919061351a565b60405180910390fd5b50603554604051631d2118f960e01b81526001600160a01b0390911690631d2118f99061035090859085906004016132e0565b600060405180830381600087803b15801561036a57600080fd5b505af115801561037e573d6000803e3d6000fd5b50505050816001600160a01b03167f5644b64ebb0ce18c4032248ca52f58355469092ff072866c3dcd8640e817d6a5826040516103bb91906132cc565b60405180910390a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561040b57600080fd5b505afa15801561041f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104439190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906104865760405162461bcd60e51b8152600401610314919061351a565b5061049081612486565b610498612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f7906104c89085906004016132cc565b60206040518083038186803b1580156104e057600080fd5b505afa1580156104f4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610518919061309d565b90506105258160006125e7565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916105589186919060040161337b565b600060405180830381600087803b15801561057257600080fd5b505af1158015610586573d6000803e3d6000fd5b50506040516001600160a01b03851692507f6f60cf8bd0f218cabe1ea3150bd07b0b758c35c4cfdf7138017a283e65564d5e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561060657600080fd5b505afa15801561061a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063e9190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906106815760405162461bcd60e51b8152600401610314919061351a565b5061068a612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f7906106ba9086906004016132cc565b60206040518083038186803b1580156106d257600080fd5b505afa1580156106e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061070a919061309d565b90506107168183612615565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916107499187919060040161337b565b600060405180830381600087803b15801561076357600080fd5b505af1158015610777573d6000803e3d6000fd5b50505050826001600160a01b03167f2694ccb0b585b6a54b8d8b4a47aa874b05c257b43d34e98aee50838be00d3405836040516107b4919061357b565b60405180910390a2505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561080557600080fd5b505afa158015610819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083d9190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906108805760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b0316610895612e22565b6001600160a01b0382166335ea6a756108b16020860186612f01565b6040518263ffffffff1660e01b81526004016108cd91906132cc565b6101806040518083038186803b1580156108e657600080fd5b505afa1580156108fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091e91906130b8565b905060006109b26001600160a01b03841663c44b11f76109416020880188612f01565b6040518263ffffffff1660e01b815260040161095d91906132cc565b60206040518083038186803b15801561097557600080fd5b505afa158015610989573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ad919061309d565b61266c565b50935060609250636111764560e11b91508590506109d36020880188612f01565b6109e36040890160208a01612f01565b856109f160408b018b6135e6565b6109fe60608d018d6135e6565b610a0b60a08f018f61359a565b604051602401610a249a99989796959493929190613467565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152610100840151909150610a7990610a7360a0880160808901612f01565b83612697565b610a8960a0860160808701612f01565b6101008401516001600160a01b039182169116610aa96020880188612f01565b6001600160a01b03167f7a943a5b6c214bf7726c069a878b1e2a8e7371981d516048b84e03743e67bc2860405160405180910390a45050505050565b60345460408051636ee554f560e11b8152905133926001600160a01b03169163ddcaa9ea916004808301926020929190829003018186803b158015610b2957600080fd5b505afa158015610b3d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b619190612f24565b6001600160a01b031614604051806040016040528060028152602001611b9b60f11b81525090610ba45760405162461bcd60e51b8152600401610314919061351a565b5060355460405163bedb86fb60e01b81526001600160a01b039091169063bedb86fb90610bd5908490600401613394565b600060405180830381600087803b158015610bef57600080fd5b505af1158015610c03573d6000803e3d6000fd5b5050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610c4e57600080fd5b505afa158015610c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c869190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610cc95760405162461bcd60e51b8152600401610314919061351a565b50610cd2612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790610d029085906004016132cc565b60206040518083038186803b158015610d1a57600080fd5b505afa158015610d2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d52919061309d565b9050610d5f8160016126ff565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691610d929186919060040161337b565b600060405180830381600087803b158015610dac57600080fd5b505af1158015610dc0573d6000803e3d6000fd5b50506040516001600160a01b03851692507f85dc710add8a0914461a7dc5a63f6fc529a7700f8c6089a3faf5e93256ccf12a9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015610e4057600080fd5b505afa158015610e54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e789190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090610ebb5760405162461bcd60e51b8152600401610314919061351a565b50610ec4612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790610ef49088906004016132cc565b60206040518083038186803b158015610f0c57600080fd5b505afa158015610f20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f44919061309d565b90508284111560405180604001604052806002815260200161373560f01b81525090610f835760405162461bcd60e51b8152600401610314919061351a565b50821561101457604080518082019091526002815261373560f01b60208201526127108311610fc55760405162461bcd60e51b8152600401610314919061351a565b50612710610fd3848461272d565b111560405180604001604052806002815260200161373560f01b8152509061100e5760405162461bcd60e51b8152600401610314919061351a565b50611056565b604080518082019091526002815261373560f01b6020820152821561104c5760405162461bcd60e51b8152600401610314919061351a565b5061105685612486565b61106081856127a4565b61106a81846127ed565b611074818361283e565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916110a79189919060040161337b565b600060405180830381600087803b1580156110c157600080fd5b505af11580156110d5573d6000803e3d6000fd5b50505050846001600160a01b03167f637febbda9275aea2e85c0ff690444c8d87eb2e8339bbede9715abcc89cb099585858560405161111693929190613584565b60405180910390a25050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561116957600080fd5b505afa15801561117d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a19190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906111e45760405162461bcd60e51b8152600401610314919061351a565b506111ed612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f79061121d9085906004016132cc565b60206040518083038186803b15801561123557600080fd5b505afa158015611249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126d919061309d565b905061127a816000612891565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916112ad9186919060040161337b565b600060405180830381600087803b1580156112c757600080fd5b505af11580156112db573d6000803e3d6000fd5b50506040516001600160a01b03851692507fe9a7e5fd4fc8ea18e602350324bf48e8f05d12434af0ce0be05743e6a5fdcb9e9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561135b57600080fd5b505afa15801561136f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113939190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906113d65760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b03166113eb612e22565b6001600160a01b0382166335ea6a756114076020860186612f01565b6040518263ffffffff1660e01b815260040161142391906132cc565b6101806040518083038186803b15801561143c57600080fd5b505afa158015611450573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147491906130b8565b905060006114976001600160a01b03841663c44b11f76109416020880188612f01565b50935060609250636111764560e11b91508590506114b86020880188612f01565b6114c86040890160208a01612f01565b856114d660408b018b6135e6565b6114e360608d018d6135e6565b6114f060a08f018f61359a565b6040516024016115099a99989796959493929190613467565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261012084015190915061155890610a7360a0880160808901612f01565b61156860a0860160808701612f01565b6101208401516001600160a01b0391821691166115886020880188612f01565b6001600160a01b03167f9439658a562a5c46b1173589df89cf001483d685bad28aedaff4a88656292d8160405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b15801561160857600080fd5b505afa15801561161c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116409190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906116835760405162461bcd60e51b8152600401610314919061351a565b5061168c612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f7906116bc9085906004016132cc565b60206040518083038186803b1580156116d457600080fd5b505afa1580156116e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170c919061309d565b90506117198160016125e7565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161174c9186919060040161337b565b600060405180830381600087803b15801561176657600080fd5b505af115801561177a573d6000803e3d6000fd5b50506040516001600160a01b03851692507f35b80cd8ea3440e9a8454f116fa658b858da1b64c86c48451f4559cefcdfb56c9150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156117fa57600080fd5b505afa15801561180e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118329190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906118755760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b031661188a612e22565b6001600160a01b0382166335ea6a756118a66020860186612f01565b6040518263ffffffff1660e01b81526004016118c291906132cc565b6101806040518083038186803b1580156118db57600080fd5b505afa1580156118ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191391906130b8565b905060006119366001600160a01b03841663c44b11f76109416020880188612f01565b5093506060925063183fb41360e01b915085905061195a6040880160208901612f01565b6119676020890189612f01565b61197760608a0160408b01612f01565b8661198560608c018c6135e6565b61199260808e018e6135e6565b8e8060c001906119a2919061359a565b6040516024016119bc9b9a9998979695949392919061339f565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915260e0840151909150611a0a90610a7360c0880160a08901612f01565b611a1a60c0860160a08701612f01565b60e08401516001600160a01b039182169116611a396020880188612f01565b6001600160a01b03167fa76f65411ec66a7fb6bc467432eb14767900449ae4469fa295e4441fe5e1cb7360405160405180910390a45050505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611ab957600080fd5b505afa158015611acd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af19190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611b345760405162461bcd60e51b8152600401610314919061351a565b50611b3d612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790611b6d9085906004016132cc565b60206040518083038186803b158015611b8557600080fd5b505afa158015611b99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbd919061309d565b9050611bca8160016128bf565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d2927691611bfd9186919060040161337b565b600060405180830381600087803b158015611c1757600080fd5b505af1158015611c2b573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8dee2b2f3e98319ae6347eda521788f73f4086c9be9a594942b370b137fb8cb19150600090a25050565b6000611c716128ed565b60015490915060ff1680611c885750611c886128f2565b80611c94575060005481115b611cb05760405162461bcd60e51b81526004016103149061352d565b60015460ff16158015611ccf576001805460ff19168117905560008290555b603480546001600160a01b0319166001600160a01b03858116919091179182905560408051630261bf8b60e01b815290519290911691630261bf8b91600480820192602092909190829003018186803b158015611d2b57600080fd5b505afa158015611d3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d639190612f24565b603580546001600160a01b0319166001600160a01b03929092169190911790558015611d94576001805460ff191690555b505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611ddd57600080fd5b505afa158015611df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e159190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611e585760405162461bcd60e51b8152600401610314919061351a565b506035546001600160a01b031660005b82811015611e9f57611e9782858584818110611e8057fe5b9050602002810190611e9291906135fc565b6128f8565b600101611e68565b50505050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b158015611ee957600080fd5b505afa158015611efd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f219190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b81525090611f645760405162461bcd60e51b8152600401610314919061351a565b50611f6d612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f790611f9d9086906004016132cc565b60206040518083038186803b158015611fb557600080fd5b505afa158015611fc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fed919061309d565b9050611ffa816001612891565b61200481836128bf565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d29276916120379187919060040161337b565b600060405180830381600087803b15801561205157600080fd5b505af1158015612065573d6000803e3d6000fd5b50505050826001600160a01b03167fab2f7f9e5ca2772fafa94f355c1842a80ae6b9e41f83083098d81f67d7a0b508836040516107b49190613394565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156120e657600080fd5b505afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906121615760405162461bcd60e51b8152600401610314919061351a565b5061216a612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f79061219a9085906004016132cc565b60206040518083038186803b1580156121b257600080fd5b505afa1580156121c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ea919061309d565b90506121f78160006126ff565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161222a9186919060040161337b565b600060405180830381600087803b15801561224457600080fd5b505af1158015612258573d6000803e3d6000fd5b50506040516001600160a01b03851692507f838ecdc4709a31a26db48b0c853212cedde3f725f07030079d793fb0719647609150600090a25050565b603454604080516315d9b46f60e31b8152905133926001600160a01b03169163aecda378916004808301926020929190829003018186803b1580156122d857600080fd5b505afa1580156122ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123109190612f24565b6001600160a01b03161460405180604001604052806002815260200161333360f01b815250906123535760405162461bcd60e51b8152600401610314919061351a565b5061235c612e0f565b60355460405163c44b11f760e01b81526001600160a01b039091169063c44b11f79061238c9085906004016132cc565b60206040518083038186803b1580156123a457600080fd5b505afa1580156123b8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123dc919061309d565b90506123e98160006128bf565b6035548151604051635c69493b60e11b81526001600160a01b039092169163b8d292769161241c9186919060040161337b565b600060405180830381600087803b15801561243657600080fd5b505af115801561244a573d6000803e3d6000fd5b50506040516001600160a01b03851692507f8bbf35441ac2c607ddecadd3d8ee58636d32f217fad201fb2655581502dd84e39150600090a25050565b61248e612e22565b6035546040516335ea6a7560e01b81526001600160a01b03909116906335ea6a75906124be9085906004016132cc565b6101806040518083038186803b1580156124d757600080fd5b505afa1580156124eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061250f91906130b8565b90506000826001600160a01b03166370a082318360e001516040518263ffffffff1660e01b815260040161254391906132cc565b60206040518083038186803b15801561255b57600080fd5b505afa15801561256f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125939190613223565b9050801580156125ae575060608201516001600160801b0316155b604051806040016040528060028152602001610ccd60f21b81525090611e9f5760405162461bcd60e51b8152600401610314919061351a565b6038816125f55760006125f8565b60015b8351670100000000000000191660ff9190911690911b1790915250565b604080518082019091526002815261373160f01b602082015261ffff8211156126515760405162461bcd60e51b8152600401610314919061351a565b50815169ffff0000000000000000191660409190911b179052565b5161ffff80821692601083901c821692602081901c831692603082901c60ff169260409290921c1690565b60405163278f794360e11b815283906001600160a01b03821690634f1ef286906126c7908690869060040161334f565b600060405180830381600087803b1580156126e157600080fd5b505af11580156126f5573d6000803e3d6000fd5b5050505050505050565b60398161270d576000612710565b60015b8351670200000000000000191660ff9190911690911b1790915250565b600082158061273a575081155b156127475750600061279e565b81611388198161275357fe5b0483111560405180604001604052806002815260200161068760f31b815250906127905760405162461bcd60e51b8152600401610314919061351a565b505061271061138882840201045b92915050565b604080518082019091526002815261363760f01b602082015261ffff8211156127e05760405162461bcd60e51b8152600401610314919061351a565b50815161ffff1916179052565b60408051808201909152600281526106c760f31b602082015261ffff8211156128295760405162461bcd60e51b8152600401610314919061351a565b50815163ffff0000191660109190911b179052565b604080518082019091526002815261363960f01b602082015261ffff82111561287a5760405162461bcd60e51b8152600401610314919061351a565b50815165ffff00000000191660209190911b179052565b603a8161289f5760006128a2565b60015b8351670400000000000000191660ff9190911690911b1790915250565b603b816128cd5760006128d0565b60015b8351670800000000000000191660ff9190911690911b1790915250565b600190565b303b1590565b60006129cf61290a6020840184612f01565b63183fb41360e01b8561292360e0870160c08801612f01565b61293360c0880160a08901612f01565b612944610100890160e08a01612f01565b61295460808a0160608b0161323b565b6129626101208b018b6135e6565b6129706101408d018d6135e6565b61297e6101e08f018f61359a565b6040516024016129989b9a99989796959493929190613420565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612d1a565b90506000612a636129e66040850160208601612f01565b636111764560e11b866129ff60c0880160a08901612f01565b612a10610100890160e08a01612f01565b612a2060808a0160608b0161323b565b612a2e6101a08b018b6135e6565b612a3c6101c08d018d6135e6565b612a4a6101e08f018f61359a565b6040516024016129989a999897969594939291906134dc565b90506000612ae1612a7a6060860160408701612f01565b636111764560e11b87612a9360c0890160a08a01612f01565b612aa46101008a0160e08b01612f01565b612ab460808b0160608c0161323b565b612ac26101608c018c6135e6565b612ad06101808e018e6135e6565b8e806101e00190612a4a919061359a565b90506001600160a01b038516637a708e92612b0260c0870160a08801612f01565b858585612b1560a08b0160808c01612f01565b6040518663ffffffff1660e01b8152600401612b3595949392919061331d565b600060405180830381600087803b158015612b4f57600080fd5b505af1158015612b63573d6000803e3d6000fd5b50505050612b6f612e0f565b6001600160a01b03861663c44b11f7612b8e60c0880160a08901612f01565b6040518263ffffffff1660e01b8152600401612baa91906132cc565b60206040518083038186803b158015612bc257600080fd5b505afa158015612bd6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bfa919061309d565b9050612c19612c0f608087016060880161323b565b829060ff16612dbc565b612c248160016125e7565b612c2f8160006126ff565b6001600160a01b03861663b8d29276612c4e60c0880160a08901612f01565b83516040516001600160e01b031960e085901b168152612c7292919060040161337b565b600060405180830381600087803b158015612c8c57600080fd5b505af1158015612ca0573d6000803e3d6000fd5b5050506001600160a01b0385169050612cbf60c0870160a08801612f01565b6001600160a01b03167f3a0ca721fc364424566385a1aa271ed508cc2c0949c2272575fb3013a163a45f8585612cfb60a08b0160808c01612f01565b604051612d0a939291906132fa565b60405180910390a3505050505050565b60008030604051612d2a90612e8d565b612d3491906132cc565b604051809103906000f080158015612d50573d6000803e3d6000fd5b5060405163347d5e2560e21b81529091506001600160a01b0382169063d1f5789490612d82908790879060040161334f565b600060405180830381600087803b158015612d9c57600080fd5b505af1158015612db0573d6000803e3d6000fd5b50929695505050505050565b604080518082019091526002815261037360f41b602082015260ff821115612df75760405162461bcd60e51b8152600401610314919061351a565b50815166ff000000000000191660309190911b179052565b6040518060200160405280600081525090565b604051806101800160405280612e36612e0f565b815260006020820181905260408201819052606082018190526080820181905260a0820181905260c0820181905260e082018190526101008201819052610120820181905261014082018190526101609091015290565b6107738061366b83390190565b805161279e81613643565b600060208284031215612eb6578081fd5b612ec0602061361c565b9151825250919050565b80516001600160801b038116811461279e57600080fd5b805164ffffffffff8116811461279e57600080fd5b805161279e8161365b565b600060208284031215612f12578081fd5b8135612f1d81613643565b9392505050565b600060208284031215612f35578081fd5b8151612f1d81613643565b60008060408385031215612f52578081fd5b8235612f5d81613643565b91506020830135612f6d81613643565b809150509250929050565b60008060408385031215612f8a578182fd5b8235612f9581613643565b915060208301358015158114612f6d578182fd5b60008060408385031215612fbb578182fd5b8235612fc681613643565b946020939093013593505050565b60008060008060808587031215612fe9578182fd5b8435612ff481613643565b966020860135965060408601359560600135945092505050565b60008060208385031215613020578182fd5b823567ffffffffffffffff80821115613037578384fd5b818501915085601f83011261304a578384fd5b813581811115613058578485fd5b866020808302850101111561306b578485fd5b60209290920196919550909350505050565b60006020828403121561308e578081fd5b81358015158114612f1d578182fd5b6000602082840312156130ae578081fd5b612f1d8383612ea5565b60006101808083850312156130cb578182fd5b6130d48161361c565b90506130e08484612ea5565b81526130ef8460208501612eca565b60208201526131018460408501612eca565b60408201526131138460608501612eca565b60608201526131258460808501612eca565b60808201526131378460a08501612eca565b60a08201526131498460c08501612ee1565b60c082015261315b8460e08501612e9a565b60e082015261010061316f85828601612e9a565b9082015261012061318285858301612e9a565b9082015261014061319585858301612e9a565b908201526101606131a885858301612ef6565b908201529392505050565b6000602082840312156131c4578081fd5b813567ffffffffffffffff8111156131da578182fd5b820160e08185031215612f1d578182fd5b6000602082840312156131fc578081fd5b813567ffffffffffffffff811115613212578182fd5b820160c08185031215612f1d578182fd5b600060208284031215613234578081fd5b5051919050565b60006020828403121561324c578081fd5b8135612f1d8161365b565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452815b818110156132a65760208185018101518683018201520161328a565b818111156132b75782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b0393841681529183166020830152909116604082015260600190565b6001600160a01b0395861681529385166020850152918416604084015283166060830152909116608082015260a00190565b6001600160a01b038316815260406020820181905260009061337390830184613281565b949350505050565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6001600160a01b038c811682528b811660208301528a81166040830152891660608201526080810188905261010060a082018190526000906133e4838201898b613257565b905082810360c08401526133f9818789613257565b905082810360e084015261340e818587613257565b9e9d5050505050505050505050505050565b6001600160a01b038c811682528b811660208301528a811660408301528916606082015260ff8816608082015261010060a082018190526000906133e4838201898b613257565b6001600160a01b038b811682528a81166020830152891660408201526060810188905260e0608082018190526000906134a3908301888a613257565b82810360a08401526134b6818789613257565b905082810360c08401526134cb818587613257565b9d9c50505050505050505050505050565b6001600160a01b038b811682528a811660208301528916604082015260ff8816606082015260e0608082018190526000906134a3908301888a613257565b600060208252612f1d6020830184613281565b6020808252602e908201527f436f6e747261637420696e7374616e63652068617320616c726561647920626560408201526d195b881a5b9a5d1a585b1a5e995960921b606082015260800190565b90815260200190565b9283526020830191909152604082015260600190565b6000808335601e198436030181126135b0578283fd5b83018035915067ffffffffffffffff8211156135ca578283fd5b6020019150368190038213156135df57600080fd5b9250929050565b6000808335601e198436030181126135b0578182fd5b600082356101fe19833603018112613612578182fd5b9190910192915050565b60405181810167ffffffffffffffff8111828210171561363b57600080fd5b604052919050565b6001600160a01b038116811461365857600080fd5b50565b60ff8116811461365857600080fdfe60a060405234801561001057600080fd5b506040516107733803806107738339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b03166106f36100806000398061022852806102725280610331528061045e528061048752806105af52506106f36000f3fe60806040526004361061004a5760003560e01c80633659cfe6146100545780634f1ef286146100875780635c60da1b14610107578063d1f5789414610138578063f851a440146101ee575b610052610203565b005b34801561006057600080fd5b506100526004803603602081101561007757600080fd5b50356001600160a01b031661021d565b6100526004803603604081101561009d57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100c857600080fd5b8201836020820111156100da57600080fd5b803590602001918460018302840111640100000000831117156100fc57600080fd5b509092509050610267565b34801561011357600080fd5b5061011c610324565b604080516001600160a01b039092168252519081900360200190f35b6100526004803603604081101561014e57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561017957600080fd5b82018360208201111561018b57600080fd5b803590602001918460018302840111640100000000831117156101ad57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610371945050505050565b3480156101fa57600080fd5b5061011c610451565b61020b6104ab565b61021b6102166104b3565b6104d8565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561025c57610257816104fc565b610264565b610264610203565b50565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610317576102a1836104fc565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b505090508061031157600080fd5b5061031f565b61031f610203565b505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156103665761035f6104b3565b905061036e565b61036e610203565b90565b600061037b6104b3565b6001600160a01b03161461038e57600080fd5b6103978261053c565b80511561044d576000826001600160a01b0316826040518082805190602001908083835b602083106103da5780518252601f1990920191602091820191016103bb565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461043a576040519150601f19603f3d011682016040523d82523d6000602084013e61043f565b606091505b505090508061031f57600080fd5b5050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561036657507f000000000000000000000000000000000000000000000000000000000000000061036e565b61021b6105a4565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156104f7573d6000f35b3d6000fd5b6105058161053c565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61054581610614565b6105805760405162461bcd60e51b815260040180806020018281038252603b815260200180610683603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc55565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561060c5760405162461bcd60e51b81526004018080602001828103825260328152602001806106516032913960400191505060405180910390fd5b61021b61021b565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061064857508115155b94935050505056fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122045486fa11a09f93745421e82d8f98aaf61194cad8bf6d90ce8eec654901255f064736f6c634300060c0033a26469706673582212205bf7c86dadc3a1053177324412eef130a0fa579d083588c5eb80e1c9ef2fd5b864736f6c634300060c0033