ETH Price: $4,047.72 (+4.08%)

Contract

0x93f6ec3DABc33cA45c0293107835CCfDc820fe6d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00
Transaction Hash
Method
Block
From
To
Set Tup183302282023-10-11 22:40:23431 days ago1697064023IN
0x93f6ec3D...Dc820fe6d
0 ETH0.01783667

Latest 24 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
202432642024-07-05 22:22:35163 days ago1720218155
0x93f6ec3D...Dc820fe6d
0.00023886 ETH
202432642024-07-05 22:22:35163 days ago1720218155
0x93f6ec3D...Dc820fe6d
0.00023886 ETH
202432642024-07-05 22:22:35163 days ago1720218155
0x93f6ec3D...Dc820fe6d
0.005 ETH
202432642024-07-05 22:22:35163 days ago1720218155
0x93f6ec3D...Dc820fe6d
0.005 ETH
183719532023-10-17 18:42:59426 days ago1697568179
0x93f6ec3D...Dc820fe6d
0.00335915 ETH
183719532023-10-17 18:42:59426 days ago1697568179
0x93f6ec3D...Dc820fe6d
0.00335915 ETH
183719532023-10-17 18:42:59426 days ago1697568179
0x93f6ec3D...Dc820fe6d
0.00836165 ETH
183719532023-10-17 18:42:59426 days ago1697568179
0x93f6ec3D...Dc820fe6d
0.00836165 ETH
183719512023-10-17 18:42:35426 days ago1697568155
0x93f6ec3D...Dc820fe6d
0.00050581 ETH
183719512023-10-17 18:42:35426 days ago1697568155
0x93f6ec3D...Dc820fe6d
0.00050581 ETH
183719512023-10-17 18:42:35426 days ago1697568155
0x93f6ec3D...Dc820fe6d
0.05053081 ETH
183719512023-10-17 18:42:35426 days ago1697568155
0x93f6ec3D...Dc820fe6d
0.05053081 ETH
183719462023-10-17 18:41:35426 days ago1697568095
0x93f6ec3D...Dc820fe6d
0.0009114 ETH
183719462023-10-17 18:41:35426 days ago1697568095
0x93f6ec3D...Dc820fe6d
0.0009114 ETH
183719462023-10-17 18:41:35426 days ago1697568095
0x93f6ec3D...Dc820fe6d
0.05 ETH
183719462023-10-17 18:41:35426 days ago1697568095
0x93f6ec3D...Dc820fe6d
0.05 ETH
183304132023-10-11 23:17:35431 days ago1697066255
0x93f6ec3D...Dc820fe6d
0.001 ETH
183304132023-10-11 23:17:35431 days ago1697066255
0x93f6ec3D...Dc820fe6d
0.001 ETH
183304132023-10-11 23:17:35431 days ago1697066255
0x93f6ec3D...Dc820fe6d
0.005 ETH
183304132023-10-11 23:17:35431 days ago1697066255
0x93f6ec3D...Dc820fe6d
0.005 ETH
183304132023-10-11 23:17:35431 days ago1697066255
0x93f6ec3D...Dc820fe6d
0.01 ETH
183304132023-10-11 23:17:35431 days ago1697066255
0x93f6ec3D...Dc820fe6d
0.01 ETH
183303932023-10-11 23:13:35431 days ago1697066015
0x93f6ec3D...Dc820fe6d
0.0016 ETH
183303932023-10-11 23:13:35431 days ago1697066015
0x93f6ec3D...Dc820fe6d
0.0016 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
HelperFlashLoan

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
Yes with 5000 runs

Other Settings:
london EvmVersion
File 1 of 18 : HelperFlashLoan.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@aave/core-v3/contracts/flashloan/base/FlashLoanSimpleReceiverBase.sol";
import "@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol";
import "./Helper.sol";

contract HelperFlashLoan is Helper, FlashLoanSimpleReceiverBase {
    using Math for uint256;

    constructor(
        address _addressProvider,
        address _exchangeRouterAddress,
        address _tupTokenAddress,
        bool _hasAlternativeSwap,
        address _owner
    )
        Helper(_addressProvider, _exchangeRouterAddress, _tupTokenAddress, _hasAlternativeSwap, _owner)
        FlashLoanSimpleReceiverBase(IPoolAddressesProvider(_addressProvider))
    { }

    function _calculateFee(uint256 amount) internal virtual override returns (uint256) {
        if (!hasAlternativeSwap) {
            return amount + amount.mulDiv(POOL.FLASHLOAN_PREMIUM_TOTAL(), 10_000);
        } else {
            return amount + amount.mulDiv(SWAP_FEE, 10_000);
        }
    }

    function _startTraditionalSwap(address asset, uint256 amount) internal virtual override returns (bool) {
        address receiver = address(this);
        bytes memory params = "";
        uint16 referralCode = 0;

        try POOL.flashLoanSimple(receiver, asset, amount, params, referralCode) {
            return true;
        } catch {
            return false;
        }
    }

    function executeOperation(address asset, uint256 amount, uint256 premium, address initiator, bytes calldata params)
        external
        override
        internalOnly
        returns (bool)
    {
        IERC20 assetToBorrow = IERC20(asset);
        uint256 totalAmount = amount + premium;
        if (_performOperation(asset, amount)) {
            uint256 finalBalance = assetToBorrow.balanceOf(address(this));
            IWETH(asset).withdraw(finalBalance - totalAmount);
            tup.receiveProfit{ value: finalBalance - totalAmount }();
        }
        assetToBorrow.approve(address(POOL), totalAmount);
        return true;
    }

    function queryPoolAddress() external view virtual override returns (address) {
        return address(POOL);
    }
}

File 2 of 18 : FlashLoanSimpleReceiverBase.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.10;

import {IFlashLoanSimpleReceiver} from '../interfaces/IFlashLoanSimpleReceiver.sol';
import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
import {IPool} from '../../interfaces/IPool.sol';

/**
 * @title FlashLoanSimpleReceiverBase
 * @author Aave
 * @notice Base contract to develop a flashloan-receiver contract.
 */
abstract contract FlashLoanSimpleReceiverBase is IFlashLoanSimpleReceiver {
  IPoolAddressesProvider public immutable override ADDRESSES_PROVIDER;
  IPool public immutable override POOL;

  constructor(IPoolAddressesProvider provider) {
    ADDRESSES_PROVIDER = provider;
    POOL = IPool(provider.getPool());
  }
}

File 3 of 18 : IPoolAddressesProvider.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

/**
 * @title IPoolAddressesProvider
 * @author Aave
 * @notice Defines the basic interface for a Pool Addresses Provider.
 */
interface IPoolAddressesProvider {
  /**
   * @dev Emitted when the market identifier is updated.
   * @param oldMarketId The old id of the market
   * @param newMarketId The new id of the market
   */
  event MarketIdSet(string indexed oldMarketId, string indexed newMarketId);

