ETH Price: $2,678.51 (-0.63%)

Contract

0x7ac6859e69d6549B39a8367097D7ae5fbff5951E
 
Transaction Hash
Method
Block
From
To
Transfer Ownersh...168283402023-03-14 19:42:23564 days ago1678822943IN
0x7ac6859e...fbff5951E
0 ETH0.0015083452.67475052
0x61010060168283392023-03-14 19:42:11564 days ago1678822931IN
 Create: AaveV2Provider
0 ETH0.1065868851.88002533

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AaveV2Provider

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : AaveV2Provider.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;

import {SafeERC20} from "openzeppelin-contracts/token/ERC20/utils/SafeERC20.sol";
import {ERC20} from "openzeppelin-contracts/token/ERC20/ERC20.sol";
import {Ownable} from "openzeppelin-contracts/access/Ownable.sol";
import {Pausable} from "openzeppelin-contracts/security/Pausable.sol";

import {IProvider} from "../../interfaces/IProvider.sol";
import {WadRayMath} from "../../libraries/WadRayMath.sol";

import {IAToken} from "./external/IAToken.sol";
import {DataTypes} from "./external/DataTypes.sol";
import {IPool} from "./external/IPool.sol";
import {IAaveIncentivesController} from "./external/IAaveIncentivesController.sol";

contract AaveV2Provider is IProvider, Ownable, Pausable {
    using SafeERC20 for ERC20;
    using WadRayMath for uint256;

    // underlying token (ie. DAI)
    address public immutable underlying;

    // aave aToken
    IAToken public immutable aToken;
    IPool public immutable pool;
    IAaveIncentivesController public immutable incentivesController;

    uint256 public totalUnRedeemed;

    mapping(address => bool) public whiteListAssets;

    address public controller;

    uint256 internal constant LTV_MASK =                   0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000; // prettier-ignore
    uint256 internal constant LIQUIDATION_THRESHOLD_MASK = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF; // prettier-ignore
    uint256 internal constant LIQUIDATION_THRESHOLD_START_BIT_POSITION = 16;
    uint256 internal constant SECONDS_PER_YEAR = 365 days;

    modifier onlyController() {
        require(msg.sender == controller, "only controller");
        _;
    }

    /**
     * @dev constructor
     * @param _aToken AAVE aToken
     */
    constructor(IAToken _aToken, address _controller) {
        aToken = _aToken;
        controller = _controller;
        underlying = _aToken.UNDERLYING_ASSET_ADDRESS();
        pool = IPool(IAToken(_aToken).POOL());
        incentivesController = IAaveIncentivesController(_aToken.getIncentivesController());
        ERC20(underlying).safeApprove(address(pool), type(uint256).max);
    }

    function deposit(uint256 _amount) external onlyOwner whenNotPaused {
        ERC20(underlying).safeTransferFrom(msg.sender, address(this), _amount);
        pool.deposit(underlying, _amount, address(this), 0);
        totalUnRedeemed = totalUnRedeemed + _amount;
    }

    function withdraw(uint256 _amount) external onlyOwner whenNotPaused {
        pool.withdraw(underlying, _amount, address(this));
        ERC20(underlying).safeTransfer(msg.sender, _amount);
        totalUnRedeemed = totalUnRedeemed - _amount;
    }

    /**
     * @dev calculate the compounded Interest for a debt
     * @param _rate the interest rate to be used
     * @param _lastUpdateTimestamp the last update timestamp used to calculate the duration of the debt
     * @return _compoundedInterest the compounded interest
     */
    function _calculateCompoundedInterest(uint256 _rate, uint40 _lastUpdateTimestamp) internal view returns (uint256) {
        //solium-disable-next-line
        uint256 timeDifference = block.timestamp - uint256(_lastUpdateTimestamp);

        uint256 ratePerSecond = _rate / SECONDS_PER_YEAR;

        return (ratePerSecond + WadRayMath.ray()).rayPow(timeDifference);
    }

    /**
     * @dev calculate the compounded balance for a debt
     * @param _rate the interest rate to be used
     * @param _balance the balance of the debt
     * @param _lastUpdateTimestamp the last update timestamp used to calculate the duration of the debt
     * @return _compoundedBalance the compounded balance
     */
    function _calculateCompoundBalance(
        uint256 _rate,
        uint256 _balance,
        uint40 _lastUpdateTimestamp
    ) internal view returns (uint256) {
        uint256 interest = _calculateCompoundedInterest(_rate, _lastUpdateTimestamp);
        return _balance.wadToRay().rayMul(interest).rayToWad();
    }

    /**
     * @dev calculate the health factor for debt
     * @param _debt debt information
     * @return healthTuple the health factor and the compounded balance
     */
    function computeHealthFactor(IProvider.Debt calldata _debt) external view returns (uint256, uint256) {
        uint256 compoundedBalance = _calculateCompoundBalance(_debt.borrowRate, _debt.borrowAmount, _debt.start);

        DataTypes.ReserveData memory reserve = pool.getReserveData(underlying);
        DataTypes.ReserveConfigurationMap memory config = reserve.configuration;
        uint256 liquidationThreshold = (config.data & ~LIQUIDATION_THRESHOLD_MASK) >>
            LIQUIDATION_THRESHOLD_START_BIT_POSITION;
        // as we only allow stable coins, we assume 1:1 ratio between collateral and debt
        uint256 healthFactor = (((_debt.collateralAmount * liquidationThreshold) *
            10**(ERC20(_debt.borrowAsset).decimals())) * 10**18) /
            10000 /
            compoundedBalance /
            10**(ERC20(underlying).decimals());
        return (healthFactor, compoundedBalance);
    }

    /**
     * @dev calculate the health factor for borrow
     * @param _debt debt information
     * @return healthTuple the health factor and the compounded balance
     */
    function computeLtv(IProvider.Debt calldata _debt) external view returns (uint256, uint256) {
        uint256 compoundedBalance = _calculateCompoundBalance(_debt.borrowRate, _debt.borrowAmount, _debt.start);

        DataTypes.ReserveData memory reserve = pool.getReserveData(underlying);
        DataTypes.ReserveConfigurationMap memory config = reserve.configuration;
        uint256 ltvThreshold = config.data & ~LTV_MASK;
        // as we only allow stable coins, we assume 1:1 ratio between collateral and debt
        uint256 healthFactor = (((_debt.collateralAmount * ltvThreshold) *
            10**(ERC20(_debt.borrowAsset).decimals())) * 10**18) /
            10000 /
            compoundedBalance /
            10**(ERC20(underlying).decimals());
        return (healthFactor, compoundedBalance);
    }

    function getBorrowRate(address asset) external view returns (uint256) {
        DataTypes.ReserveData memory reserve = pool.getReserveData(asset);
        return reserve.currentStableBorrowRate;
    }

    function getHealthFactor() external view returns (uint256) {
        (, , , , , uint256 healthFactor) = pool.getUserAccountData(address(this));
        return healthFactor;
    }

    function addTotalUnRedeemed(uint256 amount) external onlyOwner whenNotPaused {
        totalUnRedeemed = totalUnRedeemed + amount;
    }

    function enableBorrowAsset(address asset) external override onlyOwner {
        whiteListAssets[asset] = true;
    }

    function disableBorrowAsset(address asset) external override onlyOwner {
        whiteListAssets[asset] = false;
    }

    function borrow(address borrowAsset, uint256 amount) external override onlyOwner whenNotPaused {
        require(whiteListAssets[borrowAsset], "not allowed");
        pool.borrow(borrowAsset, amount, 1, 0, address(this));
        ERC20(borrowAsset).safeTransfer(msg.sender, amount);
    }

    function harvest(uint256[] calldata) external {}

    function preHarvest() external {}

    function repay(address borrowAsset, uint256 _amount) external payable override onlyOwner whenNotPaused {
        ERC20(borrowAsset).safeApprove(address(pool), 0);
        ERC20(borrowAsset).safeApprove(address(pool), _amount);
        pool.repay(borrowAsset, _amount, 1, payable(address(this)));
    }

    function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external override onlyOwner {
        pool.setUserUseReserveAsCollateral(asset, useAsCollateral);
    }

    // current total underlying balance, as measured by pool, without fees
    function underlyingBalance() external view virtual override returns (uint256) {
        // https://docs.aave.com/developers/the-core-protocol/atokens#eip20-methods
        // total underlying balance minus underlyingFees
        return aToken.balanceOf(address(this));
    }

    function smartYield() external view returns (address) {
        return owner();
    }

    function claimRewardsTo(address to) external override onlyOwner whenNotPaused {
        address[] memory assets = new address[](1);
        assets[0] = address(aToken);
        incentivesController.claimRewards(assets, type(uint256).max, to);
    }

    /**
     * @dev Rescues random funds stuck that the strat can't handle.
     * @param _token address of the token to rescue.
     */
    function inCaseTokensGetStuck(address _token) external onlyController {
        require(_token != address(aToken), "!aToken");

        uint256 amount = ERC20(_token).balanceOf(address(this));
        ERC20(_token).safeTransfer(msg.sender, amount);
    }

    function pause() public onlyController {
        _pause();
    }

    function unpause() external onlyController {
        _unpause();
    }

    function setController(address _controller) external onlyController {
        controller = _controller;
    }
}

