ETH Price: $3,390.97 (-1.32%)
Gas: 3 Gwei

Contract

0xD622dbD384D8C682F1Dfe2ec18809C6BcD09bd40
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Emergency Withdr...188165872023-12-19 0:56:47193 days ago1702947407IN
0xD622dbD3...BcD09bd40
0 ETH0.001921344.35356103
Emergency Withdr...187441472023-12-08 21:14:35203 days ago1702070075IN
0xD622dbD3...BcD09bd40
0 ETH0.0017074739.4171272
Emergency Withdr...187439422023-12-08 20:33:11203 days ago1702067591IN
0xD622dbD3...BcD09bd40
0 ETH0.0016992239.22671148
Emergency Withdr...179143792023-08-14 16:48:11319 days ago1692031691IN
0xD622dbD3...BcD09bd40
0 ETH0.0016979827.37884006
Emergency Withdr...165413442023-02-02 13:14:35512 days ago1675343675IN
0xD622dbD3...BcD09bd40
0 ETH0.0022678336.56730247
Emergency Withdr...160685802022-11-28 12:47:35578 days ago1669639655IN
0xD622dbD3...BcD09bd40
0 ETH0.0005075611.72035512
Emergency Withdr...160685802022-11-28 12:47:35578 days ago1669639655IN
0xD622dbD3...BcD09bd40
0 ETH0.0005075611.72035512
Emergency Withdr...160685732022-11-28 12:46:11578 days ago1669639571IN
0xD622dbD3...BcD09bd40
0 ETH0.000773412.47302482
Emergency Withdr...160350252022-11-23 20:18:23583 days ago1669234703IN
0xD622dbD3...BcD09bd40
0 ETH0.0008637213.9297145
Emergency Withdr...155144722022-09-11 11:02:30657 days ago1662894150IN
0xD622dbD3...BcD09bd40
0 ETH0.000397286.40725361
Emergency Withdr...153806812022-08-21 0:02:18678 days ago1661040138IN
0xD622dbD3...BcD09bd40
0 ETH0.000418186.74289877
Emergency Withdr...152423122022-07-30 6:57:01700 days ago1659164221IN
0xD622dbD3...BcD09bd40
0 ETH0.000572039.22544146
Emergency Withdr...150026772022-06-21 14:12:53738 days ago1655820773IN
0xD622dbD3...BcD09bd40
0 ETH0.0035129656.65527408
Emergency Withdr...147887212022-05-16 21:56:05774 days ago1652738165IN
0xD622dbD3...BcD09bd40
0 ETH0.0022788236.75164906
Emergency Withdr...147781502022-05-15 5:28:53776 days ago1652592533IN
0xD622dbD3...BcD09bd40
0 ETH0.0014910824.04281075
Emergency Withdr...147687892022-05-13 17:48:16777 days ago1652464096IN
0xD622dbD3...BcD09bd40
0 ETH0.00498480.37943254
Emergency Withdr...146332672022-04-22 7:13:28799 days ago1650611608IN
0xD622dbD3...BcD09bd40
0 ETH0.002297837.05771414
Emergency Withdr...146301942022-04-21 19:33:40799 days ago1650569620IN
0xD622dbD3...BcD09bd40
0 ETH0.0036554358.95289106
Emergency Withdr...146027312022-04-17 12:10:40804 days ago1650197440IN
0xD622dbD3...BcD09bd40
0 ETH0.0011281218.19025274
Emergency Withdr...145274002022-04-05 17:49:34815 days ago1649180974IN
0xD622dbD3...BcD09bd40
0 ETH0.0046756675.39199839
Emergency Withdr...145197872022-04-04 13:25:14816 days ago1649078714IN
0xD622dbD3...BcD09bd40
0 ETH0.0038012961.30528349
Emergency Withdr...145123082022-04-03 9:18:53818 days ago1648977533IN
0xD622dbD3...BcD09bd40
0 ETH0.0025674241.40611419
Emergency Withdr...144294102022-03-21 11:28:56831 days ago1647862136IN
0xD622dbD3...BcD09bd40
0 ETH0.0016604726.77920973
Emergency Withdr...144167372022-03-19 12:01:42833 days ago1647691302IN
0xD622dbD3...BcD09bd40
0 ETH0.0011078117.86621943
Emergency Withdr...144099562022-03-18 10:51:32834 days ago1647600692IN
0xD622dbD3...BcD09bd40
0 ETH0.0028699746.28537895
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
XFai

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 200 runs

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

pragma solidity ^0.7.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "./interfaces/IErc20WithDecimals.sol";
import "../contracts/XPoolHandler.sol";

// Amplify is XFIT distibutor.
//
// Note that it's ownable and the owner wields tremendous power. The ownership
// will be transferred to a governance smart contract once XFIT is sufficiently
// distributed and the community can show to govern itself.

