ETH Price: $3,248.33 (-2.59%)

Contract

0xd0Df5A352D74A746754C592a6277c9060A7c9c87
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Finalize Assets156243632022-09-27 11:22:35817 days ago1664277755IN
0xd0Df5A35...60A7c9c87
0 ETH0.0007722810.50431361
Finalize Assets154575922022-09-02 6:27:27842 days ago1662100047IN
0xd0Df5A35...60A7c9c87
0 ETH0.0009530210.51661045
Finalize Assets152371772022-07-29 11:49:32877 days ago1659095372IN
0xd0Df5A35...60A7c9c87
0 ETH0.0012888517.53040976
Finalize Assets152042362022-07-24 8:28:59882 days ago1658651339IN
0xd0Df5A35...60A7c9c87
0 ETH0.0009396712.78105183
Finalize Assets151607582022-07-17 14:44:17889 days ago1658069057IN
0xd0Df5A35...60A7c9c87
0 ETH0.0046911351.76650333
Finalize Assets150955522022-07-07 12:49:58899 days ago1657198198IN
0xd0Df5A35...60A7c9c87
0 ETH0.00162417.92087668
Finalize Assets150877422022-07-06 7:56:23900 days ago1657094183IN
0xd0Df5A35...60A7c9c87
0 ETH0.0008474621.28135454
Finalize Assets150877392022-07-06 7:55:37900 days ago1657094137IN
0xd0Df5A35...60A7c9c87
0 ETH0.0018770425.53079351
Finalize Assets150672962022-07-03 4:00:15903 days ago1656820815IN
0xd0Df5A35...60A7c9c87
0 ETH0.0011835413.06039494
Finalize Assets148339262022-05-24 5:24:52943 days ago1653369892IN
0xd0Df5A35...60A7c9c87
0 ETH0.0012591517.12640556
Finalize Assets147143762022-05-05 1:36:06963 days ago1651714566IN
0xd0Df5A35...60A7c9c87
0 ETH0.0018937625.7581713
Finalize Assets145849992022-04-14 17:49:17983 days ago1649958557IN
0xd0Df5A35...60A7c9c87
0 ETH0.0057239263.16329109
Finalize Assets145623092022-04-11 4:46:25986 days ago1649652385IN
0xd0Df5A35...60A7c9c87
0 ETH0.0022294630.32413096
Finalize Assets145504642022-04-09 8:31:57988 days ago1649493117IN
0xd0Df5A35...60A7c9c87
0 ETH0.0017937324.39761778
Finalize Assets145502952022-04-09 7:55:35988 days ago1649490935IN
0xd0Df5A35...60A7c9c87
0 ETH0.0023344531.7522612
Finalize Assets145008222022-04-01 14:09:13996 days ago1648822153IN
0xd0Df5A35...60A7c9c87
0 ETH0.0055082674.92094685
Finalize Assets144946612022-03-31 15:05:48997 days ago1648739148IN
0xd0Df5A35...60A7c9c87
0 ETH0.0062472184.97179446
Finalize Assets144933472022-03-31 10:15:28997 days ago1648721728IN
0xd0Df5A35...60A7c9c87
0 ETH0.0026543836.10373664
Finalize Assets144932532022-03-31 9:53:09997 days ago1648720389IN
0xd0Df5A35...60A7c9c87
0 ETH0.0027780930.65624842
Finalize Assets144827772022-03-29 18:38:40999 days ago1648579120IN
0xd0Df5A35...60A7c9c87
0 ETH0.0022798131.0089842
Finalize Assets144675842022-03-27 10:09:161001 days ago1648375756IN
0xd0Df5A35...60A7c9c87
0 ETH0.0014539616.04449657
Finalize Assets144599622022-03-26 5:24:411002 days ago1648272281IN
0xd0Df5A35...60A7c9c87
0 ETH0.0023189525.58962129
Finalize Assets144474492022-03-24 6:52:221004 days ago1648104742IN
0xd0Df5A35...60A7c9c87
0 ETH0.002043327.79207582
Finalize Assets144430132022-03-23 14:11:301005 days ago1648044690IN
0xd0Df5A35...60A7c9c87
0 ETH0.0032737344.52786771
Finalize Assets144427492022-03-23 13:10:121005 days ago1648041012IN
0xd0Df5A35...60A7c9c87
0 ETH0.0019283721.27957131
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DefiRound

Compiler Version
v0.6.11+commit.5ef660b1

Optimization Enabled:
Yes with 20000 runs

Other Settings:
default evmVersion
File 1 of 23 : DefiRound.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/utils/SafeCast.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "./interfaces/IDefiRound.sol";
import "./interfaces/IWETH.sol";
import "@openzeppelin/contracts/cryptography/MerkleProof.sol";

contract DefiRound is IDefiRound, Ownable {
    using SafeMath for uint256;
    using SafeCast for int256;
    using SafeERC20 for IERC20;
    using Address for address;
    using Address for address payable;
    using EnumerableSet for EnumerableSet.AddressSet;

    // solhint-disable-next-line
    address public immutable WETH;
    address public immutable override treasury;
    OversubscriptionRate public overSubscriptionRate;
    mapping(address => uint256) public override totalSupply;
    // account -> accountData
    mapping(address => AccountData) private accountData;
    mapping(address => RateData) private tokenRates;

    //Token -> oracle, genesis
    mapping(address => SupportedTokenData) private tokenSettings;

    EnumerableSet.AddressSet private supportedTokens;
    EnumerableSet.AddressSet private configuredTokenRates;
    STAGES public override currentStage;

    WhitelistSettings public whitelistSettings;
    uint256 public lastLookExpiration = type(uint256).max;
    uint256 private immutable maxTotalValue;
    bool private stage1Locked;

    constructor(
        // solhint-disable-next-line
        address _WETH,
        address _treasury,
        uint256 _maxTotalValue
    ) public {
        require(_WETH != address(0), "INVALID_WETH");
        require(_treasury != address(0), "INVALID_TREASURY");
        require(_maxTotalValue > 0, "INVALID_MAXTOTAL");

        WETH = _WETH;
        treasury = _treasury;
        currentStage = STAGES.STAGE_1;

        maxTotalValue = _maxTotalValue;
    }

    function deposit(TokenData calldata tokenInfo, bytes32[] memory proof)
        external
        payable
        override
    {
        require(currentStage == STAGES.STAGE_1, "DEPOSITS_NOT_ACCEPTED");
        require(!stage1Locked, "DEPOSITS_LOCKED");

        if (whitelistSettings.enabled) {
            require(
                verifyDepositor(msg.sender, whitelistSettings.root, proof),
                "PROOF_INVALID"
            );
        }

        TokenData memory data = tokenInfo;
        address token = data.token;
        uint256 tokenAmount = data.amount;
        require(supportedTokens.contains(token), "UNSUPPORTED_TOKEN");
        require(tokenAmount > 0, "INVALID_AMOUNT");

        // Convert ETH to WETH if ETH is passed in, otherwise treat WETH as a regular ERC20
        if (token == WETH && msg.value > 0) {
            require(tokenAmount == msg.value, "INVALID_MSG_VALUE");
            IWETH(WETH).deposit{value: tokenAmount}();
        } else {
            require(msg.value == 0, "NO_ETH");
        }

        AccountData storage tokenAccountData = accountData[msg.sender];

        if (tokenAccountData.token == address(0)) {
            tokenAccountData.token = token;
        }

        require(tokenAccountData.token == token, "SINGLE_ASSET_DEPOSITS");

        tokenAccountData.initialDeposit = tokenAccountData.initialDeposit.add(
            tokenAmount
        );
        tokenAccountData.currentBalance = tokenAccountData.currentBalance.add(
            tokenAmount
        );

        require(
            tokenAccountData.currentBalance <= tokenSettings[token].maxLimit,
            "MAX_LIMIT_EXCEEDED"
        );

        // No need to transfer from msg.sender since is ETH was converted to WETH
        if (!(token == WETH && msg.value > 0)) {
            IERC20(token).safeTransferFrom(
                msg.sender,
                address(this),
                tokenAmount
            );
        }

        if (_totalValue() >= maxTotalValue) {
            stage1Locked = true;
        }

        emit Deposited(msg.sender, tokenInfo);
    }

    // solhint-disable-next-line no-empty-blocks
    receive() external payable {
        require(msg.sender == WETH);
    }

    //We disallow withdrawal
    /*
    function withdraw(TokenData calldata tokenInfo, bool asETH)
        external
        override
    {
        require(currentStage == STAGES.STAGE_2, "WITHDRAWS_NOT_ACCEPTED");
        require(!_isLastLookComplete(), "WITHDRAWS_EXPIRED");

        TokenData memory data = tokenInfo;
        address token = data.token;
        uint256 tokenAmount = data.amount;
        require(supportedTokens.contains(token), "UNSUPPORTED_TOKEN");
        require(tokenAmount > 0, "INVALID_AMOUNT");
        AccountData storage tokenAccountData = accountData[msg.sender];
        require(token == tokenAccountData.token, "INVALID_TOKEN");
        tokenAccountData.currentBalance = tokenAccountData.currentBalance.sub(
            tokenAmount
        );
        // set the data back in the mapping, otherwise updates are not saved
        accountData[msg.sender] = tokenAccountData;

        // Don't transfer WETH, WETH is converted to ETH and sent to the recipient
        if (token == WETH && asETH) {
            IWETH(WETH).withdraw(tokenAmount);
            msg.sender.sendValue(tokenAmount);
        } else {
            IERC20(token).safeTransfer(msg.sender, tokenAmount);
        }

        emit Withdrawn(msg.sender, tokenInfo, asETH);
    }
    */

    function configureWhitelist(WhitelistSettings memory settings)
        external
        override
        onlyOwner
    {
        whitelistSettings = settings;
        emit WhitelistConfigured(settings);
    }

    function addSupportedTokens(SupportedTokenData[] calldata tokensToSupport)
        external
        override
        onlyOwner
    {
        uint256 tokensLength = tokensToSupport.length;
        for (uint256 i = 0; i < tokensLength; i++) {
            SupportedTokenData memory data = tokensToSupport[i];
            require(supportedTokens.add(data.token), "TOKEN_EXISTS");

            tokenSettings[data.token] = data;
        }
        emit SupportedTokensAdded(tokensToSupport);
    }

    function getSupportedTokens()
        external
        view
        override
        returns (address[] memory tokens)
    {
        uint256 tokensLength = supportedTokens.length();
        tokens = new address[](tokensLength);
        for (uint256 i = 0; i < tokensLength; i++) {
            tokens[i] = supportedTokens.at(i);
        }
    }

    function publishRates(
        RateData[] calldata ratesData,
        OversubscriptionRate memory oversubRate,
        uint256 lastLookDuration
    ) external override onlyOwner {
        // check rates havent been published before
        require(currentStage == STAGES.STAGE_1, "RATES_ALREADY_SET");
        //require(lastLookDuration > 0, "INVALID_DURATION");
        require(oversubRate.overDenominator > 0, "INVALID_DENOMINATOR");
        require(oversubRate.overNumerator > 0, "INVALID_NUMERATOR");

        uint256 ratesLength = ratesData.length;
        for (uint256 i = 0; i < ratesLength; i++) {
            RateData memory data = ratesData[i];
            require(data.numerator > 0, "INVALID_NUMERATOR");
            require(data.denominator > 0, "INVALID_DENOMINATOR");
            require(
                tokenRates[data.token].token == address(0),
                "RATE_ALREADY_SET"
            );
            require(configuredTokenRates.add(data.token), "ALREADY_CONFIGURED");
            tokenRates[data.token] = data;
        }

        require(
            configuredTokenRates.length() == supportedTokens.length(),
            "MISSING_RATE"
        );

        // Stage only moves forward when prices are published
        currentStage = STAGES.STAGE_2;
        lastLookExpiration = block.number + lastLookDuration;
        overSubscriptionRate = oversubRate;

        emit RatesPublished(ratesData);
    }

    function getRates(address[] calldata tokens)
        external
        view
        override
        returns (RateData[] memory rates)
    {
        uint256 tokensLength = tokens.length;
        rates = new RateData[](tokensLength);
        for (uint256 i = 0; i < tokensLength; i++) {
            rates[i] = tokenRates[tokens[i]];
        }
    }

    function getTokenValue(address token, uint256 balance)
        internal
        view
        returns (uint256 value)
    {
        uint256 tokenDecimals = ERC20(token).decimals();
        (, int256 tokenRate, , , ) = AggregatorV3Interface(
            tokenSettings[token].oracle
        ).latestRoundData();
        uint256 rate = tokenRate.toUint256();
        value = (balance.mul(rate)).div(10**tokenDecimals); //Chainlink USD prices are always to 8
    }

    function totalValue() external view override returns (uint256) {
        return _totalValue();
    }

    function _totalValue() internal view returns (uint256 value) {
        uint256 tokensLength = supportedTokens.length();
        for (uint256 i = 0; i < tokensLength; i++) {
            address token = supportedTokens.at(i);
            uint256 tokenBalance = IERC20(token).balanceOf(address(this));
            value = value.add(getTokenValue(token, tokenBalance));
        }
    }

    function accountBalance(address account)
        external
        view
        override
        returns (uint256 value)
    {
        uint256 tokenBalance = accountData[account].currentBalance;
        value = value.add(
            getTokenValue(accountData[account].token, tokenBalance)
        );
    }

    function finalizeAssets() external override {
        require(currentStage == STAGES.STAGE_3, "NOT_SYSTEM_FINAL");

        AccountData storage data = accountData[msg.sender];
        address token = data.token;

        require(token != address(0), "NO_DATA");

        (, uint256 ineffective, ) = _getRateAdjustedAmounts(
            data.currentBalance,
            token
        );

        require(ineffective > 0, "NOTHING_TO_MOVE");

        // zero out balance
        data.currentBalance = 0;
        accountData[msg.sender] = data;

        // transfer ineffectiveTokenBalance back to user
        IERC20(token).safeTransfer(msg.sender, ineffective);
    
        emit AssetsFinalized(msg.sender, token, ineffective);
    }

    function getGenesisPools(address[] calldata tokens)
        external
        view
        override
        returns (address[] memory genesisAddresses)
    {
        uint256 tokensLength = tokens.length;
        genesisAddresses = new address[](tokensLength);
        for (uint256 i = 0; i < tokensLength; i++) {
            require(supportedTokens.contains(tokens[i]), "TOKEN_UNSUPPORTED");
            genesisAddresses[i] = tokenSettings[supportedTokens.at(i)].genesis;
        }
    }

    function getTokenOracles(address[] calldata tokens)
        external
        view
        override
        returns (address[] memory oracleAddresses)
    {
        uint256 tokensLength = tokens.length;
        oracleAddresses = new address[](tokensLength);
        for (uint256 i = 0; i < tokensLength; i++) {
            require(supportedTokens.contains(tokens[i]), "TOKEN_UNSUPPORTED");
            oracleAddresses[i] = tokenSettings[tokens[i]].oracle;
        }
    }

    function getAccountData(address account)
        external
        view
        override
        returns (AccountDataDetails[] memory data)
    {
        uint256 supportedTokensLength = supportedTokens.length();
        data = new AccountDataDetails[](supportedTokensLength);
        for (uint256 i = 0; i < supportedTokensLength; i++) {
            address token = supportedTokens.at(i);
            AccountData memory accountTokenInfo = accountData[account];
            if (
                currentStage >= STAGES.STAGE_2 &&
                accountTokenInfo.token != address(0)
            ) {
                (
                    uint256 effective,
                    uint256 ineffective,
                    uint256 actual
                ) = _getRateAdjustedAmounts(
                        accountTokenInfo.currentBalance,
                        token
                    );
                AccountDataDetails memory details = AccountDataDetails(
                    token,
                    accountTokenInfo.initialDeposit,
                    accountTokenInfo.currentBalance,
                    effective,
                    ineffective,
                    actual
                );
                data[i] = details;
            } else {
                data[i] = AccountDataDetails(
                    token,
                    accountTokenInfo.initialDeposit,
                    accountTokenInfo.currentBalance,
                    0,
                    0,
                    0
                );
            }
        }
    }

    function transferToTreasury() external override onlyOwner {
        require(_isLastLookComplete(), "CURRENT_STAGE_INVALID");
        require(currentStage == STAGES.STAGE_2, "ONLY_TRANSFER_ONCE");

        uint256 supportedTokensLength = supportedTokens.length();
        TokenData[] memory tokens = new TokenData[](supportedTokensLength);
        for (uint256 i = 0; i < supportedTokensLength; i++) {
            address token = supportedTokens.at(i);
            uint256 balance = IERC20(token).balanceOf(address(this));
            (uint256 effective, , ) = _getRateAdjustedAmounts(balance, token);
            tokens[i].token = token;
            tokens[i].amount = effective;
            IERC20(token).safeTransfer(treasury, effective);
        }

        currentStage = STAGES.STAGE_3;

        emit TreasuryTransfer(tokens);
    }

    function getRateAdjustedAmounts(uint256 balance, address token)
        external
        view
        override
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        return _getRateAdjustedAmounts(balance, token);
    }

    function getMaxTotalValue() external view override returns (uint256) {
        return maxTotalValue;
    }

    function _getRateAdjustedAmounts(uint256 balance, address token)
        internal
        view
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        require(currentStage >= STAGES.STAGE_2, "RATES_NOT_PUBLISHED");

        RateData memory rateInfo = tokenRates[token];
        uint256 effectiveTokenBalance = balance
            .mul(overSubscriptionRate.overNumerator)
            .div(overSubscriptionRate.overDenominator);
        uint256 ineffectiveTokenBalance = balance
            .mul(
                overSubscriptionRate.overDenominator.sub(
                    overSubscriptionRate.overNumerator
                )
            )
            .div(overSubscriptionRate.overDenominator);

        uint256 actualReceived = effectiveTokenBalance
            .mul(rateInfo.denominator)
            .div(rateInfo.numerator);

        return (effectiveTokenBalance, ineffectiveTokenBalance, actualReceived);
    }

    function verifyDepositor(
        address participant,
        bytes32 root,
        bytes32[] memory proof
    ) internal pure returns (bool) {
        bytes32 leaf = keccak256((abi.encodePacked((participant))));
        return MerkleProof.verify(proof, root, leaf);
    }

    function _isLastLookComplete() internal view returns (bool) {
        return block.number >= lastLookExpiration;
    }
}

