Contract 0x126219afdea0b3b750A58822e71F2271a73E0822

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x617f69b1cb543b80267dcf0e5a761c9b718b58458e4445c9113c89de911213fdUpdate Pool241399762022-01-25 9:15:52254 days 5 hrs ago0x820de2eb0ee8007ee237e02ace3bf2b9cd0ddf1a IN  0x126219afdea0b3b750a58822e71f2271a73e08220 MATIC0.024384093144 80.494150941
0x040f2573e0608c0772e392dc284527a3987bf4c337bb9ef2d4eafb80a8ccdda8Update Pool239483232022-01-20 13:49:27259 days 1 hr ago0x820de2eb0ee8007ee237e02ace3bf2b9cd0ddf1a IN  0x126219afdea0b3b750a58822e71f2271a73e08220 MATIC0.073341778154 343.153143255
0x61604ae94e2d4895fc44f29eee2ef7c1fabf0cf9c1f0fe67e6112dfbe0168999Update Farm Addr...237863792022-01-16 12:08:25263 days 2 hrs ago0x820de2eb0ee8007ee237e02ace3bf2b9cd0ddf1a IN  0x126219afdea0b3b750a58822e71f2271a73e08220 MATIC0.0021248130
0x153acc9a0eba86e7088011bff51e80a9fc33f0a8fb13a075754c91cdf20645740x60806040237863692022-01-16 12:08:05263 days 2 hrs ago0x820de2eb0ee8007ee237e02ace3bf2b9cd0ddf1a IN  Contract Creation0 MATIC0.1311133530
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x4585A780F83d81f5A31fd5e07328ac53df54e2D5

Contract Name:
EthalendVaultsQuickSwapStrategy

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 14 : EthalendVaultsQuickSwapStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "interfaces/IRegistry.sol";
import "interfaces/IWallet.sol";
import "interfaces/IDistribution.sol";
import "interfaces/IVault.sol";
import "interfaces/IMemory.sol";
import "../libraries/TransferHelper.sol";

