ETH Price: $2,547.34 (-4.88%)
Gas: 1 Gwei

Contract

0x33827D2d2a0f4533AC26083E6eaAe71D417cbBA0
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Unwrap182346702023-09-28 13:57:11318 days ago1695909431IN
0x33827D2d...D417cbBA0
0 ETH0.0014112811.24487254
Wrap182346632023-09-28 13:55:47318 days ago1695909347IN
0x33827D2d...D417cbBA0
0.10697865 ETH0.0035434511.89054199
Unwrap174996652023-06-17 12:55:59421 days ago1687006559IN
0x33827D2d...D417cbBA0
0 ETH0.0013835413.9853719
Unwrap164312092023-01-18 4:10:11572 days ago1674015011IN
0x33827D2d...D417cbBA0
0 ETH0.0032810226.16177485
Wrap163713672023-01-09 19:34:59580 days ago1673292899IN
0x33827D2d...D417cbBA0
0.02246551 ETH0.0108375736.37966888
Unwrap163711312023-01-09 18:47:11580 days ago1673290031IN
0x33827D2d...D417cbBA0
0 ETH0.003335626.5970026
Unwrap163609452023-01-08 8:41:47581 days ago1673167307IN
0x33827D2d...D417cbBA0
0 ETH0.0017669114.08878495
Wrap163312872023-01-04 5:19:23586 days ago1672809563IN
0x33827D2d...D417cbBA0
0.02246551 ETH0.0046506315.61127603
Unwrap163312622023-01-04 5:14:23586 days ago1672809263IN
0x33827D2d...D417cbBA0
0 ETH0.002336118.62727868
Unwrap163215462023-01-02 20:42:11587 days ago1672692131IN
0x33827D2d...D417cbBA0
0 ETH0.0021416621.66891452
Wrap163187152023-01-02 11:13:23587 days ago1672658003IN
0x33827D2d...D417cbBA0
0.02246551 ETH0.0039645513.30824185
Unwrap163098122023-01-01 5:25:35589 days ago1672550735IN
0x33827D2d...D417cbBA0
0 ETH0.0025850617.42073917
Wrap163070102022-12-31 20:03:35589 days ago1672517015IN
0x33827D2d...D417cbBA0
0.02246551 ETH0.0044352815.42781315
Wrap163064802022-12-31 18:17:11589 days ago1672510631IN
0x33827D2d...D417cbBA0
0.0235353 ETH0.0049475416.60864531
Unwrap162035942022-12-17 9:42:59603 days ago1671270179IN
0x33827D2d...D417cbBA0
0 ETH0.0016354216.54681657
Wrap160173822022-11-21 9:05:59629 days ago1669021559IN
0x33827D2d...D417cbBA0
1.0697865 ETH0.0031614310.61232356
Wrap160139952022-11-20 21:45:23630 days ago1668980723IN
0x33827D2d...D417cbBA0
0.6418719 ETH0.0033020111.48536532
Wrap160139822022-11-20 21:42:47630 days ago1668980567IN
0x33827D2d...D417cbBA0
0.72049087 ETH0.003413411.81081266
Unwrap158544652022-10-29 14:59:59652 days ago1667055599IN
0x33827D2d...D417cbBA0
0 ETH0.0010462810.58608664
Unwrap156200652022-09-26 20:57:11685 days ago1664225831IN
0x33827D2d...D417cbBA0
0 ETH0.0014286814.4551284
Wrap156198102022-09-26 20:05:47685 days ago1664222747IN
0x33827D2d...D417cbBA0
7.44389877 ETH0.0060015220.87327066
Unwrap156196222022-09-26 19:27:47685 days ago1664220467IN
0x33827D2d...D417cbBA0
0 ETH0.0013220713.37644526
Unwrap155835842022-09-21 18:39:35690 days ago1663785575IN
0x33827D2d...D417cbBA0
0 ETH0.0048389632.61265535
Wrap155788892022-09-21 2:34:23691 days ago1663727663IN
0x33827D2d...D417cbBA0
0.0009628 ETH0.0032770511
Wrap154454142022-08-31 7:58:06711 days ago1661932686IN
0x33827D2d...D417cbBA0
1.0987425 ETH0.0034961811.735567
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
182346702023-09-28 13:57:11318 days ago1695909431
0x33827D2d...D417cbBA0
0.1 ETH
182346702023-09-28 13:57:11318 days ago1695909431
0x33827D2d...D417cbBA0
0.1 ETH
182346632023-09-28 13:55:47318 days ago1695909347
0x33827D2d...D417cbBA0
0.10697865 ETH
174996652023-06-17 12:55:59421 days ago1687006559
0x33827D2d...D417cbBA0
0.1 ETH
174996652023-06-17 12:55:59421 days ago1687006559
0x33827D2d...D417cbBA0
0.1 ETH
164312092023-01-18 4:10:11572 days ago1674015011
0x33827D2d...D417cbBA0
0.021 ETH
164312092023-01-18 4:10:11572 days ago1674015011
0x33827D2d...D417cbBA0
0.021 ETH
163713672023-01-09 19:34:59580 days ago1673292899
0x33827D2d...D417cbBA0
0.02246551 ETH
163711312023-01-09 18:47:11580 days ago1673290031
0x33827D2d...D417cbBA0
0.021 ETH
163711312023-01-09 18:47:11580 days ago1673290031
0x33827D2d...D417cbBA0
0.021 ETH
163609452023-01-08 8:41:47581 days ago1673167307
0x33827D2d...D417cbBA0
0.021 ETH
163609452023-01-08 8:41:47581 days ago1673167307
0x33827D2d...D417cbBA0
0.021 ETH
163312872023-01-04 5:19:23586 days ago1672809563
0x33827D2d...D417cbBA0
0.02246551 ETH
163312622023-01-04 5:14:23586 days ago1672809263
0x33827D2d...D417cbBA0
0.021 ETH
163312622023-01-04 5:14:23586 days ago1672809263
0x33827D2d...D417cbBA0
0.021 ETH
163215462023-01-02 20:42:11587 days ago1672692131
0x33827D2d...D417cbBA0
0.6 ETH
163215462023-01-02 20:42:11587 days ago1672692131
0x33827D2d...D417cbBA0
0.6 ETH
163187152023-01-02 11:13:23587 days ago1672658003
0x33827D2d...D417cbBA0
0.02246551 ETH
163098122023-01-01 5:25:35589 days ago1672550735
0x33827D2d...D417cbBA0
0.022 ETH
163098122023-01-01 5:25:35589 days ago1672550735
0x33827D2d...D417cbBA0
0.022 ETH
163070102022-12-31 20:03:35589 days ago1672517015
0x33827D2d...D417cbBA0
0.02246551 ETH
163064802022-12-31 18:17:11589 days ago1672510631
0x33827D2d...D417cbBA0
0.0235353 ETH
162035942022-12-17 9:42:59603 days ago1671270179
0x33827D2d...D417cbBA0
1 ETH
162035942022-12-17 9:42:59603 days ago1671270179
0x33827D2d...D417cbBA0
1 ETH
160173822022-11-21 9:05:59629 days ago1669021559
0x33827D2d...D417cbBA0
1.0697865 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WHETHv2

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion, GNU GPLv3 license
File 1 of 61 : WHETHv2.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

import "../WHAssetv2.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

/**
 * @author jmonteer
 * @title Whiteheart's Hedge Contract (WHETH)
 * @notice WHAsset implementation. Hedge contract: Wraps an amount of the underlying asset with an ATM put option (or other protection instrument)
 */
contract WHETHv2 is WHAssetv2 {
    using SafeERC20 for IERC20;
    using SafeMath for uint;

    address public WETH;

    constructor(
            IUniswapV2Router02 _swapRouter,
            IToken _stablecoin,
            AggregatorV3Interface _priceProvider,
            IWhiteUSDCPool _pool,
            IWhiteOptionsPricer _whiteOptionsPricer
    ) public WHAssetv2(_swapRouter, _stablecoin, IToken(_swapRouter.WETH()), _priceProvider, _pool, _whiteOptionsPricer, "Whiteheart Hedged ETH", "WHETH") {
      connectRouter(_swapRouter);
      IERC20(_stablecoin).safeApprove(address(_pool), type(uint256).max);
    }

    receive() payable external {}

    function connectRouter(IUniswapV2Router02 _swapRouter) public onlyOwner {
      WETH = _swapRouter.WETH();
      IERC20(WETH).safeApprove(address(_swapRouter), type(uint256).max);
    }

    /**
     * @notice function to be called by the router after a swap has been completed
     * @param total principal + hedge cost added amount
     * @param protectionPeriod seconds of protection
     * @param to recipient of Hedge Contract (onBehalfOf)
     * @param mintToken whether to mintToken or not
     * @return newTokenId new hedge contract id
     */
    function wrapAfterSwap(uint total, uint protectionPeriod, address to, bool mintToken, uint minUSDCPremium) external onlyRouter override returns (uint newTokenId) {
        uint amountToWrap = whiteOptionsPricer.getAmountToWrapFromTotal(total, protectionPeriod);
        newTokenId = _wrap(amountToWrap, protectionPeriod, to, false, mintToken, minUSDCPremium);
    }

    /**
     * @notice internal function that supports the receival of principal+hedge cost to be sent
     * @param from address sender
     * @param amount principal to receive
     * @param toUsdc hedgeCost
     */
    function _receiveAsset(address from, uint amount, uint toUsdc) internal override {
        uint received = msg.value;
        require(received >= amount.add(toUsdc), "!wrong value");
        if(received > amount.add(toUsdc)) payable(from).transfer(received.sub(amount.add(toUsdc)));
        IWETH(WETH).deposit{value:amount.add(toUsdc)}();
    }

    /**
     * @notice internal function of support that sends the principal that was protected
     * @param to receiver of principal
     * @param amount principal that has been protected
     */
    function _sendTotal(address payable to, uint amount) internal override {
        IWETH(WETH).withdraw(amount);
        to.transfer(amount);
    }
}

File 2 of 61 : IToken.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

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

interface IToken is IERC20{
    function decimals() external view returns (uint);
}

File 3 of 61 : 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 4 of 61 : WHAssetv2.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;


import "./Interfaces/IWETH.sol";
import "./Interfaces/IToken.sol";
import "./Interfaces/IWHAsset.sol";
import "./Interfaces/IWhiteUSDCPool.sol";
import "./Interfaces/IWhiteOptionsPricer.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

interface IKeep3r {
    function getRequestedPayment() external view returns (uint);
}

/**
 * @author jmonteer
 * @title Whiteheart's Hedge Contract
 * @notice WHAsset implementation. Hedge contract: Wraps an amount of the underlying asset with an ATM put option (or other protection instrument)
 */