File 2 of 23 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

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

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

File 3 of 23 : SafeCast.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;


/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such 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.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128) {
        require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits");
        return int128(value);
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64) {
        require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits");
        return int64(value);
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32) {
        require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits");
        return int32(value);
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16) {
        require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits");
        return int16(value);
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits.
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8) {
        require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        require(value < 2**255, "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

File 4 of 23 : 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 5 of 23 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    mapping (address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

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

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

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

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

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

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

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

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * Requirements:
     *
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

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

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

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

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

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

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

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

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

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

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

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

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal virtual {
        _decimals = decimals_;
    }

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

File 6 of 23 : 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 7 of 23 : 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 8 of 23 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;

        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) { // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            bytes32 lastvalue = set._values[lastIndex];

            // Move the last value to the index where the value to delete is
            set._values[toDeleteIndex] = lastvalue;
            // Update the index for the moved value
            set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }


    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

   /**
    * @dev Returns the value stored at position `index` in the set. O(1).
    *
    * Note that there are no guarantees on the ordering of values inside the
    * array, and it may change when more values are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 9 of 23 : AggregatorV3Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;

interface AggregatorV3Interface {

  function decimals()
    external
    view
    returns (
      uint8
    );

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

  function version()
    external
    view
    returns (
      uint256
    );

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(
    uint80 _roundId
  )
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

}

File 10 of 23 : IDefiRound.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.11;
pragma experimental ABIEncoderV2;

interface IDefiRound {
    enum STAGES {STAGE_1, STAGE_2, STAGE_3}

    struct AccountData {
        address token; // address of the allowed token deposited
        uint256 initialDeposit; // initial amount deposited of the token
        uint256 currentBalance; // current balance of the token that can be used to claim INSURE
    }

    struct AccountDataDetails {
        address token; // address of the allowed token deposited
        uint256 initialDeposit; // initial amount deposited of the token
        uint256 currentBalance; // current balance of the token that can be used to claim INSURE
        uint256 effectiveAmt; //Amount deposited that will be used towards INSURE
        uint256 ineffectiveAmt; //Amount deposited that will be either refunded or go to farming
        uint256 actualTokeReceived; //Amount of INSURE that will be received
    }
    struct TokenData {
        address token;
        uint256 amount;
    }
    struct SupportedTokenData {
        address token;
        address oracle;
        address genesis;
        uint256 maxLimit;
    }
    struct RateData {
        address token;
        uint256 numerator;
        uint256 denominator;
    }

    struct OversubscriptionRate {
        uint256 overNumerator;
        uint256 overDenominator;
    }

    event Deposited(address depositor, TokenData tokenInfo);
    event Withdrawn(address withdrawer, TokenData tokenInfo, bool asETH);
    event SupportedTokensAdded(SupportedTokenData[] tokenData);
    event RatesPublished(RateData[] ratesData);
    event GenesisTransfer(address user, uint256 amountTransferred);
    event AssetsFinalized(address claimer, address token, uint256 assetsMoved);
    event WhitelistConfigured(WhitelistSettings settings); 
    event TreasuryTransfer(TokenData[] tokens);

    struct TokenValues {
        uint256 effectiveTokenValue;
        uint256 ineffectiveTokenValue;
    }

    struct WhitelistSettings {
        bool enabled;
        bytes32 root;
    }

    /// @notice Enable or disable the whitelist
    /// @param settings The root to use and whether to check the whitelist at all
    function configureWhitelist(WhitelistSettings calldata settings) external;

    /// @notice returns the current stage the contract is in
    /// @return stage the current stage the round contract is in
    function currentStage() external returns (STAGES stage);

    /// @notice deposits tokens into the round contract
    /// @param tokenData an array of token structs
    function deposit(TokenData calldata tokenData, bytes32[] memory proof) external payable;

    /// @notice total value held in the entire contract amongst all the assets
    /// @return value the value of all assets held
    function totalValue() external view returns (uint256 value);

    /// @notice Current Max Total Value
    /// @return value the max total value
    function getMaxTotalValue() external view returns (uint256 value);

    /// @notice returns the address of the treasury, when users claim this is where funds that are <= maxClaimableValue go
    /// @return treasuryAddress address of the treasury
    function treasury() external returns (address treasuryAddress);

    /// @notice the total supply held for a given token
    /// @param token the token to get the supply for
    /// @return amount the total supply for a given token
    function totalSupply(address token) external returns (uint256 amount);

    /*
    /// @notice withdraws tokens from the round contract. only callable when round 2 starts
    /// @param tokenData an array of token structs
    /// @param asEth flag to determine if provided WETH, that it should be withdrawn as ETH
     function withdraw(TokenData calldata tokenData, bool asEth) external;
    */

    // /// @notice adds tokens to support
    // /// @param tokensToSupport an array of supported token structs
    function addSupportedTokens(SupportedTokenData[] calldata tokensToSupport) external;

    // /// @notice returns which tokens can be deposited
    // /// @return tokens tokens that are supported for deposit
    function getSupportedTokens() external view returns (address[] calldata tokens);

    /// @notice the oracle that will be used to denote how much the amounts deposited are worth in USD
    /// @param tokens an array of tokens
    /// @return oracleAddresses the an array of oracles corresponding to supported tokens
    function getTokenOracles(address[] calldata tokens)
        external
        view
        returns (address[] calldata oracleAddresses);

    /// @notice publishes rates for the tokens. Rates are always relative to 1 INSURE. Can only be called once within Stage 1
    // prices can be published at any time
    /// @param ratesData an array of rate info structs
    function publishRates(
        RateData[] calldata ratesData,
        OversubscriptionRate memory overSubRate,
        uint256 lastLookDuration
    ) external;

    /// @notice return the published rates for the tokens
    /// @param tokens an array of tokens to get rates for
    /// @return rates an array of rates for the provided tokens
    function getRates(address[] calldata tokens) external view returns (RateData[] calldata rates);

    /// @notice determines the account value in USD amongst all the assets the user is invovled in
    /// @param account the account to look up
    /// @return value the value of the account in USD
    function accountBalance(address account) external view returns (uint256 value);

    /// @notice Moves excess assets to private farming or refunds them
    /// @dev uses the publishedRates, selected tokens, and amounts to determine what amount of INSURE is claimed
    /// when true oversubscribed amount will deposit to genesis, else oversubscribed amount is sent back to user
    function finalizeAssets() external;

    //// @notice returns what gensis pool a supported token is mapped to
    /// @param tokens array of addresses of supported tokens
    /// @return genesisAddresses array of genesis pools corresponding to supported tokens
    function getGenesisPools(address[] calldata tokens)
        external
        view
        returns (address[] memory genesisAddresses);

    /// @notice returns a list of AccountData for a provided account
    /// @param account the address of the account
    /// @return data an array of AccountData denoting what the status is for each of the tokens deposited (if any)
    function getAccountData(address account)
        external
        view
        returns (AccountDataDetails[] calldata data);

    /// @notice Allows the owner to transfer all swapped assets to the treasury
    /// @dev only callable by owner and if last look period is complete
    function transferToTreasury() external;

    /// @notice Given a balance, calculates how the the amount will be allocated between INSURE and Farming
    /// @dev Only allowed at stage 3
    /// @param balance balance to divy up
    /// @param token token to pull the rates for
    function getRateAdjustedAmounts(uint256 balance, address token)
        external
        view
        returns (
            uint256,
            uint256,
            uint256
        );
}

File 11 of 23 : IWETH.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.11;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IWETH is IERC20Upgradeable {
    function deposit() external payable;

    function withdraw(uint256) external;
}

File 12 of 23 : MerkleProof.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev These functions deal with verification of Merkle trees (hash trees),
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        bytes32 computedHash = leaf;

        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];

            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
            }
        }

        // Check if the computed hash (root) is equal to the provided root
        return computedHash == root;
    }
}