File 2 of 20 : IProvider.sol
// SPDX-License-Identifier: Apache-2.0

pragma solidity ^0.8.0;

interface IProvider {
    enum DebtStatus {
        Invalid,
        Active,
        Finished,
        Liquidated
    }

    struct Debt {
        address borrowAsset;
        uint256 borrowAmount;
        uint40 start;
        uint256 borrowRate;
        address collateralBond;
        uint256 collateralAmount;
        DebtStatus status;
        address borrower;
    }

    function smartYield() external view returns (address);

    function underlying() external view returns (address);

    function deposit(uint256 amount) external;

    function withdraw(uint256 amount) external;

    function harvest(uint256[] calldata) external;

    function underlyingBalance() external view returns (uint256);

    function claimRewardsTo(address to) external;

    function borrow(address borrowAsset, uint256 amount) external;

    function repay(address borrowAsset, uint256 amount) external payable;

    function enableBorrowAsset(address asset) external;

    function disableBorrowAsset(address asset) external;

    function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;

    function totalUnRedeemed() external view returns (uint256);

    function addTotalUnRedeemed(uint256 amount) external;

    function computeHealthFactor(Debt memory debt) external view returns (uint256, uint256);

    function computeLtv(IProvider.Debt memory _debt) external view returns (uint256, uint256);

    function getBorrowRate(address asset) external view returns (uint256);

    function getHealthFactor() external view returns (uint256);

    function preHarvest() external;
}

File 3 of 20 : WadRayMath.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "openzeppelin-contracts/utils/math/SafeMath.sol";

/******************
@title WadRayMath library
@author Aave
@dev Provides mul and div function for wads (decimal numbers with 18 digits precision) and rays (decimals with 27 digits)
 */

library WadRayMath {
    using SafeMath for uint256;

    uint256 internal constant WAD = 1e18;
    uint256 internal constant halfWAD = WAD / 2;

    uint256 internal constant RAY = 1e27;
    uint256 internal constant halfRAY = RAY / 2;

    uint256 internal constant WAD_RAY_RATIO = 1e9;

    function ray() internal pure returns (uint256) {
        return RAY;
    }

    function wad() internal pure returns (uint256) {
        return WAD;
    }

    function halfRay() internal pure returns (uint256) {
        return halfRAY;
    }

    function halfWad() internal pure returns (uint256) {
        return halfWAD;
    }

    function wadMul(uint256 a, uint256 b) internal pure returns (uint256) {
        return halfWAD.add(a.mul(b)).div(WAD);
    }

    function wadDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 halfB = b / 2;

        return halfB.add(a.mul(WAD)).div(b);
    }

    function rayMul(uint256 a, uint256 b) internal pure returns (uint256) {
        return halfRAY.add(a.mul(b)).div(RAY);
    }

    function rayDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 halfB = b / 2;

        return halfB.add(a.mul(RAY)).div(b);
    }

    function rayToWad(uint256 a) internal pure returns (uint256) {
        uint256 halfRatio = WAD_RAY_RATIO / 2;

        return halfRatio.add(a).div(WAD_RAY_RATIO);
    }

    function wadToRay(uint256 a) internal pure returns (uint256) {
        return a.mul(WAD_RAY_RATIO);
    }

    function rayPow(uint256 x, uint256 n) internal pure returns (uint256 z) {
        z = n % 2 != 0 ? x : RAY;

        for (n /= 2; n != 0; n /= 2) {
            x = rayMul(x, x);

            if (n % 2 != 0) {
                z = rayMul(z, x);
            }
        }
    }
}

File 4 of 20 : DataTypes.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;

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}
}