abstract contract WHAssetv2 is ERC721, IWHAssetv2, Ownable {
    using Counters for Counters.Counter;
    using SafeMath for uint;
    using SafeMath for uint48;

    uint256 internal constant PRICE_DECIMALS = 1e8;
    uint256 public optionCollateralizationRatio = 100;
    address[] public underlyingToStableSwapPath;

    Counters.Counter private _tokenIds;
    IWhiteUSDCPool public immutable pool;
    IWhiteOptionsPricer public whiteOptionsPricer;
    IUniswapV2Router02 public swapRouter;
    AggregatorV3Interface public immutable priceProvider;

    address public keep3r;

    uint internal immutable DECIMALS;
    IERC20 public immutable stablecoin;

    mapping(address => bool) public routers;
    mapping(uint => Underlying) public underlying;
    mapping(address => bool) public autoUnwrapDisabled;

    constructor(
            IUniswapV2Router02 _swapRouter,
            IToken _stablecoin,
            IToken _token,
            AggregatorV3Interface _priceProvider,
            IWhiteUSDCPool _pool,
            IWhiteOptionsPricer _whiteOptionsPricer,
            string memory _name,
            string memory _symbol) public ERC721(_name, _symbol)
    {
        uint _DECIMALS = 10 ** (uint(IToken(_token).decimals()).sub(uint(IToken(_stablecoin).decimals()))) * PRICE_DECIMALS;
        DECIMALS = _DECIMALS;

        address[] memory _underlyingToStableSwapPath = new address[](2);
        _underlyingToStableSwapPath[0] = address(_token);
        _underlyingToStableSwapPath[1] = address(_stablecoin);

        underlyingToStableSwapPath = _underlyingToStableSwapPath;

        setSwapRouter(_swapRouter);
        whiteOptionsPricer = _whiteOptionsPricer;
        priceProvider = _priceProvider;
        stablecoin = _stablecoin;
        pool = _pool;
    }

    modifier onlyTokenOwner(uint tokenId) {
        require(underlying[tokenId].owner == msg.sender, "msg.sender != owner");
        _;
    }

    modifier onlyRouter {
        require(routers[msg.sender], "!not allowed");
        _;
    }


    function setSwapRouter(IUniswapV2Router02 newRouter) public onlyOwner {
      swapRouter = newRouter;
      setRouter(address(newRouter), true);
    }

    /**
     * @notice Sets swap router to swap underlying into USDC to pay for the protection
     * @param _router address of router contract
     * @param allowed bool telling if this address is an authorised router
     */
    function setRouter(address _router, bool allowed) public onlyOwner {
        routers[_router] = allowed;
    }

    /**
     * @notice Sets the Keep3r contract address. Keep3r is in charge of auto unwrapping a HedgeContract when it is in owner's best interest
     * @param newKeep3r address of Keep3r contract
     */
    function setKeep3r(address newKeep3r) external onlyOwner {
        keep3r = newKeep3r;
    }

    /**
     * @notice Returns cost of certain protection
     * @param amount amount to be protected
     * @param period duration of quoted protection
     * @return cost of protection
     */
    function wrapCost(uint amount, uint period) view external returns (uint cost){
        uint strike = _currentPrice();
        return whiteOptionsPricer.getOptionPrice(period, amount, strike);
    }

    /**
     * @notice Wraps an amount of principal into a HedgeContract
     * @param amount amount to be protected (principal)
     * @param period duration of protection
     * @param to recipient of WHAsset (onBehalfOf)
     * @param _mintToken boolean telling the function to mint a new ERC721 token representing this Hedge Contract or not
     * @param minPremiumUSDC param to protect against DEX slippage and front-running txs
     * @return newTokenId ID of new HedgeContract and its token if minted
     */
    function wrap(uint128 amount, uint period, address to, bool _mintToken, uint minPremiumUSDC) payable public override virtual returns (uint newTokenId) {
        newTokenId = _wrap(uint(amount), period, to, true, _mintToken, minPremiumUSDC);
    }

    /**
     * @notice Mints a token of an existing hedge contract
     * @param tokenId hedge contract id to mint a token for
     */
    function mintToken(uint tokenId) external {
        require(underlying[tokenId].active && underlying[tokenId].owner == msg.sender, "!not-tokenizable");
        _mint(msg.sender, tokenId);
    }

    /**
     * @notice Unwraps an active or inactive Hedge Contract, receiving back the principal amount
     * @param tokenId hedge contract id to be unwrapped
     */
    function unwrap(uint tokenId) external override onlyTokenOwner(tokenId) {
        _unwrap(tokenId);
    }

    /**
     * @notice Returns a list of autounwrappable hedge contracts. To be called off-chain
     * @return list of autounwrappable hedge contracts
     */
    function listAutoUnwrapable() external view returns (uint[] memory list) {
        uint counter = 0;
        for(uint i = 0; i <= _tokenIds.current() ; i++) {
            if(isAutoUnwrapable(i)) counter++;
        }
        list = new uint[](counter);
        uint index = 0;
        for(uint i = 0; i <= _tokenIds.current() ; i++) {
            if(isAutoUnwrapable(i)){
                list[index] = i;
                index++;
            }
            if(index>=counter) return list;
        }
    }

    /**
     * @notice Unwraps a list of autoUnwrappable hedge contracts in exchange for a fee (if called by Keep3r)
     * @param list list of hedge contracts to be unwrapped
     * @param rewardRecipient address of the recipient of the fees in exchange of autoExercise
     * @return reward that keep3r will receive
     */
    function autoUnwrapAll(uint[] calldata list, address rewardRecipient) external override returns (uint reward) {
        for(uint i = 0; i < list.length; i++){
            if(isAutoUnwrapable(list[i])) {
                _unwrap(list[i]);
            }
        }

        if(address(msg.sender).isContract() && msg.sender == keep3r) reward = pool.payKeep3r(rewardRecipient);
    }

    /**
     * @notice Unwraps a autoUnwrappable hedge contracts in exchange for a fee (if called by Keep3r)
     * @param tokenId HedgeContract to be unwrapped
     * @param rewardRecipient address of the recipient of the fees in exchange of autoExercise
     * @return reward that keep3r will receive
     */
    function autoUnwrap(uint tokenId, address rewardRecipient) public override returns (uint reward) {
        require(isAutoUnwrapable(tokenId), "!not-unwrapable");
        _unwrap(tokenId);

        if(address(msg.sender).isContract() && msg.sender == keep3r) reward = pool.payKeep3r(rewardRecipient);
    }

    /**
     * @notice Disables (or enables) autounwrapping for caller. If set to true, keep3rs wont be able to unwrap this user's WHAssets
     * @param disabled true to disable autounwrapping, false to re-enable autounwrapping
     */
    function setAutoUnwrapDisabled(bool disabled) external {
        autoUnwrapDisabled[msg.sender] = disabled;
    }

    /**
     * @notice Answers the question: is this hedge contract Auto unwrappable?
     * @param tokenId HedgeContract to be unwrapped
     * @return answer to the question: is this hedge contract Auto unwrappable
     */
    function isAutoUnwrapable(uint tokenId) public view returns (bool) {
        Underlying memory _underlying = underlying[tokenId];
        if(autoUnwrapDisabled[_underlying.owner]) return false;
        if(!_underlying.active) return false;

        bool ITM = false;
        uint currentPrice = _currentPrice();

        ITM = currentPrice < _underlying.strike;

        // if option is In The Money and the option is going to expire in the next minutes
        if (ITM && ((_underlying.expiration.sub(30 minutes) <= block.timestamp) && (_underlying.expiration >= block.timestamp))) {
            return true;
        }

        return false;
    }

    /**
     * @notice Internal function that wraps a hedge contract
     * @param amount amount
     * @param period period
     * @param to address that will receive the hedgecontract
     * @param receiveAsset whether or not require asset from sender
     * @param _mintToken whether or not to mint a token representing the hedge contract
     * @return newTokenId new token id
     */
    function _wrap(uint amount, uint period, address to, bool receiveAsset, bool _mintToken, uint minPremiumUSDC) internal returns (uint newTokenId){
        // new tokenId
        _tokenIds.increment();
        newTokenId = _tokenIds.current();

        // get cost of option
        uint strike = _currentPrice();

        uint total = whiteOptionsPricer.getOptionPrice(period, amount, strike);

        // receive asset + cost of hedge
        if(receiveAsset) _receiveAsset(msg.sender, amount, total);
        // buy option
        _createHedge(newTokenId, total, period, amount, strike, to, minPremiumUSDC);

        // mint ERC721 token
        if(_mintToken) _mint(to, newTokenId);

        emit Wrap(to, uint32(newTokenId), uint88(total), uint88(amount), uint48(strike), uint32(block.timestamp+period));
    }

    /**
     * @notice Internal function that creates the option protecting it
     * @param tokenId hedge contract id
     * @param totalFee total fee to be paid for the option
     * @param period seconds of duration of protection
     * @param amount amount to be protected
     * @param strike price at which the asset is protected
     * @param owner address of the owner of the hedge contract
     */
    function _createHedge(uint tokenId, uint totalFee, uint period, uint amount, uint strike, address owner, uint minPremiumUSDC) internal {
        uint collateral = amount.mul(strike).mul(optionCollateralizationRatio).div(100).div(DECIMALS);

        underlying[tokenId] = Underlying(
            bool(true),
            address(owner),
            uint88(amount),
            uint48(block.timestamp + period),
            uint48(strike)
        );

        uint[] memory amounts = swapRouter.swapExactTokensForTokens(
            totalFee,
            minPremiumUSDC,
            underlyingToStableSwapPath,
            address(pool),
            block.timestamp
        );
        uint totalStablecoin = amounts[amounts.length - 1];

        pool.lock(tokenId, collateral, totalStablecoin);
    }

    /**
     * @notice Exercises an option. only callable when unwrapping a hedge contract
     * @param tokenId id of hedge contract
     * @param owner owner of contract
     * @return optionProfit profit of exercised option
     * @return amount principal amount that was protected by it
     */
    function _exercise(uint tokenId, address owner) internal returns (uint optionProfit, uint amount, uint underlyingCurrentPrice) {
        Underlying storage _underlying = underlying[tokenId];
        amount = _underlying.amount;
        underlyingCurrentPrice = _currentPrice();

        if(_underlying.expiration < block.timestamp){
            pool.unlock(tokenId);
            optionProfit = 0;
        } else {
            (optionProfit) = _payProfit(owner, tokenId, _underlying.strike, _underlying.amount, underlyingCurrentPrice);
        }
    }

    /**
     * @notice Pays profit (if any) of underlying option
     * @param owner address of owner
     * @param tokenId tokenId
     * @param strike price at which the asset was protected
     * @param amount principal amount that was protected
     * @return profit profit of exercised option
     */
    function _payProfit(address owner, uint tokenId, uint strike, uint amount, uint underlyingCurrentPrice)
        internal
        returns (uint profit)
    {
        if(strike <= underlyingCurrentPrice){
            profit = 0;
        } else {
            profit = strike.sub(underlyingCurrentPrice).mul(amount).div(DECIMALS);
        }

        address _keep3r = address(msg.sender).isContract() ? keep3r : address(0);
        uint payKeep3r = _keep3r != address(0) ? IKeep3r(_keep3r).getRequestedPayment() : 0;

        require(payKeep3r <= profit, "!keep3r-requested-too-much");

        pool.send(tokenId, payable(owner), profit, payKeep3r);
    }

    /**
     * @notice Unwraps hedge contract
     * @param tokenId tokenId
     * @return owner address of hedge contract address
     * @return optionProfit profit of exercised option
     */
    function _unwrap(uint tokenId) internal returns (address owner, uint optionProfit) {
        Underlying storage _underlying = underlying[tokenId];
        owner = _underlying.owner;

        require(owner != address(0), "!tokenId-does-not-exist");
        require(_underlying.active, "!tokenId-does-not-exist");

        // exercise option
        (uint profit, uint amount, uint underlyingCurrentPrice) = _exercise(tokenId, owner);

        // burn token
        if(_exists(tokenId)) _burn(tokenId);
        _underlying.active = false;

        _sendTotal(payable(owner), amount);
        optionProfit = profit;

        emit Unwrap(owner, uint32(tokenId), uint128(underlyingCurrentPrice), uint128(profit));
    }

    /**
     * @notice changes hedge contract owner using HedgeContract underlying
     * @param from sender
     * @param to recipient
     * @param tokenId tokenId
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override {
        if(from != address(0) && to != address(0)){
            require(underlying[tokenId].owner == from, "!sth-went-wrong");
            underlying[tokenId].owner = to;
        }
    }

    function _receiveAsset(address from, uint amount, uint hedgeCost) internal virtual;

    function _sendTotal(address payable from, uint amount) internal virtual;

    function _currentPrice() internal view returns (uint) {
        (
            ,
            int price,
            ,
            ,

        ) = priceProvider.latestRoundData();

        return uint(price);
    }
}

File 5 of 61 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

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

interface IWETH is IERC20 {
    function deposit() payable external;
    function withdraw(uint wad) external;
}

File 6 of 61 : IWHAsset.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

interface IWHAssetv2 {
    event Wrap(address indexed account, uint32 indexed tokenId, uint88 cost, uint88 amount, uint48 strike, uint32 expiration);
    event Unwrap(address indexed account, uint32 indexed tokenId, uint128 closePrice, uint128 optionProfit);

    struct Underlying {
        bool active;
        address owner;
        uint88 amount;
        uint48 expiration;
        uint48 strike;
    }

    function wrap(uint128 amount, uint period, address to, bool mintToken, uint minUSDCPremium) payable external returns (uint newTokenId);
    function unwrap(uint tokenId) external;
    function autoUnwrap(uint tokenId, address rewardRecipient) external returns (uint);
    function autoUnwrapAll(uint[] calldata tokenIds, address rewardRecipient) external returns (uint);
    function wrapAfterSwap(uint total, uint protectionPeriod, address to, bool mintToken, uint minUSDCPremium) external returns (uint newTokenId);
}

File 7 of 61 : IWhiteUSDCPool.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

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";

interface ILiquidityPool {
    struct LockedLiquidity { uint120 amount; uint120 premium; bool locked; }

    event Profit(uint indexed id, uint amount);
    event Loss(uint indexed id, uint amount);
    event Provide(address indexed account, uint256 amount, uint256 writeAmount);
    event Withdraw(address indexed account, uint256 amount, uint256 writeAmount);

    function unlock(uint256 id) external;
    function setLockupPeriod(uint value) external;
    function deleteLockedLiquidity(uint id) external;
    function totalBalance() external view returns (uint256 amount);
    function setAllowedWHAsset(address _whAsset, bool approved) external;
    function send(uint256 id, address payable account, uint256 amount, uint payKeep3r) external;
}


interface IWhiteUSDCPool is ILiquidityPool {
    function lock(uint id, uint256 amountToLock, uint256 premium) external;
    function token() external view returns (IERC20);
    function payKeep3r(address keep3r) external returns (uint amount);
}

File 8 of 61 : IWhiteOptionsPricer.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

interface IWhiteOptionsPricer {
    function getOptionPrice(
        uint256 period,
        uint256 amount,
        uint256 strike
    )
        external
        view
        returns (uint256 total);

    function getAmountToWrapFromTotal(uint total, uint period) external view returns (uint);

}

File 9 of 61 : 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 10 of 61 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

File 11 of 61 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../../utils/Context.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./IERC721Receiver.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Optional mapping for token URIs
    mapping (uint256 => string) private _tokenURIs;

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) public {
        _name = name_;
        _symbol = symbol_;

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];
        string memory base = baseURI();

        // If there is no base URI, return the token URI.
        if (bytes(base).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(base, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(base, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view virtual returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || ERC721.isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _tokenOwners.contains(tokenId);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || ERC721.isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId); // internal owner

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(tokenId);

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); // internal owner
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId); // internal owner
    }

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

File 12 of 61 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

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

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

File 13 of 61 : AggregatorV3Interface.sol
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 14 of 61 : 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 15 of 61 : 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 16 of 61 : 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 17 of 61 : 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 18 of 61 : 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 19 of 61 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

File 20 of 61 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

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

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 21 of 61 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 22 of 61 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns (bytes4);
}

File 23 of 61 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () internal {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 24 of 61 : 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 25 of 61 : EnumerableMap.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

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

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry 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.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

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

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

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

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     */
    function _tryGet(Map storage map, bytes32 key) private view returns (bool, bytes32) {
        uint256 keyIndex = map._indexes[key];
        if (keyIndex == 0) return (false, 0); // Equivalent to contains(map, key)
        return (true, map._entries[keyIndex - 1]._value); // All indexes are 1-based
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, "EnumerableMap: nonexistent key"); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {_tryGet}.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

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

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

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

   /**
    * @dev Returns the element 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint160(uint256(value))));
    }

    /**
     * @dev Tries to returns the value associated with `key`.  O(1).
     * Does not revert if `key` is not in the map.
     *
     * _Available since v3.4._
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = _tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint160(uint256(_get(map._inner, bytes32(key), errorMessage))));
    }
}

File 26 of 61 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = bytes1(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

File 27 of 61 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 28 of 61 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

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

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

File 29 of 61 : WHERC20v2.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

import "../WHAssetv2.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

/**
 * @author jmonteer
 * @title Whiteheart's Hedge Contract (Any ERC20)
 * @notice WHAsset implementation. Hedge contract: Wraps an amount of the underlying asset with an ATM put option (or other protection instrument)
 */
contract WHERC20v2 is WHAssetv2 {
    using SafeERC20 for IERC20;
    using SafeMath for uint;

    IERC20 public immutable token;

    constructor(
            IUniswapV2Router02 _swapRouter,
            IToken _stablecoin,
            IToken _token,
            AggregatorV3Interface _priceProvider,
            IWhiteUSDCPool _pool,
            IWhiteOptionsPricer _whiteOptionsPricer,
            string memory _name,
            string memory _symbol
    ) public WHAssetv2(_swapRouter, _stablecoin, _token, _priceProvider, _pool, _whiteOptionsPricer, _name, _symbol) {
        token = _token;

        IERC20(_stablecoin).safeApprove(address(_pool), type(uint256).max);
        IERC20(_token).safeApprove(address(_swapRouter), type(uint256).max);
    }

    function wrap(uint128 amount, uint period, address to, bool _mintToken, uint minPremiumUSDC) payable public override returns (uint newTokenId) {
        require(msg.value == 0, "!eth not accepted");
        newTokenId = super.wrap(amount, period, to, _mintToken, minPremiumUSDC);
    }

    /**
     * @notice function to be called by the router after a swap has been completed
     * @param total principal + hedge cost added amount
     * @param protectionPeriod seconds of protection
     * @param to recipient of Hedge Contract (onBehalfOf)
     * @param mintToken whether to mintToken or not
     * @return newTokenId new hedge contract id
     */
    function wrapAfterSwap(uint total, uint protectionPeriod, address to, bool mintToken, uint minUSDCPremium) external onlyRouter override returns (uint newTokenId) {
        uint amountToWrap = whiteOptionsPricer.getAmountToWrapFromTotal(total, protectionPeriod);
        newTokenId = _wrap(amountToWrap, protectionPeriod, to, false, mintToken, minUSDCPremium);
    }

    /**
     * @notice internal function that supports the receival of principal+hedge cost to be sent
     * @param from address sender
     * @param amount principal to receive
     * @param toUsdc hedgeCost
     */
    function _receiveAsset(address from, uint amount, uint toUsdc) internal override {
        token.safeTransferFrom(from, address(this), amount.add(toUsdc));
    }

    /**
     * @notice internal function of support that sends the principal that was protected
     * @param to receiver of principal
     * @param amount principal that has been protected
     */
    function _sendTotal(address payable to, uint amount) internal override {
        token.safeTransfer(to, amount);
    }
}

File 30 of 61 : WhiteStaking.sol
/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2020 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import "../Interfaces/IWhiteStakingERC20.sol";

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

pragma solidity 0.6.12;


abstract
contract WhiteStaking is ERC20, IWhiteStaking {
    using SafeERC20 for IERC20;
    using SafeMath for uint;

    IERC20 public immutable WHITE;
    uint internal constant ACCURACY = 1e30;
    address payable public immutable FALLBACK_RECIPIENT;

    uint public totalProfit = 0;
    mapping(address => uint) internal lastProfit;
    mapping(address => uint) internal savedProfit;

    uint256 public lockupPeriod = 1 days;
    mapping(address => uint256) public lastStakeTimestamp;
    mapping(address => bool) public _revertTransfersInLockUpPeriod;

    constructor(ERC20 _token, string memory name, string memory short)
        public ERC20(name, short)
    {
        WHITE = _token;
        FALLBACK_RECIPIENT = msg.sender;
    }

    function claimProfit() external override returns (uint profit) {
        profit = saveProfit(msg.sender);
        require(profit > 0, "Zero profit");
        savedProfit[msg.sender] = 0;
        _transferProfit(profit);
        emit Claim(msg.sender, profit);
    }

    function deposit(uint amount) external override {
       lastStakeTimestamp[msg.sender] = block.timestamp;
        require(amount > 0, "!amount");
        WHITE.safeTransferFrom(msg.sender, address(this), amount);

        _mint(msg.sender, amount); 
    }

    function withdraw(uint amount) external lockupFree override {
        _burn(msg.sender, amount);

        WHITE.safeTransfer(msg.sender, amount);
    }

    /**
     * @notice Used for ...
     */
    function revertTransfersInLockUpPeriod(bool value) external {
        _revertTransfersInLockUpPeriod[msg.sender] = value;
    }

    function profitOf(address account) external view override returns (uint) {
        return savedProfit[account].add(getUnsaved(account));
    }

    function getUnsaved(address account) internal view returns (uint profit) {
        return totalProfit.sub(lastProfit[account]).mul(balanceOf(account)).div(ACCURACY);
    }

    function saveProfit(address account) internal returns (uint profit) {
        uint unsaved = getUnsaved(account);
        lastProfit[account] = totalProfit;
        profit = savedProfit[account].add(unsaved);
        savedProfit[account] = profit;
    }

    function _beforeTokenTransfer(address from, address to, uint256) internal override {
        if (from != address(0)) saveProfit(from);
        if (to != address(0)) saveProfit(to);
        if (
            lastStakeTimestamp[from].add(lockupPeriod) > block.timestamp &&
            lastStakeTimestamp[from] > lastStakeTimestamp[to]
        ) {
            require(
                !_revertTransfersInLockUpPeriod[to],
                "the recipient does not accept blocked funds"
            );
            lastStakeTimestamp[to] = lastStakeTimestamp[from];
        }
    }

    function _transferProfit(uint amount) internal virtual;

    modifier lockupFree {
        require(
            lastStakeTimestamp[msg.sender].add(lockupPeriod) <= block.timestamp,
            "Action suspended due to lockup"
        );
        _;
    }
}

File 31 of 61 : IWhiteStakingERC20.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

interface IWhiteStaking {    
    event Claim(address indexed acount, uint amount);
    event Profit(uint amount);

    function claimProfit() external returns (uint profit);
    function deposit(uint amount) external;
    function withdraw(uint amount) external;
    function profitOf(address account) external view returns (uint);
}

interface IWhiteStakingERC20 {
    function sendProfit(uint amount) external;
}

File 32 of 61 : WhiteStakingUSDC.sol
/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Hegic
 * Copyright (C) 2020 Hegic Protocol
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import "./WhiteStaking.sol";
pragma solidity 0.6.12;

contract WhiteStakingUSDC is WhiteStaking, IWhiteStakingERC20 {
    using SafeERC20 for IERC20;
    using SafeMath for uint;

    IERC20 public immutable USDC;

    constructor(ERC20 _token, ERC20 usdc) public 
        WhiteStaking(_token, "Staked WHITE", "sWHITE") {
        USDC = usdc;
    }

    function sendProfit(uint amount) external override {
        uint _totalSupply = totalSupply();
        if (_totalSupply > 0) {
            totalProfit += amount.mul(ACCURACY) / _totalSupply;
            USDC.safeTransferFrom(msg.sender, address(this), amount);
            emit Profit(amount);
        } else {
            USDC.safeTransferFrom(msg.sender, FALLBACK_RECIPIENT, amount);
        }
    }

    function _transferProfit(uint amount) internal override {
        USDC.safeTransfer(msg.sender, amount);
    }
}

File 33 of 61 : MockTokens.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.6.12;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

contract FakeWBTC is ERC20("FakeWBTC", "FAKE") {
    constructor() public {
        _setupDecimals(8);
    }

    function mintTo(address account, uint256 amount) public {
        _mint(account, amount);
    }

    function mint(uint256 amount) public {
        _mint(msg.sender, amount);
    }
}

contract FakeWHITE is ERC20("FakeWHITE", "FAKEWHITE") {

    function mintTo(address account, uint256 amount) public {
        _mint(account, amount);
    }

    function mint(uint256 amount) public {
        _mint(msg.sender, amount);
    }
}

contract FakeWETH is ERC20("FakeWETH", "FAKETH") {
    receive() external payable {}
    function mintTo(address account, uint256 amount) public {
        _mint(account, amount);
    }

    function mint(uint256 amount) public {
        _mint(msg.sender, amount);
    }

    function deposit() external payable {
        _mint(msg.sender, msg.value);
    }

    function withdraw(uint wad) external {
        payable(msg.sender).transfer(wad);
        _burn(msg.sender, wad);
    }
}

contract FakeUSDC is ERC20("FakeUSDC", "FAKEU") {
    using SafeERC20 for ERC20;
    constructor() public {
        _setupDecimals(6);
    }
    function mintTo(address account, uint256 amount) public {
        _mint(account, amount);
    }

    function mint(uint256 amount) public {
        _mint(msg.sender, amount);
    }
}

File 34 of 61 : CollectableDust.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "../Interfaces/Keep3r/ICollectableDust.sol";

abstract contract CollectableDust is ICollectableDust {
    using EnumerableSet for EnumerableSet.AddressSet;

    address public constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    EnumerableSet.AddressSet internal protocolTokens;

    constructor() public {}

    function _addProtocolToken(address _token) internal {
        require(!protocolTokens.contains(_token), "collectable-dust::token-is-part-of-the-protocol");
        protocolTokens.add(_token);
    }

    function _removeProtocolToken(address _token) internal {
        require(protocolTokens.contains(_token), "collectable-dust::token-not-part-of-the-protocol");
        protocolTokens.remove(_token);
    }

    function _sendDust(
        address _to,
        address _token,
        uint256 _amount
    ) internal {
        require(_to != address(0), "collectable-dust::cant-send-dust-to-zero-address");
        require(!protocolTokens.contains(_token), "collectable-dust::token-is-part-of-the-protocol");
        if (_token == ETH_ADDRESS) {
            payable(_to).transfer(_amount);
        } else {
            IERC20(_token).transfer(_to, _amount);
        }
        emit DustSent(_to, _token, _amount);
    }
}

File 35 of 61 : ICollectableDust.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;

interface ICollectableDust {
    event DustSent(address _to, address token, uint256 amount);

    function sendDust(
        address _to,
        address _token,
        uint256 _amount
    ) external;
}

File 36 of 61 : WhiteKeep3r.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

import "./Governable.sol";
import "./CollectableDust.sol";
import "../Interfaces/IWHAsset.sol";
import "../Interfaces/Keep3r/IKeep3rV1.sol";
import "../Interfaces/Keep3r/IChainLinkFeed.sol";
import "../Interfaces/Keep3r/IKeep3rV1Helper.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";


contract WhiteKeep3r is Governable, CollectableDust {
    using Address for address;
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    IKeep3rV1 public keep3r = IKeep3rV1(0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44);
    IChainLinkFeed public immutable ETHUSD = IChainLinkFeed(0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419);
    IChainLinkFeed public constant FASTGAS = IChainLinkFeed(0x169E633A2D1E6c10dD91238Ba11c4A708dfEF37C);
    
    uint public constant gasUsed = 100_000;
    address public job;

    IERC20 public immutable token; 

    constructor(IERC20 _token) public Governable(msg.sender) CollectableDust() {
        token = _token;
    }

    function unwrapAll(address whAsset, uint[] calldata tokenIds) external paysKeeper(tokenIds) {
        IWHAssetv2(whAsset).autoUnwrapAll(tokenIds, address(this));
    }

    function refillCredit() external onlyGovernor {
        uint balance = token.balanceOf(address(this));
        keep3r.addCredit(address(token), job, balance);
    }

    function _isKeeper() internal {
        require(tx.origin == msg.sender, "keep3r::isKeeper:keeper-is-a-smart-contract");
        require(keep3r.isKeeper(msg.sender), "keep3r::isKeeper:keeper-is-not-registered");
    }

    function getRequestedPayment() public view returns(uint){
        uint256 gasPrice = Math.min(tx.gasprice, uint256(FASTGAS.latestAnswer()));

        return gasPrice.mul(gasUsed).mul(uint(ETHUSD.latestAnswer())).div(1e20);
    }

    function getRequestedPaymentETH() public view returns(uint){
        uint256 gasPrice = Math.min(tx.gasprice, uint256(FASTGAS.latestAnswer()));

        return gasPrice.mul(gasUsed);
    }

    function setJob(address newJob) external onlyGovernor {
        job = newJob;
    }

    modifier paysKeeper(uint[] calldata tokenIds) {
        _isKeeper();
        
        _; // function executed by keep3r

        uint paidReward = tokenIds.length.mul(getRequestedPayment());

        keep3r.receipt(address(token), msg.sender, paidReward);
    }

    function setKeep3r(address _keep3r) external onlyGovernor {
        token.safeApprove(address(keep3r), 0);
        keep3r = IKeep3rV1(_keep3r);
        token.safeApprove(address(_keep3r), type(uint256).max);
    }

    // Governable
    function setPendingGovernor(address _pendingGovernor) external override onlyGovernor {
        _setPendingGovernor(_pendingGovernor);
    }

    function acceptGovernor() external override onlyPendingGovernor {
        _acceptGovernor();
    }

    // Collectable Dust
    function sendDust(
        address _to,
        address _token,
        uint256 _amount
    ) external override onlyGovernor {
        _sendDust(_to, _token, _amount);
    }

}

File 37 of 61 : Governable.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.6.12;

import "../Interfaces/Keep3r/IGovernable.sol";

abstract contract Governable is IGovernable {
    address public governor;
    address public pendingGovernor;

    constructor(address _governor) public {
        require(_governor != address(0), "governable::governor-should-not-be-zero-address");
        governor = _governor;
    }

    function _setPendingGovernor(address _pendingGovernor) internal {
        require(_pendingGovernor != address(0), "governable::pending-governor-should-not-be-zero-address");
        pendingGovernor = _pendingGovernor;
        emit PendingGovernorSet(_pendingGovernor);
    }

    function _acceptGovernor() internal {
        governor = pendingGovernor;
        pendingGovernor = address(0);
        emit GovernorAccepted();
    }

    modifier onlyGovernor {
        require(msg.sender == governor, "governable::only-governor");
        _;
    }

    modifier onlyPendingGovernor {
        require(msg.sender == pendingGovernor, "governable::only-pending-governor");
        _;
    }
}

File 38 of 61 : IKeep3rV1.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;

interface IKeep3rV1 {
    function KPRH() external returns (address);

    function name() external returns (string memory);

    function isKeeper(address) external returns (bool);

    function worked(address keeper) external;

    function workReceipt(address keeper, uint amount) external;

    function receiptETH(address keeper, uint256 amount) external;

    function receipt(address credit, address keeper, uint256 amount) external;

    function addKPRCredit(address job, uint256 amount) external;

    function addCredit(address asset, address job, uint256 amount) external;

    function addJob(address job) external;
}

File 39 of 61 : IChainLinkFeed.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity 0.6.12;

interface IChainLinkFeed {
    function latestAnswer() external view returns (int256);
}

File 40 of 61 : IKeep3rV1Helper.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;

interface IKeep3rV1Helper {
    function quote(uint256) external view returns (uint256);
}

File 41 of 61 : 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 42 of 61 : IGovernable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.12;

interface IGovernable {
    event PendingGovernorSet(address pendingGovernor);
    event GovernorAccepted();

    function setPendingGovernor(address _pendingGovernor) external;

    function acceptGovernor() external;
}

File 43 of 61 : WHSwapRouter.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

import "./Interfaces/IWETH.sol";
import "./Interfaces/IWHAsset.sol";
import "./Interfaces/IWHSwapRouter.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@sushiswap/core/contracts/uniswapv2/libraries/TransferHelper.sol";
import "@sushiswap/core/contracts/uniswapv2/libraries/UniswapV2Library.sol";

/**
 * @author jmonteer
 * @title Whiteheart's Swap+Wrap router using Uniswap-like DEX
 * @notice Contract performing a swap and sending the output to the corresponding WHAsset contract for it to be wrapped into a Hedge Contract
 */
contract WHSwapRouter is IWHSwapRouter, Ownable {
    address public immutable factory; 
    address public immutable WETH;

    // Maps the underlying asset to the corresponding Hedge Contracts
    mapping(address => address) public whAssets;
    
    /**
     * @notice Constructor
     * @param _factory DEX factory contract 
     * @param _WETH Ether ERC20's token address
     */
    constructor(address _factory, address _WETH) public {
        factory = _factory;
        WETH = _WETH;
    }

    /**
     * @notice Adds an entry to the underlyingAsset => WHAsset contract. It can be used to set the underlying asset to 0x0 address
     * @param token Asset address
     * @param whAsset WHAsset contract for the underlying asset
     */
    function setWHAsset(address token, address whAsset) external onlyOwner {
        whAssets[token] = whAsset;
    }

    /**
     * @notice Function used by WHAsset contracts to swap underlying assets into USDC, to buy options. Same function than "original" router's function
     * @param amountIn amount of the token being swap
     * @param amountOutMin minimum amount of the asset to be received from the swap
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     */
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'insufficient_output_amount');        

        TransferHelper.safeTransferFrom(
            path[0], msg.sender, UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]
        );
        _swap(amounts, path, to);
    }

    /**
     * @notice Custom function for swapExactTokensForTokens that wraps the output asset into a Hedge Contract (underlying asset + ATM put option)
     * @param amountIn amount of the token being swap
     * @param amountOutMin minimum amount of the asset to be received from the swap
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
     */
    function swapExactTokensForTokensAndWrap(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to, 
        uint deadline,
        uint protectionPeriod,
        bool mintToken,
        uint minUSDCPremium
    ) external virtual override ensure(deadline) returns (uint[] memory amounts, uint newTokenId){
        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'insufficient_output_amount');        
        
        {
            address[] calldata _path = path;
            TransferHelper.safeTransferFrom(
                _path[0], msg.sender, UniswapV2Library.pairFor(factory, _path[0], _path[1]), amounts[0]
            );
        }

        newTokenId = _swapAndWrap(path, amounts, protectionPeriod, to, mintToken, minUSDCPremium);
    }

    /**
     * @notice Custom function for swapTokensForExactTokens that wraps the output asset into a Hedge Contract (underlying asset + ATM put option)
     * @param amountOut exact amount of output asset expected
     * @param amountInMax maximum amount of tokens to be sent to the DEX
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
     */
    function swapTokensForExactTokensAndWrap(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline,
        uint protectionPeriod,
        bool mintToken,
        uint minUSDCPremium
    ) external virtual override ensure(deadline) returns (uint[] memory amounts, uint newTokenId) {
        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= amountInMax, 'excessive_input_amount');
        {
            address[] calldata _path = path;
            TransferHelper.safeTransferFrom(
                _path[0], msg.sender, UniswapV2Library.pairFor(factory, _path[0], _path[1]), amounts[0]
            );
        }
        newTokenId = _swapAndWrap(path, amounts, protectionPeriod, to, mintToken, minUSDCPremium);
    }

    /**
     * @notice Custom function for swapExactETHForTokens that wraps the output asset into a Hedge Contract (underlying asset + ATM put option)
     * @param amountOutMin minimum amount of the asset to be received from the swap
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
     */
    function swapExactETHForTokensAndWrap(uint amountOutMin, address[] calldata path, address to, uint deadline, uint protectionPeriod,
        bool mintToken, uint minUSDCPremium)
        external
        virtual
        payable
        override
        ensure(deadline)
        returns (uint[] memory amounts, uint newTokenId)
    {           
        address[] memory _path = path; // to avoid stack too deep
        amounts = UniswapV2Library.getAmountsOut(factory, msg.value, _path);
        require(amounts[amounts.length - 1] >= amountOutMin, 'insufficient_input_amount');

        IWETH(WETH).deposit{value: amounts[0]}();
        assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, _path[0], _path[1]), amounts[0]));   
        newTokenId = _swapAndWrap(path, amounts, protectionPeriod, to, mintToken, minUSDCPremium);

    }

    /**
     * @notice Custom function for swapETHForExactTokens that wraps the output asset into a Hedge Contract (underlying asset + ATM put option)
     * @param amountOut amount of the token being swap
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
     */
    function swapETHForExactTokensAndWrap(uint amountOut,
        address[] calldata path,
        address to,
        uint deadline,
        uint protectionPeriod,
        bool mintToken,
        uint minUSDCPremium
    )
        external
        virtual
        payable
        override
        ensure(deadline)
        returns (uint[] memory amounts, uint newTokenId)
    {
        address[] memory _path = path; // to avoid stack too deep
        require(_path[0] == WETH, 'invalid_path');
        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, _path);
        require(amounts[0] <= msg.value, 'excessive_input_amount');

        IWETH(WETH).deposit{value: amounts[0]}();
        {
            assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, _path[0], _path[1]), amounts[0]));
        }

        if(msg.value > amounts[0]) TransferHelper.safeTransferETH(msg.sender, msg.value - amounts[0]);
        newTokenId = _swapAndWrap(path, amounts, protectionPeriod, to, mintToken, minUSDCPremium);
    }

    /**
     * @notice Custom function for swapExactTokensForETH that wraps the output asset into a Hedge Contract (underlying asset + ATM put option)
     * @param amountIn amount of the token being swapped
     * @param amountOutMin minimum amount of the output asset to be received
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
     */
    function swapExactTokensForETHAndWrap(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline, uint protectionPeriod,
        bool mintToken, uint minUSDCPremium)
        external
        override
        ensure(deadline)
        returns(uint[] memory amounts, uint newTokenId) 
    {
        require(path[path.length - 1] == WETH, 'invalid_path');

        amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
        require(amounts[amounts.length - 1] >= amountOutMin, "insufficient_output_amount");
        {
            address[] calldata _path = path;
            TransferHelper.safeTransferFrom(
                _path[0], msg.sender, UniswapV2Library.pairFor(factory, _path[0], _path[1]), amounts[0]
            );
        }        
        newTokenId = _swapAndWrap(path, amounts, protectionPeriod, to, mintToken, minUSDCPremium);

    }

    /**
     * @notice Custom function for swapTokensForExactETH that wraps the output asset into a Hedge Contract (underlying asset + ATM put option)
     * @param amountOut amount of the output asset to be received
     * @param amountInMax maximum amount of input that user is willing to send to the contract to reach amountOut 
     * @param path ordered list of assets to be swap from, to
     * @param to recipient address of the output of the swap
     * @param deadline maximum timestamp to process the transaction
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
     */
    function swapTokensForExactETHAndWrap(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline, uint protectionPeriod,
        bool mintToken, uint minUSDCPremium)
        external
        override
        ensure(deadline)
        returns (uint[] memory amounts, uint newTokenId)
    {
        require(path[path.length - 1] == WETH, 'invalid_path');
        amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
        require(amounts[0] <= amountInMax, 'excessive_input_amount');
        {
            address[] calldata _path = path;
            TransferHelper.safeTransferFrom(
                _path[0], msg.sender, UniswapV2Library.pairFor(factory, _path[0], _path[1]), amounts[0]
            );
        } 
        newTokenId = _swapAndWrap(path, amounts, protectionPeriod, to, mintToken, minUSDCPremium);

    }

    /**
     * @notice Internal function to be called after all swap params have been calc'd. it performs a swap and sends output to corresponding WHAsset contract
     * @param path ordered list of assets to be swap from, to
     * @param amounts list of amounts to send/receive of each of path's asset
     * @param protectionPeriod amount of seconds during which the underlying amount is going to be protected
     * @param mintToken boolean that tells the WHAsset contract whether or not to mint an ERC721 token representing new Hedge Contract
    */
    function _swapAndWrap(address[] calldata path, uint[] memory amounts, uint protectionPeriod, address to, bool mintToken, uint minUSDCPremium) 
        internal
        returns (uint newTokenId)
    {
        address whAsset = whAssets[path[path.length - 1]];
        require(whAsset != address(0), 'whAsset_does_not_exist');
        _swap(amounts, path, whAsset);
        newTokenId = IWHAssetv2(whAsset).wrapAfterSwap(amounts[amounts.length - 1], protectionPeriod, to, mintToken, minUSDCPremium);
    }

    /**
     * @notice Internal function to be called for actually swapping the involved assets. requires the initial amount to have already been sent to the first pair
     * @param amounts list of amounts to send/receive of each of path's asset
     * @param path ordered list of assets to be swap from, to
     * @param _to recipient of swap's output
      */
    function _swap(uint[] memory amounts, address[] memory path, address _to) internal virtual {
        for(uint i; i < path.length - 1; i++) {
            (address input, address output) = (path[i], path[i + 1]);
            (address token0, )  = UniswapV2Library.sortTokens(input, output);
            uint amountOut = amounts[i + 1];
            (uint amount0Out, uint amount1Out) = input == token0 ? (uint(0), amountOut) : (amountOut, uint(0));
            address to = i < path.length - 2 ? UniswapV2Library.pairFor(factory, output, path[i + 2]) : _to;
            IUniswapV2Pair(UniswapV2Library.pairFor(factory, input, output)).swap(
                amount0Out, amount1Out, to, new bytes(0)
            );
        }
    }

    // **** LIBRARY FUNCTIONS **** 
    // from original Uniswap router
    function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
        return UniswapV2Library.quote(amountA, reserveA, reserveB);
    }

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountOut)
    {
        return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);
    }

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
        public
        pure
        virtual
        override
        returns (uint amountIn)
    {
        return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
    }

    function getAmountsOut(uint amountIn, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return UniswapV2Library.getAmountsOut(factory, amountIn, path);
    }

    function getAmountsIn(uint amountOut, address[] memory path)
        public
        view
        virtual
        override
        returns (uint[] memory amounts)
    {
        return UniswapV2Library.getAmountsIn(factory, amountOut, path);
    }

    modifier ensure(uint deadline) {
        require(deadline >= block.timestamp, 'EXPIRED');
        _;
    }
}