File 13 of 23 : 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;
    }
}

File 14 of 23 : 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 15 of 23 : 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 16 of 23 : IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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 17 of 23 : MerkleDistributor.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.6.11;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/cryptography/MerkleProof.sol";
import "./interfaces/IMerkleDistributor.sol";

contract MerkleDistributor is IMerkleDistributor{
    address public immutable override token;
    bytes32 public immutable override merkleRoot;
    address public immutable treasury;
    uint256 public immutable expiry; // >0 if enabled

    // This is a packed array of booleans.
    mapping(uint256 => uint256) private claimedBitMap;

    constructor(address token_, bytes32 merkleRoot_, address treasury_, uint256 expiry_) public {
        token = token_;
        merkleRoot = merkleRoot_;
        treasury = treasury_;
        expiry = expiry_;
    }

    function isClaimed(uint256 index) public view override returns (bool) {
        uint256 claimedWordIndex = index / 256;
        uint256 claimedBitIndex = index % 256;
        uint256 claimedWord = claimedBitMap[claimedWordIndex];
        uint256 mask = (1 << claimedBitIndex);
        return claimedWord & mask == mask;
    }

    function _setClaimed(uint256 index) private {
        uint256 claimedWordIndex = index / 256;
        uint256 claimedBitIndex = index % 256;
        claimedBitMap[claimedWordIndex] = claimedBitMap[claimedWordIndex] | (1 << claimedBitIndex);
    }

    function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external override {
        require(!isClaimed(index), 'MerkleDistributor: Already claimed.');
        require(expiry == 0 || block.timestamp < expiry,'MerkleDistributor: Expired.');
        // Verify the merkle proof.
        bytes32 node = keccak256(abi.encodePacked(index, account, amount));
        require(MerkleProof.verify(merkleProof, merkleRoot, node), 'MerkleDistributor: Invalid proof.');

        // Mark it claimed and send the token.
        _setClaimed(index);
        require(IERC20(token).transfer(account, amount), 'MerkleDistributor: Transfer failed.');

        emit Claimed(index, account, amount);
    }

    function salvage() external {
        require(expiry > 0 && block.timestamp >= expiry,'MerkleDistributor: Not expired.');
        uint256 _remaining = IERC20(token).balanceOf(address(this));
        IERC20(token).transfer(treasury, _remaining);
    }
}

File 18 of 23 : IMerkleDistributor.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

// Allows anyone to claim a token if they exist in a merkle root.
interface IMerkleDistributor {
    // Returns the address of the token distributed by this contract.
    function token() external view returns (address);
    // Returns the merkle root of the merkle tree containing account balances available to claim.
    function merkleRoot() external view returns (bytes32);
    // Returns true if the index has been marked claimed.
    function isClaimed(uint256 index) external view returns (bool);
    // Claim the given amount of the token to the given address. Reverts if the inputs are invalid.
    function claim(uint256 index, address account, uint256 amount, bytes32[] calldata merkleProof) external;

    // This event is triggered whenever a call to #claim succeeds.
    event Claimed(uint256 index, address account, uint256 amount);
}

File 19 of 23 : ERC20.sol
pragma solidity 0.6.11;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";

/**
 * @dev Implementation of the `IERC20` interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using `_mint`.
 * For a generic mechanism see `ERC20Mintable`.
 *
 * *For a detailed writeup see our guide [How to implement supply
 * mechanisms](https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226).*
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an `Approval` event is emitted on calls to `transferFrom`.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard `decreaseAllowance` and `increaseAllowance`
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See `IERC20.approve`.
 */
contract ERC20 is IERC20 {
    using SafeMath for uint256;

    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

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

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

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

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

    /**
     * @dev See `IERC20.approve`.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value)
        public
        override
        returns (bool)
    {
        _approve(msg.sender, spender, value);
        return true;
    }

    /**
     * @dev See `IERC20.transferFrom`.
     *
     * Emits an `Approval` event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of `ERC20`;
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `value`.
     * - the caller must have allowance for `sender`'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address sender,
        address recipient,
        uint256 amount
    ) public override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(
            sender,
            msg.sender,
            _allowances[sender][msg.sender].sub(amount)
        );
        return true;
    }

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

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to `approve` that can be used as a mitigation for
     * problems described in `IERC20.approve`.
     *
     * Emits an `Approval` event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue)
        public
        returns (bool)
    {
        _approve(
            msg.sender,
            spender,
            _allowances[msg.sender][spender].sub(subtractedValue)
        );
        return true;
    }

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

        _balances[sender] = _balances[sender].sub(amount);
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

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

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

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

        _totalSupply = _totalSupply.sub(value);
        _balances[account] = _balances[account].sub(value);
        emit Transfer(account, address(0), value);
    }

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

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

    /**
     * @dev Destoys `amount` tokens from `account`.`amount` is then deducted
     * from the caller's allowance.
     *
     * See `_burn` and `_approve`.
     */
    function _burnFrom(address account, uint256 amount) internal {
        _burn(account, amount);
        _approve(
            account,
            msg.sender,
            _allowances[account][msg.sender].sub(amount)
        );
    }
}

File 20 of 23 : TestERC20Mock.sol
pragma solidity 0.6.11;

import "./ERC20.sol";

contract TestERC20Mock is ERC20 {
    
    function mint(address _to, uint256 _amount) public {
        _mint(_to, _amount);
    }
}

File 21 of 23 : WETHMock.sol
pragma solidity 0.6.11;

import "./TestERC20Mock.sol";

contract WETHMock is TestERC20Mock {
    string public name = "WETH";
    string public symbol = "WETH";
    uint8 public decimals = 18;

}

File 22 of 23 : USDCMock.sol
pragma solidity 0.6.11;

import "./TestERC20Mock.sol";

contract USDCMock is TestERC20Mock {
    string public name = "USDC";
    string public symbol = "USDC";
    uint8 public decimals = 6;

}

File 23 of 23 : InsureToken.sol
pragma solidity 0.6.11;

/***
 *@title InsureToken
 *@author InsureDAO
 * SPDX-License-Identifier: MIT
 *@notice InsureDAO's governance token
 */