File 5 of 20 : IAToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;

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

interface IAToken is IERC20, IScaledBalanceToken {
  /**
   * @dev Emitted after the mint action
   * @param from The address performing the mint
   * @param value The amount being
   * @param index The new liquidity index of the reserve
   **/
  event Mint(address indexed from, uint256 value, uint256 index);

  /**
   * @dev Mints `amount` aTokens to `user`
   * @param user The address receiving the minted tokens
   * @param amount The amount of tokens getting minted
   * @param index The new liquidity index of the reserve
   * @return `true` if the the previous balance of the user was 0
   */
  function mint(
    address user,
    uint256 amount,
    uint256 index
  ) external returns (bool);

  /**
   * @dev Emitted after aTokens are burned
   * @param from The owner of the aTokens, getting them burned
   * @param target The address that will receive the underlying
   * @param value The amount being burned
   * @param index The new liquidity index of the reserve
   **/
  event Burn(address indexed from, address indexed target, uint256 value, uint256 index);

  /**
   * @dev Emitted during the transfer action
   * @param from The user whose tokens are being transferred
   * @param to The recipient
   * @param value The amount being transferred
   * @param index The new liquidity index of the reserve
   **/
  event BalanceTransfer(address indexed from, address indexed to, uint256 value, uint256 index);

  /**
   * @dev Burns aTokens from `user` and sends the equivalent amount of underlying to `receiverOfUnderlying`
   * @param user The owner of the aTokens, getting them burned
   * @param receiverOfUnderlying The address that will receive the underlying
   * @param amount The amount being burned
   * @param index The new liquidity index of the reserve
   **/
  function burn(
    address user,
    address receiverOfUnderlying,
    uint256 amount,
    uint256 index
  ) external;

  /**
   * @dev Mints aTokens to the reserve treasury
   * @param amount The amount of tokens getting minted
   * @param index The new liquidity index of the reserve
   */
  function mintToTreasury(uint256 amount, uint256 index) external;

  /**
   * @dev Transfers aTokens in the event of a borrow being liquidated, in case the liquidators reclaims the aToken
   * @param from The address getting liquidated, current owner of the aTokens
   * @param to The recipient
   * @param value The amount of tokens getting transferred
   **/
  function transferOnLiquidation(
    address from,
    address to,
    uint256 value
  ) external;

  /**
   * @dev Transfers the underlying asset to `target`. Used by the LendingPool to transfer
   * assets in borrow(), withdraw() and flashLoan()
   * @param user The recipient of the aTokens
   * @param amount The amount getting transferred
   * @return The amount transferred
   **/
  function transferUnderlyingTo(address user, uint256 amount) external returns (uint256);

  function UNDERLYING_ASSET_ADDRESS() external view returns (address);
  function POOL() external view returns (IPool);
  function getIncentivesController() external view returns (address);
}

File 6 of 20 : IAaveIncentivesController.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;
pragma experimental ABIEncoderV2;

interface IAaveIncentivesController {
  function REWARD_TOKEN() external view returns (address);

  function claimRewards(
    address[] calldata assets,
    uint256 amount,
    address to
  ) external returns (uint256);

}

File 7 of 20 : IERC20.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;

/**
 * @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);
}

File 8 of 20 : ILendingPoolAddressesProvider.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;

/**
 * @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;
}

File 9 of 20 : IPool.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;
pragma experimental ABIEncoderV2;

import {ILendingPoolAddressesProvider} from "./ILendingPoolAddressesProvider.sol";
import {DataTypes} from "./DataTypes.sol";

interface IPool {
    /**
     * @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);
}

File 10 of 20 : IScaledBalanceToken.sol
// SPDX-License-Identifier: agpl-3.0
pragma solidity ^0.8.10;

interface IScaledBalanceToken {
  /**
   * @dev Returns the scaled balance of the user. The scaled balance is the sum of all the
   * updated stored balance divided by the reserve's liquidity index at the moment of the update
   * @param user The user whose balance is calculated
   * @return The scaled balance of the user
   **/
  function scaledBalanceOf(address user) external view returns (uint256);

  /**
   * @dev Returns the scaled balance of the user and the scaled total supply.
   * @param user The address of the user
   * @return The scaled balance of the user
   * @return The scaled balance and the scaled total supply
   **/
  function getScaledUserBalanceAndSupply(address user) external view returns (uint256, uint256);

  /**
   * @dev Returns the scaled total supply of the variable debt token. Represents sum(debt/index)
   * @return The scaled total supply
   **/
  function scaledTotalSupply() external view returns (uint256);
}

File 11 of 20 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 12 of 20 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 13 of 20 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

