ETH Price: $3,410.84 (-0.99%)
Gas: 2 Gwei

Contract

0x0304E6e1B383a01D4Bb78486fEeebfC8eb113D19
 

Overview

ETH Balance

0.159560377233120631 ETH

Eth Value

$544.24 (@ $3,410.84/ETH)

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Deposit168830052023-03-22 12:02:35468 days ago1679486555IN
0x0304E6e1...8eb113D19
0.00729295 ETH0.0024211911.55916831
Deposit166063512023-02-11 15:15:35507 days ago1676128535IN
0x0304E6e1...8eb113D19
0.00006559 ETH0.0033501916
Deposit164625572023-01-22 13:11:35527 days ago1674393095IN
0x0304E6e1...8eb113D19
0.00030632 ETH0.0028804414.05150031
Deposit163046052022-12-31 12:00:11549 days ago1672488011IN
0x0304E6e1...8eb113D19
0.00000417 ETH0.0030147214.397843
Deposit161721592022-12-13 0:19:11568 days ago1670890751IN
0x0304E6e1...8eb113D19
0.00001953 ETH0.0030017814.64235729
Deposit161718132022-12-12 23:09:47568 days ago1670886587IN
0x0304E6e1...8eb113D19
0.00039146 ETH0.0029679814.47591076
Deposit161173062022-12-05 8:07:35575 days ago1670227655IN
0x0304E6e1...8eb113D19
0.00014437 ETH0.0024501511.95309475
Deposit161172292022-12-05 7:52:11575 days ago1670226731IN
0x0304E6e1...8eb113D19
0.00028882 ETH0.0024481111.94173798
Deposit161127822022-12-04 16:57:59576 days ago1670173079IN
0x0304E6e1...8eb113D19
0.00011164 ETH0.002225810.85995989
Deposit161052672022-12-03 15:45:35577 days ago1670082335IN
0x0304E6e1...8eb113D19
0.00016743 ETH0.0019352510.29827112
Deposit161051802022-12-03 15:28:11577 days ago1670081291IN
0x0304E6e1...8eb113D19
0.00016747 ETH0.0021563210.29827112
Deposit160252142022-11-22 11:20:59588 days ago1669116059IN
0x0304E6e1...8eb113D19
0.00000914 ETH0.0024942912.1691119
Deposit160230072022-11-22 3:56:59588 days ago1669089419IN
0x0304E6e1...8eb113D19
0.00000443 ETH0.0022017410.74258201
Deposit160129952022-11-20 18:24:11590 days ago1668968651IN
0x0304E6e1...8eb113D19
0.00020707 ETH0.0026345112.84840076
Deposit160129952022-11-20 18:24:11590 days ago1668968651IN
0x0304E6e1...8eb113D19
0.00020707 ETH0.0026338412.84840076
Deposit160068342022-11-19 21:46:11591 days ago1668894371IN
0x0304E6e1...8eb113D19
0.00019982 ETH0.0027645913.48359713
Deposit160068282022-11-19 21:44:59591 days ago1668894299IN
0x0304E6e1...8eb113D19
0.00019982 ETH0.0024032811.72069968
Deposit160068282022-11-19 21:44:59591 days ago1668894299IN
0x0304E6e1...8eb113D19
0.0001998 ETH0.0024032811.72069968
Deposit160068282022-11-19 21:44:59591 days ago1668894299IN
0x0304E6e1...8eb113D19
0.00019982 ETH0.0024032811.72069968
Deposit160068272022-11-19 21:44:47591 days ago1668894287IN
0x0304E6e1...8eb113D19
0.00019978 ETH0.0022407110.9278504
Deposit160068272022-11-19 21:44:47591 days ago1668894287IN
0x0304E6e1...8eb113D19
0.00019982 ETH0.0022407110.9278504
Deposit160068262022-11-19 21:44:35591 days ago1668894275IN
0x0304E6e1...8eb113D19
0.00019982 ETH0.0025535712.45684244
Deposit160055732022-11-19 17:32:23591 days ago1668879143IN
0x0304E6e1...8eb113D19
0.00040009 ETH0.0035117817.12715628
Deposit160024102022-11-19 6:56:11591 days ago1668840971IN
0x0304E6e1...8eb113D19
0.00080322 ETH0.0028814411.85127745
Deposit160017492022-11-19 4:43:35591 days ago1668833015IN
0x0304E6e1...8eb113D19
0.00039302 ETH0.0028758412.09232559
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
201933362024-06-28 23:01:474 days ago1719615707
0x0304E6e1...8eb113D19
0.00635864 ETH
200984892024-06-15 16:48:5917 days ago1718470139
0x0304E6e1...8eb113D19
0.00934958 ETH
196437982024-04-13 2:52:2380 days ago1712976743
0x0304E6e1...8eb113D19
0.02265794 ETH
192938482024-02-24 0:25:11130 days ago1708734311
0x0304E6e1...8eb113D19
0.02467376 ETH
184030132023-10-22 2:59:11254 days ago1697943551
0x0304E6e1...8eb113D19
0.01135372 ETH
172624142023-05-15 3:06:11414 days ago1684119971
0x0304E6e1...8eb113D19
0.01436065 ETH
169017322023-03-25 3:12:47465 days ago1679713967
0x0304E6e1...8eb113D19
0.02171369 ETH
151135782022-07-10 7:35:50723 days ago1657438550
0x0304E6e1...8eb113D19
0.00874537 ETH
151135652022-07-10 7:33:32723 days ago1657438412
0x0304E6e1...8eb113D19
0.00887218 ETH
151131492022-07-10 5:59:06723 days ago1657432746
0x0304E6e1...8eb113D19
0.01318362 ETH
150632722022-07-02 13:04:28731 days ago1656767068
0x0304E6e1...8eb113D19
0.0059475 ETH
150059542022-06-22 5:03:42741 days ago1655874222
0x0304E6e1...8eb113D19
0.01628619 ETH
147801762022-05-15 13:20:10779 days ago1652620810
0x0304E6e1...8eb113D19
0.0167837 ETH
143321732022-03-06 8:05:40849 days ago1646553940
0x0304E6e1...8eb113D19
0.69168237 ETH
142727752022-02-25 3:06:49858 days ago1645758409
0x0304E6e1...8eb113D19
0.0467633 ETH
141304602022-02-03 2:51:37880 days ago1643856697
0x0304E6e1...8eb113D19
0.05592755 ETH
141160722022-01-31 21:25:53883 days ago1643664353
0x0304E6e1...8eb113D19
0.09582389 ETH
140512432022-01-21 21:09:51893 days ago1642799391
0x0304E6e1...8eb113D19
0.02644766 ETH
140362652022-01-19 13:33:20895 days ago1642599200
0x0304E6e1...8eb113D19
0.10329773 ETH
140287132022-01-18 9:32:02896 days ago1642498322
0x0304E6e1...8eb113D19
0.10139335 ETH
138354982021-12-19 12:08:33926 days ago1639915713
0x0304E6e1...8eb113D19
0.07163183 ETH
138354972021-12-19 12:08:05926 days ago1639915685
0x0304E6e1...8eb113D19
0.06776259 ETH
137595852021-12-07 16:33:24938 days ago1638894804
0x0304E6e1...8eb113D19
0.04693263 ETH
135258112021-10-31 16:15:09975 days ago1635696909
0x0304E6e1...8eb113D19
0.01957535 ETH
134000442021-10-11 22:45:34995 days ago1633992334
0x0304E6e1...8eb113D19
0.01238166 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Mooniswap

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion, MIT license
File 1 of 30 : Mooniswap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./interfaces/IFeeCollector.sol";
import "./libraries/UniERC20.sol";
import "./libraries/Sqrt.sol";
import "./libraries/VirtualBalance.sol";
import "./governance/MooniswapGovernance.sol";


contract Mooniswap is MooniswapGovernance {
    using Sqrt for uint256;
    using SafeMath for uint256;
    using UniERC20 for IERC20;
    using VirtualBalance for VirtualBalance.Data;

    struct Balances {
        uint256 src;
        uint256 dst;
    }

    struct SwapVolumes {
        uint128 confirmed;
        uint128 result;
    }

    struct Fees {
        uint256 fee;
        uint256 slippageFee;
    }

    event Error(string reason);

    event Deposited(
        address indexed sender,
        address indexed receiver,
        uint256 share,
        uint256 token0Amount,
        uint256 token1Amount
    );

    event Withdrawn(
        address indexed sender,
        address indexed receiver,
        uint256 share,
        uint256 token0Amount,
        uint256 token1Amount
    );

    event Swapped(
        address indexed sender,
        address indexed receiver,
        address indexed srcToken,
        address dstToken,
        uint256 amount,
        uint256 result,
        uint256 srcAdditionBalance,
        uint256 dstRemovalBalance,
        address referral
    );

    event Sync(
        uint256 srcBalance,
        uint256 dstBalance,
        uint256 fee,
        uint256 slippageFee,
        uint256 referralShare,
        uint256 governanceShare
    );

    uint256 private constant _BASE_SUPPLY = 1000;  // Total supply on first deposit

    IERC20 public immutable token0;
    IERC20 public immutable token1;
    mapping(IERC20 => SwapVolumes) public volumes;
    mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForAddition;
    mapping(IERC20 => VirtualBalance.Data) public virtualBalancesForRemoval;

    modifier whenNotShutdown {
        require(mooniswapFactoryGovernance.isActive(), "Mooniswap: factory shutdown");
        _;
    }

    constructor(
        IERC20 _token0,
        IERC20 _token1,
        string memory name,
        string memory symbol,
        IMooniswapFactoryGovernance _mooniswapFactoryGovernance
    )
        public
        ERC20(name, symbol)
        MooniswapGovernance(_mooniswapFactoryGovernance)
    {
        require(bytes(name).length > 0, "Mooniswap: name is empty");
        require(bytes(symbol).length > 0, "Mooniswap: symbol is empty");
        require(_token0 != _token1, "Mooniswap: duplicate tokens");
        token0 = _token0;
        token1 = _token1;
    }

    function getTokens() external view returns(IERC20[] memory tokens) {
        tokens = new IERC20[](2);
        tokens[0] = token0;
        tokens[1] = token1;
    }

    function tokens(uint256 i) external view returns(IERC20) {
        if (i == 0) {
            return token0;
        } else if (i == 1) {
            return token1;
        } else {
            revert("Pool has two tokens");
        }
    }

    function getBalanceForAddition(IERC20 token) public view returns(uint256) {
        uint256 balance = token.uniBalanceOf(address(this));
        return Math.max(virtualBalancesForAddition[token].current(decayPeriod(), balance), balance);
    }

    function getBalanceForRemoval(IERC20 token) public view returns(uint256) {
        uint256 balance = token.uniBalanceOf(address(this));
        return Math.min(virtualBalancesForRemoval[token].current(decayPeriod(), balance), balance);
    }

    function getReturn(IERC20 src, IERC20 dst, uint256 amount) external view returns(uint256) {
        return _getReturn(src, dst, amount, getBalanceForAddition(src), getBalanceForRemoval(dst), fee(), slippageFee());
    }

    function deposit(uint256[2] memory maxAmounts, uint256[2] memory minAmounts) external payable returns(uint256 fairSupply, uint256[2] memory receivedAmounts) {
        return depositFor(maxAmounts, minAmounts, msg.sender);
    }

    function depositFor(uint256[2] memory maxAmounts, uint256[2] memory minAmounts, address target) public payable nonReentrant returns(uint256 fairSupply, uint256[2] memory receivedAmounts) {
        IERC20[2] memory _tokens = [token0, token1];
        require(msg.value == (_tokens[0].isETH() ? maxAmounts[0] : (_tokens[1].isETH() ? maxAmounts[1] : 0)), "Mooniswap: wrong value usage");

        uint256 totalSupply = totalSupply();

        if (totalSupply == 0) {
            fairSupply = _BASE_SUPPLY.mul(99);
            _mint(address(this), _BASE_SUPPLY); // Donate up to 1%

            for (uint i = 0; i < maxAmounts.length; i++) {
                fairSupply = Math.max(fairSupply, maxAmounts[i]);

                require(maxAmounts[i] > 0, "Mooniswap: amount is zero");
                require(maxAmounts[i] >= minAmounts[i], "Mooniswap: minAmount not reached");

                _tokens[i].uniTransferFrom(msg.sender, address(this), maxAmounts[i]);
                receivedAmounts[i] = maxAmounts[i];
            }
        }
        else {
            uint256[2] memory realBalances;
            for (uint i = 0; i < realBalances.length; i++) {
                realBalances[i] = _tokens[i].uniBalanceOf(address(this)).sub(_tokens[i].isETH() ? msg.value : 0);
            }

            // Pre-compute fair supply
            fairSupply = type(uint256).max;
            for (uint i = 0; i < maxAmounts.length; i++) {
                fairSupply = Math.min(fairSupply, totalSupply.mul(maxAmounts[i]).div(realBalances[i]));
            }

            uint256 fairSupplyCached = fairSupply;

            for (uint i = 0; i < maxAmounts.length; i++) {
                require(maxAmounts[i] > 0, "Mooniswap: amount is zero");
                uint256 amount = realBalances[i].mul(fairSupplyCached).add(totalSupply - 1).div(totalSupply);
                require(amount >= minAmounts[i], "Mooniswap: minAmount not reached");

                _tokens[i].uniTransferFrom(msg.sender, address(this), amount);
                receivedAmounts[i] = _tokens[i].uniBalanceOf(address(this)).sub(realBalances[i]);
                fairSupply = Math.min(fairSupply, totalSupply.mul(receivedAmounts[i]).div(realBalances[i]));
            }

            uint256 _decayPeriod = decayPeriod();  // gas savings
            for (uint i = 0; i < maxAmounts.length; i++) {
                virtualBalancesForRemoval[_tokens[i]].scale(_decayPeriod, realBalances[i], totalSupply.add(fairSupply), totalSupply);
                virtualBalancesForAddition[_tokens[i]].scale(_decayPeriod, realBalances[i], totalSupply.add(fairSupply), totalSupply);
            }
        }

        require(fairSupply > 0, "Mooniswap: result is not enough");
        _mint(target, fairSupply);

        emit Deposited(msg.sender, target, fairSupply, receivedAmounts[0], receivedAmounts[1]);
    }

    function withdraw(uint256 amount, uint256[] memory minReturns) external returns(uint256[2] memory withdrawnAmounts) {
        return withdrawFor(amount, minReturns, msg.sender);
    }

    function withdrawFor(uint256 amount, uint256[] memory minReturns, address payable target) public nonReentrant returns(uint256[2] memory withdrawnAmounts) {
        IERC20[2] memory _tokens = [token0, token1];

        uint256 totalSupply = totalSupply();
        uint256 _decayPeriod = decayPeriod();  // gas savings
        _burn(msg.sender, amount);

        for (uint i = 0; i < _tokens.length; i++) {
            IERC20 token = _tokens[i];

            uint256 preBalance = token.uniBalanceOf(address(this));
            uint256 value = preBalance.mul(amount).div(totalSupply);
            token.uniTransfer(target, value);
            withdrawnAmounts[i] = value;
            require(i >= minReturns.length || value >= minReturns[i], "Mooniswap: result is not enough");

            virtualBalancesForAddition[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply);
            virtualBalancesForRemoval[token].scale(_decayPeriod, preBalance, totalSupply.sub(amount), totalSupply);
        }

        emit Withdrawn(msg.sender, target, amount, withdrawnAmounts[0], withdrawnAmounts[1]);
    }

    function swap(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address referral) external payable returns(uint256 result) {
        return swapFor(src, dst, amount, minReturn, referral, msg.sender);
    }

    function swapFor(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address referral, address payable receiver) public payable nonReentrant whenNotShutdown returns(uint256 result) {
        require(msg.value == (src.isETH() ? amount : 0), "Mooniswap: wrong value usage");

        Balances memory balances = Balances({
            src: src.uniBalanceOf(address(this)).sub(src.isETH() ? msg.value : 0),
            dst: dst.uniBalanceOf(address(this))
        });
        uint256 confirmed;
        Balances memory virtualBalances;
        Fees memory fees = Fees({
            fee: fee(),
            slippageFee: slippageFee()
        });
        (confirmed, result, virtualBalances) = _doTransfers(src, dst, amount, minReturn, receiver, balances, fees);
        emit Swapped(msg.sender, receiver, address(src), address(dst), confirmed, result, virtualBalances.src, virtualBalances.dst, referral);
        _mintRewards(confirmed, result, referral, balances, fees);

        // Overflow of uint128 is desired
        volumes[src].confirmed += uint128(confirmed);
        volumes[src].result += uint128(result);
    }

    function _doTransfers(IERC20 src, IERC20 dst, uint256 amount, uint256 minReturn, address payable receiver, Balances memory balances, Fees memory fees)
        private returns(uint256 confirmed, uint256 result, Balances memory virtualBalances)
    {
        uint256 _decayPeriod = decayPeriod();
        virtualBalances.src = virtualBalancesForAddition[src].current(_decayPeriod, balances.src);
        virtualBalances.src = Math.max(virtualBalances.src, balances.src);
        virtualBalances.dst = virtualBalancesForRemoval[dst].current(_decayPeriod, balances.dst);
        virtualBalances.dst = Math.min(virtualBalances.dst, balances.dst);
        src.uniTransferFrom(msg.sender, address(this), amount);
        confirmed = src.uniBalanceOf(address(this)).sub(balances.src);
        result = _getReturn(src, dst, confirmed, virtualBalances.src, virtualBalances.dst, fees.fee, fees.slippageFee);
        require(result > 0 && result >= minReturn, "Mooniswap: return is not enough");
        dst.uniTransfer(receiver, result);

        // Update virtual balances to the same direction only at imbalanced state
        if (virtualBalances.src != balances.src) {
            virtualBalancesForAddition[src].set(virtualBalances.src.add(confirmed));
        }
        if (virtualBalances.dst != balances.dst) {
            virtualBalancesForRemoval[dst].set(virtualBalances.dst.sub(result));
        }
        // Update virtual balances to the opposite direction
        virtualBalancesForRemoval[src].update(_decayPeriod, balances.src);
        virtualBalancesForAddition[dst].update(_decayPeriod, balances.dst);
    }

    function _mintRewards(uint256 confirmed, uint256 result, address referral, Balances memory balances, Fees memory fees) private {
        (uint256 referralShare, uint256 governanceShare, address govWallet, address feeCollector) = mooniswapFactoryGovernance.shareParameters();

        uint256 refReward;
        uint256 govReward;

        uint256 invariantRatio = uint256(1e36);
        invariantRatio = invariantRatio.mul(balances.src.add(confirmed)).div(balances.src);
        invariantRatio = invariantRatio.mul(balances.dst.sub(result)).div(balances.dst);
        if (invariantRatio > 1e36) {
            // calculate share only if invariant increased
            invariantRatio = invariantRatio.sqrt();
            uint256 invIncrease = totalSupply().mul(invariantRatio.sub(1e18)).div(invariantRatio);

            refReward = (referral != address(0)) ? invIncrease.mul(referralShare).div(MooniswapConstants._FEE_DENOMINATOR) : 0;
            govReward = (govWallet != address(0)) ? invIncrease.mul(governanceShare).div(MooniswapConstants._FEE_DENOMINATOR) : 0;

            if (feeCollector == address(0)) {
                if (refReward > 0) {
                    _mint(referral, refReward);
                }
                if (govReward > 0) {
                    _mint(govWallet, govReward);
                }
            }
            else if (refReward > 0 || govReward > 0) {
                uint256 len = (refReward > 0 ? 1 : 0) + (govReward > 0 ? 1 : 0);
                address[] memory wallets = new address[](len);
                uint256[] memory rewards = new uint256[](len);

                wallets[0] = referral;
                rewards[0] = refReward;
                if (govReward > 0) {
                    wallets[len - 1] = govWallet;
                    rewards[len - 1] = govReward;
                }

                try IFeeCollector(feeCollector).updateRewards(wallets, rewards) {
                    _mint(feeCollector, refReward.add(govReward));
                }
                catch {
                    emit Error("updateRewards() failed");
                }
            }
        }

        emit Sync(balances.src, balances.dst, fees.fee, fees.slippageFee, refReward, govReward);
    }

    /*
        spot_ret = dx * y / x
        uni_ret = dx * y / (x + dx)
        slippage = (spot_ret - uni_ret) / spot_ret
        slippage = dx * dx * y / (x * (x + dx)) / (dx * y / x)
        slippage = dx / (x + dx)
        ret = uni_ret * (1 - slip_fee * slippage)
        ret = dx * y / (x + dx) * (1 - slip_fee * dx / (x + dx))
        ret = dx * y / (x + dx) * (x + dx - slip_fee * dx) / (x + dx)

        x = amount * denominator
        dx = amount * (denominator - fee)
    */
    function _getReturn(IERC20 src, IERC20 dst, uint256 amount, uint256 srcBalance, uint256 dstBalance, uint256 fee, uint256 slippageFee) internal view returns(uint256) {
        if (src > dst) {
            (src, dst) = (dst, src);
        }
        if (amount > 0 && src == token0 && dst == token1) {
            uint256 taxedAmount = amount.sub(amount.mul(fee).div(MooniswapConstants._FEE_DENOMINATOR));
            uint256 srcBalancePlusTaxedAmount = srcBalance.add(taxedAmount);
            uint256 ret = taxedAmount.mul(dstBalance).div(srcBalancePlusTaxedAmount);
            uint256 feeNumerator = MooniswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount).sub(slippageFee.mul(taxedAmount));
            uint256 feeDenominator = MooniswapConstants._FEE_DENOMINATOR.mul(srcBalancePlusTaxedAmount);
            return ret.mul(feeNumerator).div(feeDenominator);
        }
    }

    function rescueFunds(IERC20 token, uint256 amount) external nonReentrant onlyOwner {
        uint256 balance0 = token0.uniBalanceOf(address(this));
        uint256 balance1 = token1.uniBalanceOf(address(this));

        token.uniTransfer(msg.sender, amount);

        require(token0.uniBalanceOf(address(this)) >= balance0, "Mooniswap: access denied");
        require(token1.uniBalanceOf(address(this)) >= balance1, "Mooniswap: access denied");
        require(balanceOf(address(this)) >= _BASE_SUPPLY, "Mooniswap: access denied");
    }
}