//libraries
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract InsureToken is IERC20 {
    event UpdateMiningParameters(
        uint256 time,
        uint256 rate,
        uint256 supply,
        int256 miningepoch
    );
    event SetMinter(address minter);
    event SetAdmin(address admin);

    string public name;
    string public symbol;
    uint256 public constant decimals = 18;

    mapping(address => uint256) public override balanceOf;
    mapping(address => mapping(address => uint256)) allowances;
    uint256 public total_supply;

    address public minter;
    address public admin;

    //General constants
    uint256 constant YEAR = 86400 * 365;

    // Allocation within 5years:
    // ==========
    // * Team & Development: 24%
    // * Liquidity Mining: 40%
    // * Investors: 10%
    // * Foundation Treasury: 14%
    // * Community Treasury: 10%
    // ==========
    //
    // After 5years:
    // ==========
    // * Liquidity Mining: 40%~ (Mint fixed amount every year)
    //
    // Mint 2_800_000 INSURE every year.
    // 6th year: 1.32% inflation rate
    // 7th year: 1.30% inflation rate
    // 8th year: 1.28% infration rate
    // so on
    // ==========

    // Supply parameters
    uint256 constant INITIAL_SUPPLY = 126_000_000; //will be vested
    uint256 constant RATE_REDUCTION_TIME = YEAR;
    uint256[6] public RATES = [
        (28_000_000 * 10**18) / YEAR, //INITIAL_RATE
        (22_400_000 * 10**18) / YEAR,
        (16_800_000 * 10**18) / YEAR,
        (11_200_000 * 10**18) / YEAR,
        (5_600_000 * 10**18) / YEAR,
        (2_800_000 * 10**18) / YEAR
    ];

    uint256 constant RATE_DENOMINATOR = 10**18;
    uint256 constant INFLATION_DELAY = 86400;

    // Supply variables
    int256 public mining_epoch;
    uint256 public start_epoch_time;
    uint256 public rate;

    uint256 public start_epoch_supply;

    uint256 public emergency_minted;

    constructor(string memory _name, string memory _symbol) public {
        /***
         * @notice Contract constructor
         * @param _name Token full name
         * @param _symbol Token symbol
         * @param _decimal will be 18 in the migration script.
         */

        uint256 _init_supply = INITIAL_SUPPLY * RATE_DENOMINATOR;
        name = _name;
        symbol = _symbol;
        balanceOf[msg.sender] = _init_supply;
        total_supply = _init_supply;
        admin = msg.sender;
        emit Transfer(address(0), msg.sender, _init_supply);

        start_epoch_time =
            block.timestamp +
            INFLATION_DELAY -
            RATE_REDUCTION_TIME;
        mining_epoch = -1;
        rate = 0;
        start_epoch_supply = _init_supply;
    }

    function _update_mining_parameters() internal {
        /***
         *@dev Update mining rate and supply at the start of the epoch
         *     Any modifying mining call must also call this
         */
        uint256 _rate = rate;
        uint256 _start_epoch_supply = start_epoch_supply;

        start_epoch_time += RATE_REDUCTION_TIME;
        mining_epoch += 1;

        if (mining_epoch == 0) {
            _rate = RATES[uint256(mining_epoch)];
        } else if (mining_epoch < int256(6)) {
            _start_epoch_supply += RATES[uint256(mining_epoch) - 1] * YEAR;
            start_epoch_supply = _start_epoch_supply;
            _rate = RATES[uint256(mining_epoch)];
        } else {
            _start_epoch_supply += RATES[5] * YEAR;
            start_epoch_supply = _start_epoch_supply;
            _rate = RATES[5];
        }
        rate = _rate;
        emit UpdateMiningParameters(
            block.timestamp,
            _rate,
            _start_epoch_supply,
            mining_epoch
        );
    }

    function update_mining_parameters() external {
        /***
         * @notice Update mining rate and supply at the start of the epoch
         * @dev Callable by any address, but only once per epoch
         *     Total supply becomes slightly larger if this function is called late
         */
        require(
            block.timestamp >= start_epoch_time + RATE_REDUCTION_TIME,
            "dev: too soon!"
        );
        _update_mining_parameters();
    }

    function start_epoch_time_write() external returns (uint256) {
        /***
         *@notice Get timestamp of the current mining epoch start
         *        while simultaneously updating mining parameters
         *@return Timestamp of the epoch
         */
        uint256 _start_epoch_time = start_epoch_time;
        if (block.timestamp >= _start_epoch_time + RATE_REDUCTION_TIME) {
            _update_mining_parameters();
            return start_epoch_time;
        } else {
            return _start_epoch_time;
        }
    }

    function future_epoch_time_write() external returns (uint256) {
        /***
         *@notice Get timestamp of the next mining epoch start
         *        while simultaneously updating mining parameters
         *@return Timestamp of the next epoch
         */

        uint256 _start_epoch_time = start_epoch_time;
        if (block.timestamp >= _start_epoch_time + RATE_REDUCTION_TIME) {
            _update_mining_parameters();
            return start_epoch_time + RATE_REDUCTION_TIME;
        } else {
            return _start_epoch_time + RATE_REDUCTION_TIME;
        }
    }

    function _available_supply() internal view returns (uint256) {
        return
            start_epoch_supply +
            ((block.timestamp - start_epoch_time) * rate) +
            emergency_minted;
    }

    function available_supply() external view returns (uint256) {
        /***
         *@notice Current number of tokens in existence (claimed or unclaimed)
         */
        return _available_supply();
    }

    function mintable_in_timeframe(uint256 start, uint256 end)
        external
        view
        returns (uint256)
    {
        /***
         *@notice How much supply is mintable from start timestamp till end timestamp
         *@param start Start of the time interval (timestamp)
         *@param end End of the time interval (timestamp)
         *@return Tokens mintable from `start` till `end`
         */
        require(start <= end, "dev: start > end");
        uint256 _to_mint = 0;
        uint256 _current_epoch_time = start_epoch_time;
        uint256 _current_rate = rate;
        int256 _current_epoch = mining_epoch;

        // Special case if end is in future (not yet minted) epoch
        if (end > _current_epoch_time + RATE_REDUCTION_TIME) {
            _current_epoch_time += RATE_REDUCTION_TIME;
            if (_current_epoch < 5) {
                _current_rate = RATES[uint256(mining_epoch + int256(1))];
            } else {
                _current_rate = RATES[5];
            }
        }

        require(
            end <= _current_epoch_time + RATE_REDUCTION_TIME,
            "dev: too far in future"
        );

        for (uint256 i = 0; i < 999; i++) {
            // InsureDAO will not work in 1000 years.
            if (end >= _current_epoch_time) {
                uint256 current_end = end;
                if (current_end > _current_epoch_time + RATE_REDUCTION_TIME) {
                    current_end = _current_epoch_time + RATE_REDUCTION_TIME;
                }
                uint256 current_start = start;
                if (
                    current_start >= _current_epoch_time + RATE_REDUCTION_TIME
                ) {
                    break; // We should never get here but what if...
                } else if (current_start < _current_epoch_time) {
                    current_start = _current_epoch_time;
                }
                _to_mint += (_current_rate * (current_end - current_start));

                if (start >= _current_epoch_time) {
                    break;
                }
            }
            _current_epoch_time -= RATE_REDUCTION_TIME;
            if (_current_epoch < 5) {
                _current_rate = RATES[uint256(_current_epoch + int256(1))];
                _current_epoch += 1;
            } else {
                _current_rate = RATES[5];
                _current_epoch += 1;
            }
            assert(_current_rate <= RATES[0]); // This should never happen
        }
        return _to_mint;
    }

    function set_minter(address _minter) external {
        /***
         *@notice Set the minter address
         *@dev Only callable once, when minter has not yet been set
         *@param _minter Address of the minter
         */
        require(msg.sender == admin, "dev: admin only");
        require(
            minter == address(0),
            "dev: can set the minter only once, at creation"
        );
        minter = _minter;
        emit SetMinter(_minter);
    }

    function set_admin(address _admin) external {
        /***
         *@notice Set the new admin.
         *@dev After all is set up, admin only can change the token name
         *@param _admin New admin address
         */
        require(msg.sender == admin, "dev: admin only");
        admin = _admin;
        emit SetAdmin(_admin);
    }

    function totalSupply() external view override returns (uint256) {
        /***
         *@notice Total number of tokens in existence.
         */
        return total_supply;
    }

    function allowance(address _owner, address _spender)
        external
        view
        override
        returns (uint256)
    {
        /***
         *@notice Check the amount of tokens that an owner allowed to a spender
         *@param _owner The address which owns the funds
         *@param _spender The address which will spend the funds
         *@return uint256 specifying the amount of tokens still available for the spender
         */
        return allowances[_owner][_spender];
    }

    function transfer(address _to, uint256 _value)
        external
        override
        returns (bool)
    {
        /***
         *@notice Transfer `_value` tokens from `msg.sender` to `_to`
         *@dev Vyper does not allow underflows, so the subtraction in
         *     this function will revert on an insufficient balance
         *@param _to The address to transfer to
         *@param _value The amount to be transferred
         *@return bool success
         */
        require(_to != address(0), "dev: transfers to 0x0 are not allowed");
        balanceOf[msg.sender] -= _value;
        balanceOf[_to] += _value;
        emit Transfer(msg.sender, _to, _value);
        return true;
    }

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) external override returns (bool) {
        /***
         * @notice Transfer `_value` tokens from `_from` to `_to`
         * @param _from address The address which you want to send tokens from
         * @param _to address The address which you want to transfer to
         * @param _value uint256 the amount of tokens to be transferred
         * @return bool success
         */
        require(_from != address(0), "ERC20: transfer from the zero address");
        require(_to != address(0), "ERC20: transfer to the zero address");

        balanceOf[_from] -= _value;
        balanceOf[_to] += _value;
        allowances[_from][msg.sender] -= _value;
        emit Transfer(_from, _to, _value);
        return true;
    }

    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

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

    function approve(address _spender, uint256 _value)
        external
        override
        returns (bool)
    {
        /**
         *@notice Approve `_spender` to transfer `_value` tokens on behalf of `msg.sender`
         *@param _spender The address which will spend the funds
         *@param _value The amount of tokens to be spent
         *@return bool success
         */
        _approve(msg.sender, _spender, _value);
        return true;
    }

    function increaseAllowance(address _spender, uint256 addedValue)
        external
        returns (bool)
    {
        _approve(
            msg.sender,
            _spender,
            allowances[msg.sender][_spender] + addedValue
        );

        return true;
    }

    function decreaseAllowance(address _spender, uint256 subtractedValue)
        external
        returns (bool)
    {
        uint256 currentAllowance = allowances[msg.sender][_spender];
        require(
            currentAllowance >= subtractedValue,
            "ERC20: decreased allowance below zero"
        );
        _approve(msg.sender, _spender, currentAllowance - subtractedValue);

        return true;
    }

    function mint(address _to, uint256 _value) external returns (bool) {
        /***
         *@notice Mint `_value` tokens and assign them to `_to`
         *@dev Emits a Transfer event originating from 0x00
         *@param _to The account that will receive the created tokens
         *@param _value The amount that will be created
         *@return bool success
         */
        require(msg.sender == minter, "dev: minter only");
        require(_to != address(0), "dev: zero address");

        _mint(_to, _value);

        return true;
    }

    function _mint(address _to, uint256 _value) internal {
        if (block.timestamp >= start_epoch_time + RATE_REDUCTION_TIME) {
            _update_mining_parameters();
        }
        uint256 _total_supply = total_supply + _value;

        require(
            _total_supply <= _available_supply(),
            "dev: exceeds allowable mint amount"
        );
        total_supply = _total_supply;

        balanceOf[_to] += _value;
        emit Transfer(address(0), _to, _value);
    }

    function burn(uint256 _value) external returns (bool) {
        /**
         *@notice Burn `_value` tokens belonging to `msg.sender`
         *@dev Emits a Transfer event with a destination of 0x00
         *@param _value The amount that will be burned
         *@return bool success
         */
        require(
            balanceOf[msg.sender] >= _value,
            "_value > balanceOf[msg.sender]"
        );

        balanceOf[msg.sender] -= _value;
        total_supply -= _value;

        emit Transfer(msg.sender, address(0), _value);
        return true;
    }

    function set_name(string memory _name, string memory _symbol) external {
        /***
         *@notice Change the token name and symbol to `_name` and `_symbol`
         *@dev Only callable by the admin account
         *@param _name New token name
         *@param _symbol New token symbol
         */
        require(msg.sender == admin, "Only admin is allowed to change name");
        name = _name;
        symbol = _symbol;
    }

    function emergency_mint(uint256 _amount, address _to)
        external
        returns (bool)
    {
        /***
         * @notice Emergency minting only when CDS couldn't afford the insolvency.
         * @dev
         * @param _amountOut token amount needed. token is defiend whithin converter.
         * @param _to CDS address
         */
        require(msg.sender == minter, "dev: minter only");
        //mint
        emergency_minted += _amount;
        _mint(_to, _amount);

        return true;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_WETH","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_maxTotalValue","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"claimer","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"assetsMoved","type":"uint256"}],"name":"AssetsFinalized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositor","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct IDefiRound.TokenData","name":"tokenInfo","type":"tuple"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountTransferred","type":"uint256"}],"name":"GenesisTransfer","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":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"indexed":false,"internalType":"struct IDefiRound.RateData[]","name":"ratesData","type":"tuple[]"}],"name":"RatesPublished","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"genesis","type":"address"},{"internalType":"uint256","name":"maxLimit","type":"uint256"}],"indexed":false,"internalType":"struct IDefiRound.SupportedTokenData[]","name":"tokenData","type":"tuple[]"}],"name":"SupportedTokensAdded","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct IDefiRound.TokenData[]","name":"tokens","type":"tuple[]"}],"name":"TreasuryTransfer","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"indexed":false,"internalType":"struct IDefiRound.WhitelistSettings","name":"settings","type":"tuple"}],"name":"WhitelistConfigured","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"withdrawer","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct IDefiRound.TokenData","name":"tokenInfo","type":"tuple"},{"indexed":false,"internalType":"bool","name":"asETH","type":"bool"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"accountBalance","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"oracle","type":"address"},{"internalType":"address","name":"genesis","type":"address"},{"internalType":"uint256","name":"maxLimit","type":"uint256"}],"internalType":"struct IDefiRound.SupportedTokenData[]","name":"tokensToSupport","type":"tuple[]"}],"name":"addSupportedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"internalType":"struct IDefiRound.WhitelistSettings","name":"settings","type":"tuple"}],"name":"configureWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentStage","outputs":[{"internalType":"enum IDefiRound.STAGES","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IDefiRound.TokenData","name":"tokenInfo","type":"tuple"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"finalizeAssets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getAccountData","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"initialDeposit","type":"uint256"},{"internalType":"uint256","name":"currentBalance","type":"uint256"},{"internalType":"uint256","name":"effectiveAmt","type":"uint256"},{"internalType":"uint256","name":"ineffectiveAmt","type":"uint256"},{"internalType":"uint256","name":"actualTokeReceived","type":"uint256"}],"internalType":"struct IDefiRound.AccountDataDetails[]","name":"data","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"getGenesisPools","outputs":[{"internalType":"address[]","name":"genesisAddresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxTotalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"getRateAdjustedAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"getRates","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"internalType":"struct IDefiRound.RateData[]","name":"rates","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSupportedTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"getTokenOracles","outputs":[{"internalType":"address[]","name":"oracleAddresses","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastLookExpiration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"overSubscriptionRate","outputs":[{"internalType":"uint256","name":"overNumerator","type":"uint256"},{"internalType":"uint256","name":"overDenominator","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"numerator","type":"uint256"},{"internalType":"uint256","name":"denominator","type":"uint256"}],"internalType":"struct IDefiRound.RateData[]","name":"ratesData","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"overNumerator","type":"uint256"},{"internalType":"uint256","name":"overDenominator","type":"uint256"}],"internalType":"struct IDefiRound.OversubscriptionRate","name":"oversubRate","type":"tuple"},{"internalType":"uint256","name":"lastLookDuration","type":"uint256"}],"name":"publishRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferToTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"whitelistSettings","outputs":[{"internalType":"bool","name":"enabled","type":"bool"},{"internalType":"bytes32","name":"root","type":"bytes32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e0604052600019600e553480156200001757600080fd5b50604051620039d2380380620039d28339810160408190526200003a9162000167565b60006200004f6001600160e01b036200014516565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b038316620000cb5760405162461bcd60e51b8152600401620000c290620001a9565b60405180910390fd5b6001600160a01b038216620000f45760405162461bcd60e51b8152600401620000c290620001cf565b60008111620001175760405162461bcd60e51b8152600401620000c290620001f9565b6001600160601b0319606093841b81166080529190921b1660a052600b805460ff1916905560c05262000223565b3390565b80516001600160a01b03811681146200016157600080fd5b92915050565b6000806000606084860312156200017c578283fd5b62000188858562000149565b925062000199856020860162000149565b9150604084015190509250925092565b6020808252600c908201526b0929cac82989288beae8aa8960a31b604082015260600190565b60208082526010908201526f494e56414c49445f545245415355525960801b604082015260600190565b60208082526010908201526f1253959053125117d350561513d5105360821b604082015260600190565b60805160601c60a05160601c60c05161375e6200027460003980610a2352806114d4525080610ff4528061136c5250806101b7528061075952806107d8528061099c5280611523525061375e6000f3fe60806040526004361061019a5760003560e01c80637745d9a6116100e1578063d294cb0f1161008a578063e4dc2aa411610064578063e4dc2aa41461046e578063ef02c87e1461048e578063f2fde38b146104ae578063fcd472c2146104ce576101e3565b8063d294cb0f14610424578063d3c7c2c714610444578063d4c3eea014610459576101e3565b8063ad5c4648116100bb578063ad5c4648146103c2578063c41e8501146103d7578063ca72e5ae14610404576101e3565b80637745d9a6146103755780638da5cb5b1461038a578063980f49f41461039f576101e3565b80635d78650e1161014357806367bd79a21161011d57806367bd79a21461031e5780636ff861621461034b578063715018a614610360576101e3565b80635d78650e146102ad57806361d027b3146102da578063646dca4f146102fc576101e3565b806338ca82751161017457806338ca8275146102485780633d240674146102685780635bf5d54c1461028b576101e3565b80631f2bc010146101e857806329b50260146101fd5780633683f4e914610210576101e3565b366101e3573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101e157600080fd5b005b600080fd5b3480156101f457600080fd5b506101e16104ee565b6101e161020b36600461284a565b61065e565b34801561021c57600080fd5b5061023061022b366004612977565b610abc565b60405161023f93929190613653565b60405180910390f35b34801561025457600080fd5b506101e1610263366004612664565b610ad8565b34801561027457600080fd5b5061027d610dc2565b60405161023f929190612a45565b34801561029757600080fd5b506102a0610dcb565b60405161023f9190612dc4565b3480156102b957600080fd5b506102cd6102c83660046125dd565b610dd4565b60405161023f9190612b86565b3480156102e657600080fd5b506102ef610ff2565b60405161023f9190612a6f565b34801561030857600080fd5b50610311611016565b60405161023f919061364a565b34801561032a57600080fd5b5061033e6103393660046125f8565b61101c565b60405161023f9190612c75565b34801561035757600080fd5b506101e161111c565b34801561036c57600080fd5b506101e161140a565b34801561038157600080fd5b506103116114d2565b34801561039657600080fd5b506102ef6114f6565b3480156103ab57600080fd5b506103b4611512565b60405161023f929190612db4565b3480156103ce57600080fd5b506102ef611521565b3480156103e357600080fd5b506103f76103f23660046125f8565b611545565b60405161023f9190612b2c565b34801561041057600080fd5b506101e161041f366004612939565b611674565b34801561043057600080fd5b5061031161043f3660046125dd565b611741565b34801561045057600080fd5b506103f7611795565b34801561046557600080fd5b50610311611843565b34801561047a57600080fd5b506103116104893660046125dd565b611852565b34801561049a57600080fd5b506103f76104a93660046125f8565b611864565b3480156104ba57600080fd5b506101e16104c93660046125dd565b611960565b3480156104da57600080fd5b506101e16104e936600461272a565b611a79565b6002600b5460ff16600281111561050157fe5b146105275760405162461bcd60e51b815260040161051e90613340565b60405180910390fd5b336000908152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff168061056b5760405162461bcd60e51b815260040161051e9061312f565b600061057b836002015483611c08565b509150506000811161059f5760405162461bcd60e51b815260040161051e90613240565b600060028085018281553380845260046020526040909320865481547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91821617825560018089015490830155915492019190915561061e91908416908363ffffffff611d2316565b7f4d864ec082f3b5482c5fdcdcdd02a1c3c38ebd4e3944f441014c43678436186c33838360405161065193929190612a90565b60405180910390a1505050565b6000600b5460ff16600281111561067157fe5b1461068e5760405162461bcd60e51b815260040161051e90612ff6565b600f5460ff16156106b15760405162461bcd60e51b815260040161051e90612ef4565b600c5460ff16156106e8576106cc33600c6001015483611dc9565b6106e85760405162461bcd60e51b815260040161051e906135fa565b6106f06124de565b6106ff368490038401846128fe565b805160208201519192509061071b60078363ffffffff611e0916565b6107375760405162461bcd60e51b815260040161051e9061348a565b600081116107575760405162461bcd60e51b815260040161051e90613555565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156107b25750600034115b1561085c573481146107d65760405162461bcd60e51b815260040161051e90612f2b565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561083e57600080fd5b505af1158015610852573d6000803e3d6000fd5b505050505061087a565b341561087a5760405162461bcd60e51b815260040161051e906131d2565b336000908152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff166108e45780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161781555b805473ffffffffffffffffffffffffffffffffffffffff84811691161461091d5760405162461bcd60e51b815260040161051e9061351e565b6001810154610932908363ffffffff611e3416565b6001820155600281015461094c908363ffffffff611e3416565b6002820181905573ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040902060030154101561099a5760405162461bcd60e51b815260040161051e90613064565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156109f55750600034115b610a2157610a2173ffffffffffffffffffffffffffffffffffffffff841633308563ffffffff611e5916565b7f0000000000000000000000000000000000000000000000000000000000000000610a4a611e80565b10610a7b57600f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b7fd662a533cf12023fe15a80ae716d3a2f8835338d8143c35e821d7999c647f45a3387604051610aac929190612ac1565b60405180910390a1505050505050565b6000806000610acb8585611c08565b9250925092509250925092565b610ae0611f62565b73ffffffffffffffffffffffffffffffffffffffff16610afe6114f6565b73ffffffffffffffffffffffffffffffffffffffff1614610b315760405162461bcd60e51b815260040161051e9061330b565b6000600b5460ff166002811115610b4457fe5b14610b615760405162461bcd60e51b815260040161051e90613209565b6000826020015111610b855760405162461bcd60e51b815260040161051e906133ae565b8151610ba35760405162461bcd60e51b815260040161051e906130f8565b8260005b81811015610d0f57610bb76124f5565b868683818110610bc357fe5b905060600201803603810190610bd991906127a4565b90506000816020015111610bff5760405162461bcd60e51b815260040161051e906130f8565b6000816040015111610c235760405162461bcd60e51b815260040161051e906133ae565b805173ffffffffffffffffffffffffffffffffffffffff9081166000908152600560205260409020541615610c6a5760405162461bcd60e51b815260040161051e906133e5565b8051610c7e9060099063ffffffff611f6616565b610c9a5760405162461bcd60e51b815260040161051e90613453565b805173ffffffffffffffffffffffffffffffffffffffff908116600090815260056020908152604091829020845181547fffffffffffffffffffffffff000000000000000000000000000000000000000016941693909317835583015160018084019190915592015160029091015501610ba7565b50610d1a6007611f88565b610d246009611f88565b14610d415760405162461bcd60e51b815260040161051e90613377565b600b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155438301600e558351905560208301516002556040517f6facc2a144ccf2312601c44688580913a2bd0fc0ab75655cc496a34d54c4e6ec90610db39087908790612c06565b60405180910390a15050505050565b60015460025482565b600b5460ff1681565b60606000610de26007611f88565b90508067ffffffffffffffff81118015610dfb57600080fd5b50604051908082528060200260200182016040528015610e3557816020015b610e2261252c565b815260200190600190039081610e1a5790505b50915060005b81811015610feb576000610e5660078363ffffffff611f9316565b9050610e606124f5565b5073ffffffffffffffffffffffffffffffffffffffff808616600090815260046020908152604091829020825160608101845281549094168452600180820154928501929092526002015491830191909152600b5460ff166002811115610ec357fe5b10158015610ee75750805173ffffffffffffffffffffffffffffffffffffffff1615155b15610f7b576000806000610eff846040015186611c08565b925092509250610f0d61252c565b6040518060c001604052808773ffffffffffffffffffffffffffffffffffffffff168152602001866020015181526020018660400151815260200185815260200184815260200183815250905080898881518110610f6757fe5b602002602001018190525050505050610fe1565b6040518060c001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001826020015181526020018260400151815260200160008152602001600081526020016000815250858481518110610fd557fe5b60200260200101819052505b5050600101610e3b565b5050919050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600e5481565b6060818067ffffffffffffffff8111801561103657600080fd5b5060405190808252806020026020018201604052801561107057816020015b61105d6124f5565b8152602001906001900390816110555790505b50915060005b81811015611114576005600086868481811061108e57fe5b90506020020160208101906110a391906125dd565b73ffffffffffffffffffffffffffffffffffffffff9081168252602080830193909352604091820160002082516060810184528154909216825260018101549382019390935260029092015490820152835184908390811061110157fe5b6020908102919091010152600101611076565b505092915050565b611124611f62565b73ffffffffffffffffffffffffffffffffffffffff166111426114f6565b73ffffffffffffffffffffffffffffffffffffffff16146111755760405162461bcd60e51b815260040161051e9061330b565b61117d611f9f565b6111995760405162461bcd60e51b815260040161051e90612e29565b6001600b5460ff1660028111156111ac57fe5b146111c95760405162461bcd60e51b815260040161051e9061358c565b60006111d56007611f88565b905060608167ffffffffffffffff811180156111f057600080fd5b5060405190808252806020026020018201604052801561122a57816020015b6112176124de565b81526020019060019003908161120f5790505b50905060005b828110156113a257600061124b60078363ffffffff611f9316565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016112889190612a6f565b60206040518083038186803b1580156112a057600080fd5b505afa1580156112b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d8919061295f565b905060006112e68284611c08565b50509050828585815181106112f757fe5b60200260200101516000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508085858151811061134257fe5b602090810291909101810151015261139773ffffffffffffffffffffffffffffffffffffffff84167f00000000000000000000000000000000000000000000000000000000000000008363ffffffff611d2316565b505050600101611230565b50600b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790556040517fd3a9a54f42cff4716bd20029772986d2943700c640107b8d69cc68b4bc9ce7e1906113fe908390612d5c565b60405180910390a15050565b611412611f62565b73ffffffffffffffffffffffffffffffffffffffff166114306114f6565b73ffffffffffffffffffffffffffffffffffffffff16146114635760405162461bcd60e51b815260040161051e9061330b565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b7f000000000000000000000000000000000000000000000000000000000000000090565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600c54600d5460ff9091169082565b7f000000000000000000000000000000000000000000000000000000000000000081565b6060818067ffffffffffffffff8111801561155f57600080fd5b50604051908082528060200260200182016040528015611589578160200160208202803683370190505b50915060005b81811015611114576115c98585838181106115a657fe5b90506020020160208101906115bb91906125dd565b60079063ffffffff611e0916565b6115e55760405162461bcd60e51b815260040161051e906132d4565b600660008686848181106115f557fe5b905060200201602081019061160a91906125dd565b73ffffffffffffffffffffffffffffffffffffffff9081168252602082019290925260400160002060010154845191169084908390811061164757fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015260010161158f565b61167c611f62565b73ffffffffffffffffffffffffffffffffffffffff1661169a6114f6565b73ffffffffffffffffffffffffffffffffffffffff16146116cd5760405162461bcd60e51b815260040161051e9061330b565b8051600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556020810151600d556040517f2cebd0cd952630971231c56fc3fa47c6f10b160cdf17c8956d6376a9d60d519a90611736908390613631565b60405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600460205260408120600281015490549192909161178e91611781911683611fa8565b839063ffffffff611e3416565b9392505050565b606060006117a36007611f88565b90508067ffffffffffffffff811180156117bc57600080fd5b506040519080825280602002602001820160405280156117e6578160200160208202803683370190505b50915060005b8181101561183e5761180560078263ffffffff611f9316565b83828151811061181157fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101526001016117ec565b505090565b600061184d611e80565b905090565b60036020526000908152604090205481565b6060818067ffffffffffffffff8111801561187e57600080fd5b506040519080825280602002602001820160405280156118a8578160200160208202803683370190505b50915060005b81811015611114576118c58585838181106115a657fe5b6118e15760405162461bcd60e51b815260040161051e906132d4565b600660006118f660078463ffffffff611f9316565b73ffffffffffffffffffffffffffffffffffffffff9081168252602082019290925260400160002060020154845191169084908390811061193357fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101526001016118ae565b611968611f62565b73ffffffffffffffffffffffffffffffffffffffff166119866114f6565b73ffffffffffffffffffffffffffffffffffffffff16146119b95760405162461bcd60e51b815260040161051e9061330b565b73ffffffffffffffffffffffffffffffffffffffff81166119ec5760405162461bcd60e51b815260040161051e90612f62565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611a81611f62565b73ffffffffffffffffffffffffffffffffffffffff16611a9f6114f6565b73ffffffffffffffffffffffffffffffffffffffff1614611ad25760405162461bcd60e51b815260040161051e9061330b565b8060005b81811015611bd657611ae6612578565b848483818110611af257fe5b905060800201803603810190611b0891906127e9565b8051909150611b1f9060079063ffffffff611f6616565b611b3b5760405162461bcd60e51b815260040161051e906135c3565b805173ffffffffffffffffffffffffffffffffffffffff908116600090815260066020908152604091829020845181549085167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178255918501516001808301805492871692851692909217909155928501516002820180549190951692169190911790925560609092015160039091015501611ad6565b507f33f1b24b298d587fb4ebebe7a62493afe5b887fd273df28a24581a323a63f6a38383604051610651929190612cd7565b600080806001600b5460ff166002811115611c1f57fe5b1015611c3d5760405162461bcd60e51b815260040161051e90612ebd565b611c456124f5565b5073ffffffffffffffffffffffffffffffffffffffff80851660009081526005602090815260408083208151606081018352815490951685526001808201549386019390935260029081015491850191909152549054611cbd9190611cb1908a9063ffffffff61211c16565b9063ffffffff61215616565b600254600154919250600091611cf09190611cb190611ce390839063ffffffff61218816565b8b9063ffffffff61211c16565b90506000611d138460200151611cb186604001518661211c90919063ffffffff16565b9299919850919650945050505050565b611dc48363a9059cbb60e01b8484604051602401611d42929190612b06565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526121b0565b505050565b60008084604051602001611ddd9190612a15565b604051602081830303815290604052805190602001209050611e0083858361224c565b95945050505050565b6000611e2b8373ffffffffffffffffffffffffffffffffffffffff84166122e9565b90505b92915050565b600082820183811015611e2b5760405162461bcd60e51b815260040161051e90612fbf565b611e7a846323b872dd60e01b858585604051602401611d4293929190612a90565b50505050565b600080611e8d6007611f88565b905060005b8181101561183e576000611ead60078363ffffffff611f9316565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611eea9190612a6f565b60206040518083038186803b158015611f0257600080fd5b505afa158015611f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3a919061295f565b9050611f56611f498383611fa8565b869063ffffffff611e3416565b94505050600101611e92565b3390565b6000611e2b8373ffffffffffffffffffffffffffffffffffffffff8416612301565b6000611e2e8261234b565b6000611e2b838361234f565b600e5443101590565b6000808373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611ff157600080fd5b505afa158015612005573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202991906129f4565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660205260408082206001015481517ffeaf968c000000000000000000000000000000000000000000000000000000008152915160ff9590951695509193919092169163feaf968c9160048083019260a0929190829003018186803b1580156120af57600080fd5b505afa1580156120c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e791906129a3565b50505091505060006120f882612394565b9050612112600a84900a611cb1878463ffffffff61211c16565b9695505050505050565b60008261212b57506000611e2e565b8282028284828161213857fe5b0414611e2b5760405162461bcd60e51b815260040161051e90613277565b60008082116121775760405162461bcd60e51b815260040161051e90613166565b81838161218057fe5b049392505050565b6000828211156121aa5760405162461bcd60e51b815260040161051e9061302d565b50900390565b6060612212826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166123ba9092919063ffffffff16565b805190915015611dc457808060200190518101906122309190612788565b611dc45760405162461bcd60e51b815260040161051e906134c1565b600081815b85518110156122de57600086828151811061226857fe5b602002602001015190508083116122a957828160405160200161228c929190612a45565b6040516020818303038152906040528051906020012092506122d5565b80836040516020016122bc929190612a45565b6040516020818303038152906040528051906020012092505b50600101612251565b509092149392505050565b60009081526001919091016020526040902054151590565b600061230d83836122e9565b61234357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611e2e565b506000611e2e565b5490565b815460009082106123725760405162461bcd60e51b815260040161051e90612e60565b82600001828154811061238157fe5b9060005260206000200154905092915050565b6000808212156123b65760405162461bcd60e51b815260040161051e9061319d565b5090565b60606123c984846000856123d1565b949350505050565b6060824710156123f35760405162461bcd60e51b815260040161051e9061309b565b6123fc8561249f565b6124185760405162461bcd60e51b815260040161051e9061341c565b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040516124429190612a53565b60006040518083038185875af1925050503d806000811461247f576040519150601f19603f3d011682016040523d82523d6000602084013e612484565b606091505b50915091506124948282866124a5565b979650505050505050565b3b151590565b606083156124b457508161178e565b8251156124c45782518084602001fd5b8160405162461bcd60e51b815260040161051e9190612dd8565b604080518082019091526000808252602082015290565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081525090565b60408051608081018252600080825260208201819052918101829052606081019190915290565b803573ffffffffffffffffffffffffffffffffffffffff81168114611e2e57600080fd5b805169ffffffffffffffffffff81168114611e2e57600080fd5b6000602082840312156125ee578081fd5b611e2b838361259f565b6000806020838503121561260a578081fd5b823567ffffffffffffffff80821115612621578283fd5b81850186601f820112612632578384fd5b8035925081831115612642578384fd5b8660208085028301011115612655578384fd5b60200196919550909350505050565b600080600080848603608081121561267a578283fd5b853567ffffffffffffffff80821115612691578485fd5b81880189601f8201126126a2578586fd5b80359250818311156126b2578586fd5b8960206060850283010111156126c6578586fd5b60200196509094505060407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820112156126fe578283fd5b506127096040613669565b60208681013582526040870135908201529396929550929360600135925050565b6000806020838503121561273c578182fd5b823567ffffffffffffffff80821115612753578384fd5b81850186601f820112612764578485fd5b8035925081831115612774578485fd5b866020608085028301011115612655578485fd5b600060208284031215612799578081fd5b8151611e2b8161371a565b6000606082840312156127b5578081fd5b6127bf6060613669565b6127c9848461259f565b815260208301356020820152604083013560408201528091505092915050565b6000608082840312156127fa578081fd5b6128046080613669565b823561280f816136f5565b8152602083013561281f816136f5565b60208201526040830135612832816136f5565b60408201526060928301359281019290925250919050565b600080828403606081121561285d578283fd5b604081121561286a578283fd5b50829150604083013567ffffffffffffffff811115612887578182fd5b80840185601f820112612898578283fd5b803591506128ad6128a883613690565b613669565b8083825260208083019250808401898283880287010111156128cd578687fd5b8694505b858510156128ef5780358452600194909401939281019281016128d1565b50959890975095505050505050565b60006040828403121561290f578081fd5b6129196040613669565b8235612924816136f5565b81526020928301359281019290925250919050565b60006040828403121561294a578081fd5b6129546040613669565b82356129248161371a565b600060208284031215612970578081fd5b5051919050565b60008060408385031215612989578182fd5b8235915061299a846020850161259f565b90509250929050565b600080600080600060a086880312156129ba578283fd5b6129c487876125c3565b94506020860151935060408601519250606086015191506129e887608088016125c3565b90509295509295909350565b600060208284031215612a05578081fd5b815160ff81168114611e2b578182fd5b60609190911b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815260140190565b918252602082015260400190565b60008251612a658184602087016136c9565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff838116825260608201908335612aeb816136f5565b81811660208501525050602083013560408301529392505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015612b7a57835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612b48565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612bf9578151612bb781516136b0565b855280870151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101612ba3565b5091979650505050505050565b6020808252818101839052600090604080840186845b87811015612c685784820173ffffffffffffffffffffffffffffffffffffffff612c46828561259f565b1684523585840152818401358484015260609283019290910190600101612c1c565b5090979650505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612bf9578151805173ffffffffffffffffffffffffffffffffffffffff16855286810151878601528501518585015260609093019290850190600101612c92565b6020808252818101839052600090604080840186845b87811015612c685784820173ffffffffffffffffffffffffffffffffffffffff80612d18838661259f565b1685528135612d26816136f5565b811685880152838601359150612d3b826136f5565b16838501526060828101359084015260809283019290910190600101612ced565b602080825282518282018190526000919060409081850190868401855b82811015612bf9578151805173ffffffffffffffffffffffffffffffffffffffff168552860151868501529284019290850190600101612d79565b9115158252602082015260400190565b6020810160038310612dd257fe5b91905290565b6000602082528251806020840152612df78160408501602087016136c9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526015908201527f43555252454e545f53544147455f494e56414c49440000000000000000000000604082015260600190565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60408201527f6473000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526013908201527f52415445535f4e4f545f5055424c495348454400000000000000000000000000604082015260600190565b6020808252600f908201527f4445504f534954535f4c4f434b45440000000000000000000000000000000000604082015260600190565b60208082526011908201527f494e56414c49445f4d53475f56414c5545000000000000000000000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526015908201527f4445504f534954535f4e4f545f41434345505445440000000000000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526012908201527f4d41585f4c494d49545f45584345454445440000000000000000000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f494e56414c49445f4e554d455241544f52000000000000000000000000000000604082015260600190565b60208082526007908201527f4e4f5f4441544100000000000000000000000000000000000000000000000000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252818101527f53616665436173743a2076616c7565206d75737420626520706f736974697665604082015260600190565b60208082526006908201527f4e4f5f4554480000000000000000000000000000000000000000000000000000604082015260600190565b60208082526011908201527f52415445535f414c52454144595f534554000000000000000000000000000000604082015260600190565b6020808252600f908201527f4e4f5448494e475f544f5f4d4f56450000000000000000000000000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f544f4b454e5f554e535550504f52544544000000000000000000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201527f4e4f545f53595354454d5f46494e414c00000000000000000000000000000000604082015260600190565b6020808252600c908201527f4d495353494e475f524154450000000000000000000000000000000000000000604082015260600190565b60208082526013908201527f494e56414c49445f44454e4f4d494e41544f5200000000000000000000000000604082015260600190565b60208082526010908201527f524154455f414c52454144595f53455400000000000000000000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f414c52454144595f434f4e464947555245440000000000000000000000000000604082015260600190565b60208082526011908201527f554e535550504f525445445f544f4b454e000000000000000000000000000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526015908201527f53494e474c455f41535345545f4445504f534954530000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f414d4f554e54000000000000000000000000000000000000604082015260600190565b60208082526012908201527f4f4e4c595f5452414e534645525f4f4e43450000000000000000000000000000604082015260600190565b6020808252600c908201527f544f4b454e5f4558495354530000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f50524f4f465f494e56414c494400000000000000000000000000000000000000604082015260600190565b8151151581526020918201519181019190915260400190565b90815260200190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff8111828210171561368857600080fd5b604052919050565b600067ffffffffffffffff8211156136a6578081fd5b5060209081020190565b73ffffffffffffffffffffffffffffffffffffffff1690565b60005b838110156136e45781810151838201526020016136cc565b83811115611e7a5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461371757600080fd5b50565b801515811461371757600080fdfea2646970667358221220824a5c5d0627aa3a1eac2193ce29ff5e48de20b1c77045c37f1a7637ed98df8b64736f6c634300060b0033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ec177d69971eeeb3654a347acbfff4435ed42e4100000000000000000000000000000000000000000000000000025844398d4000