  /**
   * @dev Emitted when the pool is updated.
   * @param oldAddress The old address of the Pool
   * @param newAddress The new address of the Pool
   */
  event PoolUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the pool configurator is updated.
   * @param oldAddress The old address of the PoolConfigurator
   * @param newAddress The new address of the PoolConfigurator
   */
  event PoolConfiguratorUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the price oracle is updated.
   * @param oldAddress The old address of the PriceOracle
   * @param newAddress The new address of the PriceOracle
   */
  event PriceOracleUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the ACL manager is updated.
   * @param oldAddress The old address of the ACLManager
   * @param newAddress The new address of the ACLManager
   */
  event ACLManagerUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the ACL admin is updated.
   * @param oldAddress The old address of the ACLAdmin
   * @param newAddress The new address of the ACLAdmin
   */
  event ACLAdminUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the price oracle sentinel is updated.
   * @param oldAddress The old address of the PriceOracleSentinel
   * @param newAddress The new address of the PriceOracleSentinel
   */
  event PriceOracleSentinelUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the pool data provider is updated.
   * @param oldAddress The old address of the PoolDataProvider
   * @param newAddress The new address of the PoolDataProvider
   */
  event PoolDataProviderUpdated(address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when a new proxy is created.
   * @param id The identifier of the proxy
   * @param proxyAddress The address of the created proxy contract
   * @param implementationAddress The address of the implementation contract
   */
  event ProxyCreated(
    bytes32 indexed id,
    address indexed proxyAddress,
    address indexed implementationAddress
  );

  /**
   * @dev Emitted when a new non-proxied contract address is registered.
   * @param id The identifier of the contract
   * @param oldAddress The address of the old contract
   * @param newAddress The address of the new contract
   */
  event AddressSet(bytes32 indexed id, address indexed oldAddress, address indexed newAddress);

  /**
   * @dev Emitted when the implementation of the proxy registered with id is updated
   * @param id The identifier of the contract
   * @param proxyAddress The address of the proxy contract
   * @param oldImplementationAddress The address of the old implementation contract
   * @param newImplementationAddress The address of the new implementation contract
   */
  event AddressSetAsProxy(
    bytes32 indexed id,
    address indexed proxyAddress,
    address oldImplementationAddress,
    address indexed newImplementationAddress
  );

  /**
   * @notice Returns the id of the Aave market to which this contract points to.
   * @return The market id
   */
  function getMarketId() external view returns (string memory);

  /**
   * @notice Associates an id with a specific PoolAddressesProvider.
   * @dev This can be used to create an onchain registry of PoolAddressesProviders to
   * identify and validate multiple Aave markets.
   * @param newMarketId The market id
   */
  function setMarketId(string calldata newMarketId) external;

  /**
   * @notice Returns an address by its identifier.
   * @dev The returned address might be an EOA or a contract, potentially proxied
   * @dev It returns ZERO if there is no registered address with the given id
   * @param id The id
   * @return The address of the registered for the specified id
   */
  function getAddress(bytes32 id) external view returns (address);

  /**
   * @notice General function to update the implementation of a proxy registered with
   * certain `id`. If there is no proxy registered, it will instantiate one and
   * set as implementation the `newImplementationAddress`.
   * @dev IMPORTANT Use this function carefully, only for ids that don't have an explicit
   * setter function, in order to avoid unexpected consequences
   * @param id The id
   * @param newImplementationAddress The address of the new implementation
   */
  function setAddressAsProxy(bytes32 id, address newImplementationAddress) external;

  /**
   * @notice Sets an address for an id replacing the address saved in the addresses map.
   * @dev IMPORTANT Use this function carefully, as it will do a hard replacement
   * @param id The id
   * @param newAddress The address to set
   */
  function setAddress(bytes32 id, address newAddress) external;

  /**
   * @notice Returns the address of the Pool proxy.
   * @return The Pool proxy address
   */
  function getPool() external view returns (address);

  /**
   * @notice Updates the implementation of the Pool, or creates a proxy
   * setting the new `pool` implementation when the function is called for the first time.
   * @param newPoolImpl The new Pool implementation
   */
  function setPoolImpl(address newPoolImpl) external;

  /**
   * @notice Returns the address of the PoolConfigurator proxy.
   * @return The PoolConfigurator proxy address
   */
  function getPoolConfigurator() external view returns (address);

  /**
   * @notice Updates the implementation of the PoolConfigurator, or creates a proxy
   * setting the new `PoolConfigurator` implementation when the function is called for the first time.
   * @param newPoolConfiguratorImpl The new PoolConfigurator implementation
   */
  function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external;

  /**
   * @notice Returns the address of the price oracle.
   * @return The address of the PriceOracle
   */
  function getPriceOracle() external view returns (address);

  /**
   * @notice Updates the address of the price oracle.
   * @param newPriceOracle The address of the new PriceOracle
   */
  function setPriceOracle(address newPriceOracle) external;

  /**
   * @notice Returns the address of the ACL manager.
   * @return The address of the ACLManager
   */
  function getACLManager() external view returns (address);

  /**
   * @notice Updates the address of the ACL manager.
   * @param newAclManager The address of the new ACLManager
   */
  function setACLManager(address newAclManager) external;

  /**
   * @notice Returns the address of the ACL admin.
   * @return The address of the ACL admin
   */
  function getACLAdmin() external view returns (address);

  /**
   * @notice Updates the address of the ACL admin.
   * @param newAclAdmin The address of the new ACL admin
   */
  function setACLAdmin(address newAclAdmin) external;

  /**
   * @notice Returns the address of the price oracle sentinel.
   * @return The address of the PriceOracleSentinel
   */
  function getPriceOracleSentinel() external view returns (address);

  /**
   * @notice Updates the address of the price oracle sentinel.
   * @param newPriceOracleSentinel The address of the new PriceOracleSentinel
   */
  function setPriceOracleSentinel(address newPriceOracleSentinel) external;

  /**
   * @notice Returns the address of the data provider.
   * @return The address of the DataProvider
   */
  function getPoolDataProvider() external view returns (address);

  /**
   * @notice Updates the address of the data provider.
   * @param newDataProvider The address of the new DataProvider
   */
  function setPoolDataProvider(address newDataProvider) external;
}

File 4 of 18 : Helper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ITimeIsUp.sol";
import "./IHelperBase.sol";
import "./IUniswapV2Factory.sol";
import "./IUniswapV2Router02.sol";
import "./IUniswapV2Pair.sol";
import "./IWETH.sol";

contract Helper is Ownable, IHelperBase {
    using Math for uint256;

    bool internal immutable hasAlternativeSwap;

    bool internal isInternal;
    bool internal isRunningArbitrage;
    bool internal swapSuccessful;

    enum Operation {
        ETH_TO_TUP_INTERNAL_TUP_TO_ETH_EXTERNAL,
        ETH_TO_TUP_EXTERNAL_TUP_TO_ETH_INTERNAL
    }

    Operation internal operation;

    IUniswapV2Router02 internal router;
    IUniswapV2Factory internal factory;
    ITimeIsUp internal tup;

    address internal _pairTupEth;

    uint256 internal constant FACTOR = 10 ** 18;
    uint256 internal constant ARBITRAGE_RATE = 500;
    uint256 internal constant SWAP_FEE = 100;

    uint256[22] internal rangesWETH = [
        50_000_000 ether,
        10_000_000 ether,
        5_000_000 ether,
        1_000_000 ether,
        500_000 ether,
        100_000 ether,
        50_000 ether,
        10_000 ether,
        5_000 ether,
        1_000 ether,
        500 ether,
        100 ether,
        50 ether,
        10 ether,
        5 ether,
        1 ether,
        0.5 ether,
        0.1 ether,
        0.05 ether,
        0.01 ether,
        0.005 ether,
        0.001 ether
    ];

    modifier fromTup() {
        require(msg.sender == address(tup), "Helper: only TUP token contract can call this function");
        _;
    }

    modifier internalOnly() {
        require(isInternal, "Helper: sorry buddy but you do not have access to this function");
        _;
    }

    modifier adjustInternalCondition() {
        isInternal = true;
        _;
        isInternal = false;
    }

    modifier runningArbitrage() {
        if (!isRunningArbitrage) {
            isRunningArbitrage = true;
            _;
            isRunningArbitrage = false;
        }
    }

    constructor(
        address _addressProvider,
        address _exchangeRouterAddress,
        address _tupTokenAddress,
        bool _hasAlternativeSwap,
        address _owner
    ) {
        router = IUniswapV2Router02(_exchangeRouterAddress);
        factory = IUniswapV2Factory(router.factory());
        tup = ITimeIsUp(payable(_tupTokenAddress));
        hasAlternativeSwap = _hasAlternativeSwap;
        if (_owner != msg.sender)
            transferOwnership(_owner);
    }

    function _calculateFee(uint256 amount) internal virtual returns (uint256) {
        return amount + amount.mulDiv(SWAP_FEE, 10_000);
    }

    function _startTraditionalSwap(address asset, uint256 amount) internal virtual returns (bool) {
        return false;
    }

    function _startAlternativeSwap(uint256 amountIn, uint256 amountOut) internal returns (bool) {
        address weth = router.WETH();
        swapSuccessful = false;
        IUniswapV2Pair pair = IUniswapV2Pair(_pairTupEth);
        if (operation == Operation.ETH_TO_TUP_EXTERNAL_TUP_TO_ETH_INTERNAL) {
            uint256 amount0Out = address(tup) == pair.token0() ? amountOut : 0;
            uint256 amount1Out = address(tup) == pair.token1() ? amountOut : 0;
            try pair.swap(amount0Out, amount1Out, address(this), bytes(abi.encode(address(tup), amountOut))) {
                return swapSuccessful;
            } catch {
                return swapSuccessful;
            }
        } else {
            // ETH_TO_TUP_INTERNAL_TUP_TO_ETH_EXTERNAL
            uint256 amount0Out = weth == pair.token0() ? amountIn : 0;
            uint256 amount1Out = weth == pair.token1() ? amountIn : 0;
            try pair.swap(amount0Out, amount1Out, address(this), bytes(abi.encode(weth, amountIn))) {
                return swapSuccessful;
            } catch {
                return swapSuccessful;
            }
        }
    }

    receive() external payable { }

    fallback() external payable {
        require(msg.data.length == 0);
    }

    function _commonCall(address sender, bytes calldata data) internal {
        if (msg.sender == _pairTupEth) {
            if (sender == address(this)) {
                // Operation.ETH_TO_TUP_EXTERNAL_TUP_TO_ETH_INTERNAL
                (address tokenToBorrow, uint256 amountToBorrow) = abi.decode(data, (address, uint256));
                if (tokenToBorrow == address(tup)) {
                    // 1. TUP -> ETH (Internal)
                    try tup.sell(amountToBorrow) {
                        address[] memory path = new address[](2);
                        path[0] = router.WETH();
                        path[1] = address(tup);
                        uint256[] memory amountRequired = router.getAmountsIn(amountToBorrow, path);
                        IWETH(path[0]).deposit{ value: amountRequired[0] }();
                        // 2. ETH -> TUP (External)
                        IERC20(path[0]).transfer(msg.sender, amountRequired[0]);
                        tup.receiveProfit{ value: address(this).balance }();
                        swapSuccessful = true;
                    } catch {
                        swapSuccessful = false;
                        return;
                    }
                } else {
                    // 1. ETH -> TUP (Internal)
                    address weth = router.WETH();
                    IWETH(weth).withdraw(amountToBorrow);
                    try tup.buy{ value: amountToBorrow }() {
                        address[] memory path = new address[](2);
                        path[0] = address(tup);
                        path[1] = weth;
                        uint256[] memory amountRequired = router.getAmountsIn(amountToBorrow, path);
                        // 2. TUP -> ETH (External)
                        IERC20(path[0]).transfer(msg.sender, amountRequired[0]);
                        try tup.returnNative{ value: address(this).balance }() { // We return the pool amount to the contract here
                            try tup.sell(tup.balanceOf(address(this))) {
                                tup.receiveProfit{ value: address(this).balance }();
                                swapSuccessful = true;
                            } catch {
                                swapSuccessful = false;
                                return;
                            }
                        } catch { 
                            swapSuccessful = false;
                            return;
                        }
                    } catch {
                        swapSuccessful = false;
                        return;
                    }
                }
            }
        } else {
            swapSuccessful = false;
            return;
        }
    }

    function _createPair(address asset01, address asset02) internal returns (address pair) {
        pair = factory.getPair(asset01, asset02);
        if (pair == address(0) && asset01 != address(0) && asset02 != address(0)) {
            try factory.createPair(asset01, asset02) returns (address p) {
                pair = p;
            } catch {
                revert();
            }
        }
        return pair;
    }

    function _performOperation(address asset, uint256 amount) internal returns (bool) {
        if (operation == Operation.ETH_TO_TUP_INTERNAL_TUP_TO_ETH_EXTERNAL) {
            IWETH(asset).withdraw(amount); // assumming asset == weth
            try tup.buy{ value: amount }() {
                address[] memory path = new address[](2);
                path[0] = address(tup);
                path[1] = asset;
                uint256 tupAmount = tup.balanceOf(address(this));
                tup.approve(address(router), tupAmount);
                try router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
                    tupAmount,
                    0, // amount,
                    path,
                    address(this),
                    block.timestamp + 300
                ) {
                    return true;
                } catch {
                    return false;
                }
            } catch {
                return false;
            }
        } else {
            address[] memory path = new address[](2);
            path[0] = asset;
            path[1] = address(tup);
            IERC20(asset).approve(address(router), amount);
            try router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
                amount,
                0, //tup.queryAmountInternalLP(amount),
                path,
                address(this),
                block.timestamp + 300
            ) {
                uint256 tupAmount = tup.balanceOf(address(this));
                try tup.sell(tupAmount) {
                    IWETH(asset).deposit{ value: address(this).balance }();
                    return true;
                } catch {
                    return false;
                }
            } catch {
                return false;
            }
        }
    }

    /**
     * @dev Add liquidity for the TUP/ETH pair LP in third party exchange (based on UniswapV2)
     *
     */
    function addLiquidityNative(uint256 tupAmount) external payable fromTup returns (bool) {
        tup.approve(address(router), tupAmount);
        // add liquidity for the TUP/ETH pair
        try router.addLiquidityETH{ value: msg.value }(
            address(tup),
            tupAmount,
            0, // slippage is unavoidable
            0, // slippage is unavoidable
            address(0),
            block.timestamp + 300
        ) {
            return true;
        } catch {
            tup.returnNative{ value: msg.value }();
            return false;
        }
    }

    function checkAndPerformArbitrage() external virtual runningArbitrage fromTup adjustInternalCondition returns (bool) {
        address weth = router.WETH();

        address pair = factory.getPair(address(tup), weth);
        uint256 balanceInternalNative = tup.poolBalance();
        uint256 balanceExternalNative = IERC20(weth).balanceOf(pair);
        uint256 balanceInternalTUP = tup.balanceOf(address(tup));
        uint256 balanceExternalTUP = tup.balanceOf(pair);

        if (balanceInternalNative == 0 || balanceExternalNative == 0) {
            return false;
        }

        uint256 rateInternal = balanceInternalTUP.mulDiv(FACTOR, balanceInternalNative);
        uint256 rateExternal = balanceExternalTUP.mulDiv(FACTOR, balanceExternalNative);

        if (rateExternal == 0 || rateInternal == 0) {
            return false;
        }

        bool shouldPerformArbitrage = (rateExternal > rateInternal)
            ? (rateExternal - rateInternal).mulDiv(10_000, rateExternal) >= ARBITRAGE_RATE
            : (rateInternal - rateExternal).mulDiv(10_000, rateInternal) >= ARBITRAGE_RATE;

        return (shouldPerformArbitrage ? _performArbitrage() : false);
    }

    function _performArbitrage() internal returns (bool success) {
        address weth = router.WETH();

        address[] memory assets_01 = new address[](2);
        assets_01[0] = weth;
        assets_01[1] = address(tup);
        address[] memory assets_02 = new address[](2);
        assets_02[0] = address(tup);
        assets_02[1] = weth;

        uint256[] memory amountOutExternal;
        uint256 amountOutInternal;

        address pair = factory.getPair(address(tup), weth);
        uint256 balanceInternalNative = tup.poolBalance();
        uint256 balanceExternalNative = IERC20(weth).balanceOf(pair);
        uint256 balanceInternalTUP = tup.balanceOf(address(tup));
        uint256 balanceExternalTUP = tup.balanceOf(pair);

        // getAmountsIn (amountOut, path) --> Given an amountOut value of path[1] token, it will tell us how many path[0] tokens we send
        // getAmountsOut(amountIn,  path) --> Given an amountIn  value of path[0] token, it will tell us how many path[1] tokens we receive
        for (uint256 i = 0; i < rangesWETH.length; i++) {
            amountOutExternal = router.getAmountsOut(rangesWETH[i], assets_01);
            amountOutInternal = tup.queryNativeAmount(amountOutExternal[1]);
            uint256 totalWithFee = _calculateFee(rangesWETH[i]);
            if (amountOutInternal <= totalWithFee) {
                amountOutInternal = tup.queryAmountOptimal(rangesWETH[i]);
                amountOutExternal = router.getAmountsOut(amountOutInternal, assets_02);
                if (amountOutExternal[1] > totalWithFee) {
                    // perform arbitrage here - Option #1 - Buy TUP LP Internal and Sell TUP LP External
                    if (balanceExternalNative >= amountOutExternal[1] && balanceInternalTUP >= amountOutInternal) {
                        operation = Operation.ETH_TO_TUP_INTERNAL_TUP_TO_ETH_EXTERNAL;
                        if (!hasAlternativeSwap) {
                            success = _startTraditionalSwap(weth, rangesWETH[i]);
                            if (!success) {
                                success = _startAlternativeSwap(rangesWETH[i], amountOutInternal);
                            }
                        } else {
                            success = _startAlternativeSwap(rangesWETH[i], amountOutInternal);
                        }
                        if (success) {
                            break;
                        }
                    }
                }
            } else {
                // perform arbitrage here - Option #2 - Buy TUP LP External and Sell TUP LP Internal
                if (balanceInternalNative >= amountOutInternal && balanceExternalTUP >= amountOutExternal[1]) {
                    operation = Operation.ETH_TO_TUP_EXTERNAL_TUP_TO_ETH_INTERNAL;
                    if (!hasAlternativeSwap) {
                        success = _startTraditionalSwap(weth, rangesWETH[i]);
                        if (!success) {
                            success = _startAlternativeSwap(rangesWETH[i], amountOutExternal[1]);
                        }
                    } else {
                        success = _startAlternativeSwap(rangesWETH[i], amountOutExternal[1]);
                    }
                    if (success) {
                        break;
                    }
                }
            }
        }
        return success;
    }

    function pancakeCall(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {
        _commonCall(_sender, _data);
    }

    function pairTupEth() external view returns (address) {
        return _pairTupEth;
    }

    function uniswapV2Call(address _sender, uint256 _amount0, uint256 _amount1, bytes calldata _data) external {
        _commonCall(_sender, _data);
    }

    function queryRate() external view fromTup returns (uint256) {
        address weth = router.WETH();
        uint256 ethBalance = IERC20(weth).balanceOf(_pairTupEth);
        return (ethBalance == 0) ? FACTOR : tup.balanceOf(_pairTupEth).mulDiv(FACTOR, ethBalance);
    }

    function queryPoolAddress() external view virtual returns (address) {
        return address(0);
    }

    function setTup(address tupAddress) external virtual onlyOwner {
        tup = ITimeIsUp(payable(tupAddress));
        _pairTupEth = _createPair(address(tup), router.WETH());
    }
}