File 14 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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 `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, 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 `from` to `to` 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 from, address to, uint256 amount) external returns (bool);
}

File 15 of 20 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 16 of 20 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 17 of 20 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 18 of 20 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @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://consensys.net/diligence/blog/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");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 19 of 20 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 20 of 20 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // 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 (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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) {
        return a + b;
    }

    /**
     * @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 a - b;
    }

    /**
     * @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) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting 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 a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * 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) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

Settings
{
  "remappings": [
    "@uniswap/v3-core/=lib/v3-core/",
    "chainlink/=lib/chainlink/",
    "contracts/=contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/",
    "test/=test/",
    "uniswap-v3-periphery/=lib/v3-periphery/",
    "v3-core/=lib/v3-core/contracts/",
    "v3-periphery/=lib/v3-periphery/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IAToken","name":"_aToken","type":"address"},{"internalType":"address","name":"_controller","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"aToken","outputs":[{"internalType":"contract IAToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addTotalUnRedeemed","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"borrowAsset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"borrow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"claimRewardsTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"borrowAsset","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"internalType":"uint40","name":"start","type":"uint40"},{"internalType":"uint256","name":"borrowRate","type":"uint256"},{"internalType":"address","name":"collateralBond","type":"address"},{"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"internalType":"enum IProvider.DebtStatus","name":"status","type":"uint8"},{"internalType":"address","name":"borrower","type":"address"}],"internalType":"struct IProvider.Debt","name":"_debt","type":"tuple"}],"name":"computeHealthFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"borrowAsset","type":"address"},{"internalType":"uint256","name":"borrowAmount","type":"uint256"},{"internalType":"uint40","name":"start","type":"uint40"},{"internalType":"uint256","name":"borrowRate","type":"uint256"},{"internalType":"address","name":"collateralBond","type":"address"},{"internalType":"uint256","name":"collateralAmount","type":"uint256"},{"internalType":"enum IProvider.DebtStatus","name":"status","type":"uint8"},{"internalType":"address","name":"borrower","type":"address"}],"internalType":"struct IProvider.Debt","name":"_debt","type":"tuple"}],"name":"computeLtv","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"disableBorrowAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"enableBorrowAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getBorrowRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHealthFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"name":"harvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"inCaseTokensGetStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"incentivesController","outputs":[{"internalType":"contract IAaveIncentivesController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract IPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preHarvest","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"borrowAsset","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"repay","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_controller","type":"address"}],"name":"setController","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"bool","name":"useAsCollateral","type":"bool"}],"name":"setUserUseReserveAsCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"smartYield","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUnRedeemed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"underlyingBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whiteListAssets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b5060405162002a8638038062002a86833981016040819052620000359162000649565b62000040336200020b565b6000805460ff60a01b191690556001600160a01b0382811660a0819052600380546001600160a01b03191692841692909217909155604080516358b50cef60e11b8152905163b16a19de916004808201926020929091908290030181865afa158015620000b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000d7919062000688565b6001600160a01b03166080816001600160a01b031681525050816001600160a01b0316637535d2466040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200012f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000155919062000688565b6001600160a01b031660c0816001600160a01b031681525050816001600160a01b03166375d264136040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001ad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001d3919062000688565b6001600160a01b0390811660e05260c051608051620002039216906000196200025b602090811b620013ed17901c565b505062000773565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b801580620002d95750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015620002b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002d79190620006af565b155b620003515760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084015b60405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620003a9918591620003ae16565b505050565b60006200040a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200048c60201b62001535179092919060201c565b805190915015620003a957808060200190518101906200042b9190620006c9565b620003a95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000348565b60606200049d8484600085620004a5565b949350505050565b606082471015620005085760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000348565b600080866001600160a01b0316858760405162000526919062000720565b60006040518083038185875af1925050503d806000811462000565576040519150601f19603f3d011682016040523d82523d6000602084013e6200056a565b606091505b5090925090506200057e8783838762000589565b979650505050505050565b60608315620005fd578251600003620005f5576001600160a01b0385163b620005f55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000348565b50816200049d565b6200049d8383815115620006145781518083602001fd5b8060405162461bcd60e51b81526004016200034891906200073e565b6001600160a01b03811681146200064657600080fd5b50565b600080604083850312156200065d57600080fd5b82516200066a8162000630565b60208401519092506200067d8162000630565b809150509250929050565b6000602082840312156200069b57600080fd5b8151620006a88162000630565b9392505050565b600060208284031215620006c257600080fd5b5051919050565b600060208284031215620006dc57600080fd5b81518015158114620006a857600080fd5b60005b838110156200070a578181015183820152602001620006f0565b838111156200071a576000848401525b50505050565b6000825162000734818460208701620006ed565b9190910192915050565b60208152600082518060208401526200075f816040850160208701620006ed565b601f01601f19169190910160400192915050565b60805160a05160c05160e0516122386200084e600039600081816105100152610dcc01526000818161020a0152818161063301528181610668015281816106c00152818161078f0152818161092001528181610a5001528181610b4701528181610e6f01528181610ffb0152818161110901526111970152600081816104c7015281816109a901528181610d7501526112610152600081816103bb0152818161075a0152818161080a01528181610b1901528181610bd101528181610e4101528181610eff0152818161108e01526110cd01526122386000f3fe6080604052600436106101e35760003560e01c80637444c03211610102578063af1df25511610095578063def68a9c11610064578063def68a9c14610592578063eb2827da146105b2578063f2fde38b146105d2578063f77c4791146105f257600080fd5b8063af1df255146104fe578063b6b55f2514610532578063d71275f614610552578063dc02842f1461057257600080fd5b80638da5cb5b116100d15780638da5cb5b1461044257806392eefe9b14610495578063a0c1f15e146104b5578063a5f352b7146104e957600080fd5b80637444c03214610422578063788c8f0a146104425780637b9c97c2146104605780638456cb591461048057600080fd5b80635a3b74b91161017a5780636bde1797116101495780636bde1797146103745780636f307dc3146103a9578063715018a6146103dd57806371c353ae146103f257600080fd5b80635a3b74b9146102ea5780635c975abb1461030a5780635d14b06f1461033557806369d61e4f1461035457600080fd5b80632e1a7d4d116101b65780632e1a7d4d146102805780633f4ba83a146102a05780634b8a3529146102b557806359356c5c146102d557600080fd5b806306a42fc6146101e857806316f0115b146101f857806322867d7814610249578063240ac2ea1461025c575b600080fd5b3480156101f457600080fd5b505b005b34801561020457600080fd5b5061022c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101f6610257366004611b95565b610614565b34801561026857600080fd5b5061027260015481565b604051908152602001610240565b34801561028c57600080fd5b506101f661029b366004611bc1565b610733565b3480156102ac57600080fd5b506101f6610845565b3480156102c157600080fd5b506101f66102d0366004611b95565b610880565b3480156102e157600080fd5b50610272610991565b3480156102f657600080fd5b506101f6610305366004611be8565b610a21565b34801561031657600080fd5b50600054600160a01b900460ff165b6040519015158152602001610240565b34801561034157600080fd5b506101f6610350366004611c21565b5050565b34801561036057600080fd5b506101f661036f366004611c96565b610ab0565b34801561038057600080fd5b5061039461038f366004611cb3565b610adc565b60408051928352602083019190915201610240565b3480156103b557600080fd5b5061022c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e957600080fd5b506101f6610d2f565b3480156103fe57600080fd5b5061032561040d366004611c96565b60026020526000908152604090205460ff1681565b34801561042e57600080fd5b506101f661043d366004611c96565b610d41565b34801561044e57600080fd5b506000546001600160a01b031661022c565b34801561046c57600080fd5b5061039461047b366004611cb3565b610e09565b34801561048c57600080fd5b506101f6610f5b565b3480156104a157600080fd5b506101f66104b0366004611c96565b610f8d565b3480156104c157600080fd5b5061022c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156104f557600080fd5b50610272610fd9565b34801561050a57600080fd5b5061022c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561053e57600080fd5b506101f661054d366004611bc1565b611071565b34801561055e57600080fd5b5061027261056d366004611c96565b611173565b34801561057e57600080fd5b506101f661058d366004611bc1565b611217565b34801561059e57600080fd5b506101f66105ad366004611c96565b611235565b3480156105be57600080fd5b506101f66105cd366004611c96565b61134b565b3480156105de57600080fd5b506101f66105ed366004611c96565b611374565b3480156105fe57600080fd5b5060035461022c906001600160a01b031681565b565b61061c61154c565b6106246115a6565b6106596001600160a01b0383167f000000000000000000000000000000000000000000000000000000000000000060006113ed565b61068d6001600160a01b0383167f0000000000000000000000000000000000000000000000000000000000000000836113ed565b60405163573ade8160e01b81526001600160a01b03838116600483015260248201839052600160448301523060648301527f0000000000000000000000000000000000000000000000000000000000000000169063573ade81906084015b6020604051808303816000875af115801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190611ccc565b505050565b61073b61154c565b6107436115a6565b604051631a4ca37b60e21b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390523060448301527f000000000000000000000000000000000000000000000000000000000000000016906369328dec906064016020604051808303816000875af11580156107d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc9190611ccc565b506108316001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633836115f3565b8060015461083f9190611cfb565b60015550565b6003546001600160a01b031633146108785760405162461bcd60e51b815260040161086f90611d12565b60405180910390fd5b610612611623565b61088861154c565b6108906115a6565b6001600160a01b03821660009081526002602052604090205460ff166108e65760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015260640161086f565b60405163a415bcad60e01b81526001600160a01b0383811660048301526024820183905260016044830152600060648301523060848301527f0000000000000000000000000000000000000000000000000000000000000000169063a415bcad9060a401600060405180830381600087803b15801561096457600080fd5b505af1158015610978573d6000803e3d6000fd5b50610350925050506001600160a01b03831633836115f3565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156109f8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1c9190611ccc565b905090565b610a2961154c565b604051635a3b74b960e01b81526001600160a01b03838116600483015282151560248301527f00000000000000000000000000000000000000000000000000000000000000001690635a3b74b990604401600060405180830381600087803b158015610a9457600080fd5b505af1158015610aa8573d6000803e3d6000fd5b505050505050565b610ab861154c565b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b60008080610b0260608501803590602087013590610afd9060408901611d4e565b611678565b6040516335ea6a7560e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a759060240161018060405180830381865afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb39190611e36565b9050600081600001519050600061ffff1919826000015116905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c519190611f23565b610c5c90600a612022565b85612710610c6d60208c018c611c96565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190611f23565b610cd990600a612022565b610ce78660a08e0135612031565b610cf19190612031565b610d0390670de0b6b3a7640000612031565b610d0d9190612066565b610d179190612066565b610d219190612066565b989497509395505050505050565b610d3761154c565b61061260006116ab565b610d4961154c565b610d516115a6565b604080516001808252818301909252600091602080830190803683370190505090507f000000000000000000000000000000000000000000000000000000000000000081600081518110610da757610da761207a565b6001600160a01b039283166020918202929092010152604051633111e7b360e01b81527f000000000000000000000000000000000000000000000000000000000000000090911690633111e7b3906106eb908490600019908790600401612090565b60008080610e2a60608501803590602087013590610afd9060408901611d4e565b6040516335ea6a7560e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301529192506000917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a759060240161018060405180830381865afa158015610eb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edb9190611e36565b90506000816000015190506000601063ffff00001919836000015116901c905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d6000803e3d6000fd5b6003546001600160a01b03163314610f855760405162461bcd60e51b815260040161086f90611d12565b6106126116fb565b6003546001600160a01b03163314610fb75760405162461bcd60e51b815260040161086f90611d12565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b604051632fe4a15f60e21b815230600482015260009081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063bf92857c9060240160c060405180830381865afa158015611042573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106691906120f4565b979650505050505050565b61107961154c565b6110816115a6565b6110b66001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308461173e565b60405163e8eda9df60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015260248201839052306044830152600060648301527f0000000000000000000000000000000000000000000000000000000000000000169063e8eda9df90608401600060405180830381600087803b15801561114d57600080fd5b505af1158015611161573d6000803e3d6000fd5b505050508060015461083f919061213e565b6040516335ea6a7560e01b81526001600160a01b03828116600483015260009182917f000000000000000000000000000000000000000000000000000000000000000016906335ea6a759060240161018060405180830381865afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611e36565b60a001516001600160801b03169392505050565b61121f61154c565b6112276115a6565b8060015461083f919061213e565b6003546001600160a01b0316331461125f5760405162461bcd60e51b815260040161086f90611d12565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316036112ca5760405162461bcd60e51b815260206004820152600760248201526610b0aa37b5b2b760c91b604482015260640161086f565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611311573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113359190611ccc565b90506103506001600160a01b03831633836115f3565b61135361154c565b6001600160a01b03166000908152600260205260409020805460ff19169055565b61137c61154c565b6001600160a01b0381166113e15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086f565b6113ea816116ab565b50565b8015806114675750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114659190611ccc565b155b6114d25760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086f565b6040516001600160a01b03831660248201526044810182905261072e90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261177c565b6060611544848460008561184e565b949350505050565b6000546001600160a01b031633146106125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086f565b600054600160a01b900460ff16156106125760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161086f565b6040516001600160a01b03831660248201526044810182905261072e90849063a9059cbb60e01b906064016114fe565b61162b61191e565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080611685858461196e565b90506116a261169d82611697876119c1565b906119d1565b611a1a565b95945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6117036115a6565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861165b3390565b6040516001600160a01b03808516602483015283166044820152606481018290526117769085906323b872dd60e01b906084016114fe565b50505050565b60006117d1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115359092919063ffffffff16565b80519091501561072e57808060200190518101906117ef9190612156565b61072e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086f565b6060824710156118af5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161086f565b600080866001600160a01b031685876040516118cb919061219f565b60006040518083038185875af1925050503d8060008114611908576040519150601f19603f3d011682016040523d82523d6000602084013e61190d565b606091505b509150915061106687838387611a40565b600054600160a01b900460ff166106125760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161086f565b60008061198264ffffffffff841642611cfb565b905060006119946301e1338086612066565b90506119b6826119b06b033b2e3c9fd0803ce80000008461213e565b90611ab9565b925050505b92915050565b60006119bb82633b9aca00611b32565b6000611a136b033b2e3c9fd0803ce8000000611a0d6119f08686611b32565b611a0760026b033b2e3c9fd0803ce8000000612066565b90611b3e565b90611b4a565b9392505050565b600080611a2c6002633b9aca00612066565b9050611a13633b9aca00611a0d8386611b3e565b60608315611aaf578251600003611aa8576001600160a01b0385163b611aa85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086f565b5081611544565b6115448383611b56565b6000611ac66002836121bb565b600003611adf576b033b2e3c9fd0803ce8000000611ae1565b825b9050611aee600283612066565b91505b81156119bb57611b0183846119d1565b9250611b0e6002836121bb565b15611b2057611b1d81846119d1565b90505b611b2b600283612066565b9150611af1565b6000611a138284612031565b6000611a13828461213e565b6000611a138284612066565b815115611b665781518083602001fd5b8060405162461bcd60e51b815260040161086f91906121cf565b6001600160a01b03811681146113ea57600080fd5b60008060408385031215611ba857600080fd5b8235611bb381611b80565b946020939093013593505050565b600060208284031215611bd357600080fd5b5035919050565b80151581146113ea57600080fd5b60008060408385031215611bfb57600080fd5b8235611c0681611b80565b91506020830135611c1681611bda565b809150509250929050565b60008060208385031215611c3457600080fd5b823567ffffffffffffffff80821115611c4c57600080fd5b818501915085601f830112611c6057600080fd5b813581811115611c6f57600080fd5b8660208260051b8501011115611c8457600080fd5b60209290920196919550909350505050565b600060208284031215611ca857600080fd5b8135611a1381611b80565b60006101008284031215611cc657600080fd5b50919050565b600060208284031215611cde57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d0d57611d0d611ce5565b500390565b6020808252600f908201526e37b7363c9031b7b73a3937b63632b960891b604082015260600190565b64ffffffffff811681146113ea57600080fd5b600060208284031215611d6057600080fd5b8135611a1381611d3b565b604051610180810167ffffffffffffffff81118282101715611d9d57634e487b7160e01b600052604160045260246000fd5b60405290565b600060208284031215611db557600080fd5b6040516020810181811067ffffffffffffffff82111715611de657634e487b7160e01b600052604160045260246000fd5b6040529151825250919050565b80516001600160801b0381168114611e0a57600080fd5b919050565b8051611e0a81611d3b565b8051611e0a81611b80565b805160ff81168114611e0a57600080fd5b60006101808284031215611e4957600080fd5b611e51611d6b565b611e5b8484611da3565b8152611e6960208401611df3565b6020820152611e7a60408401611df3565b6040820152611e8b60608401611df3565b6060820152611e9c60808401611df3565b6080820152611ead60a08401611df3565b60a0820152611ebe60c08401611e0f565b60c0820152611ecf60e08401611e1a565b60e0820152610100611ee2818501611e1a565b90820152610120611ef4848201611e1a565b90820152610140611f06848201611e1a565b90820152610160611f18848201611e25565b908201529392505050565b600060208284031215611f3557600080fd5b611a1382611e25565b600181815b80851115611f79578160001904821115611f5f57611f5f611ce5565b80851615611f6c57918102915b93841c9390800290611f43565b509250929050565b600082611f90575060016119bb565b81611f9d575060006119bb565b8160018114611fb35760028114611fbd57611fd9565b60019150506119bb565b60ff841115611fce57611fce611ce5565b50506001821b6119bb565b5060208310610133831016604e8410600b8410161715611ffc575081810a6119bb565b6120068383611f3e565b806000190482111561201a5761201a611ce5565b029392505050565b6000611a1360ff841683611f81565b600081600019048311821515161561204b5761204b611ce5565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261207557612075612050565b500490565b634e487b7160e01b600052603260045260246000fd5b606080825284519082018190526000906020906080840190828801845b828110156120d25781516001600160a01b0316845292840192908401906001016120ad565b50505090830194909452506001600160a01b0391909116604090910152919050565b60008060008060008060c0878903121561210d57600080fd5b865195506020870151945060408701519350606087015192506080870151915060a087015190509295509295509295565b6000821982111561215157612151611ce5565b500190565b60006020828403121561216857600080fd5b8151611a1381611bda565b60005b8381101561218e578181015183820152602001612176565b838111156117765750506000910152565b600082516121b1818460208701612173565b9190910192915050565b6000826121ca576121ca612050565b500690565b60208152600082518060208401526121ee816040850160208701612173565b601f01601f1916919091016040019291505056fea26469706673582212207779cf438f7c45155cdfe2f0a280de40413ec86438ecbb2111eca23943819cd064736f6c634300080f0033000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a3000000000000000000000000072bb8c41fa42ee30822d8f33058a0731205ee5a

Deployed Bytecode

0x6080604052600436106101e35760003560e01c80637444c03211610102578063af1df25511610095578063def68a9c11610064578063def68a9c14610592578063eb2827da146105b2578063f2fde38b146105d2578063f77c4791146105f257600080fd5b8063af1df255146104fe578063b6b55f2514610532578063d71275f614610552578063dc02842f1461057257600080fd5b80638da5cb5b116100d15780638da5cb5b1461044257806392eefe9b14610495578063a0c1f15e146104b5578063a5f352b7146104e957600080fd5b80637444c03214610422578063788c8f0a146104425780637b9c97c2146104605780638456cb591461048057600080fd5b80635a3b74b91161017a5780636bde1797116101495780636bde1797146103745780636f307dc3146103a9578063715018a6146103dd57806371c353ae146103f257600080fd5b80635a3b74b9146102ea5780635c975abb1461030a5780635d14b06f1461033557806369d61e4f1461035457600080fd5b80632e1a7d4d116101b65780632e1a7d4d146102805780633f4ba83a146102a05780634b8a3529146102b557806359356c5c146102d557600080fd5b806306a42fc6146101e857806316f0115b146101f857806322867d7814610249578063240ac2ea1461025c575b600080fd5b3480156101f457600080fd5b505b005b34801561020457600080fd5b5061022c7f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a981565b6040516001600160a01b0390911681526020015b60405180910390f35b6101f6610257366004611b95565b610614565b34801561026857600080fd5b5061027260015481565b604051908152602001610240565b34801561028c57600080fd5b506101f661029b366004611bc1565b610733565b3480156102ac57600080fd5b506101f6610845565b3480156102c157600080fd5b506101f66102d0366004611b95565b610880565b3480156102e157600080fd5b50610272610991565b3480156102f657600080fd5b506101f6610305366004611be8565b610a21565b34801561031657600080fd5b50600054600160a01b900460ff165b6040519015158152602001610240565b34801561034157600080fd5b506101f6610350366004611c21565b5050565b34801561036057600080fd5b506101f661036f366004611c96565b610ab0565b34801561038057600080fd5b5061039461038f366004611cb3565b610adc565b60408051928352602083019190915201610240565b3480156103b557600080fd5b5061022c7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81565b3480156103e957600080fd5b506101f6610d2f565b3480156103fe57600080fd5b5061032561040d366004611c96565b60026020526000908152604090205460ff1681565b34801561042e57600080fd5b506101f661043d366004611c96565b610d41565b34801561044e57600080fd5b506000546001600160a01b031661022c565b34801561046c57600080fd5b5061039461047b366004611cb3565b610e09565b34801561048c57600080fd5b506101f6610f5b565b3480156104a157600080fd5b506101f66104b0366004611c96565b610f8d565b3480156104c157600080fd5b5061022c7f000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a381565b3480156104f557600080fd5b50610272610fd9565b34801561050a57600080fd5b5061022c7f000000000000000000000000d784927ff2f95ba542bfc824c8a8a98f3495f6b581565b34801561053e57600080fd5b506101f661054d366004611bc1565b611071565b34801561055e57600080fd5b5061027261056d366004611c96565b611173565b34801561057e57600080fd5b506101f661058d366004611bc1565b611217565b34801561059e57600080fd5b506101f66105ad366004611c96565b611235565b3480156105be57600080fd5b506101f66105cd366004611c96565b61134b565b3480156105de57600080fd5b506101f66105ed366004611c96565b611374565b3480156105fe57600080fd5b5060035461022c906001600160a01b031681565b565b61061c61154c565b6106246115a6565b6106596001600160a01b0383167f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a960006113ed565b61068d6001600160a01b0383167f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9836113ed565b60405163573ade8160e01b81526001600160a01b03838116600483015260248201839052600160448301523060648301527f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9169063573ade81906084015b6020604051808303816000875af115801561070a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072e9190611ccc565b505050565b61073b61154c565b6107436115a6565b604051631a4ca37b60e21b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f81166004830152602482018390523060448301527f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a916906369328dec906064016020604051808303816000875af11580156107d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fc9190611ccc565b506108316001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1633836115f3565b8060015461083f9190611cfb565b60015550565b6003546001600160a01b031633146108785760405162461bcd60e51b815260040161086f90611d12565b60405180910390fd5b610612611623565b61088861154c565b6108906115a6565b6001600160a01b03821660009081526002602052604090205460ff166108e65760405162461bcd60e51b815260206004820152600b60248201526a1b9bdd08185b1b1bddd95960aa1b604482015260640161086f565b60405163a415bcad60e01b81526001600160a01b0383811660048301526024820183905260016044830152600060648301523060848301527f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9169063a415bcad9060a401600060405180830381600087803b15801561096457600080fd5b505af1158015610978573d6000803e3d6000fd5b50610350925050506001600160a01b03831633836115f3565b6040516370a0823160e01b81523060048201526000907f000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a36001600160a01b0316906370a0823190602401602060405180830381865afa1580156109f8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1c9190611ccc565b905090565b610a2961154c565b604051635a3b74b960e01b81526001600160a01b03838116600483015282151560248301527f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a91690635a3b74b990604401600060405180830381600087803b158015610a9457600080fd5b505af1158015610aa8573d6000803e3d6000fd5b505050505050565b610ab861154c565b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b60008080610b0260608501803590602087013590610afd9060408901611d4e565b611678565b6040516335ea6a7560e01b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f811660048301529192506000917f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a916906335ea6a759060240161018060405180830381865afa158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bb39190611e36565b9050600081600001519050600061ffff1919826000015116905060007f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c519190611f23565b610c5c90600a612022565b85612710610c6d60208c018c611c96565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190611f23565b610cd990600a612022565b610ce78660a08e0135612031565b610cf19190612031565b610d0390670de0b6b3a7640000612031565b610d0d9190612066565b610d179190612066565b610d219190612066565b989497509395505050505050565b610d3761154c565b61061260006116ab565b610d4961154c565b610d516115a6565b604080516001808252818301909252600091602080830190803683370190505090507f000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a381600081518110610da757610da761207a565b6001600160a01b039283166020918202929092010152604051633111e7b360e01b81527f000000000000000000000000d784927ff2f95ba542bfc824c8a8a98f3495f6b590911690633111e7b3906106eb908490600019908790600401612090565b60008080610e2a60608501803590602087013590610afd9060408901611d4e565b6040516335ea6a7560e01b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f811660048301529192506000917f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a916906335ea6a759060240161018060405180830381865afa158015610eb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edb9190611e36565b90506000816000015190506000601063ffff00001919836000015116901c905060007f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2d573d6000803e3d6000fd5b6003546001600160a01b03163314610f855760405162461bcd60e51b815260040161086f90611d12565b6106126116fb565b6003546001600160a01b03163314610fb75760405162461bcd60e51b815260040161086f90611d12565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b604051632fe4a15f60e21b815230600482015260009081906001600160a01b037f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9169063bf92857c9060240160c060405180830381865afa158015611042573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106691906120f4565b979650505050505050565b61107961154c565b6110816115a6565b6110b66001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f1633308461173e565b60405163e8eda9df60e01b81526001600160a01b037f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f8116600483015260248201839052306044830152600060648301527f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a9169063e8eda9df90608401600060405180830381600087803b15801561114d57600080fd5b505af1158015611161573d6000803e3d6000fd5b505050508060015461083f919061213e565b6040516335ea6a7560e01b81526001600160a01b03828116600483015260009182917f0000000000000000000000007d2768de32b0b80b7a3454c06bdac94a69ddc7a916906335ea6a759060240161018060405180830381865afa1580156111df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112039190611e36565b60a001516001600160801b03169392505050565b61121f61154c565b6112276115a6565b8060015461083f919061213e565b6003546001600160a01b0316331461125f5760405162461bcd60e51b815260040161086f90611d12565b7f000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a36001600160a01b0316816001600160a01b0316036112ca5760405162461bcd60e51b815260206004820152600760248201526610b0aa37b5b2b760c91b604482015260640161086f565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015611311573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113359190611ccc565b90506103506001600160a01b03831633836115f3565b61135361154c565b6001600160a01b03166000908152600260205260409020805460ff19169055565b61137c61154c565b6001600160a01b0381166113e15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161086f565b6113ea816116ab565b50565b8015806114675750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114659190611ccc565b155b6114d25760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161086f565b6040516001600160a01b03831660248201526044810182905261072e90849063095ea7b360e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261177c565b6060611544848460008561184e565b949350505050565b6000546001600160a01b031633146106125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161086f565b600054600160a01b900460ff16156106125760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161086f565b6040516001600160a01b03831660248201526044810182905261072e90849063a9059cbb60e01b906064016114fe565b61162b61191e565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080611685858461196e565b90506116a261169d82611697876119c1565b906119d1565b611a1a565b95945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6117036115a6565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861165b3390565b6040516001600160a01b03808516602483015283166044820152606481018290526117769085906323b872dd60e01b906084016114fe565b50505050565b60006117d1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166115359092919063ffffffff16565b80519091501561072e57808060200190518101906117ef9190612156565b61072e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161086f565b6060824710156118af5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161086f565b600080866001600160a01b031685876040516118cb919061219f565b60006040518083038185875af1925050503d8060008114611908576040519150601f19603f3d011682016040523d82523d6000602084013e61190d565b606091505b509150915061106687838387611a40565b600054600160a01b900460ff166106125760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161086f565b60008061198264ffffffffff841642611cfb565b905060006119946301e1338086612066565b90506119b6826119b06b033b2e3c9fd0803ce80000008461213e565b90611ab9565b925050505b92915050565b60006119bb82633b9aca00611b32565b6000611a136b033b2e3c9fd0803ce8000000611a0d6119f08686611b32565b611a0760026b033b2e3c9fd0803ce8000000612066565b90611b3e565b90611b4a565b9392505050565b600080611a2c6002633b9aca00612066565b9050611a13633b9aca00611a0d8386611b3e565b60608315611aaf578251600003611aa8576001600160a01b0385163b611aa85760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161086f565b5081611544565b6115448383611b56565b6000611ac66002836121bb565b600003611adf576b033b2e3c9fd0803ce8000000611ae1565b825b9050611aee600283612066565b91505b81156119bb57611b0183846119d1565b9250611b0e6002836121bb565b15611b2057611b1d81846119d1565b90505b611b2b600283612066565b9150611af1565b6000611a138284612031565b6000611a13828461213e565b6000611a138284612066565b815115611b665781518083602001fd5b8060405162461bcd60e51b815260040161086f91906121cf565b6001600160a01b03811681146113ea57600080fd5b60008060408385031215611ba857600080fd5b8235611bb381611b80565b946020939093013593505050565b600060208284031215611bd357600080fd5b5035919050565b80151581146113ea57600080fd5b60008060408385031215611bfb57600080fd5b8235611c0681611b80565b91506020830135611c1681611bda565b809150509250929050565b60008060208385031215611c3457600080fd5b823567ffffffffffffffff80821115611c4c57600080fd5b818501915085601f830112611c6057600080fd5b813581811115611c6f57600080fd5b8660208260051b8501011115611c8457600080fd5b60209290920196919550909350505050565b600060208284031215611ca857600080fd5b8135611a1381611b80565b60006101008284031215611cc657600080fd5b50919050565b600060208284031215611cde57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082821015611d0d57611d0d611ce5565b500390565b6020808252600f908201526e37b7363c9031b7b73a3937b63632b960891b604082015260600190565b64ffffffffff811681146113ea57600080fd5b600060208284031215611d6057600080fd5b8135611a1381611d3b565b604051610180810167ffffffffffffffff81118282101715611d9d57634e487b7160e01b600052604160045260246000fd5b60405290565b600060208284031215611db557600080fd5b6040516020810181811067ffffffffffffffff82111715611de657634e487b7160e01b600052604160045260246000fd5b6040529151825250919050565b80516001600160801b0381168114611e0a57600080fd5b919050565b8051611e0a81611d3b565b8051611e0a81611b80565b805160ff81168114611e0a57600080fd5b60006101808284031215611e4957600080fd5b611e51611d6b565b611e5b8484611da3565b8152611e6960208401611df3565b6020820152611e7a60408401611df3565b6040820152611e8b60608401611df3565b6060820152611e9c60808401611df3565b6080820152611ead60a08401611df3565b60a0820152611ebe60c08401611e0f565b60c0820152611ecf60e08401611e1a565b60e0820152610100611ee2818501611e1a565b90820152610120611ef4848201611e1a565b90820152610140611f06848201611e1a565b90820152610160611f18848201611e25565b908201529392505050565b600060208284031215611f3557600080fd5b611a1382611e25565b600181815b80851115611f79578160001904821115611f5f57611f5f611ce5565b80851615611f6c57918102915b93841c9390800290611f43565b509250929050565b600082611f90575060016119bb565b81611f9d575060006119bb565b8160018114611fb35760028114611fbd57611fd9565b60019150506119bb565b60ff841115611fce57611fce611ce5565b50506001821b6119bb565b5060208310610133831016604e8410600b8410161715611ffc575081810a6119bb565b6120068383611f3e565b806000190482111561201a5761201a611ce5565b029392505050565b6000611a1360ff841683611f81565b600081600019048311821515161561204b5761204b611ce5565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261207557612075612050565b500490565b634e487b7160e01b600052603260045260246000fd5b606080825284519082018190526000906020906080840190828801845b828110156120d25781516001600160a01b0316845292840192908401906001016120ad565b50505090830194909452506001600160a01b0391909116604090910152919050565b60008060008060008060c0878903121561210d57600080fd5b865195506020870151945060408701519350606087015192506080870151915060a087015190509295509295509295565b6000821982111561215157612151611ce5565b500190565b60006020828403121561216857600080fd5b8151611a1381611bda565b60005b8381101561218e578181015183820152602001612176565b838111156117765750506000910152565b600082516121b1818460208701612173565b9190910192915050565b6000826121ca576121ca612050565b500690565b60208152600082518060208401526121ee816040850160208701612173565b601f01601f1916919091016040019291505056fea26469706673582212207779cf438f7c45155cdfe2f0a280de40413ec86438ecbb2111eca23943819cd064736f6c634300080f0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a3000000000000000000000000072bb8c41fa42ee30822d8f33058a0731205ee5a

-----Decoded View---------------
Arg [0] : _aToken (address): 0x028171bCA77440897B824Ca71D1c56caC55b68A3
Arg [1] : _controller (address): 0x072Bb8C41fa42ee30822D8f33058a0731205Ee5A

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000028171bca77440897b824ca71d1c56cac55b68a3
Arg [1] : 000000000000000000000000072bb8c41fa42ee30822d8f33058a0731205ee5a


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.