Deployed Bytecode

0x60806040526004361061019a5760003560e01c80637745d9a6116100e1578063d294cb0f1161008a578063e4dc2aa411610064578063e4dc2aa41461046e578063ef02c87e1461048e578063f2fde38b146104ae578063fcd472c2146104ce576101e3565b8063d294cb0f14610424578063d3c7c2c714610444578063d4c3eea014610459576101e3565b8063ad5c4648116100bb578063ad5c4648146103c2578063c41e8501146103d7578063ca72e5ae14610404576101e3565b80637745d9a6146103755780638da5cb5b1461038a578063980f49f41461039f576101e3565b80635d78650e1161014357806367bd79a21161011d57806367bd79a21461031e5780636ff861621461034b578063715018a614610360576101e3565b80635d78650e146102ad57806361d027b3146102da578063646dca4f146102fc576101e3565b806338ca82751161017457806338ca8275146102485780633d240674146102685780635bf5d54c1461028b576101e3565b80631f2bc010146101e857806329b50260146101fd5780633683f4e914610210576101e3565b366101e3573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216146101e157600080fd5b005b600080fd5b3480156101f457600080fd5b506101e16104ee565b6101e161020b36600461284a565b61065e565b34801561021c57600080fd5b5061023061022b366004612977565b610abc565b60405161023f93929190613653565b60405180910390f35b34801561025457600080fd5b506101e1610263366004612664565b610ad8565b34801561027457600080fd5b5061027d610dc2565b60405161023f929190612a45565b34801561029757600080fd5b506102a0610dcb565b60405161023f9190612dc4565b3480156102b957600080fd5b506102cd6102c83660046125dd565b610dd4565b60405161023f9190612b86565b3480156102e657600080fd5b506102ef610ff2565b60405161023f9190612a6f565b34801561030857600080fd5b50610311611016565b60405161023f919061364a565b34801561032a57600080fd5b5061033e6103393660046125f8565b61101c565b60405161023f9190612c75565b34801561035757600080fd5b506101e161111c565b34801561036c57600080fd5b506101e161140a565b34801561038157600080fd5b506103116114d2565b34801561039657600080fd5b506102ef6114f6565b3480156103ab57600080fd5b506103b4611512565b60405161023f929190612db4565b3480156103ce57600080fd5b506102ef611521565b3480156103e357600080fd5b506103f76103f23660046125f8565b611545565b60405161023f9190612b2c565b34801561041057600080fd5b506101e161041f366004612939565b611674565b34801561043057600080fd5b5061031161043f3660046125dd565b611741565b34801561045057600080fd5b506103f7611795565b34801561046557600080fd5b50610311611843565b34801561047a57600080fd5b506103116104893660046125dd565b611852565b34801561049a57600080fd5b506103f76104a93660046125f8565b611864565b3480156104ba57600080fd5b506101e16104c93660046125dd565b611960565b3480156104da57600080fd5b506101e16104e936600461272a565b611a79565b6002600b5460ff16600281111561050157fe5b146105275760405162461bcd60e51b815260040161051e90613340565b60405180910390fd5b336000908152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff168061056b5760405162461bcd60e51b815260040161051e9061312f565b600061057b836002015483611c08565b509150506000811161059f5760405162461bcd60e51b815260040161051e90613240565b600060028085018281553380845260046020526040909320865481547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff91821617825560018089015490830155915492019190915561061e91908416908363ffffffff611d2316565b7f4d864ec082f3b5482c5fdcdcdd02a1c3c38ebd4e3944f441014c43678436186c33838360405161065193929190612a90565b60405180910390a1505050565b6000600b5460ff16600281111561067157fe5b1461068e5760405162461bcd60e51b815260040161051e90612ff6565b600f5460ff16156106b15760405162461bcd60e51b815260040161051e90612ef4565b600c5460ff16156106e8576106cc33600c6001015483611dc9565b6106e85760405162461bcd60e51b815260040161051e906135fa565b6106f06124de565b6106ff368490038401846128fe565b805160208201519192509061071b60078363ffffffff611e0916565b6107375760405162461bcd60e51b815260040161051e9061348a565b600081116107575760405162461bcd60e51b815260040161051e90613555565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156107b25750600034115b1561085c573481146107d65760405162461bcd60e51b815260040161051e90612f2b565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561083e57600080fd5b505af1158015610852573d6000803e3d6000fd5b505050505061087a565b341561087a5760405162461bcd60e51b815260040161051e906131d2565b336000908152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff166108e45780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161781555b805473ffffffffffffffffffffffffffffffffffffffff84811691161461091d5760405162461bcd60e51b815260040161051e9061351e565b6001810154610932908363ffffffff611e3416565b6001820155600281015461094c908363ffffffff611e3416565b6002820181905573ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040902060030154101561099a5760405162461bcd60e51b815260040161051e90613064565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156109f55750600034115b610a2157610a2173ffffffffffffffffffffffffffffffffffffffff841633308563ffffffff611e5916565b7f00000000000000000000000000000000000000000000000000025844398d4000610a4a611e80565b10610a7b57600f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555b7fd662a533cf12023fe15a80ae716d3a2f8835338d8143c35e821d7999c647f45a3387604051610aac929190612ac1565b60405180910390a1505050505050565b6000806000610acb8585611c08565b9250925092509250925092565b610ae0611f62565b73ffffffffffffffffffffffffffffffffffffffff16610afe6114f6565b73ffffffffffffffffffffffffffffffffffffffff1614610b315760405162461bcd60e51b815260040161051e9061330b565b6000600b5460ff166002811115610b4457fe5b14610b615760405162461bcd60e51b815260040161051e90613209565b6000826020015111610b855760405162461bcd60e51b815260040161051e906133ae565b8151610ba35760405162461bcd60e51b815260040161051e906130f8565b8260005b81811015610d0f57610bb76124f5565b868683818110610bc357fe5b905060600201803603810190610bd991906127a4565b90506000816020015111610bff5760405162461bcd60e51b815260040161051e906130f8565b6000816040015111610c235760405162461bcd60e51b815260040161051e906133ae565b805173ffffffffffffffffffffffffffffffffffffffff9081166000908152600560205260409020541615610c6a5760405162461bcd60e51b815260040161051e906133e5565b8051610c7e9060099063ffffffff611f6616565b610c9a5760405162461bcd60e51b815260040161051e90613453565b805173ffffffffffffffffffffffffffffffffffffffff908116600090815260056020908152604091829020845181547fffffffffffffffffffffffff000000000000000000000000000000000000000016941693909317835583015160018084019190915592015160029091015501610ba7565b50610d1a6007611f88565b610d246009611f88565b14610d415760405162461bcd60e51b815260040161051e90613377565b600b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155438301600e558351905560208301516002556040517f6facc2a144ccf2312601c44688580913a2bd0fc0ab75655cc496a34d54c4e6ec90610db39087908790612c06565b60405180910390a15050505050565b60015460025482565b600b5460ff1681565b60606000610de26007611f88565b90508067ffffffffffffffff81118015610dfb57600080fd5b50604051908082528060200260200182016040528015610e3557816020015b610e2261252c565b815260200190600190039081610e1a5790505b50915060005b81811015610feb576000610e5660078363ffffffff611f9316565b9050610e606124f5565b5073ffffffffffffffffffffffffffffffffffffffff808616600090815260046020908152604091829020825160608101845281549094168452600180820154928501929092526002015491830191909152600b5460ff166002811115610ec357fe5b10158015610ee75750805173ffffffffffffffffffffffffffffffffffffffff1615155b15610f7b576000806000610eff846040015186611c08565b925092509250610f0d61252c565b6040518060c001604052808773ffffffffffffffffffffffffffffffffffffffff168152602001866020015181526020018660400151815260200185815260200184815260200183815250905080898881518110610f6757fe5b602002602001018190525050505050610fe1565b6040518060c001604052808373ffffffffffffffffffffffffffffffffffffffff168152602001826020015181526020018260400151815260200160008152602001600081526020016000815250858481518110610fd557fe5b60200260200101819052505b5050600101610e3b565b5050919050565b7f000000000000000000000000ec177d69971eeeb3654a347acbfff4435ed42e4181565b600e5481565b6060818067ffffffffffffffff8111801561103657600080fd5b5060405190808252806020026020018201604052801561107057816020015b61105d6124f5565b8152602001906001900390816110555790505b50915060005b81811015611114576005600086868481811061108e57fe5b90506020020160208101906110a391906125dd565b73ffffffffffffffffffffffffffffffffffffffff9081168252602080830193909352604091820160002082516060810184528154909216825260018101549382019390935260029092015490820152835184908390811061110157fe5b6020908102919091010152600101611076565b505092915050565b611124611f62565b73ffffffffffffffffffffffffffffffffffffffff166111426114f6565b73ffffffffffffffffffffffffffffffffffffffff16146111755760405162461bcd60e51b815260040161051e9061330b565b61117d611f9f565b6111995760405162461bcd60e51b815260040161051e90612e29565b6001600b5460ff1660028111156111ac57fe5b146111c95760405162461bcd60e51b815260040161051e9061358c565b60006111d56007611f88565b905060608167ffffffffffffffff811180156111f057600080fd5b5060405190808252806020026020018201604052801561122a57816020015b6112176124de565b81526020019060019003908161120f5790505b50905060005b828110156113a257600061124b60078363ffffffff611f9316565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016112889190612a6f565b60206040518083038186803b1580156112a057600080fd5b505afa1580156112b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d8919061295f565b905060006112e68284611c08565b50509050828585815181106112f757fe5b60200260200101516000019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508085858151811061134257fe5b602090810291909101810151015261139773ffffffffffffffffffffffffffffffffffffffff84167f000000000000000000000000ec177d69971eeeb3654a347acbfff4435ed42e418363ffffffff611d2316565b505050600101611230565b50600b80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790556040517fd3a9a54f42cff4716bd20029772986d2943700c640107b8d69cc68b4bc9ce7e1906113fe908390612d5c565b60405180910390a15050565b611412611f62565b73ffffffffffffffffffffffffffffffffffffffff166114306114f6565b73ffffffffffffffffffffffffffffffffffffffff16146114635760405162461bcd60e51b815260040161051e9061330b565b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b7f00000000000000000000000000000000000000000000000000025844398d400090565b60005473ffffffffffffffffffffffffffffffffffffffff1690565b600c54600d5460ff9091169082565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6060818067ffffffffffffffff8111801561155f57600080fd5b50604051908082528060200260200182016040528015611589578160200160208202803683370190505b50915060005b81811015611114576115c98585838181106115a657fe5b90506020020160208101906115bb91906125dd565b60079063ffffffff611e0916565b6115e55760405162461bcd60e51b815260040161051e906132d4565b600660008686848181106115f557fe5b905060200201602081019061160a91906125dd565b73ffffffffffffffffffffffffffffffffffffffff9081168252602082019290925260400160002060010154845191169084908390811061164757fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015260010161158f565b61167c611f62565b73ffffffffffffffffffffffffffffffffffffffff1661169a6114f6565b73ffffffffffffffffffffffffffffffffffffffff16146116cd5760405162461bcd60e51b815260040161051e9061330b565b8051600c80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790556020810151600d556040517f2cebd0cd952630971231c56fc3fa47c6f10b160cdf17c8956d6376a9d60d519a90611736908390613631565b60405180910390a150565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600460205260408120600281015490549192909161178e91611781911683611fa8565b839063ffffffff611e3416565b9392505050565b606060006117a36007611f88565b90508067ffffffffffffffff811180156117bc57600080fd5b506040519080825280602002602001820160405280156117e6578160200160208202803683370190505b50915060005b8181101561183e5761180560078263ffffffff611f9316565b83828151811061181157fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101526001016117ec565b505090565b600061184d611e80565b905090565b60036020526000908152604090205481565b6060818067ffffffffffffffff8111801561187e57600080fd5b506040519080825280602002602001820160405280156118a8578160200160208202803683370190505b50915060005b81811015611114576118c58585838181106115a657fe5b6118e15760405162461bcd60e51b815260040161051e906132d4565b600660006118f660078463ffffffff611f9316565b73ffffffffffffffffffffffffffffffffffffffff9081168252602082019290925260400160002060020154845191169084908390811061193357fe5b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101526001016118ae565b611968611f62565b73ffffffffffffffffffffffffffffffffffffffff166119866114f6565b73ffffffffffffffffffffffffffffffffffffffff16146119b95760405162461bcd60e51b815260040161051e9061330b565b73ffffffffffffffffffffffffffffffffffffffff81166119ec5760405162461bcd60e51b815260040161051e90612f62565b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b611a81611f62565b73ffffffffffffffffffffffffffffffffffffffff16611a9f6114f6565b73ffffffffffffffffffffffffffffffffffffffff1614611ad25760405162461bcd60e51b815260040161051e9061330b565b8060005b81811015611bd657611ae6612578565b848483818110611af257fe5b905060800201803603810190611b0891906127e9565b8051909150611b1f9060079063ffffffff611f6616565b611b3b5760405162461bcd60e51b815260040161051e906135c3565b805173ffffffffffffffffffffffffffffffffffffffff908116600090815260066020908152604091829020845181549085167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216178255918501516001808301805492871692851692909217909155928501516002820180549190951692169190911790925560609092015160039091015501611ad6565b507f33f1b24b298d587fb4ebebe7a62493afe5b887fd273df28a24581a323a63f6a38383604051610651929190612cd7565b600080806001600b5460ff166002811115611c1f57fe5b1015611c3d5760405162461bcd60e51b815260040161051e90612ebd565b611c456124f5565b5073ffffffffffffffffffffffffffffffffffffffff80851660009081526005602090815260408083208151606081018352815490951685526001808201549386019390935260029081015491850191909152549054611cbd9190611cb1908a9063ffffffff61211c16565b9063ffffffff61215616565b600254600154919250600091611cf09190611cb190611ce390839063ffffffff61218816565b8b9063ffffffff61211c16565b90506000611d138460200151611cb186604001518661211c90919063ffffffff16565b9299919850919650945050505050565b611dc48363a9059cbb60e01b8484604051602401611d42929190612b06565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526121b0565b505050565b60008084604051602001611ddd9190612a15565b604051602081830303815290604052805190602001209050611e0083858361224c565b95945050505050565b6000611e2b8373ffffffffffffffffffffffffffffffffffffffff84166122e9565b90505b92915050565b600082820183811015611e2b5760405162461bcd60e51b815260040161051e90612fbf565b611e7a846323b872dd60e01b858585604051602401611d4293929190612a90565b50505050565b600080611e8d6007611f88565b905060005b8181101561183e576000611ead60078363ffffffff611f9316565b905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401611eea9190612a6f565b60206040518083038186803b158015611f0257600080fd5b505afa158015611f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3a919061295f565b9050611f56611f498383611fa8565b869063ffffffff611e3416565b94505050600101611e92565b3390565b6000611e2b8373ffffffffffffffffffffffffffffffffffffffff8416612301565b6000611e2e8261234b565b6000611e2b838361234f565b600e5443101590565b6000808373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015611ff157600080fd5b505afa158015612005573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061202991906129f4565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600660205260408082206001015481517ffeaf968c000000000000000000000000000000000000000000000000000000008152915160ff9590951695509193919092169163feaf968c9160048083019260a0929190829003018186803b1580156120af57600080fd5b505afa1580156120c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e791906129a3565b50505091505060006120f882612394565b9050612112600a84900a611cb1878463ffffffff61211c16565b9695505050505050565b60008261212b57506000611e2e565b8282028284828161213857fe5b0414611e2b5760405162461bcd60e51b815260040161051e90613277565b60008082116121775760405162461bcd60e51b815260040161051e90613166565b81838161218057fe5b049392505050565b6000828211156121aa5760405162461bcd60e51b815260040161051e9061302d565b50900390565b6060612212826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166123ba9092919063ffffffff16565b805190915015611dc457808060200190518101906122309190612788565b611dc45760405162461bcd60e51b815260040161051e906134c1565b600081815b85518110156122de57600086828151811061226857fe5b602002602001015190508083116122a957828160405160200161228c929190612a45565b6040516020818303038152906040528051906020012092506122d5565b80836040516020016122bc929190612a45565b6040516020818303038152906040528051906020012092505b50600101612251565b509092149392505050565b60009081526001919091016020526040902054151590565b600061230d83836122e9565b61234357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611e2e565b506000611e2e565b5490565b815460009082106123725760405162461bcd60e51b815260040161051e90612e60565b82600001828154811061238157fe5b9060005260206000200154905092915050565b6000808212156123b65760405162461bcd60e51b815260040161051e9061319d565b5090565b60606123c984846000856123d1565b949350505050565b6060824710156123f35760405162461bcd60e51b815260040161051e9061309b565b6123fc8561249f565b6124185760405162461bcd60e51b815260040161051e9061341c565b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040516124429190612a53565b60006040518083038185875af1925050503d806000811461247f576040519150601f19603f3d011682016040523d82523d6000602084013e612484565b606091505b50915091506124948282866124a5565b979650505050505050565b3b151590565b606083156124b457508161178e565b8251156124c45782518084602001fd5b8160405162461bcd60e51b815260040161051e9190612dd8565b604080518082019091526000808252602082015290565b6040518060600160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b6040518060c00160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600081525090565b60408051608081018252600080825260208201819052918101829052606081019190915290565b803573ffffffffffffffffffffffffffffffffffffffff81168114611e2e57600080fd5b805169ffffffffffffffffffff81168114611e2e57600080fd5b6000602082840312156125ee578081fd5b611e2b838361259f565b6000806020838503121561260a578081fd5b823567ffffffffffffffff80821115612621578283fd5b81850186601f820112612632578384fd5b8035925081831115612642578384fd5b8660208085028301011115612655578384fd5b60200196919550909350505050565b600080600080848603608081121561267a578283fd5b853567ffffffffffffffff80821115612691578485fd5b81880189601f8201126126a2578586fd5b80359250818311156126b2578586fd5b8960206060850283010111156126c6578586fd5b60200196509094505060407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0820112156126fe578283fd5b506127096040613669565b60208681013582526040870135908201529396929550929360600135925050565b6000806020838503121561273c578182fd5b823567ffffffffffffffff80821115612753578384fd5b81850186601f820112612764578485fd5b8035925081831115612774578485fd5b866020608085028301011115612655578485fd5b600060208284031215612799578081fd5b8151611e2b8161371a565b6000606082840312156127b5578081fd5b6127bf6060613669565b6127c9848461259f565b815260208301356020820152604083013560408201528091505092915050565b6000608082840312156127fa578081fd5b6128046080613669565b823561280f816136f5565b8152602083013561281f816136f5565b60208201526040830135612832816136f5565b60408201526060928301359281019290925250919050565b600080828403606081121561285d578283fd5b604081121561286a578283fd5b50829150604083013567ffffffffffffffff811115612887578182fd5b80840185601f820112612898578283fd5b803591506128ad6128a883613690565b613669565b8083825260208083019250808401898283880287010111156128cd578687fd5b8694505b858510156128ef5780358452600194909401939281019281016128d1565b50959890975095505050505050565b60006040828403121561290f578081fd5b6129196040613669565b8235612924816136f5565b81526020928301359281019290925250919050565b60006040828403121561294a578081fd5b6129546040613669565b82356129248161371a565b600060208284031215612970578081fd5b5051919050565b60008060408385031215612989578182fd5b8235915061299a846020850161259f565b90509250929050565b600080600080600060a086880312156129ba578283fd5b6129c487876125c3565b94506020860151935060408601519250606086015191506129e887608088016125c3565b90509295509295909350565b600060208284031215612a05578081fd5b815160ff81168114611e2b578182fd5b60609190911b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815260140190565b918252602082015260400190565b60008251612a658184602087016136c9565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff838116825260608201908335612aeb816136f5565b81811660208501525050602083013560408301529392505050565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015612b7a57835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101612b48565b50909695505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612bf9578151612bb781516136b0565b855280870151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101612ba3565b5091979650505050505050565b6020808252818101839052600090604080840186845b87811015612c685784820173ffffffffffffffffffffffffffffffffffffffff612c46828561259f565b1684523585840152818401358484015260609283019290910190600101612c1c565b5090979650505050505050565b602080825282518282018190526000919060409081850190868401855b82811015612bf9578151805173ffffffffffffffffffffffffffffffffffffffff16855286810151878601528501518585015260609093019290850190600101612c92565b6020808252818101839052600090604080840186845b87811015612c685784820173ffffffffffffffffffffffffffffffffffffffff80612d18838661259f565b1685528135612d26816136f5565b811685880152838601359150612d3b826136f5565b16838501526060828101359084015260809283019290910190600101612ced565b602080825282518282018190526000919060409081850190868401855b82811015612bf9578151805173ffffffffffffffffffffffffffffffffffffffff168552860151868501529284019290850190600101612d79565b9115158252602082015260400190565b6020810160038310612dd257fe5b91905290565b6000602082528251806020840152612df78160408501602087016136c9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526015908201527f43555252454e545f53544147455f494e56414c49440000000000000000000000604082015260600190565b60208082526022908201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60408201527f6473000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526013908201527f52415445535f4e4f545f5055424c495348454400000000000000000000000000604082015260600190565b6020808252600f908201527f4445504f534954535f4c4f434b45440000000000000000000000000000000000604082015260600190565b60208082526011908201527f494e56414c49445f4d53475f56414c5545000000000000000000000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526015908201527f4445504f534954535f4e4f545f41434345505445440000000000000000000000604082015260600190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526012908201527f4d41585f4c494d49545f45584345454445440000000000000000000000000000604082015260600190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60408201527f722063616c6c0000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f494e56414c49445f4e554d455241544f52000000000000000000000000000000604082015260600190565b60208082526007908201527f4e4f5f4441544100000000000000000000000000000000000000000000000000604082015260600190565b6020808252601a908201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604082015260600190565b6020808252818101527f53616665436173743a2076616c7565206d75737420626520706f736974697665604082015260600190565b60208082526006908201527f4e4f5f4554480000000000000000000000000000000000000000000000000000604082015260600190565b60208082526011908201527f52415445535f414c52454144595f534554000000000000000000000000000000604082015260600190565b6020808252600f908201527f4e4f5448494e475f544f5f4d4f56450000000000000000000000000000000000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f544f4b454e5f554e535550504f52544544000000000000000000000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526010908201527f4e4f545f53595354454d5f46494e414c00000000000000000000000000000000604082015260600190565b6020808252600c908201527f4d495353494e475f524154450000000000000000000000000000000000000000604082015260600190565b60208082526013908201527f494e56414c49445f44454e4f4d494e41544f5200000000000000000000000000604082015260600190565b60208082526010908201527f524154455f414c52454144595f53455400000000000000000000000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b60208082526012908201527f414c52454144595f434f4e464947555245440000000000000000000000000000604082015260600190565b60208082526011908201527f554e535550504f525445445f544f4b454e000000000000000000000000000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526015908201527f53494e474c455f41535345545f4445504f534954530000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f414d4f554e54000000000000000000000000000000000000604082015260600190565b60208082526012908201527f4f4e4c595f5452414e534645525f4f4e43450000000000000000000000000000604082015260600190565b6020808252600c908201527f544f4b454e5f4558495354530000000000000000000000000000000000000000604082015260600190565b6020808252600d908201527f50524f4f465f494e56414c494400000000000000000000000000000000000000604082015260600190565b8151151581526020918201519181019190915260400190565b90815260200190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff8111828210171561368857600080fd5b604052919050565b600067ffffffffffffffff8211156136a6578081fd5b5060209081020190565b73ffffffffffffffffffffffffffffffffffffffff1690565b60005b838110156136e45781810151838201526020016136cc565b83811115611e7a5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff8116811461371757600080fd5b50565b801515811461371757600080fdfea2646970667358221220824a5c5d0627aa3a1eac2193ce29ff5e48de20b1c77045c37f1a7637ed98df8b64736f6c634300060b0033

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

000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ec177d69971eeeb3654a347acbfff4435ed42e4100000000000000000000000000000000000000000000000000025844398d4000

-----Decoded View---------------
Arg [0] : _WETH (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _treasury (address): 0xEC177D69971eeEB3654A347AcbffF4435ed42e41
Arg [2] : _maxTotalValue (uint256): 660000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 000000000000000000000000ec177d69971eeeb3654a347acbfff4435ed42e41
Arg [2] : 00000000000000000000000000000000000000000000000000025844398d4000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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