File 44 of 61 : IWHSwapRouter.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

interface IWHSwapRouter {
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);

    function swapExactTokensForTokensAndWrap(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to, 
        uint deadline,
        uint protectionPeriod,
        bool mintToken,
        uint minUSDCPremium
    ) external returns (uint[] memory amounts, uint newTokenId);

    function swapTokensForExactTokensAndWrap(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline,
        uint protectionPeriod, 
        bool mintToken,
        uint minUSDCPremium
    ) external returns (uint[] memory amounts, uint newTokenId);

    function swapExactETHForTokensAndWrap(uint amountOutMin, address[] calldata path, address to, uint deadline, uint protectionPeriod, bool mintToken, uint minUSDCPremium)
        external
        payable
        returns (uint[] memory amounts, uint newTokenId);

    function swapETHForExactTokensAndWrap(uint amountOut, address[] calldata path, address to, uint deadline, uint protectionPeriod, bool mintToken, uint minUSDCPremium)
        external
        payable
        returns (uint[] memory amounts, uint newTokenId);


    function swapExactTokensForETHAndWrap(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline, uint protectionPeriod, bool mintToken, uint minUSDCPremium)
        external
        returns(uint[] memory amounts, uint newTokenId);

    function swapTokensForExactETHAndWrap(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline, uint protectionPeriod, bool mintToken, uint minUSDCPremium)
        external
        returns (uint[] memory amounts, uint newTokenId);

// **** LIBRARY FUNCTIONS ****
    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);

    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
        external
        pure
        returns (uint amountOut);

    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
        external
        pure        
        returns (uint amountIn);

    function getAmountsOut(uint amountIn, address[] memory path)
        external
        view        
        returns (uint[] memory amounts);

    function getAmountsIn(uint amountOut, address[] memory path)
        external
        view
        returns (uint[] memory amounts);
}

File 45 of 61 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.6.0;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
    function safeApprove(address token, address to, uint value) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
    }

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

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

    function safeTransferETH(address to, uint value) internal {
        (bool success,) = to.call{value:value}(new bytes(0));
        require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
    }
}

File 46 of 61 : UniswapV2Library.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0;

import '../interfaces/IUniswapV2Pair.sol';

import "./SafeMath.sol";

library UniswapV2Library {
    using SafeMathUniswap for uint;

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
    }

    // calculates the CREATE2 address for a pair without making any external calls
    function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = address(uint(keccak256(abi.encodePacked(
                hex'ff',
                factory,
                keccak256(abi.encodePacked(token0, token1)),
                hex'fa418eb2c6e15c39605695377d0e364aca1c3c56b333eefe9c0d4b707662f785' // init code hash
            ))));
    }

    // fetches and sorts the reserves for a pair
    function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
        (address token0,) = sortTokens(tokenA, tokenB);
        (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
    function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
        require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
        require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        amountB = amountA.mul(reserveB) / reserveA;
    }

    // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
        require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint amountInWithFee = amountIn.mul(997);
        uint numerator = amountInWithFee.mul(reserveOut);
        uint denominator = reserveIn.mul(1000).add(amountInWithFee);
        amountOut = numerator / denominator;
    }

    // given an output amount of an asset and pair reserves, returns a required input amount of the other asset
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
        require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
        require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
        uint numerator = reserveIn.mul(amountOut).mul(1000);
        uint denominator = reserveOut.sub(amountOut).mul(997);
        amountIn = (numerator / denominator).add(1);
    }

    // performs chained getAmountOut calculations on any number of pairs
    function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[0] = amountIn;
        for (uint i; i < path.length - 1; i++) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
            amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
        }
    }

    // performs chained getAmountIn calculations on any number of pairs
    function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
        require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
        amounts = new uint[](path.length);
        amounts[amounts.length - 1] = amountOut;
        for (uint i = path.length - 1; i > 0; i--) {
            (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
            amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
        }
    }
}

File 47 of 61 : IUniswapV2Pair.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0;

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

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

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

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

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

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

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

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

    function initialize(address, address) external;
}

File 48 of 61 : SafeMath.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.6.12;

// a library for performing overflow-safe math, courtesy of DappHub (https://github.com/dapphub/ds-math)

library SafeMathUniswap {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x, 'ds-math-add-overflow');
    }

    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x, 'ds-math-sub-underflow');
    }

    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
    }
}

File 49 of 61 : UniswapV2ERC20.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.6.12;

import './libraries/SafeMath.sol';

contract UniswapV2ERC20 {
    using SafeMathUniswap for uint;

    string public constant name = 'SushiSwap LP Token';
    string public constant symbol = 'SLP';
    uint8 public constant decimals = 18;
    uint  public totalSupply;
    mapping(address => uint) public balanceOf;
    mapping(address => mapping(address => uint)) public allowance;

    bytes32 public DOMAIN_SEPARATOR;
    // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
    mapping(address => uint) public nonces;

    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    constructor() public {
        uint chainId;
        assembly {
            chainId := chainid()
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
                keccak256(bytes(name)),
                keccak256(bytes('1')),
                chainId,
                address(this)
            )
        );
    }

    function _mint(address to, uint value) internal {
        totalSupply = totalSupply.add(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(address(0), to, value);
    }

    function _burn(address from, uint value) internal {
        balanceOf[from] = balanceOf[from].sub(value);
        totalSupply = totalSupply.sub(value);
        emit Transfer(from, address(0), value);
    }

    function _approve(address owner, address spender, uint value) private {
        allowance[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    function _transfer(address from, address to, uint value) private {
        balanceOf[from] = balanceOf[from].sub(value);
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

    function approve(address spender, uint value) external returns (bool) {
        _approve(msg.sender, spender, value);
        return true;
    }

    function transfer(address to, uint value) external returns (bool) {
        _transfer(msg.sender, to, value);
        return true;
    }

    function transferFrom(address from, address to, uint value) external returns (bool) {
        if (allowance[from][msg.sender] != uint(-1)) {
            allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
        }
        _transfer(from, to, value);
        return true;
    }

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
        require(deadline >= block.timestamp, 'UniswapV2: EXPIRED');
        bytes32 digest = keccak256(
            abi.encodePacked(
                '\x19\x01',
                DOMAIN_SEPARATOR,
                keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
            )
        );
        address recoveredAddress = ecrecover(digest, v, r, s);
        require(recoveredAddress != address(0) && recoveredAddress == owner, 'UniswapV2: INVALID_SIGNATURE');
        _approve(owner, spender, value);
    }
}

File 50 of 61 : UniswapV2Pair.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.6.12;

import './UniswapV2ERC20.sol';
import './libraries/Math.sol';
import './libraries/UQ112x112.sol';
import './interfaces/IERC20.sol';
import './interfaces/IUniswapV2Factory.sol';
import './interfaces/IUniswapV2Callee.sol';

interface IMigrator {
    // Return the desired amount of liquidity token that the migrator wants.
    function desiredLiquidity() external view returns (uint256);
}

contract UniswapV2Pair is UniswapV2ERC20 {
    using SafeMathUniswap  for uint;
    using UQ112x112 for uint224;

    uint public constant MINIMUM_LIQUIDITY = 10**3;
    bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));

    address public factory;
    address public token0;
    address public token1;

    uint112 private reserve0;           // uses single storage slot, accessible via getReserves
    uint112 private reserve1;           // uses single storage slot, accessible via getReserves
    uint32  private blockTimestampLast; // uses single storage slot, accessible via getReserves

    uint public price0CumulativeLast;
    uint public price1CumulativeLast;
    uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event

    uint private unlocked = 1;
    modifier lock() {
        require(unlocked == 1, 'UniswapV2: LOCKED');
        unlocked = 0;
        _;
        unlocked = 1;
    }

    function getReserves() public view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
        _reserve0 = reserve0;
        _reserve1 = reserve1;
        _blockTimestampLast = blockTimestampLast;
    }

    function _safeTransfer(address token, address to, uint value) private {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'UniswapV2: TRANSFER_FAILED');
    }

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    constructor() public {
        factory = msg.sender;
    }

    // called once by the factory at time of deployment
    function initialize(address _token0, address _token1) external {
        require(msg.sender == factory, 'UniswapV2: FORBIDDEN'); // sufficient check
        token0 = _token0;
        token1 = _token1;
    }

    // update reserves and, on the first call per block, price accumulators
    function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
        require(balance0 <= uint112(-1) && balance1 <= uint112(-1), 'UniswapV2: OVERFLOW');
        uint32 blockTimestamp = uint32(block.timestamp % 2**32);
        uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
        if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
            // * never overflows, and + overflow is desired
            price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
            price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
        }
        reserve0 = uint112(balance0);
        reserve1 = uint112(balance1);
        blockTimestampLast = blockTimestamp;
        emit Sync(reserve0, reserve1);
    }

    // if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
    function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
        address feeTo = IUniswapV2Factory(factory).feeTo();
        feeOn = feeTo != address(0);
        uint _kLast = kLast; // gas savings
        if (feeOn) {
            if (_kLast != 0) {
                uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
                uint rootKLast = Math.sqrt(_kLast);
                if (rootK > rootKLast) {
                    uint numerator = totalSupply.mul(rootK.sub(rootKLast));
                    uint denominator = rootK.mul(5).add(rootKLast);
                    uint liquidity = numerator / denominator;
                    if (liquidity > 0) _mint(feeTo, liquidity);
                }
            }
        } else if (_kLast != 0) {
            kLast = 0;
        }
    }

    // this low-level function should be called from a contract which performs important safety checks
    function mint(address to) external lock returns (uint liquidity) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        uint balance0 = IERC20Uniswap(token0).balanceOf(address(this));
        uint balance1 = IERC20Uniswap(token1).balanceOf(address(this));
        uint amount0 = balance0.sub(_reserve0);
        uint amount1 = balance1.sub(_reserve1);

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        if (_totalSupply == 0) {
            address migrator = IUniswapV2Factory(factory).migrator();
            if (msg.sender == migrator) {
                liquidity = IMigrator(migrator).desiredLiquidity();
                require(liquidity > 0 && liquidity != uint256(-1), "Bad desired liquidity");
            } else {
                require(migrator == address(0), "Must not have migrator");
                liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
                _mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
            }
        } else {
            liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
        }
        require(liquidity > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_MINTED');
        _mint(to, liquidity);

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
        emit Mint(msg.sender, amount0, amount1);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function burn(address to) external lock returns (uint amount0, uint amount1) {
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        address _token0 = token0;                                // gas savings
        address _token1 = token1;                                // gas savings
        uint balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
        uint balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
        uint liquidity = balanceOf[address(this)];

        bool feeOn = _mintFee(_reserve0, _reserve1);
        uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
        amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
        amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
        require(amount0 > 0 && amount1 > 0, 'UniswapV2: INSUFFICIENT_LIQUIDITY_BURNED');
        _burn(address(this), liquidity);
        _safeTransfer(_token0, to, amount0);
        _safeTransfer(_token1, to, amount1);
        balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
        balance1 = IERC20Uniswap(_token1).balanceOf(address(this));

        _update(balance0, balance1, _reserve0, _reserve1);
        if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
        emit Burn(msg.sender, amount0, amount1, to);
    }

    // this low-level function should be called from a contract which performs important safety checks
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external lock {
        require(amount0Out > 0 || amount1Out > 0, 'UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT');
        (uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
        require(amount0Out < _reserve0 && amount1Out < _reserve1, 'UniswapV2: INSUFFICIENT_LIQUIDITY');

        uint balance0;
        uint balance1;
        { // scope for _token{0,1}, avoids stack too deep errors
        address _token0 = token0;
        address _token1 = token1;
        require(to != _token0 && to != _token1, 'UniswapV2: INVALID_TO');
        if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
        if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
        if (data.length > 0) IUniswapV2Callee(to).uniswapV2Call(msg.sender, amount0Out, amount1Out, data);
        balance0 = IERC20Uniswap(_token0).balanceOf(address(this));
        balance1 = IERC20Uniswap(_token1).balanceOf(address(this));
        }
        uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
        uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
        require(amount0In > 0 || amount1In > 0, 'UniswapV2: INSUFFICIENT_INPUT_AMOUNT');
        { // scope for reserve{0,1}Adjusted, avoids stack too deep errors
        uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
        uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
        require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'UniswapV2: K');
        }

        _update(balance0, balance1, _reserve0, _reserve1);
        emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
    }

    // force balances to match reserves
    function skim(address to) external lock {
        address _token0 = token0; // gas savings
        address _token1 = token1; // gas savings
        _safeTransfer(_token0, to, IERC20Uniswap(_token0).balanceOf(address(this)).sub(reserve0));
        _safeTransfer(_token1, to, IERC20Uniswap(_token1).balanceOf(address(this)).sub(reserve1));
    }

    // force reserves to match balances
    function sync() external lock {
        _update(IERC20Uniswap(token0).balanceOf(address(this)), IERC20Uniswap(token1).balanceOf(address(this)), reserve0, reserve1);
    }
}

File 51 of 61 : Math.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.6.12;

// a library for performing various math operations

library Math {
    function min(uint x, uint y) internal pure returns (uint z) {
        z = x < y ? x : y;
    }

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    function sqrt(uint y) internal pure returns (uint z) {
        if (y > 3) {
            z = y;
            uint x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
    }
}

File 52 of 61 : UQ112x112.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.6.12;

// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))

// range: [0, 2**112 - 1]
// resolution: 1 / 2**112

library UQ112x112 {
    uint224 constant Q112 = 2**112;

    // encode a uint112 as a UQ112x112
    function encode(uint112 y) internal pure returns (uint224 z) {
        z = uint224(y) * Q112; // never overflows
    }

    // divide a UQ112x112 by a uint112, returning a UQ112x112
    function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
        z = x / uint224(y);
    }
}

File 53 of 61 : IERC20.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0;

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

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

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

File 54 of 61 : IUniswapV2Factory.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0;

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

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

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

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

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

File 55 of 61 : IUniswapV2Callee.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.5.0;

interface IUniswapV2Callee {
    function uniswapV2Call(address sender, uint amount0, uint amount1, bytes calldata data) external;
}

File 56 of 61 : SushiSwapPairMock.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@sushiswap/core/contracts/uniswapv2/UniswapV2Pair.sol";

contract SushiSwapPairMock is UniswapV2Pair {
    constructor() public UniswapV2Pair() {
        return;
    }
}

File 57 of 61 : UniswapV2Factory.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.6.12;

import './interfaces/IUniswapV2Factory.sol';
import './UniswapV2Pair.sol';