contract XFai is XPoolHandler, Pausable {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    // Info of each user.
    struct UserInfo {
        uint256 amount; // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
        uint256 lastDepositedBlock;
        //
        // We do some fancy math here. Basically, any point in time, the amount of XFITs
        // entitled to a user but is pending to be distributed is:
        //
        //   pending reward = (user.amount * pool.accXFITPerShare) - user.rewardDebt
        //
        // Whenever a user deposits or withdraws LP tokens to a pool. Here's what happens:
        //   1. The pool's `accXFITPerShare` (and `lastRewardBlock`) gets updated.
        //   2. User receives the pending reward sent to his/her address.
        //   3. User's `amount` gets updated.
        //   4. User's `rewardDebt` gets updated.
    }


    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken; // Address of LP token contract.
        IERC20 inputToken; // Token in which Single sided liquidity can be provided
        IXPriceOracle xPoolOracle;
        uint256 allocPoint; // How many allocation points assigned to this pool. XFITs to distribute per block.
        uint256 lastRewardBlock; // Last block number that XFITs distribution occurs.
        uint256 accXFITPerShare; // Accumulated XFITs per share, times 1e18. See below.
    }

    // The XFIT TOKEN!
    IERC20 public immutable XFIT;

    // Dev address.
    address public devaddr;
    // Block number when bonus XFIT period ends.
    uint256 public immutable bonusEndBlock;
    // XFIT tokens distributed per block.
    uint256 public XFITPerBlock;

    uint256 public totalLiquidity;

    // Bonus muliplier for early XFIT farmers.
    uint256 public constant BONUS_MULTIPLIER = 2;

    uint256 public constant REWARD_FACTOR = 10;

    // Info of each pool.
    PoolInfo[] public poolInfo;
    // Info of each user that stakes LP tokens.
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;
    // Total allocation points. Must be the sum of all allocation points in all pools.
    uint256 public totalAllocPoint = 0;
    // The block number when XFIT mining starts.
    uint256 public immutable startBlock;

    event Deposit(address indexed user, uint256 indexed pid, uint256 amount);
    event Withdraw(address indexed user, uint256 indexed pid, uint256 amount);
    event EmergencyWithdraw(
        address indexed user,
        uint256 indexed pid,
        uint256 amount
    );

    constructor(
        IERC20 _XFIT,
        address _devaddr,
        uint256 _XFITPerBlock,
        uint256 _startBlock,
        uint256 _bonusEndBlock,
        uint256 _xFitThreeshold,
        uint256 _fundsSplitFactor
    ) XPoolHandler(_xFitThreeshold, _fundsSplitFactor) {
        XFIT = _XFIT;
        devaddr = _devaddr;
        XFITPerBlock = _XFITPerBlock;
        bonusEndBlock = _bonusEndBlock;
        startBlock = _startBlock;
    }

    function poolLength() external view returns (uint256) {
        return poolInfo.length;
    }

    // Add a new lp to the pool. Can only be called by the owner.
    // XXX DO NOT add the same LP token more than once. Rewards will be messed up if you do.
    function add(
        IERC20 _lpToken,
        IERC20 _inputToken,
        IXPriceOracle _xPoolOracle,
        bool _withUpdate
    ) public onlyOwner {
        if (_withUpdate) {
            massUpdatePools();
        }
        uint256 lastRewardBlock =
            block.number > startBlock ? block.number : startBlock;
        poolInfo.push(
            PoolInfo({
                lpToken: _lpToken,
                inputToken: _inputToken,
                xPoolOracle: _xPoolOracle,
                allocPoint: 0,
                lastRewardBlock: lastRewardBlock,
                accXFITPerShare: 0
            })
        );
    }

    function _setInternal(
        uint256 _pid,
        uint256 _allocPoint,
        bool _withUpdate
    ) internal {
        if (_withUpdate) {
            massUpdatePools();
        }
        totalAllocPoint = totalAllocPoint.sub(poolInfo[_pid].allocPoint).add(
            _allocPoint
        );
        poolInfo[_pid].allocPoint = _allocPoint;
    }

    function _getNormalisedLiquidity(IERC20 _inputToken, uint256 _lpAmount)
        internal
        view
        returns (uint256 normalizedAmount)
    {
        normalizedAmount = _lpAmount;
        if (IErc20WithDecimals(address(_inputToken)).decimals() == 6) {
            normalizedAmount = _lpAmount.mul(1e6);
        }
    }

    // Return reward multiplier over the given _from to _to block.
    function getMultiplier(uint256 _from, uint256 _to)
        public
        view
        returns (uint256)
    {
        if (_to <= bonusEndBlock) {
            return _to.sub(_from).mul(BONUS_MULTIPLIER);
        } else if (_from >= bonusEndBlock) {
            return _to.sub(_from);
        } else {
            return
                bonusEndBlock.sub(_from).mul(BONUS_MULTIPLIER).add(
                    _to.sub(bonusEndBlock)
                );
        }
    }

    // View function to see pending XFITs on frontend.
    function pendingXFIT(uint256 _pid, address _user)
        external
        view
        returns (uint256)
    {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][_user];
        uint256 accXFITPerShare = pool.accXFITPerShare;
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (block.number > pool.lastRewardBlock && lpSupply != 0) {
            uint256 multiplier =
                getMultiplier(pool.lastRewardBlock, block.number);
            uint256 XFITReward =
                multiplier.mul(XFITPerBlock).mul(pool.allocPoint).div(
                    totalAllocPoint
                );
            accXFITPerShare = accXFITPerShare.add(
                XFITReward.mul(1e18).div(lpSupply)
            );
        }
        return user.amount.mul(accXFITPerShare).div(1e18).sub(user.rewardDebt);
    }

    // Update reward variables for all pools. Be careful of gas spending!
    function massUpdatePools() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            _updatePool(pid);
        }
    }

    function massUpdateAllocationPoints() public {
        uint256 length = poolInfo.length;
        for (uint256 pid = 0; pid < length; ++pid) {
            PoolInfo storage pool = poolInfo[pid];
            uint256 lpSupply = pool.lpToken.balanceOf(address(this));
            if (lpSupply == 0) {
                return;
            }
            if (totalLiquidity == 0) {
                _setInternal(pid, 0, false);
            } else {
                _setInternal(
                    pid,
                    _getNormalisedLiquidity(pool.inputToken, lpSupply)
                        .mul(1e18)
                        .div(totalLiquidity),
                    false
                );
            }
        }
    }

    function depositLPWithToken(
        uint256 _pid,
        uint256 _amount,
        uint256 _minPoolTokens
    ) public whenNotPaused {
        massUpdatePools();
        PoolInfo storage pool = poolInfo[_pid];
        (uint256 lpTokensBought, uint256 fundingRaised) =
            poolLiquidity(
                address(pool.inputToken),
                address(pool.lpToken),
                address(pool.xPoolOracle),
                _amount,
                _minPoolTokens
            );
        // Continous funding to devAddress
        if (fundingRaised > 0) {
            pool.inputToken.safeTransfer(devaddr, fundingRaised);
        }
        _depositInternal(_pid, lpTokensBought, false);
    }

    // Deposit LP tokens to Amplify for XFIT allocation.
    function depositLP(uint256 _pid, uint256 _amount) public whenNotPaused {
        massUpdatePools();
        _depositInternal(_pid, _amount, true);
    }

    function withdrawLPWithToken(uint256 _pid, uint256 _amount)
        public
        whenNotPaused
    {
        massUpdatePools();
        uint256 actualWithdrawAmount = _withdrawInternal(_pid, _amount, false);
        PoolInfo storage pool = poolInfo[_pid];
        redeemLPTokens(address(pool.lpToken), actualWithdrawAmount);
    }

    // Withdraw LP tokens from Amplify.
    function withdrawLP(uint256 _pid, uint256 _amount) public whenNotPaused {
        massUpdatePools();
        _withdrawInternal(_pid, _amount, true);
    }

    function _depositInternal(
        uint256 _pid,
        uint256 _amount,
        bool withLPTokens
    ) internal {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        if (user.amount > 0) {
            uint256 pending =
                user.amount.mul(pool.accXFITPerShare).div(1e18).sub(
                    user.rewardDebt
                );
            if (pending > 0) {
                safeXFITTransfer(msg.sender, pending);
            }
        }
        if (_amount > 0) {
            if (withLPTokens == true) {
                pool.lpToken.safeTransferFrom(
                    address(msg.sender),
                    address(this),
                    _amount
                );
            }
            user.amount = user.amount.add(_amount);
        }
        totalLiquidity = totalLiquidity.add(
            _getNormalisedLiquidity(pool.inputToken, _amount)
        );
        massUpdateAllocationPoints();
        user.rewardDebt = user.amount.mul(pool.accXFITPerShare).div(1e18);
        user.lastDepositedBlock = block.number;
        emit Deposit(msg.sender, _pid, _amount);
    }

    function _withdrawInternal(
        uint256 _pid,
        uint256 _amount,
        bool withLPTokens
    ) internal returns (uint256) {
        massUpdatePools();
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        require(user.amount >= _amount, "withdraw: not good");
        uint256 pending =
            user.amount.mul(pool.accXFITPerShare).div(1e18).sub(
                user.rewardDebt
            );
        if (pending > 0) {
            safeXFITTransfer(msg.sender, pending);
        }
        if (_amount > 0) {
            require(
                block.number >= user.lastDepositedBlock.add(10),
                "Withdraw: Can only withdraw after 10 blocks"
            );
            user.amount = user.amount.sub(_amount);
            if (withLPTokens == true) {
                pool.lpToken.safeTransfer(address(msg.sender), _amount);
            }
        }
        totalLiquidity = totalLiquidity.sub(
            _getNormalisedLiquidity(pool.inputToken, _amount)
        );
        massUpdateAllocationPoints();
        user.rewardDebt = user.amount.mul(pool.accXFITPerShare).div(1e18);
        emit Withdraw(msg.sender, _pid, _amount);
        return _amount;
    }

    // Update reward variables of the given pool to be up-to-date.
    function _updatePool(uint256 _pid) internal {
        PoolInfo storage pool = poolInfo[_pid];
        if (block.number <= pool.lastRewardBlock) {
            return;
        }
        uint256 lpSupply = pool.lpToken.balanceOf(address(this));
        if (lpSupply == 0) {
            pool.lastRewardBlock = block.number;
            return;
        }
        if (totalLiquidity > 0) {
            _setInternal(
                _pid,
                _getNormalisedLiquidity(pool.inputToken, lpSupply)
                    .mul(1e18)
                    .div(totalLiquidity),
                false
            );
        }
        uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number);
        uint256 XFITReward =
            multiplier.mul(XFITPerBlock).mul(pool.allocPoint).div(
                totalAllocPoint
            );
        XFIT.transfer(devaddr, XFITReward.div(REWARD_FACTOR));
        pool.accXFITPerShare = pool.accXFITPerShare.add(
            XFITReward.mul(1e18).div(lpSupply)
        );
        pool.lastRewardBlock = block.number;
    }

    // Withdraw without caring about rewards. EMERGENCY ONLY.
    function emergencyWithdraw(uint256 _pid) public {
        PoolInfo storage pool = poolInfo[_pid];
        UserInfo storage user = userInfo[_pid][msg.sender];
        uint256 amount = user.amount;
        user.amount = 0;
        user.rewardDebt = 0;
        pool.lpToken.safeTransfer(address(msg.sender), amount);
        emit EmergencyWithdraw(msg.sender, _pid, amount);
    }

    // Safe XFIT transfer function, just in case if rounding error causes pool to not have enough XFITs.
    function safeXFITTransfer(address _to, uint256 _amount) internal {
        uint256 XFITBal = XFIT.balanceOf(address(this));
        if (_amount > XFITBal) {
            XFIT.transfer(_to, XFITBal);
        } else {
            XFIT.transfer(_to, _amount);
        }
    }

    // ADMIN METHODS

    // Update dev address by the admin.
    function dev(address _devaddr) public onlyOwner {
        devaddr = _devaddr;
    }

    function setPriceOracle(uint256 _pid, IXPriceOracle _xPoolOracle)
        public
        onlyOwner
    {
        PoolInfo storage pool = poolInfo[_pid];
        pool.xPoolOracle = _xPoolOracle;
    }

    function pauseDistribution() public onlyOwner {
        _pause();
    }

    function resumeDistribution() public onlyOwner {
        _unpause();
    }

    function setXFITRewardPerBlock(uint256 _newReward) public onlyOwner {
        massUpdatePools();
        XFITPerBlock = _newReward;
    }

    function withdrawAdminXFIT(uint256 amount) public onlyOwner {
        XFIT.transfer(msg.sender, amount);
    }

    function withdrawAdminFunding(uint256 _pid, uint256 _amount)
        public
        onlyOwner
    {
        PoolInfo memory pool = poolInfo[_pid];
        pool.inputToken.safeTransfer(msg.sender, _amount);
    }
}

File 2 of 17 : XPoolHandler.sol
pragma solidity ^0.7.0;

import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