contract EthalendVaultsQuickSwapStrategy is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using Address for address;

    // Contracts used by Ethalend.
    struct EthalendContracts {
        IRegistry registry; //ethalend registry contract
        address curvePool; // curvePool conntract address
        address transferLogic; //contract address used by ethalend underneath to transfer funds to ethalend before deposit.
        address curveLogic; //contract address used by ethalend underneath to swap/addLiquidity for curve pools.
        address quickSwapLogic; //contract address used by ethalend underneath to swap/addLiquidity to quickswap.
        address vaultLogic; //contract address used by ethalend underneath to deposit funds into vaults
        address eVault; //contract address used by ethalend. This is the vault address so if the reward token is weth, this will be weth Evault address
    }

    EthalendContracts public ethalendContracts;

    IWallet public ethaWallet;
    IMemory public memoryContract; //This is the memory contract address used to retrieve variables stored in memory

    IERC20 public asset; //same which was used in staking pool
    IERC20 public secondaryAsset; //the token used as tokenB when providing liquidity.
    IERC20 public rewardToken; //wmatic/wbtc/link
    IERC20 public etha;

    address public ygnConverter; // YGN Converter address
    address public farm; //Farm Address
    uint256 public strategyWithdrawalFeeBP = 10; // 0.1% in ethalend. StrategyWithdraw fee in basis points. This is respective to ethalend and the token so there is no use of saving this in poolInfo
    uint256 public strategyDepositFeeBP = 0;
    uint256 public totalInputTokensStaked = 0;

    bool public supportsEmergencyWithdraw = false;
    bool public isStrategyEnabled = true;

    // whitelisted liquidityHolders
    mapping(address => bool) public liquidityHolders;

    event SetYGNConverter(address indexed user, address indexed ygnConverter);
    event RescueAsset(address farm, uint256 rescuedAssetAmount);
    event LiquidityHolderStatus(address liquidityHolder, bool status);

    modifier ensureNonZeroAddress(address addressToCheck) {
        require(addressToCheck != address(0), "No zero address");
        _;
    }

    modifier ensureValidTokenAddress(address _token) {
        require(_token != address(0), "No zero address");
        require(_token == address(asset), "Invalid token for deposit/withdraw");
        _;
    }

    modifier ensureValidLiquidityHolder(address liquidityHolder) {
        require(liquidityHolder != address(0), "No zero address");
        require(liquidityHolders[liquidityHolder], "Invalid Liquidity Holder");
        _;
    }

    /**
     * @notice Creates a new Ethalend Vault Strategy Contract
     * @param _asset usdc/usdt/dai token address. This is the input token for the pool and the vault.
     * @param _secondaryAsset This is the secondary asset which is introduced as a pair with the vaults.
     * @param _rewardToken Reward Token is the reward given out by the vaults (wbtc, wmatic, link)
     * @param _etha Etha Token Address
     * @param _registry; //ethalend registry contract
     * @param _curvePool; //curve pool contract used for swapping by curve
     * @param _transferLogic; //contract address used by ethalend underneath to transfer funds to ethalend.
     * @param _curveLogic; //contract address used by ethalend underneath to swap for curve pools.
     * @param _quickSwapLogic; //contract address used by ethalend underneath to swap/addLiquidity to quickswap.
     * @param _vaultLogic; //contract address used by ethalend underneath to deposit/withdraw funds for vaults
     * @param _eVault; //contract address used by ethalend which is the vault address so if the reward token is weth, this will be weth Evault address
     * @param _ygnConverter fee address for transferring residues and reward tokens
     * @dev deployer of contract is set as owner
     */
    constructor(
        IERC20 _asset,
        IERC20 _secondaryAsset,
        IERC20 _rewardToken,
        IERC20 _etha,
        IRegistry _registry,
        address _curvePool,
        address _transferLogic,
        address _curveLogic,
        address _quickSwapLogic,
        address _vaultLogic,
        address _eVault,
        address _ygnConverter
    ) {
        asset = _asset;
        secondaryAsset = _secondaryAsset;
        rewardToken = _rewardToken;
        etha = _etha;
        ethalendContracts.registry = _registry;
        ethalendContracts.curvePool = _curvePool;
        ethalendContracts.transferLogic = _transferLogic;
        ethalendContracts.curveLogic = _curveLogic;
        ethalendContracts.quickSwapLogic = _quickSwapLogic;
        ethalendContracts.vaultLogic = _vaultLogic;
        ethalendContracts.eVault = _eVault;
        ygnConverter = _ygnConverter;
        ethaWallet = IWallet(ethalendContracts.registry.deployWallet());
        require(address(ethaWallet) != address(0), "Etha Wallet not deployed");
        IERC20(asset).safeApprove(address(ethaWallet), uint256(-1));
        memoryContract = IMemory(ethalendContracts.registry.memoryAddr());
    }

    function updateLiquidityHolder(address _liquidityHolder, bool _status)
        external
        onlyOwner
        ensureNonZeroAddress(_liquidityHolder)
    {
        liquidityHolders[_liquidityHolder] = _status;
        emit LiquidityHolderStatus(_liquidityHolder, _status);
    }

    /**
     * @notice Updates the Strategy Mode for the strategy
     * @param _isStrategyEnabled bool flag to enable disable strategy
     * @dev Only owner can call and update the strategy mode
     */
    function updateStrategyMode(bool _isStrategyEnabled) external onlyOwner {
        isStrategyEnabled = _isStrategyEnabled;
    }

    /**
     * @notice Updates the emergency withdraw support Mode for the protocol
     * @param _supportsEmergencyWithdraw bool flag to enable disable if protocol supports emergency withdraw
     * @dev Only owner can call and update this
     */
    function updateSupportsEmergencyWithdraw(bool _supportsEmergencyWithdraw) external onlyOwner {
        supportsEmergencyWithdraw = _supportsEmergencyWithdraw;
    }

    /**
     * @notice Updates the Farm Address for the strategy
     * @param _farm Address of the farm
     * @dev Only owner can call and update the farm address
     */
    function updateFarmAddress(address _farm) external onlyOwner ensureNonZeroAddress(_farm) {
        liquidityHolders[farm] = false;
        farm = _farm;
        liquidityHolders[farm] = true;
    }

    /**
     * @notice Updates the QuickSwap LP Token Address.
     * @param _asset Address of the QuickSwap LP
     * @dev Only owner can call and update the QuickSwap LP address
     */
    function updateAsset(IERC20 _asset) external onlyOwner ensureNonZeroAddress(address(_asset)) {
        asset = _asset;
    }

    /**
     * @notice Can be used by the owner to update the address for reward token
     * @param _rewardToken ERC20 address for the new reward token
     * @dev Only owner can call and update the rewardToken.
     */
    function updateRewardToken(IERC20 _rewardToken)
        external
        onlyOwner
        ensureNonZeroAddress(address(_rewardToken))
    {
        rewardToken = _rewardToken;
    }

    /**
     * @notice Can be used by the owner to update the address for etha token
     * @param _etha ERC20 address for the etha token
     * @dev Only owner can call and update the etha token address.
     */
    function updateETHA(IERC20 _etha) external onlyOwner ensureNonZeroAddress(address(_etha)) {
        etha = _etha;
    }

    /**
     * @notice Updates the secondary asset of the strategy. Should not be used since the funds will remain in the first vault
     * @param _secondaryAsset Address of the secondary asset
     * @dev Only owner can call and update the secondary asset
     */
    function updateSecondaryAsset(IERC20 _secondaryAsset)
        external
        onlyOwner
        ensureNonZeroAddress(address(_secondaryAsset))
    {
        secondaryAsset = _secondaryAsset;
    }

    /**
     * @notice Updates the registry contract of the ethalend ecosystem.
     * @param _registry Address of the registry
     * @dev Only owner can call and update the registry contract of the ethalend registry
     */
    function updateRegistry(IRegistry _registry)
        external
        onlyOwner
        ensureNonZeroAddress(address(_registry))
    {
        ethalendContracts.registry = _registry;
    }

    /**
     * @notice Updates the transferLogic contract of the ethalend ecosystem.
     * @param _transferLogic Address of the transferLogic contract
     * @dev Only owner can call and update the transferLogic contract of the ethalend ecosystem
     */
    function updateTransferLogicContract(address _transferLogic)
        external
        onlyOwner
        ensureNonZeroAddress(_transferLogic)
    {
        ethalendContracts.transferLogic = _transferLogic;
    }

    /**
     * @notice Updates the curveLogic contract of the ethalend ecosystem.
     * @param _curveLogic Address of the curveLogic contract
     * @dev Only owner can call and update the curveLogic contract of the ethalend ecosystem
     */
    function updateCurveLogicContract(address _curveLogic)
        external
        onlyOwner
        ensureNonZeroAddress(_curveLogic)
    {
        ethalendContracts.curveLogic = _curveLogic;
    }

    /**
     * @notice Updates the curvePool contract of the ethalend ecosystem.
     * @param _curvePool Address of the curvePool contract
     * @dev Only owner can call and update the curvePool contract of the ethalend ecosystem
     */
    function updateCurvePoolContract(address _curvePool)
        external
        onlyOwner
        ensureNonZeroAddress(_curvePool)
    {
        ethalendContracts.curvePool = _curvePool;
    }

    /**
     * @notice Updates the quickSwapLogic contract of the ethalend ecosystem.
     * @param _quickSwapLogic Address of the quickSwapLogic contract
     * @dev Only owner can call and update the quickSwapLogic contract of the ethalend ecosystem
     */
    function updateEthalendQuickSwapLogicContract(address _quickSwapLogic)
        external
        onlyOwner
        ensureNonZeroAddress(_quickSwapLogic)
    {
        ethalendContracts.quickSwapLogic = _quickSwapLogic;
    }

    /**
     * @notice Updates the vaultLogic contract of the ethalend ecosystem.
     * @param _vaultLogic Address of the vaultLogic contract
     * @dev Only owner can call and update the vaultLogic contract of the ethalend ecosystem
     */
    function updateEthalendVaultLogicContract(address _vaultLogic)
        external
        onlyOwner
        ensureNonZeroAddress(_vaultLogic)
    {
        ethalendContracts.vaultLogic = _vaultLogic;
    }

    /**
     * @notice Updates the eVault contract of the ethalend ecosystem. This is the exact vault dependent on the rewardToken given out.
     * @param _eVault Address of the eVault contract
     * @dev Only owner can call and update the eVault contract of the ethalend ecosystem
     */
    function updateEthalendEVaultContract(address _eVault)
        external
        onlyOwner
        ensureNonZeroAddress(_eVault)
    {
        ethalendContracts.eVault = _eVault;
    }

    /**
     * @notice Can be used by the owner to update the withdrawal fee based on the ethalend contracts. Should not be modified unless ethalend updates it.
     * @param _strategyWithdrawalFeeBP New withdrawal fee of the ethalend vault contracts in basis points
     * @dev Only owner can call and update the ethalend withdrawal fee.
     */
    function updateStrategyWithdrawalFee(uint256 _strategyWithdrawalFeeBP) external onlyOwner {
        strategyWithdrawalFeeBP = _strategyWithdrawalFeeBP;
    }

    /**
     * @notice Can be used by the owner to update the deposit fee based on the ethalend contracts. Currently there is no deposit fee
     * @param _strategyDepositFeeBP New deposit fee of the ethalend vault contracts in basis points
     * @dev Only owner can call and update the ethalend deposit fee.
     */
    function updateStrategyDepositFee(uint256 _strategyDepositFeeBP) external onlyOwner {
        strategyDepositFeeBP = _strategyDepositFeeBP;
    }

    // Update YGN Converter
    function setYGNConverter(address _ygnConverter)
        external
        onlyOwner
        ensureNonZeroAddress(_ygnConverter)
    {
        ygnConverter = _ygnConverter;
        emit SetYGNConverter(_msgSender(), _ygnConverter);
    }

    /**
     * @notice transfer accumulated asset. Shouldn't be called since this will transfer community's residue asset to ygnConverter
     * @param _withdrawFromEthaWallet true if rewards need to be withdrawn from ethawallet.
     * @dev Only owner can call and claim the residue assets
     */
    function transferAssetResidue(bool _withdrawFromEthaWallet) external onlyOwner {
        updatePool();
        if (_withdrawFromEthaWallet) {
            _withdrawTokenFromEthaWallet(address(asset), asset.balanceOf(address(ethaWallet)));
        }
        uint256 assetResidue = asset.balanceOf(address(this));
        TransferHelper.safeTransfer(address(asset), ygnConverter, assetResidue);
    }

    /**
     * @notice transfer accumulated secodary asset. Shouldn't be called since this will transfer community's residue secondary asset to ygnConverter
     * @param _withdrawFromEthaWallet true if rewards need to be withdrawn from ethawallet.
     * @dev Only owner can call and claim the secondary assets residue
     */
    function transferSecondaryAssetResidue(bool _withdrawFromEthaWallet) external onlyOwner {
        updatePool();
        if (_withdrawFromEthaWallet) {
            _withdrawTokenFromEthaWallet(
                address(secondaryAsset),
                secondaryAsset.balanceOf(address(ethaWallet))
            );
        }
        uint256 secondaryAssetResidue = secondaryAsset.balanceOf(address(this));
        TransferHelper.safeTransfer(address(secondaryAsset), ygnConverter, secondaryAssetResidue);
    }

    /**
     * @notice transfer accumulated reward tokens. Shouldn't be called since this will transfer community's reward tokens to ygnConverter
     * @dev Only owner can call and claim the reward tokens
     */
    function transferRewardTokenRewards(bool _withdrawFromEthaWallet) external onlyOwner {
        updatePool();
        if (_withdrawFromEthaWallet) {
            _withdrawTokenFromEthaWallet(
                address(rewardToken),
                rewardToken.balanceOf(address(ethaWallet))
            );
        }
        uint256 rewardTokenRewards = rewardToken.balanceOf(address(this));
        TransferHelper.safeTransfer(address(rewardToken), ygnConverter, rewardTokenRewards);
    }

    /**
     * @notice transfer etha rewards tokens. Shouldn't be called since this will transfer community's etha to ygnConverter.
     * @dev Only owner can call and claim the etha reward tokens
     */
    function transferEthaRewards(bool _withdrawFromEthaWallet) external onlyOwner {
        updatePool();
        if (_withdrawFromEthaWallet) {
            _withdrawTokenFromEthaWallet(address(etha), etha.balanceOf(address(ethaWallet)));
        }
        uint256 ethaTokenRewards = etha.balanceOf(address(this));
        TransferHelper.safeTransfer(address(etha), ygnConverter, ethaTokenRewards);
    }

    /**
     * @dev View function to see pending etha rewards.
     */
    function getPendingEthaRewards() public view returns (uint256 pendingEthaRewards) {
        IDistribution distribution = IDistribution(IVault(ethalendContracts.eVault).distribution());
        pendingEthaRewards = distribution.earned(address(ethaWallet));
    }

    /**
     * @dev View function to see pending reward tokens generated.
     */
    function getTotalRewardTokensGenerated()
        public
        view
        returns (uint256 totalRewardTokensGenerated)
    {
        totalRewardTokensGenerated = IVault(ethalendContracts.eVault).unclaimedProfit(
            address(ethaWallet)
        );
    }

    /**
     * @dev View function to get total LP staked in vaults.
     */
    function getTotalLPStaked() public view returns (uint256 totalLPStaked) {
        IVault vault = IVault(ethalendContracts.eVault);
        totalLPStaked = vault.balanceOf(address(ethaWallet));
    }

    /**
     * @dev function to claim rewards (etha and rewardTokens to ethawallet)
     */
    function _claimRewardsToEthaWallet() internal {
        //These steps are for building the claim tx.
        address[] memory targets = new address[](1);
        bytes[] memory datas = new bytes[](1);

        targets[0] = ethalendContracts.vaultLogic;
        datas[0] = abi.encodeWithSignature(
            "claim(address,uint256)",
            address(ethalendContracts.eVault),
            0 //setId. Is zero since it doesn't matter
        );

        ethaWallet.execute(targets, datas);
    }

    // function to withdraw rewards (rewardTokens and etha tokens) from ethaWallet to contract.
    function _withdrawRewardsFromEthaWallet() internal {
        //withdraw full available balance of the reward tokens
        _withdrawTokenFromEthaWallet(
            address(rewardToken),
            rewardToken.balanceOf(address(ethaWallet))
        );
        //withdraw full available balance of the etha tokens
        _withdrawTokenFromEthaWallet(address(etha), etha.balanceOf(address(ethaWallet)));
    }

    /**
     * @dev function to withdraw token from ethaWallet to strategy contract.
     */
    function _withdrawTokenFromEthaWallet(address _token, uint256 _amountToWithdraw)
        internal
        returns (uint256 withdrawnAmount)
    {
        if (_amountToWithdraw > 0) {
            uint256 initialStrategyBalance = IERC20(_token).balanceOf(address(this));
            address[] memory targets = new address[](1);
            bytes[] memory datas = new bytes[](1);
            targets[0] = ethalendContracts.transferLogic;
            datas[0] = abi.encodeWithSignature(
                "withdraw(address,uint256)",
                _token,
                _amountToWithdraw
            );
            ethaWallet.execute(targets, datas);
            uint256 afterWithdrawStrategyBalance = IERC20(_token).balanceOf(address(this));
            withdrawnAmount = afterWithdrawStrategyBalance.sub(initialStrategyBalance);
            require(withdrawnAmount == _amountToWithdraw, "Invalid withdrawn amount processed");
        }
    }

    // function to deposit asset from contract to Ethalend Vaults.
    function _depositAssetToEthalendVaults(uint256 _amount) internal {
        uint256 initialLPBalanceInVaults = getTotalLPStaked();
        //These steps are for building the lego tx.
        address[] memory targets = new address[](4);
        bytes[] memory datas = new bytes[](4);

        //Step 1 - Transfer asset from strategy to created ethalend wallet.
        targets[0] = ethalendContracts.transferLogic;
        datas[0] = abi.encodeWithSignature("deposit(address,uint256)", asset, _amount);

        //Step 2- Swap half of asset to secondary asset using curveLogic contract
        targets[1] = ethalendContracts.curveLogic;
        datas[1] = abi.encodeWithSignature(
            "swap(address,address,address,uint256,uint256,uint256,uint256)",
            ethalendContracts.curvePool,
            asset,
            secondaryAsset,
            _amount.div(2),
            0, //getId
            1, //setId (for setting in memory where amount of B tokens are stored)
            1 //divider which is 1 by default
        );

        //Step 3 - Add Liquidity for asset and secondary asset using quickSwapLogic contract
        targets[2] = ethalendContracts.quickSwapLogic;
        datas[2] = abi.encodeWithSignature(
            "addLiquidity(address,address,uint256,uint256,uint256,uint256,uint256,uint256)",
            address(asset),
            address(secondaryAsset),
            _amount.div(2),
            0, //since this is fetched from the memory i.e. getId2
            0, //getId is 0, since amt tokenA is provided
            1, //getId2 is 1 since the amount swapped is stored at id - 1 in memory contract
            1, //setId is 1 since this is for the no.of lp tokens that are received and stored in memory
            1 //divider which is 1 by default
        );

        //Step 4 - Add Received LP Tokens in the respective e-vault contract through the vault logic contract
        targets[3] = ethalendContracts.vaultLogic;
        datas[3] = abi.encodeWithSignature(
            "deposit(address,uint256,uint256)",
            address(ethalendContracts.eVault),
            0, //can add this as anything since this is fetched from the memory
            1 //getId2 this is memory id for where the lp tokens are stored
        );

        ethaWallet.execute(targets, datas);
        uint256 finalLPBalanceInVaults = getTotalLPStaked();
        uint256 lpDeposited = memoryContract.getUint(1); //since this is for the no.of lp tokens that are received
        require(
            lpDeposited == finalLPBalanceInVaults.sub(initialLPBalanceInVaults),
            "Invalid LP amount deposited"
        );
    }

    // function to withdraw asset from Ethalend Vaults to ethawallet.
    function _withdrawAssetFromEthalendVaults(uint256 _lpAmountToWithdraw)
        internal
        returns (uint256 assetWithdrawnInEthaWallet)
    {
        uint256 initialAssetBalanceInEthaWallet = asset.balanceOf(address(ethaWallet));
        //These steps are for building the lego tx.
        address[] memory targets = new address[](3);
        bytes[] memory datas = new bytes[](3);

        //Step 1 - Remove LP tokens based on the number of tokens deposited.
        targets[0] = ethalendContracts.vaultLogic;
        datas[0] = abi.encodeWithSignature(
            "withdraw(address,uint256,uint256,uint256)",
            address(ethalendContracts.eVault),
            _lpAmountToWithdraw,
            0, //getId
            1 //setId (for setting in memory where amount of LP tokens removed are stored)
        );

        //Step 2- Remove Liquidity for these LP tokens

        targets[1] = ethalendContracts.quickSwapLogic;
        datas[1] = abi.encodeWithSignature(
            "removeLiquidity(address,address,address,uint256,uint256,uint256,uint256,uint256)",
            address(asset),
            address(secondaryAsset),
            address(IVault(ethalendContracts.eVault).underlying()),
            0, //amount of LP. Here zero since it will take from memory
            1, //getId for where LP tokens are stored
            1, //setId (for setting in memory where amount of asset tokens are stored)
            2, //setId2 (for setting in memory where amount of secondary asset tokens are stored)
            1 //divider which is 1 by default
        );

        //Step 3 - Swap secondary asset received to primary asset. This step is trickey. Need to know if we need to use quickswap to remove liquidity or curve.
        targets[2] = ethalendContracts.curveLogic;
        datas[2] = abi.encodeWithSignature(
            "swap(address,address,address,uint256,uint256,uint256,uint256)",
            ethalendContracts.curvePool,
            address(secondaryAsset),
            address(asset),
            0, //amount of source token. Here zero since it will take from memory
            2, //getId is 2 since the amount of tokenB is stored at 12 in memory contract
            3, //setId is 3. This is for the amount of asset received after swapping.
            1 //divider which is 1 by default
        );

        ethaWallet.execute(targets, datas);

        uint256 finalAssetBalanceInEthaWallet = asset.balanceOf(address(ethaWallet));
        assetWithdrawnInEthaWallet = memoryContract.getUint(1).add(memoryContract.getUint(3)); //swapped amout plus the amount received by removing liquidity

        //consider again if this is needed
        require(
            assetWithdrawnInEthaWallet ==
                finalAssetBalanceInEthaWallet.sub(initialAssetBalanceInEthaWallet),
            "Invalid amount of asset withdrawn"
        );
    }

    /**
     * @notice View function to see pending rewards on frontend.
     */
    function getPendingRewards()
        external
        view
        returns (uint256 pendingRewardTokens, uint256 pendingEthaTokens)
    {
        pendingRewardTokens = getTotalRewardTokensGenerated();
        pendingEthaTokens = getPendingEthaRewards();
    }

    /**
     * @notice Update reward variables of the pool to be up-to-date. This also claims the rewards generated form vaults
     */
    function updatePool() public {
        uint256 totalLPStaked = getTotalLPStaked();

        if (totalLPStaked == 0) {
            return;
        }

        uint256 totalRewardTokensGenerated = getTotalRewardTokensGenerated();
        uint256 pendingEthaRewards = getPendingEthaRewards();

        if (totalRewardTokensGenerated > 0 || pendingEthaRewards > 0) {
            _claimRewardsToEthaWallet();
            _withdrawRewardsFromEthaWallet();
            uint256 rewardTokenRewards = rewardToken.balanceOf(address(this));
            TransferHelper.safeTransfer(address(rewardToken), ygnConverter, rewardTokenRewards);
            uint256 ethaTokenRewards = etha.balanceOf(address(this));
            TransferHelper.safeTransfer(address(etha), ygnConverter, ethaTokenRewards);
        }
    }

    /**
     * @notice function to deposit asset to ethalend vaults.
     * @param _token Address of the token. (Should be the same as the asset token)
     * @param _amount amount of asset token deposited.
     * @dev Can only be called from the liquidity manager
     */
    function deposit(address _token, uint256 _amount)
        external
        ensureValidTokenAddress(_token)
        ensureValidLiquidityHolder(msg.sender)
        nonReentrant
        returns (uint256 depositedAmount)
    {
        require(isStrategyEnabled, "Strategy is disabled");
        updatePool();
        if (_amount > 0) {
            TransferHelper.safeTransferFrom(_token, farm, address(this), _amount);
            _depositAssetToEthalendVaults(_amount);
            depositedAmount = _amount;
        }
        totalInputTokensStaked = totalInputTokensStaked.add(_amount);
    }

    /**
     * @notice function to withdraw asset from ethalend vaults.
     * @param _token Address of the token. (Should be the same as the asset token)
     * @param _amount amount of asset token the user wants to withdraw.
     * @dev Can only be called from the liquidity manager
     */
    function withdraw(address _token, uint256 _amount)
        external
        ensureValidTokenAddress(_token)
        ensureValidLiquidityHolder(msg.sender)
        nonReentrant
        returns (uint256 withdrawnAmount)
    {
        updatePool();
        if (_amount > 0) {
            if (isStrategyEnabled) {
                uint256 totalLPStaked = getTotalLPStaked();
                uint256 lpAmountToWithdraw = _amount.mul(totalLPStaked).div(totalInputTokensStaked);
                uint256 assetWithdrawnInEthaWallet = _withdrawAssetFromEthalendVaults(
                    lpAmountToWithdraw
                );
                withdrawnAmount = _withdrawTokenFromEthaWallet(
                    address(asset),
                    assetWithdrawnInEthaWallet
                );
            } else {
                withdrawnAmount = _getWithdrawableAmount(_amount);
            }
            IERC20(_token).safeApprove(address(msg.sender), withdrawnAmount);
        }
        totalInputTokensStaked = totalInputTokensStaked.sub(_amount);
    }

    /**
     * @notice function to withdraw all asset and transfer back to liquidity holder.
     * @param _token Address of the token. (Should be the same as the asset token)
     * @dev Can only be called from the liquidity manager by the owner
     */
    function rescueFunds(address _token)
        external
        onlyOwner
        ensureValidTokenAddress(_token)
        returns (uint256 rescuedAssetAmount)
    {
        updatePool();
        uint256 totalLPStaked = getTotalLPStaked();

        if (totalLPStaked > 0) {
            _withdrawAssetFromEthalendVaults(totalLPStaked);
            _withdrawTokenFromEthaWallet(address(asset), asset.balanceOf(address(ethaWallet)));
            rescuedAssetAmount = asset.balanceOf(address(this));
            emit RescueAsset(msg.sender, rescuedAssetAmount);
            isStrategyEnabled = false;
        }
    }

    function _getWithdrawableAmount(uint256 _amount)
        internal
        view
        returns (uint256 withdrawableAmount)
    {
        uint256 totalBalance = asset.balanceOf(address(this));
        uint256 totalAmount = totalBalance >= totalInputTokensStaked
            ? totalInputTokensStaked
            : totalBalance;
        withdrawableAmount = _amount.mul(totalAmount).div(totalInputTokensStaked);
    }
}