contract UniswapV2Factory is IUniswapV2Factory {
    address public override feeTo;
    address public override feeToSetter;
    address public override migrator;

    mapping(address => mapping(address => address)) public override getPair;
    address[] public override allPairs;

    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    constructor(address _feeToSetter) public {
        feeToSetter = _feeToSetter;
    }

    function allPairsLength() external override view returns (uint) {
        return allPairs.length;
    }

    function pairCodeHash() external pure returns (bytes32) {
        return keccak256(type(UniswapV2Pair).creationCode);
    }

    function createPair(address tokenA, address tokenB) external override returns (address pair) {
        require(tokenA != tokenB, 'UniswapV2: IDENTICAL_ADDRESSES');
        (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
        require(token0 != address(0), 'UniswapV2: ZERO_ADDRESS');
        require(getPair[token0][token1] == address(0), 'UniswapV2: PAIR_EXISTS'); // single check is sufficient
        bytes memory bytecode = type(UniswapV2Pair).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(token0, token1));
        assembly {
            pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        UniswapV2Pair(pair).initialize(token0, token1);
        getPair[token0][token1] = pair;
        getPair[token1][token0] = pair; // populate mapping in the reverse direction
        allPairs.push(pair);
        emit PairCreated(token0, token1, pair, allPairs.length);
    }

    function setFeeTo(address _feeTo) external override {
        require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');
        feeTo = _feeTo;
    }

    function setMigrator(address _migrator) external override {
        require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');
        migrator = _migrator;
    }

    function setFeeToSetter(address _feeToSetter) external override {
        require(msg.sender == feeToSetter, 'UniswapV2: FORBIDDEN');
        feeToSetter = _feeToSetter;
    }

}

File 58 of 61 : SushiSwapFactoryMock.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
import "@sushiswap/core/contracts/uniswapv2/interfaces/IUniswapV2Factory.sol";
import "@sushiswap/core/contracts/uniswapv2/UniswapV2Factory.sol";

contract SushiSwapFactoryMock is UniswapV2Factory {
    constructor() public UniswapV2Factory(msg.sender) {
        return;
    }
}

File 59 of 61 : WhiteUSDCPool.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

import "./Interfaces/IWhiteUSDCPool.sol";
import "./Interfaces/IWhiteStakingERC20.sol";

/**
 * @author jmonteer & 0mllwntrmt3
 * @title Whiteheart Stablecoin Liquidity Pool
 * @notice Accumulates liquidity in USDC from LPs and distributes P&L in USDC
 */
contract WhiteUSDCPool is
    IWhiteUSDCPool,
    Ownable,
    ERC20("Whiteheart USDC LP Token", "writeUSDC")
{
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    // token that is holded in the pool
    IERC20 public override immutable token;
    // address of fee recipient contract
    IWhiteStakingERC20 public immutable settlementFeeRecipient;
    address public hegicFeeRecipient;

    // storage variable to keep
    uint256 public owedToKeep3r = 0;
    // amount locked as collateral for open positions
    uint256 public lockedAmount;
    // amount of locked premiums
    uint256 public lockedPremium;
    // minimum amount of time to pass between last provide timestamp and withdrawal
    uint256 public lockupPeriod = 2 weeks;
    uint256 public hegicFee = 0;
    uint256 public constant INITIAL_RATE = 1e13;

    // WHAsset contracts allowed to open positions using this pool
    mapping(address => bool) public whAssets;
    // Last provided timestamp for this address
    mapping(address => uint256) public lastProvideTimestamp;
    // Locked Liquidity mapping per WHAsset (whAsset address => id => LockedLiquidity)
    mapping(address => mapping(uint => LockedLiquidity)) public lockedLiquidity;
    // Whether or not the tranfers of Locked funds are allowed
    mapping(address => bool) public _revertTransfersInLockUpPeriod;

    /**
     * @param _token USDC address
     * @param _settlementFeeRecipient Address of contract that will receive the fees
     */
    constructor(IERC20 _token, IWhiteStakingERC20 _settlementFeeRecipient) public {
        token = _token;
        settlementFeeRecipient = _settlementFeeRecipient;
        hegicFeeRecipient = msg.sender;
        IERC20(_token).safeApprove(address(_settlementFeeRecipient), type(uint256).max);
    }

    modifier onlyWHAssets {
        require(whAssets[msg.sender], "whiteheart::pool::not-allowed");
        _;
    }

    /**
     * @notice Used for changing the lockup period
     * @param value New period value
     */
    function setLockupPeriod(uint256 value) external override onlyOwner {
        require(value <= 60 days, "Lockup period is too large");
        lockupPeriod = value;
    }

    /**
     * @notice Used for changing the Hegic fee recipient
     * @param value New value
     */
    function setHegicFeeRecipient(address value) external onlyOwner {
        require(value != address(0));
        hegicFeeRecipient = value;
    }

    /**
     * @notice Used for withdrawing the Hegic fee
     */
    function withdrawHegicFee() external {
      token.safeTransfer(hegicFeeRecipient, hegicFee);
      hegicFee = 0;
    }

    /**
     * @notice Allows new smart contract to open positions using USDC pools
     * @param _whAsset whAsset address
     * @param approved set to true for approval, set to false for rejecting previously granted access
     */
    function setAllowedWHAsset(address _whAsset, bool approved) external override onlyOwner {
        whAssets[_whAsset] = approved;
    }

    /**
     * @notice Lets each user to decide whether or not they want to allow incoming transfers of locked funds
     * @param value bool option. true if the transfer should be reverted, false if it shouldnt
     */
    function revertTransfersInLockUpPeriod(bool value) external {
        _revertTransfersInLockUpPeriod[msg.sender] = value;
    }

    /**
     * @notice called by WHAsset contract to lock funds and premium (when opening a position)
     * @param id Id of the Hedge Contract that is being opened
     * @param amountToLock Amount of funds that should be locked in an option
     * @param totalFee premium paid for the protection. It will be locked until funds are unlocked
     */
    function lock(uint id, uint256 amountToLock, uint256 totalFee) external override onlyWHAssets {
        address creator = msg.sender;
        require(
            lockedAmount.add(amountToLock).mul(10) <= totalBalance().mul(8),
            "Pool Error: Amount is too large."
        );

        uint256 premium = totalFee.mul(30).div(100);
        uint256 settlementFee = totalFee.mul(30).div(100);
        uint256 hegicFeeAmount = totalFee.sub(premium).sub(settlementFee);

        lockedLiquidity[creator][id] = (LockedLiquidity(uint120(amountToLock), uint120(premium), true));
        lockedPremium = lockedPremium.add(premium);
        lockedAmount = lockedAmount.add(amountToLock);

        settlementFeeRecipient.sendProfit(settlementFee);
        hegicFee = hegicFee.add(hegicFeeAmount);
    }

    /**
     * @notice calls by WHAsset contract to unlock funds and premium (when closing a position, either exercising or unlocking funds)
     * @param id Id of the Hedge Contract that is being opened
     */
    function unlock(uint256 id) external override {
        LockedLiquidity storage ll = lockedLiquidity[msg.sender][id];
        require(ll.locked, "LockedLiquidity with such id has already unlocked");
        ll.locked = false;

        lockedPremium = lockedPremium.sub(ll.premium);
        lockedAmount = lockedAmount.sub(ll.amount);

        emit Profit(id, ll.premium);
    }

    /**
     * @notice Function that can only be called by WHAsset contracts to retrieve funds owed to a keep3r
     * @param keep3r address of the function to receive accumulated rewards
     */
    function payKeep3r(address keep3r) external onlyWHAssets override returns (uint amount) {
        amount = owedToKeep3r;
        owedToKeep3r = 0;
        if(amount > 0) token.safeTransfer(keep3r, amount);
    }

    /**
     * @notice function that pays profit (if any) to the hedge contract holder and unlocks premium and liquidity
     * @param id Id of the Hedge Contract that is being closed
     * @param to address to receive profit
     * @param amount profit to be sent
     * @param _payKeep3r amount to be saved for the keep3r unwrapping the asset
     */
    function send(uint id, address payable to, uint256 amount, uint _payKeep3r)
        external
        override
    {
        LockedLiquidity storage ll = lockedLiquidity[msg.sender][id];
        require(ll.locked, "LockedLiquidity with such id has already unlocked");
        require(to != address(0));

        ll.locked = false;
        lockedPremium = lockedPremium.sub(ll.premium);
        lockedAmount = lockedAmount.sub(ll.amount);

        uint transferAmount = amount > ll.amount ? ll.amount : amount;
        token.safeTransfer(to, transferAmount.sub(_payKeep3r));

        if(_payKeep3r > 0) owedToKeep3r = owedToKeep3r.add(_payKeep3r);

        if (transferAmount <= ll.premium)
            emit Profit(id, ll.premium - transferAmount);
        else
            emit Loss(id, transferAmount - ll.premium);
    }

    /**
     * @notice deletes locked liquidity, receiving a gas refund. used to reduce gas usage
     * @param id Id of the Hedge Contract that is being closed
     */
    function deleteLockedLiquidity(uint id) external override {
        delete lockedLiquidity[msg.sender][id];
    }

    /**
     * @notice A provider supplies USDC to the pool and receives writeUSDC tokens
     * @param amount Amount to send to the contract
     * @param minMint minimum amount of writeUSDC tokens to be minted
     * @return mint amount of writeUSDC minted to provider
     */
    function provide(uint256 amount, uint256 minMint) external returns (uint256 mint) {
        lastProvideTimestamp[msg.sender] = block.timestamp;
        uint supply = totalSupply();
        uint balance = totalBalance();
        if (supply > 0 && balance > 0)
            mint = amount.mul(supply).div(balance);
        else
            mint = amount.mul(INITIAL_RATE);

        require(mint >= minMint, "Pool: Mint limit is too large");
        require(mint > 0, "Pool: Amount is too small");
        _mint(msg.sender, mint);
        emit Provide(msg.sender, amount, mint);

        token.safeTransferFrom(msg.sender, address(this), amount);
    }

    /**
     * @notice A provider supplies writeUSDC to the pool and receives USDC tokens
     * @param amount Amount to withdraw from the pool
     * @param maxBurn maximum amount of writeUSDC to be burned in exchange
     * @return burn amount of writeUSDC burnt from provider
     */
    function withdraw(uint256 amount, uint256 maxBurn) external returns (uint256 burn) {
        require(
            lastProvideTimestamp[msg.sender].add(lockupPeriod) <= block.timestamp,
            "Pool: Withdrawal is locked up"
        );
        require(
            amount <= availableBalance(),
            "Pool Error: You are trying to unlock more funds than have been locked for your contract. Please lower the amount."
        );

        burn = divCeil(amount.mul(totalSupply()), totalBalance());

        require(burn <= maxBurn, "Pool: Burn limit is too small");
        require(burn <= balanceOf(msg.sender), "Pool: Amount is too large");
        require(burn > 0, "Pool: Amount is too small");

        _burn(msg.sender, burn);
        emit Withdraw(msg.sender, amount, burn);
        token.safeTransfer(msg.sender, amount);
    }

    /**
     * @notice Returns provider's share in USDC
     * @param user Provider's address
     * @return share Provider's share in USDC
     */
    function shareOf(address user) external view returns (uint256 share) {
        uint supply = totalSupply();
        if (supply > 0)
            share = totalBalance().mul(balanceOf(user)).div(supply);
        else
            share = 0;
    }

    /**
     * @notice Returns the amount of USDC available for withdrawals
     * @return balance Unlocked amount
     */
    function availableBalance() public view returns (uint256 balance) {
        return totalBalance().sub(lockedAmount);
    }

    /**
     * @notice Returns the USDC total balance provided to the pool
     * @return balance Pool balance
     */
    function totalBalance() public override view returns (uint256 balance) {
        return token.balanceOf(address(this)).sub(lockedPremium).sub(hegicFee);
    }

    /**
     * @notice Internal function that checks if to be transferred tokens are locked and act accordingly
     * @param from sender
     * @param to recipient
     */
    function _beforeTokenTransfer(address from, address to, uint256) internal override {
        if (
            lastProvideTimestamp[from].add(lockupPeriod) > block.timestamp &&
            lastProvideTimestamp[from] > lastProvideTimestamp[to]
        ) {
            require(
                !_revertTransfersInLockUpPeriod[to],
                "the recipient does not accept blocked funds"
            );
            lastProvideTimestamp[to] = lastProvideTimestamp[from];
        }
    }

    // support function that divides and chooses result's ceil
    function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0);
        uint256 c = a / b;
        if (a % b != 0)
            c = c + 1;
        return c;
    }
}

File 60 of 61 : WhiteOptionsPricer.sol
// SPDX-License-Identifier: GPL-3.0
import "./Interfaces/IWhiteOptionsPricer.sol";

pragma solidity 0.6.12;

/**
 * @author jmonteer & 0mllwntrmt3
 * @title Whiteheart Options Pricer: Separate module to price protection of WHAssets
 * @notice Support contract that provides prices for certain protection periods, strikes and amounts
 */
contract WhiteOptionsPricer is IWhiteOptionsPricer, Ownable {
    using SafeMath for uint;

    uint256 public impliedVolRate;
    uint256 internal constant PRICE_DECIMALS = 1e8;

    AggregatorV3Interface public underlyingPriceProvider;

    constructor(AggregatorV3Interface _priceProvider) public {
        underlyingPriceProvider = _priceProvider;
        impliedVolRate = 5500;
    }

    /**
     * @notice Used for adjusting the options prices while balancing asset's implied volatility rate
     * @param value New IVRate value
     */
    function setImpliedVolRate(uint256 value) external onlyOwner {
        require(value >= 1000, "ImpliedVolRate limit is too small");
        impliedVolRate = value;
    }

    /**
     * @notice Returns the price that opening a certain option should cost
     * @param period period of protection
     * @param amount amount of underlying asset to be protected
     * @return total totalfee
     */
    function getOptionPrice(
        uint256 period,
        uint256 amount,
        uint256
    )
        external
        override
        view
        returns (uint256 total)
    {
        require(period <= 4 weeks, "!period: too long");
        require(period >= 1 days, "!period: too short");

        return amount
            .mul(sqrt(period))
            .mul(impliedVolRate)
            .div(PRICE_DECIMALS);
    }


    /**
     * @notice Returns the amount of WHAsset that is going to be created when provided with the total
     * amount of underlying asset sent (some goes to protecting the asset, some to the principal being protected)
     * @param total principal + hedgecost
     * @param period period of protection
     * @return maximum amount to be wrapped
     */
    function getAmountToWrapFromTotal(uint total, uint period) external view override returns (uint){
        uint numerator = total.mul(PRICE_DECIMALS).mul(10000);
        uint denominator = PRICE_DECIMALS.add(sqrt(period).mul(impliedVolRate));
        return numerator.div(denominator).div(10000);
    }

    /**
     * @dev Counts square root of the number.
     * Throws "invalid opcode" at uint(-1)

     */
    function sqrt(uint256 x) internal pure returns (uint256 result) {
        result = x;
        uint256 k = (x + 1) >> 1;
        while (k < result) (result, k) = (k, (x / k + k) >> 1);
    }
}