import "./interfaces/IUniswapV2Router02.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IXPriceOracle.sol";
import "./lib/Babylonian.sol";

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

    IUniswapV2Factory private constant UniSwapV2FactoryAddress =
        IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f);

    IUniswapV2Router02 private constant uniswapRouter =
        IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);

    address private constant wethTokenAddress =
        0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    uint256 private constant deadline =
        0xf000000000000000000000000000000000000000000000000000000000000000;

    uint256 public totalRaised;
    uint256 public xFitThreeshold;
    uint256 public fundsSplitFactor;

    event INTERNAL_SWAP(address sender, uint256 tokensBought);

    event SWAP_TOKENS(
        address sender,
        uint256 amount,
        address fromToken,
        address toToken
    );
    event POOL_LIQUIDITY(
        address sender,
        address pool,
        address tokenA,
        uint256 amountA,
        address tokenB,
        uint256 amountB
    );
    event REMOVE_LIQUIDITY(
        address sender,
        address pool,
        address tokenA,
        uint256 amountA,
        address tokenB,
        uint256 amountB
    );

    constructor(uint256 _xFitThreeshold, uint256 _fundsSplitFactor) {
        xFitThreeshold = _xFitThreeshold;
        fundsSplitFactor = _fundsSplitFactor;
    }

    /**
    @notice Remove liquidity from a pool
    @param _FromUniPoolAddress The uniswap pair address to reomve liquidity from
    @param _lpTokensAmount The amount of LP
    @return (amountA, amountB) The amount of pair tokens received after removing liquidity
     */
    function redeemLPTokens(
        address _FromUniPoolAddress,
        uint256 _lpTokensAmount
    ) internal nonReentrant returns (uint256, uint256) {
        IUniswapV2Pair pair = IUniswapV2Pair(_FromUniPoolAddress);

        require(address(pair) != address(0), "Error: Invalid Unipool Address");

        // get reserves
        address token0 = pair.token0();
        address token1 = pair.token1();

        IERC20(_FromUniPoolAddress).safeApprove(address(uniswapRouter), 0);
        IERC20(_FromUniPoolAddress).safeApprove(
            address(uniswapRouter),
            _lpTokensAmount
        );
        uint256 amountA;
        uint256 amountB;
        if (token0 == wethTokenAddress || token1 == wethTokenAddress) {
            address _token = token0 == wethTokenAddress ? token1 : token0;
            (amountA, amountB) = uniswapRouter.removeLiquidityETH(
                _token,
                _lpTokensAmount,
                1,
                1,
                address(this),
                deadline
            );
            // send tokens
            IERC20(_token).safeTransfer(msg.sender, amountA);
            Address.sendValue(msg.sender, amountB);
        } else {
            (amountA, amountB) = uniswapRouter.removeLiquidity(
                token0,
                token1,
                _lpTokensAmount,
                1,
                1,
                address(this),
                deadline
            );

            // send tokens
            IERC20(token0).safeTransfer(msg.sender, amountA);
            IERC20(token1).safeTransfer(msg.sender, amountB);
        }
        emit REMOVE_LIQUIDITY(
            msg.sender,
            _FromUniPoolAddress,
            token0,
            amountA,
            token1,
            amountB
        );
        return (amountA, amountB);
    }

    /**
    @notice This function is used to invest in given Uniswap V2 pair through either of the tokens
    @param _FromTokenContractAddress The ERC20 token used for investment (address(0x00) if ether)
    @param _pairAddress The Uniswap pair address
    @param _amount The amount of fromToken to invest
    @param _minPoolTokens Reverts if less tokens received than this
    @return Amount of LP bought
     */
    function poolLiquidity(
        address _FromTokenContractAddress,
        address _pairAddress,
        address _xPoolOracle,
        uint256 _amount,
        uint256 _minPoolTokens
    ) internal nonReentrant returns (uint256, uint256) {
        uint256 toInvest = _pullTokens(_FromTokenContractAddress, _amount);
        uint256 LPBought;
        uint256 fundingRaised;
        (address _ToUniswapToken0, address _ToUniswapToken1) =
            _getPairTokens(_pairAddress);

        if (_FromTokenContractAddress == _ToUniswapToken0) {
            (LPBought, fundingRaised) = _poolLiquidityInternal(
                _FromTokenContractAddress,
                _ToUniswapToken1,
                _pairAddress,
                _xPoolOracle,
                toInvest
            );
        } else {
            (LPBought, fundingRaised) = _poolLiquidityInternal(
                _FromTokenContractAddress,
                _ToUniswapToken0,
                _pairAddress,
                _xPoolOracle,
                toInvest
            );
        }

        require(LPBought >= _minPoolTokens, "ERR: High Slippage");

        // Update the price oracle cumulative prices for the pair
        IXPriceOracle(_xPoolOracle).update();

        return (LPBought, fundingRaised);
    }

    function _getPairTokens(address _pairAddress)
        internal
        pure
        returns (address token0, address token1)
    {
        IUniswapV2Pair uniPair = IUniswapV2Pair(_pairAddress);
        token0 = uniPair.token0();
        token1 = uniPair.token1();
    }

    function _pullTokens(address token, uint256 amount)
        internal
        returns (uint256 value)
    {
        if (token == address(0)) {
            require(msg.value > 0, "No eth sent");
            return msg.value;
        }
        require(amount > 0, "Invalid token amount");
        require(msg.value == 0, "Eth sent with token");

        //transfer token
        IERC20(token).safeTransferFrom(msg.sender, address(this), amount);

        return amount;
    }

    // Variables required to compute the dynamic swap amount and paths
    struct TokenSwapVars {
        uint256 amountToSwap;
        uint256 destTokensAmount;
        uint256 fromTokensBought;
        uint256 toTokensBought;
        uint256 destTokenReserve;
        uint256 fundingRaised;
    }

    // This checks if its possible to swap Incoming tokens for XFit from the contract. If its not possible, then uses Uniswap to swap the tokens.
    function _poolLiquidityInternal(
        address _FromTokenContractAddress,
        address _ToTokenContractAddress,
        address _pairAddress,
        address _xPoolOracle,
        uint256 _amount
    ) internal returns (uint256, uint256) {
        TokenSwapVars memory tokenSwapVars;

        tokenSwapVars.amountToSwap = _amount / 2;

        // Convert amountToSwap to equivalent number of XFit tokens by quering prie oracle
        tokenSwapVars.destTokensAmount = IXPriceOracle(_xPoolOracle).consult(
            _FromTokenContractAddress,
            tokenSwapVars.amountToSwap
        );

        // How much of the incoming funds should be used to swap for XFit again
        uint256 splittedFunds =
            _amount.sub(tokenSwapVars.amountToSwap).mul(fundsSplitFactor).div(
                1e18
            );

        // Contract's balance of XFit tokens
        tokenSwapVars.destTokenReserve = IERC20(_ToTokenContractAddress)
            .balanceOf(address(this));

        // If XFit are available in the contract, swap internally
        if (
            tokenSwapVars.destTokenReserve > xFitThreeshold &&
            tokenSwapVars.destTokensAmount <
            (tokenSwapVars.destTokenReserve.sub(xFitThreeshold))
        ) {
            tokenSwapVars.fromTokensBought = tokenSwapVars.amountToSwap;
            tokenSwapVars.toTokensBought = tokenSwapVars.destTokensAmount;
            // Swap the splittedFunds portion of incoming funding to buyBack XFit
            swapSplittedFunds(
                _FromTokenContractAddress,
                _ToTokenContractAddress,
                splittedFunds
            );
            tokenSwapVars.fundingRaised = _amount
                .sub(tokenSwapVars.amountToSwap)
                .sub(splittedFunds);
            totalRaised = totalRaised.add(tokenSwapVars.fundingRaised);
            emit INTERNAL_SWAP(msg.sender, tokenSwapVars.toTokensBought);
        }
        // else use uniswap
        else {
            // divide intermediate into appropriate amount to add liquidity using single side liquidity provision logic descrobed here: https://blog.alphafinance.io/onesideduniswap/
            (
                tokenSwapVars.fromTokensBought,
                tokenSwapVars.toTokensBought
            ) = _swapTokens(
                _FromTokenContractAddress,
                IUniswapV2Pair(_pairAddress),
                _amount
            );
        }

        // Add liquidity to Uniswap
        (uint256 lpAmount, uint256 amountA, uint256 amountB) =
            _uniDeposit(
                _FromTokenContractAddress,
                _ToTokenContractAddress,
                tokenSwapVars.fromTokensBought,
                tokenSwapVars.toTokensBought,
                tokenSwapVars.fundingRaised > 0
            );

        emit POOL_LIQUIDITY(
            msg.sender,
            _pairAddress,
            _FromTokenContractAddress,
            amountA,
            _ToTokenContractAddress,
            amountB
        );

        return (lpAmount, tokenSwapVars.fundingRaised);
    }

    function swapSplittedFunds(
        address _FromTokenContractAddress,
        address _ToTokenContractAddress,
        uint256 _splittedFunds
    ) internal {
        _swapTokensInternal(
            _FromTokenContractAddress,
            _ToTokenContractAddress,
            _splittedFunds
        );
    }

    function _uniDeposit(
        address _ToUnipoolToken0,
        address _ToUnipoolToken1,
        uint256 token0Bought,
        uint256 token1Bought,
        bool isInternalSwap
    )
        internal
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        IERC20(_ToUnipoolToken0).safeApprove(address(uniswapRouter), 0);
        IERC20(_ToUnipoolToken1).safeApprove(address(uniswapRouter), 0);

        IERC20(_ToUnipoolToken0).safeApprove(
            address(uniswapRouter),
            token0Bought
        );
        IERC20(_ToUnipoolToken1).safeApprove(
            address(uniswapRouter),
            token1Bought
        );

        (uint256 amountA, uint256 amountB, uint256 LP) =
            uniswapRouter.addLiquidity(
                _ToUnipoolToken0,
                _ToUnipoolToken1,
                token0Bought,
                token1Bought,
                1,
                1,
                address(this),
                deadline
            );

        //Returning Residue in token0, if any.
        if (token0Bought.sub(amountA) > 0) {
            IERC20(_ToUnipoolToken0).safeTransfer(
                msg.sender,
                token0Bought.sub(amountA)
            );
        }

        // Return Xfit residue if there is any only if Uniswap is used for swapping and not the internal reserves.
        if (!isInternalSwap) {
            //Returning Residue in token1, if any

            if (token1Bought.sub(amountB) > 0) {
                IERC20(_ToUnipoolToken1).safeTransfer(
                    msg.sender,
                    token1Bought.sub(amountB)
                );
            }
        }

        return (LP, amountA, amountB);
    }

    function _swapTokens(
        address _fromContractAddress,
        IUniswapV2Pair _pair,
        uint256 _amount
    ) internal returns (uint256 fromTokensBought, uint256 toTokensBought) {
        (address _ToUnipoolToken0, address _ToUnipoolToken1) =
            _getPairTokens(address(_pair));

        (uint256 res0, uint256 res1, ) = _pair.getReserves();

        if (_fromContractAddress == _ToUnipoolToken0) {
            uint256 amountToSwap = calculateSwapInAmount(res0, _amount);
            //if no reserve or a new _pair is created
            if (amountToSwap == 0) amountToSwap = _amount.div(2);
            toTokensBought = _swapTokensInternal(
                _fromContractAddress,
                _ToUnipoolToken1,
                amountToSwap
            );
            fromTokensBought = _amount.sub(amountToSwap);
        } else {
            uint256 amountToSwap = calculateSwapInAmount(res1, _amount);
            //if no reserve or a new _pair is created
            if (amountToSwap == 0) amountToSwap = _amount.div(2);
            toTokensBought = _swapTokensInternal(
                _fromContractAddress,
                _ToUnipoolToken0,
                amountToSwap
            );
            fromTokensBought = _amount.sub(amountToSwap);
        }
    }

    function calculateSwapInAmount(uint256 reserveIn, uint256 userIn)
        internal
        pure
        returns (uint256)
    {
        return
            Babylonian
                .sqrt(
                reserveIn.mul(userIn.mul(3988000) + reserveIn.mul(3988009))
            )
                .sub(reserveIn.mul(1997)) / 1994;
    }

    /**
    @notice This function is used to swap ERC20 <> ERC20
    @param _FromTokenContractAddress The token address to swap from.
    @param _ToTokenContractAddress The token address to swap to. 
    @param tokens2Trade The amount of tokens to swap
    @return tokenBought The quantity of tokens bought
    */
    function _swapTokensInternal(
        address _FromTokenContractAddress,
        address _ToTokenContractAddress,
        uint256 tokens2Trade
    ) internal returns (uint256 tokenBought) {
        if (_FromTokenContractAddress == _ToTokenContractAddress) {
            return tokens2Trade;
        }
        IERC20(_FromTokenContractAddress).safeApprove(
            address(uniswapRouter),
            0
        );
        IERC20(_FromTokenContractAddress).safeApprove(
            address(uniswapRouter),
            tokens2Trade
        );

        address[] memory path = new address[](2);
        path[0] = _FromTokenContractAddress;
        path[1] = _ToTokenContractAddress;

        tokenBought = uniswapRouter.swapExactTokensForTokens(
            tokens2Trade,
            1,
            path,
            address(this),
            deadline
        )[path.length - 1];

        require(tokenBought > 0, "Error Swapping Tokens 2");
        emit SWAP_TOKENS(
            msg.sender,
            tokens2Trade,
            _FromTokenContractAddress,
            _ToTokenContractAddress
        );
    }

    function getEstimatedLPTokens(
        uint256 _amountIn,
        address _FromTokenContractAddress,
        address _pair
    ) public view returns (uint256 estimatedLps) {
        (uint256 res0, uint256 res1, ) = IUniswapV2Pair(_pair).getReserves();
        (address _ToUnipoolToken0, address _ToUnipoolToken1) =
            _getPairTokens(_pair);
        if (_FromTokenContractAddress == _ToUnipoolToken0) {
            uint256 amountToSwap = calculateSwapInAmount(res0, _amountIn);
            estimatedLps = _amountIn
                .sub(amountToSwap)
                .mul(IUniswapV2Pair(_pair).totalSupply())
                .div(res0);
        } else if (_FromTokenContractAddress == _ToUnipoolToken1) {
            uint256 amountToSwap = calculateSwapInAmount(res1, _amountIn);
            estimatedLps = _amountIn
                .sub(amountToSwap)
                .mul(IUniswapV2Pair(_pair).totalSupply())
                .div(res1);
        }
    }

    // Owner function

    function setXFitThreeshold(uint256 _xFitThreeshold) public onlyOwner {
        xFitThreeshold = _xFitThreeshold;
    }

    function setFundsSplitFactor(uint256 _fundsSplitFactor) public onlyOwner {
        require(_fundsSplitFactor <= 1e18, "Invalid fundsSplitFactor Value");
        fundsSplitFactor = _fundsSplitFactor;
    }
}

File 3 of 17 : IErc20WithDecimals.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IErc20WithDecimals {
    function decimals() external view returns (uint256);
}

File 4 of 17 : IUniswapV2Factory.sol
interface IUniswapV2Factory {
    function getPair(address tokenA, address tokenB)
        external
        view
        returns (address);
}

File 5 of 17 : IUniswapV2Pair.sol
interface IUniswapV2Pair {
    function token0() external pure returns (address);

    function token1() external pure returns (address);