File 2 of 14 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

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

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

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

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

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

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

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

File 3 of 14 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 4 of 14 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 5 of 14 : IRegistry.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

/**
 * @title RegistryInterface Interface
 */
interface IRegistry {
    function logic(address logicAddr) external view returns (bool);

    function implementation(bytes32 key) external view returns (address);

    function notAllowed(address erc20) external view returns (bool);

    function deployWallet() external returns (address);

    function wallets(address user) external view returns (address);

    function getFee() external view returns (uint256);

    function getFeeManager() external view returns (address);

    function feeRecipient() external view returns (address);

    function memoryAddr() external view returns (address);

    function distributionContract(address token) external view returns (address);
}

File 6 of 14 : IWallet.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
pragma experimental ABIEncoderV2;

interface IWallet {
    event LogMint(address indexed erc20, uint256 tokenAmt);
    event LogRedeem(address indexed erc20, uint256 tokenAmt);
    event LogBorrow(address indexed erc20, uint256 tokenAmt);
    event LogPayback(address indexed erc20, uint256 tokenAmt);
    event LogDeposit(address indexed erc20, uint256 tokenAmt);
    event LogWithdraw(address indexed erc20, uint256 tokenAmt);
    event LogSwap(address indexed src, address indexed dest, uint256 amount);
    event LogLiquidityAdd(
        address indexed tokenA,
        address indexed tokenB,
        uint256 amountA,
        uint256 amountB
    );
    event LogLiquidityRemove(
        address indexed tokenA,
        address indexed tokenB,
        uint256 amountA,
        uint256 amountB
    );
    event VaultDeposit(address indexed erc20, uint256 tokenAmt);
    event VaultWithdraw(address indexed erc20, uint256 tokenAmt);
    event VaultClaim(address indexed erc20, uint256 tokenAmt);
    event DelegateAdded(address delegate);
    event DelegateRemoved(address delegate);
    event Claim(address indexed erc20, uint256 tokenAmt);
    event Staked(address indexed erc20, uint256 tokenAmt);
    event Unstaked(address indexed erc20, uint256 tokenAmt);