File 5 of 18 : IFlashLoanSimpleReceiver.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

import {IPoolAddressesProvider} from '../../interfaces/IPoolAddressesProvider.sol';
import {IPool} from '../../interfaces/IPool.sol';

/**
 * @title IFlashLoanSimpleReceiver
 * @author Aave
 * @notice Defines the basic interface of a flashloan-receiver contract.
 * @dev Implement this interface to develop a flashloan-compatible flashLoanReceiver contract
 */
interface IFlashLoanSimpleReceiver {
  /**
   * @notice Executes an operation after receiving the flash-borrowed asset
   * @dev Ensure that the contract can return the debt + premium, e.g., has
   *      enough funds to repay and has approved the Pool to pull the total amount
   * @param asset The address of the flash-borrowed asset
   * @param amount The amount of the flash-borrowed asset
   * @param premium The fee of the flash-borrowed asset
   * @param initiator The address of the flashloan initiator
   * @param params The byte-encoded params passed when initiating the flashloan
   * @return True if the execution of the operation succeeds, false otherwise
   */
  function executeOperation(
    address asset,
    uint256 amount,
    uint256 premium,
    address initiator,
    bytes calldata params
  ) external returns (bool);

  function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);

  function POOL() external view returns (IPool);
}

File 6 of 18 : IPool.sol
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.0;

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

/**
 * @title IPool
 * @author Aave
 * @notice Defines the basic interface for an Aave Pool.
 */
interface IPool {
  /**
   * @dev Emitted on mintUnbacked()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address initiating the supply
   * @param onBehalfOf The beneficiary of the supplied assets, receiving the aTokens
   * @param amount The amount of supplied assets
   * @param referralCode The referral code used
   */
  event MintUnbacked(
    address indexed reserve,
    address user,
    address indexed onBehalfOf,
    uint256 amount,
    uint16 indexed referralCode
  );

  /**
   * @dev Emitted on backUnbacked()
   * @param reserve The address of the underlying asset of the reserve
   * @param backer The address paying for the backing
   * @param amount The amount added as backing
   * @param fee The amount paid in fees
   */
  event BackUnbacked(address indexed reserve, address indexed backer, uint256 amount, uint256 fee);

  /**
   * @dev Emitted on supply()
   * @param reserve The address of the underlying asset of the reserve
   * @param user The address initiating the supply
   * @param onBehalfOf The beneficiary of the supply, receiving the aTokens
   * @param amount The amount supplied
   * @param referralCode The referral code used
   */
  event Supply(
    address indexed reserve,
    address user,
    address indexed onBehalfOf,
    uint256 amount,
    uint16 indexed referralCode
  );

  /**
   * @dev Emitted on withdraw()
   * @param reserve The address of the underlying asset being withdrawn
   * @param user The address initiating the withdrawal, owner of aTokens
   * @param to The 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 interestRateMode The rate mode: 1 for Stable, 2 for Variable
   * @param borrowRate The numeric rate at which the user has borrowed, expressed in ray
   * @param referralCode The referral code used
   */
  event Borrow(
    address indexed reserve,
    address user,
    address indexed onBehalfOf,
    uint256 amount,
    DataTypes.InterestRateMode interestRateMode,
    uint256 borrowRate,
    uint16 indexed referralCode
  );

  /**
   * @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
   * @param useATokens True if the repayment is done using aTokens, `false` if done with underlying asset directly
   */
  event Repay(
    address indexed reserve,
    address indexed user,
    address indexed repayer,
    uint256 amount,
    bool useATokens
  );

  /**
   * @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 interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
   */
  event SwapBorrowRateMode(
    address indexed reserve,
    address indexed user,
    DataTypes.InterestRateMode interestRateMode
  );

  /**
   * @dev Emitted on borrow(), repay() and liquidationCall() when using isolated assets
   * @param asset The address of the underlying asset of the reserve
   * @param totalDebt The total isolation mode debt for the reserve
   */
  event IsolationModeTotalDebtUpdated(address indexed asset, uint256 totalDebt);

  /**
   * @dev Emitted when the user selects a certain asset category for eMode
   * @param user The address of the user
   * @param categoryId The category id
   */
  event UserEModeSet(address indexed user, uint8 categoryId);

  /**
   * @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 interestRateMode The flashloan mode: 0 for regular flashloan, 1 for Stable debt, 2 for Variable debt
   * @param premium The fee flash borrowed
   * @param referralCode The referral code used
   */
  event FlashLoan(
    address indexed target,
    address initiator,
    address indexed asset,
    uint256 amount,
    DataTypes.InterestRateMode interestRateMode,
    uint256 premium,
    uint16 indexed referralCode
  );

  /**
   * @dev Emitted when a borrower is liquidated.
   * @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 liquidator
   * @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.
   * @param reserve The address of the underlying asset of the reserve
   * @param liquidityRate The next liquidity rate
   * @param stableBorrowRate The next stable borrow rate
   * @param variableBorrowRate The next variable borrow rate
   * @param liquidityIndex The next liquidity index
   * @param variableBorrowIndex The next variable borrow index
   */
  event ReserveDataUpdated(
    address indexed reserve,
    uint256 liquidityRate,
    uint256 stableBorrowRate,
    uint256 variableBorrowRate,
    uint256 liquidityIndex,
    uint256 variableBorrowIndex
  );

  /**
   * @dev Emitted when the protocol treasury receives minted aTokens from the accrued interest.
   * @param reserve The address of the reserve
   * @param amountMinted The amount minted to the treasury
   */
  event MintedToTreasury(address indexed reserve, uint256 amountMinted);

  /**
   * @notice Mints an `amount` of aTokens to the `onBehalfOf`
   * @param asset The address of the underlying asset to mint
   * @param amount The amount to mint
   * @param onBehalfOf The address that will receive the aTokens
   * @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 mintUnbacked(
    address asset,
    uint256 amount,
    address onBehalfOf,
    uint16 referralCode
  ) external;

  /**
   * @notice Back the current unbacked underlying with `amount` and pay `fee`.
   * @param asset The address of the underlying asset to back
   * @param amount The amount to back
   * @param fee The amount paid in fees
   * @return The backed amount
   */
  function backUnbacked(
    address asset,
    uint256 amount,
    uint256 fee
  ) external returns (uint256);

  /**
   * @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
   * - E.g. User supplies 100 USDC and gets in return 100 aUSDC
   * @param asset The address of the underlying asset to supply
   * @param amount The amount to be supplied
   * @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 supply(
    address asset,
    uint256 amount,
    address onBehalfOf,
    uint16 referralCode
  ) external;

  /**
   * @notice Supply with transfer approval of asset to be supplied done via permit function
   * see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
   * @param asset The address of the underlying asset to supply
   * @param amount The amount to be supplied
   * @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 deadline The deadline timestamp that the permit is valid
   * @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 permitV The V parameter of ERC712 permit sig
   * @param permitR The R parameter of ERC712 permit sig
   * @param permitS The S parameter of ERC712 permit sig
   */
  function supplyWithPermit(
    address asset,
    uint256 amount,
    address onBehalfOf,
    uint16 referralCode,
    uint256 deadline,
    uint8 permitV,
    bytes32 permitR,
    bytes32 permitS
  ) external;

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

  /**
   * @notice Allows users to borrow a specific `amount` of the reserve underlying asset, provided that the borrower
   * already supplied 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 The 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 The 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 interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
   * @param onBehalfOf The 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 interestRateMode,
    address onBehalfOf
  ) external returns (uint256);

  /**
   * @notice Repay with transfer approval of asset to be repaid done via permit function
   * see: https://eips.ethereum.org/EIPS/eip-2612 and https://eips.ethereum.org/EIPS/eip-713
   * @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 interestRateMode 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
   * @param deadline The deadline timestamp that the permit is valid
   * @param permitV The V parameter of ERC712 permit sig
   * @param permitR The R parameter of ERC712 permit sig
   * @param permitS The S parameter of ERC712 permit sig
   * @return The final amount repaid
   */
  function repayWithPermit(
    address asset,
    uint256 amount,
    uint256 interestRateMode,
    address onBehalfOf,
    uint256 deadline,
    uint8 permitV,
    bytes32 permitR,
    bytes32 permitS
  ) external returns (uint256);

  /**
   * @notice Repays a borrowed `amount` on a specific reserve using the reserve aTokens, burning the
   * equivalent debt tokens
   * - E.g. User repays 100 USDC using 100 aUSDC, burning 100 variable/stable debt tokens
   * @dev  Passing uint256.max as amount will clean up any residual aToken dust balance, if the user aToken
   * balance is not enough to cover the whole debt
   * @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 interestRateMode The interest rate mode at of the debt the user wants to repay: 1 for Stable, 2 for Variable
   * @return The final amount repaid
   */
  function repayWithATokens(
    address asset,
    uint256 amount,
    uint256 interestRateMode
  ) external returns (uint256);

  /**
   * @notice Allows a borrower to swap his debt between stable and variable mode, or vice versa
   * @param asset The address of the underlying asset borrowed
   * @param interestRateMode The current interest rate mode of the position being swapped: 1 for Stable, 2 for Variable
   */
  function swapBorrowRateMode(address asset, uint256 interestRateMode) external;

  /**
   * @notice 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 supply APY is below REBALANCE_UP_THRESHOLD * maxVariableBorrowRate, which means that too
   *        much has been borrowed at a stable rate and suppliers 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;

  /**
   * @notice Allows suppliers to enable/disable a specific supplied asset as collateral
   * @param asset The address of the underlying asset supplied
   * @param useAsCollateral True if the user wants to use the supply as collateral, false otherwise
   */
  function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;

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

  /**
   * @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
   * as long as the amount taken plus a fee is returned.
   * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
   * into consideration. For further details please visit https://docs.aave.com/developers/
   * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanReceiver interface
   * @param assets The addresses of the assets being flash-borrowed
   * @param amounts The amounts of the assets being flash-borrowed
   * @param interestRateModes 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 The 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 interestRateModes,
    address onBehalfOf,
    bytes calldata params,
    uint16 referralCode
  ) external;

  /**
   * @notice Allows smartcontracts to access the liquidity of the pool within one transaction,
   * as long as the amount taken plus a fee is returned.
   * @dev IMPORTANT There are security concerns for developers of flashloan receiver contracts that must be kept
   * into consideration. For further details please visit https://docs.aave.com/developers/
   * @param receiverAddress The address of the contract receiving the funds, implementing IFlashLoanSimpleReceiver interface
   * @param asset The address of the asset being flash-borrowed
   * @param amount The amount of the asset being flash-borrowed
   * @param params Variadic packed params to pass to the receiver as extra information
   * @param referralCode The 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 flashLoanSimple(
    address receiverAddress,
    address asset,
    uint256 amount,
    bytes calldata params,
    uint16 referralCode
  ) external;

  /**
   * @notice Returns the user account data across all the reserves
   * @param user The address of the user
   * @return totalCollateralBase The total collateral of the user in the base currency used by the price feed
   * @return totalDebtBase The total debt of the user in the base currency used by the price feed
   * @return availableBorrowsBase The borrowing power left of the user in the base currency used by the price feed
   * @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 totalCollateralBase,
      uint256 totalDebtBase,
      uint256 availableBorrowsBase,
      uint256 currentLiquidationThreshold,
      uint256 ltv,
      uint256 healthFactor
    );

  /**
   * @notice Initializes a reserve, activating it, assigning an aToken and debt tokens and an
   * interest rate strategy
   * @dev Only callable by the PoolConfigurator contract
   * @param asset The address of the underlying asset of the reserve
   * @param aTokenAddress The address of the aToken that will be assigned to the reserve
   * @param stableDebtAddress The address of the StableDebtToken that will be assigned to the reserve
   * @param variableDebtAddress The address of the VariableDebtToken that will be assigned to the reserve
   * @param interestRateStrategyAddress The address of the interest rate strategy contract
   */
  function initReserve(
    address asset,
    address aTokenAddress,
    address stableDebtAddress,
    address variableDebtAddress,
    address interestRateStrategyAddress
  ) external;

  /**
   * @notice Drop a reserve
   * @dev Only callable by the PoolConfigurator contract
   * @param asset The address of the underlying asset of the reserve
   */
  function dropReserve(address asset) external;

  /**
   * @notice Updates the address of the interest rate strategy contract
   * @dev Only callable by the PoolConfigurator contract
   * @param asset The address of the underlying asset of the reserve
   * @param rateStrategyAddress The address of the interest rate strategy contract
   */
  function setReserveInterestRateStrategyAddress(address asset, address rateStrategyAddress)
    external;