    function getReserves()
        external
        view
        returns (
            uint112 _reserve0,
            uint112 _reserve1,
            uint32 _blockTimestampLast
        );

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

File 6 of 17 : IUniswapV2Router02.sol
interface IUniswapV2Router02 {
    function factory() external pure returns (address);

    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountADesired,
        uint256 amountBDesired,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    )
        external
        returns (
            uint256 amountA,
            uint256 amountB,
            uint256 liquidity
        );

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountA, uint256 amountB);

    function removeLiquidityETH(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountToken, uint256 amountETH);

    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint256 liquidity,
        uint256 amountAMin,
        uint256 amountBMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountA, uint256 amountB);

    function removeLiquidityETHWithPermit(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline,
        bool approveMax,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external returns (uint256 amountToken, uint256 amountETH);

    function swapExactTokensForTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapTokensForExactTokens(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactETHForTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);

    function swapTokensForExactETH(
        uint256 amountOut,
        uint256 amountInMax,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapExactTokensForETH(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external returns (uint256[] memory amounts);

    function swapETHForExactTokens(
        uint256 amountOut,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable returns (uint256[] memory amounts);

    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountETH);

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

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function quote(
        uint256 amountA,
        uint256 reserveA,
        uint256 reserveB
    ) external pure returns (uint256 amountB);

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

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

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

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

File 7 of 17 : IXPriceOracle.sol
interface IXPriceOracle {
    function update() external;

    function consult(address token, uint256 amountIn)
        external
        view
        returns (uint256);
}

File 8 of 17 : Babylonian.sol
// import "@uniswap/lib/contracts/libraries/Babylonian.sol";
library Babylonian {
    function sqrt(uint256 y) internal pure returns (uint256 z) {
        if (y > 3) {
            z = y;
            uint256 x = y / 2 + 1;
            while (x < z) {
                z = x;
                x = (y / x + x) / 2;
            }
        } else if (y != 0) {
            z = 1;
        }
        // else z = 0
    }
}

File 9 of 17 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "../utils/Context.sol";
/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor () internal {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_owner, address(0));
        _owner = address(0);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 10 of 17 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

File 12 of 17 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.2 <0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity >=0.6.0 <0.8.0;

/*
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with GSN meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address payable) {
        return msg.sender;
    }

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

File 15 of 17 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

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

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

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

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

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

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

            bytes32 lastvalue = set._values[lastIndex];

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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


    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

File 16 of 17 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./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.
 */
abstract 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 virtual 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 17 of 17 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

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

    uint256 private _status;

    constructor () internal {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IERC20","name":"_XFIT","type":"address"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"uint256","name":"_XFITPerBlock","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_bonusEndBlock","type":"uint256"},{"internalType":"uint256","name":"_xFitThreeshold","type":"uint256"},{"internalType":"uint256","name":"_fundsSplitFactor","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"EmergencyWithdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokensBought","type":"uint256"}],"name":"INTERNAL_SWAP","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"tokenA","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountA","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenB","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountB","type":"uint256"}],"name":"POOL_LIQUIDITY","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"tokenA","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountA","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenB","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountB","type":"uint256"}],"name":"REMOVE_LIQUIDITY","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"fromToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"}],"name":"SWAP_TOKENS","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"BONUS_MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XFIT","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"XFITPerBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_lpToken","type":"address"},{"internalType":"contract IERC20","name":"_inputToken","type":"address"},{"internalType":"contract IXPriceOracle","name":"_xPoolOracle","type":"address"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bonusEndBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minPoolTokens","type":"uint256"}],"name":"depositLPWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devaddr","type":"address"}],"name":"dev","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devaddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fundsSplitFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"address","name":"_FromTokenContractAddress","type":"address"},{"internalType":"address","name":"_pair","type":"address"}],"name":"getEstimatedLPTokens","outputs":[{"internalType":"uint256","name":"estimatedLps","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdateAllocationPoints","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"address","name":"_user","type":"address"}],"name":"pendingXFIT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IERC20","name":"lpToken","type":"address"},{"internalType":"contract IERC20","name":"inputToken","type":"address"},{"internalType":"contract IXPriceOracle","name":"xPoolOracle","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardBlock","type":"uint256"},{"internalType":"uint256","name":"accXFITPerShare","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resumeDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fundsSplitFactor","type":"uint256"}],"name":"setFundsSplitFactor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"contract IXPriceOracle","name":"_xPoolOracle","type":"address"}],"name":"setPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newReward","type":"uint256"}],"name":"setXFITRewardPerBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_xFitThreeshold","type":"uint256"}],"name":"setXFitThreeshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAllocPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"},{"internalType":"uint256","name":"lastDepositedBlock","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawAdminFunding","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawAdminXFIT","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawLP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawLPWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xFitThreeshold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60e06040526000600a553480156200001657600080fd5b5060405162003ec838038062003ec8833981810160405260e08110156200003c57600080fd5b508051602082015160408301516060840151608085015160a086015160c090960151600160009081559596949593949293919291829082906200007e62000123565b600180546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35060039190915560045550506005805460609690961b6001600160601b0319166080526001600160a81b03199095166101006001600160a01b0395909516949094029390931790935560065560a05260c05262000127565b3390565b60805160601c60a05160c051613d3a6200018e60003980610b33528061155252806115795250806108d95280610f1f5280610f5c5280610f945280610fc2525080611082528061178d52806126bc5280612a3d5280612ae05280612b895250613d3a6000f3fe608060405234801561001057600080fd5b506004361061023d5760003560e01c80636ad754b11161013b578063b47ab19e116100b8578063d49e77cd1161007c578063d49e77cd146105bd578063e00b2f84146105c5578063e3c947c914610603578063f2fde38b14610620578063f525bfba146106465761023d565b8063b47ab19e14610506578063b60f0c2a14610532578063b7c69cb714610566578063bfe50f7214610592578063c5c4744c146105b55761023d565b80638da5cb5b116100ff5780638da5cb5b1461044a5780638dbb1e3a1461046e57806391918d641461049157806393f1a40b146104b457806395c64a3b146104fe5761023d565b80636ad754b1146103da578063715018a6146103f7578063739d58c0146103ff5780638aa285501461041c5780638d88a90e146104245761023d565b80632b782ebd116101c95780634c046eb51161018d5780634c046eb5146103685780635312ea8e146103705780635b395fdc1461038d5780635c975abb146103b6578063630b5ba1146103d25761023d565b80632b782ebd146103255780632b8c74ff1461032d57806331cec7a314610350578063421d55f61461035857806348cd4cb1146103605761023d565b80631526fe27116102105780631526fe27146102a657806315770f921461030557806317caf6f11461030d57806318369be1146103155780631aed65531461031d5761023d565b8063081e3eda146102425780630ae108331461025c578063127f5b2b14610281578063132678051461029e575b600080fd5b61024a61064e565b60408051918252519081900360200190f35b61027f6004803603604081101561027257600080fd5b5080359060200135610654565b005b61027f6004803603602081101561029757600080fd5b5035610740565b61027f610804565b6102c3600480360360208110156102bc57600080fd5b5035610870565b604080516001600160a01b039788168152958716602087015293909516848401526060840191909152608083015260a082019290925290519081900360c00190f35b61024a6108c6565b61024a6108cc565b61024a6108d2565b61024a6108d7565b61024a6108fb565b61027f6004803603604081101561034357600080fd5b5080359060200135610901565b61027f6109a5565b61027f610a0f565b61024a610b31565b61024a610b55565b61027f6004803603602081101561038657600080fd5b5035610b5b565b61027f600480360360608110156103a357600080fd5b5080359060208101359060400135610bf7565b6103be610cd3565b604080519115158252519081900360200190f35b61027f610cdc565b61027f600480360360208110156103f057600080fd5b5035610cfb565b61027f610d62565b61027f6004803603602081101561041557600080fd5b5035610e0e565b61024a610e7d565b61027f6004803603602081101561043a57600080fd5b50356001600160a01b0316610e82565b610452610f0c565b604080516001600160a01b039092168252519081900360200190f35b61024a6004803603604081101561048457600080fd5b5080359060200135610f1b565b61027f600480360360408110156104a757600080fd5b5080359060200135610ff3565b6104e0600480360360408110156104ca57600080fd5b50803590602001356001600160a01b0316611054565b60408051938452602084019290925282820152519081900360600190f35b610452611080565b61027f6004803603604081101561051c57600080fd5b50803590602001356001600160a01b03166110a4565b61024a6004803603606081101561054857600080fd5b508035906001600160a01b036020820135811691604001351661114b565b61024a6004803603604081101561057c57600080fd5b50803590602001356001600160a01b03166112f9565b61027f600480360360408110156105a857600080fd5b5080359060200135611463565b61024a6114c4565b6104526114ca565b61027f600480360360808110156105db57600080fd5b506001600160a01b0381358116916020810135821691604082013516906060013515156114de565b61027f6004803603602081101561061957600080fd5b5035611704565b61027f6004803603602081101561063657600080fd5b50356001600160a01b03166117ff565b61024a611902565b60085490565b61065c611908565b6001600160a01b031661066d610f0c565b6001600160a01b0316146106b6576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6106be613b2b565b600883815481106106cb57fe5b60009182526020918290206040805160c081018252600690930290910180546001600160a01b039081168452600182015481169484018590526002820154169183019190915260038101546060830152600481015460808301526005015460a0820152915061073b90338461190c565b505050565b610748611908565b6001600160a01b0316610759610f0c565b6001600160a01b0316146107a2576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b670de0b6b3a76400008111156107ff576040805162461bcd60e51b815260206004820152601e60248201527f496e76616c69642066756e647353706c6974466163746f722056616c75650000604482015290519081900360640190fd5b600455565b61080c611908565b6001600160a01b031661081d610f0c565b6001600160a01b031614610866576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b61086e61195e565b565b6008818154811061088057600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b0394851696509284169491909316929186565b60075481565b600a5481565b600a81565b7f000000000000000000000000000000000000000000000000000000000000000081565b60065481565b610909610cd3565b1561094e576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610956610cdc565b6000610964838360006119fe565b905060006008848154811061097557fe5b60009182526020909120600690910201805490915061099d906001600160a01b031683611be8565b505050505050565b6109ad611908565b6001600160a01b03166109be610f0c565b6001600160a01b031614610a07576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b61086e612081565b60085460005b81811015610b2d57600060088281548110610a2c57fe5b6000918252602080832060069092029091018054604080516370a0823160e01b815230600482015290519295506001600160a01b03909116926370a0823192602480840193829003018186803b158015610a8557600080fd5b505afa158015610a99573d6000803e3d6000fd5b505050506040513d6020811015610aaf57600080fd5b5051905080610ac1575050505061086e565b600754610ad957610ad483600080612104565b610b23565b610b2383610b1c600754610b16670de0b6b3a7640000610b108860010160009054906101000a90046001600160a01b031688612177565b906121f2565b9061224b565b6000612104565b5050600101610a15565b5050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60045481565b600060088281548110610b6a57fe5b600091825260208083208584526009825260408085203380875293528420805485825560018201959095556006909302018054909450919291610bba916001600160a01b0391909116908361190c565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a350505050565b610bff610cd3565b15610c44576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610c4c610cdc565b600060088481548110610c5b57fe5b600091825260208220600160069092020190810154815460028301549294508392610c97926001600160a01b03908116928116911688886122b2565b90925090508015610cc7576005546001840154610cc7916001600160a01b0391821691610100909104168361190c565b61099d8683600061242b565b60055460ff1690565b60085460005b81811015610b2d57610cf38161257c565b600101610ce2565b610d03611908565b6001600160a01b0316610d14610f0c565b6001600160a01b031614610d5d576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b600355565b610d6a611908565b6001600160a01b0316610d7b610f0c565b6001600160a01b031614610dc4576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b610e16611908565b6001600160a01b0316610e27610f0c565b6001600160a01b031614610e70576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b610e78610cdc565b600655565b600281565b610e8a611908565b6001600160a01b0316610e9b610f0c565b6001600160a01b031614610ee4576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001546001600160a01b031690565b60007f00000000000000000000000000000000000000000000000000000000000000008211610f5a57610f536002610b1084866127a3565b9050610fed565b7f00000000000000000000000000000000000000000000000000000000000000008310610f8b57610f5382846127a3565b610f53610fb8837f00000000000000000000000000000000000000000000000000000000000000006127a3565b610fe76002610b107f0000000000000000000000000000000000000000000000000000000000000000886127a3565b90612800565b92915050565b610ffb610cd3565b15611040576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b611048610cdc565b61073b828260016119fe565b600960209081526000928352604080842090915290825290208054600182015460029092015490919083565b7f000000000000000000000000000000000000000000000000000000000000000081565b6110ac611908565b6001600160a01b03166110bd610f0c565b6001600160a01b031614611106576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b60006008838154811061111557fe5b6000918252602090912060069091020160020180546001600160a01b0319166001600160a01b0393909316929092179091555050565b6000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d60608110156111b357600080fd5b5080516020909101516001600160701b0391821693501690506000806111d88661285a565b91509150816001600160a01b0316876001600160a01b03161415611282576000611202858a612940565b905061127a85610b16896001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561124457600080fd5b505afa158015611258573d6000803e3d6000fd5b505050506040513d602081101561126e57600080fd5b5051610b108d866127a3565b9550506112ee565b806001600160a01b0316876001600160a01b031614156112ee5760006112a8848a612940565b90506112ea84610b16896001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561124457600080fd5b9550505b505050509392505050565b6000806008848154811061130957fe5b600091825260208083208784526009825260408085206001600160a01b0389811687529084528186206006959095029092016005810154815483516370a0823160e01b815230600482015293519298509596909590949316926370a082319260248082019391829003018186803b15801561138357600080fd5b505afa158015611397573d6000803e3d6000fd5b505050506040513d60208110156113ad57600080fd5b50516004850154909150431180156113c457508015155b156114275760006113d9856004015443610f1b565b90506000611400600a54610b168860030154610b10600654876121f290919063ffffffff16565b905061142261141b84610b1684670de0b6b3a76400006121f2565b8590612800565b935050505b6114588360010154611452670de0b6b3a7640000610b168688600001546121f290919063ffffffff16565b906127a3565b979650505050505050565b61146b610cd3565b156114b0576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6114b8610cdc565b610b2d8282600161242b565b60025481565b60055461010090046001600160a01b031681565b6114e6611908565b6001600160a01b03166114f7610f0c565b6001600160a01b031614611540576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b801561154e5761154e610cdc565b60007f0000000000000000000000000000000000000000000000000000000000000000431161159d577f000000000000000000000000000000000000000000000000000000000000000061159f565b435b6040805160c0810182526001600160a01b039788168152958716602087019081529487169086019081526000606087018181526080880193845260a08801828152600880546001810182559352975160069092027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381018054938b166001600160a01b031994851617905596517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee488018054918b1691841691909117905591517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee5870180549190991691161790965594517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee6840155505091517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee7830155517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee890910155565b61170c611908565b6001600160a01b031661171d610f0c565b6001600160a01b031614611766576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163a9059cbb9160448083019260209291908290030181600087803b1580156117d557600080fd5b505af11580156117e9573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b611807611908565b6001600160a01b0316611818610f0c565b6001600160a01b031614611861576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6001600160a01b0381166118a65760405162461bcd60e51b8152600401808060200182810382526026815260200180613bb36026913960400191505060405180910390fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261073b908490612988565b611966610cd3565b6119ae576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6119e1611908565b604080516001600160a01b039092168252519081900360200190a1565b6000611a08610cdc565b600060088581548110611a1757fe5b600091825260208083208884526009825260408085203386529092529220805460069092029092019250851115611a8a576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b6000611abb8260010154611452670de0b6b3a7640000610b16876005015487600001546121f290919063ffffffff16565b90508015611acd57611acd3382612a39565b8515611b50576002820154611ae390600a612800565b431015611b215760405162461bcd60e51b815260040180806020018281038252602b815260200180613cda602b913960400191505060405180910390fd5b8154611b2d90876127a3565b825560018515151415611b50578254611b50906001600160a01b0316338861190c565b6001830154611b7590611b6c906001600160a01b031688612177565b600754906127a3565b600755611b80610a0f565b60058301548254611b9e91670de0b6b3a764000091610b16916121f2565b6001830155604080518781529051889133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a38593505050505b9392505050565b60008060026000541415611c43576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055836001600160a01b038116611ca4576040805162461bcd60e51b815260206004820152601e60248201527f4572726f723a20496e76616c696420556e69706f6f6c20416464726573730000604482015290519081900360640190fd5b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611cdf57600080fd5b505afa158015611cf3573d6000803e3d6000fd5b505050506040513d6020811015611d0957600080fd5b50516040805163d21220a760e01b815290519192506000916001600160a01b0385169163d21220a7916004808301926020929190829003018186803b158015611d5157600080fd5b505afa158015611d65573d6000803e3d6000fd5b505050506040513d6020811015611d7b57600080fd5b50519050611da86001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d6000612c2f565b611dd06001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d88612c2f565b6000806001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21480611e1a57506001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b15611f2a5760006001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214611e4b5784611e4d565b835b60408051629d473b60e21b81526001600160a01b0383166004820152602481018c90526001604482018190526064820152306084820152600f60fc1b60a48201528151929350737a250d5630b4cf539739df2c5dacb4c659f2488d926302751cec9260c4808401939192918290030181600087803b158015611ece57600080fd5b505af1158015611ee2573d6000803e3d6000fd5b505050506040513d6040811015611ef857600080fd5b5080516020909101519093509150611f1a6001600160a01b038216338561190c565b611f243383612d42565b5061200f565b60408051635d5155ef60e11b81526001600160a01b03868116600483015285166024820152604481018a905260016064820181905260848201523060a4820152600f60fc1b60c48201528151737a250d5630b4cf539739df2c5dacb4c659f2488d9263baa2abde9260e480820193918290030181600087803b158015611faf57600080fd5b505af1158015611fc3573d6000803e3d6000fd5b505050506040513d6040811015611fd957600080fd5b5080516020909101519092509050611ffb6001600160a01b038516338461190c565b61200f6001600160a01b038416338361190c565b604080513381526001600160a01b03808c16602083015280871682840152606082018590528516608082015260a0810183905290517f8251496d51a0099361551b4a9901c85074f36c95f425405ad965a04c650a340b9181900360c00190a16001600055909890975095505050505050565b612089610cd3565b156120ce576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119e1611908565b801561211257612112610cdc565b61214982610fe76008868154811061212657fe5b906000526020600020906006020160030154600a546127a390919063ffffffff16565b600a81905550816008848154811061215d57fe5b906000526020600020906006020160030181905550505050565b6000819050826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156121b557600080fd5b505afa1580156121c9573d6000803e3d6000fd5b505050506040513d60208110156121df57600080fd5b505160061415610fed57611be182620f42405b60008261220157506000610fed565b8282028284828161220e57fe5b0414611be15760405162461bcd60e51b8152600401808060200182810382526021815260200180613c396021913960400191505060405180910390fd5b60008082116122a1576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816122aa57fe5b049392505050565b6000806002600054141561230d576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815561231e8886612e27565b905060008060008061232f8b61285a565b91509150816001600160a01b03168c6001600160a01b031614156123645761235a8c828d8d89612f31565b9094509250612377565b6123718c838d8d89612f31565b90945092505b878410156123c1576040805162461bcd60e51b81526020600482015260126024820152714552523a204869676820536c69707061676560701b604482015290519081900360640190fd5b896001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b5050600160005550939c929b50919950505050505050505050565b60006008848154811061243a57fe5b600091825260208083208784526009825260408085203386529092529220805460069092029092019250156124ae57600061249a8260010154611452670de0b6b3a7640000610b16876005015487600001546121f290919063ffffffff16565b905080156124ac576124ac3382612a39565b505b83156124e557600183151514156124d65781546124d6906001600160a01b03163330876131f7565b80546124e29085612800565b81555b600182015461250a90612501906001600160a01b031686612177565b60075490612800565b600755612515610a0f565b6005820154815461253391670de0b6b3a764000091610b16916121f2565b6001820155436002820155604080518581529051869133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35050505050565b60006008828154811061258b57fe5b90600052602060002090600602019050806004015443116125ac57506127a0565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156125f657600080fd5b505afa15801561260a573d6000803e3d6000fd5b505050506040513d602081101561262057600080fd5b50519050806126365750436004909101556127a0565b600754156126755761267583610b1c600754610b16670de0b6b3a7640000610b108860010160009054906101000a90046001600160a01b031688612177565b6000612685836004015443610f1b565b905060006126ac600a54610b168660030154610b10600654876121f290919063ffffffff16565b6005549091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169163a9059cbb91610100909104166126f684600a61224b565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561273c57600080fd5b505af1158015612750573d6000803e3d6000fd5b505050506040513d602081101561276657600080fd5b5061278d905061278284610b1684670de0b6b3a76400006121f2565b600586015490612800565b6005850155505043600490920191909155505b50565b6000828211156127fa576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015611be1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806000839050806001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561289b57600080fd5b505afa1580156128af573d6000803e3d6000fd5b505050506040513d60208110156128c557600080fd5b50516040805163d21220a760e01b815290519194506001600160a01b0383169163d21220a791600480820192602092909190829003018186803b15801561290b57600080fd5b505afa15801561291f573d6000803e3d6000fd5b505050506040513d602081101561293557600080fd5b505192949293505050565b60006107ca612981612954856107cd6121f2565b61145261297c61296788623cda296121f2565b61297488623cda206121f2565b8991016121f2565b613257565b816122aa57fe5b60606129dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132a99092919063ffffffff16565b80519091501561073b578080602001905160208110156129fc57600080fd5b505161073b5760405162461bcd60e51b815260040180806020018281038252602a815260200180613c7a602a913960400191505060405180910390fd5b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612aa857600080fd5b505afa158015612abc573d6000803e3d6000fd5b505050506040513d6020811015612ad257600080fd5b5051905080821115612b87577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb84836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612b5557600080fd5b505af1158015612b69573d6000803e3d6000fd5b505050506040513d6020811015612b7f57600080fd5b5061073b9050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb84846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612bfe57600080fd5b505af1158015612c12573d6000803e3d6000fd5b505050506040513d6020811015612c2857600080fd5b5050505050565b801580612cb5575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612c8757600080fd5b505afa158015612c9b573d6000803e3d6000fd5b505050506040513d6020811015612cb157600080fd5b5051155b612cf05760405162461bcd60e51b8152600401808060200182810382526036815260200180613ca46036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261073b908490612988565b80471015612d97576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114612de2576040519150601f19603f3d011682016040523d82523d6000602084013e612de7565b606091505b505090508061073b5760405162461bcd60e51b815260040180806020018281038252603a815260200180613bd9603a913960400191505060405180910390fd5b60006001600160a01b038316612e815760003411612e7a576040805162461bcd60e51b815260206004820152600b60248201526a139bc8195d1a081cd95b9d60aa1b604482015290519081900360640190fd5b5034610fed565b60008211612ecd576040805162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081d1bdad95b88185b5bdd5b9d60621b604482015290519081900360640190fd5b3415612f16576040805162461bcd60e51b815260206004820152601360248201527222ba341039b2b73a103bb4ba34103a37b5b2b760691b604482015290519081900360640190fd5b612f2b6001600160a01b0384163330856131f7565b50919050565b600080612f3c613b7c565b6002840480825260408051633ddac95360e01b81526001600160a01b038b811660048301526024820193909352905191871691633ddac95391604480820192602092909190829003018186803b158015612f9557600080fd5b505afa158015612fa9573d6000803e3d6000fd5b505050506040513d6020811015612fbf57600080fd5b505160208201526004548151600091612feb91670de0b6b3a764000091610b1691610b10908a906127a3565b9050876001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561303a57600080fd5b505afa15801561304e573d6000803e3d6000fd5b505050506040513d602081101561306457600080fd5b50516080830181905260035410801561309057506003546080830151613089916127a3565b8260200151105b1561311f5781516040830152602082015160608301526130b18989836132c0565b81516130c49082906114529088906127a3565b60a083018190526002546130d791612800565b600255606082015160408051338152602081019290925280517ff5d2aae17378660eb3f69d6565b2348a72c176693efd056d66772fefffe318709281900390910190a1613135565b61312a8988876132cb565b606084015260408301525b60008060006131568c8c8760400151886060015160008a60a00151116133f9565b9250925092507fe52a8d6444a86a0f9c4d5e4022c26ec5f9e2c0a873c0733b601b0ddc04a942d9338b8e858f8660405180876001600160a01b03168152602001866001600160a01b03168152602001856001600160a01b03168152602001848152602001836001600160a01b03168152602001828152602001965050505050505060405180910390a1505060a0909201519199919850909650505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052613251908590612988565b50505050565b6000600382111561329a575080600160028204015b818110156132945780915060028182858161328357fe5b04018161328c57fe5b04905061326c565b506132a4565b81156132a4575060015b919050565b60606132b884846000856135eb565b949350505050565b61325183838361373c565b6000806000806132da8661285a565b91509150600080876001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561331a57600080fd5b505afa15801561332e573d6000803e3d6000fd5b505050506040513d606081101561334457600080fd5b5080516020909101516001600160701b0391821693501690506001600160a01b0389811690851614156133b157600061337d8389612940565b9050806133925761338f88600261224b565b90505b61339d8a858361373c565b95506133a988826127a3565b9650506133ed565b60006133bd8289612940565b9050806133d2576133cf88600261224b565b90505b6133dd8a868361373c565b95506133e988826127a3565b9650505b50505050935093915050565b600080806134256001600160a01b038916737a250d5630b4cf539739df2c5dacb4c659f2488d83612c2f565b61344e6001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d6000612c2f565b6134766001600160a01b038916737a250d5630b4cf539739df2c5dacb4c659f2488d88612c2f565b61349e6001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d87612c2f565b6040805162e8e33760e81b81526001600160a01b038a8116600483015289166024820152604481018890526064810187905260016084820181905260a48201523060c4820152600f60fc1b60e4820152905160009182918291737a250d5630b4cf539739df2c5dacb4c659f2488d9163e8e33700916101048082019260609290919082900301818787803b15801561353557600080fd5b505af1158015613549573d6000803e3d6000fd5b505050506040513d606081101561355f57600080fd5b5080516020820151604090920151909450909250905060006135818a856127a3565b11156135a6576135a6336135958b866127a3565b6001600160a01b038e16919061190c565b866135dc5760006135b789846127a3565b11156135dc576135dc336135cb8a856127a3565b6001600160a01b038d16919061190c565b9a919950975095505050505050565b60608247101561362c5760405162461bcd60e51b8152600401808060200182810382526026815260200180613c136026913960400191505060405180910390fd5b61363585613a81565b613686576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106136c55780518252601f1990920191602091820191016136a6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613727576040519150601f19603f3d011682016040523d82523d6000602084013e61372c565b606091505b5091509150611458828286613a87565b6000826001600160a01b0316846001600160a01b0316141561375f575080611be1565b6137886001600160a01b038516737a250d5630b4cf539739df2c5dacb4c659f2488d6000612c2f565b6137b06001600160a01b038516737a250d5630b4cf539739df2c5dacb4c659f2488d84612c2f565b604080516002808252606080830184529260208301908036833701905050905084816000815181106137de57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061380c57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03166338ed17398460018430600f60fc1b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156138c95781810151838201526020016138b1565b505050509050019650505050505050600060405180830381600087803b1580156138f257600080fd5b505af1158015613906573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561392f57600080fd5b810190808051604051939291908464010000000082111561394f57600080fd5b90830190602082018581111561396457600080fd5b825186602082028301116401000000008211171561398157600080fd5b82525081516020918201928201910280838360005b838110156139ae578181015183820152602001613996565b505050509050016040525050506001825103815181106139ca57fe5b6020026020010151915060008211613a29576040805162461bcd60e51b815260206004820152601760248201527f4572726f72205377617070696e6720546f6b656e732032000000000000000000604482015290519081900360640190fd5b60408051338152602081018590526001600160a01b03808816828401528616606082015290517fb242fac543571b33f0bb49bcc84178771cbd74e5c7785b45981424829ba3c0759181900360800190a1509392505050565b3b151590565b60608315613a96575081611be1565b825115613aa65782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613af0578181015183820152602001613ad8565b50505050905090810190601f168015613b1d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b6040518060c00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636557697468647261773a2043616e206f6e6c7920776974686472617720616674657220313020626c6f636b73a26469706673582212201f4685f07c3621dda1fc522fd8f2f10a1545c155cc80af7cfb1a228b8623415564736f6c634300070500330000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc7441000000000000000000000000fc675877a7ab97a2ff02215b2b15ea7ba802054f000000000000000000000000000000000000000000000001d7d843dc3b4800000000000000000000000000000000000000000000000000000000000000badad90000000000000000000000000000000000000000000000000000000000badad90000000000000000000000000000000000000000001920280ca990b1fa600000000000000000000000000000000000000000000000000000002386f26fc10000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061023d5760003560e01c80636ad754b11161013b578063b47ab19e116100b8578063d49e77cd1161007c578063d49e77cd146105bd578063e00b2f84146105c5578063e3c947c914610603578063f2fde38b14610620578063f525bfba146106465761023d565b8063b47ab19e14610506578063b60f0c2a14610532578063b7c69cb714610566578063bfe50f7214610592578063c5c4744c146105b55761023d565b80638da5cb5b116100ff5780638da5cb5b1461044a5780638dbb1e3a1461046e57806391918d641461049157806393f1a40b146104b457806395c64a3b146104fe5761023d565b80636ad754b1146103da578063715018a6146103f7578063739d58c0146103ff5780638aa285501461041c5780638d88a90e146104245761023d565b80632b782ebd116101c95780634c046eb51161018d5780634c046eb5146103685780635312ea8e146103705780635b395fdc1461038d5780635c975abb146103b6578063630b5ba1146103d25761023d565b80632b782ebd146103255780632b8c74ff1461032d57806331cec7a314610350578063421d55f61461035857806348cd4cb1146103605761023d565b80631526fe27116102105780631526fe27146102a657806315770f921461030557806317caf6f11461030d57806318369be1146103155780631aed65531461031d5761023d565b8063081e3eda146102425780630ae108331461025c578063127f5b2b14610281578063132678051461029e575b600080fd5b61024a61064e565b60408051918252519081900360200190f35b61027f6004803603604081101561027257600080fd5b5080359060200135610654565b005b61027f6004803603602081101561029757600080fd5b5035610740565b61027f610804565b6102c3600480360360208110156102bc57600080fd5b5035610870565b604080516001600160a01b039788168152958716602087015293909516848401526060840191909152608083015260a082019290925290519081900360c00190f35b61024a6108c6565b61024a6108cc565b61024a6108d2565b61024a6108d7565b61024a6108fb565b61027f6004803603604081101561034357600080fd5b5080359060200135610901565b61027f6109a5565b61027f610a0f565b61024a610b31565b61024a610b55565b61027f6004803603602081101561038657600080fd5b5035610b5b565b61027f600480360360608110156103a357600080fd5b5080359060208101359060400135610bf7565b6103be610cd3565b604080519115158252519081900360200190f35b61027f610cdc565b61027f600480360360208110156103f057600080fd5b5035610cfb565b61027f610d62565b61027f6004803603602081101561041557600080fd5b5035610e0e565b61024a610e7d565b61027f6004803603602081101561043a57600080fd5b50356001600160a01b0316610e82565b610452610f0c565b604080516001600160a01b039092168252519081900360200190f35b61024a6004803603604081101561048457600080fd5b5080359060200135610f1b565b61027f600480360360408110156104a757600080fd5b5080359060200135610ff3565b6104e0600480360360408110156104ca57600080fd5b50803590602001356001600160a01b0316611054565b60408051938452602084019290925282820152519081900360600190f35b610452611080565b61027f6004803603604081101561051c57600080fd5b50803590602001356001600160a01b03166110a4565b61024a6004803603606081101561054857600080fd5b508035906001600160a01b036020820135811691604001351661114b565b61024a6004803603604081101561057c57600080fd5b50803590602001356001600160a01b03166112f9565b61027f600480360360408110156105a857600080fd5b5080359060200135611463565b61024a6114c4565b6104526114ca565b61027f600480360360808110156105db57600080fd5b506001600160a01b0381358116916020810135821691604082013516906060013515156114de565b61027f6004803603602081101561061957600080fd5b5035611704565b61027f6004803603602081101561063657600080fd5b50356001600160a01b03166117ff565b61024a611902565b60085490565b61065c611908565b6001600160a01b031661066d610f0c565b6001600160a01b0316146106b6576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6106be613b2b565b600883815481106106cb57fe5b60009182526020918290206040805160c081018252600690930290910180546001600160a01b039081168452600182015481169484018590526002820154169183019190915260038101546060830152600481015460808301526005015460a0820152915061073b90338461190c565b505050565b610748611908565b6001600160a01b0316610759610f0c565b6001600160a01b0316146107a2576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b670de0b6b3a76400008111156107ff576040805162461bcd60e51b815260206004820152601e60248201527f496e76616c69642066756e647353706c6974466163746f722056616c75650000604482015290519081900360640190fd5b600455565b61080c611908565b6001600160a01b031661081d610f0c565b6001600160a01b031614610866576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b61086e61195e565b565b6008818154811061088057600080fd5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501546001600160a01b0394851696509284169491909316929186565b60075481565b600a5481565b600a81565b7f0000000000000000000000000000000000000000000000000000000000badad981565b60065481565b610909610cd3565b1561094e576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610956610cdc565b6000610964838360006119fe565b905060006008848154811061097557fe5b60009182526020909120600690910201805490915061099d906001600160a01b031683611be8565b505050505050565b6109ad611908565b6001600160a01b03166109be610f0c565b6001600160a01b031614610a07576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b61086e612081565b60085460005b81811015610b2d57600060088281548110610a2c57fe5b6000918252602080832060069092029091018054604080516370a0823160e01b815230600482015290519295506001600160a01b03909116926370a0823192602480840193829003018186803b158015610a8557600080fd5b505afa158015610a99573d6000803e3d6000fd5b505050506040513d6020811015610aaf57600080fd5b5051905080610ac1575050505061086e565b600754610ad957610ad483600080612104565b610b23565b610b2383610b1c600754610b16670de0b6b3a7640000610b108860010160009054906101000a90046001600160a01b031688612177565b906121f2565b9061224b565b6000612104565b5050600101610a15565b5050565b7f0000000000000000000000000000000000000000000000000000000000badad981565b60045481565b600060088281548110610b6a57fe5b600091825260208083208584526009825260408085203380875293528420805485825560018201959095556006909302018054909450919291610bba916001600160a01b0391909116908361190c565b604080518281529051859133917fbb757047c2b5f3974fe26b7c10f732e7bce710b0952a71082702781e62ae05959181900360200190a350505050565b610bff610cd3565b15610c44576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b610c4c610cdc565b600060088481548110610c5b57fe5b600091825260208220600160069092020190810154815460028301549294508392610c97926001600160a01b03908116928116911688886122b2565b90925090508015610cc7576005546001840154610cc7916001600160a01b0391821691610100909104168361190c565b61099d8683600061242b565b60055460ff1690565b60085460005b81811015610b2d57610cf38161257c565b600101610ce2565b610d03611908565b6001600160a01b0316610d14610f0c565b6001600160a01b031614610d5d576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b600355565b610d6a611908565b6001600160a01b0316610d7b610f0c565b6001600160a01b031614610dc4576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6001546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600180546001600160a01b0319169055565b610e16611908565b6001600160a01b0316610e27610f0c565b6001600160a01b031614610e70576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b610e78610cdc565b600655565b600281565b610e8a611908565b6001600160a01b0316610e9b610f0c565b6001600160a01b031614610ee4576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6001546001600160a01b031690565b60007f0000000000000000000000000000000000000000000000000000000000badad98211610f5a57610f536002610b1084866127a3565b9050610fed565b7f0000000000000000000000000000000000000000000000000000000000badad98310610f8b57610f5382846127a3565b610f53610fb8837f0000000000000000000000000000000000000000000000000000000000badad96127a3565b610fe76002610b107f0000000000000000000000000000000000000000000000000000000000badad9886127a3565b90612800565b92915050565b610ffb610cd3565b15611040576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b611048610cdc565b61073b828260016119fe565b600960209081526000928352604080842090915290825290208054600182015460029092015490919083565b7f0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc744181565b6110ac611908565b6001600160a01b03166110bd610f0c565b6001600160a01b031614611106576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b60006008838154811061111557fe5b6000918252602090912060069091020160020180546001600160a01b0319166001600160a01b0393909316929092179091555050565b6000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d60608110156111b357600080fd5b5080516020909101516001600160701b0391821693501690506000806111d88661285a565b91509150816001600160a01b0316876001600160a01b03161415611282576000611202858a612940565b905061127a85610b16896001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561124457600080fd5b505afa158015611258573d6000803e3d6000fd5b505050506040513d602081101561126e57600080fd5b5051610b108d866127a3565b9550506112ee565b806001600160a01b0316876001600160a01b031614156112ee5760006112a8848a612940565b90506112ea84610b16896001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561124457600080fd5b9550505b505050509392505050565b6000806008848154811061130957fe5b600091825260208083208784526009825260408085206001600160a01b0389811687529084528186206006959095029092016005810154815483516370a0823160e01b815230600482015293519298509596909590949316926370a082319260248082019391829003018186803b15801561138357600080fd5b505afa158015611397573d6000803e3d6000fd5b505050506040513d60208110156113ad57600080fd5b50516004850154909150431180156113c457508015155b156114275760006113d9856004015443610f1b565b90506000611400600a54610b168860030154610b10600654876121f290919063ffffffff16565b905061142261141b84610b1684670de0b6b3a76400006121f2565b8590612800565b935050505b6114588360010154611452670de0b6b3a7640000610b168688600001546121f290919063ffffffff16565b906127a3565b979650505050505050565b61146b610cd3565b156114b0576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6114b8610cdc565b610b2d8282600161242b565b60025481565b60055461010090046001600160a01b031681565b6114e6611908565b6001600160a01b03166114f7610f0c565b6001600160a01b031614611540576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b801561154e5761154e610cdc565b60007f0000000000000000000000000000000000000000000000000000000000badad9431161159d577f0000000000000000000000000000000000000000000000000000000000badad961159f565b435b6040805160c0810182526001600160a01b039788168152958716602087019081529487169086019081526000606087018181526080880193845260a08801828152600880546001810182559352975160069092027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381018054938b166001600160a01b031994851617905596517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee488018054918b1691841691909117905591517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee5870180549190991691161790965594517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee6840155505091517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee7830155517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee890910155565b61170c611908565b6001600160a01b031661171d610f0c565b6001600160a01b031614611766576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b037f0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc7441169163a9059cbb9160448083019260209291908290030181600087803b1580156117d557600080fd5b505af11580156117e9573d6000803e3d6000fd5b505050506040513d602081101561073b57600080fd5b611807611908565b6001600160a01b0316611818610f0c565b6001600160a01b031614611861576040805162461bcd60e51b81526020600482018190526024820152600080516020613c5a833981519152604482015290519081900360640190fd5b6001600160a01b0381166118a65760405162461bcd60e51b8152600401808060200182810382526026815260200180613bb36026913960400191505060405180910390fd5b6001546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b60035481565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261073b908490612988565b611966610cd3565b6119ae576040805162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015290519081900360640190fd5b6005805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6119e1611908565b604080516001600160a01b039092168252519081900360200190a1565b6000611a08610cdc565b600060088581548110611a1757fe5b600091825260208083208884526009825260408085203386529092529220805460069092029092019250851115611a8a576040805162461bcd60e51b81526020600482015260126024820152711dda5d1a191c985dce881b9bdd0819dbdbd960721b604482015290519081900360640190fd5b6000611abb8260010154611452670de0b6b3a7640000610b16876005015487600001546121f290919063ffffffff16565b90508015611acd57611acd3382612a39565b8515611b50576002820154611ae390600a612800565b431015611b215760405162461bcd60e51b815260040180806020018281038252602b815260200180613cda602b913960400191505060405180910390fd5b8154611b2d90876127a3565b825560018515151415611b50578254611b50906001600160a01b0316338861190c565b6001830154611b7590611b6c906001600160a01b031688612177565b600754906127a3565b600755611b80610a0f565b60058301548254611b9e91670de0b6b3a764000091610b16916121f2565b6001830155604080518781529051889133917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b5689181900360200190a38593505050505b9392505050565b60008060026000541415611c43576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600055836001600160a01b038116611ca4576040805162461bcd60e51b815260206004820152601e60248201527f4572726f723a20496e76616c696420556e69706f6f6c20416464726573730000604482015290519081900360640190fd5b6000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611cdf57600080fd5b505afa158015611cf3573d6000803e3d6000fd5b505050506040513d6020811015611d0957600080fd5b50516040805163d21220a760e01b815290519192506000916001600160a01b0385169163d21220a7916004808301926020929190829003018186803b158015611d5157600080fd5b505afa158015611d65573d6000803e3d6000fd5b505050506040513d6020811015611d7b57600080fd5b50519050611da86001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d6000612c2f565b611dd06001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d88612c2f565b6000806001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21480611e1a57506001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2145b15611f2a5760006001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214611e4b5784611e4d565b835b60408051629d473b60e21b81526001600160a01b0383166004820152602481018c90526001604482018190526064820152306084820152600f60fc1b60a48201528151929350737a250d5630b4cf539739df2c5dacb4c659f2488d926302751cec9260c4808401939192918290030181600087803b158015611ece57600080fd5b505af1158015611ee2573d6000803e3d6000fd5b505050506040513d6040811015611ef857600080fd5b5080516020909101519093509150611f1a6001600160a01b038216338561190c565b611f243383612d42565b5061200f565b60408051635d5155ef60e11b81526001600160a01b03868116600483015285166024820152604481018a905260016064820181905260848201523060a4820152600f60fc1b60c48201528151737a250d5630b4cf539739df2c5dacb4c659f2488d9263baa2abde9260e480820193918290030181600087803b158015611faf57600080fd5b505af1158015611fc3573d6000803e3d6000fd5b505050506040513d6040811015611fd957600080fd5b5080516020909101519092509050611ffb6001600160a01b038516338461190c565b61200f6001600160a01b038416338361190c565b604080513381526001600160a01b03808c16602083015280871682840152606082018590528516608082015260a0810183905290517f8251496d51a0099361551b4a9901c85074f36c95f425405ad965a04c650a340b9181900360c00190a16001600055909890975095505050505050565b612089610cd3565b156120ce576040805162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015290519081900360640190fd5b6005805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119e1611908565b801561211257612112610cdc565b61214982610fe76008868154811061212657fe5b906000526020600020906006020160030154600a546127a390919063ffffffff16565b600a81905550816008848154811061215d57fe5b906000526020600020906006020160030181905550505050565b6000819050826001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156121b557600080fd5b505afa1580156121c9573d6000803e3d6000fd5b505050506040513d60208110156121df57600080fd5b505160061415610fed57611be182620f42405b60008261220157506000610fed565b8282028284828161220e57fe5b0414611be15760405162461bcd60e51b8152600401808060200182810382526021815260200180613c396021913960400191505060405180910390fd5b60008082116122a1576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b8183816122aa57fe5b049392505050565b6000806002600054141561230d576040805162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015290519081900360640190fd5b6002600090815561231e8886612e27565b905060008060008061232f8b61285a565b91509150816001600160a01b03168c6001600160a01b031614156123645761235a8c828d8d89612f31565b9094509250612377565b6123718c838d8d89612f31565b90945092505b878410156123c1576040805162461bcd60e51b81526020600482015260126024820152714552523a204869676820536c69707061676560701b604482015290519081900360640190fd5b896001600160a01b031663a2e620456040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b5050600160005550939c929b50919950505050505050505050565b60006008848154811061243a57fe5b600091825260208083208784526009825260408085203386529092529220805460069092029092019250156124ae57600061249a8260010154611452670de0b6b3a7640000610b16876005015487600001546121f290919063ffffffff16565b905080156124ac576124ac3382612a39565b505b83156124e557600183151514156124d65781546124d6906001600160a01b03163330876131f7565b80546124e29085612800565b81555b600182015461250a90612501906001600160a01b031686612177565b60075490612800565b600755612515610a0f565b6005820154815461253391670de0b6b3a764000091610b16916121f2565b6001820155436002820155604080518581529051869133917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159181900360200190a35050505050565b60006008828154811061258b57fe5b90600052602060002090600602019050806004015443116125ac57506127a0565b8054604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156125f657600080fd5b505afa15801561260a573d6000803e3d6000fd5b505050506040513d602081101561262057600080fd5b50519050806126365750436004909101556127a0565b600754156126755761267583610b1c600754610b16670de0b6b3a7640000610b108860010160009054906101000a90046001600160a01b031688612177565b6000612685836004015443610f1b565b905060006126ac600a54610b168660030154610b10600654876121f290919063ffffffff16565b6005549091506001600160a01b037f0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc744181169163a9059cbb91610100909104166126f684600a61224b565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561273c57600080fd5b505af1158015612750573d6000803e3d6000fd5b505050506040513d602081101561276657600080fd5b5061278d905061278284610b1684670de0b6b3a76400006121f2565b600586015490612800565b6005850155505043600490920191909155505b50565b6000828211156127fa576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015611be1576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000806000839050806001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561289b57600080fd5b505afa1580156128af573d6000803e3d6000fd5b505050506040513d60208110156128c557600080fd5b50516040805163d21220a760e01b815290519194506001600160a01b0383169163d21220a791600480820192602092909190829003018186803b15801561290b57600080fd5b505afa15801561291f573d6000803e3d6000fd5b505050506040513d602081101561293557600080fd5b505192949293505050565b60006107ca612981612954856107cd6121f2565b61145261297c61296788623cda296121f2565b61297488623cda206121f2565b8991016121f2565b613257565b816122aa57fe5b60606129dd826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166132a99092919063ffffffff16565b80519091501561073b578080602001905160208110156129fc57600080fd5b505161073b5760405162461bcd60e51b815260040180806020018281038252602a815260200180613c7a602a913960400191505060405180910390fd5b60007f0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc74416001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612aa857600080fd5b505afa158015612abc573d6000803e3d6000fd5b505050506040513d6020811015612ad257600080fd5b5051905080821115612b87577f0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc74416001600160a01b031663a9059cbb84836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612b5557600080fd5b505af1158015612b69573d6000803e3d6000fd5b505050506040513d6020811015612b7f57600080fd5b5061073b9050565b7f0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc74416001600160a01b031663a9059cbb84846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015612bfe57600080fd5b505af1158015612c12573d6000803e3d6000fd5b505050506040513d6020811015612c2857600080fd5b5050505050565b801580612cb5575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015612c8757600080fd5b505afa158015612c9b573d6000803e3d6000fd5b505050506040513d6020811015612cb157600080fd5b5051155b612cf05760405162461bcd60e51b8152600401808060200182810382526036815260200180613ca46036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261073b908490612988565b80471015612d97576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b6040516000906001600160a01b0384169083908381818185875af1925050503d8060008114612de2576040519150601f19603f3d011682016040523d82523d6000602084013e612de7565b606091505b505090508061073b5760405162461bcd60e51b815260040180806020018281038252603a815260200180613bd9603a913960400191505060405180910390fd5b60006001600160a01b038316612e815760003411612e7a576040805162461bcd60e51b815260206004820152600b60248201526a139bc8195d1a081cd95b9d60aa1b604482015290519081900360640190fd5b5034610fed565b60008211612ecd576040805162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081d1bdad95b88185b5bdd5b9d60621b604482015290519081900360640190fd5b3415612f16576040805162461bcd60e51b815260206004820152601360248201527222ba341039b2b73a103bb4ba34103a37b5b2b760691b604482015290519081900360640190fd5b612f2b6001600160a01b0384163330856131f7565b50919050565b600080612f3c613b7c565b6002840480825260408051633ddac95360e01b81526001600160a01b038b811660048301526024820193909352905191871691633ddac95391604480820192602092909190829003018186803b158015612f9557600080fd5b505afa158015612fa9573d6000803e3d6000fd5b505050506040513d6020811015612fbf57600080fd5b505160208201526004548151600091612feb91670de0b6b3a764000091610b1691610b10908a906127a3565b9050876001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561303a57600080fd5b505afa15801561304e573d6000803e3d6000fd5b505050506040513d602081101561306457600080fd5b50516080830181905260035410801561309057506003546080830151613089916127a3565b8260200151105b1561311f5781516040830152602082015160608301526130b18989836132c0565b81516130c49082906114529088906127a3565b60a083018190526002546130d791612800565b600255606082015160408051338152602081019290925280517ff5d2aae17378660eb3f69d6565b2348a72c176693efd056d66772fefffe318709281900390910190a1613135565b61312a8988876132cb565b606084015260408301525b60008060006131568c8c8760400151886060015160008a60a00151116133f9565b9250925092507fe52a8d6444a86a0f9c4d5e4022c26ec5f9e2c0a873c0733b601b0ddc04a942d9338b8e858f8660405180876001600160a01b03168152602001866001600160a01b03168152602001856001600160a01b03168152602001848152602001836001600160a01b03168152602001828152602001965050505050505060405180910390a1505060a0909201519199919850909650505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052613251908590612988565b50505050565b6000600382111561329a575080600160028204015b818110156132945780915060028182858161328357fe5b04018161328c57fe5b04905061326c565b506132a4565b81156132a4575060015b919050565b60606132b884846000856135eb565b949350505050565b61325183838361373c565b6000806000806132da8661285a565b91509150600080876001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561331a57600080fd5b505afa15801561332e573d6000803e3d6000fd5b505050506040513d606081101561334457600080fd5b5080516020909101516001600160701b0391821693501690506001600160a01b0389811690851614156133b157600061337d8389612940565b9050806133925761338f88600261224b565b90505b61339d8a858361373c565b95506133a988826127a3565b9650506133ed565b60006133bd8289612940565b9050806133d2576133cf88600261224b565b90505b6133dd8a868361373c565b95506133e988826127a3565b9650505b50505050935093915050565b600080806134256001600160a01b038916737a250d5630b4cf539739df2c5dacb4c659f2488d83612c2f565b61344e6001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d6000612c2f565b6134766001600160a01b038916737a250d5630b4cf539739df2c5dacb4c659f2488d88612c2f565b61349e6001600160a01b038816737a250d5630b4cf539739df2c5dacb4c659f2488d87612c2f565b6040805162e8e33760e81b81526001600160a01b038a8116600483015289166024820152604481018890526064810187905260016084820181905260a48201523060c4820152600f60fc1b60e4820152905160009182918291737a250d5630b4cf539739df2c5dacb4c659f2488d9163e8e33700916101048082019260609290919082900301818787803b15801561353557600080fd5b505af1158015613549573d6000803e3d6000fd5b505050506040513d606081101561355f57600080fd5b5080516020820151604090920151909450909250905060006135818a856127a3565b11156135a6576135a6336135958b866127a3565b6001600160a01b038e16919061190c565b866135dc5760006135b789846127a3565b11156135dc576135dc336135cb8a856127a3565b6001600160a01b038d16919061190c565b9a919950975095505050505050565b60608247101561362c5760405162461bcd60e51b8152600401808060200182810382526026815260200180613c136026913960400191505060405180910390fd5b61363585613a81565b613686576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106136c55780518252601f1990920191602091820191016136a6565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114613727576040519150601f19603f3d011682016040523d82523d6000602084013e61372c565b606091505b5091509150611458828286613a87565b6000826001600160a01b0316846001600160a01b0316141561375f575080611be1565b6137886001600160a01b038516737a250d5630b4cf539739df2c5dacb4c659f2488d6000612c2f565b6137b06001600160a01b038516737a250d5630b4cf539739df2c5dacb4c659f2488d84612c2f565b604080516002808252606080830184529260208301908036833701905050905084816000815181106137de57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050838160018151811061380c57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050737a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b03166338ed17398460018430600f60fc1b6040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156138c95781810151838201526020016138b1565b505050509050019650505050505050600060405180830381600087803b1580156138f257600080fd5b505af1158015613906573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561392f57600080fd5b810190808051604051939291908464010000000082111561394f57600080fd5b90830190602082018581111561396457600080fd5b825186602082028301116401000000008211171561398157600080fd5b82525081516020918201928201910280838360005b838110156139ae578181015183820152602001613996565b505050509050016040525050506001825103815181106139ca57fe5b6020026020010151915060008211613a29576040805162461bcd60e51b815260206004820152601760248201527f4572726f72205377617070696e6720546f6b656e732032000000000000000000604482015290519081900360640190fd5b60408051338152602081018590526001600160a01b03808816828401528616606082015290517fb242fac543571b33f0bb49bcc84178771cbd74e5c7785b45981424829ba3c0759181900360800190a1509392505050565b3b151590565b60608315613a96575081611be1565b825115613aa65782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613af0578181015183820152602001613ad8565b50505050905090810190601f168015613b1d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6040518060c0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600081525090565b6040518060c00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e636557697468647261773a2043616e206f6e6c7920776974686472617720616674657220313020626c6f636b73a26469706673582212201f4685f07c3621dda1fc522fd8f2f10a1545c155cc80af7cfb1a228b8623415564736f6c63430007050033

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