File 61 of 61 : FakePriceProvider.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.6.12;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract FakePriceProvider is AggregatorV3Interface {
    uint256 public price;
    uint8 public override decimals = 8;
    string public override description = "Test implementation";
    uint256 public override version = 0;

    constructor(uint256 _price) public {
        price = _price;
    }

    function setPrice(uint256 _price) external {
        price = _price;
    }

    function getRoundData(uint80) external override view returns (uint80, int256, uint256, uint256, uint80) {
        revert("Test implementation");
    }

    function latestAnswer() external view returns(int result) {
        (, result, , , ) = latestRoundData();
    }

    function latestRoundData()
        public
        override
        view
        returns (
            uint80,
            int256 answer,
            uint256,
            uint256,
            uint80
        )
    {
        answer = int(price);
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "evmVersion": "istanbul",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IUniswapV2Router02","name":"_swapRouter","type":"address"},{"internalType":"contract IToken","name":"_stablecoin","type":"address"},{"internalType":"contract AggregatorV3Interface","name":"_priceProvider","type":"address"},{"internalType":"contract IWhiteUSDCPool","name":"_pool","type":"address"},{"internalType":"contract IWhiteOptionsPricer","name":"_whiteOptionsPricer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint32","name":"tokenId","type":"uint32"},{"indexed":false,"internalType":"uint128","name":"closePrice","type":"uint128"},{"indexed":false,"internalType":"uint128","name":"optionProfit","type":"uint128"}],"name":"Unwrap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint32","name":"tokenId","type":"uint32"},{"indexed":false,"internalType":"uint88","name":"cost","type":"uint88"},{"indexed":false,"internalType":"uint88","name":"amount","type":"uint88"},{"indexed":false,"internalType":"uint48","name":"strike","type":"uint48"},{"indexed":false,"internalType":"uint32","name":"expiration","type":"uint32"}],"name":"Wrap","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"rewardRecipient","type":"address"}],"name":"autoUnwrap","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"list","type":"uint256[]"},{"internalType":"address","name":"rewardRecipient","type":"address"}],"name":"autoUnwrapAll","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"autoUnwrapDisabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IUniswapV2Router02","name":"_swapRouter","type":"address"}],"name":"connectRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isAutoUnwrapable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keep3r","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listAutoUnwrapable","outputs":[{"internalType":"uint256[]","name":"list","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optionCollateralizationRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool","outputs":[{"internalType":"contract IWhiteUSDCPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceProvider","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"routers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"disabled","type":"bool"}],"name":"setAutoUnwrapDisabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newKeep3r","type":"address"}],"name":"setKeep3r","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_router","type":"address"},{"internalType":"bool","name":"allowed","type":"bool"}],"name":"setRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IUniswapV2Router02","name":"newRouter","type":"address"}],"name":"setSwapRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stablecoin","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"swapRouter","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"underlying","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint88","name":"amount","type":"uint88"},{"internalType":"uint48","name":"expiration","type":"uint48"},{"internalType":"uint48","name":"strike","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"underlyingToStableSwapPath","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"unwrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"whiteOptionsPricer","outputs":[{"internalType":"contract IWhiteOptionsPricer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"period","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"_mintToken","type":"bool"},{"internalType":"uint256","name":"minPremiumUSDC","type":"uint256"}],"name":"wrap","outputs":[{"internalType":"uint256","name":"newTokenId","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"total","type":"uint256"},{"internalType":"uint256","name":"protectionPeriod","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"mintToken","type":"bool"},{"internalType":"uint256","name":"minUSDCPremium","type":"uint256"}],"name":"wrapAfterSwap","outputs":[{"internalType":"uint256","name":"newTokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"period","type":"uint256"}],"name":"wrapCost","outputs":[{"internalType":"uint256","name":"cost","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101006040526064600b553480156200001757600080fd5b5060405162004fb638038062004fb6833981810160405260a08110156200003d57600080fd5b508051602080830151604080850151606086015160809096015182516315ab88c960e31b815292519596939591949092879287926001600160a01b0385169263ad5c46489260048083019392829003018186803b1580156200009e57600080fd5b505afa158015620000b3573d6000803e3d6000fd5b505050506040513d6020811015620000ca57600080fd5b5051604080518082018252601581527f5768697465686561727420486564676564204554480000000000000000000000602082810191909152825180840190935260058352640ae908aa8960db1b908301528791879187918181620001366301ffc9a760e01b62000415565b81516200014b90600690602085019062000b4e565b5080516200016190600790602084019062000b4e565b50620001746380ac58cd60e01b62000415565b62000186635b5e139f60e01b62000415565b6200019863780e9d6360e01b62000415565b5060009050620001a76200049a565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060006305f5e100620002ea896001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200023a57600080fd5b505afa1580156200024f573d6000803e3d6000fd5b505050506040513d60208110156200026657600080fd5b50516040805163313ce56760e01b815290516001600160a01b038c169163313ce567916004808301926020929190829003018186803b158015620002a957600080fd5b505afa158015620002be573d6000803e3d6000fd5b505050506040513d6020811015620002d557600080fd5b5051906200049e602090811b620020ec17901c565b600a0a0260c081905260408051600280825260608083018452939450909160208301908036833701905050905087816000815181106200032657fe5b60200260200101906001600160a01b031690816001600160a01b03168152505088816001815181106200035557fe5b6001600160a01b0390921660209283029190910182015281516200038091600c919084019062000bd3565b506200038c8a620004fc565b5050600e80546001600160a01b039094166001600160a01b03199094169390931790925550506001600160601b0319606092831b811660a05293821b841660e052901b90911660805250620003e39050856200058f565b6200040a82600019866001600160a01b03166200069960201b62002149179092919060201c565b505050505062000c71565b6001600160e01b0319808216141562000475576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b3390565b600082821115620004f6576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b620005066200049a565b6001600160a01b031662000519620007bd565b6001600160a01b03161462000564576040805162461bcd60e51b8152602060048201819052602482015260008051602062004f36833981519152604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b0383161790556200058c816001620007cc565b50565b620005996200049a565b6001600160a01b0316620005ac620007bd565b6001600160a01b031614620005f7576040805162461bcd60e51b8152602060048201819052602482015260008051602062004f36833981519152604482015290519081900360640190fd5b806001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156200063157600080fd5b505afa15801562000646573d6000803e3d6000fd5b505050506040513d60208110156200065d57600080fd5b5051601480546001600160a01b0319166001600160a01b0392831617908190556200058c91168260001962000699602090811b6200214917901c565b80158062000723575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015620006f357600080fd5b505afa15801562000708573d6000803e3d6000fd5b505050506040513d60208110156200071f57600080fd5b5051155b620007605760405162461bcd60e51b815260040180806020018281038252603681526020018062004f806036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620007b89185916200085f16565b505050565b600a546001600160a01b031690565b620007d66200049a565b6001600160a01b0316620007e9620007bd565b6001600160a01b03161462000834576040805162461bcd60e51b8152602060048201819052602482015260008051602062004f36833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6060620008bb826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200091b60201b6200225c179092919060201c565b805190915015620007b857808060200190516020811015620008dc57600080fd5b5051620007b85760405162461bcd60e51b815260040180806020018281038252602a81526020018062004f56602a913960400191505060405180910390fd5b60606200092c848460008562000936565b90505b9392505050565b606082471015620009795760405162461bcd60e51b815260040180806020018281038252602681526020018062004f106026913960400191505060405180910390fd5b620009848562000a9e565b620009d6576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b6020831062000a175780518252601f199092019160209182019101620009f6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811462000a7b576040519150601f19603f3d011682016040523d82523d6000602084013e62000a80565b606091505b50909250905062000a9382828662000aa4565b979650505050505050565b3b151590565b6060831562000ab55750816200092f565b82511562000ac65782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562000b1257818101518382015260200162000af8565b50505050905090810190601f16801562000b405780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1062000b9157805160ff191683800117855562000bc1565b8280016001018555821562000bc1579182015b8281111562000bc157825182559160200191906001019062000ba4565b5062000bcf92915062000c39565b5090565b82805482825590600052602060002090810192821562000c2b579160200282015b8281111562000c2b57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019062000bf4565b5062000bcf92915062000c50565b5b8082111562000bcf576000815560010162000c3a565b5b8082111562000bcf5780546001600160a01b031916815560010162000c51565b60805160601c60a05160601c60c05160e05160601c61423862000cd860003980611e9f52508061330952806138dc5250806118c15280612465525080610d93528061103052806111625280612d1d52806134b452806136605280613a0752506142386000f3fe6080604052600436106102815760003560e01c8063715018a61161014f578063c31c9c07116100c1578063de0e9a3e1161007a578063de0e9a3e14610ad5578063e985e9c514610aff578063e9cbd82214610b3a578063f1fa916c14610b4f578063f2fde38b14610bb4578063f8fdeb6814610be757610288565b8063c31c9c07146109b5578063c3c64674146109ca578063c634d03214610a05578063c87b56dd14610a2f578063d5a8776514610a59578063daddef3014610aa257610288565b80638da5cb5b116101135780638da5cb5b1461085357806395d89b4114610868578063a22cb4651461087d578063ad5c4648146108b8578063b888879e146108cd578063b88d4fde146108e257610288565b8063715018a6146107a2578063767c6e3c146107b757806380dd9a1f146107e15780638552ea41146108145780638d5cd1ca1461082957610288565b8063302ce651116101f35780635aebbac7116101ac5780635aebbac71461069b578063634c7bb5146106ce5780636352211e146106e357806366b2a9481461070d5780636c0360eb1461075a57806370a082311461076f57610288565b8063302ce6511461052d5780633b0199fe1461054257806341273657146105c857806342842e0e146105fb5780634cc18e571461063e5780634f6ccce71461067157610288565b80630edd61c0116102455780630edd61c01461042b57806311a1db7d1461045b57806316f0115b1461048757806318160ddd1461049c57806323b872dd146104b15780632f745c59146104f457610288565b806301ffc9a71461028d57806306fdde03146102d5578063072888e71461035f578063081812fc146103aa578063095ea7b3146103f057610288565b3661028857005b600080fd5b34801561029957600080fd5b506102c1600480360360208110156102b057600080fd5b50356001600160e01b031916610c59565b604080519115158252519081900360200190f35b3480156102e157600080fd5b506102ea610c7c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036b57600080fd5b506103986004803603604081101561038257600080fd5b50803590602001356001600160a01b0316610d13565b60408051918252519081900360200190f35b3480156103b657600080fd5b506103d4600480360360208110156103cd57600080fd5b5035610e35565b604080516001600160a01b039092168252519081900360200190f35b3480156103fc57600080fd5b506104296004803603604081101561041357600080fd5b506001600160a01b038135169060200135610e97565b005b34801561043757600080fd5b506103986004803603604081101561044e57600080fd5b5080359060200135610f72565b34801561046757600080fd5b506104296004803603602081101561047e57600080fd5b5035151561100e565b34801561049357600080fd5b506103d461102e565b3480156104a857600080fd5b50610398611052565b3480156104bd57600080fd5b50610429600480360360608110156104d457600080fd5b506001600160a01b03813581169160208101359091169060400135611063565b34801561050057600080fd5b506103986004803603604081101561051757600080fd5b506001600160a01b0381351690602001356110ba565b34801561053957600080fd5b506103986110e3565b34801561054e57600080fd5b506103986004803603604081101561056557600080fd5b81019060208101813564010000000081111561058057600080fd5b82018360208201111561059257600080fd5b803590602001918460208302840111640100000000831117156105b457600080fd5b9193509150356001600160a01b03166110e9565b3480156105d457600080fd5b50610429600480360360208110156105eb57600080fd5b50356001600160a01b03166111e3565b34801561060757600080fd5b506104296004803603606081101561061e57600080fd5b506001600160a01b0381358116916020810135909116906040013561126e565b34801561064a57600080fd5b506104296004803603602081101561066157600080fd5b50356001600160a01b0316611289565b34801561067d57600080fd5b506103986004803603602081101561069457600080fd5b503561130d565b3480156106a757600080fd5b506102c1600480360360208110156106be57600080fd5b50356001600160a01b0316611323565b3480156106da57600080fd5b506103d4611338565b3480156106ef57600080fd5b506103d46004803603602081101561070657600080fd5b5035611347565b34801561071957600080fd5b50610398600480360360a081101561073057600080fd5b508035906020810135906001600160a01b036040820135169060608101351515906080013561136f565b34801561076657600080fd5b506102ea61145d565b34801561077b57600080fd5b506103986004803603602081101561079257600080fd5b50356001600160a01b03166114be565b3480156107ae57600080fd5b50610429611526565b3480156107c357600080fd5b506103d4600480360360208110156107da57600080fd5b50356115d2565b3480156107ed57600080fd5b506102c16004803603602081101561080457600080fd5b50356001600160a01b03166115f9565b34801561082057600080fd5b506103d461160e565b34801561083557600080fd5b506102c16004803603602081101561084c57600080fd5b503561161d565b34801561085f57600080fd5b506103d461173b565b34801561087457600080fd5b506102ea61174a565b34801561088957600080fd5b50610429600480360360408110156108a057600080fd5b506001600160a01b03813516906020013515156117ab565b3480156108c457600080fd5b506103d46118b0565b3480156108d957600080fd5b506103d46118bf565b3480156108ee57600080fd5b506104296004803603608081101561090557600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561094057600080fd5b82018360208201111561095257600080fd5b8035906020019184600183028401116401000000008311171561097457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506118e3945050505050565b3480156109c157600080fd5b506103d4611941565b3480156109d657600080fd5b50610429600480360360408110156109ed57600080fd5b506001600160a01b0381351690602001351515611950565b348015610a1157600080fd5b5061042960048036036020811015610a2857600080fd5b50356119dd565b348015610a3b57600080fd5b506102ea60048036036020811015610a5257600080fd5b5035611a64565b610398600480360360a0811015610a6f57600080fd5b506001600160801b03813516906020810135906001600160a01b0360408201351690606081013515159060800135611ce7565b348015610aae57600080fd5b5061042960048036036020811015610ac557600080fd5b50356001600160a01b0316611d0b565b348015610ae157600080fd5b5061042960048036036020811015610af857600080fd5b5035611dfe565b348015610b0b57600080fd5b506102c160048036036040811015610b2257600080fd5b506001600160a01b0381358116916020013516611e6f565b348015610b4657600080fd5b506103d4611e9d565b348015610b5b57600080fd5b50610b64611ec1565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610ba0578181015183820152602001610b88565b505050509050019250505060405180910390f35b348015610bc057600080fd5b5061042960048036036020811015610bd757600080fd5b50356001600160a01b0316611f97565b348015610bf357600080fd5b50610c1160048036036020811015610c0a57600080fd5b503561209a565b6040805195151586526001600160a01b0390941660208601526001600160581b039092168484015265ffffffffffff9081166060850152166080830152519081900360a00190f35b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d085780601f10610cdd57610100808354040283529160200191610d08565b820191906000526020600020905b815481529060010190602001808311610ceb57829003601f168201915b505050505090505b90565b6000610d1e8361161d565b610d61576040805162461bcd60e51b815260206004820152600f60248201526e216e6f742d756e7772617061626c6560881b604482015290519081900360640190fd5b610d6a83612273565b50610d769050336123db565b8015610d8c57506010546001600160a01b031633145b15610e2f577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ba9100c9836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b158015610e0057600080fd5b505af1158015610e14573d6000803e3d6000fd5b505050506040513d6020811015610e2a57600080fd5b505190505b92915050565b6000610e40826123e1565b610e7b5760405162461bcd60e51b815260040180806020018281038252602c8152602001806140ad602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610ea282611347565b9050806001600160a01b0316836001600160a01b03161415610ef55760405162461bcd60e51b81526004018080602001828103825260218152602001806141516021913960400191505060405180910390fd5b806001600160a01b0316610f076123ee565b6001600160a01b03161480610f285750610f2881610f236123ee565b611e6f565b610f635760405162461bcd60e51b8152600401808060200182810382526038815260200180613fdf6038913960400191505060405180910390fd5b610f6d83836123f2565b505050565b600080610f7d612460565b600e546040805163102cffa160e21b815260048101879052602481018890526044810184905290519293506001600160a01b03909116916340b3fe8491606480820192602092909190829003018186803b158015610fda57600080fd5b505afa158015610fee573d6000803e3d6000fd5b505050506040513d602081101561100457600080fd5b5051949350505050565b336000908152601360205260409020805460ff1916911515919091179055565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061105e60026124f1565b905090565b61107461106e6123ee565b826124fc565b6110af5760405162461bcd60e51b81526004018080602001828103825260318152602001806141726031913960400191505060405180910390fd5b610f6d838383612598565b6001600160a01b03821660009081526001602052604081206110dc90836126e4565b9392505050565b600b5481565b6000805b8381101561113b5761111085858381811061110457fe5b9050602002013561161d565b156111335761113085858381811061112457fe5b90506020020135612273565b50505b6001016110ed565b50611145336123db565b801561115b57506010546001600160a01b031633145b156110dc577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ba9100c9836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b1580156111cf57600080fd5b505af1158015610fee573d6000803e3d6000fd5b6111eb6123ee565b6001600160a01b03166111fc61173b565b6001600160a01b031614611245576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b03831617905561126b816001611950565b50565b610f6d838383604051806020016040528060008152506118e3565b6112916123ee565b6001600160a01b03166112a261173b565b6001600160a01b0316146112eb576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60008061131b6002846126f0565b509392505050565b60136020526000908152604090205460ff1681565b6010546001600160a01b031681565b6000610e2f82604051806060016040528060298152602001614041602991396002919061270c565b3360009081526011602052604081205460ff166113c2576040805162461bcd60e51b815260206004820152600c60248201526b085b9bdd08185b1b1bddd95960a21b604482015290519081900360640190fd5b600e546040805163274be9fd60e01b8152600481018990526024810188905290516000926001600160a01b03169163274be9fd916044808301926020929190829003018186803b15801561141557600080fd5b505afa158015611429573d6000803e3d6000fd5b505050506040513d602081101561143f57600080fd5b5051905061145281878760008888612719565b979650505050505050565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d085780601f10610cdd57610100808354040283529160200191610d08565b60006001600160a01b0382166115055760405162461bcd60e51b815260040180806020018281038252602a815260200180614017602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610e2f906124f1565b61152e6123ee565b6001600160a01b031661153f61173b565b6001600160a01b031614611588576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600c81815481106115df57fe5b6000918252602090912001546001600160a01b0316905081565b60116020526000908152604090205460ff1681565b600e546001600160a01b031681565b6000611627613e68565b506000828152601260209081526040808320815160a081018352815460ff8082161515835261010082046001600160a01b0316838701819052600160a81b9092046001600160581b03168386015260019093015465ffffffffffff8082166060850152600160301b90910416608083015285526013909352922054909116156116b4576000915050610c77565b80516116c4576000915050610c77565b6000806116cf612460565b9050826080015165ffffffffffff168110915081801561171f5750606083015142906117059065ffffffffffff166107086120ec565b1115801561171f575042836060015165ffffffffffff1610155b156117305760019350505050610c77565b506000949350505050565b600a546001600160a01b031690565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d085780601f10610cdd57610100808354040283529160200191610d08565b6117b36123ee565b6001600160a01b0316826001600160a01b03161415611819576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b80600560006118266123ee565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561186a6123ee565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6014546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6118f46118ee6123ee565b836124fc565b61192f5760405162461bcd60e51b81526004018080602001828103825260318152602001806141726031913960400191505060405180910390fd5b61193b84848484612876565b50505050565b600f546001600160a01b031681565b6119586123ee565b6001600160a01b031661196961173b565b6001600160a01b0316146119b2576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b60008181526012602052604090205460ff168015611a16575060008181526012602052604090205461010090046001600160a01b031633145b611a5a576040805162461bcd60e51b815260206004820152601060248201526f216e6f742d746f6b656e697a61626c6560801b604482015290519081900360640190fd5b61126b33826128c8565b6060611a6f826123e1565b611aaa5760405162461bcd60e51b815260040180806020018281038252602f815260200180614122602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015611b3f5780601f10611b1457610100808354040283529160200191611b3f565b820191906000526020600020905b815481529060010190602001808311611b2257829003601f168201915b505050505090506060611b5061145d565b9050805160001415611b6457509050610c77565b815115611c255780826040516020018083805190602001908083835b60208310611b9f5780518252601f199092019160209182019101611b80565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310611be75780518252601f199092019160209182019101611bc8565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050610c77565b80611c2f856129f6565b6040516020018083805190602001908083835b60208310611c615780518252601f199092019160209182019101611c42565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310611ca95780518252601f199092019160209182019101611c8a565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b6000611d01866001600160801b0316868660018787612719565b9695505050505050565b611d136123ee565b6001600160a01b0316611d2461173b565b6001600160a01b031614611d6d576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b806001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611da657600080fd5b505afa158015611dba573d6000803e3d6000fd5b505050506040513d6020811015611dd057600080fd5b5051601480546001600160a01b0319166001600160a01b03928316179081905561126b911682600019612149565b600081815260126020526040902054819061010090046001600160a01b03163314611e66576040805162461bcd60e51b815260206004820152601360248201527236b9b39739b2b73232b910109e9037bbb732b960691b604482015290519081900360640190fd5b61193b82612273565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b7f000000000000000000000000000000000000000000000000000000000000000081565b60606000805b611ed1600d612ad1565b8111611ef457611ee08161161d565b15611eec576001909101905b600101611ec7565b508067ffffffffffffffff81118015611f0c57600080fd5b50604051908082528060200260200182016040528015611f36578160200160208202803683370190505b5091506000805b611f47600d612ad1565b8111611f9157611f568161161d565b15611f7a5780848381518110611f6857fe5b60209081029190910101526001909101905b828210611f8957505050610d10565b600101611f3d565b50505090565b611f9f6123ee565b6001600160a01b0316611fb061173b565b6001600160a01b031614611ff9576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b6001600160a01b03811661203e5760405162461bcd60e51b8152600401808060200182810382526026815260200180613f436026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6012602052600090815260409020805460019091015460ff82169161010081046001600160a01b031691600160a81b9091046001600160581b03169065ffffffffffff80821691600160301b90041685565b600082821115612143576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b8015806121cf575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156121a157600080fd5b505afa1580156121b5573d6000803e3d6000fd5b505050506040513d60208110156121cb57600080fd5b5051155b61220a5760405162461bcd60e51b81526004018080602001828103825260368152602001806141cd6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610f6d908490612ad5565b606061226b8484600085612b86565b949350505050565b6000818152601260205260408120805461010090046001600160a01b03169190826122df576040805162461bcd60e51b8152602060048201526017602482015276085d1bdad95b92590b591bd95ccb5b9bdd0b595e1a5cdd604a1b604482015290519081900360640190fd5b805460ff1661232f576040805162461bcd60e51b8152602060048201526017602482015276085d1bdad95b92590b591bd95ccb5b9bdd0b595e1a5cdd604a1b604482015290519081900360640190fd5b600080600061233e8787612cd7565b92509250925061234d876123e1565b1561235b5761235b87612de2565b835460ff1916845561236d8683612eaf565b8294508663ffffffff16866001600160a01b03167f659603c537707823d3be763a1df310e3b687e0a143450b8e809b37e0557322c9838660405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390a350505050915091565b3b151590565b6000610e2f600283612f4a565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061242782611347565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156124bc57600080fd5b505afa1580156124d0573d6000803e3d6000fd5b505050506040513d60a08110156124e657600080fd5b506020015191505090565b6000610e2f82612ad1565b6000612507826123e1565b6125425760405162461bcd60e51b815260040180806020018281038252602c815260200180613fb3602c913960400191505060405180910390fd5b600061254d83611347565b9050806001600160a01b0316846001600160a01b031614806125885750836001600160a01b031661257d84610e35565b6001600160a01b0316145b8061226b575061226b8185611e6f565b826001600160a01b03166125ab82611347565b6001600160a01b0316146125f05760405162461bcd60e51b81526004018080602001828103825260298152602001806140f96029913960400191505060405180910390fd5b6001600160a01b0382166126355760405162461bcd60e51b8152600401808060200182810382526024815260200180613f696024913960400191505060405180910390fd5b612640838383612f56565b61264b6000826123f2565b6001600160a01b038316600090815260016020526040902061266d9082613013565b506001600160a01b0382166000908152600160205260409020612690908261301f565b5061269d6002828461302b565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006110dc8383613041565b60008080806126ff86866130a5565b9097909650945050505050565b600061226b848484613120565b6000612725600d6131ea565b61272f600d612ad1565b9050600061273b612460565b600e546040805163102cffa160e21b8152600481018b9052602481018c90526044810184905290519293506000926001600160a01b03909216916340b3fe8491606480820192602092909190829003018186803b15801561279b57600080fd5b505afa1580156127af573d6000803e3d6000fd5b505050506040513d60208110156127c557600080fd5b5051905085156127da576127da338a836131f3565b6127e983828a8c868c8a613302565b84156127f9576127f987846128c8565b604080516001600160581b0380841682528b16602082015265ffffffffffff841681830152428a0163ffffffff90811660608301529151918516916001600160a01b038a16917f2de7f4b26a79590e7f51ba673e3ba629a98c8aa1904d7873f0286134b52a4a96919081900360800190a350509695505050505050565b612881848484612598565b61288d848484846136f8565b61193b5760405162461bcd60e51b8152600401808060200182810382526032815260200180613f116032913960400191505060405180910390fd5b6001600160a01b038216612923576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61292c816123e1565b1561297e576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b61298a60008383612f56565b6001600160a01b03821660009081526001602052604090206129ac908261301f565b506129b96002828461302b565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b606081612a1b57506040805180820190915260018152600360fc1b6020820152610c77565b8160005b8115612a3357600101600a82049150612a1f565b60608167ffffffffffffffff81118015612a4c57600080fd5b506040519080825280601f01601f191660200182016040528015612a77576020820181803683370190505b50859350905060001982015b8315612ac857600a840660300160f81b82828060019003935081518110612aa657fe5b60200101906001600160f81b031916908160001a905350600a84049350612a83565b50949350505050565b5490565b6060612b2a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661225c9092919063ffffffff16565b805190915015610f6d57808060200190516020811015612b4957600080fd5b5051610f6d5760405162461bcd60e51b815260040180806020018281038252602a8152602001806141a3602a913960400191505060405180910390fd5b606082471015612bc75760405162461bcd60e51b8152600401808060200182810382526026815260200180613f8d6026913960400191505060405180910390fd5b612bd0856123db565b612c21576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612c605780518252601f199092019160209182019101612c41565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612cc2576040519150601f19603f3d011682016040523d82523d6000602084013e612cc7565b606091505b5091509150611452828286613860565b60008281526012602052604081208054600160a81b90046001600160581b0316908290612d02612460565b60018201549092504265ffffffffffff9091161015612da2577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636198e339876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612d8157600080fd5b505af1158015612d95573d6000803e3d6000fd5b5050505060009350612dda565b60018101548154612dd79187918991600160301b900465ffffffffffff1690600160a81b90046001600160581b0316866138c6565b93505b509250925092565b6000612ded82611347565b9050612dfb81600084612f56565b612e066000836123f2565b6000828152600860205260409020546002600019610100600184161502019091160415612e44576000828152600860205260408120612e4491613e96565b6001600160a01b0381166000908152600160205260409020612e669083613013565b50612e72600283613aaf565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60145460408051632e1a7d4d60e01b81526004810184905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b158015612efc57600080fd5b505af1158015612f10573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f19350505050158015610f6d573d6000803e3d6000fd5b60006110dc8383613abb565b6001600160a01b03831615801590612f7657506001600160a01b03821615155b15610f6d576000818152601260205260409020546001600160a01b038481166101009092041614612fe0576040805162461bcd60e51b815260206004820152600f60248201526e217374682d77656e742d77726f6e6760881b604482015290519081900360640190fd5b600081815260126020526040902080546001600160a01b03841661010002610100600160a81b0319909116179055505050565b60006110dc8383613ad3565b60006110dc8383613b99565b600061226b84846001600160a01b038516613be3565b815460009082106130835760405162461bcd60e51b8152600401808060200182810382526022815260200180613eef6022913960400191505060405180910390fd5b82600001828154811061309257fe5b9060005260206000200154905092915050565b8154600090819083106130e95760405162461bcd60e51b815260040180806020018281038252602281526020018061406a6022913960400191505060405180910390fd5b60008460000184815481106130fa57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816131bb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613180578181015183820152602001613168565b50505050905090810190601f1680156131ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b508460000160018203815481106131ce57fe5b9060005260206000209060020201600101549150509392505050565b80546001019055565b346131fe8383613c7a565b811015613241576040805162461bcd60e51b815260206004820152600c60248201526b2177726f6e672076616c756560a01b604482015290519081900360640190fd5b61324b8383613c7a565b81111561329d576001600160a01b0384166108fc61327361326c8686613c7a565b84906120ec565b6040518115909202916000818181858888f1935050505015801561329b573d6000803e3d6000fd5b505b6014546001600160a01b031663d0e30db06132b88585613c7a565b6040518263ffffffff1660e01b81526004016000604051808303818588803b1580156132e357600080fd5b505af11580156132f7573d6000803e3d6000fd5b505050505050505050565b60006133527f000000000000000000000000000000000000000000000000000000000000000061334c606461334c600b546133468a8c613cd490919063ffffffff16565b90613cd4565b90613d2d565b90506040518060a00160405280600115158152602001846001600160a01b03168152602001866001600160581b0316815260200187420165ffffffffffff1681526020018565ffffffffffff16815250601260008a815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160000160156101000a8154816001600160581b0302191690836001600160581b0316021790555060608201518160010160006101000a81548165ffffffffffff021916908365ffffffffffff16021790555060808201518160010160066101000a81548165ffffffffffff021916908365ffffffffffff1602179055509050506060600f60009054906101000a90046001600160a01b03166001600160a01b03166338ed17398985600c7f0000000000000000000000000000000000000000000000000000000000000000426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818154815260200191508054801561355357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613535575b50509650505050505050600060405180830381600087803b15801561357757600080fd5b505af115801561358b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156135b457600080fd5b81019080805160405193929190846401000000008211156135d457600080fd5b9083019060208201858111156135e957600080fd5b825186602082028301116401000000008211171561360657600080fd5b82525081516020918201928201910280838360005b8381101561363357818101518382015260200161361b565b50505050905001604052505050905060008160018351038151811061365457fe5b602002602001015190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663edd0d4218b85846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156136d457600080fd5b505af11580156136e8573d6000803e3d6000fd5b5050505050505050505050505050565b600061370c846001600160a01b03166123db565b6137185750600161226b565b6060613826630a85bd0160e11b61372d6123ee565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561379457818101518382015260200161377c565b50505050905090810190601f1680156137c15780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001613f11603291396001600160a01b038816919061225c565b9050600081806020019051602081101561383f57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6060831561386f5750816110dc565b82511561387f5782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315613180578181015183820152602001613168565b60008184116138d75750600061390c565b6139097f000000000000000000000000000000000000000000000000000000000000000061334c8561334688876120ec565b90505b6000613917336123db565b61392257600061392f565b6010546001600160a01b03165b905060006001600160a01b0382166139485760006139ae565b816001600160a01b0316637e7c60c66040518163ffffffff1660e01b815260040160206040518083038186803b15801561398157600080fd5b505afa158015613995573d6000803e3d6000fd5b505050506040513d60208110156139ab57600080fd5b50515b905082811115613a05576040805162461bcd60e51b815260206004820152601a60248201527f216b65657033722d7265717565737465642d746f6f2d6d756368000000000000604482015290519081900360640190fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a134ce5b888a86856040518563ffffffff1660e01b815260040180858152602001846001600160a01b03168152602001838152602001828152602001945050505050600060405180830381600087803b158015613a8c57600080fd5b505af1158015613aa0573d6000803e3d6000fd5b50505050505095945050505050565b60006110dc8383613d94565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015613b8f5783546000198083019190810190600090879083908110613b0657fe5b9060005260206000200154905080876000018481548110613b2357fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080613b5357fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610e2f565b6000915050610e2f565b6000613ba58383613abb565b613bdb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e2f565b506000610e2f565b600082815260018401602052604081205480613c485750506040805180820182528381526020808201848152865460018181018955600089815284812095516002909302909501918255915190820155865486845281880190925292909120556110dc565b82856000016001830381548110613c5b57fe5b90600052602060002090600202016001018190555060009150506110dc565b6000828201838110156110dc576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082613ce357506000610e2f565b82820282848281613cf057fe5b04146110dc5760405162461bcd60e51b815260040180806020018281038252602181526020018061408c6021913960400191505060405180910390fd5b6000808211613d83576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381613d8c57fe5b049392505050565b60008181526001830160205260408120548015613b8f5783546000198083019190810190600090879083908110613dc757fe5b9060005260206000209060020201905080876000018481548110613de757fe5b600091825260208083208454600290930201918255600193840154918401919091558354825289830190526040902090840190558654879080613e2657fe5b6000828152602080822060026000199094019384020182815560019081018390559290935588815289820190925260408220919091559450610e2f9350505050565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b50805460018160011615610100020316600290046000825580601f10613ebc575061126b565b601f01602090049060005260206000209081019061126b91905b80821115613eea5760008155600101613ed6565b509056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665645361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212207758d89d239779b75e90477543ae96e94afba734e90d34e5e58addbf48dbd11364736f6c634300060c0033416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419000000000000000000000000da0606037834f4279dc590434231f1e01c4686290000000000000000000000003d079e3c861ed7d2944400a2c9916702fdbd26ee

Deployed Bytecode

0x6080604052600436106102815760003560e01c8063715018a61161014f578063c31c9c07116100c1578063de0e9a3e1161007a578063de0e9a3e14610ad5578063e985e9c514610aff578063e9cbd82214610b3a578063f1fa916c14610b4f578063f2fde38b14610bb4578063f8fdeb6814610be757610288565b8063c31c9c07146109b5578063c3c64674146109ca578063c634d03214610a05578063c87b56dd14610a2f578063d5a8776514610a59578063daddef3014610aa257610288565b80638da5cb5b116101135780638da5cb5b1461085357806395d89b4114610868578063a22cb4651461087d578063ad5c4648146108b8578063b888879e146108cd578063b88d4fde146108e257610288565b8063715018a6146107a2578063767c6e3c146107b757806380dd9a1f146107e15780638552ea41146108145780638d5cd1ca1461082957610288565b8063302ce651116101f35780635aebbac7116101ac5780635aebbac71461069b578063634c7bb5146106ce5780636352211e146106e357806366b2a9481461070d5780636c0360eb1461075a57806370a082311461076f57610288565b8063302ce6511461052d5780633b0199fe1461054257806341273657146105c857806342842e0e146105fb5780634cc18e571461063e5780634f6ccce71461067157610288565b80630edd61c0116102455780630edd61c01461042b57806311a1db7d1461045b57806316f0115b1461048757806318160ddd1461049c57806323b872dd146104b15780632f745c59146104f457610288565b806301ffc9a71461028d57806306fdde03146102d5578063072888e71461035f578063081812fc146103aa578063095ea7b3146103f057610288565b3661028857005b600080fd5b34801561029957600080fd5b506102c1600480360360208110156102b057600080fd5b50356001600160e01b031916610c59565b604080519115158252519081900360200190f35b3480156102e157600080fd5b506102ea610c7c565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561032457818101518382015260200161030c565b50505050905090810190601f1680156103515780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561036b57600080fd5b506103986004803603604081101561038257600080fd5b50803590602001356001600160a01b0316610d13565b60408051918252519081900360200190f35b3480156103b657600080fd5b506103d4600480360360208110156103cd57600080fd5b5035610e35565b604080516001600160a01b039092168252519081900360200190f35b3480156103fc57600080fd5b506104296004803603604081101561041357600080fd5b506001600160a01b038135169060200135610e97565b005b34801561043757600080fd5b506103986004803603604081101561044e57600080fd5b5080359060200135610f72565b34801561046757600080fd5b506104296004803603602081101561047e57600080fd5b5035151561100e565b34801561049357600080fd5b506103d461102e565b3480156104a857600080fd5b50610398611052565b3480156104bd57600080fd5b50610429600480360360608110156104d457600080fd5b506001600160a01b03813581169160208101359091169060400135611063565b34801561050057600080fd5b506103986004803603604081101561051757600080fd5b506001600160a01b0381351690602001356110ba565b34801561053957600080fd5b506103986110e3565b34801561054e57600080fd5b506103986004803603604081101561056557600080fd5b81019060208101813564010000000081111561058057600080fd5b82018360208201111561059257600080fd5b803590602001918460208302840111640100000000831117156105b457600080fd5b9193509150356001600160a01b03166110e9565b3480156105d457600080fd5b50610429600480360360208110156105eb57600080fd5b50356001600160a01b03166111e3565b34801561060757600080fd5b506104296004803603606081101561061e57600080fd5b506001600160a01b0381358116916020810135909116906040013561126e565b34801561064a57600080fd5b506104296004803603602081101561066157600080fd5b50356001600160a01b0316611289565b34801561067d57600080fd5b506103986004803603602081101561069457600080fd5b503561130d565b3480156106a757600080fd5b506102c1600480360360208110156106be57600080fd5b50356001600160a01b0316611323565b3480156106da57600080fd5b506103d4611338565b3480156106ef57600080fd5b506103d46004803603602081101561070657600080fd5b5035611347565b34801561071957600080fd5b50610398600480360360a081101561073057600080fd5b508035906020810135906001600160a01b036040820135169060608101351515906080013561136f565b34801561076657600080fd5b506102ea61145d565b34801561077b57600080fd5b506103986004803603602081101561079257600080fd5b50356001600160a01b03166114be565b3480156107ae57600080fd5b50610429611526565b3480156107c357600080fd5b506103d4600480360360208110156107da57600080fd5b50356115d2565b3480156107ed57600080fd5b506102c16004803603602081101561080457600080fd5b50356001600160a01b03166115f9565b34801561082057600080fd5b506103d461160e565b34801561083557600080fd5b506102c16004803603602081101561084c57600080fd5b503561161d565b34801561085f57600080fd5b506103d461173b565b34801561087457600080fd5b506102ea61174a565b34801561088957600080fd5b50610429600480360360408110156108a057600080fd5b506001600160a01b03813516906020013515156117ab565b3480156108c457600080fd5b506103d46118b0565b3480156108d957600080fd5b506103d46118bf565b3480156108ee57600080fd5b506104296004803603608081101561090557600080fd5b6001600160a01b0382358116926020810135909116916040820135919081019060808101606082013564010000000081111561094057600080fd5b82018360208201111561095257600080fd5b8035906020019184600183028401116401000000008311171561097457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506118e3945050505050565b3480156109c157600080fd5b506103d4611941565b3480156109d657600080fd5b50610429600480360360408110156109ed57600080fd5b506001600160a01b0381351690602001351515611950565b348015610a1157600080fd5b5061042960048036036020811015610a2857600080fd5b50356119dd565b348015610a3b57600080fd5b506102ea60048036036020811015610a5257600080fd5b5035611a64565b610398600480360360a0811015610a6f57600080fd5b506001600160801b03813516906020810135906001600160a01b0360408201351690606081013515159060800135611ce7565b348015610aae57600080fd5b5061042960048036036020811015610ac557600080fd5b50356001600160a01b0316611d0b565b348015610ae157600080fd5b5061042960048036036020811015610af857600080fd5b5035611dfe565b348015610b0b57600080fd5b506102c160048036036040811015610b2257600080fd5b506001600160a01b0381358116916020013516611e6f565b348015610b4657600080fd5b506103d4611e9d565b348015610b5b57600080fd5b50610b64611ec1565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610ba0578181015183820152602001610b88565b505050509050019250505060405180910390f35b348015610bc057600080fd5b5061042960048036036020811015610bd757600080fd5b50356001600160a01b0316611f97565b348015610bf357600080fd5b50610c1160048036036020811015610c0a57600080fd5b503561209a565b6040805195151586526001600160a01b0390941660208601526001600160581b039092168484015265ffffffffffff9081166060850152166080830152519081900360a00190f35b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d085780601f10610cdd57610100808354040283529160200191610d08565b820191906000526020600020905b815481529060010190602001808311610ceb57829003601f168201915b505050505090505b90565b6000610d1e8361161d565b610d61576040805162461bcd60e51b815260206004820152600f60248201526e216e6f742d756e7772617061626c6560881b604482015290519081900360640190fd5b610d6a83612273565b50610d769050336123db565b8015610d8c57506010546001600160a01b031633145b15610e2f577f000000000000000000000000da0606037834f4279dc590434231f1e01c4686296001600160a01b031663ba9100c9836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b158015610e0057600080fd5b505af1158015610e14573d6000803e3d6000fd5b505050506040513d6020811015610e2a57600080fd5b505190505b92915050565b6000610e40826123e1565b610e7b5760405162461bcd60e51b815260040180806020018281038252602c8152602001806140ad602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610ea282611347565b9050806001600160a01b0316836001600160a01b03161415610ef55760405162461bcd60e51b81526004018080602001828103825260218152602001806141516021913960400191505060405180910390fd5b806001600160a01b0316610f076123ee565b6001600160a01b03161480610f285750610f2881610f236123ee565b611e6f565b610f635760405162461bcd60e51b8152600401808060200182810382526038815260200180613fdf6038913960400191505060405180910390fd5b610f6d83836123f2565b505050565b600080610f7d612460565b600e546040805163102cffa160e21b815260048101879052602481018890526044810184905290519293506001600160a01b03909116916340b3fe8491606480820192602092909190829003018186803b158015610fda57600080fd5b505afa158015610fee573d6000803e3d6000fd5b505050506040513d602081101561100457600080fd5b5051949350505050565b336000908152601360205260409020805460ff1916911515919091179055565b7f000000000000000000000000da0606037834f4279dc590434231f1e01c46862981565b600061105e60026124f1565b905090565b61107461106e6123ee565b826124fc565b6110af5760405162461bcd60e51b81526004018080602001828103825260318152602001806141726031913960400191505060405180910390fd5b610f6d838383612598565b6001600160a01b03821660009081526001602052604081206110dc90836126e4565b9392505050565b600b5481565b6000805b8381101561113b5761111085858381811061110457fe5b9050602002013561161d565b156111335761113085858381811061112457fe5b90506020020135612273565b50505b6001016110ed565b50611145336123db565b801561115b57506010546001600160a01b031633145b156110dc577f000000000000000000000000da0606037834f4279dc590434231f1e01c4686296001600160a01b031663ba9100c9836040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050602060405180830381600087803b1580156111cf57600080fd5b505af1158015610fee573d6000803e3d6000fd5b6111eb6123ee565b6001600160a01b03166111fc61173b565b6001600160a01b031614611245576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b03831617905561126b816001611950565b50565b610f6d838383604051806020016040528060008152506118e3565b6112916123ee565b6001600160a01b03166112a261173b565b6001600160a01b0316146112eb576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60008061131b6002846126f0565b509392505050565b60136020526000908152604090205460ff1681565b6010546001600160a01b031681565b6000610e2f82604051806060016040528060298152602001614041602991396002919061270c565b3360009081526011602052604081205460ff166113c2576040805162461bcd60e51b815260206004820152600c60248201526b085b9bdd08185b1b1bddd95960a21b604482015290519081900360640190fd5b600e546040805163274be9fd60e01b8152600481018990526024810188905290516000926001600160a01b03169163274be9fd916044808301926020929190829003018186803b15801561141557600080fd5b505afa158015611429573d6000803e3d6000fd5b505050506040513d602081101561143f57600080fd5b5051905061145281878760008888612719565b979650505050505050565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d085780601f10610cdd57610100808354040283529160200191610d08565b60006001600160a01b0382166115055760405162461bcd60e51b815260040180806020018281038252602a815260200180614017602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610e2f906124f1565b61152e6123ee565b6001600160a01b031661153f61173b565b6001600160a01b031614611588576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600c81815481106115df57fe5b6000918252602090912001546001600160a01b0316905081565b60116020526000908152604090205460ff1681565b600e546001600160a01b031681565b6000611627613e68565b506000828152601260209081526040808320815160a081018352815460ff8082161515835261010082046001600160a01b0316838701819052600160a81b9092046001600160581b03168386015260019093015465ffffffffffff8082166060850152600160301b90910416608083015285526013909352922054909116156116b4576000915050610c77565b80516116c4576000915050610c77565b6000806116cf612460565b9050826080015165ffffffffffff168110915081801561171f5750606083015142906117059065ffffffffffff166107086120ec565b1115801561171f575042836060015165ffffffffffff1610155b156117305760019350505050610c77565b506000949350505050565b600a546001600160a01b031690565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d085780601f10610cdd57610100808354040283529160200191610d08565b6117b36123ee565b6001600160a01b0316826001600160a01b03161415611819576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b80600560006118266123ee565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561186a6123ee565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6014546001600160a01b031681565b7f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841981565b6118f46118ee6123ee565b836124fc565b61192f5760405162461bcd60e51b81526004018080602001828103825260318152602001806141726031913960400191505060405180910390fd5b61193b84848484612876565b50505050565b600f546001600160a01b031681565b6119586123ee565b6001600160a01b031661196961173b565b6001600160a01b0316146119b2576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b60008181526012602052604090205460ff168015611a16575060008181526012602052604090205461010090046001600160a01b031633145b611a5a576040805162461bcd60e51b815260206004820152601060248201526f216e6f742d746f6b656e697a61626c6560801b604482015290519081900360640190fd5b61126b33826128c8565b6060611a6f826123e1565b611aaa5760405162461bcd60e51b815260040180806020018281038252602f815260200180614122602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f6002600019610100600186161502019093169290920491820184900484028101840190945280845260609392830182828015611b3f5780601f10611b1457610100808354040283529160200191611b3f565b820191906000526020600020905b815481529060010190602001808311611b2257829003601f168201915b505050505090506060611b5061145d565b9050805160001415611b6457509050610c77565b815115611c255780826040516020018083805190602001908083835b60208310611b9f5780518252601f199092019160209182019101611b80565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310611be75780518252601f199092019160209182019101611bc8565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050610c77565b80611c2f856129f6565b6040516020018083805190602001908083835b60208310611c615780518252601f199092019160209182019101611c42565b51815160209384036101000a600019018019909216911617905285519190930192850191508083835b60208310611ca95780518252601f199092019160209182019101611c8a565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405292505050919050565b6000611d01866001600160801b0316868660018787612719565b9695505050505050565b611d136123ee565b6001600160a01b0316611d2461173b565b6001600160a01b031614611d6d576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b806001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611da657600080fd5b505afa158015611dba573d6000803e3d6000fd5b505050506040513d6020811015611dd057600080fd5b5051601480546001600160a01b0319166001600160a01b03928316179081905561126b911682600019612149565b600081815260126020526040902054819061010090046001600160a01b03163314611e66576040805162461bcd60e51b815260206004820152601360248201527236b9b39739b2b73232b910109e9037bbb732b960691b604482015290519081900360640190fd5b61193b82612273565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b60606000805b611ed1600d612ad1565b8111611ef457611ee08161161d565b15611eec576001909101905b600101611ec7565b508067ffffffffffffffff81118015611f0c57600080fd5b50604051908082528060200260200182016040528015611f36578160200160208202803683370190505b5091506000805b611f47600d612ad1565b8111611f9157611f568161161d565b15611f7a5780848381518110611f6857fe5b60209081029190910101526001909101905b828210611f8957505050610d10565b600101611f3d565b50505090565b611f9f6123ee565b6001600160a01b0316611fb061173b565b6001600160a01b031614611ff9576040805162461bcd60e51b815260206004820181905260248201526000805160206140d9833981519152604482015290519081900360640190fd5b6001600160a01b03811661203e5760405162461bcd60e51b8152600401808060200182810382526026815260200180613f436026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6012602052600090815260409020805460019091015460ff82169161010081046001600160a01b031691600160a81b9091046001600160581b03169065ffffffffffff80821691600160301b90041685565b600082821115612143576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b8015806121cf575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156121a157600080fd5b505afa1580156121b5573d6000803e3d6000fd5b505050506040513d60208110156121cb57600080fd5b5051155b61220a5760405162461bcd60e51b81526004018080602001828103825260368152602001806141cd6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610f6d908490612ad5565b606061226b8484600085612b86565b949350505050565b6000818152601260205260408120805461010090046001600160a01b03169190826122df576040805162461bcd60e51b8152602060048201526017602482015276085d1bdad95b92590b591bd95ccb5b9bdd0b595e1a5cdd604a1b604482015290519081900360640190fd5b805460ff1661232f576040805162461bcd60e51b8152602060048201526017602482015276085d1bdad95b92590b591bd95ccb5b9bdd0b595e1a5cdd604a1b604482015290519081900360640190fd5b600080600061233e8787612cd7565b92509250925061234d876123e1565b1561235b5761235b87612de2565b835460ff1916845561236d8683612eaf565b8294508663ffffffff16866001600160a01b03167f659603c537707823d3be763a1df310e3b687e0a143450b8e809b37e0557322c9838660405180836001600160801b03168152602001826001600160801b031681526020019250505060405180910390a350505050915091565b3b151590565b6000610e2f600283612f4a565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061242782611347565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000807f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b84196001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156124bc57600080fd5b505afa1580156124d0573d6000803e3d6000fd5b505050506040513d60a08110156124e657600080fd5b506020015191505090565b6000610e2f82612ad1565b6000612507826123e1565b6125425760405162461bcd60e51b815260040180806020018281038252602c815260200180613fb3602c913960400191505060405180910390fd5b600061254d83611347565b9050806001600160a01b0316846001600160a01b031614806125885750836001600160a01b031661257d84610e35565b6001600160a01b0316145b8061226b575061226b8185611e6f565b826001600160a01b03166125ab82611347565b6001600160a01b0316146125f05760405162461bcd60e51b81526004018080602001828103825260298152602001806140f96029913960400191505060405180910390fd5b6001600160a01b0382166126355760405162461bcd60e51b8152600401808060200182810382526024815260200180613f696024913960400191505060405180910390fd5b612640838383612f56565b61264b6000826123f2565b6001600160a01b038316600090815260016020526040902061266d9082613013565b506001600160a01b0382166000908152600160205260409020612690908261301f565b5061269d6002828461302b565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b60006110dc8383613041565b60008080806126ff86866130a5565b9097909650945050505050565b600061226b848484613120565b6000612725600d6131ea565b61272f600d612ad1565b9050600061273b612460565b600e546040805163102cffa160e21b8152600481018b9052602481018c90526044810184905290519293506000926001600160a01b03909216916340b3fe8491606480820192602092909190829003018186803b15801561279b57600080fd5b505afa1580156127af573d6000803e3d6000fd5b505050506040513d60208110156127c557600080fd5b5051905085156127da576127da338a836131f3565b6127e983828a8c868c8a613302565b84156127f9576127f987846128c8565b604080516001600160581b0380841682528b16602082015265ffffffffffff841681830152428a0163ffffffff90811660608301529151918516916001600160a01b038a16917f2de7f4b26a79590e7f51ba673e3ba629a98c8aa1904d7873f0286134b52a4a96919081900360800190a350509695505050505050565b612881848484612598565b61288d848484846136f8565b61193b5760405162461bcd60e51b8152600401808060200182810382526032815260200180613f116032913960400191505060405180910390fd5b6001600160a01b038216612923576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61292c816123e1565b1561297e576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b61298a60008383612f56565b6001600160a01b03821660009081526001602052604090206129ac908261301f565b506129b96002828461302b565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b606081612a1b57506040805180820190915260018152600360fc1b6020820152610c77565b8160005b8115612a3357600101600a82049150612a1f565b60608167ffffffffffffffff81118015612a4c57600080fd5b506040519080825280601f01601f191660200182016040528015612a77576020820181803683370190505b50859350905060001982015b8315612ac857600a840660300160f81b82828060019003935081518110612aa657fe5b60200101906001600160f81b031916908160001a905350600a84049350612a83565b50949350505050565b5490565b6060612b2a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661225c9092919063ffffffff16565b805190915015610f6d57808060200190516020811015612b4957600080fd5b5051610f6d5760405162461bcd60e51b815260040180806020018281038252602a8152602001806141a3602a913960400191505060405180910390fd5b606082471015612bc75760405162461bcd60e51b8152600401808060200182810382526026815260200180613f8d6026913960400191505060405180910390fd5b612bd0856123db565b612c21576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612c605780518252601f199092019160209182019101612c41565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612cc2576040519150601f19603f3d011682016040523d82523d6000602084013e612cc7565b606091505b5091509150611452828286613860565b60008281526012602052604081208054600160a81b90046001600160581b0316908290612d02612460565b60018201549092504265ffffffffffff9091161015612da2577f000000000000000000000000da0606037834f4279dc590434231f1e01c4686296001600160a01b0316636198e339876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612d8157600080fd5b505af1158015612d95573d6000803e3d6000fd5b5050505060009350612dda565b60018101548154612dd79187918991600160301b900465ffffffffffff1690600160a81b90046001600160581b0316866138c6565b93505b509250925092565b6000612ded82611347565b9050612dfb81600084612f56565b612e066000836123f2565b6000828152600860205260409020546002600019610100600184161502019091160415612e44576000828152600860205260408120612e4491613e96565b6001600160a01b0381166000908152600160205260409020612e669083613013565b50612e72600283613aaf565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60145460408051632e1a7d4d60e01b81526004810184905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b158015612efc57600080fd5b505af1158015612f10573d6000803e3d6000fd5b50506040516001600160a01b038516925083156108fc02915083906000818181858888f19350505050158015610f6d573d6000803e3d6000fd5b60006110dc8383613abb565b6001600160a01b03831615801590612f7657506001600160a01b03821615155b15610f6d576000818152601260205260409020546001600160a01b038481166101009092041614612fe0576040805162461bcd60e51b815260206004820152600f60248201526e217374682d77656e742d77726f6e6760881b604482015290519081900360640190fd5b600081815260126020526040902080546001600160a01b03841661010002610100600160a81b0319909116179055505050565b60006110dc8383613ad3565b60006110dc8383613b99565b600061226b84846001600160a01b038516613be3565b815460009082106130835760405162461bcd60e51b8152600401808060200182810382526022815260200180613eef6022913960400191505060405180910390fd5b82600001828154811061309257fe5b9060005260206000200154905092915050565b8154600090819083106130e95760405162461bcd60e51b815260040180806020018281038252602281526020018061406a6022913960400191505060405180910390fd5b60008460000184815481106130fa57fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816131bb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613180578181015183820152602001613168565b50505050905090810190601f1680156131ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b508460000160018203815481106131ce57fe5b9060005260206000209060020201600101549150509392505050565b80546001019055565b346131fe8383613c7a565b811015613241576040805162461bcd60e51b815260206004820152600c60248201526b2177726f6e672076616c756560a01b604482015290519081900360640190fd5b61324b8383613c7a565b81111561329d576001600160a01b0384166108fc61327361326c8686613c7a565b84906120ec565b6040518115909202916000818181858888f1935050505015801561329b573d6000803e3d6000fd5b505b6014546001600160a01b031663d0e30db06132b88585613c7a565b6040518263ffffffff1660e01b81526004016000604051808303818588803b1580156132e357600080fd5b505af11580156132f7573d6000803e3d6000fd5b505050505050505050565b60006133527f0000000000000000000000000000000000000000000000056bc75e2d6310000061334c606461334c600b546133468a8c613cd490919063ffffffff16565b90613cd4565b90613d2d565b90506040518060a00160405280600115158152602001846001600160a01b03168152602001866001600160581b0316815260200187420165ffffffffffff1681526020018565ffffffffffff16815250601260008a815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160000160156101000a8154816001600160581b0302191690836001600160581b0316021790555060608201518160010160006101000a81548165ffffffffffff021916908365ffffffffffff16021790555060808201518160010160066101000a81548165ffffffffffff021916908365ffffffffffff1602179055509050506060600f60009054906101000a90046001600160a01b03166001600160a01b03166338ed17398985600c7f000000000000000000000000da0606037834f4279dc590434231f1e01c468629426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818154815260200191508054801561355357602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613535575b50509650505050505050600060405180830381600087803b15801561357757600080fd5b505af115801561358b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260208110156135b457600080fd5b81019080805160405193929190846401000000008211156135d457600080fd5b9083019060208201858111156135e957600080fd5b825186602082028301116401000000008211171561360657600080fd5b82525081516020918201928201910280838360005b8381101561363357818101518382015260200161361b565b50505050905001604052505050905060008160018351038151811061365457fe5b602002602001015190507f000000000000000000000000da0606037834f4279dc590434231f1e01c4686296001600160a01b031663edd0d4218b85846040518463ffffffff1660e01b8152600401808481526020018381526020018281526020019350505050600060405180830381600087803b1580156136d457600080fd5b505af11580156136e8573d6000803e3d6000fd5b5050505050505050505050505050565b600061370c846001600160a01b03166123db565b6137185750600161226b565b6060613826630a85bd0160e11b61372d6123ee565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561379457818101518382015260200161377c565b50505050905090810190601f1680156137c15780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001613f11603291396001600160a01b038816919061225c565b9050600081806020019051602081101561383f57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6060831561386f5750816110dc565b82511561387f5782518084602001fd5b60405162461bcd60e51b8152602060048201818152845160248401528451859391928392604401919085019080838360008315613180578181015183820152602001613168565b60008184116138d75750600061390c565b6139097f0000000000000000000000000000000000000000000000056bc75e2d6310000061334c8561334688876120ec565b90505b6000613917336123db565b61392257600061392f565b6010546001600160a01b03165b905060006001600160a01b0382166139485760006139ae565b816001600160a01b0316637e7c60c66040518163ffffffff1660e01b815260040160206040518083038186803b15801561398157600080fd5b505afa158015613995573d6000803e3d6000fd5b505050506040513d60208110156139ab57600080fd5b50515b905082811115613a05576040805162461bcd60e51b815260206004820152601a60248201527f216b65657033722d7265717565737465642d746f6f2d6d756368000000000000604482015290519081900360640190fd5b7f000000000000000000000000da0606037834f4279dc590434231f1e01c4686296001600160a01b031663a134ce5b888a86856040518563ffffffff1660e01b815260040180858152602001846001600160a01b03168152602001838152602001828152602001945050505050600060405180830381600087803b158015613a8c57600080fd5b505af1158015613aa0573d6000803e3d6000fd5b50505050505095945050505050565b60006110dc8383613d94565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015613b8f5783546000198083019190810190600090879083908110613b0657fe5b9060005260206000200154905080876000018481548110613b2357fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080613b5357fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610e2f565b6000915050610e2f565b6000613ba58383613abb565b613bdb57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e2f565b506000610e2f565b600082815260018401602052604081205480613c485750506040805180820182528381526020808201848152865460018181018955600089815284812095516002909302909501918255915190820155865486845281880190925292909120556110dc565b82856000016001830381548110613c5b57fe5b90600052602060002090600202016001018190555060009150506110dc565b6000828201838110156110dc576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082613ce357506000610e2f565b82820282848281613cf057fe5b04146110dc5760405162461bcd60e51b815260040180806020018281038252602181526020018061408c6021913960400191505060405180910390fd5b6000808211613d83576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b818381613d8c57fe5b049392505050565b60008181526001830160205260408120548015613b8f5783546000198083019190810190600090879083908110613dc757fe5b9060005260206000209060020201905080876000018481548110613de757fe5b600091825260208083208454600290930201918255600193840154918401919091558354825289830190526040902090840190558654879080613e2657fe5b6000828152602080822060026000199094019384020182815560019081018390559290935588815289820190925260408220919091559450610e2f9350505050565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b50805460018160011615610100020316600290046000825580601f10613ebc575061126b565b601f01602090049060005260206000209081019061126b91905b80821115613eea5760008155600101613ed6565b509056fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665645361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a26469706673582212207758d89d239779b75e90477543ae96e94afba734e90d34e5e58addbf48dbd11364736f6c634300060c0033

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

0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419000000000000000000000000da0606037834f4279dc590434231f1e01c4686290000000000000000000000003d079e3c861ed7d2944400a2c9916702fdbd26ee

-----Decoded View---------------
Arg [0] : _swapRouter (address): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
Arg [1] : _stablecoin (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [2] : _priceProvider (address): 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
Arg [3] : _pool (address): 0xda0606037834f4279Dc590434231F1E01C468629
Arg [4] : _whiteOptionsPricer (address): 0x3d079E3C861eD7d2944400A2c9916702FdbD26eE

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Arg [1] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [2] : 0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419
Arg [3] : 000000000000000000000000da0606037834f4279dc590434231f1e01c468629
Arg [4] : 0000000000000000000000003d079e3c861ed7d2944400a2c9916702fdbd26ee


Deployed Bytecode Sourcemap

370:2502:56:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;965:148:2;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;965:148:2;-1:-1:-1;;;;;;965:148:2;;:::i;:::-;;;;;;;;;;;;;;;;;;4517:98:9;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7174:305:57;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7174:305:57;;;;;;-1:-1:-1;;;;;7174:305:57;;:::i;:::-;;;;;;;;;;;;;;;;7222:217:9;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7222:217:9;;:::i;:::-;;;;-1:-1:-1;;;;;7222:217:9;;;;;;;;;;;;;;6766:395;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;6766:395:9;;;;;;;;:::i;:::-;;3900:197:57;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3900:197:57;;;;;;;:::i;7722:113::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7722:113:57;;;;:::i;1237:36::-;;;;;;;;;;;;;:::i;6260:208:9:-;;;;;;;;;;;;;:::i;8086:300::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;8086:300:9;;;;;;;;;;;;;;;;;:::i;6029:160::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;6029:160:9;;;;;;;;:::i;1092:49:57:-;;;;;;;;;;;;;:::i;6479:378::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6479:378:57;-1:-1:-1;6479:378:57;-1:-1:-1;;;;;6479:378:57;;:::i;2901:150::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2901:150:57;-1:-1:-1;;;;;2901:150:57;;:::i;8452:149:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;8452:149:9;;;;;;;;;;;;;;;;;:::i;3607:92:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3607:92:57;-1:-1:-1;;;;;3607:92:57;;:::i;6540:169:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6540:169:9;;:::i;1634:50:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1634:50:57;-1:-1:-1;;;;;1634:50:57;;:::i;1431:21::-;;;;;;;;;;;;;:::i;4280:175:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4280:175:9;;:::i;1587:365:56:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1587:365:56;;;;;;;;-1:-1:-1;;;;;1587:365:56;;;;;;;;;;;;;;;;;:::i;5855:95:9:-;;;;;;;;;;;;;:::i;4005:218::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4005:218:9;-1:-1:-1;;;;;4005:218:9;;:::i;1717:145:1:-;;;;;;;;;;;;;:::i;1147:43:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1147:43:57;;:::i;1538:39::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1538:39:57;-1:-1:-1;;;;;1538:39:57;;:::i;1279:45::-;;;;;;;;;;;;;:::i;8066:648::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8066:648:57;;:::i;1085:85:1:-;;;;;;;;;;;;;:::i;4679:102:9:-;;;;;;;;;;;;;:::i;7506:290::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;7506:290:9;;;;;;;;;;:::i;468:19:56:-;;;;;;;;;;;;;:::i;1372:52:57:-;;;;;;;;;;;;;:::i;8667:282:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;8667:282:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8667:282:9;;-1:-1:-1;8667:282:9;;-1:-1:-1;;;;;8667:282:9:i;1330:36:57:-;;;;;;;;;;;;;:::i;3284:110::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;3284:110:57;;;;;;;;;;:::i;5006:193::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5006:193:57;;:::i;4847:776:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4847:776:9;;:::i;4619:246:57:-;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;4619:246:57;;;;;;;;;-1:-1:-1;;;;;4619:246:57;;;;;;;;;;;;;;;;;:::i;1030:185:56:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1030:185:56;-1:-1:-1;;;;;1030:185:56;;:::i;5374:105:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5374:105:57;;:::i;7862:162:9:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;7862:162:9;;;;;;;;;;:::i;1497:34:57:-;;;;;;;;;;;;;:::i;5645:502::-;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2011:240:1;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2011:240:1;-1:-1:-1;;;;;2011:240:1;;:::i;1583:45:57:-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1583:45:57;;:::i;:::-;;;;;;;;;-1:-1:-1;;;;;1583:45:57;;;;;;;-1:-1:-1;;;;;1583:45:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;965:148:2;-1:-1:-1;;;;;;1073:33:2;;1050:4;1073:33;;;;;;;;;;;;;965:148;;;;:::o;4517:98:9:-;4603:5;4596:12;;;;;;;;-1:-1:-1;;4596:12:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4571:13;;4596:12;;4603:5;;4596:12;;4603:5;4596:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4517:98;;:::o;7174:305:57:-;7258:11;7289:25;7306:7;7289:16;:25::i;:::-;7281:53;;;;;-1:-1:-1;;;7281:53:57;;;;;;;;;;;;-1:-1:-1;;;7281:53:57;;;;;;;;;;;;;;;7344:16;7352:7;7344;:16::i;:::-;-1:-1:-1;7374:32:57;;-1:-1:-1;7382:10:57;7374:30;:32::i;:::-;:56;;;;-1:-1:-1;7424:6:57;;-1:-1:-1;;;;;7424:6:57;7410:10;:20;7374:56;7371:101;;;7441:4;-1:-1:-1;;;;;7441:14:57;;7456:15;7441:31;;;;;;;;;;;;;-1:-1:-1;;;;;7441:31:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7441:31:57;;-1:-1:-1;7371:101:57;7174:305;;;;:::o;7222:217:9:-;7298:7;7325:16;7333:7;7325;:16::i;:::-;7317:73;;;;-1:-1:-1;;;7317:73:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7408:24:9;;;;:15;:24;;;;;;-1:-1:-1;;;;;7408:24:9;;7222:217::o;6766:395::-;6846:13;6862:23;6877:7;6862:14;:23::i;:::-;6846:39;;6909:5;-1:-1:-1;;;;;6903:11:9;:2;-1:-1:-1;;;;;6903:11:9;;;6895:57;;;;-1:-1:-1;;;6895:57:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6987:5;-1:-1:-1;;;;;6971:21:9;:12;:10;:12::i;:::-;-1:-1:-1;;;;;6971:21:9;;:69;;;;6996:44;7020:5;7027:12;:10;:12::i;:::-;6996:23;:44::i;:::-;6963:159;;;;-1:-1:-1;;;6963:159:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7133:21;7142:2;7146:7;7133:8;:21::i;:::-;6766:395;;;:::o;3900:197:57:-;3967:9;3987:11;4001:15;:13;:15::i;:::-;4033:18;;:57;;;-1:-1:-1;;;4033:57:57;;;;;;;;;;;;;;;;;;;;;;3987:29;;-1:-1:-1;;;;;;4033:18:57;;;;:33;;:57;;;;;;;;;;;;;;;:18;:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4033:57:57;;3900:197;-1:-1:-1;;;;3900:197:57:o;7722:113::-;7806:10;7787:30;;;;:18;:30;;;;;:41;;-1:-1:-1;;7787:41:57;;;;;;;;;;7722:113::o;1237:36::-;;;:::o;6260:208:9:-;6321:7;6440:21;:12;:19;:21::i;:::-;6433:28;;6260:208;:::o;8086:300::-;8245:41;8264:12;:10;:12::i;:::-;8278:7;8245:18;:41::i;:::-;8237:103;;;;-1:-1:-1;;;8237:103:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8351:28;8361:4;8367:2;8371:7;8351:9;:28::i;6029:160::-;-1:-1:-1;;;;;6152:20:9;;6126:7;6152:20;;;:13;:20;;;;;:30;;6176:5;6152:23;:30::i;:::-;6145:37;6029:160;-1:-1:-1;;;6029:160:9:o;1092:49:57:-;;;;:::o;6479:378::-;6576:11;;6599:140;6615:15;;;6599:140;;;6653:25;6670:4;;6675:1;6670:7;;;;;;;;;;;;;6653:16;:25::i;:::-;6650:79;;;6698:16;6706:4;;6711:1;6706:7;;;;;;;;;;;;;6698;:16::i;:::-;;;6650:79;6632:3;;6599:140;;;-1:-1:-1;6752:32:57;6760:10;6752:30;:32::i;:::-;:56;;;;-1:-1:-1;6802:6:57;;-1:-1:-1;;;;;6802:6:57;6788:10;:20;6752:56;6749:101;;;6819:4;-1:-1:-1;;;;;6819:14:57;;6834:15;6819:31;;;;;;;;;;;;;-1:-1:-1;;;;;6819:31:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2901:150;1308:12:1;:10;:12::i;:::-;-1:-1:-1;;;;;1297:23:1;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1297:23:1;;1289:68;;;;;-1:-1:-1;;;1289:68:1;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1289:68:1;;;;;;;;;;;;;;;2979:10:57::1;:22:::0;;-1:-1:-1;;;;;;2979:22:57::1;-1:-1:-1::0;;;;;2979:22:57;::::1;;::::0;;3009:35:::1;2979:22:::0;-1:-1:-1;3009:9:57::1;:35::i;:::-;2901:150:::0;:::o;8452:149:9:-;8555:39;8572:4;8578:2;8582:7;8555:39;;;;;;;;;;;;:16;:39::i;3607:92:57:-;1308:12:1;:10;:12::i;:::-;-1:-1:-1;;;;;1297:23:1;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1297:23:1;;1289:68;;;;;-1:-1:-1;;;1289:68:1;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1289:68:1;;;;;;;;;;;;;;;3674:6:57::1;:18:::0;;-1:-1:-1;;;;;;3674:18:57::1;-1:-1:-1::0;;;;;3674:18:57;;;::::1;::::0;;;::::1;::::0;;3607:92::o;6540:169:9:-;6615:7;;6656:22;:12;6672:5;6656:15;:22::i;:::-;-1:-1:-1;6634:44:9;6540:169;-1:-1:-1;;;6540:169:9:o;1634:50:57:-;;;;;;;;;;;;;;;:::o;1431:21::-;;;-1:-1:-1;;;;;1431:21:57;;:::o;4280:175:9:-;4352:7;4378:70;4395:7;4378:70;;;;;;;;;;;;;;;;;:12;;:70;:16;:70::i;1587:365:56:-;2848:10:57;1732:15:56;2840:19:57;;;:7;:19;;;;;;;;2832:44;;;;;-1:-1:-1;;;2832:44:57;;;;;;;;;;;;-1:-1:-1;;;2832:44:57;;;;;;;;;;;;;;;1779:18:56::1;::::0;:68:::1;::::0;;-1:-1:-1;;;1779:68:56;;::::1;::::0;::::1;::::0;;;;;;;;;;;1759:17:::1;::::0;-1:-1:-1;;;;;1779:18:56::1;::::0;:43:::1;::::0;:68;;;;;::::1;::::0;;;;;;;;:18;:68;::::1;;::::0;::::1;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;1779:68:56;;-1:-1:-1;1870:75:56::1;1779:68:::0;1890:16;1908:2;1912:5:::1;1919:9:::0;1930:14;1870:5:::1;:75::i;:::-;1857:88:::0;1587:365;-1:-1:-1;;;;;;;1587:365:56:o;5855:95:9:-;5935:8;5928:15;;;;;;;;-1:-1:-1;;5928:15:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5903:13;;5928:15;;5935:8;;5928:15;;5935:8;5928:15;;;;;;;;;;;;;;;;;;;;;;;;4005:218;4077:7;-1:-1:-1;;;;;4104:19:9;;4096:74;;;;-1:-1:-1;;;4096:74:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;4187:20:9;;;;;;:13;:20;;;;;:29;;:27;:29::i;1717:145:1:-;1308:12;:10;:12::i;:::-;-1:-1:-1;;;;;1297:23:1;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1297:23:1;;1289:68;;;;;-1:-1:-1;;;1289:68:1;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1289:68:1;;;;;;;;;;;;;;;1807:6:::1;::::0;1786:40:::1;::::0;1823:1:::1;::::0;-1:-1:-1;;;;;1807:6:1::1;::::0;1786:40:::1;::::0;1823:1;;1786:40:::1;1836:6;:19:::0;;-1:-1:-1;;;;;;1836:19:1::1;::::0;;1717:145::o;1147:43:57:-;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1147:43:57;;-1:-1:-1;1147:43:57;:::o;1538:39::-;;;;;;;;;;;;;;;:::o;1279:45::-;;;-1:-1:-1;;;;;1279:45:57;;:::o;8066:648::-;8127:4;8143:29;;:::i;:::-;-1:-1:-1;8175:19:57;;;;:10;:19;;;;;;;;8143:51;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;8143:51:57;;;;;;;-1:-1:-1;;;8143:51:57;;;-1:-1:-1;;;;;8143:51:57;;;;;;;;;;;;;;;;;;-1:-1:-1;;;8143:51:57;;;;;;;;8207:37;;:18;:37;;;;;;8143:51;;8207:37;8204:54;;;8253:5;8246:12;;;;;8204:54;8272:18;;8268:36;;8299:5;8292:12;;;;;8268:36;8315:8;8341:17;8361:15;:13;:15::i;:::-;8341:35;;8408:11;:18;;;8393:33;;:12;:33;8387:39;;8532:3;:115;;;;-1:-1:-1;8541:22:57;;;;8583:15;;8541:38;;:26;;8568:10;8541:26;:38::i;:::-;:57;;8540:106;;;;;8630:15;8604:11;:22;;;:41;;;;8540:106;8528:157;;;8670:4;8663:11;;;;;;;8528:157;-1:-1:-1;8702:5:57;;8066:648;-1:-1:-1;;;;8066:648:57:o;1085:85:1:-;1157:6;;-1:-1:-1;;;;;1157:6:1;1085:85;:::o;4679:102:9:-;4767:7;4760:14;;;;;;;;-1:-1:-1;;4760:14:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4735:13;;4760:14;;4767:7;;4760:14;;4767:7;4760:14;;;;;;;;;;;;;;;;;;;;;;;;7506:290;7620:12;:10;:12::i;:::-;-1:-1:-1;;;;;7608:24:9;:8;-1:-1:-1;;;;;7608:24:9;;;7600:62;;;;;-1:-1:-1;;;7600:62:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;7718:8;7673:18;:32;7692:12;:10;:12::i;:::-;-1:-1:-1;;;;;7673:32:9;;;;;;;;;;;;;;;;;-1:-1:-1;7673:32:9;;;:42;;;;;;;;;;;;:53;;-1:-1:-1;;7673:53:9;;;;;;;;;;;7756:12;:10;:12::i;:::-;-1:-1:-1;;;;;7741:48:9;;7780:8;7741:48;;;;;;;;;;;;;;;;;;;;7506:290;;:::o;468:19:56:-;;;-1:-1:-1;;;;;468:19:56;;:::o;1372:52:57:-;;;:::o;8667:282:9:-;8798:41;8817:12;:10;:12::i;:::-;8831:7;8798:18;:41::i;:::-;8790:103;;;;-1:-1:-1;;;8790:103:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8903:39;8917:4;8923:2;8927:7;8936:5;8903:13;:39::i;:::-;8667:282;;;;:::o;1330:36:57:-;;;-1:-1:-1;;;;;1330:36:57;;:::o;3284:110::-;1308:12:1;:10;:12::i;:::-;-1:-1:-1;;;;;1297:23:1;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1297:23:1;;1289:68;;;;;-1:-1:-1;;;1289:68:1;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1289:68:1;;;;;;;;;;;;;;;-1:-1:-1;;;;;3361:16:57;;;::::1;;::::0;;;:7:::1;:16;::::0;;;;:26;;-1:-1:-1;;3361:26:57::1;::::0;::::1;;::::0;;;::::1;::::0;;3284:110::o;5006:193::-;5066:19;;;;:10;:19;;;;;:26;;;:69;;;;-1:-1:-1;5096:19:57;;;;:10;:19;;;;;:25;;;;-1:-1:-1;;;;;5096:25:57;5125:10;5096:39;5066:69;5058:98;;;;;-1:-1:-1;;;5058:98:57;;;;;;;;;;;;-1:-1:-1;;;5058:98:57;;;;;;;;;;;;;;;5166:26;5172:10;5184:7;5166:5;:26::i;4847:776:9:-;4920:13;4953:16;4961:7;4953;:16::i;:::-;4945:76;;;;-1:-1:-1;;;4945:76:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5058:19;;;;:10;:19;;;;;;;;;5032:45;;;;;;-1:-1:-1;;5032:45:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:23;;:45;;;5058:19;5032:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5087:18;5108:9;:7;:9::i;:::-;5087:30;;5196:4;5190:18;5212:1;5190:23;5186:70;;;-1:-1:-1;5236:9:9;-1:-1:-1;5229:16:9;;5186:70;5358:23;;:27;5354:106;;5432:4;5438:9;5415:33;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5415:33:9;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5415:33:9;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5415:33:9;;;;;;;;;;;;;-1:-1:-1;;5415:33:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5401:48;;;;;;5354:106;5590:4;5596:18;:7;:16;:18::i;:::-;5573:42;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5573:42:9;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5573:42:9;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5573:42:9;;;;;;;;;;;;;-1:-1:-1;;5573:42:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5559:57;;;;4847:776;;;:::o;4619:246:57:-;4753:15;4793:65;4804:6;-1:-1:-1;;;;;4799:12:57;4813:6;4821:2;4825:4;4831:10;4843:14;4793:5;:65::i;:::-;4780:78;4619:246;-1:-1:-1;;;;;;4619:246:57:o;1030:185:56:-;1308:12:1;:10;:12::i;:::-;-1:-1:-1;;;;;1297:23:1;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1297:23:1;;1289:68;;;;;-1:-1:-1;;;1289:68:1;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1289:68:1;;;;;;;;;;;;;;;1117:11:56::1;-1:-1:-1::0;;;;;1117:16:56::1;;:18;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;::::0;::::1;;-1:-1:-1::0;1117:18:56;1110:4:::1;:25:::0;;-1:-1:-1;;;;;;1110:25:56::1;-1:-1:-1::0;;;;;1110:25:56;;::::1;;::::0;;;;1143:65:::1;::::0;1150:4:::1;1176:11:::0;-1:-1:-1;;1143:24:56::1;:65::i;5374:105:57:-:0;2715:19;;;;:10;:19;;;;;:25;5437:7;;2715:25;;;-1:-1:-1;;;;;2715:25:57;2744:10;2715:39;2707:71;;;;;-1:-1:-1;;;2707:71:57;;;;;;;;;;;;-1:-1:-1;;;2707:71:57;;;;;;;;;;;;;;;5456:16:::1;5464:7;5456;:16::i;7862:162:9:-:0;-1:-1:-1;;;;;7982:25:9;;;7959:4;7982:25;;;:18;:25;;;;;;;;:35;;;;;;;;;;;;;;;7862:162::o;1497:34:57:-;;;:::o;5645:502::-;5698:18;5728:12;5758:6;5754:106;5775:19;:9;:17;:19::i;:::-;5770:1;:24;5754:106;;5819:19;5836:1;5819:16;:19::i;:::-;5816:33;;;5840:9;;;;;5816:33;5797:3;;5754:106;;;;5887:7;5876:19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5876:19:57;;5869:26;;5905:10;5933:6;5929:212;5950:19;:9;:17;:19::i;:::-;5945:1;:24;5929:212;;5994:19;6011:1;5994:16;:19::i;:::-;5991:96;;;6046:1;6032:4;6037:5;6032:11;;;;;;;;;;;;;;;;;:15;6065:7;;;;;5991:96;6110:7;6103:5;:14;6100:30;;6119:11;;;;;6100:30;5972:3;;5929:212;;;;5645:502;;;:::o;2011:240:1:-;1308:12;:10;:12::i;:::-;-1:-1:-1;;;;;1297:23:1;:7;:5;:7::i;:::-;-1:-1:-1;;;;;1297:23:1;;1289:68;;;;;-1:-1:-1;;;1289:68:1;;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;1289:68:1;;;;;;;;;;;;;;;-1:-1:-1;;;;;2099:22:1;::::1;2091:73;;;;-1:-1:-1::0;;;2091:73:1::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2200:6;::::0;2179:38:::1;::::0;-1:-1:-1;;;;;2179:38:1;;::::1;::::0;2200:6:::1;::::0;2179:38:::1;::::0;2200:6:::1;::::0;2179:38:::1;2227:6;:17:::0;;-1:-1:-1;;;;;;2227:17:1::1;-1:-1:-1::0;;;;;2227:17:1;;;::::1;::::0;;;::::1;::::0;;2011:240::o;1583:45:57:-;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1583:45:57;;-1:-1:-1;;;1583:45:57;;;-1:-1:-1;;;;;1583:45:57;;;;;;;-1:-1:-1;;;1583:45:57;;;;:::o;3136:155:5:-;3194:7;3226:1;3221;:6;;3213:49;;;;;-1:-1:-1;;;3213:49:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3279:5:5;;;3136:155::o;1348:613:8:-;1713:10;;;1712:62;;-1:-1:-1;1729:39:8;;;-1:-1:-1;;;1729:39:8;;1753:4;1729:39;;;;-1:-1:-1;;;;;1729:39:8;;;;;;;;;:15;;;;;;:39;;;;;;;;;;;;;;;:15;:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1729:39:8;:44;1712:62;1704:150;;;;-1:-1:-1;;;1704:150:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1891:62;;;-1:-1:-1;;;;;1891:62:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1891:62:8;-1:-1:-1;;;1891:62:8;;;1864:90;;1884:5;;1864:19;:90::i;3581:193:14:-;3684:12;3715:52;3737:6;3745:4;3751:1;3754:12;3715:21;:52::i;:::-;3708:59;3581:193;-1:-1:-1;;;;3581:193:14:o;13149:714:57:-;13198:13;13275:19;;;:10;:19;;;;;13312:17;;;;;-1:-1:-1;;;;;13312:17:57;;13198:13;13312:17;13340:55;;;;;-1:-1:-1;;;13340:55:57;;;;;;;;;;;;-1:-1:-1;;;13340:55:57;;;;;;;;;;;;;;;13413:18;;;;13405:54;;;;;-1:-1:-1;;;13405:54:57;;;;;;;;;;;;-1:-1:-1;;;13405:54:57;;;;;;;;;;;;;;;13498:11;13511;13524:27;13555:25;13565:7;13574:5;13555:9;:25::i;:::-;13497:83;;;;;;13616:16;13624:7;13616;:16::i;:::-;13613:35;;;13634:14;13640:7;13634:5;:14::i;:::-;13658:26;;-1:-1:-1;;13658:26:57;;;13695:34;13714:5;13722:6;13695:10;:34::i;:::-;13754:6;13739:21;;13797:7;13776:80;;13783:5;-1:-1:-1;;;;;13776:80:57;;13815:22;13848:6;13776:80;;;;-1:-1:-1;;;;;13776:80:57;;;;;;-1:-1:-1;;;;;13776:80:57;;;;;;;;;;;;;;;;13149:714;;;;;;;:::o;726:413:14:-;1086:20;1124:8;;;726:413::o;10383:125:9:-;10448:4;10471:30;:12;10493:7;10471:21;:30::i;598:104:15:-;685:10;598:104;:::o;16225:189:9:-;16299:24;;;;:15;:24;;;;;:29;;-1:-1:-1;;;;;;16299:29:9;-1:-1:-1;;;;;16299:29:9;;;;;;;;:24;;16352:23;16299:24;16352:14;:23::i;:::-;-1:-1:-1;;;;;16343:46:9;;;;;;;;;;;16225:189;;:::o;14495:211:57:-;14543:4;14587:9;14639:13;-1:-1:-1;;;;;14639:29:57;;:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;14639:31:57;;;;-1:-1:-1;;14495:211:57;:::o;7820:121:17:-;7889:7;7915:19;7923:3;7915:7;:19::i;10666:351:9:-;10759:4;10783:16;10791:7;10783;:16::i;:::-;10775:73;;;;-1:-1:-1;;;10775:73:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10858:13;10874:23;10889:7;10874:14;:23::i;:::-;10858:39;;10926:5;-1:-1:-1;;;;;10915:16:9;:7;-1:-1:-1;;;;;10915:16:9;;:51;;;;10959:7;-1:-1:-1;;;;;10935:31:9;:20;10947:7;10935:11;:20::i;:::-;-1:-1:-1;;;;;10935:31:9;;10915:51;:94;;;;10970:39;10994:5;11001:7;10970:23;:39::i;13707:584::-;13831:4;-1:-1:-1;;;;;13804:31:9;:23;13819:7;13804:14;:23::i;:::-;-1:-1:-1;;;;;13804:31:9;;13796:85;;;;-1:-1:-1;;;13796:85:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;13917:16:9;;13909:65;;;;-1:-1:-1;;;13909:65:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13985:39;14006:4;14012:2;14016:7;13985:20;:39::i;:::-;14086:29;14103:1;14107:7;14086:8;:29::i;:::-;-1:-1:-1;;;;;14126:19:9;;;;;;:13;:19;;;;;:35;;14153:7;14126:26;:35::i;:::-;-1:-1:-1;;;;;;14171:17:9;;;;;;:13;:17;;;;;:30;;14193:7;14171:21;:30::i;:::-;-1:-1:-1;14212:29:9;:12;14229:7;14238:2;14212:16;:29::i;:::-;;14276:7;14272:2;-1:-1:-1;;;;;14257:27:9;14266:4;-1:-1:-1;;;;;14257:27:9;;;;;;;;;;;13707:584;;;:::o;9250:135:18:-;9321:7;9355:22;9359:3;9371:5;9355:3;:22::i;8269:233:17:-;8349:7;;;;8408:22;8412:3;8424:5;8408:3;:22::i;:::-;8377:53;;;;-1:-1:-1;8269:233:17;-1:-1:-1;;;;;8269:233:17:o;9522:211::-;9629:7;9679:44;9684:3;9704;9710:12;9679:4;:44::i;9109:813:57:-;9237:15;9286:21;:9;:19;:21::i;:::-;9330:19;:9;:17;:19::i;:::-;9317:32;;9390:11;9404:15;:13;:15::i;:::-;9443:18;;:57;;;-1:-1:-1;;;9443:57:57;;;;;;;;;;;;;;;;;;;;;;9390:29;;-1:-1:-1;9430:10:57;;-1:-1:-1;;;;;9443:18:57;;;;:33;;:57;;;;;;;;;;;;;;;:18;:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9443:57:57;;-1:-1:-1;9552:57:57;;;;9569:40;9583:10;9595:6;9603:5;9569:13;:40::i;:::-;9641:75;9654:10;9666:5;9673:6;9681;9689;9697:2;9701:14;9641:12;:75::i;:::-;9759:10;9756:36;;;9771:21;9777:2;9781:10;9771:5;:21::i;:::-;9808:107;;;-1:-1:-1;;;;;9808:107:57;;;;;;;;;;;;;;;;;;9891:15;:22;;9808:107;;;;;;;;;;;;;;-1:-1:-1;;;;;9808:107:57;;;;;;;;;;;;;9109:813;;;;;;;;;;:::o;9811:269:9:-;9924:28;9934:4;9940:2;9944:7;9924:9;:28::i;:::-;9970:48;9993:4;9999:2;10003:7;10012:5;9970:22;:48::i;:::-;9962:111;;;;-1:-1:-1;;;9962:111:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12246:393;-1:-1:-1;;;;;12325:16:9;;12317:61;;;;;-1:-1:-1;;;12317:61:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12397:16;12405:7;12397;:16::i;:::-;12396:17;12388:58;;;;;-1:-1:-1;;;12388:58:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;12457:45;12486:1;12490:2;12494:7;12457:20;:45::i;:::-;-1:-1:-1;;;;;12513:17:9;;;;;;:13;:17;;;;;:30;;12535:7;12513:21;:30::i;:::-;-1:-1:-1;12554:29:9;:12;12571:7;12580:2;12554:16;:29::i;:::-;-1:-1:-1;12599:33:9;;12624:7;;-1:-1:-1;;;;;12599:33:9;;;12616:1;;12599:33;;12616:1;;12599:33;12246:393;;:::o;210:725:19:-;266:13;483:10;479:51;;-1:-1:-1;509:10:19;;;;;;;;;;;;-1:-1:-1;;;509:10:19;;;;;;479:51;554:5;539:12;593:75;600:9;;593:75;;625:8;;655:2;647:10;;;;593:75;;;677:19;709:6;699:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;699:17:19;-1:-1:-1;769:5:19;;-1:-1:-1;677:39:19;-1:-1:-1;;;742:10:19;;784:114;791:9;;784:114;;859:2;852:4;:9;847:2;:14;834:29;;816:6;823:7;;;;;;;816:15;;;;;;;;;;;:47;-1:-1:-1;;;;;816:47:19;;;;;;;;-1:-1:-1;885:2:19;877:10;;;;784:114;;;-1:-1:-1;921:6:19;210:725;-1:-1:-1;;;;210:725:19:o;1106:112:16:-;1197:14;;1106:112::o;2967:751:8:-;3386:23;3412:69;3440:4;3412:69;;;;;;;;;;;;;;;;;3420:5;-1:-1:-1;;;;;3412:27:8;;;:69;;;;;:::i;:::-;3495:17;;3386:95;;-1:-1:-1;3495:21:8;3491:221;;3635:10;3624:30;;;;;;;;;;;;;;;-1:-1:-1;3624:30:8;3616:85;;;;-1:-1:-1;;;3616:85:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4608:523:14;4735:12;4792:5;4767:21;:30;;4759:81;;;;-1:-1:-1;;;4759:81:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4858:18;4869:6;4858:10;:18::i;:::-;4850:60;;;;;-1:-1:-1;;;4850:60:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;4981:12;4995:23;5022:6;-1:-1:-1;;;;;5022:11:14;5042:5;5050:4;5022:33;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;5022:33:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4980:75;;;;5072:52;5090:7;5099:10;5111:12;5072:17;:52::i;11436:550:57:-;11502:17;11606:19;;;:10;:19;;;;;11644:18;;-1:-1:-1;;;11644:18:57;;-1:-1:-1;;;;;11644:18:57;;11502:17;;11697:15;:13;:15::i;:::-;11726:22;;;;11672:40;;-1:-1:-1;11751:15:57;11726:22;;;;:40;11723:257;;;11781:4;-1:-1:-1;;;;;11781:11:57;;11793:7;11781:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11830:1;11815:16;;11723:257;;;11906:18;;;;11926;;11879:90;;11890:5;;11897:7;;-1:-1:-1;;;11906:18:57;;;;;-1:-1:-1;;;11926:18:57;;-1:-1:-1;;;;;11926:18:57;11946:22;11879:10;:90::i;:::-;11862:107;;11723:257;11436:550;;;;;;:::o;12856:527:9:-;12915:13;12931:23;12946:7;12931:14;:23::i;:::-;12915:39;;12983:48;13004:5;13019:1;13023:7;12983:20;:48::i;:::-;13069:29;13086:1;13090:7;13069:8;:29::i;:::-;13154:19;;;;:10;:19;;;;;13148:33;;-1:-1:-1;;13148:33:9;;;;;;;;;;;:38;13144:95;;13209:19;;;;:10;:19;;;;;13202:26;;;:::i;:::-;-1:-1:-1;;;;;13249:20:9;;;;;;:13;:20;;;;;:36;;13277:7;13249:27;:36::i;:::-;-1:-1:-1;13296:28:9;:12;13316:7;13296:19;:28::i;:::-;-1:-1:-1;13340:36:9;;13368:7;;13364:1;;-1:-1:-1;;;;;13340:36:9;;;;;13364:1;;13340:36;12856:527;;:::o;2725:145:56:-;2812:4;;2806:28;;;-1:-1:-1;;;2806:28:56;;;;;;;;;;-1:-1:-1;;;;;2812:4:56;;;;2806:20;;:28;;;;;2812:4;;2806:28;;;;;;;;2812:4;;2806:28;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;2844:19:56;;-1:-1:-1;;;;;2844:11:56;;;-1:-1:-1;2844:19:56;;;;;-1:-1:-1;2856:6:56;;2844:19;;;;2856:6;2844:11;:19;;;;;;;;;;;;;;;;;;;7588:149:17;7672:4;7695:35;7705:3;7725;7695:9;:35::i;14043:279:57:-;-1:-1:-1;;;;;14147:18:57;;;;;;:38;;-1:-1:-1;;;;;;14169:16:57;;;;14147:38;14144:172;;;14208:19;;;;:10;:19;;;;;:25;-1:-1:-1;;;;;14208:33:57;;;:25;;;;;:33;14200:61;;;;;-1:-1:-1;;;14200:61:57;;;;;;;;;;;;-1:-1:-1;;;14200:61:57;;;;;;;;;;;;;;;14275:19;;;;:10;:19;;;;;:30;;-1:-1:-1;;;;;14275:30:57;;;;-1:-1:-1;;;;;;14275:30:57;;;;;;14043:279;;;:::o;8365:135:18:-;8435:4;8458:35;8466:3;8486:5;8458:7;:35::i;8068:129::-;8135:4;8158:32;8163:3;8183:5;8158:4;:32::i;7027:183:17:-;7116:4;7139:64;7144:3;7164;-1:-1:-1;;;;;7178:23:17;;7139:4;:64::i;4452:201:18:-;4546:18;;4519:7;;4546:26;-1:-1:-1;4538:73:18;;;;-1:-1:-1;;;4538:73:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4628:3;:11;;4640:5;4628:18;;;;;;;;;;;;;;;;4621:25;;4452:201;;;;:::o;4942:274:17:-;5045:19;;5009:7;;;;5045:27;-1:-1:-1;5037:74:17;;;;-1:-1:-1;;;5037:74:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5122:22;5147:3;:12;;5160:5;5147:19;;;;;;;;;;;;;;;;;;5122:44;;5184:5;:10;;;5196:5;:12;;;5176:33;;;;;4942:274;;;;;:::o;6403:315::-;6497:7;6535:17;;;:12;;;:17;;;;;;6585:12;6570:13;6562:36;;;;-1:-1:-1;;;6562:36:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6651:3;:12;;6675:1;6664:8;:12;6651:26;;;;;;;;;;;;;;;;;;:33;;;6644:40;;;6403:315;;;;;:::o;1224:178:16:-;1376:19;;1394:1;1376:19;;;1224:178::o;2176:345:56:-;2283:9;2322:18;:6;2333;2322:10;:18::i;:::-;2310:8;:30;;2302:55;;;;;-1:-1:-1;;;2302:55:56;;;;;;;;;;;;-1:-1:-1;;;2302:55:56;;;;;;;;;;;;;;;2381:18;:6;2392;2381:10;:18::i;:::-;2370:8;:29;2367:90;;;-1:-1:-1;;;;;2401:22:56;;:56;2424:32;2437:18;:6;2448;2437:10;:18::i;:::-;2424:8;;:12;:32::i;:::-;2401:56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2367:90;2473:4;;-1:-1:-1;;;;;2473:4:56;2467:19;2493:18;:6;2504;2493:10;:18::i;:::-;2467:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2176:345;;;;:::o;10335:796:57:-;10480:15;10498:75;10564:8;10498:61;10555:3;10498:52;10521:28;;10498:18;10509:6;10498;:10;;:18;;;;:::i;:::-;:22;;:52::i;:::-;:56;;:61::i;:75::-;10480:93;;10606:174;;;;;;;;10635:4;10606:174;;;;;;10662:5;-1:-1:-1;;;;;10606:174:57;;;;;10689:6;-1:-1:-1;;;;;10606:174:57;;;;;10735:6;10717:15;:24;10606:174;;;;;;10763:6;10606:174;;;;;10584:10;:19;10595:7;10584:19;;;;;;;;;;;:196;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;10584:196:57;;;;;-1:-1:-1;;;;;10584:196:57;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;10584:196:57;;;;;-1:-1:-1;;;;;10584:196:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10791:21;10815:10;;;;;;;;;-1:-1:-1;;;;;10815:10:57;-1:-1:-1;;;;;10815:35:57;;10864:8;10886:14;10914:26;10962:4;10981:15;10815:191;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;10815:191:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;10815:191:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;10815:191:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;10815:191:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10791:215;;11016:20;11039:7;11064:1;11047:7;:14;:18;11039:27;;;;;;;;;;;;;;11016:50;;11077:4;-1:-1:-1;;;;;11077:9:57;;11087:7;11096:10;11108:15;11077:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10335:796;;;;;;;;;;:::o;15524:589:9:-;15644:4;15669:15;:2;-1:-1:-1;;;;;15669:13:9;;:15::i;:::-;15664:58;;-1:-1:-1;15707:4:9;15700:11;;15664:58;15731:23;15757:246;-1:-1:-1;;;15868:12:9;:10;:12::i;:::-;15894:4;15912:7;15933:5;15773:175;;;;;;-1:-1:-1;;;;;15773:175:9;;;;;;-1:-1:-1;;;;;15773:175:9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;15773:175:9;;;;;;;-1:-1:-1;;;;;15773:175:9;;;;;;;;;;;15757:246;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;15757:15:9;;;:246;:15;:246::i;:::-;15731:272;;16013:13;16040:10;16029:32;;;;;;;;;;;;;;;-1:-1:-1;16029:32:9;-1:-1:-1;;;;;;16079:26:9;-1:-1:-1;;;16079:26:9;;-1:-1:-1;;;15524:589:9;;;;;;:::o;7091:725:14:-;7206:12;7234:7;7230:580;;;-1:-1:-1;7264:10:14;7257:17;;7230:580;7375:17;;:21;7371:429;;7633:10;7627:17;7693:15;7680:10;7676:2;7672:19;7665:44;7582:145;7765:20;;-1:-1:-1;;;7765:20:14;;;;;;;;;;;;;;;;;7772:12;;7765:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12298:651:57;12436:11;12476:22;12466:6;:32;12463:171;;-1:-1:-1;12522:1:57;12463:171;;;12563:60;12614:8;12563:46;12602:6;12563:34;:6;12574:22;12563:10;:34::i;:60::-;12554:69;;12463:171;12644:15;12662:32;12670:10;12662:30;:32::i;:::-;:54;;12714:1;12662:54;;;12697:6;;-1:-1:-1;;;;;12697:6:57;12662:54;12644:72;-1:-1:-1;12726:14:57;-1:-1:-1;;;;;12743:21:57;;:66;;12808:1;12743:66;;;12775:7;-1:-1:-1;;;;;12767:36:57;;:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;12767:38:57;12743:66;12726:83;;12841:6;12828:9;:19;;12820:58;;;;;-1:-1:-1;;;12820:58:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;12889:4;-1:-1:-1;;;;;12889:9:57;;12899:7;12916:5;12924:6;12932:9;12889:53;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;12889:53:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12298:651;;;;;;;;;:::o;7369:140:17:-;7446:4;7469:33;7477:3;7497;7469:7;:33::i;4278:123::-;4349:4;4372:17;;;:12;;;;;:17;;;;;;:22;;;4278:123::o;2212:1512:18:-;2278:4;2415:19;;;:12;;;:19;;;;;;2449:15;;2445:1273;;2878:18;;-1:-1:-1;;2830:14:18;;;;2878:22;;;;2806:21;;2878:3;;:22;;3160;;;;;;;;;;;;;;3140:42;;3303:9;3274:3;:11;;3286:13;3274:26;;;;;;;;;;;;;;;;;;;:38;;;;3378:23;;;3420:1;3378:12;;;:23;;;;;;3404:17;;;3378:43;;3527:17;;3378:3;;3527:17;;;;;;;;;;;;;;;;;;;;;;3619:3;:12;;:19;3632:5;3619:19;;;;;;;;;;;3612:26;;;3660:4;3653:11;;;;;;;;2445:1273;3702:5;3695:12;;;;;1640:404;1703:4;1724:21;1734:3;1739:5;1724:9;:21::i;:::-;1719:319;;-1:-1:-1;1761:23:18;;;;;;;;:11;:23;;;;;;;;;;;;;1941:18;;1919:19;;;:12;;;:19;;;;;;:40;;;;1973:11;;1719:319;-1:-1:-1;2022:5:18;2015:12;;1836:678:17;1912:4;2045:17;;;:12;;;:17;;;;;;2077:13;2073:435;;-1:-1:-1;;2161:38:17;;;;;;;;;;;;;;;;;;2143:57;;;;;;;;:12;:57;;;;;;;;;;;;;;;;;;;;;;;;2355:19;;2335:17;;;:12;;;:17;;;;;;;:39;2388:11;;2073:435;2466:5;2430:3;:12;;2454:1;2443:8;:12;2430:26;;;;;;;;;;;;;;;;;;:33;;:41;;;;2492:5;2485:12;;;;;2690:175:5;2748:7;2779:5;;;2802:6;;;;2794:46;;;;;-1:-1:-1;;;2794:46:5;;;;;;;;;;;;;;;;;;;;;;;;;;;3538:215;3596:7;3619:6;3615:20;;-1:-1:-1;3634:1:5;3627:8;;3615:20;3657:5;;;3661:1;3657;:5;:1;3680:5;;;;;:10;3672:56;;;;-1:-1:-1;;;3672:56:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4217:150;4275:7;4306:1;4302;:5;4294:44;;;;;-1:-1:-1;;;4294:44:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;4359:1;4355;:5;;;;;;;4217:150;-1:-1:-1;;;4217:150:5:o;2682:1517:17:-;2746:4;2879:17;;;:12;;;:17;;;;;;2911:13;;2907:1286;;3337:19;;-1:-1:-1;;3291:12:17;;;;3337:23;;;;3267:21;;3337:3;;:23;;3629;;;;;;;;;;;;;;;;3600:52;;3774:9;3744:3;:12;;3757:13;3744:27;;;;;;;;;;;;;;;;:39;;:27;;;;;:39;;;;;;;;;;;;;;;3862:14;;3849:28;;:12;;;:28;;;;;3880:17;;;3849:48;;4003:18;;3849:3;;4003:18;;;;;;;;;;;;;;-1:-1:-1;;4003:18:17;;;;;;;;;;;;;;;;;;;;;4096:17;;;:12;;;:17;;;;;;4089:24;;;;4003:18;-1:-1:-1;4128:11:17;;-1:-1:-1;;;;4128:11:17;-1:-1:-1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o

Swarm Source

ipfs://7758d89d239779b75e90477543ae96e94afba734e90d34e5e58addbf48dbd113

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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