Contract 0x66e9b34680f9a7c80034e0ea553e6872259f4859

 
Txn Hash Method
Block
From
To
Value
0x8b3811c4d9f6720743dd7f44de08ab5b99aec6ac845ecf1b8cd97d73bd257bd4Create Vault Tok...409834022022-11-22 16:22:23309 days 23 hrs ago0x5b0390bccca1f040d8993eb6e4ce8ded93721765 IN  0x66e9b34680f9a7c80034e0ea553e6872259f48590 ETH0.0000645678420.001
0x4c269fac1e41f68e3aeddf19484ae9361fdd1faf6d63184a1610cb527ec0d189Create Vault Tok...409832942022-11-22 16:21:53309 days 23 hrs ago0x5b0390bccca1f040d8993eb6e4ce8ded93721765 IN  0x66e9b34680f9a7c80034e0ea553e6872259f48590 ETH0.0000645678420.001
0xaa09c45d84e703ecb7ad0a9db06e6b227aec448fc16047d6b79b4aaeecb98d96Create Vault Tok...354726142022-11-07 16:27:11324 days 23 hrs ago0x5b0390bccca1f040d8993eb6e4ce8ded93721765 IN  0x66e9b34680f9a7c80034e0ea553e6872259f48590 ETH0.0000985094180.001
0x0a03d0ee5efce825b1efaa2c5beb49b17d341dfc0a7783d39c4d81c463447ff30x60806040354714982022-11-07 16:22:10324 days 23 hrs ago0x5b0390bccca1f040d8993eb6e4ce8ded93721765 IN  Create: VeloStableVaultTokenFactory0 ETH0.0073737507250.001
[ Download CSV Export 
Latest 3 internal transactions
Parent Txn Hash Block From To Value
0x8b3811c4d9f6720743dd7f44de08ab5b99aec6ac845ecf1b8cd97d73bd257bd4409834022022-11-22 16:22:23309 days 23 hrs ago 0x66e9b34680f9a7c80034e0ea553e6872259f4859  Contract Creation0 ETH
0x4c269fac1e41f68e3aeddf19484ae9361fdd1faf6d63184a1610cb527ec0d189409832942022-11-22 16:21:53309 days 23 hrs ago 0x66e9b34680f9a7c80034e0ea553e6872259f4859  Contract Creation0 ETH
0xaa09c45d84e703ecb7ad0a9db06e6b227aec448fc16047d6b79b4aaeecb98d96354726142022-11-07 16:27:11324 days 23 hrs ago 0x66e9b34680f9a7c80034e0ea553e6872259f4859  Contract Creation0 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
VeloStableVaultTokenFactory

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 20 : VeloStableVaultTokenFactory.sol
pragma solidity =0.5.16;

import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./interfaces/IBaseV1Pair.sol";
import "./VeloStableVaultToken.sol";
import "./interfaces/IVeloStableVaultTokenFactory.sol";

contract VeloStableVaultTokenFactory is Ownable, IVeloStableVaultTokenFactory {
    address public optiSwap;
    address public router;
    address public voter;
    address public pairFactory;
    address public rewardsToken;
    address public coreStableToken;
    address public reinvestFeeTo;

    mapping(address => address) public getVaultToken;
    address[] public allVaultTokens;

    constructor(
        address _optiSwap,
        address _router,
        address _voter,
        address _pairFactory,
        address _rewardsToken,
        address _coreStableToken,
        address _reinvestFeeTo
    ) public {
        optiSwap = _optiSwap;
        router = _router;
        voter = _voter;
        pairFactory = _pairFactory;
        rewardsToken = _rewardsToken;
        coreStableToken = _coreStableToken;
        reinvestFeeTo = _reinvestFeeTo;
    }

    function allVaultTokensLength() external view returns (uint256) {
        return allVaultTokens.length;
    }

    function createVaultToken(address _underlying)
        external
        returns (address vaultToken)
    {
        require(
            getVaultToken[_underlying] == address(0),
            "VaultTokenFactory: POOL_EXISTS"
        );
        require(IBaseV1Pair(_underlying).stable(), "VaultTokenFactory: IS_VAMM");
        bytes memory bytecode = type(VeloStableVaultToken).creationCode;
        assembly {
            vaultToken := create2(0, add(bytecode, 32), mload(bytecode), _underlying)
        }
        VeloStableVaultToken(vaultToken)._initialize(
            _underlying,
            optiSwap,
            router,
            voter,
            pairFactory,
            rewardsToken,
            coreStableToken,
            reinvestFeeTo
        );
        getVaultToken[_underlying] = vaultToken;
        allVaultTokens.push(vaultToken);
        emit VaultTokenCreated(_underlying, vaultToken, allVaultTokens.length);
    }
}

File 2 of 20 : Ownable.sol
pragma solidity ^0.5.0;

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

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

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

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

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

    /**
     * @dev Returns true if the caller is the current owner.
     */
    function isOwner() public view returns (bool) {
        return _msgSender() == _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 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 onlyOwner {
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     */
    function _transferOwnership(address newOwner) internal {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

File 3 of 20 : IBaseV1Pair.sol
pragma solidity >=0.5.0;

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

    function stable() external view returns (bool);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
	
    function token0() external view returns (address);
    function token1() external view returns (address);
    function tokens() external view returns (address, address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function observationLength() external view returns (uint);
    function observations(uint) external view returns (
        uint timestamp,
        uint reserve0Cumulative,
        uint reserve1Cumulative
    );
    function currentCumulativePrices() external view returns (
        uint reserve0Cumulative,
        uint reserve1Cumulative,
        uint timestamp
    );

    function metadata() external view returns (uint, uint, uint, uint, bool, address, address);
}

File 4 of 20 : VeloStableVaultToken.sol
pragma solidity =0.5.16;

import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./PoolToken.sol";
import "./interfaces/IOptiSwap.sol";
import "./interfaces/IVeloVoter.sol";
import "./interfaces/IVeloPairFactory.sol";
import "./interfaces/IVeloGauge.sol";
import "./interfaces/IVeloRouter.sol";
import "./interfaces/IBaseV1Pair.sol";
import "./interfaces/IVeloStableVaultToken.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IERC20.sol";
import "./libraries/SafeToken.sol";
import "./libraries/Math.sol";

interface OptiSwapPair {
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
}

contract VeloStableVaultToken is IVeloStableVaultToken, PoolToken {
    using SafeToken for address;

    bool public constant isVaultToken = true;
    bool public constant stable = true;

    address public optiSwap;
    address public router;
    address public voter;
    address public gauge;
    address public pairFactory;
    address public rewardsToken;
    address public WETH;
    address public coreStableToken;
    address public reinvestFeeTo;
    address public token0;
    address public token1;
    uint256 public decimals0;
    uint256 public decimals1;

    uint256 public constant MIN_REINVEST_BOUNTY = 0;
    uint256 public constant MAX_REINVEST_BOUNTY = 0.05e18;
    uint256 public REINVEST_BOUNTY = 0.02e18;
    uint256 public constant MIN_REINVEST_FEE = 0;
    uint256 public constant MAX_REINVEST_FEE = 0.05e18;
    uint256 public REINVEST_FEE = 0.02e18;

    address[] reinvestorList;
    mapping(address => bool) reinvestorEnabled;

    event Reinvest(address indexed caller, uint256 reward, uint256 bounty, uint256 fee);
    event UpdateReinvestBounty(uint256 _newReinvestBounty);
    event UpdateReinvestFee(uint256 _newReinvestFee);
    event UpdateReinvestFeeTo(address _newReinvestFeeTo);
    event UpdateCoreStableToken(address _newCoreStableToken);

    function _initialize(
        address _underlying,
        address _optiSwap,
        address _router,
        address _voter,
        address _pairFactory,
        address _rewardsToken,
        address _coreStableToken,
        address _reinvestFeeTo
    ) external {
        require(factory == address(0), "VaultToken: FACTORY_ALREADY_SET"); // sufficient check
        factory = msg.sender;
        _setName("Tarot Vault Token", "vTAROT");
        underlying = _underlying;
        optiSwap = _optiSwap;
        voter = _voter;
        gauge = IVeloVoter(voter).gauges(underlying);
        require(gauge != address(0), "VaultToken: NO_GAUGE");
        router = _router;
        pairFactory = _pairFactory;
        WETH = IVeloRouter(_router).weth();
        (decimals0, decimals1, , , ,token0, token1) = IBaseV1Pair(_underlying).metadata();
        rewardsToken = _rewardsToken;
        coreStableToken = _coreStableToken;
        reinvestFeeTo = _reinvestFeeTo;
        rewardsToken.safeApprove(address(router), uint256(-1));
        WETH.safeApprove(address(router), uint256(-1));
        underlying.safeApprove(address(gauge), uint256(-1));
    }

    function reinvestorListLength() external view returns (uint256) {
        return reinvestorList.length;
    }

    function reinvestorListItem(uint256 index) external view returns (address) {
        return reinvestorList[index];
    }

    function isReinvestorEnabled(address reinvestor) external view returns (bool) {
        return reinvestorEnabled[reinvestor];
    }

    function _addReinvestor(address reinvestor) private {
        require(!reinvestorEnabled[reinvestor], "VaultToken: REINVESTOR_ENABLED");

        reinvestorEnabled[reinvestor] = true;
        reinvestorList.push(reinvestor);
    }

    function addReinvestor(address reinvestor) external onlyFactoryOwner {
        _addReinvestor(reinvestor);
    }

    function _indexOfReinvestor(address reinvestor) private view returns (uint256 index) {
        uint256 count = reinvestorList.length;
        for (uint256 i = 0; i < count; i++) {
            if (reinvestorList[i] == reinvestor) {
                return i;
            }
        }
        require(false, "VaultToken: REINVESTOR_NOT_FOUND");
    }

    function removeReinvestor(address reinvestor) external onlyFactoryOwner {
        require(reinvestorEnabled[reinvestor], "VaultToken: REINVESTOR_ENABLED");

        uint256 index = _indexOfReinvestor(reinvestor);
        address last = reinvestorList[reinvestorList.length - 1];
        reinvestorList[index] = last;
        reinvestorList.pop();
        delete reinvestorEnabled[reinvestor];
    }

    function updateReinvestBounty(uint256 _newReinvestBounty) external onlyFactoryOwner {
        require(_newReinvestBounty >= MIN_REINVEST_BOUNTY && _newReinvestBounty <= MAX_REINVEST_BOUNTY, "VaultToken: INVLD_REINVEST_BOUNTY");
        REINVEST_BOUNTY = _newReinvestBounty;

        emit UpdateReinvestBounty(_newReinvestBounty);
    }

    function updateReinvestFee(uint256 _newReinvestFee) external onlyFactoryOwner {
        require(_newReinvestFee >= MIN_REINVEST_FEE && _newReinvestFee <= MAX_REINVEST_FEE, "VaultToken: INVLD_REINVEST_FEE");
        REINVEST_FEE = _newReinvestFee;

        emit UpdateReinvestFee(_newReinvestFee);
    }

    function updateReinvestFeeTo(address _newReinvestFeeTo) external onlyFactoryOwner {
        reinvestFeeTo = _newReinvestFeeTo;

        emit UpdateReinvestFeeTo(_newReinvestFeeTo);
    }

    function updateCoreStableToken(address _newCoreStableToken) external onlyFactoryOwner {
        coreStableToken = _newCoreStableToken;

        emit UpdateCoreStableToken(_newCoreStableToken);
    }

    /*** PoolToken Overrides ***/

    function _update() internal {
        uint256 _totalBalance = IVeloGauge(gauge).balanceOf(address(this));
        totalBalance = _totalBalance;
        emit Sync(_totalBalance);
    }

    // this low-level function should be called from another contract
    function mint(address minter) external nonReentrant update returns (uint256 mintTokens) {
        uint256 mintAmount = underlying.myBalance();
        // handle pools with deposit fees by checking balance before and after deposit
        uint256 _totalBalanceBefore = IVeloGauge(gauge).balanceOf(address(this));
        IVeloGauge(gauge).deposit(mintAmount, 0);
        uint256 _totalBalanceAfter = IVeloGauge(gauge).balanceOf(address(this));
        mintTokens = _totalBalanceAfter.sub(_totalBalanceBefore).mul(1e18).div(exchangeRate());

        if (totalSupply == 0) {
            // permanently lock the first MINIMUM_LIQUIDITY tokens
            mintTokens = mintTokens.sub(MINIMUM_LIQUIDITY);
            _mint(address(0), MINIMUM_LIQUIDITY);
        }
        require(mintTokens > 0, "VaultToken: MINT_AMOUNT_ZERO");
        _mint(minter, mintTokens);
        emit Mint(msg.sender, minter, mintAmount, mintTokens);
    }

    // this low-level function should be called from another contract
    function redeem(address redeemer) external nonReentrant update returns (uint256 redeemAmount) {
        uint256 redeemTokens = balanceOf[address(this)];
        redeemAmount = redeemTokens.mul(exchangeRate()).div(1e18);

        require(redeemAmount > 0, "VaultToken: REDEEM_AMOUNT_ZERO");
        require(redeemAmount <= totalBalance, "VaultToken: INSUFFICIENT_CASH");
        _burn(address(this), redeemTokens);
        IVeloGauge(gauge).withdraw(redeemAmount);
        _safeTransfer(redeemer, redeemAmount);
        emit Redeem(msg.sender, redeemer, redeemAmount, redeemTokens);
    }

    /*** Reinvest ***/

    function _optimalDeposit(
        uint256 _amountA,
        uint256 _reserveA,
        uint256 _reserveB,
        uint256 _decimalsA,
        uint256 _decimalsB
    ) internal pure returns (uint256) {
        uint256 num;
        uint256 den;
        {
            uint256 a = _amountA.mul(1e18).div(_decimalsA);
            uint256 x = _reserveA.mul(1e18).div(_decimalsA);
            uint256 y = _reserveB.mul(1e18).div(_decimalsB);
            uint256 x2 = x.mul(x).div(1e18);
            uint256 y2 = y.mul(y).div(1e18);
            uint256 p = y.mul(x2.mul(3).add(y2).mul(1e18).div(y2.mul(3).add(x2))).div(x);
            num = a.mul(y);
            den = a.add(x).mul(p).div(1e18).add(y);
        }

        return num.div(den).mul(_decimalsA).div(1e18);
    }

    function approveRouter(address token, uint256 amount) internal {
        if (IERC20(token).allowance(address(this), router) >= amount) return;
        token.safeApprove(address(router), uint256(-1));
    }

    function swapExactTokensForTokens(
        address tokenIn,
        address tokenOut,
        uint256 amount
    ) internal {
        approveRouter(tokenIn, amount);
        IVeloRouter(router).swapExactTokensForTokensSimple(amount, 0, tokenIn, tokenOut, true, address(this), block.timestamp);
    }

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint256 amountA,
        uint256 amountB
    ) internal returns (uint256 liquidity) {
        approveRouter(tokenA, amountA);
        approveRouter(tokenB, amountB);
        (, , liquidity) = IVeloRouter(router).addLiquidity(tokenA, tokenB, true, amountA, amountB, 0, 0, address(this), block.timestamp);
    }

    function swapTokensForBestAmountOut(
        IOptiSwap _optiSwap,
        address tokenIn,
        address tokenOut,
        uint256 amountIn
    ) internal returns (uint256 amountOut) {
        if (tokenIn == tokenOut) {
            return amountIn;
        }
        address pair;
        (pair, amountOut) = _optiSwap.getBestAmountOut(amountIn, tokenIn, tokenOut);
        require(pair != address(0), "NO_PAIR");
        tokenIn.safeTransfer(pair, amountIn);
        if (tokenIn < tokenOut) {
            OptiSwapPair(pair).swap(0, amountOut, address(this), new bytes(0));
        } else {
            OptiSwapPair(pair).swap(amountOut, 0, address(this), new bytes(0));
        }
    }

    function optiSwapExactTokensForTokens(
        address tokenIn,
        address tokenOut,
        uint256 amountIn
    ) internal returns (uint256 amountOut) {
        if (tokenIn == tokenOut) {
            return amountIn;
        }
        IOptiSwap _optiSwap = IOptiSwap(optiSwap);
        address nextHop = _optiSwap.getBridgeToken(tokenIn);
        if (nextHop == tokenOut) {
            return swapTokensForBestAmountOut(_optiSwap, tokenIn, tokenOut, amountIn);
        }
        address waypoint = _optiSwap.getBridgeToken(tokenOut);
        if (tokenIn == waypoint) {
            return swapTokensForBestAmountOut(_optiSwap, tokenIn, tokenOut, amountIn);
        }
        uint256 hopAmountOut;
        if (nextHop != tokenIn) {
            hopAmountOut = swapTokensForBestAmountOut(_optiSwap, tokenIn, nextHop, amountIn);
        } else {
            hopAmountOut = amountIn;
        }
        if (nextHop == waypoint) {
            return swapTokensForBestAmountOut(_optiSwap, nextHop, tokenOut, hopAmountOut);
        } else if (waypoint == tokenOut) {
            return optiSwapExactTokensForTokens(nextHop, tokenOut, hopAmountOut);
        } else {
            uint256 waypointAmountOut = optiSwapExactTokensForTokens(nextHop, waypoint, hopAmountOut);
            return swapTokensForBestAmountOut(_optiSwap, waypoint, tokenOut, waypointAmountOut);
        }
    }

    function _getReward() internal returns (uint256 amount) {
        address[] memory tokens = new address[](1);
        tokens[0] = rewardsToken;
        IVeloGauge(gauge).getReward(address(this), tokens);

        return rewardsToken.myBalance();
    }

    function getReward() external nonReentrant returns (uint256) {
        require(msg.sender == tx.origin || reinvestorEnabled[msg.sender]);
        return _getReward();
    }

    function _expectedLiquidity(
        uint256 amountA,
        uint256 amountB,
        bool tokenAIsToken0
    ) internal view returns (uint256 expectedLiquidity) {
        (uint256 _reserve0, uint256 _reserve1, ) = IUniswapV2Pair(underlying).getReserves();
        (uint256 reserveA, uint256 reserveB) = tokenAIsToken0 ? (_reserve0, _reserve1) : (_reserve1, _reserve0);
        uint256 lpTotalSupply = IUniswapV2Pair(underlying).totalSupply();
        expectedLiquidity = Math.min(amountA.mul(lpTotalSupply).div(reserveA), amountB.mul(lpTotalSupply).div(reserveB));
    }

    function _optimalLiquidity(
        uint256 amountADesired,
        uint256 amountBDesired,
        bool tokenAIsToken0
    ) internal view returns (uint256 amountA, uint256 amountB) {
        (uint256 _reserve0, uint256 _reserve1, ) = IUniswapV2Pair(underlying)
            .getReserves();
        (uint256 reserveA, uint256 reserveB) = tokenAIsToken0 ? (_reserve0, _reserve1) : (_reserve1, _reserve0);
        uint256 amountBOptimal = _quote(amountADesired, reserveA, reserveB);
        if (amountBOptimal <= amountBDesired) {
            (amountA, amountB) = (amountADesired, amountBOptimal);
        } else {
            uint256 amountAOptimal = _quote(amountBDesired, reserveB, reserveA);
            assert(amountAOptimal <= amountADesired);
            (amountA, amountB) = (amountAOptimal, amountBDesired);
        }
    }

    function _quote(
        uint256 amountA,
        uint256 reserveA,
        uint256 reserveB
    ) internal pure returns (uint256 amountB) {
        require(amountA > 0, "VaultToken: INSUFFICIENT_AMOUNT");
        require(
            reserveA > 0 && reserveB > 0,
            "VaultToken: INSUFFICIENT_LIQUIDITY"
        );
        amountB = amountA.mul(reserveB) / reserveA;
    }

    function reinvest() external nonReentrant update {
        require(msg.sender == tx.origin || reinvestorEnabled[msg.sender]);
        // 1. Withdraw all the rewards.
        uint256 reward = _getReward();
        if (reward == 0) return;
        // 2. Send the reward bounty to the caller and reinvest fee to reinvestFeeTo.
        uint256 bounty = reward.mul(REINVEST_BOUNTY) / 1e18;
        if (bounty > 0) {
            rewardsToken.safeTransfer(msg.sender, bounty);
        }
        uint256 fee = reward.mul(REINVEST_FEE) / 1e18;
        if (fee > 0) {
            rewardsToken.safeTransfer(reinvestFeeTo, fee);
        }
        // 3. Convert all the remaining rewards to token0 or token1.
        address tokenA;
        address tokenB;
        if (token0 == rewardsToken || token1 == rewardsToken) {
            (tokenA, tokenB) = token0 == rewardsToken ? (token0, token1) : (token1, token0);
        } else {
            if (token1 == WETH || token1 == coreStableToken) {
                (tokenA, tokenB) = (token1, token0);
            } else {
                (tokenA, tokenB) = (token0, token1);
            }
            optiSwapExactTokensForTokens(rewardsToken, tokenA, reward.sub(bounty.add(fee)));
        }
        // 4. Convert tokenA to LP Token underlyings.
        uint256 totalAmountA = tokenA.myBalance();
        uint256 totalAmountB = tokenB.myBalance();
        uint256 liquidity;
        assert(totalAmountA > 0 || totalAmountB > 0);
        if (totalAmountA > 0 && totalAmountB > 0) {
            (uint256 liqAmountA, uint256 liqAmountB) = _optimalLiquidity(
                totalAmountA,
                totalAmountB,
                tokenA == token0
            );

            if (liqAmountA > 0 && liqAmountB > 0) {
                uint256 expectedLiquidity = _expectedLiquidity(liqAmountA, liqAmountB, tokenA == token0);
                if (expectedLiquidity > 0) {
                    liquidity = addLiquidity(tokenA, tokenB, liqAmountA, liqAmountB);
                    totalAmountA = totalAmountA.sub(liqAmountA);
                    totalAmountB = totalAmountB.sub(liqAmountB);
                }
            }
        }
        if (totalAmountA > 0 || totalAmountB > 0) {
            uint256 decimalsA;
            uint256 decimalsB;
            uint256 reserveA;
            uint256 reserveB;
            {
                (uint256 r0, uint256 r1, ) = IUniswapV2Pair(underlying).getReserves();
                (decimalsA, decimalsB, reserveA, reserveB) = tokenA == token0 ? (decimals0, decimals1, r0, r1) : (decimals1, decimals0, r1, r0);
            }
            if (totalAmountA.mul(reserveB) > totalAmountB.mul(reserveA)) {
                // Swap A for B
                uint256 swapAmount = _optimalDeposit(totalAmountA, reserveA, reserveB, decimalsA, decimalsB);
                if (swapAmount > 0) {
                    swapExactTokensForTokens(tokenA, tokenB, swapAmount);
                    totalAmountA = totalAmountA.sub(swapAmount);
                    totalAmountB = tokenB.myBalance();
                }
            } else {
                //Swap B for A
                uint256 swapAmount = _optimalDeposit(totalAmountB, reserveB, reserveA, decimalsB, decimalsA);
                if (swapAmount > 0) {
                    swapExactTokensForTokens(tokenB, tokenA, swapAmount);
                    totalAmountA = tokenA.myBalance();
                    totalAmountB = totalAmountB.sub(swapAmount);
                }
            }
            if (totalAmountA > 0 && totalAmountB > 0) {
                (uint256 liqAmountA, uint256 liqAmountB) = _optimalLiquidity(
                    totalAmountA,
                    totalAmountB,
                    tokenA == token0
                );

                if (liqAmountA > 0 && liqAmountB > 0) {
                    uint256 expectedLiquidity = _expectedLiquidity(liqAmountA, liqAmountB, tokenA == token0);
                    if (expectedLiquidity > 0) {
                        liquidity = liquidity.add(addLiquidity(tokenA, tokenB, liqAmountA, liqAmountB));
                    }
                }
            }
        }
        // 5. Stake the LP Tokens.
        IVeloGauge(gauge).deposit(liquidity, 0);
        emit Reinvest(msg.sender, reward, bounty, fee);
    }

    function adminClaimRewards(address[] calldata _tokens) external onlyFactoryOwner nonReentrant {
        IVeloGauge(gauge).getReward(address(this), _tokens);
    }

    function adminRescueTokens(address _to, address[] calldata _tokens) external onlyFactoryOwner nonReentrant {
        require(_to != address(0), "VaultToken: INVLD_TO");

        for (uint256 i = 0; i < _tokens.length; i++) {
            address token = _tokens[i];
            require(token != underlying, "VaultToken: IS_UNDERLYING");
            require(token != rewardsToken, "VaultToken: IS_REWARDS_TOKEN");
            require(token != token0, "VaultToken: IS_TOKEN_0");
            require(token != token1, "VaultToken: IS_TOKEN_1");

            uint256 tokenBalance = token.myBalance();
            if (tokenBalance > 0) {
                token.safeTransfer(_to, tokenBalance);
            }
        }
    }

    function getScale() external view returns (uint256 scale) {
        if (totalSupply == 0) return 1e18;
        uint256 _totalSupply = IUniswapV2Pair(underlying).totalSupply();
        return totalBalance.mul(1e18).div(_totalSupply);
    }

    /*** Mirrored From uniswapV2Pair ***/

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        )
    {
        (uint _reserve0, uint _reserve1, uint _blockTimestampLast) = IUniswapV2Pair(underlying).getReserves();
        reserve0 = safe112(_reserve0);
        reserve1 = safe112(_reserve1);
        blockTimestampLast = uint32(_blockTimestampLast % 2**32);
        // if no token has been minted yet mirror uniswap getReserves
        if (totalSupply == 0) return (reserve0, reserve1, blockTimestampLast);
        // else, return the underlying reserves of this contract
        uint256 _totalBalance = totalBalance;
        uint256 _totalSupply = IUniswapV2Pair(underlying).totalSupply();
        reserve0 = safe112(_totalBalance.mul(reserve0).div(_totalSupply));
        reserve1 = safe112(_totalBalance.mul(reserve1).div(_totalSupply));
        require(reserve0 > 100 && reserve1 > 100, "VaultToken: INSUFFICIENT_RESERVES");
    }

    /*** Mirrored from BaseV1Pair ***/

    function observationLength() external view returns (uint) {
        return IBaseV1Pair(underlying).observationLength();
    }

    function observations(uint index)
        external
        view
        returns (
            uint timestamp,
            uint reserve0Cumulative,
            uint reserve1Cumulative
        )
    {
        return IBaseV1Pair(underlying).observations(index);
    }

    function metadata() external view returns (uint256 dec0, uint256 dec1, uint256 r0, uint256 r1, bool st, address t0, address t1) {
        return IBaseV1Pair(underlying).metadata();
    }

    function currentCumulativePrices()
        external
        view
        returns (
            uint reserve0Cumulative,
            uint reserve1Cumulative,
            uint timestamp
        )
    {
        return IBaseV1Pair(underlying).currentCumulativePrices();
    }

    /*** Utilities ***/

    function safe112(uint256 n) internal pure returns (uint112) {
        require(n < 2**112, "VaultToken: SAFE112");
        return uint112(n);
    }

    function getBlockTimestamp() public view returns (uint32) {
        return uint32(block.timestamp % 2**32);
    }

    /*** Modifiers ***/

    modifier onlyFactoryOwner() {
        require(Ownable(factory).owner() == msg.sender, "NOT_AUTHORIZED");
        _;
    }
}

File 5 of 20 : IVeloStableVaultTokenFactory.sol
pragma solidity >=0.5.0;

interface IVeloStableVaultTokenFactory {
    event VaultTokenCreated(
        address indexed pool,
        address vaultToken,
        uint256 vaultTokenIndex
    );

    function optiSwap() external view returns (address);

    function router() external view returns (address);

    function voter() external view returns (address);

    function pairFactory() external view returns (address);

    function rewardsToken() external view returns (address);

    function coreStableToken() external view returns (address);

    function reinvestFeeTo() external view returns (address);

    function getVaultToken(address) external view returns (address);

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

    function allVaultTokensLength() external view returns (uint256);

    function createVaultToken(address _underlying)
        external
        returns (address vaultToken);
}

File 6 of 20 : Context.sol
pragma solidity ^0.5.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.
 */
contract Context {
    // Empty internal constructor, to prevent people from mistakenly deploying
    // an instance of this contract, which should be used via inheritance.
    constructor () internal { }
    // solhint-disable-previous-line no-empty-blocks

    function _msgSender() internal view returns (address payable) {
        return msg.sender;
    }

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

File 7 of 20 : PoolToken.sol
pragma solidity =0.5.16;

import "./TarotERC20.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IPoolToken.sol";
import "./libraries/SafeMath.sol";

contract PoolToken is IPoolToken, TarotERC20 {
    uint256 internal constant initialExchangeRate = 1e18;
    address public underlying;
    address public factory;
    uint256 public totalBalance;
    uint256 public constant MINIMUM_LIQUIDITY = 1000;

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    /*** Initialize ***/

    // called once by the factory
    function _setFactory() external {
        require(factory == address(0), "Tarot: FACTORY_ALREADY_SET");
        factory = msg.sender;
    }

    /*** PoolToken ***/

    function _update() internal {
        totalBalance = IERC20(underlying).balanceOf(address(this));
        emit Sync(totalBalance);
    }

    function exchangeRate() public view returns (uint256) {
        uint256 _totalSupply = totalSupply; // gas savings
        uint256 _totalBalance = totalBalance; // gas savings
        if (_totalSupply == 0 || _totalBalance == 0) return initialExchangeRate;
        return _totalBalance.mul(1e18).div(_totalSupply);
    }

    // this low-level function should be called from another contract
    function mint(address minter)
        external
        nonReentrant
        update
        returns (uint256 mintTokens)
    {
        uint256 balance = IERC20(underlying).balanceOf(address(this));
        uint256 mintAmount = balance.sub(totalBalance);
        mintTokens = mintAmount.mul(1e18).div(exchangeRate());

        if (totalSupply == 0) {
            // permanently lock the first MINIMUM_LIQUIDITY tokens
            mintTokens = mintTokens.sub(MINIMUM_LIQUIDITY);
            _mint(address(0), MINIMUM_LIQUIDITY);
        }
        require(mintTokens > 0, "Tarot: MINT_AMOUNT_ZERO");
        _mint(minter, mintTokens);
        emit Mint(msg.sender, minter, mintAmount, mintTokens);
    }

    // this low-level function should be called from another contract
    function redeem(address redeemer)
        external
        nonReentrant
        update
        returns (uint256 redeemAmount)
    {
        uint256 redeemTokens = balanceOf[address(this)];
        redeemAmount = redeemTokens.mul(exchangeRate()).div(1e18);

        require(redeemAmount > 0, "Tarot: REDEEM_AMOUNT_ZERO");
        require(redeemAmount <= totalBalance, "Tarot: INSUFFICIENT_CASH");
        _burn(address(this), redeemTokens);
        _safeTransfer(redeemer, redeemAmount);
        emit Redeem(msg.sender, redeemer, redeemAmount, redeemTokens);
    }

    // force real balance to match totalBalance
    function skim(address to) external nonReentrant {
        _safeTransfer(
            to,
            IERC20(underlying).balanceOf(address(this)).sub(totalBalance)
        );
    }

    // force totalBalance to match real balance
    function sync() external nonReentrant update {}

    /*** Utilities ***/

    // same safe transfer function used by UniSwapV2 (with fixed underlying)
    bytes4 private constant SELECTOR =
        bytes4(keccak256(bytes("transfer(address,uint256)")));

    function _safeTransfer(address to, uint256 amount) internal {
        (bool success, bytes memory data) = underlying.call(
            abi.encodeWithSelector(SELECTOR, to, amount)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "Tarot: TRANSFER_FAILED"
        );
    }

    // prevents a contract from calling itself, directly or indirectly.
    bool internal _notEntered = true;
    modifier nonReentrant() {
        require(_notEntered, "Tarot: REENTERED");
        _notEntered = false;
        _;
        _notEntered = true;
    }

    // update totalBalance with current balance
    modifier update() {
        _;
        _update();
    }
}

File 8 of 20 : IOptiSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0;

interface IOptiSwap {
    function weth() external view returns (address);

    function bridgeFromTokens(uint256 index) external view returns (address token);

    function bridgeFromTokensLength() external view returns (uint256);

    function getBridgeToken(address _token) external view returns (address bridgeToken);

    function addBridgeToken(address _token, address _bridgeToken) external;

    function getDexInfo(uint256 index) external view returns (address dex, address handler);

    function dexListLength() external view returns (uint256);

    function indexOfDex(address _dex) external view returns (uint256);

    function getDexEnabled(address _dex) external view returns (bool);

    function addDex(address _dex, address _handler) external;

    function removeDex(address _dex) external;

    function getBestAmountOut(
        uint256 _amountIn,
        address _tokenIn,
        address _tokenOut
    ) external view returns (address pair, uint256 amountOut);
}

File 9 of 20 : IVeloVoter.sol
pragma solidity >=0.5.0;

interface IVeloVoter {
    function _ve() external view returns (address);
    function governor() external view returns (address);
    function emergencyCouncil() external view returns (address);
    function attachTokenToGauge(uint _tokenId, address account) external;
    function detachTokenFromGauge(uint _tokenId, address account) external;
    function emitDeposit(uint _tokenId, address account, uint amount) external;
    function emitWithdraw(uint _tokenId, address account, uint amount) external;
    function isWhitelisted(address token) external view returns (bool);
    function notifyRewardAmount(uint amount) external;
    function distribute(address _gauge) external;
    function gauges(address token) external view returns (address);
}

File 10 of 20 : IVeloPairFactory.sol
pragma solidity >=0.5.0;

interface IVeloPairFactory {
    function allPairsLength() external view returns (uint);
    function isPair(address pair) external view returns (bool);
    function pairCodeHash() external pure returns (bytes32);
    function getPair(address tokenA, address token, bool stable) external view returns (address);
    function createPair(address tokenA, address tokenB, bool stable) external returns (address pair);
    function getFee(bool _stable) external view returns (uint);
}

File 11 of 20 : IVeloGauge.sol
pragma solidity >=0.5.0;

interface IVeloGauge {
    function notifyRewardAmount(address token, uint amount) external;
    function getReward(address account, address[] calldata tokens) external;
    function claimFees() external returns (uint claimed0, uint claimed1);
    function left(address token) external view returns (uint);
    function isForPair() external view returns (bool);
    function earned(address token, address account) external view returns (uint);
    function balanceOf(address account) external view returns (uint);
    function deposit(uint256 amount, uint256 tokenId) external;
    function withdraw(uint256 amount) external;
}

File 12 of 20 : IVeloRouter.sol
pragma solidity >=0.5.0;

interface IVeloRouter {
  function weth() external pure returns (address);

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

  function swapExactTokensForTokensSimple(
    uint256 amountIn,
    uint256 amountOutMin,
    address tokenFrom,
    address tokenTo,
    bool stable,
    address to,
    uint256 deadline
  ) external returns (uint[] memory amounts);
}

File 13 of 20 : IVeloStableVaultToken.sol
pragma solidity >=0.5.0;

interface IVeloStableVaultToken {
    /*** Tarot ERC20 ***/

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

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

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

    function allowance(address owner, address spender) external view returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

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

    /*** Pool Token ***/

    event Mint(address indexed sender, address indexed minter, uint256 mintAmount, uint256 mintTokens);
    event Redeem(address indexed sender, address indexed redeemer, uint256 redeemAmount, uint256 redeemTokens);
    event Sync(uint256 totalBalance);

    function underlying() external view returns (address);

    function factory() external view returns (address);

    function totalBalance() external view returns (uint256);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function exchangeRate() external view returns (uint256);

    function mint(address minter) external returns (uint256 mintTokens);

    function redeem(address redeemer) external returns (uint256 redeemAmount);

    function skim(address to) external;

    function sync() external;

    function _setFactory() external;

    /*** VaultToken ***/

    event Reinvest(address indexed caller, uint256 reward, uint256 bounty, uint256 fee);

    function isVaultToken() external pure returns (bool);

    function stable() external pure returns (bool);

    function optiSwap() external view returns (address);

    function router() external view returns (address);

    function voter() external view returns (address);

    function pairFactory() external view returns (address);

    function rewardsToken() external view returns (address);

    function WETH() external view returns (address);

    function coreStableToken() external view returns (address);

    function reinvestFeeTo() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function REINVEST_BOUNTY() external view returns (uint256);

    function REINVEST_FEE() external view returns (uint256);

    function reinvestorListLength() external view returns (uint256);

    function reinvestorListItem(uint256 index) external view returns (address);

    function isReinvestorEnabled(address reinvestor) external view returns (bool);

    function addReinvestor(address reinvestor) external;

    function removeReinvestor(address reinvestor) external;

    function updateReinvestBounty(uint256 _newReinvestBounty) external;

    function updateReinvestFee(uint256 _newReinvestFee) external;

    function updateReinvestFeeTo(address _newReinvestFeeTo) external;

    function updateCoreStableToken(address _newCoreStableToken) external;

    function getScale() external view returns (uint256 scale);

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    function observationLength() external view returns (uint);

    function observations(uint index)
        external
        view
        returns (
            uint timestamp,
            uint reserve0Cumulative,
            uint reserve1Cumulative
        );
    
    function metadata() external view returns (uint256, uint256, uint256, uint256, bool, address, address);

    function currentCumulativePrices()
        external
        view
        returns (
            uint reserve0Cumulative,
            uint reserve1Cumulative,
            uint timestamp
        );

    function _initialize(
        address _underlying,
        address _optiSwap,
        address _router,
        address _voter,
        address _pairFactory,
        address _rewardsToken,
        address _coreStableToken,
        address _reinvestFeeTo
    ) external;

    function reinvest() external;

    function getReward() external returns (uint256);

    function getBlockTimestamp() external view returns (uint32);

    function adminClaimRewards(address[] calldata _tokens) external;

    function adminRescueTokens(address _to, address[] calldata _tokens) external;
}

File 14 of 20 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

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

    function totalSupply() external view returns (uint256);

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

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );

    function price0CumulativeLast() external view returns (uint256);

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

File 15 of 20 : IERC20.sol
pragma solidity >=0.5.0;

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

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

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

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

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

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);
}