File 2 of 30 : MooniswapFactory.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "./interfaces/IMooniswapDeployer.sol";
import "./interfaces/IMooniswapFactory.sol";
import "./libraries/UniERC20.sol";
import "./Mooniswap.sol";
import "./governance/MooniswapFactoryGovernance.sol";


contract MooniswapFactory is IMooniswapFactory, MooniswapFactoryGovernance {
    using UniERC20 for IERC20;

    event Deployed(
        Mooniswap indexed mooniswap,
        IERC20 indexed token1,
        IERC20 indexed token2
    );

    IMooniswapDeployer public immutable mooniswapDeployer;
    address public immutable poolOwner;
    Mooniswap[] public allPools;
    mapping(Mooniswap => bool) public override isPool;
    mapping(IERC20 => mapping(IERC20 => Mooniswap)) private _pools;

    constructor (address _poolOwner, IMooniswapDeployer _mooniswapDeployer, address _governanceMothership) public MooniswapFactoryGovernance(_governanceMothership) {
        poolOwner = _poolOwner;
        mooniswapDeployer = _mooniswapDeployer;
    }

    function getAllPools() external view returns(Mooniswap[] memory) {
        return allPools;
    }

    function pools(IERC20 tokenA, IERC20 tokenB) external view override returns (Mooniswap pool) {
        (IERC20 token1, IERC20 token2) = sortTokens(tokenA, tokenB);
        return _pools[token1][token2];
    }

    function deploy(IERC20 tokenA, IERC20 tokenB) public returns(Mooniswap pool) {
        require(tokenA != tokenB, "Factory: not support same tokens");
        (IERC20 token1, IERC20 token2) = sortTokens(tokenA, tokenB);
        require(_pools[token1][token2] == Mooniswap(0), "Factory: pool already exists");

        string memory symbol1 = token1.uniSymbol();
        string memory symbol2 = token2.uniSymbol();

        pool = mooniswapDeployer.deploy(
            token1,
            token2,
            string(abi.encodePacked("1inch Liquidity Pool (", symbol1, "-", symbol2, ")")),
            string(abi.encodePacked("1LP-", symbol1, "-", symbol2)),
            poolOwner
        );

        _pools[token1][token2] = pool;
        allPools.push(pool);
        isPool[pool] = true;

        emit Deployed(pool, token1, token2);
    }

    function sortTokens(IERC20 tokenA, IERC20 tokenB) public pure returns(IERC20, IERC20) {
        if (tokenA < tokenB) {
            return (tokenA, tokenB);
        }
        return (tokenB, tokenA);
    }
}

File 3 of 30 : BaseGovernanceModule.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../interfaces/IGovernanceModule.sol";


abstract contract BaseGovernanceModule is IGovernanceModule {
    address public immutable mothership;

    modifier onlyMothership {
        require(msg.sender == mothership, "Access restricted to mothership");

        _;
    }

    constructor(address _mothership) public {
        mothership = _mothership;
    }

    function notifyStakesChanged(address[] calldata accounts, uint256[] calldata newBalances) external override onlyMothership {
        require(accounts.length == newBalances.length, "Arrays length should be equal");

        for(uint256 i = 0; i < accounts.length; ++i) {
            _notifyStakeChanged(accounts[i], newBalances[i]);
        }
    }

    function notifyStakeChanged(address account, uint256 newBalance) external override onlyMothership {
        _notifyStakeChanged(account, newBalance);
    }

    function _notifyStakeChanged(address account, uint256 newBalance) internal virtual;
}

File 4 of 30 : MooniswapFactoryGovernance.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "../interfaces/IMooniswapFactoryGovernance.sol";
import "../libraries/ExplicitLiquidVoting.sol";
import "../libraries/MooniswapConstants.sol";
import "../libraries/SafeCast.sol";
import "../utils/BalanceAccounting.sol";
import "./BaseGovernanceModule.sol";


contract MooniswapFactoryGovernance is IMooniswapFactoryGovernance, BaseGovernanceModule, BalanceAccounting, Ownable, Pausable {
    using Vote for Vote.Data;
    using ExplicitLiquidVoting for ExplicitLiquidVoting.Data;
    using VirtualVote for VirtualVote.Data;
    using SafeMath for uint256;
    using SafeCast for uint256;

    event DefaultFeeVoteUpdate(address indexed user, uint256 fee, bool isDefault, uint256 amount);
    event DefaultSlippageFeeVoteUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount);
    event DefaultDecayPeriodVoteUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount);
    event ReferralShareVoteUpdate(address indexed user, uint256 referralShare, bool isDefault, uint256 amount);
    event GovernanceShareVoteUpdate(address indexed user, uint256 governanceShare, bool isDefault, uint256 amount);
    event GovernanceWalletUpdate(address governanceWallet);
    event FeeCollectorUpdate(address feeCollector);

    ExplicitLiquidVoting.Data private _defaultFee;
    ExplicitLiquidVoting.Data private _defaultSlippageFee;
    ExplicitLiquidVoting.Data private _defaultDecayPeriod;
    ExplicitLiquidVoting.Data private _referralShare;
    ExplicitLiquidVoting.Data private _governanceShare;
    address public override governanceWallet;
    address public override feeCollector;

    mapping(address => bool) public override isFeeCollector;

    constructor(address _mothership) public BaseGovernanceModule(_mothership) {
        _defaultFee.data.result = MooniswapConstants._DEFAULT_FEE.toUint104();
        _defaultSlippageFee.data.result = MooniswapConstants._DEFAULT_SLIPPAGE_FEE.toUint104();
        _defaultDecayPeriod.data.result = MooniswapConstants._DEFAULT_DECAY_PERIOD.toUint104();
        _referralShare.data.result = MooniswapConstants._DEFAULT_REFERRAL_SHARE.toUint104();
        _governanceShare.data.result = MooniswapConstants._DEFAULT_GOVERNANCE_SHARE.toUint104();
    }

    function shutdown() external onlyOwner {
        _pause();
    }

    function isActive() external view override returns (bool) {
        return !paused();
    }

    function shareParameters() external view override returns(uint256, uint256, address, address) {
        return (_referralShare.data.current(), _governanceShare.data.current(), governanceWallet, feeCollector);
    }

    function defaults() external view override returns(uint256, uint256, uint256) {
        return (_defaultFee.data.current(), _defaultSlippageFee.data.current(), _defaultDecayPeriod.data.current());
    }

    function defaultFee() external view override returns(uint256) {
        return _defaultFee.data.current();
    }

    function defaultFeeVotes(address user) external view returns(uint256) {
        return _defaultFee.votes[user].get(MooniswapConstants._DEFAULT_FEE);
    }

    function virtualDefaultFee() external view returns(uint104, uint104, uint48) {
        return (_defaultFee.data.oldResult, _defaultFee.data.result, _defaultFee.data.time);
    }

    function defaultSlippageFee() external view override returns(uint256) {
        return _defaultSlippageFee.data.current();
    }

    function defaultSlippageFeeVotes(address user) external view returns(uint256) {
        return _defaultSlippageFee.votes[user].get(MooniswapConstants._DEFAULT_SLIPPAGE_FEE);
    }

    function virtualDefaultSlippageFee() external view returns(uint104, uint104, uint48) {
        return (_defaultSlippageFee.data.oldResult, _defaultSlippageFee.data.result, _defaultSlippageFee.data.time);
    }

    function defaultDecayPeriod() external view override returns(uint256) {
        return _defaultDecayPeriod.data.current();
    }

    function defaultDecayPeriodVotes(address user) external view returns(uint256) {
        return _defaultDecayPeriod.votes[user].get(MooniswapConstants._DEFAULT_DECAY_PERIOD);
    }

    function virtualDefaultDecayPeriod() external view returns(uint104, uint104, uint48) {
        return (_defaultDecayPeriod.data.oldResult, _defaultDecayPeriod.data.result, _defaultDecayPeriod.data.time);
    }

    function referralShare() external view override returns(uint256) {
        return _referralShare.data.current();
    }

    function referralShareVotes(address user) external view returns(uint256) {
        return _referralShare.votes[user].get(MooniswapConstants._DEFAULT_REFERRAL_SHARE);
    }

    function virtualReferralShare() external view returns(uint104, uint104, uint48) {
        return (_referralShare.data.oldResult, _referralShare.data.result, _referralShare.data.time);
    }

    function governanceShare() external view override returns(uint256) {
        return _governanceShare.data.current();
    }

    function governanceShareVotes(address user) external view returns(uint256) {
        return _governanceShare.votes[user].get(MooniswapConstants._DEFAULT_GOVERNANCE_SHARE);
    }

    function virtualGovernanceShare() external view returns(uint104, uint104, uint48) {
        return (_governanceShare.data.oldResult, _governanceShare.data.result, _governanceShare.data.time);
    }

    function setGovernanceWallet(address newGovernanceWallet) external onlyOwner {
        governanceWallet = newGovernanceWallet;
        isFeeCollector[newGovernanceWallet] = true;
        emit GovernanceWalletUpdate(newGovernanceWallet);
    }

    function setFeeCollector(address newFeeCollector) external onlyOwner {
        feeCollector = newFeeCollector;
        isFeeCollector[newFeeCollector] = true;
        emit FeeCollectorUpdate(newFeeCollector);
    }

    function defaultFeeVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_FEE, "Fee vote is too high");
        _defaultFee.updateVote(msg.sender, _defaultFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate);
    }

    function discardDefaultFeeVote() external {
       _defaultFee.updateVote(msg.sender, _defaultFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate);
    }

    function defaultSlippageFeeVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_SLIPPAGE_FEE, "Slippage fee vote is too high");
        _defaultSlippageFee.updateVote(msg.sender, _defaultSlippageFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate);
    }

   function discardDefaultSlippageFeeVote() external {
        _defaultSlippageFee.updateVote(msg.sender, _defaultSlippageFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate);
    }

    function defaultDecayPeriodVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_DECAY_PERIOD, "Decay period vote is too high");
        require(vote >= MooniswapConstants._MIN_DECAY_PERIOD, "Decay period vote is too low");
        _defaultDecayPeriod.updateVote(msg.sender, _defaultDecayPeriod.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate);
    }

    function discardDefaultDecayPeriodVote() external {
        _defaultDecayPeriod.updateVote(msg.sender, _defaultDecayPeriod.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate);
    }

    function referralShareVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_SHARE, "Referral share vote is too high");
        require(vote >= MooniswapConstants._MIN_REFERRAL_SHARE, "Referral share vote is too low");
        _referralShare.updateVote(msg.sender, _referralShare.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate);
    }

    function discardReferralShareVote() external {
        _referralShare.updateVote(msg.sender, _referralShare.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate);
    }

    function governanceShareVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_SHARE, "Gov share vote is too high");
        _governanceShare.updateVote(msg.sender, _governanceShare.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate);
    }

    function discardGovernanceShareVote() external {
        _governanceShare.updateVote(msg.sender, _governanceShare.votes[msg.sender], Vote.init(), balanceOf(msg.sender), MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate);
    }

    function _notifyStakeChanged(address account, uint256 newBalance) internal override {
        uint256 balance = _set(account, newBalance);
        if (newBalance == balance) {
            return;
        }

        _defaultFee.updateBalance(account, _defaultFee.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_FEE, _emitDefaultFeeVoteUpdate);
        _defaultSlippageFee.updateBalance(account, _defaultSlippageFee.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_SLIPPAGE_FEE, _emitDefaultSlippageFeeVoteUpdate);
        _defaultDecayPeriod.updateBalance(account, _defaultDecayPeriod.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_DECAY_PERIOD, _emitDefaultDecayPeriodVoteUpdate);
        _referralShare.updateBalance(account, _referralShare.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_REFERRAL_SHARE, _emitReferralShareVoteUpdate);
        _governanceShare.updateBalance(account, _governanceShare.votes[account], balance, newBalance, MooniswapConstants._DEFAULT_GOVERNANCE_SHARE, _emitGovernanceShareVoteUpdate);
    }

    function _emitDefaultFeeVoteUpdate(address user, uint256 newDefaultFee, bool isDefault, uint256 balance) private {
        emit DefaultFeeVoteUpdate(user, newDefaultFee, isDefault, balance);
    }

    function _emitDefaultSlippageFeeVoteUpdate(address user, uint256 newDefaultSlippageFee, bool isDefault, uint256 balance) private {
        emit DefaultSlippageFeeVoteUpdate(user, newDefaultSlippageFee, isDefault, balance);
    }

    function _emitDefaultDecayPeriodVoteUpdate(address user, uint256 newDefaultDecayPeriod, bool isDefault, uint256 balance) private {
        emit DefaultDecayPeriodVoteUpdate(user, newDefaultDecayPeriod, isDefault, balance);
    }

    function _emitReferralShareVoteUpdate(address user, uint256 newReferralShare, bool isDefault, uint256 balance) private {
        emit ReferralShareVoteUpdate(user, newReferralShare, isDefault, balance);
    }

    function _emitGovernanceShareVoteUpdate(address user, uint256 newGovernanceShare, bool isDefault, uint256 balance) private {
        emit GovernanceShareVoteUpdate(user, newGovernanceShare, isDefault, balance);
    }
}