    function executeMetaTransaction(bytes memory sign, bytes memory data) external;

    function execute(address[] calldata targets, bytes[] calldata datas) external payable;

    function owner() external view returns (address);

    function registry() external view returns (address);

    function DELEGATE_ROLE() external view returns (bytes32);

    function hasRole(bytes32, address) external view returns (bool);
}

File 7 of 14 : IDistribution.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

interface IDistribution {
    function stake(address user, uint256 redeemTokens) external;

    function withdraw(address user, uint256 redeemAmount) external;

    function getReward(address user) external;

    function balanceOf(address account) external view returns (uint256);

    function rewardsToken() external view returns (address);

    function earned(address account) external view returns (uint256);

    function rewardPerToken() external view returns (uint256);

    function rewardRate() external view returns (uint256);
}

File 8 of 14 : IVault.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IERC20Detailed is IERC20 {
    function decimals() external view returns (uint8);
}

interface IVault {
    function underlying() external view returns (IERC20Detailed);

    function target() external view returns (IERC20);

    function distribution() external view returns (address);

    function strat() external view returns (address);

    function timelock() external view returns (address payable);

    function balanceOf(address) external view returns (uint256);

    function calcTotalValue() external view returns (uint256);

    function changePerformanceFee(uint256 fee) external;

    function claim() external returns (uint256 claimed);

    function unclaimedProfit(address user) external view returns (uint256);

    function pending(address user) external view returns (uint256);
}

File 9 of 14 : IMemory.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;

interface IMemory {
    function getUint(uint256) external view returns (uint256);

    function setUint(uint256 id, uint256 value) external;

    function getAToken(address asset) external view returns (address);

    function setAToken(address asset, address _aToken) external;

    function getCrToken(address asset) external view returns (address);

    function setCrToken(address asset, address _crToken) external;
}

File 10 of 14 : TransferHelper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.0;

library TransferHelper {
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x095ea7b3, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper: APPROVE_FAILED"
        );
    }

    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0xa9059cbb, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper: TRANSFER_FAILED"
        );
    }

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x23b872dd, from, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "TransferHelper: TRANSFER_FROM_FAILED"
        );
    }
}

File 11 of 14 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 12 of 14 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

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

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

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

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

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

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