File 16 of 20 : SafeToken.sol
pragma solidity 0.5.16;

interface ERC20Interface {
    function balanceOf(address user) external view returns (uint256);
}

library SafeToken {
    function myBalance(address token) internal view returns (uint256) {
        return ERC20Interface(token).balanceOf(address(this));
    }

    function balanceOf(address token, address user)
        internal
        view
        returns (uint256)
    {
        return ERC20Interface(token).balanceOf(user);
    }

    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        // bytes4(keccak256(bytes('approve(address,uint256)')));
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(0x095ea7b3, to, value)
        );
        require(
            success && (data.length == 0 || abi.decode(data, (bool))),
            "!safeApprove"
        );
    }

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

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

    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call.value(value)(new bytes(0));
        require(success, "!safeTransferETH");
    }
}

File 17 of 20 : Math.sol
pragma solidity =0.5.16;

// a library for performing various math operations
// forked from: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/libraries/Math.sol

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

    // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
    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;
        }
    }
}

File 18 of 20 : TarotERC20.sol
pragma solidity =0.5.16;

import "./libraries/SafeMath.sol";

// This contract is basically UniswapV2ERC20 with small modifications
// src: https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol

contract TarotERC20 {
    using SafeMath for uint256;

    string public name;
    string public symbol;
    uint8 public decimals = 18;
    uint256 public totalSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    bytes32 public DOMAIN_SEPARATOR;
    mapping(address => uint256) public nonces;

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

    constructor() public {}

    function _setName(string memory _name, string memory _symbol) internal {
        name = _name;
        symbol = _symbol;
        uint256 chainId;
        assembly {
            chainId := chainid
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256(
                    "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
                ),
                keccak256(bytes(_name)),
                keccak256(bytes("1")),
                chainId,
                address(this)
            )
        );
    }

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

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

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

    function _transfer(
        address from,
        address to,
        uint256 value
    ) internal {
        balanceOf[from] = balanceOf[from].sub(
            value,
            "Tarot: TRANSFER_TOO_HIGH"
        );
        balanceOf[to] = balanceOf[to].add(value);
        emit Transfer(from, to, value);
    }

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

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

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

    function _checkSignature(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s,
        bytes32 typehash
    ) internal {
        require(deadline >= block.timestamp, "Tarot: EXPIRED");
        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOMAIN_SEPARATOR,
                keccak256(
                    abi.encode(
                        typehash,
                        owner,
                        spender,
                        value,
                        nonces[owner]++,
                        deadline
                    )
                )
            )
        );
        address recoveredAddress = ecrecover(digest, v, r, s);
        require(
            recoveredAddress != address(0) && recoveredAddress == owner,
            "Tarot: INVALID_SIGNATURE"
        );
    }

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

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external {
        _checkSignature(
            owner,
            spender,
            value,
            deadline,
            v,
            r,
            s,
            PERMIT_TYPEHASH
        );
        _approve(owner, spender, value);
    }
}