File 5 of 30 : MooniswapGovernance.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../interfaces/IMooniswapFactoryGovernance.sol";
import "../libraries/LiquidVoting.sol";
import "../libraries/MooniswapConstants.sol";
import "../libraries/SafeCast.sol";


abstract contract MooniswapGovernance is ERC20, Ownable, ReentrancyGuard {
    using Vote for Vote.Data;
    using LiquidVoting for LiquidVoting.Data;
    using VirtualVote for VirtualVote.Data;
    using SafeCast for uint256;

    event FeeVoteUpdate(address indexed user, uint256 fee, bool isDefault, uint256 amount);
    event SlippageFeeVoteUpdate(address indexed user, uint256 slippageFee, bool isDefault, uint256 amount);
    event DecayPeriodVoteUpdate(address indexed user, uint256 decayPeriod, bool isDefault, uint256 amount);

    IMooniswapFactoryGovernance public mooniswapFactoryGovernance;
    LiquidVoting.Data private _fee;
    LiquidVoting.Data private _slippageFee;
    LiquidVoting.Data private _decayPeriod;

    constructor(IMooniswapFactoryGovernance _mooniswapFactoryGovernance) internal {
        mooniswapFactoryGovernance = _mooniswapFactoryGovernance;
        _fee.data.result = _mooniswapFactoryGovernance.defaultFee().toUint104();
        _slippageFee.data.result = _mooniswapFactoryGovernance.defaultSlippageFee().toUint104();
        _decayPeriod.data.result = _mooniswapFactoryGovernance.defaultDecayPeriod().toUint104();
    }

    function setMooniswapFactoryGovernance(IMooniswapFactoryGovernance newMooniswapFactoryGovernance) external onlyOwner {
        mooniswapFactoryGovernance = newMooniswapFactoryGovernance;
        this.discardFeeVote();
        this.discardSlippageFeeVote();
        this.discardDecayPeriodVote();
    }

    function fee() public view returns(uint256) {
        return _fee.data.current();
    }

    function slippageFee() public view returns(uint256) {
        return _slippageFee.data.current();
    }

    function decayPeriod() public view returns(uint256) {
        return _decayPeriod.data.current();
    }

    function virtualFee() external view returns(uint104, uint104, uint48) {
        return (_fee.data.oldResult, _fee.data.result, _fee.data.time);
    }

    function virtualSlippageFee() external view returns(uint104, uint104, uint48) {
        return (_slippageFee.data.oldResult, _slippageFee.data.result, _slippageFee.data.time);
    }

    function virtualDecayPeriod() external view returns(uint104, uint104, uint48) {
        return (_decayPeriod.data.oldResult, _decayPeriod.data.result, _decayPeriod.data.time);
    }

    function feeVotes(address user) external view returns(uint256) {
        return _fee.votes[user].get(mooniswapFactoryGovernance.defaultFee);
    }

    function slippageFeeVotes(address user) external view returns(uint256) {
        return _slippageFee.votes[user].get(mooniswapFactoryGovernance.defaultSlippageFee);
    }

    function decayPeriodVotes(address user) external view returns(uint256) {
        return _decayPeriod.votes[user].get(mooniswapFactoryGovernance.defaultDecayPeriod);
    }

    function feeVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_FEE, "Fee vote is too high");

        _fee.updateVote(msg.sender, _fee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultFee(), _emitFeeVoteUpdate);
    }

    function slippageFeeVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_SLIPPAGE_FEE, "Slippage fee vote is too high");

        _slippageFee.updateVote(msg.sender, _slippageFee.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultSlippageFee(), _emitSlippageFeeVoteUpdate);
    }

    function decayPeriodVote(uint256 vote) external {
        require(vote <= MooniswapConstants._MAX_DECAY_PERIOD, "Decay period vote is too high");
        require(vote >= MooniswapConstants._MIN_DECAY_PERIOD, "Decay period vote is too low");

        _decayPeriod.updateVote(msg.sender, _decayPeriod.votes[msg.sender], Vote.init(vote), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultDecayPeriod(), _emitDecayPeriodVoteUpdate);
    }

    function discardFeeVote() external {
        _fee.updateVote(msg.sender, _fee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultFee(), _emitFeeVoteUpdate);
    }

    function discardSlippageFeeVote() external {
        _slippageFee.updateVote(msg.sender, _slippageFee.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultSlippageFee(), _emitSlippageFeeVoteUpdate);
    }

    function discardDecayPeriodVote() external {
        _decayPeriod.updateVote(msg.sender, _decayPeriod.votes[msg.sender], Vote.init(), balanceOf(msg.sender), totalSupply(), mooniswapFactoryGovernance.defaultDecayPeriod(), _emitDecayPeriodVoteUpdate);
    }

    function _emitFeeVoteUpdate(address account, uint256 newFee, bool isDefault, uint256 newBalance) private {
        emit FeeVoteUpdate(account, newFee, isDefault, newBalance);
    }

    function _emitSlippageFeeVoteUpdate(address account, uint256 newSlippageFee, bool isDefault, uint256 newBalance) private {
        emit SlippageFeeVoteUpdate(account, newSlippageFee, isDefault, newBalance);
    }

    function _emitDecayPeriodVoteUpdate(address account, uint256 newDecayPeriod, bool isDefault, uint256 newBalance) private {
        emit DecayPeriodVoteUpdate(account, newDecayPeriod, isDefault, newBalance);
    }

    function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
        if (from == to) {
            // ignore transfers to self
            return;
        }

        IMooniswapFactoryGovernance _mooniswapFactoryGovernance = mooniswapFactoryGovernance;
        bool updateFrom = !(from == address(0) || _mooniswapFactoryGovernance.isFeeCollector(from));
        bool updateTo = !(to == address(0) || _mooniswapFactoryGovernance.isFeeCollector(to));

        if (!updateFrom && !updateTo) {
            // mint to feeReceiver or burn from feeReceiver
            return;
        }

        uint256 balanceFrom = (from != address(0)) ? balanceOf(from) : 0;
        uint256 balanceTo = (to != address(0)) ? balanceOf(to) : 0;
        uint256 newTotalSupply = totalSupply()
            .add(from == address(0) ? amount : 0)
            .sub(to == address(0) ? amount : 0);

        ParamsHelper memory params = ParamsHelper({
            from: from,
            to: to,
            updateFrom: updateFrom,
            updateTo: updateTo,
            amount: amount,
            balanceFrom: balanceFrom,
            balanceTo: balanceTo,
            newTotalSupply: newTotalSupply
        });

        (uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod) = _mooniswapFactoryGovernance.defaults();

        _updateOnTransfer(params, defaultFee, _emitFeeVoteUpdate, _fee);
        _updateOnTransfer(params, defaultSlippageFee, _emitSlippageFeeVoteUpdate, _slippageFee);
        _updateOnTransfer(params, defaultDecayPeriod, _emitDecayPeriodVoteUpdate, _decayPeriod);
    }

    struct ParamsHelper {
        address from;
        address to;
        bool updateFrom;
        bool updateTo;
        uint256 amount;
        uint256 balanceFrom;
        uint256 balanceTo;
        uint256 newTotalSupply;
    }

    function _updateOnTransfer(
        ParamsHelper memory params,
        uint256 defaultValue,
        function(address, uint256, bool, uint256) internal emitEvent,
        LiquidVoting.Data storage votingData
    ) private {
        Vote.Data memory voteFrom = votingData.votes[params.from];
        Vote.Data memory voteTo = votingData.votes[params.to];

        if (voteFrom.isDefault() && voteTo.isDefault() && params.updateFrom && params.updateTo) {
            emitEvent(params.from, voteFrom.get(defaultValue), true, params.balanceFrom.sub(params.amount));
            emitEvent(params.to, voteTo.get(defaultValue), true, params.balanceTo.add(params.amount));
            return;
        }

        if (params.updateFrom) {
            votingData.updateBalance(params.from, voteFrom, params.balanceFrom, params.balanceFrom.sub(params.amount), params.newTotalSupply, defaultValue, emitEvent);
        }

        if (params.updateTo) {
            votingData.updateBalance(params.to, voteTo, params.balanceTo, params.balanceTo.add(params.amount), params.newTotalSupply, defaultValue, emitEvent);
        }
    }
}

File 6 of 30 : IFeeCollector.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;


interface IFeeCollector {
    function updateReward(address receiver, uint256 amount) external;
    function updateRewards(address[] calldata receivers, uint256[] calldata amounts) external;
}

File 7 of 30 : IGovernanceModule.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;


interface IGovernanceModule {
    function notifyStakeChanged(address account, uint256 newBalance) external;
    function notifyStakesChanged(address[] calldata accounts, uint256[] calldata newBalances) external;
}

File 8 of 30 : IMooniswapDeployer.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../Mooniswap.sol";

interface IMooniswapDeployer {
    function deploy(
        IERC20 token1,
        IERC20 token2,
        string calldata name,
        string calldata symbol,
        address poolOwner
    ) external returns(Mooniswap pool);
}

File 9 of 30 : IMooniswapFactory.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../Mooniswap.sol";

interface IMooniswapFactory is IMooniswapFactoryGovernance {
    function pools(IERC20 token0, IERC20 token1) external view returns (Mooniswap);
    function isPool(Mooniswap mooniswap) external view returns (bool);
}

File 10 of 30 : IMooniswapFactoryGovernance.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;


interface IMooniswapFactoryGovernance {
    function shareParameters() external view returns(uint256 referralShare, uint256 governanceShare, address governanceWallet, address referralFeeReceiver);
    function defaults() external view returns(uint256 defaultFee, uint256 defaultSlippageFee, uint256 defaultDecayPeriod);

    function defaultFee() external view returns(uint256);
    function defaultSlippageFee() external view returns(uint256);
    function defaultDecayPeriod() external view returns(uint256);
    function referralShare() external view returns(uint256);
    function governanceShare() external view returns(uint256);
    function governanceWallet() external view returns(address);
    function feeCollector() external view returns(address);

    function isFeeCollector(address) external view returns(bool);
    function isActive() external view returns (bool);
}

File 11 of 30 : ExplicitLiquidVoting.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./SafeCast.sol";
import "./VirtualVote.sol";
import "./Vote.sol";


library ExplicitLiquidVoting {
    using SafeMath for uint256;
    using SafeCast for uint256;
    using Vote for Vote.Data;
    using VirtualVote for VirtualVote.Data;

    struct Data {
        VirtualVote.Data data;
        uint256 _weightedSum;
        uint256 _votedSupply;
        mapping(address => Vote.Data) votes;
    }

    function updateVote(
        ExplicitLiquidVoting.Data storage self,
        address user,
        Vote.Data memory oldVote,
        Vote.Data memory newVote,
        uint256 balance,
        uint256 defaultVote,
        function(address, uint256, bool, uint256) emitEvent
    ) internal {
        return _update(self, user, oldVote, newVote, balance, balance, defaultVote, emitEvent);
    }

    function updateBalance(
        ExplicitLiquidVoting.Data storage self,
        address user,
        Vote.Data memory oldVote,
        uint256 oldBalance,
        uint256 newBalance,
        uint256 defaultVote,
        function(address, uint256, bool, uint256) emitEvent
    ) internal {
        return _update(self, user, oldVote, newBalance == 0 ? Vote.init() : oldVote, oldBalance, newBalance, defaultVote, emitEvent);
    }

    function _update(
        ExplicitLiquidVoting.Data storage self,
        address user,
        Vote.Data memory oldVote,
        Vote.Data memory newVote,
        uint256 oldBalance,
        uint256 newBalance,
        uint256 defaultVote,
        function(address, uint256, bool, uint256) emitEvent
    ) private {
        uint256 oldWeightedSum = self._weightedSum;
        uint256 newWeightedSum = oldWeightedSum;
        uint256 oldVotedSupply = self._votedSupply;
        uint256 newVotedSupply = oldVotedSupply;

        if (!oldVote.isDefault()) {
            newWeightedSum = newWeightedSum.sub(oldBalance.mul(oldVote.get(defaultVote)));
            newVotedSupply = newVotedSupply.sub(oldBalance);
        }

        if (!newVote.isDefault()) {
            newWeightedSum = newWeightedSum.add(newBalance.mul(newVote.get(defaultVote)));
            newVotedSupply = newVotedSupply.add(newBalance);
        }

        if (newWeightedSum != oldWeightedSum) {
            self._weightedSum = newWeightedSum;
        }

        if (newVotedSupply != oldVotedSupply) {
            self._votedSupply = newVotedSupply;
        }

        {
            uint256 newResult = newVotedSupply == 0 ? defaultVote : newWeightedSum.div(newVotedSupply);
            VirtualVote.Data memory data = self.data;

            if (newResult != data.result) {
                VirtualVote.Data storage sdata = self.data;
                (sdata.oldResult, sdata.result, sdata.time) = (
                    data.current().toUint104(),
                    newResult.toUint104(),
                    block.timestamp.toUint48()
                );
            }
        }

        if (!newVote.eq(oldVote)) {
            self.votes[user] = newVote;
        }

        emitEvent(user, newVote.get(defaultVote), newVote.isDefault(), newBalance);
    }
}

File 12 of 30 : LiquidVoting.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

import "@openzeppelin/contracts/math/SafeMath.sol";
import "./SafeCast.sol";
import "./VirtualVote.sol";
import "./Vote.sol";


library LiquidVoting {
    using SafeMath for uint256;
    using SafeCast for uint256;
    using Vote for Vote.Data;
    using VirtualVote for VirtualVote.Data;

    struct Data {
        VirtualVote.Data data;
        uint256 _weightedSum;
        uint256 _defaultVotes;
        mapping(address => Vote.Data) votes;
    }

    function updateVote(
        LiquidVoting.Data storage self,
        address user,
        Vote.Data memory oldVote,
        Vote.Data memory newVote,
        uint256 balance,
        uint256 totalSupply,
        uint256 defaultVote,
        function(address, uint256, bool, uint256) emitEvent
    ) internal {
        return _update(self, user, oldVote, newVote, balance, balance, totalSupply, defaultVote, emitEvent);
    }

    function updateBalance(
        LiquidVoting.Data storage self,
        address user,
        Vote.Data memory oldVote,
        uint256 oldBalance,
        uint256 newBalance,
        uint256 newTotalSupply,
        uint256 defaultVote,
        function(address, uint256, bool, uint256) emitEvent
    ) internal {
        return _update(self, user, oldVote, newBalance == 0 ? Vote.init() : oldVote, oldBalance, newBalance, newTotalSupply, defaultVote, emitEvent);
    }

    function _update(
        LiquidVoting.Data storage self,
        address user,
        Vote.Data memory oldVote,
        Vote.Data memory newVote,
        uint256 oldBalance,
        uint256 newBalance,
        uint256 newTotalSupply,
        uint256 defaultVote,
        function(address, uint256, bool, uint256) emitEvent
    ) private {
        uint256 oldWeightedSum = self._weightedSum;
        uint256 newWeightedSum = oldWeightedSum;
        uint256 oldDefaultVotes = self._defaultVotes;
        uint256 newDefaultVotes = oldDefaultVotes;

        if (oldVote.isDefault()) {
            newDefaultVotes = newDefaultVotes.sub(oldBalance);
        } else {
            newWeightedSum = newWeightedSum.sub(oldBalance.mul(oldVote.get(defaultVote)));
        }

        if (newVote.isDefault()) {
            newDefaultVotes = newDefaultVotes.add(newBalance);
        } else {
            newWeightedSum = newWeightedSum.add(newBalance.mul(newVote.get(defaultVote)));
        }

        if (newWeightedSum != oldWeightedSum) {
            self._weightedSum = newWeightedSum;
        }

        if (newDefaultVotes != oldDefaultVotes) {
            self._defaultVotes = newDefaultVotes;
        }

        {
            uint256 newResult = newTotalSupply == 0 ? defaultVote : newWeightedSum.add(newDefaultVotes.mul(defaultVote)).div(newTotalSupply);
            VirtualVote.Data memory data = self.data;

            if (newResult != data.result) {
                VirtualVote.Data storage sdata = self.data;
                (sdata.oldResult, sdata.result, sdata.time) = (
                    data.current().toUint104(),
                    newResult.toUint104(),
                    block.timestamp.toUint48()
                );
            }
        }

        if (!newVote.eq(oldVote)) {
            self.votes[user] = newVote;
        }

        emitEvent(user, newVote.get(defaultVote), newVote.isDefault(), newBalance);
    }
}