  /**
   * @notice Sets the configuration bitmap of the reserve as a whole
   * @dev Only callable by the PoolConfigurator contract
   * @param asset The address of the underlying asset of the reserve
   * @param configuration The new configuration bitmap
   */
  function setConfiguration(address asset, DataTypes.ReserveConfigurationMap calldata configuration)
    external;

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

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

  /**
   * @notice Returns the 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);

  /**
   * @notice Returns the normalized variable debt per unit of asset
   * @dev WARNING: This function is intended to be used primarily by the protocol itself to get a
   * "dynamic" variable index based on time, current stored index and virtual rate at the current
   * moment (approx. a borrower would get if opening a position). This means that is always used in
   * combination with variable debt supply/balances.
   * If using this function externally, consider that is possible to have an increasing normalized
   * variable debt that is not equivalent to how the variable debt index would be updated in storage
   * (e.g. only updates with non-zero variable debt supply)
   * @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);

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

  /**
   * @notice Validates and finalizes an aToken transfer
   * @dev Only callable by the overlying aToken of the `asset`
   * @param asset The address of the underlying asset of the aToken
   * @param from The user from which the aTokens are transferred
   * @param to The user receiving the aTokens
   * @param amount The amount being transferred/withdrawn
   * @param balanceFromBefore The aToken balance of the `from` user before the transfer
   * @param balanceToBefore The aToken balance of the `to` user before the transfer
   */
  function finalizeTransfer(
    address asset,
    address from,
    address to,
    uint256 amount,
    uint256 balanceFromBefore,
    uint256 balanceToBefore
  ) external;

  /**
   * @notice Returns the list of the underlying assets of all the initialized reserves
   * @dev It does not include dropped reserves
   * @return The addresses of the underlying assets of the initialized reserves
   */
  function getReservesList() external view returns (address[] memory);

  /**
   * @notice Returns the address of the underlying asset of a reserve by the reserve id as stored in the DataTypes.ReserveData struct
   * @param id The id of the reserve as stored in the DataTypes.ReserveData struct
   * @return The address of the reserve associated with id
   */
  function getReserveAddressById(uint16 id) external view returns (address);

  /**
   * @notice Returns the PoolAddressesProvider connected to this contract
   * @return The address of the PoolAddressesProvider
   */
  function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider);

  /**
   * @notice Updates the protocol fee on the bridging
   * @param bridgeProtocolFee The part of the premium sent to the protocol treasury
   */
  function updateBridgeProtocolFee(uint256 bridgeProtocolFee) external;

  /**
   * @notice Updates flash loan premiums. Flash loan premium consists of two parts:
   * - A part is sent to aToken holders as extra, one time accumulated interest
   * - A part is collected by the protocol treasury
   * @dev The total premium is calculated on the total borrowed amount
   * @dev The premium to protocol is calculated on the total premium, being a percentage of `flashLoanPremiumTotal`
   * @dev Only callable by the PoolConfigurator contract
   * @param flashLoanPremiumTotal The total premium, expressed in bps
   * @param flashLoanPremiumToProtocol The part of the premium sent to the protocol treasury, expressed in bps
   */
  function updateFlashloanPremiums(
    uint128 flashLoanPremiumTotal,
    uint128 flashLoanPremiumToProtocol
  ) external;

  /**
   * @notice Configures a new category for the eMode.
   * @dev In eMode, the protocol allows very high borrowing power to borrow assets of the same category.
   * The category 0 is reserved as it's the default for volatile assets
   * @param id The id of the category
   * @param config The configuration of the category
   */
  function configureEModeCategory(uint8 id, DataTypes.EModeCategory memory config) external;

  /**
   * @notice Returns the data of an eMode category
   * @param id The id of the category
   * @return The configuration data of the category
   */
  function getEModeCategoryData(uint8 id) external view returns (DataTypes.EModeCategory memory);

  /**
   * @notice Allows a user to use the protocol in eMode
   * @param categoryId The id of the category
   */
  function setUserEMode(uint8 categoryId) external;

  /**
   * @notice Returns the eMode the user is using
   * @param user The address of the user
   * @return The eMode id
   */
  function getUserEMode(address user) external view returns (uint256);

  /**
   * @notice Resets the isolation mode total debt of the given asset to zero
   * @dev It requires the given asset has zero debt ceiling
   * @param asset The address of the underlying asset to reset the isolationModeTotalDebt
   */
  function resetIsolationModeTotalDebt(address asset) external;

  /**
   * @notice Returns the percentage of available liquidity that can be borrowed at once at stable rate
   * @return The percentage of available liquidity to borrow, expressed in bps
   */
  function MAX_STABLE_RATE_BORROW_SIZE_PERCENT() external view returns (uint256);

  /**
   * @notice Returns the total fee on flash loans
   * @return The total fee on flashloans
   */
  function FLASHLOAN_PREMIUM_TOTAL() external view returns (uint128);

  /**
   * @notice Returns the part of the bridge fees sent to protocol
   * @return The bridge fee sent to the protocol treasury
   */
  function BRIDGE_PROTOCOL_FEE() external view returns (uint256);

  /**
   * @notice Returns the part of the flashloan fees sent to protocol
   * @return The flashloan fee sent to the protocol treasury
   */
  function FLASHLOAN_PREMIUM_TO_PROTOCOL() external view returns (uint128);

  /**
   * @notice Returns the maximum number of reserves supported to be listed in this Pool
   * @return The maximum number of reserves supported
   */
  function MAX_NUMBER_RESERVES() external view returns (uint16);

  /**
   * @notice Mints the assets accrued through the reserve factor to the treasury in the form of aTokens
   * @param assets The list of reserves for which the minting needs to be executed
   */
  function mintToTreasury(address[] calldata assets) external;

  /**
   * @notice Rescue and transfer tokens locked in this contract
   * @param token The address of the token
   * @param to The address of the recipient
   * @param amount The amount of token to transfer
   */
  function rescueTokens(
    address token,
    address to,
    uint256 amount
  ) external;

  /**
   * @notice Supplies an `amount` of underlying asset into the reserve, receiving in return overlying aTokens.
   * - E.g. User supplies 100 USDC and gets in return 100 aUSDC
   * @dev Deprecated: Use the `supply` function instead
   * @param asset The address of the underlying asset to supply
   * @param amount The amount to be supplied
   * @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;
}

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

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 8 of 18 : 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 9 of 18 : 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 10 of 18 : ITimeIsUp.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;

interface ITimeIsUp {
    function FLASH_MINT_FEE() external view returns (uint256);
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
    function accountShareBalance(address account) external view returns (uint256);
    function burn(uint256 amount) external;
    function mint(uint256 timeAmount) external payable;
    function queryAmountExternalLP(uint256 amountNative) external view returns (uint256);
    function queryAmountInternalLP(uint256 amountNative) external view returns (uint256);
    function queryAmountOptimal(uint256 amountNative) external view returns (uint256);
    function queryNativeAmount(uint256 d2Amount) external view returns (uint256);
    function queryNativeFromTimeAmount(uint256 timeAmount) external view returns (uint256);
    function queryPriceNative(uint256 amountNative) external view returns (uint256);
    function queryPriceInverse(uint256 d2Amount) external view returns (uint256);
    function queryRate() external view returns (uint256);
    function queryPublicReward() external view returns (uint256);
    function returnNative() external payable returns (bool);
    function splitSharesWithReward() external;
    function buy() external payable returns (bool success);
    function sell(uint256 d2Amount) external returns (bool success);
    function flashMint(uint256 d2AmountToBorrow, bytes calldata data) external;
    function payFlashMintFee() external payable;
    function poolBalance() external view returns (uint256);
    function toBeShared() external view returns (uint256);
    function receiveProfit() external payable;
}

File 11 of 18 : IHelperBase.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.10;

interface IHelperBase {
    function addLiquidityNative(uint256 tupAmount) external payable returns (bool);
    function checkAndPerformArbitrage() external returns (bool);
    function pairTupEth() external view returns (address);
    function queryRate() external view returns (uint256);
    function queryPoolAddress() external view returns (address);
    function setTup(address tupAddress) external;
}

File 12 of 18 : IUniswapV2Factory.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint256);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint256) external view returns (address pair);
    function allPairsLength() external view returns (uint256);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 13 of 18 : IUniswapV2Router02.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import "./IUniswapV2Router01.sol";

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;
    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable;
    function swapExactAVAXForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;
    function swapExactTokensForAVAXSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;
}

File 14 of 18 : IUniswapV2Pair.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint256);
    function balanceOf(address owner) external view returns (uint256);
    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);
    function transfer(address to, uint256 value) external returns (bool);
    function transferFrom(address from, address to, uint256 value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint256);

    function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
        external;

    function MINIMUM_LIQUIDITY() external pure returns (uint256);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint256);
    function price1CumulativeLast() external view returns (uint256);
    function kLast() external view returns (uint256);

    function mint(address to) external returns (uint256 liquidity);
    function burn(address to) external returns (uint256 amount0, uint256 amount1);
    function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 15 of 18 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;

interface IWETH {
    function approve(address to, uint256 amount) external returns (bool);
    function deposit() external payable;
    function mint(address to, uint256 value) external returns (bool);
    function transfer(address to, uint256 value) external returns (bool);
    function withdraw(uint256) external;
}

File 16 of 18 : DataTypes.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

library DataTypes {
  struct ReserveData {
    //stores the reserve configuration
    ReserveConfigurationMap configuration;
    //the liquidity index. Expressed in ray
    uint128 liquidityIndex;
    //the current supply rate. Expressed in ray
    uint128 currentLiquidityRate;
    //variable borrow index. Expressed in ray
    uint128 variableBorrowIndex;
    //the current variable borrow rate. Expressed in ray
    uint128 currentVariableBorrowRate;
    //the current stable borrow rate. Expressed in ray
    uint128 currentStableBorrowRate;
    //timestamp of last update
    uint40 lastUpdateTimestamp;
    //the id of the reserve. Represents the position in the list of the active reserves
    uint16 id;
    //aToken address
    address aTokenAddress;
    //stableDebtToken address
    address stableDebtTokenAddress;
    //variableDebtToken address
    address variableDebtTokenAddress;
    //address of the interest rate strategy
    address interestRateStrategyAddress;
    //the current treasury balance, scaled
    uint128 accruedToTreasury;
    //the outstanding unbacked aTokens minted through the bridging feature
    uint128 unbacked;
    //the outstanding debt borrowed against this asset in isolation mode
    uint128 isolationModeTotalDebt;
  }

  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: asset is paused
    //bit 61: borrowing in isolation mode is enabled
    //bit 62-63: reserved
    //bit 64-79: reserve factor
    //bit 80-115 borrow cap in whole tokens, borrowCap == 0 => no cap
    //bit 116-151 supply cap in whole tokens, supplyCap == 0 => no cap
    //bit 152-167 liquidation protocol fee
    //bit 168-175 eMode category
    //bit 176-211 unbacked mint cap in whole tokens, unbackedMintCap == 0 => minting disabled
    //bit 212-251 debt ceiling for isolation mode with (ReserveConfiguration::DEBT_CEILING_DECIMALS) decimals
    //bit 252-255 unused

    uint256 data;
  }

  struct UserConfigurationMap {
    /**
     * @dev Bitmap of the users collaterals and borrows. It is divided in pairs of bits, one pair per asset.
     * The first bit indicates if an asset is used as collateral by the user, the second whether an
     * asset is borrowed by the user.
     */
    uint256 data;
  }

  struct EModeCategory {
    // each eMode category has a custom ltv and liquidation threshold
    uint16 ltv;
    uint16 liquidationThreshold;
    uint16 liquidationBonus;
    // each eMode category may or may not have a custom oracle to override the individual assets price oracles
    address priceSource;
    string label;
  }

  enum InterestRateMode {
    NONE,
    STABLE,
    VARIABLE
  }

  struct ReserveCache {
    uint256 currScaledVariableDebt;
    uint256 nextScaledVariableDebt;
    uint256 currPrincipalStableDebt;
    uint256 currAvgStableBorrowRate;
    uint256 currTotalStableDebt;
    uint256 nextAvgStableBorrowRate;
    uint256 nextTotalStableDebt;
    uint256 currLiquidityIndex;
    uint256 nextLiquidityIndex;
    uint256 currVariableBorrowIndex;
    uint256 nextVariableBorrowIndex;
    uint256 currLiquidityRate;
    uint256 currVariableBorrowRate;
    uint256 reserveFactor;
    ReserveConfigurationMap reserveConfiguration;
    address aTokenAddress;
    address stableDebtTokenAddress;
    address variableDebtTokenAddress;
    uint40 reserveLastUpdateTimestamp;
    uint40 stableDebtLastUpdateTimestamp;
  }

  struct ExecuteLiquidationCallParams {
    uint256 reservesCount;
    uint256 debtToCover;
    address collateralAsset;
    address debtAsset;
    address user;
    bool receiveAToken;
    address priceOracle;
    uint8 userEModeCategory;
    address priceOracleSentinel;
  }

  struct ExecuteSupplyParams {
    address asset;
    uint256 amount;
    address onBehalfOf;
    uint16 referralCode;
  }

  struct ExecuteBorrowParams {
    address asset;
    address user;
    address onBehalfOf;
    uint256 amount;
    InterestRateMode interestRateMode;
    uint16 referralCode;
    bool releaseUnderlying;
    uint256 maxStableRateBorrowSizePercent;
    uint256 reservesCount;
    address oracle;
    uint8 userEModeCategory;
    address priceOracleSentinel;
  }

  struct ExecuteRepayParams {
    address asset;
    uint256 amount;
    InterestRateMode interestRateMode;
    address onBehalfOf;
    bool useATokens;
  }

  struct ExecuteWithdrawParams {
    address asset;
    uint256 amount;
    address to;
    uint256 reservesCount;
    address oracle;
    uint8 userEModeCategory;
  }

  struct ExecuteSetUserEModeParams {
    uint256 reservesCount;
    address oracle;
    uint8 categoryId;
  }

  struct FinalizeTransferParams {
    address asset;
    address from;
    address to;
    uint256 amount;
    uint256 balanceFromBefore;
    uint256 balanceToBefore;
    uint256 reservesCount;
    address oracle;
    uint8 fromEModeCategory;
  }

  struct FlashloanParams {
    address receiverAddress;
    address[] assets;
    uint256[] amounts;
    uint256[] interestRateModes;
    address onBehalfOf;
    bytes params;
    uint16 referralCode;
    uint256 flashLoanPremiumToProtocol;
    uint256 flashLoanPremiumTotal;
    uint256 maxStableRateBorrowSizePercent;
    uint256 reservesCount;
    address addressesProvider;
    uint8 userEModeCategory;
    bool isAuthorizedFlashBorrower;
  }

  struct FlashloanSimpleParams {
    address receiverAddress;
    address asset;
    uint256 amount;
    bytes params;
    uint16 referralCode;
    uint256 flashLoanPremiumToProtocol;
    uint256 flashLoanPremiumTotal;
  }

  struct FlashLoanRepaymentParams {
    uint256 amount;
    uint256 totalPremium;
    uint256 flashLoanPremiumToProtocol;
    address asset;
    address receiverAddress;
    uint16 referralCode;
  }

  struct CalculateUserAccountDataParams {
    UserConfigurationMap userConfig;
    uint256 reservesCount;
    address user;
    address oracle;
    uint8 userEModeCategory;
  }

  struct ValidateBorrowParams {
    ReserveCache reserveCache;
    UserConfigurationMap userConfig;
    address asset;
    address userAddress;
    uint256 amount;
    InterestRateMode interestRateMode;
    uint256 maxStableLoanPercent;
    uint256 reservesCount;
    address oracle;
    uint8 userEModeCategory;
    address priceOracleSentinel;
    bool isolationModeActive;
    address isolationModeCollateralAddress;
    uint256 isolationModeDebtCeiling;
  }

  struct ValidateLiquidationCallParams {
    ReserveCache debtReserveCache;
    uint256 totalDebt;
    uint256 healthFactor;
    address priceOracleSentinel;
  }

  struct CalculateInterestRatesParams {
    uint256 unbacked;
    uint256 liquidityAdded;
    uint256 liquidityTaken;
    uint256 totalStableDebt;
    uint256 totalVariableDebt;
    uint256 averageStableBorrowRate;
    uint256 reserveFactor;
    address reserve;
    address aToken;
  }

  struct InitReserveParams {
    address asset;
    address aTokenAddress;
    address stableDebtAddress;
    address variableDebtAddress;
    address interestRateStrategyAddress;
    uint16 reservesCount;
    uint16 maxNumberReserves;
  }
}