File 19 of 20 : IPoolToken.sol
pragma solidity >=0.5.0;

interface IPoolToken {
    /*** Tarot ERC20 ***/

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

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint256);

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

    function allowance(address owner, address spender)
        external
        view
        returns (uint256);

    function approve(address spender, uint256 value) external returns (bool);

    function transfer(address to, uint256 value) external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint256);

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

    /*** Pool Token ***/

    event Mint(
        address indexed sender,
        address indexed minter,
        uint256 mintAmount,
        uint256 mintTokens
    );
    event Redeem(
        address indexed sender,
        address indexed redeemer,
        uint256 redeemAmount,
        uint256 redeemTokens
    );
    event Sync(uint256 totalBalance);

    function underlying() external view returns (address);

    function factory() external view returns (address);

    function totalBalance() external view returns (uint256);

    function MINIMUM_LIQUIDITY() external pure returns (uint256);

    function exchangeRate() external view returns (uint256);

    function mint(address minter) external returns (uint256 mintTokens);

    function redeem(address redeemer) external returns (uint256 redeemAmount);

    function skim(address to) external;

    function sync() external;

    function _setFactory() external;
}

File 20 of 20 : SafeMath.sol
pragma solidity =0.5.16;

// From https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/math/Math.sol
// Subject to the MIT license.

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

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

        return c;
    }

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

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     * - Subtraction cannot underflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

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

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     * - Multiplication cannot overflow.
     */
    function mul(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, errorMessage);

        return c;
    }

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

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

        return c;
    }

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_optiSwap","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_pairFactory","type":"address"},{"internalType":"address","name":"_rewardsToken","type":"address"},{"internalType":"address","name":"_coreStableToken","type":"address"},{"internalType":"address","name":"_reinvestFeeTo","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"vaultToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"vaultTokenIndex","type":"uint256"}],"name":"VaultTokenCreated","type":"event"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allVaultTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allVaultTokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"coreStableToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_underlying","type":"address"}],"name":"createVaultToken","outputs":[{"internalType":"address","name":"vaultToken","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"getVaultToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"optiSwap","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pairFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"reinvestFeeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b506040516159bc3803806159bc833981810160405260e081101561003357600080fd5b508051602082015160408301516060840151608085015160a086015160c090960151949593949293919290919060006100736001600160e01b0361013e16565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b03199081166001600160a01b03998a1617909155600280548216978916979097179096556003805487169588169590951790945560048054861693871693909317909255600580548516918616919091179055600680548416918516919091179055600780549092169216919091179055610142565b3390565b61586b806101516000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638da5cb5b11610097578063d1af0c7d11610066578063d1af0c7d146101e7578063e14f870d146101ef578063f2fde38b146101f7578063f887ea401461021d576100f5565b80638da5cb5b146101805780638f32d59b146101885780639dc6108f146101a4578063a9a1e138146101ca576100f5565b806360c2affa116100d357806360c2affa14610140578063715018a6146101485780637daeecf0146101525780638a9a19c21461015a576100f5565b806329e15d0b146100fa57806346c96aac1461011457806347a35fc914610138575b600080fd5b610102610225565b60408051918252519081900360200190f35b61011c61022b565b604080516001600160a01b039092168252519081900360200190f35b61011c61023a565b61011c610249565b610150610258565b005b61011c6102fb565b61011c6004803603602081101561017057600080fd5b50356001600160a01b031661030a565b61011c6105c0565b6101906105cf565b604080519115158252519081900360200190f35b61011c600480360360208110156101ba57600080fd5b50356001600160a01b03166105f3565b61011c600480360360208110156101e057600080fd5b503561060e565b61011c610635565b61011c610644565b6101506004803603602081101561020d57600080fd5b50356001600160a01b0316610653565b61011c6106b8565b60095490565b6003546001600160a01b031681565b6006546001600160a01b031681565b6001546001600160a01b031681565b6102606105cf565b6102b1576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6007546001600160a01b031681565b6001600160a01b0381811660009081526008602052604081205490911615610379576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e466163746f72793a20504f4f4c5f4558495354530000604482015290519081900360640190fd5b816001600160a01b03166322be3de16040518163ffffffff1660e01b815260040160206040518083038186803b1580156103b257600080fd5b505afa1580156103c6573d6000803e3d6000fd5b505050506040513d60208110156103dc57600080fd5b505161042f576040805162461bcd60e51b815260206004820152601a60248201527f5661756c74546f6b656e466163746f72793a2049535f56414d4d000000000000604482015290519081900360640190fd5b6060604051806020016104419061076b565b6020820181038252601f19601f820116604052509050828151602083016000f560015460025460035460048054600554600654600754604080516312ffb80560e31b81526001600160a01b038e81169782019790975298861660248a0152968516604489015294841660648801529183166084870152821660a4860152811660c485015290811660e484015290519294508416916397fdc028916101048082019260009290919082900301818387803b1580156104fd57600080fd5b505af1158015610511573d6000803e3d6000fd5b5050506001600160a01b03808516600081815260086020908152604080832080549589166001600160a01b0319968716811790915560098054600181018255948190527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90940180549096168117909555915482519485529084015280519193507f68750cb824b88919ca0bc2d5e95520467a0a0007128b0b04772b5f06e8dda660928290030190a250919050565b6000546001600160a01b031690565b600080546001600160a01b03166105e46106c7565b6001600160a01b031614905090565b6008602052600090815260409020546001600160a01b031681565b6009818154811061061b57fe5b6000918252602090912001546001600160a01b0316905081565b6005546001600160a01b031681565b6004546001600160a01b031681565b61065b6105cf565b6106ac576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6106b5816106cb565b50565b6002546001600160a01b031681565b3390565b6001600160a01b0381166107105760405162461bcd60e51b81526004018080602001828103825260268152602001806158116026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b615098806107798339019056fe60806040526002805460ff19908116601217909155600b8054909116600117905566470de4df82000060188190556019556150598061003f6000396000f3fe608060405234801561001057600080fd5b50600436106103db5760003560e01c80637bdd6b441161020a578063c4990f0411610125578063e15fadfb116100b8578063ebeb31db11610087578063ebeb31db14610a56578063ef3469e514610a5e578063f887ea4014610acc578063fdb5a03e14610ad4578063fff6cae914610adc576103db565b8063e15fadfb14610a20578063e4a1337e14610a46578063e6df664914610a4e578063e6e87e7e1461084c576103db565b8063d21220a7116100f4578063d21220a714610991578063d505accf14610999578063dd62ed3e146109ea578063e14f870d14610a18576103db565b8063c4990f041461093d578063c8c4ff8c146106c6578063ca932df014610963578063d1af0c7d14610989576103db565b8063a6f19c841161019d578063b5cddab81161016c578063b5cddab8146108ff578063ba9a7a5614610907578063bc25cf771461090f578063c45a015514610935576103db565b8063a6f19c84146108bb578063a9059cbb146108c3578063ad5c4648146108ef578063ad7a672f146108f7576103db565b806395d89b41116101d957806395d89b411461084457806396fa4c111461084c57806397fdc02814610854578063a28af8a4146108b3576103db565b80637bdd6b44146107e85780637daeecf0146107f05780637ecebe00146107f857806395a2251f1461081e576103db565b80633d18b912116102fa57806360c2affa1161028d5780636ee272271161025c5780636ee27227146105395780636f307dc31461079957806370a08231146107a1578063796b89b9146107c7576103db565b806360c2affa1461073d57806367114b83146107455780636a6278421461076b5780636c2a3bc514610791576103db565b806346c96aac116102c957806346c96aac1461070857806346fb738b1461071057806347a35fc91461072d5780634a5d316c14610735576103db565b80633d18b912146106be57806340aa9b71146106c657806345aca17d146106ce57806346853382146106eb576103db565b8063252c09d7116103725780633644e515116103415780633644e5151461063a578063378ab9d314610642578063392f37e9146106685780633ba0b9a9146106b6576103db565b8063252c09d71461057757806329a105221461059457806330adf81f14610614578063313ce5671461061c576103db565b806318160ddd116103ae57806318160ddd146104f95780631df8c7171461051357806322be3de11461053957806323b872dd14610541576103db565b806306fdde03146103e05780630902f1ac1461045d578063095ea7b3146104955780630dfe1681146104d5575b600080fd5b6103e8610ae4565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561042257818101518382015260200161040a565b50505050905090810190601f16801561044f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610465610b72565b604080516001600160701b03948516815292909316602083015263ffffffff168183015290519081900360600190f35b6104c1600480360360408110156104ab57600080fd5b506001600160a01b038135169060200135610d80565b604080519115158252519081900360200190f35b6104dd610d97565b604080516001600160a01b039092168252519081900360200190f35b610501610da6565b60408051918252519081900360200190f35b61051b610dac565b60408051938452602084019290925282820152519081900360600190f35b6104c1610e42565b6104c16004803603606081101561055757600080fd5b506001600160a01b03813581169160208101359091169060400135610e47565b61051b6004803603602081101561058d57600080fd5b5035610f17565b610612600480360360408110156105aa57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156105d457600080fd5b8201836020820111156105e657600080fd5b803590602001918460208302840111600160201b8311171561060757600080fd5b509092509050610fae565b005b61050161130a565b61062461132e565b6040805160ff9092168252519081900360200190f35b610501611337565b6104c16004803603602081101561065857600080fd5b50356001600160a01b031661133d565b61067061135f565b604080519788526020880196909652868601949094526060860192909252151560808501526001600160a01b0390811660a08501521660c0830152519081900360e00190f35b610501611419565b610501611469565b610501611500565b610612600480360360208110156106e457600080fd5b503561150b565b6104dd6004803603602081101561070157600080fd5b503561165e565b6104dd611688565b6106126004803603602081101561072657600080fd5b5035611697565b6104dd6117d4565b6106126117e3565b6104dd611855565b6106126004803603602081101561075b57600080fd5b50356001600160a01b0316611869565b6105016004803603602081101561078157600080fd5b50356001600160a01b0316611979565b610501611c72565b6104dd611c78565b610501600480360360208110156107b757600080fd5b50356001600160a01b0316611c87565b6107cf611c99565b6040805163ffffffff9092168252519081900360200190f35b610501611ca3565b6104dd611ca9565b6105016004803603602081101561080e57600080fd5b50356001600160a01b0316611cb8565b6105016004803603602081101561083457600080fd5b50356001600160a01b0316611cca565b6103e8611ecd565b610501611f27565b610612600480360361010081101561086b57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a081013582169160c082013581169160e0013516611f2c565b6105016122f4565b6104dd6122fa565b6104c1600480360360408110156108d957600080fd5b506001600160a01b038135169060200135612309565b6104dd612316565b610501612325565b61050161232b565b6105016123e2565b6106126004803603602081101561092557600080fd5b50356001600160a01b03166123e8565b6104dd6124e2565b6106126004803603602081101561095357600080fd5b50356001600160a01b03166124f1565b6106126004803603602081101561097957600080fd5b50356001600160a01b0316612601565b6104dd6126c9565b6104dd6126d8565b610612600480360360e08110156109af57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356126e7565b61050160048036036040811015610a0057600080fd5b506001600160a01b038135811691602001351661272b565b6104dd612748565b61061260048036036020811015610a3657600080fd5b50356001600160a01b0316612757565b61050161294e565b610501612954565b61050161295a565b61061260048036036020811015610a7457600080fd5b810190602081018135600160201b811115610a8e57600080fd5b820183602082011115610aa057600080fd5b803590602001918460208302840111600160201b83111715610ac157600080fd5b5090925090506129d0565b6104dd612b8c565b610612612b9b565b610612613211565b6000805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b820191906000526020600020905b815481529060010190602001808311610b4d57829003601f168201915b505050505081565b600080600080600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610bc957600080fd5b505afa158015610bdd573d6000803e3d6000fd5b505050506040513d6060811015610bf357600080fd5b50805160208201516040909201516001600160701b0391821695509116925063ffffffff169050610c238361326d565b9550610c2e8261326d565b9450600160201b8106935060035460001415610c4d5750610d7b915050565b600a54600854604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b158015610c9557600080fd5b505afa158015610ca9573d6000803e3d6000fd5b505050506040513d6020811015610cbf57600080fd5b50519050610cf4610cef82610ce3856001600160701b038d1663ffffffff6132c116565b9063ffffffff61331a16565b61326d565b9750610d16610cef82610ce3856001600160701b038c1663ffffffff6132c116565b96506064886001600160701b0316118015610d3a57506064876001600160701b0316115b610d755760405162461bcd60e51b81526004018080602001828103825260218152602001806150046021913960400191505060405180910390fd5b50505050505b909192565b6000610d8d33848461335c565b5060015b92915050565b6014546001600160a01b031681565b60035481565b6000806000600860009054906101000a90046001600160a01b03166001600160a01b0316631df8c7176040518163ffffffff1660e01b815260040160606040518083038186803b158015610dff57600080fd5b505afa158015610e13573d6000803e3d6000fd5b505050506040513d6060811015610e2957600080fd5b5080516020820151604090920151909591945092509050565b600181565b6001600160a01b038316600090815260056020908152604080832033845290915281205460001914610f0157604080518082018252601b81527f5461726f743a205452414e534645525f4e4f545f414c4c4f57454400000000006020808301919091526001600160a01b0387166000908152600582528381203382529091529190912054610edc91849063ffffffff6133be16565b6001600160a01b03851660009081526005602090815260408083203384529091529020555b610f0c848484613455565b5060015b9392505050565b6008546040805163252c09d760e01b8152600481018490529051600092839283926001600160a01b039092169163252c09d791602480820192606092909190829003018186803b158015610f6a57600080fd5b505afa158015610f7e573d6000803e3d6000fd5b505050506040513d6060811015610f9457600080fd5b508051602082015160409092015190969195509350915050565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015610ff257600080fd5b505afa158015611006573d6000803e3d6000fd5b505050506040513d602081101561101c57600080fd5b50516001600160a01b03161461106a576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b600b5460ff166110b4576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556001600160a01b038316611110576040805162461bcd60e51b81526020600482015260146024820152735661756c74546f6b656e3a20494e564c445f544f60601b604482015290519081900360640190fd5b60005b818110156112f757600083838381811061112957fe5b6008546001600160a01b03602090920293909301358116935091909116821415905061119c576040805162461bcd60e51b815260206004820152601960248201527f5661756c74546f6b656e3a2049535f554e4445524c59494e4700000000000000604482015290519081900360640190fd5b6010546001600160a01b03828116911614156111ff576040805162461bcd60e51b815260206004820152601c60248201527f5661756c74546f6b656e3a2049535f524557415244535f544f4b454e00000000604482015290519081900360640190fd5b6014546001600160a01b038281169116141561125b576040805162461bcd60e51b815260206004820152601660248201527505661756c74546f6b656e3a2049535f544f4b454e5f360541b604482015290519081900360640190fd5b6015546001600160a01b03828116911614156112b7576040805162461bcd60e51b81526020600482015260166024820152755661756c74546f6b656e3a2049535f544f4b454e5f3160501b604482015290519081900360640190fd5b60006112cb826001600160a01b0316613547565b905080156112ed576112ed6001600160a01b038316878363ffffffff6135c316565b5050600101611113565b5050600b805460ff191660011790555050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b60065481565b6001600160a01b0381166000908152601b602052604090205460ff165b919050565b6000806000806000806000600860009054906101000a90046001600160a01b03166001600160a01b031663392f37e96040518163ffffffff1660e01b815260040160e06040518083038186803b1580156113b857600080fd5b505afa1580156113cc573d6000803e3d6000fd5b505050506040513d60e08110156113e257600080fd5b508051602082015160408301516060840151608085015160a086015160c090960151949d939c50919a509850965091945092509050565b600354600a546000919081158061142e575080155b1561144557670de0b6b3a764000092505050611466565b61146182610ce383670de0b6b3a764000063ffffffff6132c116565b925050505b90565b600b5460009060ff166114b6576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055333214806114dd5750336000908152601b602052604090205460ff165b6114e657600080fd5b6114ee61371d565b9050600b805460ff1916600117905590565b66b1a2bc2ec5000081565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b15801561154f57600080fd5b505afa158015611563573d6000803e3d6000fd5b505050506040513d602081101561157957600080fd5b50516001600160a01b0316146115c7576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b66b1a2bc2ec50000811115611623576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e3a20494e564c445f5245494e564553545f4645450000604482015290519081900360640190fd5b60198190556040805182815290517f06df23e01946274f699a86923d1f32785f705fa03f19b8f7203367561b6e0b3d9181900360200190a150565b6000601a828154811061166d57fe5b6000918252602090912001546001600160a01b031692915050565b600d546001600160a01b031681565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b1580156116db57600080fd5b505afa1580156116ef573d6000803e3d6000fd5b505050506040513d602081101561170557600080fd5b50516001600160a01b031614611753576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b66b1a2bc2ec500008111156117995760405162461bcd60e51b8152600401808060200182810382526021815260200180614fe36021913960400191505060405180910390fd5b60188190556040805182815290517ffa1e13889c5c5294758f01f045a83de15feca61a17e6281f4d11a5110085d9329181900360200190a150565b6012546001600160a01b031681565b6009546001600160a01b031615611841576040805162461bcd60e51b815260206004820152601a60248201527f5461726f743a20464143544f52595f414c52454144595f534554000000000000604482015290519081900360640190fd5b600980546001600160a01b03191633179055565b600b5461010090046001600160a01b031681565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b1580156118ad57600080fd5b505afa1580156118c1573d6000803e3d6000fd5b505050506040513d60208110156118d757600080fd5b50516001600160a01b031614611925576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b601280546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fcaf206acd4cc7f2badb8f7e04b169f74cb4db745b437eb91b7a9bc18117108329181900360200190a150565b600b5460009060ff166119c6576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556008546000906119e8906001600160a01b0316613547565b600e54604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b158015611a3957600080fd5b505afa158015611a4d573d6000803e3d6000fd5b505050506040513d6020811015611a6357600080fd5b5051600e5460408051631c57762b60e31b81526004810186905260006024820181905291519394506001600160a01b039092169263e2bbb15892604480820193929182900301818387803b158015611aba57600080fd5b505af1158015611ace573d6000803e3d6000fd5b5050600e54604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b158015611b1f57600080fd5b505afa158015611b33573d6000803e3d6000fd5b505050506040513d6020811015611b4957600080fd5b50519050611b80611b58611419565b610ce3670de0b6b3a7640000611b74858763ffffffff61383016565b9063ffffffff6132c116565b935060035460001415611bae57611b9f846103e863ffffffff61383016565b9350611bae60006103e8613872565b60008411611c03576040805162461bcd60e51b815260206004820152601c60248201527f5661756c74546f6b656e3a204d494e545f414d4f554e545f5a45524f00000000604482015290519081900360640190fd5b611c0d8585613872565b604080518481526020810186905281516001600160a01b0388169233927f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee929081900390910190a3505050611c60613909565b600b805460ff19166001179055919050565b60185481565b6008546001600160a01b031681565b60046020526000908152604090205481565b63ffffffff421690565b60165481565b6013546001600160a01b031681565b60076020526000908152604090205481565b600b5460009060ff16611d17576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff1916905530600090815260046020526040902054611d55670de0b6b3a7640000610ce3611d48611419565b849063ffffffff6132c116565b915060008211611dac576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e3a2052454445454d5f414d4f554e545f5a45524f0000604482015290519081900360640190fd5b600a54821115611e03576040805162461bcd60e51b815260206004820152601d60248201527f5661756c74546f6b656e3a20494e53554646494349454e545f43415348000000604482015290519081900360640190fd5b611e0d30826139bf565b600e5460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b158015611e5a57600080fd5b505af1158015611e6e573d6000803e3d6000fd5b50505050611e7c8383613a5c565b604080518381526020810183905281516001600160a01b0386169233927f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc929081900390910190a350611c60613909565b60018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610b6a5780601f10610b3f57610100808354040283529160200191610b6a565b600081565b6009546001600160a01b031615611f8a576040805162461bcd60e51b815260206004820152601f60248201527f5661756c74546f6b656e3a20464143544f52595f414c52454144595f53455400604482015290519081900360640190fd5b600980546001600160a01b0319163317905560408051808201825260118152702a30b937ba102b30bab63a102a37b5b2b760791b602080830191909152825180840190935260068352651d95105493d560d21b90830152611fea91613bee565b600880546001600160a01b03199081166001600160a01b038b81169190911792839055600b8054610100600160a81b0319166101008c841602179055600d805490921688821617918290556040805163b9a09fd560e01b815293821660048501525191169163b9a09fd5916024808301926020929190829003018186803b15801561207457600080fd5b505afa158015612088573d6000803e3d6000fd5b505050506040513d602081101561209e57600080fd5b5051600e80546001600160a01b0319166001600160a01b03928316179081905516612107576040805162461bcd60e51b81526020600482015260146024820152735661756c74546f6b656e3a204e4f5f474155474560601b604482015290519081900360640190fd5b600c80546001600160a01b038089166001600160a01b03199283168117909355600f80549188169190921617905560408051633fc8cef360e01b81529051633fc8cef391600480820192602092909190829003018186803b15801561216b57600080fd5b505afa15801561217f573d6000803e3d6000fd5b505050506040513d602081101561219557600080fd5b5051601180546001600160a01b0319166001600160a01b039283161790556040805163392f37e960e01b81529051918a169163392f37e99160048082019260e092909190829003018186803b1580156121ed57600080fd5b505afa158015612201573d6000803e3d6000fd5b505050506040513d60e081101561221757600080fd5b508051602082015160a083015160c090930151601580546001600160a01b03199081166001600160a01b03938416179091556014805482169583169590951790945560179190915560169190915560108054831686831617908190556012805484168684161790556013805490931684831617909255600c546122a09282169116600019613cb6565b600c546011546122c5916001600160a01b03918216911660001963ffffffff613cb616565b600e546008546122ea916001600160a01b03918216911660001963ffffffff613cb616565b5050505050505050565b60175481565b600e546001600160a01b031681565b6000610d8d338484613455565b6011546001600160a01b031681565b600a5481565b6000600354600014156123475750670de0b6b3a7640000611466565b600854604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561238c57600080fd5b505afa1580156123a0573d6000803e3d6000fd5b505050506040513d60208110156123b657600080fd5b5051600a549091506123dc908290610ce390670de0b6b3a764000063ffffffff6132c116565b91505090565b6103e881565b600b5460ff16612432576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600a54600854604080516370a0823160e01b815230600482015290516124d29385936124cd9391926001600160a01b03909116916370a08231916024808301926020929190829003018186803b15801561249557600080fd5b505afa1580156124a9573d6000803e3d6000fd5b505050506040513d60208110156124bf57600080fd5b50519063ffffffff61383016565b613a5c565b50600b805460ff19166001179055565b6009546001600160a01b031681565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b15801561253557600080fd5b505afa158015612549573d6000803e3d6000fd5b505050506040513d602081101561255f57600080fd5b50516001600160a01b0316146125ad576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b601380546001600160a01b0383166001600160a01b0319909116811790915560408051918252517f7f0cbd49972f62913af26d643526e8da09b67d71da761e4782ce72d4bdc78b739181900360200190a150565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b15801561264557600080fd5b505afa158015612659573d6000803e3d6000fd5b505050506040513d602081101561266f57600080fd5b50516001600160a01b0316146126bd576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b6126c681613e08565b50565b6010546001600160a01b031681565b6015546001600160a01b031681565b612717878787878787877f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9613edc565b61272287878761335c565b50505050505050565b600560209081526000928352604080842090915290825290205481565b600f546001600160a01b031681565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b15801561279b57600080fd5b505afa1580156127af573d6000803e3d6000fd5b505050506040513d60208110156127c557600080fd5b50516001600160a01b031614612813576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b6001600160a01b0381166000908152601b602052604090205460ff16612880576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e3a205245494e564553544f525f454e41424c45440000604482015290519081900360640190fd5b600061288b826140b1565b601a805491925060009160001981019081106128a357fe5b600091825260209091200154601a80546001600160a01b0390921692508291849081106128cc57fe5b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550601a80548061290557fe5b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b03949094168152601b909352505060409020805460ff19169055565b601a5490565b60195481565b6008546040805163ebeb31db60e01b815290516000926001600160a01b03169163ebeb31db916004808301926020929190829003018186803b15801561299f57600080fd5b505afa1580156129b3573d6000803e3d6000fd5b505050506040513d60208110156129c957600080fd5b5051905090565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015612a1457600080fd5b505afa158015612a28573d6000803e3d6000fd5b505050506040513d6020811015612a3e57600080fd5b50516001600160a01b031614612a8c576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b600b5460ff16612ad6576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600e54604080516331279d3d60e01b8152306004820181815260248301938452604483018690526001600160a01b03909416936331279d3d9391928792879291606401846020850280828437600081840152601f19601f820116905080830192505050945050505050600060405180830381600087803b158015612b6357600080fd5b505af1158015612b77573d6000803e3d6000fd5b5050600b805460ff1916600117905550505050565b600c546001600160a01b031681565b600b5460ff16612be5576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff1916905533321480612c0c5750336000908152601b602052604090205460ff165b612c1557600080fd5b6000612c1f61371d565b905080612c2c57506131fa565b6000670de0b6b3a7640000612c4c601854846132c190919063ffffffff16565b81612c5357fe5b0490508015612c7957601054612c79906001600160a01b0316338363ffffffff6135c316565b6000670de0b6b3a7640000612c99601954856132c190919063ffffffff16565b81612ca057fe5b0490508015612ccc57601354601054612ccc916001600160a01b0391821691168363ffffffff6135c316565b60105460145460009182916001600160a01b0390811691161480612d0057506010546015546001600160a01b039081169116145b15612d53576010546014546001600160a01b03908116911614612d35576015546014546001600160a01b039182169116612d49565b6014546015546001600160a01b0391821691165b9092509050612def565b6011546015546001600160a01b0390811691161480612d8257506012546015546001600160a01b039081169116145b15612da15750506015546014546001600160a01b039182169116612db7565b50506014546015546001600160a01b0391821691165b601054612ded906001600160a01b031683612de8612ddb888863ffffffff61415216565b899063ffffffff61383016565b6141ac565b505b6000612e03836001600160a01b0316613547565b90506000612e19836001600160a01b0316613547565b9050600080831180612e2b5750600082115b612e3157fe5b600083118015612e415750600082115b15612ee3576014546000908190612e6990869086906001600160a01b038b81169116146143dc565b91509150600082118015612e7d5750600081115b15612ee057601454600090612ea390849084906001600160a01b038c81169116146144d6565b90508015612ede57612eb78888858561463d565b9350612ec9868463ffffffff61383016565b9550612edb858363ffffffff61383016565b94505b505b50505b6000831180612ef25750600082115b1561314357600080600080600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015612f4e57600080fd5b505afa158015612f62573d6000803e3d6000fd5b505050506040513d6060811015612f7857600080fd5b5080516020909101516014546001600160701b039283169450911691506001600160a01b038c8116911614612fb4576017546016548284612fbd565b60165460175483835b92985090965094509250612fdb91508790508363ffffffff6132c116565b612feb888363ffffffff6132c116565b11156130405760006130008884848888614715565b9050801561303a576130138a8a83614882565b613023888263ffffffff61383016565b9750613037896001600160a01b0316613547565b96505b5061308b565b600061304f8783858789614715565b9050801561308957613062898b83614882565b6130748a6001600160a01b0316613547565b9750613086878263ffffffff61383016565b96505b505b60008711801561309b5750600086115b1561313e5760145460009081906130c3908a908a906001600160a01b038f81169116146143dc565b915091506000821180156130d75750600081115b1561313b5760006131128383601460009054906101000a90046001600160a01b03166001600160a01b03168f6001600160a01b0316146144d6565b90508015613139576131366131298d8d868661463d565b899063ffffffff61415216565b97505b505b50505b505050505b600e5460408051631c57762b60e31b81526004810184905260006024820181905291516001600160a01b039093169263e2bbb1589260448084019391929182900301818387803b15801561319657600080fd5b505af11580156131aa573d6000803e3d6000fd5b5050604080518b8152602081018b90528082018a905290513393507f5a1f3c64a894cbcee558ea14f59dd807692703df44b42f0c036588f149c8f7ba92509081900360600190a250505050505050505b613202613909565b600b805460ff19166001179055565b600b5460ff1661325b576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055613202613909565b6000600160701b82106132bd576040805162461bcd60e51b81526020600482015260136024820152722b30bab63a2a37b5b2b71d1029a0a32298989960691b604482015290519081900360640190fd5b5090565b6000826132d057506000610d91565b828202828482816132dd57fe5b0414610f105760405162461bcd60e51b8152600401808060200182810382526021815260200180614fc26021913960400191505060405180910390fd5b6000610f1083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506149cd565b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000818484111561344d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156134125781810151838201526020016133fa565b50505050905090810190601f16801561343f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b604080518082018252601881527f5461726f743a205452414e534645525f544f4f5f4849474800000000000000006020808301919091526001600160a01b0386166000908152600490915291909120546134b691839063ffffffff6133be16565b6001600160a01b0380851660009081526004602052604080822093909355908416815220546134eb908263ffffffff61415216565b6001600160a01b0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b15801561359157600080fd5b505afa1580156135a5573d6000803e3d6000fd5b505050506040513d60208110156135bb57600080fd5b505192915050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b602083106136405780518252601f199092019160209182019101613621565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146136a2576040519150601f19603f3d011682016040523d82523d6000602084013e6136a7565b606091505b50915091508180156136d55750805115806136d557508080602001905160208110156136d257600080fd5b50515b613716576040805162461bcd60e51b815260206004820152600d60248201526c10b9b0b332aa3930b739b332b960991b604482015290519081900360640190fd5b5050505050565b6040805160018082528183019092526000916060919060208083019080388339505060105482519293506001600160a01b03169183915060009061375d57fe5b6001600160a01b03928316602091820292909201810191909152600e54604080516331279d3d60e01b815230600482018181526024830193845287516044840152875194909616956331279d3d959194889491939192606490920191858101910280838360005b838110156137dc5781810151838201526020016137c4565b505050509050019350505050600060405180830381600087803b15801561380257600080fd5b505af1158015613816573d6000803e3d6000fd5b50506010546123dc92506001600160a01b03169050613547565b6000610f1083836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f77008152506133be565b600354613885908263ffffffff61415216565b6003556001600160a01b0382166000908152600460205260409020546138b1908263ffffffff61415216565b6001600160a01b03831660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600e54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561395457600080fd5b505afa158015613968573d6000803e3d6000fd5b505050506040513d602081101561397e57600080fd5b5051600a8190556040805182815290519192507f8a0df8ef054fae2c3d2d19a7b322e864870cc9fd3cb07fb9526309c596244bf4919081900360200190a150565b6001600160a01b0382166000908152600460205260409020546139e8908263ffffffff61383016565b6001600160a01b038316600090815260046020526040902055600354613a14908263ffffffff61383016565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600854604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0386811660248301526044808301879052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009560609594169382918083835b60208310613b095780518252601f199092019160209182019101613aea565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613b6b576040519150601f19603f3d011682016040523d82523d6000602084013e613b70565b606091505b5091509150818015613b9e575080511580613b9e5750808060200190516020811015613b9b57600080fd5b50515b613be8576040805162461bcd60e51b815260206004820152601660248201527515185c9bdd0e881514905394d1915497d1905253115160521b604482015290519081900360640190fd5b50505050565b8151613c01906000906020850190614ebf565b508051613c15906001906020840190614ebf565b506040514690806052614f708239604080519182900360520182208651602097880120838301835260018452603160f81b93880193909352815180880191909152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606083015260808201939093523060a0808301919091528351808303909101815260c090910190925250805192019190912060065550565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b60208310613d335780518252601f199092019160209182019101613d14565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613d95576040519150601f19603f3d011682016040523d82523d6000602084013e613d9a565b606091505b5091509150818015613dc8575080511580613dc85750808060200190516020811015613dc557600080fd5b50515b613716576040805162461bcd60e51b815260206004820152600c60248201526b2173616665417070726f766560a01b604482015290519081900360640190fd5b6001600160a01b0381166000908152601b602052604090205460ff1615613e76576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e3a205245494e564553544f525f454e41424c45440000604482015290519081900360640190fd5b6001600160a01b03166000818152601b60205260408120805460ff19166001908117909155601a805491820181559091527f057c384a7d1c54f3a1b2e5e67b2617b8224fdfd1ea7234eea573a6ff665ff63e0180546001600160a01b0319169091179055565b42851015613f22576040805162461bcd60e51b815260206004820152600e60248201526d15185c9bdd0e881156141254915160921b604482015290519081900360640190fd5b6006546001600160a01b03808a1660008181526007602090815260408083208054600180820190925582518085018a905280840196909652958e166060860152608085018d905260a085019590955260c08085018c90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff8a166101828501526101a284018990526101c28401889052519193926101e280820193601f1981019281900390910190855afa15801561401e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906140545750896001600160a01b0316816001600160a01b0316145b6140a5576040805162461bcd60e51b815260206004820152601860248201527f5461726f743a20494e56414c49445f5349474e41545552450000000000000000604482015290519081900360640190fd5b50505050505050505050565b601a54600090815b8181101561410457836001600160a01b0316601a82815481106140d857fe5b6000918252602090912001546001600160a01b031614156140fc57915061135a9050565b6001016140b9565b506040805162461bcd60e51b815260206004820181905260248201527f5661756c74546f6b656e3a205245494e564553544f525f4e4f545f464f554e44604482015290519081900360640190fd5b600082820183811015610f10576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826001600160a01b0316846001600160a01b031614156141cf575080610f10565b600b546040805163711f958560e11b81526001600160a01b038781166004830152915161010090930490911691600091839163e23f2b0a91602480820192602092909190829003018186803b15801561422757600080fd5b505afa15801561423b573d6000803e3d6000fd5b505050506040513d602081101561425157600080fd5b505190506001600160a01b03808216908616141561427e5761427582878787614a32565b92505050610f10565b6000826001600160a01b031663e23f2b0a876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b1580156142d657600080fd5b505afa1580156142ea573d6000803e3d6000fd5b505050506040513d602081101561430057600080fd5b505190506001600160a01b03878116908216141561432e5761432483888888614a32565b9350505050610f10565b6000876001600160a01b0316836001600160a01b03161461435c5761435584898589614a32565b905061435f565b50845b816001600160a01b0316836001600160a01b031614156143905761438584848984614a32565b945050505050610f10565b866001600160a01b0316826001600160a01b031614156143b5576143858388836141ac565b60006143c28484846141ac565b90506143d085848a84614a32565b95505050505050610f10565b600080600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561443057600080fd5b505afa158015614444573d6000803e3d6000fd5b505050506040513d606081101561445a57600080fd5b5080516020909101516001600160701b03918216935016905060008086614482578284614485565b83835b9150915060006144968a8484614d38565b90508881116144aa578996509450846144c9565b60006144b78a8486614d38565b90508a8111156144c357fe5b96508895505b5050505050935093915050565b6000806000600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561452957600080fd5b505afa15801561453d573d6000803e3d6000fd5b505050506040513d606081101561455357600080fd5b5080516020909101516001600160701b0391821693501690506000808561457b57828461457e565b83835b915091506000600860009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b1580156145d257600080fd5b505afa1580156145e6573d6000803e3d6000fd5b505050506040513d60208110156145fc57600080fd5b5051905061463061461784610ce38c8563ffffffff6132c116565b61462b84610ce38c8663ffffffff6132c116565b614dfa565b9998505050505050505050565b60006146498584614e10565b6146538483614e10565b600c5460408051635a47ddc360e01b81526001600160a01b0388811660048301528781166024830152600160448301526064820187905260848201869052600060a4830181905260c483018190523060e4840152426101048401529251931692635a47ddc39261012480840193606093929083900390910190829087803b1580156146dd57600080fd5b505af11580156146f1573d6000803e3d6000fd5b505050506040513d606081101561470757600080fd5b506040015195945050505050565b600080808061473686610ce38b670de0b6b3a764000063ffffffff6132c116565b9050600061475687610ce38b670de0b6b3a764000063ffffffff6132c116565b9050600061477687610ce38b670de0b6b3a764000063ffffffff6132c116565b90506000614796670de0b6b3a7640000610ce3858063ffffffff6132c116565b905060006147b6670de0b6b3a7640000610ce3858063ffffffff6132c116565b9050600061481385610ce36148066147e5876147d988600363ffffffff6132c116565b9063ffffffff61415216565b610ce3670de0b6b3a7640000611b74896147d98c600363ffffffff6132c116565b879063ffffffff6132c116565b9050614825868563ffffffff6132c116565b975061484b846147d9670de0b6b3a7640000610ce385611b748c8c63ffffffff61415216565b9650505050505050614876670de0b6b3a7640000610ce387611b74858761331a90919063ffffffff16565b98975050505050505050565b61488c8382614e10565b600c54604080516313dcfc5960e01b8152600481018490526000602482018190526001600160a01b0387811660448401528681166064840152600160848401523060a48401524260c4840152925192909316926313dcfc599260e48084019382900301818387803b15801561490057600080fd5b505af1158015614914573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561493d57600080fd5b8101908080516040519392919084600160201b82111561495c57600080fd5b90830190602082018581111561497157600080fd5b82518660208202830111600160201b8211171561498d57600080fd5b82525081516020918201928201910280838360005b838110156149ba5781810151838201526020016149a2565b5050505090500160405250505050505050565b60008183614a1c5760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156134125781810151838201526020016133fa565b506000838581614a2857fe5b0495945050505050565b6000826001600160a01b0316846001600160a01b03161415614a55575080614d30565b60408051630820681160e11b8152600481018490526001600160a01b0386811660248301528581166044830152825160009391891692631040d022926064808301939192829003018186803b158015614aad57600080fd5b505afa158015614ac1573d6000803e3d6000fd5b505050506040513d6040811015614ad757600080fd5b508051602090910151925090506001600160a01b038116614b29576040805162461bcd60e51b81526020600482015260076024820152662727afa820a4a960c91b604482015290519081900360640190fd5b614b436001600160a01b038616828563ffffffff6135c316565b836001600160a01b0316856001600160a01b03161015614c4757604080516000808252602082019283905263022c0d9f60e01b835260248201818152604483018690523060648401819052608060848501908152845160a486018190526001600160a01b0388169663022c0d9f968a9590939092909160c48501918083838b5b83811015614bdb578181015183820152602001614bc3565b50505050905090810190601f168015614c085780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015614c2a57600080fd5b505af1158015614c3e573d6000803e3d6000fd5b50505050614d2e565b604080516000808252602082019283905263022c0d9f60e01b835260248201858152604483018290523060648401819052608060848501908152845160a486018190526001600160a01b0388169663022c0d9f968a969590939092909160c48501918083838a5b83811015614cc6578181015183820152602001614cae565b50505050905090810190601f168015614cf35780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015614d1557600080fd5b505af1158015614d29573d6000803e3d6000fd5b505050505b505b949350505050565b6000808411614d8e576040805162461bcd60e51b815260206004820152601f60248201527f5661756c74546f6b656e3a20494e53554646494349454e545f414d4f554e5400604482015290519081900360640190fd5b600083118015614d9e5750600082115b614dd95760405162461bcd60e51b8152600401808060200182810382526022815260200180614f4e6022913960400191505060405180910390fd5b82614dea858463ffffffff6132c116565b81614df157fe5b04949350505050565b6000818310614e095781610f10565b5090919050565b600c5460408051636eb1769f60e11b81523060048201526001600160a01b0392831660248201529051839285169163dd62ed3e916044808301926020929190829003018186803b158015614e6357600080fd5b505afa158015614e77573d6000803e3d6000fd5b505050506040513d6020811015614e8d57600080fd5b505110614e9957614ebb565b600c54614ebb906001600160a01b03848116911660001963ffffffff613cb616565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10614f0057805160ff1916838001178555614f2d565b82800160010185558215614f2d579182015b82811115614f2d578251825591602001919060010190614f12565b506132bd926114669250905b808211156132bd5760008155600101614f3956fe5661756c74546f6b656e3a20494e53554646494349454e545f4c4951554944495459454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775661756c74546f6b656e3a20494e564c445f5245494e564553545f424f554e54595661756c74546f6b656e3a20494e53554646494349454e545f5245534552564553a265627a7a723158203971f16483023f4348ff9c264b9850d3d4b858dd8de7ed2a9caeebd298726b1064736f6c634300051000324f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a723158208564dab737415562f8a6b7a0639601ec62de670c8ab6a094cb6d50ddfa8be86964736f6c634300051000320000000000000000000000006108feaa628155b073150f408d0b390ec3121834000000000000000000000000a132dab612db5cb9fc9ac426a0cc215a3423f9c900000000000000000000000009236cff45047dbee6b921e00704bed6d6b8cf7e00000000000000000000000025cbddb98b35ab1ff77413456b31ec81a6b6b7460000000000000000000000003c8b650257cfb5f272f799f5e2b4e65093a11a050000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607000000000000000000000000d204e3dc1937d3a30fc6f20abc48ac5506c94d1e

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