File 13 of 14 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }

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

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 14 of 14 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_asset","type":"address"},{"internalType":"contract IERC20","name":"_secondaryAsset","type":"address"},{"internalType":"contract IERC20","name":"_rewardToken","type":"address"},{"internalType":"contract IERC20","name":"_etha","type":"address"},{"internalType":"contract IRegistry","name":"_registry","type":"address"},{"internalType":"address","name":"_curvePool","type":"address"},{"internalType":"address","name":"_transferLogic","type":"address"},{"internalType":"address","name":"_curveLogic","type":"address"},{"internalType":"address","name":"_quickSwapLogic","type":"address"},{"internalType":"address","name":"_vaultLogic","type":"address"},{"internalType":"address","name":"_eVault","type":"address"},{"internalType":"address","name":"_ygnConverter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"liquidityHolder","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"LiquidityHolderStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"farm","type":"address"},{"indexed":false,"internalType":"uint256","name":"rescuedAssetAmount","type":"uint256"}],"name":"RescueAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"ygnConverter","type":"address"}],"name":"SetYGNConverter","type":"event"},{"inputs":[],"name":"asset","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"depositedAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"etha","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethaWallet","outputs":[{"internalType":"contract IWallet","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ethalendContracts","outputs":[{"internalType":"contract IRegistry","name":"registry","type":"address"},{"internalType":"address","name":"curvePool","type":"address"},{"internalType":"address","name":"transferLogic","type":"address"},{"internalType":"address","name":"curveLogic","type":"address"},{"internalType":"address","name":"quickSwapLogic","type":"address"},{"internalType":"address","name":"vaultLogic","type":"address"},{"internalType":"address","name":"eVault","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"farm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingEthaRewards","outputs":[{"internalType":"uint256","name":"pendingEthaRewards","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPendingRewards","outputs":[{"internalType":"uint256","name":"pendingRewardTokens","type":"uint256"},{"internalType":"uint256","name":"pendingEthaTokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalLPStaked","outputs":[{"internalType":"uint256","name":"totalLPStaked","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalRewardTokensGenerated","outputs":[{"internalType":"uint256","name":"totalRewardTokensGenerated","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStrategyEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"liquidityHolders","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"memoryContract","outputs":[{"internalType":"contract IMemory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"rescueFunds","outputs":[{"internalType":"uint256","name":"rescuedAssetAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"secondaryAsset","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ygnConverter","type":"address"}],"name":"setYGNConverter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategyDepositFeeBP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"strategyWithdrawalFeeBP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supportsEmergencyWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalInputTokensStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_withdrawFromEthaWallet","type":"bool"}],"name":"transferAssetResidue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_withdrawFromEthaWallet","type":"bool"}],"name":"transferEthaRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_withdrawFromEthaWallet","type":"bool"}],"name":"transferRewardTokenRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_withdrawFromEthaWallet","type":"bool"}],"name":"transferSecondaryAssetResidue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_asset","type":"address"}],"name":"updateAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_curveLogic","type":"address"}],"name":"updateCurveLogicContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_curvePool","type":"address"}],"name":"updateCurvePoolContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_etha","type":"address"}],"name":"updateETHA","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_eVault","type":"address"}],"name":"updateEthalendEVaultContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_quickSwapLogic","type":"address"}],"name":"updateEthalendQuickSwapLogicContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultLogic","type":"address"}],"name":"updateEthalendVaultLogicContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_farm","type":"address"}],"name":"updateFarmAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_liquidityHolder","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"updateLiquidityHolder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRegistry","name":"_registry","type":"address"}],"name":"updateRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_rewardToken","type":"address"}],"name":"updateRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_secondaryAsset","type":"address"}],"name":"updateSecondaryAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strategyDepositFeeBP","type":"uint256"}],"name":"updateStrategyDepositFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isStrategyEnabled","type":"bool"}],"name":"updateStrategyMode","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_strategyWithdrawalFeeBP","type":"uint256"}],"name":"updateStrategyWithdrawalFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_supportsEmergencyWithdraw","type":"bool"}],"name":"updateSupportsEmergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_transferLogic","type":"address"}],"name":"updateTransferLogicContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"withdrawnAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ygnConverter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080604052600a601155600060128190556013556014805461ffff19166101001790553480156200002f57600080fd5b50604051620048d7380380620048d783398101604081905262000052916200073b565b60006200005e620002f5565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060018055600b80546001600160a01b03199081166001600160a01b038f811691909117909255600c805482168e8416179055600d805482168d8416179055600e805482168c84161790556002805482168b841617908190556003805483168b85161790556004805483168a85161781556005805484168a8616179055600680548416898616179055600780548416888616179055600880548416878616179055600f805490931685851617909255604080516353535db960e01b8152905191909316926353535db992818101926020929091908290030181600087803b1580156200019257600080fd5b505af1158015620001a7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001cd91906200071c565b600980546001600160a01b0319166001600160a01b03928316179081905516620002145760405162461bcd60e51b81526004016200020b9062000840565b60405180910390fd5b600954600b5462000241916001600160a01b039182169116600019620002f9602090811b6200225917901c565b6002546040805163f54ad35f60e01b815290516001600160a01b039092169163f54ad35f91600480820192602092909190829003018186803b1580156200028757600080fd5b505afa1580156200029c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002c291906200071c565b600a80546001600160a01b0319166001600160a01b039290921691909117905550620008909a5050505050505050505050565b3390565b80158062000383575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156200035357600080fd5b505afa15801562000368573d6000803e3d6000fd5b505050506040513d60208110156200037f57600080fd5b5051155b620003c05760405162461bcd60e51b8152600401808060200182810382526036815260200180620048a16036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620004189185916200041d16565b505050565b600062000479826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620004d960201b6200236c179092919060201c565b80519091501562000418578080602001905160208110156200049a57600080fd5b5051620004185760405162461bcd60e51b815260040180806020018281038252602a81526020018062004877602a913960400191505060405180910390fd5b6060620004ea8484600085620004f4565b90505b9392505050565b606082471015620005375760405162461bcd60e51b8152600401808060200182810382526026815260200180620048516026913960400191505060405180910390fd5b62000542856200065b565b62000594576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310620005d45780518252601f199092019160209182019101620005b3565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811462000638576040519150601f19603f3d011682016040523d82523d6000602084013e6200063d565b606091505b5090925090506200065082828662000665565b979650505050505050565b803b15155b919050565b6060831562000676575081620004ed565b825115620006875782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620006d3578181015183820152602001620006b9565b50505050905090810190601f168015620007015780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b8051620006608162000877565b6000602082840312156200072e578081fd5b8151620004ed8162000877565b6000806000806000806000806000806000806101808d8f0312156200075e578788fd5b8c516200076b8162000877565b60208e0151909c506200077e8162000877565b60408e0151909b50620007918162000877565b60608e0151909a50620007a48162000877565b60808e0151909950620007b78162000877565b60a08e0151909850620007ca8162000877565b9650620007da60c08e016200070f565b9550620007ea60e08e016200070f565b9450620007fb6101008e016200070f565b93506200080c6101208e016200070f565b92506200081d6101408e016200070f565b91506200082e6101608e016200070f565b90509295989b509295989b509295989b565b60208082526018908201527f457468612057616c6c6574206e6f74206465706c6f7965640000000000000000604082015260600190565b6001600160a01b03811681146200088d57600080fd5b50565b613fb180620008a06000396000f3fe608060405234801561001057600080fd5b50600436106102a05760003560e01c80637d206c0211610167578063d9621f9e116100ce578063f141b52b11610087578063f141b52b14610545578063f2fde38b14610558578063f3fef3a31461056b578063f75de6381461057e578063f7c618c114610586578063f8cf31cb1461058e576102a0565b8063d9621f9e146104e6578063da4701d0146104fc578063e3161ddd1461050f578063e38fee7014610517578063e53b20171461052a578063edb7d7801461053d576102a0565b8063a6ce326911610120578063a6ce3269146104ab578063a9daf0dc146104be578063bc46838d146104c6578063c7cb09b1146104ce578063d3771f77146104d6578063d80f6f54146104de576102a0565b80637d206c021461045857806380886d54146104605780638da5cb5b14610468578063980bdf18146104705780639f7754cd14610478578063a6532ea814610498576102a0565b80633a6596bd1161020b5780636d31d770116101c45780636d31d770146103e9578063715018a6146103fc57806373afbcf7146104045780637696c13e14610417578063797e1b1c1461042a5780637c22a33114610445576102a0565b80633a6596bd146103825780633e6c7a211461038a57806347e7ef241461039d578063582d8d5e146103b0578063663e4846146103c35780636843f75c146103d6576102a0565b8063235e88031161025d578063235e8803146103195780632be98ec01461032c57806336e9332d1461033f57806337081e301461035457806338d52e0f1461036757806339741e9f1461036f576102a0565b80630771d4e3146102a557806310e45fa9146102ba57806312036b43146102cd57806316f7f1d3146102eb5780631714dcb7146102f35780631a5da6c814610306575b600080fd5b6102b86102b33660046138d7565b6105a1565b005b6102b86102c836600461396e565b610656565b6102d56107fb565b6040516102e29190613cb4565b60405180910390f35b6102d5610801565b6102b8610301366004613988565b610807565b6102b86103143660046138d7565b61086e565b6102b86103273660046138d7565b61091a565b6102b861033a36600461396e565b610a02565b610347610a77565b6040516102e291906139b8565b6102b861036236600461396e565b610a86565b610347610b02565b6102b861037d3660046138d7565b610b11565b610347610bbd565b6102b86103983660046138d7565b610bcc565b6102d56103ab366004613943565b610ca9565b6102b86103be36600461396e565b610e29565b6102b86103d1366004613988565b610f75565b6102b86103e436600461390f565b610fdc565b6102b86103f736600461396e565b6110c8565b6102b8611214565b6102b86104123660046138d7565b6112c0565b6102b86104253660046138d7565b61136c565b610432611418565b6040516102e29796959493929190613c73565b6102b86104533660046138d7565b611451565b6103476114fd565b6102d561150c565b61034761161f565b61034761162e565b61048b6104863660046138d7565b61163d565b6040516102e29190613c68565b6102b86104a63660046138d7565b611652565b6102b86104b93660046138d7565b6116fe565b61048b6117aa565b6103476117b8565b6103476117c7565b61048b6117d6565b6102d56117df565b6104ee611817565b6040516102e2929190613e47565b6102b861050a36600461396e565b611832565b6102b861197e565b6102b86105253660046138d7565b611b1c565b6102d56105383660046138d7565b611bc8565b6102d5611dac565b6102b86105533660046138d7565b611e39565b6102b86105663660046138d7565b611ee5565b6102d5610579366004613943565b611fe7565b6102d5612198565b61034761219e565b6102b861059c3660046138d7565b6121ad565b6105a9612385565b6001600160a01b03166105ba61161f565b6001600160a01b031614610603576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166106335760405162461bcd60e51b815260040161062a90613e1e565b60405180910390fd5b50600780546001600160a01b0319166001600160a01b0392909216919091179055565b61065e612385565b6001600160a01b031661066f61161f565b6001600160a01b0316146106b8576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b6106c061197e565b801561075657600b546009546040516370a0823160e01b8152610754926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b60206040518083038186803b15801561071757600080fd5b505afa15801561072b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074f91906139a0565b612389565b505b600b546040516370a0823160e01b81526000916001600160a01b0316906370a08231906107879030906004016139b8565b60206040518083038186803b15801561079f57600080fd5b505afa1580156107b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d791906139a0565b600b54600f549192506107f7916001600160a01b0391821691168361260f565b5050565b60135481565b60115481565b61080f612385565b6001600160a01b031661082061161f565b6001600160a01b031614610869576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b601255565b610876612385565b6001600160a01b031661088761161f565b6001600160a01b0316146108d0576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166108f75760405162461bcd60e51b815260040161062a90613e1e565b50600280546001600160a01b0319166001600160a01b0392909216919091179055565b610922612385565b6001600160a01b031661093361161f565b6001600160a01b03161461097c576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166109a35760405162461bcd60e51b815260040161062a90613e1e565b600f80546001600160a01b0319166001600160a01b0384169081179091556109c9612385565b6001600160a01b03167f3bfd77603925bafa2bb0488d6a3fc3c802e56b29b4fc1744f336ee74290f541160405160405180910390a35050565b610a0a612385565b6001600160a01b0316610a1b61161f565b6001600160a01b031614610a64576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b6014805460ff1916911515919091179055565b6010546001600160a01b031681565b610a8e612385565b6001600160a01b0316610a9f61161f565b6001600160a01b031614610ae8576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b601480549115156101000261ff0019909216919091179055565b600b546001600160a01b031681565b610b19612385565b6001600160a01b0316610b2a61161f565b6001600160a01b031614610b73576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b038116610b9a5760405162461bcd60e51b815260040161062a90613e1e565b50600680546001600160a01b0319166001600160a01b0392909216919091179055565b600c546001600160a01b031681565b610bd4612385565b6001600160a01b0316610be561161f565b6001600160a01b031614610c2e576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b038116610c555760405162461bcd60e51b815260040161062a90613e1e565b50601080546001600160a01b03908116600090815260156020526040808220805460ff1990811690915584546001600160a01b03191695841695909517938490559290911681522080549091166001179055565b6000826001600160a01b038116610cd25760405162461bcd60e51b815260040161062a90613e1e565b600b546001600160a01b03828116911614610cff5760405162461bcd60e51b815260040161062a90613cbd565b3380610d1d5760405162461bcd60e51b815260040161062a90613e1e565b6001600160a01b03811660009081526015602052604090205460ff16610d555760405162461bcd60e51b815260040161062a90613db9565b60026001541415610dad576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600155601454610100900460ff16610dd95760405162461bcd60e51b815260040161062a90613df0565b610de161197e565b8315610e0d57601054610e009086906001600160a01b03163087612771565b610e09846128cd565b8392505b601354610e1a9085612cca565b60135550506001805592915050565b610e31612385565b6001600160a01b0316610e4261161f565b6001600160a01b031614610e8b576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b610e9361197e565b8015610ed457600e546009546040516370a0823160e01b8152610ed2926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b505b600e546040516370a0823160e01b81526000916001600160a01b0316906370a0823190610f059030906004016139b8565b60206040518083038186803b158015610f1d57600080fd5b505afa158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5591906139a0565b600e54600f549192506107f7916001600160a01b0391821691168361260f565b610f7d612385565b6001600160a01b0316610f8e61161f565b6001600160a01b031614610fd7576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b601155565b610fe4612385565b6001600160a01b0316610ff561161f565b6001600160a01b03161461103e576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b816001600160a01b0381166110655760405162461bcd60e51b815260040161062a90613e1e565b6001600160a01b03831660009081526015602052604090819020805460ff1916841515179055517fd6cbc523798a149c5a76937e4bb86b9cc67ab8cd88373375bee5ab651aeec5f3906110bb9085908590613ac6565b60405180910390a1505050565b6110d0612385565b6001600160a01b03166110e161161f565b6001600160a01b03161461112a576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b61113261197e565b801561117357600c546009546040516370a0823160e01b8152611171926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b505b600c546040516370a0823160e01b81526000916001600160a01b0316906370a08231906111a49030906004016139b8565b60206040518083038186803b1580156111bc57600080fd5b505afa1580156111d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f491906139a0565b600c54600f549192506107f7916001600160a01b0391821691168361260f565b61121c612385565b6001600160a01b031661122d61161f565b6001600160a01b031614611276576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6112c8612385565b6001600160a01b03166112d961161f565b6001600160a01b031614611322576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166113495760405162461bcd60e51b815260040161062a90613e1e565b50600380546001600160a01b0319166001600160a01b0392909216919091179055565b611374612385565b6001600160a01b031661138561161f565b6001600160a01b0316146113ce576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166113f55760405162461bcd60e51b815260040161062a90613e1e565b50600580546001600160a01b0319166001600160a01b0392909216919091179055565b6002546003546004546005546006546007546008546001600160a01b039687169695861695948516949384169392831692918216911687565b611459612385565b6001600160a01b031661146a61161f565b6001600160a01b0316146114b3576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166114da5760405162461bcd60e51b815260040161062a90613e1e565b50600480546001600160a01b0319166001600160a01b0392909216919091179055565b6009546001600160a01b031681565b600080600260060160009054906101000a90046001600160a01b03166001600160a01b0316635ee58efc6040518163ffffffff1660e01b815260040160206040518083038186803b15801561156057600080fd5b505afa158015611574573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159891906138f3565b6009546040516246613160e11b81529192506001600160a01b0380841692628cc262926115c99216906004016139b8565b60206040518083038186803b1580156115e157600080fd5b505afa1580156115f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161991906139a0565b91505090565b6000546001600160a01b031690565b600f546001600160a01b031681565b60156020526000908152604090205460ff1681565b61165a612385565b6001600160a01b031661166b61161f565b6001600160a01b0316146116b4576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166116db5760405162461bcd60e51b815260040161062a90613e1e565b50600c80546001600160a01b0319166001600160a01b0392909216919091179055565b611706612385565b6001600160a01b031661171761161f565b6001600160a01b031614611760576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166117875760405162461bcd60e51b815260040161062a90613e1e565b50600e80546001600160a01b0319166001600160a01b0392909216919091179055565b601454610100900460ff1681565b600e546001600160a01b031681565b600a546001600160a01b031681565b60145460ff1681565b6008546009546040516370a0823160e01b81526000926001600160a01b039081169283926370a08231926115c99216906004016139b8565b600080611822611dac565b915061182c61150c565b90509091565b61183a612385565b6001600160a01b031661184b61161f565b6001600160a01b031614611894576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b61189c61197e565b80156118dd57600d546009546040516370a0823160e01b81526118db926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b505b600d546040516370a0823160e01b81526000916001600160a01b0316906370a082319061190e9030906004016139b8565b60206040518083038186803b15801561192657600080fd5b505afa15801561193a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195e91906139a0565b600d54600f549192506107f7916001600160a01b0391821691168361260f565b60006119886117df565b9050806119955750611b1a565b600061199f611dac565b905060006119ab61150c565b905060008211806119bc5750600081115b15611b16576119c9612d24565b6119d1612e61565b600d546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611a029030906004016139b8565b60206040518083038186803b158015611a1a57600080fd5b505afa158015611a2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a5291906139a0565b600d54600f54919250611a72916001600160a01b0391821691168361260f565b600e546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611aa39030906004016139b8565b60206040518083038186803b158015611abb57600080fd5b505afa158015611acf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af391906139a0565b600e54600f54919250611b13916001600160a01b0391821691168361260f565b50505b5050505b565b611b24612385565b6001600160a01b0316611b3561161f565b6001600160a01b031614611b7e576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b038116611ba55760405162461bcd60e51b815260040161062a90613e1e565b50600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000611bd2612385565b6001600160a01b0316611be361161f565b6001600160a01b031614611c2c576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b816001600160a01b038116611c535760405162461bcd60e51b815260040161062a90613e1e565b600b546001600160a01b03828116911614611c805760405162461bcd60e51b815260040161062a90613cbd565b611c8861197e565b6000611c926117df565b90508015611da557611ca381612ed7565b50600b546009546040516370a0823160e01b8152611cdd926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b50600b546040516370a0823160e01b81526001600160a01b03909116906370a0823190611d0e9030906004016139b8565b60206040518083038186803b158015611d2657600080fd5b505afa158015611d3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d5e91906139a0565b92507f8016ab729ce61b1ac68b62c65d0da83b88b44f70b66bcd1f0d8021f4fd77dc0a3384604051611d919291906139cc565b60405180910390a16014805461ff00191690555b5050919050565b6008546009546040516301678afb60e31b81526000926001600160a01b0390811692630b3c57d892611de492909116906004016139b8565b60206040518083038186803b158015611dfc57600080fd5b505afa158015611e10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e3491906139a0565b905090565b611e41612385565b6001600160a01b0316611e5261161f565b6001600160a01b031614611e9b576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b038116611ec25760405162461bcd60e51b815260040161062a90613e1e565b50600b80546001600160a01b0319166001600160a01b0392909216919091179055565b611eed612385565b6001600160a01b0316611efe61161f565b6001600160a01b031614611f47576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b6001600160a01b038116611f8c5760405162461bcd60e51b8152600401808060200182810382526026815260200180613e6b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000826001600160a01b0381166120105760405162461bcd60e51b815260040161062a90613e1e565b600b546001600160a01b0382811691161461203d5760405162461bcd60e51b815260040161062a90613cbd565b338061205b5760405162461bcd60e51b815260040161062a90613e1e565b6001600160a01b03811660009081526015602052604090205460ff166120935760405162461bcd60e51b815260040161062a90613db9565b600260015414156120eb576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026001556120f861197e565b831561218b57601454610100900460ff161561216b5760006121186117df565b9050600061213b601354612135848961343790919063ffffffff16565b90613490565b9050600061214882612ed7565b600b54909150612161906001600160a01b031682612389565b9550505050612177565b612174846134f7565b92505b61218b6001600160a01b0386163385612259565b601354610e1a90856135b0565b60125481565b600d546001600160a01b031681565b6121b5612385565b6001600160a01b03166121c661161f565b6001600160a01b03161461220f576040805162461bcd60e51b81526020600482018190526024820152600080516020613ed8833981519152604482015290519081900360640190fd5b806001600160a01b0381166122365760405162461bcd60e51b815260040161062a90613e1e565b50600d80546001600160a01b0319166001600160a01b0392909216919091179055565b8015806122df575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156122b157600080fd5b505afa1580156122c5573d6000803e3d6000fd5b505050506040513d60208110156122db57600080fd5b5051155b61231a5760405162461bcd60e51b8152600401808060200182810382526036815260200180613f466036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611b1690849061360d565b606061237b84846000856136be565b90505b9392505050565b3390565b60008115612609576040516370a0823160e01b81526000906001600160a01b038516906370a08231906123c09030906004016139b8565b60206040518083038186803b1580156123d857600080fd5b505afa1580156123ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061241091906139a0565b604080516001808252818301909252919250600091906020808301908036833750506040805160018082528183019092529293506000929150602082015b606081526020019060019003908161244e57505060045483519192506001600160a01b031690839060009061247f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505085856040516024016124b29291906139cc565b60408051601f198184030181529190526020810180516001600160e01b031663f3fef3a360e01b179052815182906000906124e957fe5b602090810291909101015260095460405163c8d18a4560e01b81526001600160a01b039091169063c8d18a45906125269085908590600401613b93565b600060405180830381600087803b15801561254057600080fd5b505af1158015612554573d6000803e3d6000fd5b50506040516370a0823160e01b8152600092506001600160a01b03891691506370a08231906125879030906004016139b8565b60206040518083038186803b15801561259f57600080fd5b505afa1580156125b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d791906139a0565b90506125e381856135b0565b94508585146126045760405162461bcd60e51b815260040161062a90613cff565b505050505b92915050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1781529251825160009485949389169392918291908083835b6020831061268b5780518252601f19909201916020918201910161266c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146126ed576040519150601f19603f3d011682016040523d82523d6000602084013e6126f2565b606091505b5091509150818015612720575080511580612720575080806020019051602081101561271d57600080fd5b50515b611b13576040805162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604482015290519081900360640190fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b178152925182516000948594938a169392918291908083835b602083106127f55780518252601f1990920191602091820191016127d6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612857576040519150601f19603f3d011682016040523d82523d6000602084013e61285c565b606091505b509150915081801561288a57508051158061288a575080806020019051602081101561288757600080fd5b50515b6128c55760405162461bcd60e51b8152600401808060200182810382526024815260200180613f226024913960400191505060405180910390fd5b505050505050565b60006128d76117df565b60408051600480825260a082019092529192506000919060208201608080368337505060408051600480825260a082019092529293506000929150602082015b606081526020019060019003908161291757505060045483519192506001600160a01b031690839060009061294857fe5b6001600160a01b039283166020918202929092010152600b5460405161297792919091169086906024016139cc565b60408051601f198184030181529190526020810180516001600160e01b03166311f9fbc960e21b179052815182906000906129ae57fe5b602090810291909101015260055482516001600160a01b0390911690839060019081106129d757fe5b6001600160a01b039283166020918202929092010152600354600b54600c54918316929081169116612a0a876002613490565b6000600180604051602401612a259796959493929190613ae1565b60408051601f198184030181529190526020810180516001600160e01b0316632423110760e11b179052815182906001908110612a5e57fe5b602090810291909101015260065482516001600160a01b039091169083906002908110612a8757fe5b6001600160a01b039283166020918202929092010152600b54600c549082169116612ab3866002613490565b6000806001806001604051602401612ad2989796959493929190613a78565b60408051601f198184030181529190526020810180516001600160e01b031663ba1ffd0360e01b179052815182906002908110612b0b57fe5b602090810291909101015260075482516001600160a01b039091169083906003908110612b3457fe5b6001600160a01b039283166020918202929092010152600854604051612b67929190911690600090600190602401613b43565b60408051601f198184030181529190526020810180516001600160e01b0316630efe6a8b60e01b179052815182906003908110612ba057fe5b602090810291909101015260095460405163c8d18a4560e01b81526001600160a01b039091169063c8d18a4590612bdd9085908590600401613b93565b600060405180830381600087803b158015612bf757600080fd5b505af1158015612c0b573d6000803e3d6000fd5b505050506000612c196117df565b600a546040516354e3875560e11b81529192506000916001600160a01b039091169063a9c70eaa90612c5090600190600401613cb4565b60206040518083038186803b158015612c6857600080fd5b505afa158015612c7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ca091906139a0565b9050612cac82866135b0565b81146128c55760405162461bcd60e51b815260040161062a90613d41565b60008282018381101561237e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040805160018082528183019092526000916020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081612d5e57505060075483519192506001600160a01b0316908390600090612d8f57fe5b6001600160a01b039283166020918202929092010152600854604051612dbf929190911690600090602401613b27565b60408051601f198184030181529190526020810180516001600160e01b0316635569f64b60e11b17905281518290600090612df657fe5b602090810291909101015260095460405163c8d18a4560e01b81526001600160a01b039091169063c8d18a4590612e339085908590600401613b93565b600060405180830381600087803b158015612e4d57600080fd5b505af11580156128c5573d6000803e3d6000fd5b600d546009546040516370a0823160e01b8152612e9a926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b50600e546009546040516370a0823160e01b8152612ed4926001600160a01b039081169283926370a08231926106ff9216906004016139b8565b50565b600b546009546040516370a0823160e01b815260009283926001600160a01b03918216926370a0823192612f0f9216906004016139b8565b60206040518083038186803b158015612f2757600080fd5b505afa158015612f3b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5f91906139a0565b6040805160038082526080820190925291925060009190602082016060803683375050604080516003808252608082019092529293506000929150602082015b6060815260200190600190039081612f9f57505060075483519192506001600160a01b0316908390600090612fd057fe5b6001600160a01b0392831660209182029290920101526008546040516130059291909116908790600090600190602401613b67565b60408051601f198184030181529190526020810180516001600160e01b03166322996bbb60e11b1790528151829060009061303c57fe5b602090810291909101015260065482516001600160a01b03909116908390600190811061306557fe5b6001600160a01b03928316602091820292909201810191909152600b54600c5460085460408051636f307dc360e01b8152905193861695928316949190921692636f307dc3926004808201939291829003018186803b1580156130c757600080fd5b505afa1580156130db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130ff91906138f3565b60006001806002600160405160240161311f9897969594939291906139e5565b60408051601f198184030181529190526020810180516001600160e01b0316630c5172ed60e21b17905281518290600190811061315857fe5b602090810291909101015260055482516001600160a01b03909116908390600290811061318157fe5b6001600160a01b03928316602091820292909201015260038054600c54600b546040516131c7959384169492841693919091169160009160029190600190602401613a33565b60408051601f198184030181529190526020810180516001600160e01b0316632423110760e11b17905281518290600290811061320057fe5b602090810291909101015260095460405163c8d18a4560e01b81526001600160a01b039091169063c8d18a459061323d9085908590600401613b93565b600060405180830381600087803b15801561325757600080fd5b505af115801561326b573d6000803e3d6000fd5b5050600b546009546040516370a0823160e01b8152600094506001600160a01b0392831693506370a08231926132a59216906004016139b8565b60206040518083038186803b1580156132bd57600080fd5b505afa1580156132d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132f591906139a0565b600a546040516354e3875560e11b8152919250613404916001600160a01b039091169063a9c70eaa9061332d90600390600401613cb4565b60206040518083038186803b15801561334557600080fd5b505afa158015613359573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061337d91906139a0565b600a546040516354e3875560e11b81526001600160a01b039091169063a9c70eaa906133ae90600190600401613cb4565b60206040518083038186803b1580156133c657600080fd5b505afa1580156133da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133fe91906139a0565b90612cca565b945061341081856135b0565b851461342e5760405162461bcd60e51b815260040161062a90613d78565b50505050919050565b60008261344657506000612609565b8282028284828161345357fe5b041461237e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613eb76021913960400191505060405180910390fd5b60008082116134e6576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816134ef57fe5b049392505050565b600b546040516370a0823160e01b815260009182916001600160a01b03909116906370a082319061352c9030906004016139b8565b60206040518083038186803b15801561354457600080fd5b505afa158015613558573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061357c91906139a0565b905060006013548210156135905781613594565b6013545b6013549091506135a8906121358684613437565b949350505050565b600082821115613607576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b6000613662826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661236c9092919063ffffffff16565b805190915015611b165780806020019051602081101561368157600080fd5b5051611b165760405162461bcd60e51b815260040180806020018281038252602a815260200180613ef8602a913960400191505060405180910390fd5b6060824710156136ff5760405162461bcd60e51b8152600401808060200182810382526026815260200180613e916026913960400191505060405180910390fd5b61370885613819565b613759576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106137975780518252601f199092019160209182019101613778565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146137f9576040519150601f19603f3d011682016040523d82523d6000602084013e6137fe565b606091505b509150915061380e828286613823565b979650505050505050565b803b15155b919050565b6060831561383257508161237e565b8251156138425782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561388c578181015183820152602001613874565b50505050905090810190601f1680156138b95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b8035801515811461381e57600080fd5b6000602082840312156138e8578081fd5b813561237e81613e55565b600060208284031215613904578081fd5b815161237e81613e55565b60008060408385031215613921578081fd5b823561392c81613e55565b915061393a602084016138c7565b90509250929050565b60008060408385031215613955578182fd5b823561396081613e55565b946020939093013593505050565b60006020828403121561397f578081fd5b61237e826138c7565b600060208284031215613999578081fd5b5035919050565b6000602082840312156139b1578081fd5b5051919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039889168152968816602088015294909616604086015260ff92831660608601529082166080850152811660a084015292831660c083015290911660e08201526101000190565b6001600160a01b039788168152958716602087015293909516604085015260ff91821660608501528116608084015292831660a083015290911660c082015260e00190565b6001600160a01b039889168152969097166020870152604086019490945260ff92831660608601529082166080850152811660a084015290811660c083015290911660e08201526101000190565b6001600160a01b039290921682521515602082015260400190565b6001600160a01b0397881681529587166020870152939095166040850152606084019190915260ff908116608084015292831660a083015290911660c082015260e00190565b6001600160a01b0392909216825260ff16602082015260400190565b6001600160a01b0393909316835260ff918216602084015216604082015260600190565b6001600160a01b03949094168452602084019290925260ff908116604084015216606082015260800190565b604080825283519082018190526000906020906060840190828701845b82811015613bd55781516001600160a01b031684529284019290840190600101613bb0565b5050508381038285015284518082528282019080840283018401878501865b83811015613c5957601f1980878503018652825180518086528a5b81811015613c2a578281018b01518782018c01528a01613c0f565b81811115613c3a578b8b83890101525b5096890196601f01909116939093018701925090860190600101613bf4565b50909998505050505050505050565b901515815260200190565b6001600160a01b03978816815295871660208701529386166040860152918516606085015284166080840152831660a083015290911660c082015260e00190565b90815260200190565b60208082526022908201527f496e76616c696420746f6b656e20666f72206465706f7369742f776974686472604082015261617760f01b606082015260800190565b60208082526022908201527f496e76616c69642077697468647261776e20616d6f756e742070726f63657373604082015261195960f21b606082015260800190565b6020808252601b908201527f496e76616c6964204c5020616d6f756e74206465706f73697465640000000000604082015260600190565b60208082526021908201527f496e76616c696420616d6f756e74206f662061737365742077697468647261776040820152603760f91b606082015260800190565b60208082526018908201527f496e76616c6964204c697175696469747920486f6c6465720000000000000000604082015260600190565b60208082526014908201527314dd1c985d1959de481a5cc8191a5cd8589b195960621b604082015260600190565b6020808252600f908201526e4e6f207a65726f206164647265737360881b604082015260600190565b918252602082015260400190565b6001600160a01b0381168114612ed457600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c45445361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a264697066735822122066e72078572d4fefa2960dbe6b69af6aff2f35c296db1ce46a74fa090679653a64736f6c63430007060033416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000001bfd67037b42cf73acf2047067bd4f2c47d9bfd600000000000000000000000059e9261255644c411afdd00bd89162d09d862e38000000000000000000000000583b965462e11da63d1d4bc6d2d43d391f79af1f000000000000000000000000445fe580ef8d70ff569ab36e80c647af338db351000000000000000000000000589e3a1285de27b5efdaf7bbcf63aa6b3dbff9d9000000000000000000000000e8dd7766f476af2d0676429567b7e39c3ff358c0000000000000000000000000da3b84867b9e78026d523d7717fb83d93c90b3780000000000000000000000006e7cdde3a8ec102c888bd5df292bf28656be8323000000000000000000000000b56aab9696b95a75a6edd5435bc9dcc4b07403b00000000000000000000000001188772c9810cfecac6c35ffde41a710983b01ec

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.