File 13 of 30 : MooniswapConstants.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;


library MooniswapConstants {
    uint256 internal constant _FEE_DENOMINATOR = 1e18;

    uint256 internal constant _MIN_REFERRAL_SHARE = 0.05e18; // 5%
    uint256 internal constant _MIN_DECAY_PERIOD = 1 minutes;

    uint256 internal constant _MAX_FEE = 0.01e18; // 1%
    uint256 internal constant _MAX_SLIPPAGE_FEE = 1e18;  // 100%
    uint256 internal constant _MAX_SHARE = 0.1e18; // 10%
    uint256 internal constant _MAX_DECAY_PERIOD = 5 minutes;

    uint256 internal constant _DEFAULT_FEE = 0;
    uint256 internal constant _DEFAULT_SLIPPAGE_FEE = 1e18;  // 100%
    uint256 internal constant _DEFAULT_REFERRAL_SHARE = 0.1e18; // 10%
    uint256 internal constant _DEFAULT_GOVERNANCE_SHARE = 0;
    uint256 internal constant _DEFAULT_DECAY_PERIOD = 1 minutes;
}

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

pragma solidity ^0.6.0;

library SafeCast {
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value < 2**216, "value does not fit in 216 bits");
        return uint216(value);
    }

    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value < 2**104, "value does not fit in 104 bits");
        return uint104(value);
    }

    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value < 2**48, "value does not fit in 48 bits");
        return uint48(value);
    }

    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value < 2**40, "value does not fit in 40 bits");
        return uint40(value);
    }
}

File 15 of 30 : Sqrt.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;


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

File 16 of 30 : UniERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

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


library UniERC20 {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    function isETH(IERC20 token) internal pure returns(bool) {
        return (address(token) == address(0));
    }

    function uniBalanceOf(IERC20 token, address account) internal view returns (uint256) {
        if (isETH(token)) {
            return account.balance;
        } else {
            return token.balanceOf(account);
        }
    }

    function uniTransfer(IERC20 token, address payable to, uint256 amount) internal {
        if (amount > 0) {
            if (isETH(token)) {
                to.transfer(amount);
            } else {
                token.safeTransfer(to, amount);
            }
        }
    }

    function uniTransferFrom(IERC20 token, address payable from, address to, uint256 amount) internal {
        if (amount > 0) {
            if (isETH(token)) {
                require(msg.value >= amount, "UniERC20: not enough value");
                require(from == msg.sender, "from is not msg.sender");
                require(to == address(this), "to is not this");
                if (msg.value > amount) {
                    // Return remainder if exist
                    from.transfer(msg.value.sub(amount));
                }
            } else {
                token.safeTransferFrom(from, to, amount);
            }
        }
    }

    function uniSymbol(IERC20 token) internal view returns(string memory) {
        if (isETH(token)) {
            return "ETH";
        }

        (bool success, bytes memory data) = address(token).staticcall{ gas: 20000 }(
            abi.encodeWithSignature("symbol()")
        );
        if (!success) {
            (success, data) = address(token).staticcall{ gas: 20000 }(
                abi.encodeWithSignature("SYMBOL()")
            );
        }

        if (success && data.length >= 96) {
            (uint256 offset, uint256 len) = abi.decode(data, (uint256, uint256));
            if (offset == 0x20 && len > 0 && len <= 256) {
                return string(abi.decode(data, (bytes)));
            }
        }

        if (success && data.length == 32) {
            uint len = 0;
            while (len < data.length && data[len] >= 0x20 && data[len] <= 0x7E) {
                len++;
            }

            if (len > 0) {
                bytes memory result = new bytes(len);
                for (uint i = 0; i < len; i++) {
                    result[i] = data[i];
                }
                return string(result);
            }
        }

        return _toHex(address(token));
    }

    function _toHex(address account) private pure returns(string memory) {
        return _toHex(abi.encodePacked(account));
    }

    function _toHex(bytes memory data) private pure returns(string memory) {
        bytes memory str = new bytes(2 + data.length * 2);
        str[0] = "0";
        str[1] = "x";
        uint j = 2;
        for (uint i = 0; i < data.length; i++) {
            uint a = uint8(data[i]) >> 4;
            uint b = uint8(data[i]) & 0x0f;
            str[j++] = byte(uint8(a + 48 + (a/10)*39));
            str[j++] = byte(uint8(b + 48 + (b/10)*39));
        }

        return string(str);
    }
}

File 17 of 30 : VirtualBalance.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;


import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/math/Math.sol";
import "./SafeCast.sol";


library VirtualBalance {
    using SafeMath for uint256;
    using SafeCast for uint256;

    struct Data {
        uint216 balance;
        uint40 time;
    }

    function set(VirtualBalance.Data storage self, uint256 balance) internal {
        (self.balance, self.time) = (
            balance.toUint216(),
            block.timestamp.toUint40()
        );
    }

    function update(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance) internal {
        set(self, current(self, decayPeriod, realBalance));
    }

    function scale(VirtualBalance.Data storage self, uint256 decayPeriod, uint256 realBalance, uint256 num, uint256 denom) internal {
        set(self, current(self, decayPeriod, realBalance).mul(num).add(denom.sub(1)).div(denom));
    }

    function current(VirtualBalance.Data memory self, uint256 decayPeriod, uint256 realBalance) internal view returns(uint256) {
        uint256 timePassed = Math.min(decayPeriod, block.timestamp.sub(self.time));
        uint256 timeRemain = decayPeriod.sub(timePassed);
        return uint256(self.balance).mul(timeRemain).add(
            realBalance.mul(timePassed)
        ).div(decayPeriod);
    }
}

File 18 of 30 : VirtualVote.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;

import "@openzeppelin/contracts/math/Math.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";


library VirtualVote {
    using SafeMath for uint256;

    uint256 private constant _VOTE_DECAY_PERIOD = 1 days;

    struct Data {
        uint104 oldResult;
        uint104 result;
        uint48 time;
    }

    function current(VirtualVote.Data memory self) internal view returns(uint256) {
        uint256 timePassed = Math.min(_VOTE_DECAY_PERIOD, block.timestamp.sub(self.time));
        uint256 timeRemain = _VOTE_DECAY_PERIOD.sub(timePassed);
        return uint256(self.oldResult).mul(timeRemain).add(
            uint256(self.result).mul(timePassed)
        ).div(_VOTE_DECAY_PERIOD);
    }
}

File 19 of 30 : Vote.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.12;


library Vote {
    struct Data {
        uint256 value;
    }

    function eq(Vote.Data memory self, Vote.Data memory vote) internal pure returns(bool) {
        return self.value == vote.value;
    }

    function init() internal pure returns(Vote.Data memory data) {
        return Vote.Data({
            value: 0
        });
    }

    function init(uint256 vote) internal pure returns(Vote.Data memory data) {
        return Vote.Data({
            value: vote + 1
        });
    }

    function isDefault(Data memory self) internal pure returns(bool) {
        return self.value == 0;
    }

    function get(Data memory self, uint256 defaultVote) internal pure returns(uint256) {
        if (self.value > 0) {
            return self.value - 1;
        }
        return defaultVote;
    }

    function get(Data memory self, function() external view returns(uint256) defaultVoteFn) internal view returns(uint256) {
        if (self.value > 0) {
            return self.value - 1;
        }
        return defaultVoteFn();
    }
}

File 20 of 30 : BalanceAccounting.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "@openzeppelin/contracts/math/SafeMath.sol";