0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc7441000000000000000000000000fc675877a7ab97a2ff02215b2b15ea7ba802054f000000000000000000000000000000000000000000000001d7d843dc3b4800000000000000000000000000000000000000000000000000000000000000badad90000000000000000000000000000000000000000000000000000000000badad90000000000000000000000000000000000000000001920280ca990b1fa600000000000000000000000000000000000000000000000000000002386f26fc10000

-----Decoded View---------------
Arg [0] : _XFIT (address): 0x4aa41bC1649C9C3177eD16CaaA11482295fC7441
Arg [1] : _devaddr (address): 0xfc675877A7AB97A2fF02215B2B15EA7ba802054f
Arg [2] : _XFITPerBlock (uint256): 34000000000000000000
Arg [3] : _startBlock (uint256): 12245721
Arg [4] : _bonusEndBlock (uint256): 12245721
Arg [5] : _xFitThreeshold (uint256): 30375000000000000000000000
Arg [6] : _fundsSplitFactor (uint256): 10000000000000000

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000004aa41bc1649c9c3177ed16caaa11482295fc7441
Arg [1] : 000000000000000000000000fc675877a7ab97a2ff02215b2b15ea7ba802054f
Arg [2] : 000000000000000000000000000000000000000000000001d7d843dc3b480000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000badad9
Arg [4] : 0000000000000000000000000000000000000000000000000000000000badad9
Arg [5] : 0000000000000000000000000000000000000000001920280ca990b1fa600000
Arg [6] : 000000000000000000000000000000000000000000000000002386f26fc10000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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