File 17 of 18 : 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 18 of 18 : IUniswapV2Router01.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IUniswapV2Router01 {
    function defaultFactory() external pure returns (address);
    function factory() external pure returns (address);
    function factoryV2() external pure returns (address);
    function WETH() external pure returns (address);
    function weth() external pure returns (address);
    function WCELO() external pure returns (address);
    function WETH9() external pure returns (address);
    function WAVAX() external pure returns (address);
    function WHT() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB, uint256 liquidity);
    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB);
    function removeLiquidityETH(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountToken, uint256 amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountA, uint256 amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountToken, uint256 amountETH);
    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);
    function swapTokensForExactTokens(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);
    function swapExactETHForTokens(uint256 amountOutMin, address[] calldata path, address to, uint256 deadline)
        external
        payable
        returns (uint256[] memory amounts);
    function swapTokensForExactETH(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);
    function swapExactTokensForETH(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);
    function swapETHForExactTokens(uint256 amountOut, address[] calldata path, address to, uint256 deadline)
        external
        payable
        returns (uint256[] memory amounts);

    function quote(uint256 amountA, uint256 reserveA, uint256 reserveB) external pure returns (uint256 amountB);
    function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut)
        external
        pure
        returns (uint256 amountOut);
    function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut)
        external
        pure
        returns (uint256 amountIn);
    function getAmountsOut(uint256 amountIn, address[] calldata path)
        external
        view
        returns (uint256[] memory amounts);
    function getAmountsIn(uint256 amountOut, address[] calldata path)
        external
        view
        returns (uint256[] memory amounts);
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@aave/=node_modules/@aave/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@layerzerolabs/=node_modules/@layerzerolabs/",
    "@uniswap/=node_modules/@uniswap/",
    "RMPL/=lib/RMPL/",
    "ampl/=lib/ampl/",
    "base64-sol/=node_modules/base64-sol/",
    "hardhat-deploy/=node_modules/hardhat-deploy/",
    "rdnt/=lib/rdnt/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 5000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_addressProvider","type":"address"},{"internalType":"address","name":"_exchangeRouterAddress","type":"address"},{"internalType":"address","name":"_tupTokenAddress","type":"address"},{"internalType":"bool","name":"_hasAlternativeSwap","type":"bool"},{"internalType":"address","name":"_owner","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"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"ADDRESSES_PROVIDER","outputs":[{"internalType":"contract IPoolAddressesProvider","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOL","outputs":[{"internalType":"contract IPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tupAmount","type":"uint256"}],"name":"addLiquidityNative","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"checkAndPerformArbitrage","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"address","name":"initiator","type":"address"},{"internalType":"bytes","name":"params","type":"bytes"}],"name":"executeOperation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pairTupEth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_amount0","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"pancakeCall","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"queryPoolAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"queryRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tupAddress","type":"address"}],"name":"setTup","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint256","name":"_amount0","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"uniswapV2Call","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6103a06040526a295be96e6406697200000060e09081526a084595161401484a000000610100526a0422ca8b0a00a4250000006101205269d3c21bcecceda1000000610140526969e10de76676d08000006101605269152d02c7e14af680000061018052690a968163f0a57b4000006101a05269021e19e0c9bab24000006101c05269010f0cf064dd592000006101e052683635c9adc5dea0000061020052681b1ae4d6e2ef5000006102205268056bc75e2d63100000610240526802b5e3af16b188000061026052678ac7230489e8000061028052674563918244f400006102a052670de0b6b3a76400006102c0526706f05b59d3b200006102e05267016345785d8a00006103005266b1a2bc2ec5000061032052662386f26fc10000610340526611c37937e080006103605266038d7ea4c68000610380526200014990600590601662000420565b503480156200015757600080fd5b5060405162003e9238038062003e928339810160408190526200017a91620004a2565b8480858585856200018b33620002ef565b600180546001600160a01b0319166001600160a01b0386169081179091556040805163c45a015560e01b8152905163c45a0155916004808201926020929091908290030181865afa158015620001e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020b919062000518565b600280546001600160a01b03199081166001600160a01b0393841617909155600380549091168583161790558215156080523390821614620002525762000252816200033f565b5050505050806001600160a01b031660a0816001600160a01b031681525050806001600160a01b031663026b1d5f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002d6919062000518565b6001600160a01b031660c052506200053d945050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b62000349620003c2565b6001600160a01b038116620003b45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b620003bf81620002ef565b50565b6000546001600160a01b031633146200041e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401620003ab565b565b82601681019282156200045c579160200282015b828111156200045c57825182906001600160581b031690559160200191906001019062000434565b506200046a9291506200046e565b5090565b5b808211156200046a57600081556001016200046f565b80516001600160a01b03811681146200049d57600080fd5b919050565b600080600080600060a08688031215620004bb57600080fd5b620004c68662000485565b9450620004d66020870162000485565b9350620004e66040870162000485565b925060608601518015158114620004fc57600080fd5b91506200050c6080870162000485565b90509295509295909350565b6000602082840312156200052b57600080fd5b620005368262000485565b9392505050565b60805160a05160c0516138fb62000597600039600081816101040152818161021f0152818161077a01528181612d4d0152612e4401526000610153015260008181612b4f01528181612c5a0152612d2501526138fb6000f3fe6080604052600436106100e15760003560e01c80637535d2461161007f57806395d18a131161005957806395d18a131461025f578063a840a4f514610282578063c6cc93a114610297578063f2fde38b146102b5576100e8565b80637535d2461461020d57806384800812146101755780638da5cb5b14610241576100e8565b806315496ef5116100bb57806315496ef5146101955780631b11d0ff146101b85780632ea77103146101d8578063715018a6146101f8576100e8565b806303bc95a0146100f55780630542975c1461014157806310d1e85c14610175576100e8565b366100e857005b36156100f357600080fd5b005b34801561010157600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014d57600080fd5b506101247f000000000000000000000000000000000000000000000000000000000000000081565b34801561018157600080fd5b506100f3610190366004613346565b6102d5565b6101a86101a33660046133b0565b6102e7565b6040519015158152602001610138565b3480156101c457600080fd5b506101a86101d33660046133c9565b610562565b3480156101e457600080fd5b506100f36101f3366004613445565b610806565b34801561020457600080fd5b506100f3610909565b34801561021957600080fd5b506101247f000000000000000000000000000000000000000000000000000000000000000081565b34801561024d57600080fd5b506000546001600160a01b0316610124565b34801561026b57600080fd5b5061027461091d565b604051908152602001610138565b34801561028e57600080fd5b506101a8610b47565b3480156102a357600080fd5b506004546001600160a01b0316610124565b3480156102c157600080fd5b506100f36102d0366004613445565b611054565b6102e08583836110e4565b5050505050565b6003546000906001600160a01b0316331461036f5760405162461bcd60e51b815260206004820152603660248201527f48656c7065723a206f6e6c792054555020746f6b656e20636f6e74726163742060448201527f63616e2063616c6c20746869732066756e6374696f6e0000000000000000000060648201526084015b60405180910390fd5b6003546001546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810185905291169063095ea7b3906044016020604051808303816000875af11580156103dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104019190613462565b506001546003546001600160a01b039182169163f305d71991349116856000808061042e4261012c6134b3565b60405160e089901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b039687166004820152602481019590955260448501939093526064840191909152909216608482015260a481019190915260c40160606040518083038185885af1935050505080156104d0575060408051601f3d908101601f191682019092526104cd918101906134cb565b60015b61055757600360009054906101000a90046001600160a01b03166001600160a01b03166370471f73346040518263ffffffff1660e01b815260040160206040518083038185885af1158015610529573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061054e9190613462565b50600092915050565b506001949350505050565b6000805474010000000000000000000000000000000000000000900460ff166105f35760405162461bcd60e51b815260206004820152603f60248201527f48656c7065723a20736f7272792062756464792062757420796f7520646f206e60448201527f6f7420686176652061636365737320746f20746869732066756e6374696f6e006064820152608401610366565b86600061060087896134b3565b905061060c8989611b6f565b1561074a576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610658573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067c91906134f9565b90506001600160a01b038a16632e1a7d4d6106978484613512565b6040518263ffffffff1660e01b81526004016106b591815260200190565b600060405180830381600087803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b50506003546001600160a01b03169150639c4da9d890506107048484613512565b6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561072f57600080fd5b505af1158015610743573d6000803e3d6000fd5b5050505050505b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301526024820183905283169063095ea7b3906044016020604051808303816000875af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190613462565b5060019998505050505050505050565b61080e61218a565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03838116918217909255600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516108ce94929092169163ad5c4648916004808201926020929091908290030181865afa1580156108a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c99190613529565b6121e4565b600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039290921691909117905550565b61091161218a565b61091b6000612347565b565b6003546000906001600160a01b031633146109a05760405162461bcd60e51b815260206004820152603660248201527f48656c7065723a206f6e6c792054555020746f6b656e20636f6e74726163742060448201527f63616e2063616c6c20746869732066756e6374696f6e000000000000000000006064820152608401610366565b600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa158015610a03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a279190613529565b600480546040516370a0823160e01b81526001600160a01b03918216928101929092529192506000918316906370a0823190602401602060405180830381865afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d91906134f9565b90508015610b3557600354600480546040516370a0823160e01b81526001600160a01b0391821692810192909252610b3092670de0b6b3a7640000928592909116906370a0823190602401602060405180830381865afa158015610b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2991906134f9565b91906123af565b610b3f565b670de0b6b3a76400005b925050505b90565b600080547501000000000000000000000000000000000000000000900460ff16610b4457600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055600354336001600160a01b0390911614610c2d5760405162461bcd60e51b815260206004820152603660248201527f48656c7065723a206f6e6c792054555020746f6b656e20636f6e74726163742060448201527f63616e2063616c6c20746869732066756e6374696f6e000000000000000000006064820152608401610366565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000178155600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163ad5c4648916004808201926020929091908290030181865afa158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190613529565b6002546003546040517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152818416602482015292935060009291169063e6a4390590604401602060405180830381865afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190613529565b90506000600360009054906101000a90046001600160a01b03166001600160a01b03166396365d446040518163ffffffff1660e01b8152600401602060405180830381865afa158015610de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0591906134f9565b6040516370a0823160e01b81526001600160a01b0384811660048301529192506000918516906370a0823190602401602060405180830381865afa158015610e51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7591906134f9565b6003546040516370a0823160e01b81526001600160a01b0390911660048201819052919250600091906370a0823190602401602060405180830381865afa158015610ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee891906134f9565b6003546040516370a0823160e01b81526001600160a01b038781166004830152929350600092909116906370a0823190602401602060405180830381865afa158015610f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5c91906134f9565b9050831580610f69575082155b15610f7d5760009650505050505050611029565b6000610f9283670de0b6b3a7640000876123af565b90506000610fa983670de0b6b3a7640000876123af565b9050801580610fb6575081155b15610fcc57600098505050505050505050611029565b6000828211610ff0576101f4610fe961271085610b298682613512565b1015611007565b6101f461100461271084610b298782613512565b10155b90508061101557600061101d565b61101d61247c565b99505050505050505050505b600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff16905590565b61105c61218a565b6001600160a01b0381166110d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610366565b6110e181612347565b50565b6004546001600160a01b0316331415611b42576001600160a01b038316301415611b3d5760008061111783850185613546565b60035491935091506001600160a01b0380841691161415611569576003546040517fe4849b32000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063e4849b32906024016020604051808303816000875af19250505080156111b2575060408051601f3d908101601f191682019092526111af91810190613462565b60015b6111e5575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff169055505050565b506040805160028082526060820183526000926020830190803683375050600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015611269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128d9190613529565b816000815181106112a0576112a06135a1565b6001600160a01b0392831660209182029290920101526003548251911690829060019081106112d1576112d16135a1565b6001600160a01b0392831660209182029290920101526001546040517f1f00ca740000000000000000000000000000000000000000000000000000000081526000929190911690631f00ca749061132e9086908690600401613614565b600060405180830381865afa15801561134b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113739190810190613635565b905081600081518110611388576113886135a1565b60200260200101516001600160a01b031663d0e30db0826000815181106113b1576113b16135a1565b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b1580156113e457600080fd5b505af11580156113f8573d6000803e3d6000fd5b505050505081600081518110611410576114106135a1565b60200260200101516001600160a01b031663a9059cbb338360008151811061143a5761143a6135a1565b60200260200101516040518363ffffffff1660e01b81526004016114739291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015611492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b69190613462565b50600360009054906101000a90046001600160a01b03166001600160a01b0316639c4da9d8476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561150757600080fd5b505af115801561151b573d6000803e3d6000fd5b5050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16760100000000000000000000000000000000000000000000179055506102e09350505050565b600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156115cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f09190613529565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490529091506001600160a01b03821690632e1a7d4d90602401600060405180830381600087803b15801561164e57600080fd5b505af1158015611662573d6000803e3d6000fd5b50505050600360009054906101000a90046001600160a01b03166001600160a01b031663a6f2ae3a836040518263ffffffff1660e01b815260040160206040518083038185885af1935050505080156116d8575060408051601f3d908101601f191682019092526116d591810190613462565b60015b61170c575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16905550505050565b50604080516002808252606082018352600092602083019080368337505060035482519293506001600160a01b03169183915060009061174e5761174e6135a1565b60200260200101906001600160a01b031690816001600160a01b0316815250508181600181518110611782576117826135a1565b6001600160a01b0392831660209182029290920101526001546040517f1f00ca740000000000000000000000000000000000000000000000000000000081526000929190911690631f00ca74906117df9087908690600401613614565b600060405180830381865afa1580156117fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118249190810190613635565b905081600081518110611839576118396135a1565b60200260200101516001600160a01b031663a9059cbb3383600081518110611863576118636135a1565b60200260200101516040518363ffffffff1660e01b815260040161189c9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156118bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118df9190613462565b50600360009054906101000a90046001600160a01b03166001600160a01b03166370471f73476040518263ffffffff1660e01b815260040160206040518083038185885af193505050508015611952575060408051601f3d908101601f1916820190925261194f91810190613462565b60015b611988575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff169055505050505050565b506003546040516370a0823160e01b81523060048201526001600160a01b039091169063e4849b329082906370a0823190602401602060405180830381865afa1580156119d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fd91906134f9565b6040518263ffffffff1660e01b8152600401611a1b91815260200190565b6020604051808303816000875af1925050508015611a56575060408051601f3d908101601f19168201909252611a5391810190613462565b60015b611a8c575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff169055505050505050565b50600360009054906101000a90046001600160a01b03166001600160a01b0316639c4da9d8476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611add57600080fd5b505af1158015611af1573d6000803e3d6000fd5b5050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff1676010000000000000000000000000000000000000000000017905550505050505050505b505050565b5050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16905550565b60008060005477010000000000000000000000000000000000000000000000900460ff166001811115611ba457611ba46136f3565b1415611eab576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03841690632e1a7d4d90602401600060405180830381600087803b158015611c0557600080fd5b505af1158015611c19573d6000803e3d6000fd5b50505050600360009054906101000a90046001600160a01b03166001600160a01b031663a6f2ae3a836040518263ffffffff1660e01b815260040160206040518083038185885af193505050508015611c8f575060408051601f3d908101601f19168201909252611c8c91810190613462565b60015b611c9b57506000612184565b50604080516002808252606082018352600092602083019080368337505060035482519293506001600160a01b031691839150600090611cdd57611cdd6135a1565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600181518110611d1157611d116135a1565b6001600160a01b0392831660209182029290920101526003546040516370a0823160e01b815230600482015260009291909116906370a0823190602401602060405180830381865afa158015611d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8f91906134f9565b6003546001546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101849052929350169063095ea7b3906044016020604051808303816000875af1158015611dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e239190613462565b506001546001600160a01b0316635c11d7958260008530611e464261012c6134b3565b6040518663ffffffff1660e01b8152600401611e66959493929190613722565b600060405180830381600087803b158015611e8057600080fd5b505af1925050508015611e91575060015b611ea057600092505050612184565b600192505050612184565b6040805160028082526060820183526000926020830190803683370190505090508381600081518110611ee057611ee06135a1565b6001600160a01b039283166020918202929092010152600354825191169082906001908110611f1157611f116135a1565b6001600160a01b0392831660209182029290920101526001546040517f095ea7b30000000000000000000000000000000000000000000000000000000081529082166004820152602481018590529085169063095ea7b3906044016020604051808303816000875af1158015611f8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faf9190613462565b506001546001600160a01b0316635c11d7958460008430611fd24261012c6134b3565b6040518663ffffffff1660e01b8152600401611ff2959493929190613722565b600060405180830381600087803b15801561200c57600080fd5b505af192505050801561201d575060015b61202b576000915050612184565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612074573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209891906134f9565b6003546040517fe4849b32000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b03169063e4849b32906024016020604051808303816000875af1925050508015612119575060408051601f3d908101601f1916820190925261211691810190613462565b60015b61212857600092505050612184565b50846001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561216457600080fd5b505af1158015612178573d6000803e3d6000fd5b50505050506001925050505b92915050565b6000546001600160a01b0316331461091b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b6002546040517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528381166024830152600092169063e6a4390590604401602060405180830381865afa158015612250573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122749190613529565b90506001600160a01b03811615801561229557506001600160a01b03831615155b80156122a957506001600160a01b03821615155b15612184576002546040517fc9c653960000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015284811660248301529091169063c9c65396906044016020604051808303816000875af1925050508015612337575060408051601f3d908101601f1916820190925261233491810190613529565b60015b61234057600080fd5b9392505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415612408578382816123fe576123fe61375e565b0492505050612340565b80841161241457600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f69190613529565b60408051600280825260608201835292935060009290916020830190803683370190505090508181600081518110612530576125306135a1565b6001600160a01b039283166020918202929092010152600354825191169082906001908110612561576125616135a1565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183526000939192909183019080368337505060035482519293506001600160a01b0316918391506000906125bc576125bc6135a1565b60200260200101906001600160a01b031690816001600160a01b03168152505082816001815181106125f0576125f06135a1565b6001600160a01b0392831660209182029290920101526002546003546040517fe6a4390500000000000000000000000000000000000000000000000000000000815290831660048201528583166024820152606092600092839291169063e6a4390590604401602060405180830381865afa158015612673573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126979190613529565b90506000600360009054906101000a90046001600160a01b03166001600160a01b03166396365d446040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271291906134f9565b6040516370a0823160e01b81526001600160a01b0384811660048301529192506000918916906370a0823190602401602060405180830381865afa15801561275e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278291906134f9565b6003546040516370a0823160e01b81526001600160a01b0390911660048201819052919250600091906370a0823190602401602060405180830381865afa1580156127d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f591906134f9565b6003546040516370a0823160e01b81526001600160a01b038781166004830152929350600092909116906370a0823190602401602060405180830381865afa158015612845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286991906134f9565b905060005b6016811015612d13576001546001600160a01b031663d06ca61f6005836016811061289b5761289b6135a1565b01548c6040518363ffffffff1660e01b81526004016128bb929190613614565b600060405180830381865afa1580156128d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129009190810190613635565b60035481519199506001600160a01b03169063f3d33a0e908a90600190811061292b5761292b6135a1565b60200260200101516040518263ffffffff1660e01b815260040161295191815260200190565b602060405180830381865afa15801561296e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299291906134f9565b965060006129b3600583601681106129ac576129ac6135a1565b0154612d21565b9050808811612be7576003546001600160a01b03166398527875600584601681106129e0576129e06135a1565b01546040518263ffffffff1660e01b8152600401612a0091815260200190565b602060405180830381865afa158015612a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4191906134f9565b6001546040517fd06ca61f0000000000000000000000000000000000000000000000000000000081529199506001600160a01b03169063d06ca61f90612a8d908b908e90600401613614565b600060405180830381865afa158015612aaa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ad29190810190613635565b98508089600181518110612ae857612ae86135a1565b60200260200101511115612be25788600181518110612b0957612b096135a1565b60200260200101518510158015612b205750878410155b15612be257600080547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff1690557f0000000000000000000000000000000000000000000000000000000000000000612bbd57612b908c60058460168110612b8957612b896135a1565b0154612e01565b9c508c612bb857612bb560058360168110612bad57612bad6135a1565b015489612ec8565b9c505b612bd6565b612bd360058360168110612bad57612bad6135a1565b9c505b8c15612be25750612d13565b612d00565b878610158015612c11575088600181518110612c0557612c056135a1565b60200260200101518310155b15612d0057600080547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff16770100000000000000000000000000000000000000000000001790557f0000000000000000000000000000000000000000000000000000000000000000612cdb57612c948c60058460168110612b8957612b896135a1565b9c508c612cd657612cd360058360168110612cb157612cb16135a1565b01548a600181518110612cc657612cc66135a1565b6020026020010151612ec8565b9c505b612cf4565b612cf160058360168110612cb157612cb16135a1565b9c505b8c15612d005750612d13565b5080612d0b8161378d565b91505061286e565b505050505050505050505090565b60007f0000000000000000000000000000000000000000000000000000000000000000612df357612de97f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663074b2e436040518163ffffffff1660e01b8152600401602060405180830381865afa158015612da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dcd91906137c6565b83906fffffffffffffffffffffffffffffffff166127106123af565b61218490836134b3565b612de98260646127106123af565b60408051602081018252600080825291517f42b0b77c00000000000000000000000000000000000000000000000000000000815230919083906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342b0b77c90612e819086908a908a9088908890600401613845565b600060405180830381600087803b158015612e9b57600080fd5b505af1925050508015612eac575060015b612ebc5760009350505050612184565b60019350505050612184565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f429190613529565b600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff1690556004549091506001600160a01b0316600160005477010000000000000000000000000000000000000000000000900460ff166001811115612fad57612fad6136f3565b14156131a1576000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130179190613529565b6003546001600160a01b03908116911614613033576000613035565b845b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613077573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061309b9190613529565b6003546001600160a01b039081169116146130b75760006130b9565b855b600354604080516001600160a01b03928316602082015290810189905291925084169063022c0d9f908490849030906060015b6040516020818303038152906040526040518563ffffffff1660e01b815260040161311a949392919061388d565b600060405180830381600087803b15801561313457600080fd5b505af1925050508015613145575060015b613175575050600054760100000000000000000000000000000000000000000000900460ff169250612184915050565b5050600054760100000000000000000000000000000000000000000000900460ff169250612184915050565b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132059190613529565b6001600160a01b0316836001600160a01b031614613224576000613226565b855b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061328c9190613529565b6001600160a01b0316846001600160a01b0316146132ab5760006132ad565b865b9050826001600160a01b031663022c0d9f838330888c6040516020016130ec9291906001600160a01b03929092168252602082015260400190565b6001600160a01b03811681146110e157600080fd5b60008083601f84011261330f57600080fd5b50813567ffffffffffffffff81111561332757600080fd5b60208301915083602082850101111561333f57600080fd5b9250929050565b60008060008060006080868803121561335e57600080fd5b8535613369816132e8565b94506020860135935060408601359250606086013567ffffffffffffffff81111561339357600080fd5b61339f888289016132fd565b969995985093965092949392505050565b6000602082840312156133c257600080fd5b5035919050565b60008060008060008060a087890312156133e257600080fd5b86356133ed816132e8565b95506020870135945060408701359350606087013561340b816132e8565b9250608087013567ffffffffffffffff81111561342757600080fd5b61343389828a016132fd565b979a9699509497509295939492505050565b60006020828403121561345757600080fd5b8135612340816132e8565b60006020828403121561347457600080fd5b8151801515811461234057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156134c6576134c6613484565b500190565b6000806000606084860312156134e057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561350b57600080fd5b5051919050565b60008282101561352457613524613484565b500390565b60006020828403121561353b57600080fd5b8151612340816132e8565b6000806040838503121561355957600080fd5b8235613564816132e8565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081518084526020808501945080840160005b838110156136095781516001600160a01b0316875295820195908201906001016135e4565b509495945050505050565b82815260406020820152600061362d60408301846135d0565b949350505050565b6000602080838503121561364857600080fd5b825167ffffffffffffffff8082111561366057600080fd5b818501915085601f83011261367457600080fd5b81518181111561368657613686613572565b8060051b604051601f19603f830116810181811085821117156136ab576136ab613572565b6040529182528482019250838101850191888311156136c957600080fd5b938501935b828510156136e7578451845293850193928501926136ce565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b85815284602082015260a06040820152600061374160a08301866135d0565b6001600160a01b0394909416606083015250608001529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156137bf576137bf613484565b5060010190565b6000602082840312156137d857600080fd5b81516fffffffffffffffffffffffffffffffff8116811461234057600080fd5b6000815180845260005b8181101561381e57602081850181015186830182015201613802565b81811115613830576000602083870101525b50601f01601f19169290920160200192915050565b60006001600160a01b03808816835280871660208401525084604083015260a0606083015261387760a08301856137f8565b905061ffff831660808301529695505050505050565b8481528360208201526001600160a01b03831660408201526080606082015260006138bb60808301846137f8565b969550505050505056fea26469706673582212205c7a95b7480fc379415bd22b8b74d36bacbdebfa16513ba05aabc071180dfd6964736f6c634300080a00330000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123e587f469fcb3c5992793d081be8d643fd78e1

Deployed Bytecode

0x6080604052600436106100e15760003560e01c80637535d2461161007f57806395d18a131161005957806395d18a131461025f578063a840a4f514610282578063c6cc93a114610297578063f2fde38b146102b5576100e8565b80637535d2461461020d57806384800812146101755780638da5cb5b14610241576100e8565b806315496ef5116100bb57806315496ef5146101955780631b11d0ff146101b85780632ea77103146101d8578063715018a6146101f8576100e8565b806303bc95a0146100f55780630542975c1461014157806310d1e85c14610175576100e8565b366100e857005b36156100f357600080fd5b005b34801561010157600080fd5b507f00000000000000000000000087870bca3f3fd6335c3f4ce8392d69350b4fa4e25b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014d57600080fd5b506101247f0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e81565b34801561018157600080fd5b506100f3610190366004613346565b6102d5565b6101a86101a33660046133b0565b6102e7565b6040519015158152602001610138565b3480156101c457600080fd5b506101a86101d33660046133c9565b610562565b3480156101e457600080fd5b506100f36101f3366004613445565b610806565b34801561020457600080fd5b506100f3610909565b34801561021957600080fd5b506101247f00000000000000000000000087870bca3f3fd6335c3f4ce8392d69350b4fa4e281565b34801561024d57600080fd5b506000546001600160a01b0316610124565b34801561026b57600080fd5b5061027461091d565b604051908152602001610138565b34801561028e57600080fd5b506101a8610b47565b3480156102a357600080fd5b506004546001600160a01b0316610124565b3480156102c157600080fd5b506100f36102d0366004613445565b611054565b6102e08583836110e4565b5050505050565b6003546000906001600160a01b0316331461036f5760405162461bcd60e51b815260206004820152603660248201527f48656c7065723a206f6e6c792054555020746f6b656e20636f6e74726163742060448201527f63616e2063616c6c20746869732066756e6374696f6e0000000000000000000060648201526084015b60405180910390fd5b6003546001546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b0391821660048201526024810185905291169063095ea7b3906044016020604051808303816000875af11580156103dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104019190613462565b506001546003546001600160a01b039182169163f305d71991349116856000808061042e4261012c6134b3565b60405160e089901b7fffffffff000000000000000000000000000000000000000000000000000000001681526001600160a01b039687166004820152602481019590955260448501939093526064840191909152909216608482015260a481019190915260c40160606040518083038185885af1935050505080156104d0575060408051601f3d908101601f191682019092526104cd918101906134cb565b60015b61055757600360009054906101000a90046001600160a01b03166001600160a01b03166370471f73346040518263ffffffff1660e01b815260040160206040518083038185885af1158015610529573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061054e9190613462565b50600092915050565b506001949350505050565b6000805474010000000000000000000000000000000000000000900460ff166105f35760405162461bcd60e51b815260206004820152603f60248201527f48656c7065723a20736f7272792062756464792062757420796f7520646f206e60448201527f6f7420686176652061636365737320746f20746869732066756e6374696f6e006064820152608401610366565b86600061060087896134b3565b905061060c8989611b6f565b1561074a576040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015610658573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067c91906134f9565b90506001600160a01b038a16632e1a7d4d6106978484613512565b6040518263ffffffff1660e01b81526004016106b591815260200190565b600060405180830381600087803b1580156106cf57600080fd5b505af11580156106e3573d6000803e3d6000fd5b50506003546001600160a01b03169150639c4da9d890506107048484613512565b6040518263ffffffff1660e01b81526004016000604051808303818588803b15801561072f57600080fd5b505af1158015610743573d6000803e3d6000fd5b5050505050505b6040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b037f00000000000000000000000087870bca3f3fd6335c3f4ce8392d69350b4fa4e2811660048301526024820183905283169063095ea7b3906044016020604051808303816000875af11580156107d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f69190613462565b5060019998505050505050505050565b61080e61218a565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03838116918217909255600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516108ce94929092169163ad5c4648916004808201926020929091908290030181865afa1580156108a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c99190613529565b6121e4565b600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039290921691909117905550565b61091161218a565b61091b6000612347565b565b6003546000906001600160a01b031633146109a05760405162461bcd60e51b815260206004820152603660248201527f48656c7065723a206f6e6c792054555020746f6b656e20636f6e74726163742060448201527f63616e2063616c6c20746869732066756e6374696f6e000000000000000000006064820152608401610366565b600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa158015610a03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a279190613529565b600480546040516370a0823160e01b81526001600160a01b03918216928101929092529192506000918316906370a0823190602401602060405180830381865afa158015610a79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9d91906134f9565b90508015610b3557600354600480546040516370a0823160e01b81526001600160a01b0391821692810192909252610b3092670de0b6b3a7640000928592909116906370a0823190602401602060405180830381865afa158015610b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2991906134f9565b91906123af565b610b3f565b670de0b6b3a76400005b925050505b90565b600080547501000000000000000000000000000000000000000000900460ff16610b4457600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055600354336001600160a01b0390911614610c2d5760405162461bcd60e51b815260206004820152603660248201527f48656c7065723a206f6e6c792054555020746f6b656e20636f6e74726163742060448201527f63616e2063616c6c20746869732066756e6374696f6e000000000000000000006064820152608401610366565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000178155600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516001600160a01b039092169163ad5c4648916004808201926020929091908290030181865afa158015610ccf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf39190613529565b6002546003546040517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b039182166004820152818416602482015292935060009291169063e6a4390590604401602060405180830381865afa158015610d66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d8a9190613529565b90506000600360009054906101000a90046001600160a01b03166001600160a01b03166396365d446040518163ffffffff1660e01b8152600401602060405180830381865afa158015610de1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0591906134f9565b6040516370a0823160e01b81526001600160a01b0384811660048301529192506000918516906370a0823190602401602060405180830381865afa158015610e51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7591906134f9565b6003546040516370a0823160e01b81526001600160a01b0390911660048201819052919250600091906370a0823190602401602060405180830381865afa158015610ec4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee891906134f9565b6003546040516370a0823160e01b81526001600160a01b038781166004830152929350600092909116906370a0823190602401602060405180830381865afa158015610f38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5c91906134f9565b9050831580610f69575082155b15610f7d5760009650505050505050611029565b6000610f9283670de0b6b3a7640000876123af565b90506000610fa983670de0b6b3a7640000876123af565b9050801580610fb6575081155b15610fcc57600098505050505050505050611029565b6000828211610ff0576101f4610fe961271085610b298682613512565b1015611007565b6101f461100461271084610b298782613512565b10155b90508061101557600061101d565b61101d61247c565b99505050505050505050505b600080547fffffffffffffffffffff0000ffffffffffffffffffffffffffffffffffffffff16905590565b61105c61218a565b6001600160a01b0381166110d85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610366565b6110e181612347565b50565b6004546001600160a01b0316331415611b42576001600160a01b038316301415611b3d5760008061111783850185613546565b60035491935091506001600160a01b0380841691161415611569576003546040517fe4849b32000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b039091169063e4849b32906024016020604051808303816000875af19250505080156111b2575060408051601f3d908101601f191682019092526111af91810190613462565b60015b6111e5575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff169055505050565b506040805160028082526060820183526000926020830190803683375050600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015611269573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128d9190613529565b816000815181106112a0576112a06135a1565b6001600160a01b0392831660209182029290920101526003548251911690829060019081106112d1576112d16135a1565b6001600160a01b0392831660209182029290920101526001546040517f1f00ca740000000000000000000000000000000000000000000000000000000081526000929190911690631f00ca749061132e9086908690600401613614565b600060405180830381865afa15801561134b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526113739190810190613635565b905081600081518110611388576113886135a1565b60200260200101516001600160a01b031663d0e30db0826000815181106113b1576113b16135a1565b60200260200101516040518263ffffffff1660e01b81526004016000604051808303818588803b1580156113e457600080fd5b505af11580156113f8573d6000803e3d6000fd5b505050505081600081518110611410576114106135a1565b60200260200101516001600160a01b031663a9059cbb338360008151811061143a5761143a6135a1565b60200260200101516040518363ffffffff1660e01b81526004016114739291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af1158015611492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b69190613462565b50600360009054906101000a90046001600160a01b03166001600160a01b0316639c4da9d8476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561150757600080fd5b505af115801561151b573d6000803e3d6000fd5b5050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16760100000000000000000000000000000000000000000000179055506102e09350505050565b600154604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156115cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f09190613529565b6040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018490529091506001600160a01b03821690632e1a7d4d90602401600060405180830381600087803b15801561164e57600080fd5b505af1158015611662573d6000803e3d6000fd5b50505050600360009054906101000a90046001600160a01b03166001600160a01b031663a6f2ae3a836040518263ffffffff1660e01b815260040160206040518083038185885af1935050505080156116d8575060408051601f3d908101601f191682019092526116d591810190613462565b60015b61170c575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16905550505050565b50604080516002808252606082018352600092602083019080368337505060035482519293506001600160a01b03169183915060009061174e5761174e6135a1565b60200260200101906001600160a01b031690816001600160a01b0316815250508181600181518110611782576117826135a1565b6001600160a01b0392831660209182029290920101526001546040517f1f00ca740000000000000000000000000000000000000000000000000000000081526000929190911690631f00ca74906117df9087908690600401613614565b600060405180830381865afa1580156117fc573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526118249190810190613635565b905081600081518110611839576118396135a1565b60200260200101516001600160a01b031663a9059cbb3383600081518110611863576118636135a1565b60200260200101516040518363ffffffff1660e01b815260040161189c9291906001600160a01b03929092168252602082015260400190565b6020604051808303816000875af11580156118bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118df9190613462565b50600360009054906101000a90046001600160a01b03166001600160a01b03166370471f73476040518263ffffffff1660e01b815260040160206040518083038185885af193505050508015611952575060408051601f3d908101601f1916820190925261194f91810190613462565b60015b611988575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff169055505050505050565b506003546040516370a0823160e01b81523060048201526001600160a01b039091169063e4849b329082906370a0823190602401602060405180830381865afa1580156119d9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119fd91906134f9565b6040518263ffffffff1660e01b8152600401611a1b91815260200190565b6020604051808303816000875af1925050508015611a56575060408051601f3d908101601f19168201909252611a5391810190613462565b60015b611a8c575050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff169055505050505050565b50600360009054906101000a90046001600160a01b03166001600160a01b0316639c4da9d8476040518263ffffffff1660e01b81526004016000604051808303818588803b158015611add57600080fd5b505af1158015611af1573d6000803e3d6000fd5b5050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff1676010000000000000000000000000000000000000000000017905550505050505050505b505050565b5050600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16905550565b60008060005477010000000000000000000000000000000000000000000000900460ff166001811115611ba457611ba46136f3565b1415611eab576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03841690632e1a7d4d90602401600060405180830381600087803b158015611c0557600080fd5b505af1158015611c19573d6000803e3d6000fd5b50505050600360009054906101000a90046001600160a01b03166001600160a01b031663a6f2ae3a836040518263ffffffff1660e01b815260040160206040518083038185885af193505050508015611c8f575060408051601f3d908101601f19168201909252611c8c91810190613462565b60015b611c9b57506000612184565b50604080516002808252606082018352600092602083019080368337505060035482519293506001600160a01b031691839150600090611cdd57611cdd6135a1565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600181518110611d1157611d116135a1565b6001600160a01b0392831660209182029290920101526003546040516370a0823160e01b815230600482015260009291909116906370a0823190602401602060405180830381865afa158015611d6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8f91906134f9565b6003546001546040517f095ea7b30000000000000000000000000000000000000000000000000000000081526001600160a01b03918216600482015260248101849052929350169063095ea7b3906044016020604051808303816000875af1158015611dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e239190613462565b506001546001600160a01b0316635c11d7958260008530611e464261012c6134b3565b6040518663ffffffff1660e01b8152600401611e66959493929190613722565b600060405180830381600087803b158015611e8057600080fd5b505af1925050508015611e91575060015b611ea057600092505050612184565b600192505050612184565b6040805160028082526060820183526000926020830190803683370190505090508381600081518110611ee057611ee06135a1565b6001600160a01b039283166020918202929092010152600354825191169082906001908110611f1157611f116135a1565b6001600160a01b0392831660209182029290920101526001546040517f095ea7b30000000000000000000000000000000000000000000000000000000081529082166004820152602481018590529085169063095ea7b3906044016020604051808303816000875af1158015611f8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611faf9190613462565b506001546001600160a01b0316635c11d7958460008430611fd24261012c6134b3565b6040518663ffffffff1660e01b8152600401611ff2959493929190613722565b600060405180830381600087803b15801561200c57600080fd5b505af192505050801561201d575060015b61202b576000915050612184565b6003546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612074573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061209891906134f9565b6003546040517fe4849b32000000000000000000000000000000000000000000000000000000008152600481018390529192506001600160a01b03169063e4849b32906024016020604051808303816000875af1925050508015612119575060408051601f3d908101601f1916820190925261211691810190613462565b60015b61212857600092505050612184565b50846001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561216457600080fd5b505af1158015612178573d6000803e3d6000fd5b50505050506001925050505b92915050565b6000546001600160a01b0316331461091b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610366565b6002546040517fe6a439050000000000000000000000000000000000000000000000000000000081526001600160a01b0384811660048301528381166024830152600092169063e6a4390590604401602060405180830381865afa158015612250573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122749190613529565b90506001600160a01b03811615801561229557506001600160a01b03831615155b80156122a957506001600160a01b03821615155b15612184576002546040517fc9c653960000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015284811660248301529091169063c9c65396906044016020604051808303816000875af1925050508015612337575060408051601f3d908101601f1916820190925261233491810190613529565b60015b61234057600080fd5b9392505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8587098587029250828110838203039150508060001415612408578382816123fe576123fe61375e565b0492505050612340565b80841161241457600080fd5b600084868809600260036001881981018916988990049182028318808302840302808302840302808302840302808302840302808302840302918202909203026000889003889004909101858311909403939093029303949094049190911702949350505050565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f69190613529565b60408051600280825260608201835292935060009290916020830190803683370190505090508181600081518110612530576125306135a1565b6001600160a01b039283166020918202929092010152600354825191169082906001908110612561576125616135a1565b6001600160a01b03929092166020928302919091018201526040805160028082526060820183526000939192909183019080368337505060035482519293506001600160a01b0316918391506000906125bc576125bc6135a1565b60200260200101906001600160a01b031690816001600160a01b03168152505082816001815181106125f0576125f06135a1565b6001600160a01b0392831660209182029290920101526002546003546040517fe6a4390500000000000000000000000000000000000000000000000000000000815290831660048201528583166024820152606092600092839291169063e6a4390590604401602060405180830381865afa158015612673573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126979190613529565b90506000600360009054906101000a90046001600160a01b03166001600160a01b03166396365d446040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126ee573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271291906134f9565b6040516370a0823160e01b81526001600160a01b0384811660048301529192506000918916906370a0823190602401602060405180830381865afa15801561275e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061278291906134f9565b6003546040516370a0823160e01b81526001600160a01b0390911660048201819052919250600091906370a0823190602401602060405180830381865afa1580156127d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127f591906134f9565b6003546040516370a0823160e01b81526001600160a01b038781166004830152929350600092909116906370a0823190602401602060405180830381865afa158015612845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286991906134f9565b905060005b6016811015612d13576001546001600160a01b031663d06ca61f6005836016811061289b5761289b6135a1565b01548c6040518363ffffffff1660e01b81526004016128bb929190613614565b600060405180830381865afa1580156128d8573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129009190810190613635565b60035481519199506001600160a01b03169063f3d33a0e908a90600190811061292b5761292b6135a1565b60200260200101516040518263ffffffff1660e01b815260040161295191815260200190565b602060405180830381865afa15801561296e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299291906134f9565b965060006129b3600583601681106129ac576129ac6135a1565b0154612d21565b9050808811612be7576003546001600160a01b03166398527875600584601681106129e0576129e06135a1565b01546040518263ffffffff1660e01b8152600401612a0091815260200190565b602060405180830381865afa158015612a1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4191906134f9565b6001546040517fd06ca61f0000000000000000000000000000000000000000000000000000000081529199506001600160a01b03169063d06ca61f90612a8d908b908e90600401613614565b600060405180830381865afa158015612aaa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612ad29190810190613635565b98508089600181518110612ae857612ae86135a1565b60200260200101511115612be25788600181518110612b0957612b096135a1565b60200260200101518510158015612b205750878410155b15612be257600080547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff1690557f0000000000000000000000000000000000000000000000000000000000000000612bbd57612b908c60058460168110612b8957612b896135a1565b0154612e01565b9c508c612bb857612bb560058360168110612bad57612bad6135a1565b015489612ec8565b9c505b612bd6565b612bd360058360168110612bad57612bad6135a1565b9c505b8c15612be25750612d13565b612d00565b878610158015612c11575088600181518110612c0557612c056135a1565b60200260200101518310155b15612d0057600080547fffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffff16770100000000000000000000000000000000000000000000001790557f0000000000000000000000000000000000000000000000000000000000000000612cdb57612c948c60058460168110612b8957612b896135a1565b9c508c612cd657612cd360058360168110612cb157612cb16135a1565b01548a600181518110612cc657612cc66135a1565b6020026020010151612ec8565b9c505b612cf4565b612cf160058360168110612cb157612cb16135a1565b9c505b8c15612d005750612d13565b5080612d0b8161378d565b91505061286e565b505050505050505050505090565b60007f0000000000000000000000000000000000000000000000000000000000000000612df357612de97f00000000000000000000000087870bca3f3fd6335c3f4ce8392d69350b4fa4e26001600160a01b031663074b2e436040518163ffffffff1660e01b8152600401602060405180830381865afa158015612da9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dcd91906137c6565b83906fffffffffffffffffffffffffffffffff166127106123af565b61218490836134b3565b612de98260646127106123af565b60408051602081018252600080825291517f42b0b77c00000000000000000000000000000000000000000000000000000000815230919083906001600160a01b037f00000000000000000000000087870bca3f3fd6335c3f4ce8392d69350b4fa4e216906342b0b77c90612e819086908a908a9088908890600401613845565b600060405180830381600087803b158015612e9b57600080fd5b505af1925050508015612eac575060015b612ebc5760009350505050612184565b60019350505050612184565b600080600160009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612f1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f429190613529565b600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff1690556004549091506001600160a01b0316600160005477010000000000000000000000000000000000000000000000900460ff166001811115612fad57612fad6136f3565b14156131a1576000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015612ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130179190613529565b6003546001600160a01b03908116911614613033576000613035565b845b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613077573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061309b9190613529565b6003546001600160a01b039081169116146130b75760006130b9565b855b600354604080516001600160a01b03928316602082015290810189905291925084169063022c0d9f908490849030906060015b6040516020818303038152906040526040518563ffffffff1660e01b815260040161311a949392919061388d565b600060405180830381600087803b15801561313457600080fd5b505af1925050508015613145575060015b613175575050600054760100000000000000000000000000000000000000000000900460ff169250612184915050565b5050600054760100000000000000000000000000000000000000000000900460ff169250612184915050565b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156131e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132059190613529565b6001600160a01b0316836001600160a01b031614613224576000613226565b855b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061328c9190613529565b6001600160a01b0316846001600160a01b0316146132ab5760006132ad565b865b9050826001600160a01b031663022c0d9f838330888c6040516020016130ec9291906001600160a01b03929092168252602082015260400190565b6001600160a01b03811681146110e157600080fd5b60008083601f84011261330f57600080fd5b50813567ffffffffffffffff81111561332757600080fd5b60208301915083602082850101111561333f57600080fd5b9250929050565b60008060008060006080868803121561335e57600080fd5b8535613369816132e8565b94506020860135935060408601359250606086013567ffffffffffffffff81111561339357600080fd5b61339f888289016132fd565b969995985093965092949392505050565b6000602082840312156133c257600080fd5b5035919050565b60008060008060008060a087890312156133e257600080fd5b86356133ed816132e8565b95506020870135945060408701359350606087013561340b816132e8565b9250608087013567ffffffffffffffff81111561342757600080fd5b61343389828a016132fd565b979a9699509497509295939492505050565b60006020828403121561345757600080fd5b8135612340816132e8565b60006020828403121561347457600080fd5b8151801515811461234057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082198211156134c6576134c6613484565b500190565b6000806000606084860312156134e057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561350b57600080fd5b5051919050565b60008282101561352457613524613484565b500390565b60006020828403121561353b57600080fd5b8151612340816132e8565b6000806040838503121561355957600080fd5b8235613564816132e8565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081518084526020808501945080840160005b838110156136095781516001600160a01b0316875295820195908201906001016135e4565b509495945050505050565b82815260406020820152600061362d60408301846135d0565b949350505050565b6000602080838503121561364857600080fd5b825167ffffffffffffffff8082111561366057600080fd5b818501915085601f83011261367457600080fd5b81518181111561368657613686613572565b8060051b604051601f19603f830116810181811085821117156136ab576136ab613572565b6040529182528482019250838101850191888311156136c957600080fd5b938501935b828510156136e7578451845293850193928501926136ce565b98975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b85815284602082015260a06040820152600061374160a08301866135d0565b6001600160a01b0394909416606083015250608001529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156137bf576137bf613484565b5060010190565b6000602082840312156137d857600080fd5b81516fffffffffffffffffffffffffffffffff8116811461234057600080fd5b6000815180845260005b8181101561381e57602081850181015186830182015201613802565b81811115613830576000602083870101525b50601f01601f19169290920160200192915050565b60006001600160a01b03808816835280871660208401525084604083015260a0606083015261387760a08301856137f8565b905061ffff831660808301529695505050505050565b8481528360208201526001600160a01b03831660408201526080606082015260006138bb60808301846137f8565b969550505050505056fea26469706673582212205c7a95b7480fc379415bd22b8b74d36bacbdebfa16513ba05aabc071180dfd6964736f6c634300080a0033

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

0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123e587f469fcb3c5992793d081be8d643fd78e1

-----Decoded View---------------
Arg [0] : _addressProvider (address): 0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e
Arg [1] : _exchangeRouterAddress (address): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
Arg [2] : _tupTokenAddress (address): 0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e
Arg [3] : _hasAlternativeSwap (bool): False
Arg [4] : _owner (address): 0x123E587F469fCB3c5992793d081bE8D643FD78e1

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e
Arg [1] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Arg [2] : 0000000000000000000000002f39d218133afab8f2b819b1066c7e434ad94e9e
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 000000000000000000000000123e587f469fcb3c5992793d081be8d643fd78e1


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  ]
[ 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.