contract BalanceAccounting {
    using SafeMath for uint256;

    uint256 private _totalSupply;
    mapping(address => uint256) private _balances;

    function totalSupply() public view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function _mint(address account, uint256 amount) internal virtual {
        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
    }

    function _burn(address account, uint256 amount) internal virtual {
        _balances[account] = _balances[account].sub(amount, "Burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
    }

    function _set(address account, uint256 amount) internal virtual returns(uint256 oldAmount) {
        oldAmount = _balances[account];
        if (oldAmount != amount) {
            _balances[account] = amount;
            _totalSupply = _totalSupply.add(amount).sub(oldAmount);
        }
    }
}

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

pragma solidity ^0.6.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 22 of 30 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../GSN/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.
 */
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 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 23 of 30 : Math.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 24 of 30 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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, 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) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * 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);
        uint256 c = a - b;

        return c;
    }

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

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

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

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 25 of 30 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.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;
    using Address for address;

    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 returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view 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 returns (uint8) {
        return _decimals;
    }

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

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

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public 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 is internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 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 {
        _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 26 of 30 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 27 of 30 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.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 28 of 30 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.2;

/**
 * @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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

    /**
     * @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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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 29 of 30 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.6.0;

import "../GSN/Context.sol";

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

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

    bool private _paused;

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

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

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

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

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

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

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

pragma solidity ^0.6.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "evmVersion": "istanbul",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_token0","type":"address"},{"internalType":"contract IERC20","name":"_token1","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"contract IMooniswapFactoryGovernance","name":"_mooniswapFactoryGovernance","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"decayPeriod","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDefault","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DecayPeriodVoteUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token0Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Amount","type":"uint256"}],"name":"Deposited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"Error","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDefault","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeeVoteUpdate","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":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"slippageFee","type":"uint256"},{"indexed":false,"internalType":"bool","name":"isDefault","type":"bool"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SlippageFeeVoteUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"srcToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"result","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"srcAdditionBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstRemovalBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"referral","type":"address"}],"name":"Swapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"srcBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"dstBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"slippageFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"referralShare","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"governanceShare","type":"uint256"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"share","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token0Amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"token1Amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decayPeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vote","type":"uint256"}],"name":"decayPeriodVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"decayPeriodVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[2]","name":"maxAmounts","type":"uint256[2]"},{"internalType":"uint256[2]","name":"minAmounts","type":"uint256[2]"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"fairSupply","type":"uint256"},{"internalType":"uint256[2]","name":"receivedAmounts","type":"uint256[2]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[2]","name":"maxAmounts","type":"uint256[2]"},{"internalType":"uint256[2]","name":"minAmounts","type":"uint256[2]"},{"internalType":"address","name":"target","type":"address"}],"name":"depositFor","outputs":[{"internalType":"uint256","name":"fairSupply","type":"uint256"},{"internalType":"uint256[2]","name":"receivedAmounts","type":"uint256[2]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"discardDecayPeriodVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"discardFeeVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"discardSlippageFeeVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vote","type":"uint256"}],"name":"feeVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"feeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getBalanceForAddition","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"getBalanceForRemoval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"src","type":"address"},{"internalType":"contract IERC20","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getReturn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokens","outputs":[{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mooniswapFactoryGovernance","outputs":[{"internalType":"contract IMooniswapFactoryGovernance","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMooniswapFactoryGovernance","name":"newMooniswapFactoryGovernance","type":"address"}],"name":"setMooniswapFactoryGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippageFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vote","type":"uint256"}],"name":"slippageFeeVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"slippageFeeVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"src","type":"address"},{"internalType":"contract IERC20","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"referral","type":"address"}],"name":"swap","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"src","type":"address"},{"internalType":"contract IERC20","name":"dst","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"address","name":"referral","type":"address"},{"internalType":"address payable","name":"receiver","type":"address"}],"name":"swapFor","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"i","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"virtualBalancesForAddition","outputs":[{"internalType":"uint216","name":"balance","type":"uint216"},{"internalType":"uint40","name":"time","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"virtualBalancesForRemoval","outputs":[{"internalType":"uint216","name":"balance","type":"uint216"},{"internalType":"uint40","name":"time","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualDecayPeriod","outputs":[{"internalType":"uint104","name":"","type":"uint104"},{"internalType":"uint104","name":"","type":"uint104"},{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualFee","outputs":[{"internalType":"uint104","name":"","type":"uint104"},{"internalType":"uint104","name":"","type":"uint104"},{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"virtualSlippageFee","outputs":[{"internalType":"uint104","name":"","type":"uint104"},{"internalType":"uint104","name":"","type":"uint104"},{"internalType":"uint48","name":"","type":"uint48"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"name":"volumes","outputs":[{"internalType":"uint128","name":"confirmed","type":"uint128"},{"internalType":"uint128","name":"result","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"minReturns","type":"uint256[]"}],"name":"withdraw","outputs":[{"internalType":"uint256[2]","name":"withdrawnAmounts","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256[]","name":"minReturns","type":"uint256[]"},{"internalType":"address payable","name":"target","type":"address"}],"name":"withdrawFor","outputs":[{"internalType":"uint256[2]","name":"withdrawnAmounts","type":"uint256[2]"}],"stateMutability":"nonpayable","type":"function"}]

60c06040523480156200001157600080fd5b50604051620059e8380380620059e8833981810160405260a08110156200003757600080fd5b815160208301516040808501805191519395929483019291846401000000008211156200006357600080fd5b9083019060208201858111156200007957600080fd5b82516401000000008111828201881017156200009457600080fd5b82525081516020918201929091019080838360005b83811015620000c3578181015183820152602001620000a9565b50505050905090810190601f168015620000f15780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011557600080fd5b9083019060208201858111156200012b57600080fd5b82516401000000008111828201881017156200014657600080fd5b82525081516020918201929091019080838360005b83811015620001755781810151838201526020016200015b565b50505050905090810190601f168015620001a35780820380516001836020036101000a031916815260200191505b50604052602090810151855190935083925085918591620001cb91600391908501906200058a565b508051620001e19060049060208401906200058a565b50506005805460ff19166012179055506000620001fd62000527565b60058054610100600160a81b0319166101006001600160a01b03841690810291909117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600655600780546001600160a01b0319166001600160a01b038316908117909155604080516305a6c72d60e41b81529051620002f29291635a6c72d0916004808301926020929190829003018186803b158015620002b257600080fd5b505afa158015620002c7573d6000803e3d6000fd5b505050506040513d6020811015620002de57600080fd5b50516200052b602090811b62002ee817901c565b6008600001600001600d6101000a8154816001600160681b0302191690836001600160681b031602179055506200035c816001600160a01b03166323662bb96040518163ffffffff1660e01b815260040160206040518083038186803b158015620002b257600080fd5b600c600001600001600d6101000a8154816001600160681b0302191690836001600160681b03160217905550620003c6816001600160a01b0316631845f0db6040518163ffffffff1660e01b815260040160206040518083038186803b158015620002b257600080fd5b601080546001600160681b0392909216600160681b02600160681b600160d01b031990921691909117905550825162000446576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206e616d6520697320656d7074790000000000000000604482015290519081900360640190fd5b60008251116200049d576040805162461bcd60e51b815260206004820152601a60248201527f4d6f6f6e69737761703a2073796d626f6c20697320656d707479000000000000604482015290519081900360640190fd5b836001600160a01b0316856001600160a01b0316141562000505576040805162461bcd60e51b815260206004820152601b60248201527f4d6f6f6e69737761703a206475706c696361746520746f6b656e730000000000604482015290519081900360640190fd5b5050506001600160601b0319606092831b8116608052911b1660a0526200061c565b3390565b6000600160681b821062000586576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2031303420626974730000604482015290519081900360640190fd5b5090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005cd57805160ff1916838001178555620005fd565b82800160010185558215620005fd579182015b82811115620005fd578251825591602001919060010190620005e0565b50620005869291505b8082111562000586576000815560010162000606565b60805160601c60a05160601c61535c6200068c6000398061142552806116a752806119ad5280611a7e5280611d5c528061246e52806126af528061318052508061108152806114005280611677528061197652806119f75280611d3752806124205280613143525061535c6000f3fe6080604052600436106103135760003560e01c80637e82a6f31161019a578063d21220a7116100e1578063e331d0391161008a578063f1ea604211610064578063f1ea604214610e1a578063f2fde38b14610e2f578063f76d13b414610e6257610313565b8063e331d03914610d73578063e7ff42c914610dbd578063eaadf84814610df057610313565b8063d9a0c217116100bb578063d9a0c21714610d0e578063dd62ed3e14610d23578063ddca3f4314610d5e57610313565b8063d21220a714610c82578063d5bcb9b514610c97578063d7d3aab514610cdb57610313565b80639ea5ce0a11610143578063aa6ca8081161011d578063aa6ca80814610b8d578063b1ec4c4014610bdb578063c40d4d6614610c4f57610313565b80639ea5ce0a14610a9e578063a457c2d714610b1b578063a9059cbb14610b5457610313565b806395cad3c71161017457806395cad3c714610a2357806395d89b4114610a565780639aad141b14610a6b57610313565b80637e82a6f3146109c65780638da5cb5b146109f957806393028d8314610a0e57610313565b80633732b3941161025e5780635ed9156d1161020757806370a08231116101e157806370a0823114610945578063715018a61461097857806378e3214f1461098d57610313565b80635ed9156d146108a15780636669302a146108fd5780636edc2c091461091257610313565b806348d67e1b1161023857806348d67e1b146107ab5780634f64b2be146107c05780635915d806146107ea57610313565b80633732b3941461066057806339509351146106755780633c6216a6146106ae57610313565b806318160ddd116102c057806323e8cae11161029a57806323e8cae11461056a5780633049105d1461057f578063313ce5671461063557610313565b806318160ddd146104bd5780631e1401f8146104e457806323b872dd1461052757610313565b8063095ea7b3116102f1578063095ea7b3146104155780630dfe16811461046257806311212d661461049357610313565b80630146081f1461031857806306fdde031461035f57806307a80070146103e9575b600080fd5b34801561032457600080fd5b5061032d610e77565b604080516001600160681b03948516815292909316602083015265ffffffffffff168183015290519081900360600190f35b34801561036b57600080fd5b50610374610ea3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103ae578181015183820152602001610396565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103f557600080fd5b506104136004803603602081101561040c57600080fd5b5035610f39565b005b34801561042157600080fd5b5061044e6004803603604081101561043857600080fd5b506001600160a01b038135169060200135611061565b604080519115158252519081900360200190f35b34801561046e57600080fd5b5061047761107f565b604080516001600160a01b039092168252519081900360200190f35b34801561049f57600080fd5b50610413600480360360208110156104b657600080fd5b50356110a3565b3480156104c957600080fd5b506104d26111c7565b60408051918252519081900360200190f35b3480156104f057600080fd5b506104d26004803603606081101561050757600080fd5b506001600160a01b038135811691602081013590911690604001356111cd565b34801561053357600080fd5b5061044e6004803603606081101561054a57600080fd5b506001600160a01b03813581169160208101359091169060400135611206565b34801561057657600080fd5b5061032d61128d565b6105f36004803603608081101561059557600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194506112b99350505050565b6040518083815260200182600260200280838360005b83811015610621578181015183820152602001610609565b505050509050019250505060405180910390f35b34801561064157600080fd5b5061064a6112d9565b6040805160ff9092168252519081900360200190f35b34801561066c57600080fd5b506104d26112e2565b34801561068157600080fd5b5061044e6004803603604081101561069857600080fd5b506001600160a01b038135169060200135611330565b3480156106ba57600080fd5b50610770600480360360608110156106d157600080fd5b813591908101906040810160208201356401000000008111156106f357600080fd5b82018360208201111561070557600080fd5b8035906020019184602083028401116401000000008311171561072757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b0316915061137e9050565b6040518082600260200280838360005b83811015610798578181015183820152602001610780565b5050505090500191505060405180910390f35b3480156107b757600080fd5b506104d2611624565b3480156107cc57600080fd5b50610477600480360360208110156107e357600080fd5b503561166d565b3480156107f657600080fd5b506107706004803603604081101561080d57600080fd5b8135919081019060408101602082013564010000000081111561082f57600080fd5b82018360208201111561084157600080fd5b8035906020019184602083028401116401000000008311171561086357600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061171d945050505050565b3480156108ad57600080fd5b506108d4600480360360208110156108c457600080fd5b50356001600160a01b0316611730565b604080516001600160d81b03909316835264ffffffffff90911660208301528051918290030190f35b34801561090957600080fd5b5061041361175b565b34801561091e57600080fd5b506108d46004803603602081101561093557600080fd5b50356001600160a01b0316611789565b34801561095157600080fd5b506104d26004803603602081101561096857600080fd5b50356001600160a01b03166117b4565b34801561098457600080fd5b506104136117cf565b34801561099957600080fd5b50610413600480360360408110156109b057600080fd5b506001600160a01b03813516906020013561189b565b3480156109d257600080fd5b506104d2600480360360208110156109e957600080fd5b50356001600160a01b0316611b61565b348015610a0557600080fd5b50610477611b9c565b348015610a1a57600080fd5b50610413611bb0565b348015610a2f57600080fd5b506104d260048036036020811015610a4657600080fd5b50356001600160a01b0316611bdc565b348015610a6257600080fd5b50610374611c17565b348015610a7757600080fd5b506104d260048036036020811015610a8e57600080fd5b50356001600160a01b0316611c78565b6105f3600480360360a0811015610ab457600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194505050356001600160a01b03169050611cb3565b348015610b2757600080fd5b5061044e60048036036040811015610b3e57600080fd5b506001600160a01b038135169060200135612382565b348015610b6057600080fd5b5061044e60048036036040811015610b7757600080fd5b506001600160a01b0381351690602001356123ea565b348015610b9957600080fd5b50610ba26123fe565b60408051602080825283518183015283519192839290830191858101910280838360008315610621578181015183820152602001610609565b348015610be757600080fd5b50610c0e60048036036020811015610bfe57600080fd5b50356001600160a01b03166124bd565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b348015610c5b57600080fd5b5061041360048036036020811015610c7257600080fd5b50356001600160a01b03166124f9565b348015610c8e57600080fd5b506104776126ad565b6104d2600480360360a0811015610cad57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608090910135166126d1565b348015610ce757600080fd5b506104d260048036036020811015610cfe57600080fd5b50356001600160a01b03166126eb565b348015610d1a57600080fd5b50610477612761565b348015610d2f57600080fd5b506104d260048036036040811015610d4657600080fd5b506001600160a01b0381358116916020013516612770565b348015610d6a57600080fd5b506104d261279b565b6104d2600480360360c0811015610d8957600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013581169160a00135166127e4565b348015610dc957600080fd5b506104d260048036036020811015610de057600080fd5b50356001600160a01b0316612b7d565b348015610dfc57600080fd5b5061041360048036036020811015610e1357600080fd5b5035612bf3565b348015610e2657600080fd5b5061032d612d68565b348015610e3b57600080fd5b5061041360048036036020811015610e5257600080fd5b50356001600160a01b0316612d94565b348015610e6e57600080fd5b50610413612ebc565b6010546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b820191906000526020600020905b815481529060010190602001808311610f1257829003601f168201915b5050505050905090565b670de0b6b3a7640000811115610f96576040805162461bcd60e51b815260206004820152601d60248201527f536c6970706167652066656520766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b336000818152600f602090815260409182902082519182019092529054815261105e9190610fc384612f46565b610fcc336117b4565b610fd46111c7565b600760009054906101000a90046001600160a01b03166001600160a01b03166323662bb96040518163ffffffff1660e01b815260040160206040518083038186803b15801561102257600080fd5b505afa158015611036573d6000803e3d6000fd5b505050506040513d602081101561104c57600080fd5b5051600c959493929190612f65612fb8565b50565b600061107561106e612fd3565b8484612fd7565b5060015b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b662386f26fc100008111156110ff576040805162461bcd60e51b815260206004820152601460248201527f46656520766f746520697320746f6f2068696768000000000000000000000000604482015290519081900360640190fd5b336000818152600b602090815260409182902082519182019092529054815261105e919061112c84612f46565b611135336117b4565b61113d6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316635a6c72d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561118b57600080fd5b505afa15801561119f573d6000803e3d6000fd5b505050506040513d60208110156111b557600080fd5b505160089594939291906130c3612fb8565b60025490565b60006111fc8484846111de886126eb565b6111e788612b7d565b6111ef61279b565b6111f76112e2565b613116565b90505b9392505050565b6000611213848484613257565b6112838461121f612fd3565b61127e85604051806060016040528060288152602001615246602891396001600160a01b038a1660009081526001602052604081209061125d612fd3565b6001600160a01b0316815260208101919091526040016000205491906133b2565b612fd7565b5060019392505050565b600c546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60006112c36150ab565b6112ce848433611cb3565b915091509250929050565b60055460ff1690565b60408051606081018252600c546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b905090565b600061107561133d612fd3565b8461127e856001600061134e612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906134cc565b6113866150ab565b600260065414156113de576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026006556113eb6150ab565b50604080518082019091526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682527f000000000000000000000000000000000000000000000000000000000000000016602082015260006114546111c7565b90506000611460611624565b905061146c3388613526565b60005b60028110156115c157600084826002811061148657fe5b6020020151905060006114a26001600160a01b03831630613622565b905060006114ba866114b4848e6136c3565b9061371c565b90506114d06001600160a01b0384168a8361375e565b808885600281106114dd57fe5b602002015289518410158061150557508984815181106114f957fe5b60200260200101518110155b611556576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b6115868583611565898f6137c7565b6001600160a01b03871660009081526015602052604090209291908a613809565b6115b68583611595898f6137c7565b6001600160a01b03871660009081526016602052604090209291908a613809565b50505060010161146f565b508351602080860151604080518b8152928301939093528183015290516001600160a01b0387169133917f3cae9923fd3c2f468aa25a8ef687923e37f957459557c0380fd06526c0b8cdbc9181900360600190a350506001600655509392505050565b604080516060810182526010546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60008161169b57507f0000000000000000000000000000000000000000000000000000000000000000611718565b81600114156116cb57507f0000000000000000000000000000000000000000000000000000000000000000611718565b6040805162461bcd60e51b815260206004820152601360248201527f506f6f6c206861732074776f20746f6b656e7300000000000000000000000000604482015290519081900360640190fd5b919050565b6117256150ab565b6111ff83833361137e565b6016602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b336000818152600f60209081526040918290208251918201909252905481526117879190610fc3613866565b565b6015602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b6001600160a01b031660009081526020819052604090205490565b6117d7612fd3565b60055461010090046001600160a01b0390811691161461183e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36005805474ffffffffffffffffffffffffffffffffffffffff0019169055565b600260065414156118f3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611900612fd3565b60055461010090046001600160a01b03908116911614611967576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600061199c6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b905060006119d36001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b90506119e96001600160a01b038516338561375e565b81611a1d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b1015611a70576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b80611aa46001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b1015611af7576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b6103e8611b03306117b4565b1015611b56576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b505060016006555050565b6007546001600160a01b038281166000908152601360209081526040808320815192830190915254815290926110799216631845f0db613881565b60055461010090046001600160a01b031690565b336000818152600b6020908152604091829020825191820190925290548152611787919061112c613866565b6007546001600160a01b038281166000908152600f602090815260408083208151928301909152548152909261107992166323662bb9613881565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b6007546001600160a01b038281166000908152600b60209081526040808320815192830190915254815290926110799216635a6c72d0613881565b6000611cbd6150ab565b60026006541415611d15576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611d226150ab565b50604080518082019091526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682527f0000000000000000000000000000000000000000000000000000000000000000166020820152611d9b8160005b60200201516001600160a01b03166138f7565b611dc057611daa816001611d88565b611db5576000611dbb565b60208601515b611dc3565b85515b3414611e16576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6000611e206111c7565b905080611fac57611e346103e860636136c3565b9350611e42306103e8613904565b60005b6002811015611fa657611e6885898360028110611e5e57fe5b60200201516139f4565b94506000888260028110611e7857fe5b602002015111611ecf576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b868160028110611edb57fe5b6020020151888260028110611eec57fe5b60200201511015611f44576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b611f7c33308a8460028110611f5557fe5b6020020151868560028110611f6657fe5b60200201516001600160a01b0316929190613a0b565b878160028110611f8857fe5b6020020151848260028110611f9957fe5b6020020152600101611e45565b506122bf565b611fb46150ab565b60005b600281101561202257612009611fd2858360028110611d8857fe5b611fdd576000611fdf565b345b61200330878560028110611fef57fe5b60200201516001600160a01b031690613622565b906137c7565b82826002811061201557fe5b6020020152600101611fb7565b50600019945060005b60028110156120765761206c8661206784846002811061204757fe5b60200201516114b48d866002811061205b57fe5b602002015188906136c3565b613b97565b955060010161202b565b508460005b60028110156122035760008a826002811061209257fe5b6020020151116120e9576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b6000612117856114b4600188036121118789886002811061210657fe5b6020020151906136c3565b906134cc565b905089826002811061212557fe5b602002015181101561217e576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b612190333083898660028110611f6657fe5b6121b484836002811061219f57fe5b602002015161200330898660028110611fef57fe5b8783600281106121c057fe5b60200201526121f8886120678685600281106121d857fe5b60200201516114b48b87600281106121ec57fe5b60200201518a906136c3565b97505060010161207b565b50600061220e611624565b905060005b60028110156122ba576122828285836002811061222c57fe5b602002015161223b888c6134cc565b88601660008c886002811061224c57fe5b60200201516001600160a01b03166001600160a01b0316815260200190815260200160002061380990949392919063ffffffff16565b6122b28285836002811061229257fe5b60200201516122a1888c6134cc565b88601560008c886002811061224c57fe5b600101612213565b505050505b60008411612314576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b61231e8585613904565b825160208085015160408051888152928301939093528183015290516001600160a01b0387169133917f8bab6aed5a508937051a144e61d6e61336834a66aaee250a00613ae6f744c4229181900360600190a3505060016006559094909350915050565b600061107561238f612fd3565b8461127e8560405180606001604052806025815260200161530260259139600160006123b9612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906133b2565b60006110756123f7612fd3565b8484613257565b60408051600280825260608083018452926020830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061244c57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000000000000000000000000000000000000000000008160018151811061249a57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b6014602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b612501612fd3565b60055461010090046001600160a01b03908116911614612568576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316179055604080517f93028d83000000000000000000000000000000000000000000000000000000008152905130916393028d8391600480830192600092919082900301818387803b1580156125ec57600080fd5b505af1158015612600573d6000803e3d6000fd5b50505050306001600160a01b0316636669302a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561263f57600080fd5b505af1158015612653573d6000803e3d6000fd5b50505050306001600160a01b031663f76d13b46040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561269257600080fd5b505af11580156126a6573d6000803e3d6000fd5b5050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60006126e18686868686336127e4565b9695505050505050565b6000806127016001600160a01b03841630613622565b90506111ff61275b612711611624565b6001600160a01b0386166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b826139f4565b6007546001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b604080516060810182526008546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60006002600654141561283e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655600754604080517f22f3e2d400000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916322f3e2d491600480820192602092909190829003018186803b1580156128a157600080fd5b505afa1580156128b5573d6000803e3d6000fd5b505050506040513d60208110156128cb57600080fd5b505161291e576040805162461bcd60e51b815260206004820152601b60248201527f4d6f6f6e69737761703a20666163746f72792073687574646f776e0000000000604482015290519081900360640190fd5b612930876001600160a01b03166138f7565b61293b57600061293d565b845b3414612990576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6129986150c9565b60405180604001604052806129d86129b88b6001600160a01b03166138f7565b6129c35760006129c5565b345b6120036001600160a01b038d1630613622565b81526020016129f06001600160a01b038a1630613622565b9052905060006129fe6150c9565b612a066150c9565b6040518060400160405280612a1961279b565b8152602001612a266112e2565b90529050612a398b8b8b8b8a8987613c01565b8094508197508295505050508a6001600160a01b0316866001600160a01b0316336001600160a01b03167fbd99c6719f088aa0abd9e7b7a4a635d1f931601e9f304b538dc42be25d8c65c68d878a886000015189602001518f60405180876001600160a01b03168152602001868152602001858152602001848152602001838152602001826001600160a01b03168152602001965050505050505060405180910390a4612ae98386898785613e84565b50506001600160a01b03909816600090815260146020526040902080547001000000000000000000000000000000006fffffffffffffffffffffffffffffffff808316909b018b167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909216919091178181048b1685018b1690910299169890981790975560016006559695505050505050565b600080612b936001600160a01b03841630613622565b90506111ff612bed612ba3611624565b6001600160a01b0386166000908152601660209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b82613b97565b61012c811115612c4a576040805162461bcd60e51b815260206004820152601d60248201527f446563617920706572696f6420766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b603c811015612ca0576040805162461bcd60e51b815260206004820152601c60248201527f446563617920706572696f6420766f746520697320746f6f206c6f7700000000604482015290519081900360640190fd5b3360008181526013602090815260409182902082519182019092529054815261105e9190612ccd84612f46565b612cd6336117b4565b612cde6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316631845f0db6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d2c57600080fd5b505afa158015612d40573d6000803e3d6000fd5b505050506040513d6020811015612d5657600080fd5b505160109594939291906143af612fb8565b6008546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b612d9c612fd3565b60055461010090046001600160a01b03908116911614612e03576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116612e485760405162461bcd60e51b81526004018080602001828103825260268152602001806151b76026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b336000818152601360209081526040918290208251918201909252905481526117879190612ccd613866565b6000600160681b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2031303420626974730000604482015290519081900360640190fd5b5090565b612f4e6150e3565b506040805160208101909152600182018152919050565b60408051848152831515602082015280820183905290516001600160a01b038616917fce0cf859d853e1944032294143a1bf3ad799998ae77acbeb6c4d9b20d6910240919081900360600190a250505050565b612fc9888888888889898989614402565b5050505050505050565b3390565b6001600160a01b03831661301c5760405162461bcd60e51b81526004018080602001828103825260248152602001806152b46024913960400191505060405180910390fd5b6001600160a01b0382166130615760405162461bcd60e51b81526004018080602001828103825260228152602001806151dd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fe117cae46817b894b41a4412b73ae0ba746a5707b94e02d83b4c6502010b11ac919081900360600190a250505050565b6000866001600160a01b0316886001600160a01b03161115613136579596955b60008611801561317757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b0316145b80156131b457507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316876001600160a01b0316145b1561324c5760006131db6131d4670de0b6b3a76400006114b48a886136c3565b88906137c7565b905060006131e987836134cc565b905060006131fb826114b4858a6136c3565b9050600061321e61320c87866136c3565b612003670de0b6b3a7640000866136c3565b90506000613234670de0b6b3a7640000856136c3565b9050613244816114b485856136c3565b955050505050505b979650505050505050565b6001600160a01b03831661329c5760405162461bcd60e51b815260040180806020018281038252602581526020018061528f6025913960400191505060405180910390fd5b6001600160a01b0382166132e15760405162461bcd60e51b81526004018080602001828103825260238152602001806151726023913960400191505060405180910390fd5b6132ec838383614626565b613329816040518060600160405280602681526020016151ff602691396001600160a01b03861660009081526020819052604090205491906133b2565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461335890826134cc565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156134415760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156134065781810151838201526020016133ee565b50505050905090810190601f1680156134335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008061347262015180612067856040015165ffffffffffff16426137c790919063ffffffff16565b9050600061348362015180836137c7565b90506134c4620151806114b46134af8588602001516001600160681b03166136c390919063ffffffff16565b8751612111906001600160681b0316866136c3565b949350505050565b6000828201838110156111ff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03821661356b5760405162461bcd60e51b815260040180806020018281038252602181526020018061526e6021913960400191505060405180910390fd5b61357782600083614626565b6135b481604051806060016040528060228152602001615195602291396001600160a01b03851660009081526020819052604090205491906133b2565b6001600160a01b0383166000908152602081905260409020556002546135da90826137c7565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600061362d836138f7565b1561364357506001600160a01b03811631611079565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561369057600080fd5b505afa1580156136a4573d6000803e3d6000fd5b505050506040513d60208110156136ba57600080fd5b50519050611079565b6000826136d257506000611079565b828202828482816136df57fe5b04146111ff5760405162461bcd60e51b81526004018080602001828103825260218152602001806152256021913960400191505060405180910390fd5b60006111ff83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614911565b80156137c25761376d836138f7565b156137ae576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156137a8573d6000803e3d6000fd5b506137c2565b6137c26001600160a01b0384168383614976565b505050565b60006111ff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506133b2565b6126a685613861836114b461381f8260016137c7565b604080518082019091528b546001600160d81b0381168252600160d81b900464ffffffffff16602082015261211190899061385b908d8d613ba6565b906136c3565b6149f6565b61386e6150e3565b5060408051602081019091526000815290565b82516000901561389757508251600019016111ff565b82826040518163ffffffff1660e01b815260040160206040518083038186803b1580156138c357600080fd5b505afa1580156138d7573d6000803e3d6000fd5b505050506040513d60208110156138ed57600080fd5b5051949350505050565b6001600160a01b03161590565b6001600160a01b03821661395f576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61396b60008383614626565b60025461397890826134cc565b6002556001600160a01b03821660009081526020819052604090205461399e90826134cc565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081831015613a0457816111ff565b5090919050565b8015613b9157613a1a846138f7565b15613b7c5780341015613a74576040805162461bcd60e51b815260206004820152601a60248201527f556e6945524332303a206e6f7420656e6f7567682076616c7565000000000000604482015290519081900360640190fd5b6001600160a01b0383163314613ad1576040805162461bcd60e51b815260206004820152601660248201527f66726f6d206973206e6f74206d73672e73656e64657200000000000000000000604482015290519081900360640190fd5b6001600160a01b0382163014613b2e576040805162461bcd60e51b815260206004820152600e60248201527f746f206973206e6f742074686973000000000000000000000000000000000000604482015290519081900360640190fd5b80341115613b77576001600160a01b0383166108fc613b4d34846137c7565b6040518115909202916000818181858888f19350505050158015613b75573d6000803e3d6000fd5b505b613b91565b613b916001600160a01b038516848484614a53565b50505050565b6000818310613a0457816111ff565b600080613bcb84612067876020015164ffffffffff16426137c790919063ffffffff16565b90506000613bd985836137c7565b90506126e1856114b4613bec87866136c3565b8951612111906001600160d81b0316866136c3565b600080613c0c6150c9565b6000613c16611624565b86516001600160a01b038d166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff1690820152919250613c6a91908390613ba6565b8083528651613c7991906139f4565b82526020868101516001600160a01b038c166000908152601683526040908190208151808301909252546001600160d81b0381168252600160d81b900464ffffffffff1692810192909252613cd091908390613ba6565b6020808401829052870151613ce59190613b97565b6020830152613cff6001600160a01b038c1633308c613a0b565b8551613d18906120036001600160a01b038e1630613622565b9350613d398b8b86856000015186602001518a600001518b60200151613116565b9250600083118015613d4b5750878310155b613d9c576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a2072657475726e206973206e6f7420656e6f75676800604482015290519081900360640190fd5b613db06001600160a01b038b16888561375e565b8551825114613de7578151613de790613dc990866134cc565b6001600160a01b038d166000908152601560205260409020906149f6565b8560200151826020015114613e27576020820151613e2790613e0990856137c7565b6001600160a01b038c166000908152601660205260409020906149f6565b85516001600160a01b038c166000908152601660205260409020613e4c918390614adb565b6020808701516001600160a01b038c16600090815260159092526040909120613e76918390614adb565b509750975097945050505050565b600080600080600760009054906101000a90046001600160a01b03166001600160a01b031663172886e76040518163ffffffff1660e01b815260040160806040518083038186803b158015613ed857600080fd5b505afa158015613eec573d6000803e3d6000fd5b505050506040513d6080811015613f0257600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935060008060006ec097ce7bc90715b34b9f10000000009050613f7989600001516114b4613f728f8d600001516134cc90919063ffffffff16565b84906136c3565b60208a0151909150613f92906114b4613f72828f6137c7565b90506ec097ce7bc90715b34b9f100000000081111561434357613fb481614b17565b90506000613fd9826114b4613fd182670de0b6b3a76400006137c7565b61385b6111c7565b90506001600160a01b038b16613ff0576000614006565b614006670de0b6b3a76400006114b4838b6136c3565b93506001600160a01b03861661401d576000614033565b614033670de0b6b3a76400006114b4838a6136c3565b92506001600160a01b038516614068578315614053576140538b85613904565b8215614063576140638684613904565b614341565b60008411806140775750600083115b1561434157600080841161408c57600061408f565b60015b6000861161409e5760006140a1565b60015b0160ff16905060608167ffffffffffffffff811180156140c057600080fd5b506040519080825280602002602001820160405280156140ea578160200160208202803683370190505b50905060608267ffffffffffffffff8111801561410657600080fd5b50604051908082528060200260200182016040528015614130578160200160208202803683370190505b5090508d8260008151811061414157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868160008151811061416f57fe5b602090810291909101015285156141cd578882600185038151811061419057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050858160018503815181106141c057fe5b6020026020010181815250505b604080517f0931753c000000000000000000000000000000000000000000000000000000008152600481019182528351604482015283516001600160a01b038b1692630931753c92869286929182916024820191606401906020808801910280838360005b8381101561424a578181015183820152602001614232565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015614289578181015183820152602001614271565b50505050905001945050505050600060405180830381600087803b1580156142b057600080fd5b505af19250505080156142c1575060015b61432a576040805160208082526016908201527f757064617465526577617264732829206661696c6564000000000000000000008183015290517f08c379a0afcc32b1a39302f7cb8073359698411ab5fd6e3edb2c02c0b5fba8aa9181900360600190a161433d565b61433d8861433889896134cc565b613904565b5050505b505b88516020808b01518a518b83015160408051958652938501929092528383015260608301526080820185905260a08201849052517f2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd69181900360c00190a1505050505050505050505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fd0784d105a7412ffec29813ff8401f04f3d1cdbe6aca756974b1a31f830e5cb7919081900360600190a250505050565b600189015460028a01548190806144188b614b71565b1561442e57614427818a6137c7565b905061444f565b61444c61444561443e8d89614b76565b8b906136c3565b84906137c7565b92505b6144588a614b71565b1561446e5761446781896134cc565b905061448f565b61448c61448561447e8c89614b76565b8a906136c3565b84906134cc565b92505b83831461449e5760018d018390555b8181146144ad5760028d018190555b600087156144d2576144cd886114b46144c6858b6136c3565b87906134cc565b6144d4565b865b90506144de6150f6565b50604080516060810182528f546001600160681b038082168352600160681b82041660208301819052600160d01b90910465ffffffffffff16928201929092529082146145c6578e61453761453283613449565b612ee8565b61454084612ee8565b61454942614b92565b835479ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b65ffffffffffff9290921691909102177fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff16600160681b6001600160681b0392831602176cffffffffffffffffffffffffff191691161790555b506145d390508a8c614bef565b6145f6576001600160a01b038c16600090815260038e01602052604090208a5190555b6146178c6146048c89614b76565b61460d8d614b71565b8b8963ffffffff16565b50505050505050505050505050565b816001600160a01b0316836001600160a01b03161415614645576137c2565b6007546001600160a01b0390811690600090851615806146da5750816001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156146ad57600080fd5b505afa1580156146c1573d6000803e3d6000fd5b505050506040513d60208110156146d757600080fd5b50515b15905060006001600160a01b038516158061476a5750826001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561473d57600080fd5b505afa158015614751573d6000803e3d6000fd5b505050506040513d602081101561476757600080fd5b50515b15905081158015614779575080155b15614786575050506137c2565b60006001600160a01b03871661479d5760006147a6565b6147a6876117b4565b905060006001600160a01b0387166147bf5760006147c8565b6147c8876117b4565b9050600061480a6001600160a01b038916156147e55760006147e7565b875b6120036001600160a01b038c1615614800576000614802565b895b6121116111c7565b9050614814615116565b6040518061010001604052808b6001600160a01b031681526020018a6001600160a01b03168152602001871515815260200186151581526020018981526020018581526020018481526020018381525090506000806000896001600160a01b031663edb7a6fa6040518163ffffffff1660e01b815260040160606040518083038186803b1580156148a457600080fd5b505afa1580156148b8573d6000803e3d6000fd5b505050506040513d60608110156148ce57600080fd5b508051602082015160409092015190945090925090506148f384846130c36008614bf6565b6149028483612f65600c614bf6565b61461784826143af6010614bf6565b600081836149605760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156134065781810151838201526020016133ee565b50600083858161496c57fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526137c2908490614d70565b6149ff81614e21565b614a0842614e7b565b83546001600160d81b0392831664ffffffffff909216600160d81b029216919091177fffffffffff000000000000000000000000000000000000000000000000000000161790915550565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052613b91908590614d70565b6040805180820190915283546001600160d81b0381168252600160d81b900464ffffffffff1660208201526137c2908490613861908585613ba6565b60006003821115614b5b5781600160028204015b81811015614b5357809150600281828681614b4257fe5b040181614b4b57fe5b049050614b2b565b509050611718565b8115614b6957506001611718565b506000611718565b511590565b815160009015614b8c5750815160001901611079565b50919050565b600066010000000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034382062697473000000604482015290519081900360640190fd5b5190511490565b614bfe6150e3565b5083516001600160a01b03166000908152600382016020908152604091829020825191820190925290548152614c326150e3565b506020808601516001600160a01b031660009081526003840182526040908190208151928301909152548152614c6782614b71565b8015614c775750614c7781614b71565b8015614c84575085604001515b8015614c91575085606001515b15614d03578551614ccc90614ca68488614b76565b6001614cc38a608001518b60a001516137c790919063ffffffff16565b8863ffffffff16565b6020860151614cfc90614cdf8388614b76565b6001614cc38a608001518b60c001516134cc90919063ffffffff16565b5050613b91565b856040015115614d3d57855160a08701516080880151614d3d92918591614d2b9082906137c7565b60e08b01518894939291908b8b614ed7565b856060015115614d6857602086015160c08701516080880151614d6892918491614d2b9082906134cc565b505050505050565b6060614dc5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614efb9092919063ffffffff16565b8051909150156137c257808060200190516020811015614de457600080fd5b50516137c25760405162461bcd60e51b815260040180806020018281038252602a8152602001806152d8602a913960400191505060405180910390fd5b6000600160d81b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2032313620626974730000604482015290519081900360640190fd5b6000650100000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034302062697473000000604482015290519081900360640190fd5b612fc98888888715614ee95789614ef1565b614ef1613866565b8989898989614402565b60606111fc84846000856060614f1085615072565b614f61576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310614fa05780518252601f199092019160209182019101614f81565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615002576040519150601f19603f3d011682016040523d82523d6000602084013e615007565b606091505b5091509150811561501b5791506134c49050565b80511561502b5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156134065781810151838201526020016133ee565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906134c4575050151592915050565b60405180604001604052806002906020820280368337509192915050565b604051806040016040528060008152602001600081525090565b6040518060200160405280600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160001515815260200160001515815260200160008152602001600081526020016000815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f5acfd09e87c0e0c91649c917b687b73362797cc26a1c21a7d92ee5d568457a464736f6c634300060c003300000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98400000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000baf9a5d4b0052359326a6cdab54babaa3a3a9643000000000000000000000000000000000000000000000000000000000000001e31696e6368204c697175696469747920506f6f6c20284554482d554e49290000000000000000000000000000000000000000000000000000000000000000000b314c502d4554482d554e49000000000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106103135760003560e01c80637e82a6f31161019a578063d21220a7116100e1578063e331d0391161008a578063f1ea604211610064578063f1ea604214610e1a578063f2fde38b14610e2f578063f76d13b414610e6257610313565b8063e331d03914610d73578063e7ff42c914610dbd578063eaadf84814610df057610313565b8063d9a0c217116100bb578063d9a0c21714610d0e578063dd62ed3e14610d23578063ddca3f4314610d5e57610313565b8063d21220a714610c82578063d5bcb9b514610c97578063d7d3aab514610cdb57610313565b80639ea5ce0a11610143578063aa6ca8081161011d578063aa6ca80814610b8d578063b1ec4c4014610bdb578063c40d4d6614610c4f57610313565b80639ea5ce0a14610a9e578063a457c2d714610b1b578063a9059cbb14610b5457610313565b806395cad3c71161017457806395cad3c714610a2357806395d89b4114610a565780639aad141b14610a6b57610313565b80637e82a6f3146109c65780638da5cb5b146109f957806393028d8314610a0e57610313565b80633732b3941161025e5780635ed9156d1161020757806370a08231116101e157806370a0823114610945578063715018a61461097857806378e3214f1461098d57610313565b80635ed9156d146108a15780636669302a146108fd5780636edc2c091461091257610313565b806348d67e1b1161023857806348d67e1b146107ab5780634f64b2be146107c05780635915d806146107ea57610313565b80633732b3941461066057806339509351146106755780633c6216a6146106ae57610313565b806318160ddd116102c057806323e8cae11161029a57806323e8cae11461056a5780633049105d1461057f578063313ce5671461063557610313565b806318160ddd146104bd5780631e1401f8146104e457806323b872dd1461052757610313565b8063095ea7b3116102f1578063095ea7b3146104155780630dfe16811461046257806311212d661461049357610313565b80630146081f1461031857806306fdde031461035f57806307a80070146103e9575b600080fd5b34801561032457600080fd5b5061032d610e77565b604080516001600160681b03948516815292909316602083015265ffffffffffff168183015290519081900360600190f35b34801561036b57600080fd5b50610374610ea3565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103ae578181015183820152602001610396565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103f557600080fd5b506104136004803603602081101561040c57600080fd5b5035610f39565b005b34801561042157600080fd5b5061044e6004803603604081101561043857600080fd5b506001600160a01b038135169060200135611061565b604080519115158252519081900360200190f35b34801561046e57600080fd5b5061047761107f565b604080516001600160a01b039092168252519081900360200190f35b34801561049f57600080fd5b50610413600480360360208110156104b657600080fd5b50356110a3565b3480156104c957600080fd5b506104d26111c7565b60408051918252519081900360200190f35b3480156104f057600080fd5b506104d26004803603606081101561050757600080fd5b506001600160a01b038135811691602081013590911690604001356111cd565b34801561053357600080fd5b5061044e6004803603606081101561054a57600080fd5b506001600160a01b03813581169160208101359091169060400135611206565b34801561057657600080fd5b5061032d61128d565b6105f36004803603608081101561059557600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194506112b99350505050565b6040518083815260200182600260200280838360005b83811015610621578181015183820152602001610609565b505050509050019250505060405180910390f35b34801561064157600080fd5b5061064a6112d9565b6040805160ff9092168252519081900360200190f35b34801561066c57600080fd5b506104d26112e2565b34801561068157600080fd5b5061044e6004803603604081101561069857600080fd5b506001600160a01b038135169060200135611330565b3480156106ba57600080fd5b50610770600480360360608110156106d157600080fd5b813591908101906040810160208201356401000000008111156106f357600080fd5b82018360208201111561070557600080fd5b8035906020019184602083028401116401000000008311171561072757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550505090356001600160a01b0316915061137e9050565b6040518082600260200280838360005b83811015610798578181015183820152602001610780565b5050505090500191505060405180910390f35b3480156107b757600080fd5b506104d2611624565b3480156107cc57600080fd5b50610477600480360360208110156107e357600080fd5b503561166d565b3480156107f657600080fd5b506107706004803603604081101561080d57600080fd5b8135919081019060408101602082013564010000000081111561082f57600080fd5b82018360208201111561084157600080fd5b8035906020019184602083028401116401000000008311171561086357600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061171d945050505050565b3480156108ad57600080fd5b506108d4600480360360208110156108c457600080fd5b50356001600160a01b0316611730565b604080516001600160d81b03909316835264ffffffffff90911660208301528051918290030190f35b34801561090957600080fd5b5061041361175b565b34801561091e57600080fd5b506108d46004803603602081101561093557600080fd5b50356001600160a01b0316611789565b34801561095157600080fd5b506104d26004803603602081101561096857600080fd5b50356001600160a01b03166117b4565b34801561098457600080fd5b506104136117cf565b34801561099957600080fd5b50610413600480360360408110156109b057600080fd5b506001600160a01b03813516906020013561189b565b3480156109d257600080fd5b506104d2600480360360208110156109e957600080fd5b50356001600160a01b0316611b61565b348015610a0557600080fd5b50610477611b9c565b348015610a1a57600080fd5b50610413611bb0565b348015610a2f57600080fd5b506104d260048036036020811015610a4657600080fd5b50356001600160a01b0316611bdc565b348015610a6257600080fd5b50610374611c17565b348015610a7757600080fd5b506104d260048036036020811015610a8e57600080fd5b50356001600160a01b0316611c78565b6105f3600480360360a0811015610ab457600080fd5b6040805180820182529183019291818301918390600290839083908082843760009201919091525050604080518082018252929594938181019392509060029083908390808284376000920191909152509194505050356001600160a01b03169050611cb3565b348015610b2757600080fd5b5061044e60048036036040811015610b3e57600080fd5b506001600160a01b038135169060200135612382565b348015610b6057600080fd5b5061044e60048036036040811015610b7757600080fd5b506001600160a01b0381351690602001356123ea565b348015610b9957600080fd5b50610ba26123fe565b60408051602080825283518183015283519192839290830191858101910280838360008315610621578181015183820152602001610609565b348015610be757600080fd5b50610c0e60048036036020811015610bfe57600080fd5b50356001600160a01b03166124bd565b60405180836fffffffffffffffffffffffffffffffff168152602001826fffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b348015610c5b57600080fd5b5061041360048036036020811015610c7257600080fd5b50356001600160a01b03166124f9565b348015610c8e57600080fd5b506104776126ad565b6104d2600480360360a0811015610cad57600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608090910135166126d1565b348015610ce757600080fd5b506104d260048036036020811015610cfe57600080fd5b50356001600160a01b03166126eb565b348015610d1a57600080fd5b50610477612761565b348015610d2f57600080fd5b506104d260048036036040811015610d4657600080fd5b506001600160a01b0381358116916020013516612770565b348015610d6a57600080fd5b506104d261279b565b6104d2600480360360c0811015610d8957600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013591608082013581169160a00135166127e4565b348015610dc957600080fd5b506104d260048036036020811015610de057600080fd5b50356001600160a01b0316612b7d565b348015610dfc57600080fd5b5061041360048036036020811015610e1357600080fd5b5035612bf3565b348015610e2657600080fd5b5061032d612d68565b348015610e3b57600080fd5b5061041360048036036020811015610e5257600080fd5b50356001600160a01b0316612d94565b348015610e6e57600080fd5b50610413612ebc565b6010546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60038054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b820191906000526020600020905b815481529060010190602001808311610f1257829003601f168201915b5050505050905090565b670de0b6b3a7640000811115610f96576040805162461bcd60e51b815260206004820152601d60248201527f536c6970706167652066656520766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b336000818152600f602090815260409182902082519182019092529054815261105e9190610fc384612f46565b610fcc336117b4565b610fd46111c7565b600760009054906101000a90046001600160a01b03166001600160a01b03166323662bb96040518163ffffffff1660e01b815260040160206040518083038186803b15801561102257600080fd5b505afa158015611036573d6000803e3d6000fd5b505050506040513d602081101561104c57600080fd5b5051600c959493929190612f65612fb8565b50565b600061107561106e612fd3565b8484612fd7565b5060015b92915050565b7f000000000000000000000000000000000000000000000000000000000000000081565b662386f26fc100008111156110ff576040805162461bcd60e51b815260206004820152601460248201527f46656520766f746520697320746f6f2068696768000000000000000000000000604482015290519081900360640190fd5b336000818152600b602090815260409182902082519182019092529054815261105e919061112c84612f46565b611135336117b4565b61113d6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316635a6c72d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561118b57600080fd5b505afa15801561119f573d6000803e3d6000fd5b505050506040513d60208110156111b557600080fd5b505160089594939291906130c3612fb8565b60025490565b60006111fc8484846111de886126eb565b6111e788612b7d565b6111ef61279b565b6111f76112e2565b613116565b90505b9392505050565b6000611213848484613257565b6112838461121f612fd3565b61127e85604051806060016040528060288152602001615246602891396001600160a01b038a1660009081526001602052604081209061125d612fd3565b6001600160a01b0316815260208101919091526040016000205491906133b2565b612fd7565b5060019392505050565b600c546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b60006112c36150ab565b6112ce848433611cb3565b915091509250929050565b60055460ff1690565b60408051606081018252600c546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b905090565b600061107561133d612fd3565b8461127e856001600061134e612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918c1681529252902054906134cc565b6113866150ab565b600260065414156113de576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b60026006556113eb6150ab565b50604080518082019091526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682527f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98416602082015260006114546111c7565b90506000611460611624565b905061146c3388613526565b60005b60028110156115c157600084826002811061148657fe5b6020020151905060006114a26001600160a01b03831630613622565b905060006114ba866114b4848e6136c3565b9061371c565b90506114d06001600160a01b0384168a8361375e565b808885600281106114dd57fe5b602002015289518410158061150557508984815181106114f957fe5b60200260200101518110155b611556576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b6115868583611565898f6137c7565b6001600160a01b03871660009081526015602052604090209291908a613809565b6115b68583611595898f6137c7565b6001600160a01b03871660009081526016602052604090209291908a613809565b50505060010161146f565b508351602080860151604080518b8152928301939093528183015290516001600160a01b0387169133917f3cae9923fd3c2f468aa25a8ef687923e37f957459557c0380fd06526c0b8cdbc9181900360600190a350506001600655509392505050565b604080516060810182526010546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60008161169b57507f0000000000000000000000000000000000000000000000000000000000000000611718565b81600114156116cb57507f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984611718565b6040805162461bcd60e51b815260206004820152601360248201527f506f6f6c206861732074776f20746f6b656e7300000000000000000000000000604482015290519081900360640190fd5b919050565b6117256150ab565b6111ff83833361137e565b6016602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b336000818152600f60209081526040918290208251918201909252905481526117879190610fc3613866565b565b6015602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b6001600160a01b031660009081526020819052604090205490565b6117d7612fd3565b60055461010090046001600160a01b0390811691161461183e576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a36005805474ffffffffffffffffffffffffffffffffffffffff0019169055565b600260065414156118f3576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611900612fd3565b60055461010090046001600160a01b03908116911614611967576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600061199c6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b905060006119d36001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9841630613622565b90506119e96001600160a01b038516338561375e565b81611a1d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630613622565b1015611a70576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b80611aa46001600160a01b037f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9841630613622565b1015611af7576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b6103e8611b03306117b4565b1015611b56576040805162461bcd60e51b815260206004820152601860248201527f4d6f6f6e69737761703a206163636573732064656e6965640000000000000000604482015290519081900360640190fd5b505060016006555050565b6007546001600160a01b038281166000908152601360209081526040808320815192830190915254815290926110799216631845f0db613881565b60055461010090046001600160a01b031690565b336000818152600b6020908152604091829020825191820190925290548152611787919061112c613866565b6007546001600160a01b038281166000908152600f602090815260408083208151928301909152548152909261107992166323662bb9613881565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610f2f5780601f10610f0457610100808354040283529160200191610f2f565b6007546001600160a01b038281166000908152600b60209081526040808320815192830190915254815290926110799216635a6c72d0613881565b6000611cbd6150ab565b60026006541415611d15576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655611d226150ab565b50604080518082019091526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811682527f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984166020820152611d9b8160005b60200201516001600160a01b03166138f7565b611dc057611daa816001611d88565b611db5576000611dbb565b60208601515b611dc3565b85515b3414611e16576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6000611e206111c7565b905080611fac57611e346103e860636136c3565b9350611e42306103e8613904565b60005b6002811015611fa657611e6885898360028110611e5e57fe5b60200201516139f4565b94506000888260028110611e7857fe5b602002015111611ecf576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b868160028110611edb57fe5b6020020151888260028110611eec57fe5b60200201511015611f44576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b611f7c33308a8460028110611f5557fe5b6020020151868560028110611f6657fe5b60200201516001600160a01b0316929190613a0b565b878160028110611f8857fe5b6020020151848260028110611f9957fe5b6020020152600101611e45565b506122bf565b611fb46150ab565b60005b600281101561202257612009611fd2858360028110611d8857fe5b611fdd576000611fdf565b345b61200330878560028110611fef57fe5b60200201516001600160a01b031690613622565b906137c7565b82826002811061201557fe5b6020020152600101611fb7565b50600019945060005b60028110156120765761206c8661206784846002811061204757fe5b60200201516114b48d866002811061205b57fe5b602002015188906136c3565b613b97565b955060010161202b565b508460005b60028110156122035760008a826002811061209257fe5b6020020151116120e9576040805162461bcd60e51b815260206004820152601960248201527f4d6f6f6e69737761703a20616d6f756e74206973207a65726f00000000000000604482015290519081900360640190fd5b6000612117856114b4600188036121118789886002811061210657fe5b6020020151906136c3565b906134cc565b905089826002811061212557fe5b602002015181101561217e576040805162461bcd60e51b815260206004820181905260248201527f4d6f6f6e69737761703a206d696e416d6f756e74206e6f742072656163686564604482015290519081900360640190fd5b612190333083898660028110611f6657fe5b6121b484836002811061219f57fe5b602002015161200330898660028110611fef57fe5b8783600281106121c057fe5b60200201526121f8886120678685600281106121d857fe5b60200201516114b48b87600281106121ec57fe5b60200201518a906136c3565b97505060010161207b565b50600061220e611624565b905060005b60028110156122ba576122828285836002811061222c57fe5b602002015161223b888c6134cc565b88601660008c886002811061224c57fe5b60200201516001600160a01b03166001600160a01b0316815260200190815260200160002061380990949392919063ffffffff16565b6122b28285836002811061229257fe5b60200201516122a1888c6134cc565b88601560008c886002811061224c57fe5b600101612213565b505050505b60008411612314576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a20726573756c74206973206e6f7420656e6f75676800604482015290519081900360640190fd5b61231e8585613904565b825160208085015160408051888152928301939093528183015290516001600160a01b0387169133917f8bab6aed5a508937051a144e61d6e61336834a66aaee250a00613ae6f744c4229181900360600190a3505060016006559094909350915050565b600061107561238f612fd3565b8461127e8560405180606001604052806025815260200161530260259139600160006123b9612fd3565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906133b2565b60006110756123f7612fd3565b8484613257565b60408051600280825260608083018452926020830190803683370190505090507f00000000000000000000000000000000000000000000000000000000000000008160008151811061244c57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9848160018151811061249a57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505090565b6014602052600090815260409020546fffffffffffffffffffffffffffffffff8082169170010000000000000000000000000000000090041682565b612501612fd3565b60055461010090046001600160a01b03908116911614612568576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600780547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038316179055604080517f93028d83000000000000000000000000000000000000000000000000000000008152905130916393028d8391600480830192600092919082900301818387803b1580156125ec57600080fd5b505af1158015612600573d6000803e3d6000fd5b50505050306001600160a01b0316636669302a6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561263f57600080fd5b505af1158015612653573d6000803e3d6000fd5b50505050306001600160a01b031663f76d13b46040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561269257600080fd5b505af11580156126a6573d6000803e3d6000fd5b5050505050565b7f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98481565b60006126e18686868686336127e4565b9695505050505050565b6000806127016001600160a01b03841630613622565b90506111ff61275b612711611624565b6001600160a01b0386166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b826139f4565b6007546001600160a01b031681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b604080516060810182526008546001600160681b038082168352600160681b8204166020830152600160d01b900465ffffffffffff169181019190915260009061132b90613449565b60006002600654141561283e576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600655600754604080517f22f3e2d400000000000000000000000000000000000000000000000000000000815290516001600160a01b03909216916322f3e2d491600480820192602092909190829003018186803b1580156128a157600080fd5b505afa1580156128b5573d6000803e3d6000fd5b505050506040513d60208110156128cb57600080fd5b505161291e576040805162461bcd60e51b815260206004820152601b60248201527f4d6f6f6e69737761703a20666163746f72792073687574646f776e0000000000604482015290519081900360640190fd5b612930876001600160a01b03166138f7565b61293b57600061293d565b845b3414612990576040805162461bcd60e51b815260206004820152601c60248201527f4d6f6f6e69737761703a2077726f6e672076616c756520757361676500000000604482015290519081900360640190fd5b6129986150c9565b60405180604001604052806129d86129b88b6001600160a01b03166138f7565b6129c35760006129c5565b345b6120036001600160a01b038d1630613622565b81526020016129f06001600160a01b038a1630613622565b9052905060006129fe6150c9565b612a066150c9565b6040518060400160405280612a1961279b565b8152602001612a266112e2565b90529050612a398b8b8b8b8a8987613c01565b8094508197508295505050508a6001600160a01b0316866001600160a01b0316336001600160a01b03167fbd99c6719f088aa0abd9e7b7a4a635d1f931601e9f304b538dc42be25d8c65c68d878a886000015189602001518f60405180876001600160a01b03168152602001868152602001858152602001848152602001838152602001826001600160a01b03168152602001965050505050505060405180910390a4612ae98386898785613e84565b50506001600160a01b03909816600090815260146020526040902080547001000000000000000000000000000000006fffffffffffffffffffffffffffffffff808316909b018b167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909216919091178181048b1685018b1690910299169890981790975560016006559695505050505050565b600080612b936001600160a01b03841630613622565b90506111ff612bed612ba3611624565b6001600160a01b0386166000908152601660209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff16908201529084613ba6565b82613b97565b61012c811115612c4a576040805162461bcd60e51b815260206004820152601d60248201527f446563617920706572696f6420766f746520697320746f6f2068696768000000604482015290519081900360640190fd5b603c811015612ca0576040805162461bcd60e51b815260206004820152601c60248201527f446563617920706572696f6420766f746520697320746f6f206c6f7700000000604482015290519081900360640190fd5b3360008181526013602090815260409182902082519182019092529054815261105e9190612ccd84612f46565b612cd6336117b4565b612cde6111c7565b600760009054906101000a90046001600160a01b03166001600160a01b0316631845f0db6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d2c57600080fd5b505afa158015612d40573d6000803e3d6000fd5b505050506040513d6020811015612d5657600080fd5b505160109594939291906143af612fb8565b6008546001600160681b0380821692600160681b830490911691600160d01b900465ffffffffffff1690565b612d9c612fd3565b60055461010090046001600160a01b03908116911614612e03576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116612e485760405162461bcd60e51b81526004018080602001828103825260268152602001806151b76026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b039092166101000274ffffffffffffffffffffffffffffffffffffffff0019909216919091179055565b336000818152601360209081526040918290208251918201909252905481526117879190612ccd613866565b6000600160681b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2031303420626974730000604482015290519081900360640190fd5b5090565b612f4e6150e3565b506040805160208101909152600182018152919050565b60408051848152831515602082015280820183905290516001600160a01b038616917fce0cf859d853e1944032294143a1bf3ad799998ae77acbeb6c4d9b20d6910240919081900360600190a250505050565b612fc9888888888889898989614402565b5050505050505050565b3390565b6001600160a01b03831661301c5760405162461bcd60e51b81526004018080602001828103825260248152602001806152b46024913960400191505060405180910390fd5b6001600160a01b0382166130615760405162461bcd60e51b81526004018080602001828103825260228152602001806151dd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fe117cae46817b894b41a4412b73ae0ba746a5707b94e02d83b4c6502010b11ac919081900360600190a250505050565b6000866001600160a01b0316886001600160a01b03161115613136579596955b60008611801561317757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b0316145b80156131b457507f0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f9846001600160a01b0316876001600160a01b0316145b1561324c5760006131db6131d4670de0b6b3a76400006114b48a886136c3565b88906137c7565b905060006131e987836134cc565b905060006131fb826114b4858a6136c3565b9050600061321e61320c87866136c3565b612003670de0b6b3a7640000866136c3565b90506000613234670de0b6b3a7640000856136c3565b9050613244816114b485856136c3565b955050505050505b979650505050505050565b6001600160a01b03831661329c5760405162461bcd60e51b815260040180806020018281038252602581526020018061528f6025913960400191505060405180910390fd5b6001600160a01b0382166132e15760405162461bcd60e51b81526004018080602001828103825260238152602001806151726023913960400191505060405180910390fd5b6132ec838383614626565b613329816040518060600160405280602681526020016151ff602691396001600160a01b03861660009081526020819052604090205491906133b2565b6001600160a01b03808516600090815260208190526040808220939093559084168152205461335890826134cc565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156134415760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156134065781810151838201526020016133ee565b50505050905090810190601f1680156134335780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008061347262015180612067856040015165ffffffffffff16426137c790919063ffffffff16565b9050600061348362015180836137c7565b90506134c4620151806114b46134af8588602001516001600160681b03166136c390919063ffffffff16565b8751612111906001600160681b0316866136c3565b949350505050565b6000828201838110156111ff576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6001600160a01b03821661356b5760405162461bcd60e51b815260040180806020018281038252602181526020018061526e6021913960400191505060405180910390fd5b61357782600083614626565b6135b481604051806060016040528060228152602001615195602291396001600160a01b03851660009081526020819052604090205491906133b2565b6001600160a01b0383166000908152602081905260409020556002546135da90826137c7565b6002556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600061362d836138f7565b1561364357506001600160a01b03811631611079565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561369057600080fd5b505afa1580156136a4573d6000803e3d6000fd5b505050506040513d60208110156136ba57600080fd5b50519050611079565b6000826136d257506000611079565b828202828482816136df57fe5b04146111ff5760405162461bcd60e51b81526004018080602001828103825260218152602001806152256021913960400191505060405180910390fd5b60006111ff83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614911565b80156137c25761376d836138f7565b156137ae576040516001600160a01b0383169082156108fc029083906000818181858888f193505050501580156137a8573d6000803e3d6000fd5b506137c2565b6137c26001600160a01b0384168383614976565b505050565b60006111ff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506133b2565b6126a685613861836114b461381f8260016137c7565b604080518082019091528b546001600160d81b0381168252600160d81b900464ffffffffff16602082015261211190899061385b908d8d613ba6565b906136c3565b6149f6565b61386e6150e3565b5060408051602081019091526000815290565b82516000901561389757508251600019016111ff565b82826040518163ffffffff1660e01b815260040160206040518083038186803b1580156138c357600080fd5b505afa1580156138d7573d6000803e3d6000fd5b505050506040513d60208110156138ed57600080fd5b5051949350505050565b6001600160a01b03161590565b6001600160a01b03821661395f576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61396b60008383614626565b60025461397890826134cc565b6002556001600160a01b03821660009081526020819052604090205461399e90826134cc565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600081831015613a0457816111ff565b5090919050565b8015613b9157613a1a846138f7565b15613b7c5780341015613a74576040805162461bcd60e51b815260206004820152601a60248201527f556e6945524332303a206e6f7420656e6f7567682076616c7565000000000000604482015290519081900360640190fd5b6001600160a01b0383163314613ad1576040805162461bcd60e51b815260206004820152601660248201527f66726f6d206973206e6f74206d73672e73656e64657200000000000000000000604482015290519081900360640190fd5b6001600160a01b0382163014613b2e576040805162461bcd60e51b815260206004820152600e60248201527f746f206973206e6f742074686973000000000000000000000000000000000000604482015290519081900360640190fd5b80341115613b77576001600160a01b0383166108fc613b4d34846137c7565b6040518115909202916000818181858888f19350505050158015613b75573d6000803e3d6000fd5b505b613b91565b613b916001600160a01b038516848484614a53565b50505050565b6000818310613a0457816111ff565b600080613bcb84612067876020015164ffffffffff16426137c790919063ffffffff16565b90506000613bd985836137c7565b90506126e1856114b4613bec87866136c3565b8951612111906001600160d81b0316866136c3565b600080613c0c6150c9565b6000613c16611624565b86516001600160a01b038d166000908152601560209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff1690820152919250613c6a91908390613ba6565b8083528651613c7991906139f4565b82526020868101516001600160a01b038c166000908152601683526040908190208151808301909252546001600160d81b0381168252600160d81b900464ffffffffff1692810192909252613cd091908390613ba6565b6020808401829052870151613ce59190613b97565b6020830152613cff6001600160a01b038c1633308c613a0b565b8551613d18906120036001600160a01b038e1630613622565b9350613d398b8b86856000015186602001518a600001518b60200151613116565b9250600083118015613d4b5750878310155b613d9c576040805162461bcd60e51b815260206004820152601f60248201527f4d6f6f6e69737761703a2072657475726e206973206e6f7420656e6f75676800604482015290519081900360640190fd5b613db06001600160a01b038b16888561375e565b8551825114613de7578151613de790613dc990866134cc565b6001600160a01b038d166000908152601560205260409020906149f6565b8560200151826020015114613e27576020820151613e2790613e0990856137c7565b6001600160a01b038c166000908152601660205260409020906149f6565b85516001600160a01b038c166000908152601660205260409020613e4c918390614adb565b6020808701516001600160a01b038c16600090815260159092526040909120613e76918390614adb565b509750975097945050505050565b600080600080600760009054906101000a90046001600160a01b03166001600160a01b031663172886e76040518163ffffffff1660e01b815260040160806040518083038186803b158015613ed857600080fd5b505afa158015613eec573d6000803e3d6000fd5b505050506040513d6080811015613f0257600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935060008060006ec097ce7bc90715b34b9f10000000009050613f7989600001516114b4613f728f8d600001516134cc90919063ffffffff16565b84906136c3565b60208a0151909150613f92906114b4613f72828f6137c7565b90506ec097ce7bc90715b34b9f100000000081111561434357613fb481614b17565b90506000613fd9826114b4613fd182670de0b6b3a76400006137c7565b61385b6111c7565b90506001600160a01b038b16613ff0576000614006565b614006670de0b6b3a76400006114b4838b6136c3565b93506001600160a01b03861661401d576000614033565b614033670de0b6b3a76400006114b4838a6136c3565b92506001600160a01b038516614068578315614053576140538b85613904565b8215614063576140638684613904565b614341565b60008411806140775750600083115b1561434157600080841161408c57600061408f565b60015b6000861161409e5760006140a1565b60015b0160ff16905060608167ffffffffffffffff811180156140c057600080fd5b506040519080825280602002602001820160405280156140ea578160200160208202803683370190505b50905060608267ffffffffffffffff8111801561410657600080fd5b50604051908082528060200260200182016040528015614130578160200160208202803683370190505b5090508d8260008151811061414157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050868160008151811061416f57fe5b602090810291909101015285156141cd578882600185038151811061419057fe5b60200260200101906001600160a01b031690816001600160a01b031681525050858160018503815181106141c057fe5b6020026020010181815250505b604080517f0931753c000000000000000000000000000000000000000000000000000000008152600481019182528351604482015283516001600160a01b038b1692630931753c92869286929182916024820191606401906020808801910280838360005b8381101561424a578181015183820152602001614232565b50505050905001838103825284818151815260200191508051906020019060200280838360005b83811015614289578181015183820152602001614271565b50505050905001945050505050600060405180830381600087803b1580156142b057600080fd5b505af19250505080156142c1575060015b61432a576040805160208082526016908201527f757064617465526577617264732829206661696c6564000000000000000000008183015290517f08c379a0afcc32b1a39302f7cb8073359698411ab5fd6e3edb2c02c0b5fba8aa9181900360600190a161433d565b61433d8861433889896134cc565b613904565b5050505b505b88516020808b01518a518b83015160408051958652938501929092528383015260608301526080820185905260a08201849052517f2a368c7f33bb86e2d999940a3989d849031aff29b750f67947e6b8e8c3d2ffd69181900360c00190a1505050505050505050505050565b60408051848152831515602082015280820183905290516001600160a01b038616917fd0784d105a7412ffec29813ff8401f04f3d1cdbe6aca756974b1a31f830e5cb7919081900360600190a250505050565b600189015460028a01548190806144188b614b71565b1561442e57614427818a6137c7565b905061444f565b61444c61444561443e8d89614b76565b8b906136c3565b84906137c7565b92505b6144588a614b71565b1561446e5761446781896134cc565b905061448f565b61448c61448561447e8c89614b76565b8a906136c3565b84906134cc565b92505b83831461449e5760018d018390555b8181146144ad5760028d018190555b600087156144d2576144cd886114b46144c6858b6136c3565b87906134cc565b6144d4565b865b90506144de6150f6565b50604080516060810182528f546001600160681b038082168352600160681b82041660208301819052600160d01b90910465ffffffffffff16928201929092529082146145c6578e61453761453283613449565b612ee8565b61454084612ee8565b61454942614b92565b835479ffffffffffffffffffffffffffffffffffffffffffffffffffff16600160d01b65ffffffffffff9290921691909102177fffffffffffff00000000000000000000000000ffffffffffffffffffffffffff16600160681b6001600160681b0392831602176cffffffffffffffffffffffffff191691161790555b506145d390508a8c614bef565b6145f6576001600160a01b038c16600090815260038e01602052604090208a5190555b6146178c6146048c89614b76565b61460d8d614b71565b8b8963ffffffff16565b50505050505050505050505050565b816001600160a01b0316836001600160a01b03161415614645576137c2565b6007546001600160a01b0390811690600090851615806146da5750816001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156146ad57600080fd5b505afa1580156146c1573d6000803e3d6000fd5b505050506040513d60208110156146d757600080fd5b50515b15905060006001600160a01b038516158061476a5750826001600160a01b0316633b90b9bf866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561473d57600080fd5b505afa158015614751573d6000803e3d6000fd5b505050506040513d602081101561476757600080fd5b50515b15905081158015614779575080155b15614786575050506137c2565b60006001600160a01b03871661479d5760006147a6565b6147a6876117b4565b905060006001600160a01b0387166147bf5760006147c8565b6147c8876117b4565b9050600061480a6001600160a01b038916156147e55760006147e7565b875b6120036001600160a01b038c1615614800576000614802565b895b6121116111c7565b9050614814615116565b6040518061010001604052808b6001600160a01b031681526020018a6001600160a01b03168152602001871515815260200186151581526020018981526020018581526020018481526020018381525090506000806000896001600160a01b031663edb7a6fa6040518163ffffffff1660e01b815260040160606040518083038186803b1580156148a457600080fd5b505afa1580156148b8573d6000803e3d6000fd5b505050506040513d60608110156148ce57600080fd5b508051602082015160409092015190945090925090506148f384846130c36008614bf6565b6149028483612f65600c614bf6565b61461784826143af6010614bf6565b600081836149605760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156134065781810151838201526020016133ee565b50600083858161496c57fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526137c2908490614d70565b6149ff81614e21565b614a0842614e7b565b83546001600160d81b0392831664ffffffffff909216600160d81b029216919091177fffffffffff000000000000000000000000000000000000000000000000000000161790915550565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052613b91908590614d70565b6040805180820190915283546001600160d81b0381168252600160d81b900464ffffffffff1660208201526137c2908490613861908585613ba6565b60006003821115614b5b5781600160028204015b81811015614b5357809150600281828681614b4257fe5b040181614b4b57fe5b049050614b2b565b509050611718565b8115614b6957506001611718565b506000611718565b511590565b815160009015614b8c5750815160001901611079565b50919050565b600066010000000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034382062697473000000604482015290519081900360640190fd5b5190511490565b614bfe6150e3565b5083516001600160a01b03166000908152600382016020908152604091829020825191820190925290548152614c326150e3565b506020808601516001600160a01b031660009081526003840182526040908190208151928301909152548152614c6782614b71565b8015614c775750614c7781614b71565b8015614c84575085604001515b8015614c91575085606001515b15614d03578551614ccc90614ca68488614b76565b6001614cc38a608001518b60a001516137c790919063ffffffff16565b8863ffffffff16565b6020860151614cfc90614cdf8388614b76565b6001614cc38a608001518b60c001516134cc90919063ffffffff16565b5050613b91565b856040015115614d3d57855160a08701516080880151614d3d92918591614d2b9082906137c7565b60e08b01518894939291908b8b614ed7565b856060015115614d6857602086015160c08701516080880151614d6892918491614d2b9082906134cc565b505050505050565b6060614dc5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614efb9092919063ffffffff16565b8051909150156137c257808060200190516020811015614de457600080fd5b50516137c25760405162461bcd60e51b815260040180806020018281038252602a8152602001806152d8602a913960400191505060405180910390fd5b6000600160d81b8210612f42576040805162461bcd60e51b815260206004820152601e60248201527f76616c756520646f6573206e6f742066697420696e2032313620626974730000604482015290519081900360640190fd5b6000650100000000008210612f42576040805162461bcd60e51b815260206004820152601d60248201527f76616c756520646f6573206e6f742066697420696e2034302062697473000000604482015290519081900360640190fd5b612fc98888888715614ee95789614ef1565b614ef1613866565b8989898989614402565b60606111fc84846000856060614f1085615072565b614f61576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310614fa05780518252601f199092019160209182019101614f81565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114615002576040519150601f19603f3d011682016040523d82523d6000602084013e615007565b606091505b5091509150811561501b5791506134c49050565b80511561502b5780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156134065781810151838201526020016133ee565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708181148015906134c4575050151592915050565b60405180604001604052806002906020820280368337509192915050565b604051806040016040528060008152602001600081525090565b6040518060200160405280600081525090565b604080516060810182526000808252602082018190529181019190915290565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160001515815260200160001515815260200160008152602001600081526020016000815260200160008152509056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735361666545524332303a204552433230206f7065726174696f6e20646964206e6f74207375636365656445524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220f5acfd09e87c0e0c91649c917b687b73362797cc26a1c21a7d92ee5d568457a464736f6c634300060c0033

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

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f98400000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000baf9a5d4b0052359326a6cdab54babaa3a3a9643000000000000000000000000000000000000000000000000000000000000001e31696e6368204c697175696469747920506f6f6c20284554482d554e49290000000000000000000000000000000000000000000000000000000000000000000b314c502d4554482d554e49000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _token0 (address): 0x0000000000000000000000000000000000000000
Arg [1] : _token1 (address): 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
Arg [2] : name (string): 1inch Liquidity Pool (ETH-UNI)
Arg [3] : symbol (string): 1LP-ETH-UNI
Arg [4] : _mooniswapFactoryGovernance (address): 0xbAF9A5d4b0052359326A6CDAb54BABAa3a3A9643

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000001f9840a85d5af5bf1d1762f925bdaddc4201f984
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [4] : 000000000000000000000000baf9a5d4b0052359326a6cdab54babaa3a3a9643
Arg [5] : 000000000000000000000000000000000000000000000000000000000000001e
Arg [6] : 31696e6368204c697175696469747920506f6f6c20284554482d554e49290000
Arg [7] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [8] : 314c502d4554482d554e49000000000000000000000000000000000000000000


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.