0000000000000000000000006108feaa628155b073150f408d0b390ec3121834000000000000000000000000a132dab612db5cb9fc9ac426a0cc215a3423f9c900000000000000000000000009236cff45047dbee6b921e00704bed6d6b8cf7e00000000000000000000000025cbddb98b35ab1ff77413456b31ec81a6b6b7460000000000000000000000003c8b650257cfb5f272f799f5e2b4e65093a11a050000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607000000000000000000000000d204e3dc1937d3a30fc6f20abc48ac5506c94d1e

-----Decoded View---------------
Arg [0] : _optiSwap (address): 0x6108FeAA628155b073150F408D0b390eC3121834
Arg [1] : _router (address): 0xa132DAB612dB5cB9fC9Ac426A0Cc215A3423F9c9
Arg [2] : _voter (address): 0x09236cfF45047DBee6B921e00704bed6D6B8Cf7e
Arg [3] : _pairFactory (address): 0x25CbdDb98b35ab1FF77413456B31EC81A6B6B746
Arg [4] : _rewardsToken (address): 0x3c8B650257cFb5f272f799F5e2b4e65093a11a05
Arg [5] : _coreStableToken (address): 0x7F5c764cBc14f9669B88837ca1490cCa17c31607
Arg [6] : _reinvestFeeTo (address): 0xD204E3dC1937d3a30fc6F20ABc48AC5506C94D1E

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000006108feaa628155b073150f408d0b390ec3121834
Arg [1] : 000000000000000000000000a132dab612db5cb9fc9ac426a0cc215a3423f9c9
Arg [2] : 00000000000000000000000009236cff45047dbee6b921e00704bed6d6b8cf7e
Arg [3] : 00000000000000000000000025cbddb98b35ab1ff77413456b31ec81a6b6b746
Arg [4] : 0000000000000000000000003c8b650257cfb5f272f799f5e2b4e65093a11a05
Arg [5] : 0000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607
Arg [6] : 000000000000000000000000d204e3dc1937d3a30fc6f20abc48ac5506c94d1e


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.