Contract 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x2714fc56bd5042138da5a2995a1eaf1b3fbb700b5b002abb01e3023b3ff7da8dCreate Vault Tok...390304982022-05-25 13:58:0943 days 2 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.271130983266
0x48481dca25840567f487abff820c93556460971ad415a2188a15ba7214dfc34aCreate Vault Tok...390304922022-05-25 13:58:0143 days 2 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.268505881218
0x5330702216eb39194b5e791d630e172b97a448deff17cb52d2e842b2c37cfa6fCreate Vault Tok...390304882022-05-25 13:57:5543 days 2 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.287396606711
0xdf7aa5b408f64bd47db67d77ec88555d53edbda51af0b665a665fee0847367fcCreate Vault Tok...386162872022-05-19 22:40:1848 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.404505446076
0x629c0f0e63cc57e5007cfe7265b8b8681cf76816f5ca0e623edbf808572a190eCreate Vault Tok...386162782022-05-19 22:40:0948 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.41219265576
0xb93cb1f7cdddf4aa9449e1e1eb1904adadaf48d66d23cb8d0ad33a1d6418c946Create Vault Tok...386162702022-05-19 22:40:0048 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.41219265576
0x0b561256528eb2892e658037a853e05ef0ee4932205e778c6430916a6773a276Create Vault Tok...386162602022-05-19 22:39:5148 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.41219265576
0x5c7f62453a26114bb97c5d63933fe431a78b7cf410bbc21b6df67833c1af09f9Create Vault Tok...386162422022-05-19 22:39:2948 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.41219265576
0x17bd90d1eeb3c3b1aaa35f0363f5b2ab052b3e6996d422f55d995e778676370bCreate Vault Tok...386162242022-05-19 22:39:1248 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.41219265576
0x6b48a5fe2c6764e91652c0c9e04e7133db34586ba9c73f6fecacc587f71b98a9Create Vault Tok...386162162022-05-19 22:39:0348 days 17 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.456605664629
0xf86ac38399b963b158c7135bb5bce77fb7aa8275fddeb0f52c6064f4b1c2c52eCreate Vault Tok...375303382022-05-04 12:14:5164 days 4 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.930375011376
0x0e3497a973ba134e74c160bba24b5c312cbee9fec63e3be62fb09c16408935c9Create Vault Tok...350611472022-04-02 17:35:3795 days 22 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.80529890483
0x2c62a5f368d7189672be9bd1eee3eef2594bfff2d663e378a8f77f2a2dc9fe76Create Vault Tok...350611402022-04-02 17:35:3095 days 22 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM0.804728135702
0x545cf62464649bfeb525fd0716da43919133ca60f54845803d41ad8987cac2b8Create Vault Tok...331601322022-03-11 18:33:10117 days 21 hrs agoTarot: Deployer IN  0x9189a6c06a33dea7ad82201e37b73fe2adc595ed0 FTM1.235496513212
0xc4d385a14e9b4d9021a9c87f7492a28bd4048ccf69f516ca8c60713ddc50fd160x60806040331600732022-03-11 18:32:21117 days 21 hrs agoTarot: Deployer IN  Create: TombSwapVaultTokenFactory0 FTM1.342396258294
[ Download CSV Export 
Latest 15 internal transactions
Parent Txn Hash Block From To Value
0x2714fc56bd5042138da5a2995a1eaf1b3fbb700b5b002abb01e3023b3ff7da8d390304982022-05-25 13:58:0943 days 2 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x48481dca25840567f487abff820c93556460971ad415a2188a15ba7214dfc34a390304922022-05-25 13:58:0143 days 2 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x5330702216eb39194b5e791d630e172b97a448deff17cb52d2e842b2c37cfa6f390304882022-05-25 13:57:5543 days 2 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0xdf7aa5b408f64bd47db67d77ec88555d53edbda51af0b665a665fee0847367fc386162872022-05-19 22:40:1848 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x629c0f0e63cc57e5007cfe7265b8b8681cf76816f5ca0e623edbf808572a190e386162782022-05-19 22:40:0948 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0xb93cb1f7cdddf4aa9449e1e1eb1904adadaf48d66d23cb8d0ad33a1d6418c946386162702022-05-19 22:40:0048 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x0b561256528eb2892e658037a853e05ef0ee4932205e778c6430916a6773a276386162602022-05-19 22:39:5148 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x5c7f62453a26114bb97c5d63933fe431a78b7cf410bbc21b6df67833c1af09f9386162422022-05-19 22:39:2948 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x17bd90d1eeb3c3b1aaa35f0363f5b2ab052b3e6996d422f55d995e778676370b386162242022-05-19 22:39:1248 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x6b48a5fe2c6764e91652c0c9e04e7133db34586ba9c73f6fecacc587f71b98a9386162162022-05-19 22:39:0348 days 17 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0xf86ac38399b963b158c7135bb5bce77fb7aa8275fddeb0f52c6064f4b1c2c52e375303382022-05-04 12:14:5164 days 4 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x0e3497a973ba134e74c160bba24b5c312cbee9fec63e3be62fb09c16408935c9350611472022-04-02 17:35:3795 days 22 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x2c62a5f368d7189672be9bd1eee3eef2594bfff2d663e378a8f77f2a2dc9fe76350611402022-04-02 17:35:3095 days 22 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0x545cf62464649bfeb525fd0716da43919133ca60f54845803d41ad8987cac2b8331601322022-03-11 18:33:10117 days 21 hrs ago 0x9189a6c06a33dea7ad82201e37b73fe2adc595ed  Contract Creation0 FTM
0xc4d385a14e9b4d9021a9c87f7492a28bd4048ccf69f516ca8c60713ddc50fd16331600732022-03-11 18:32:21117 days 21 hrs ago Tarot: Deployer  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TombSwapVaultTokenFactory

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 18 : TombSwapVaultTokenFactory.sol
pragma solidity =0.5.16;

import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./TombSwapVaultToken.sol";
import "./interfaces/IMasterChef.sol";
import "./interfaces/IVaultTokenFactory.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IUniswapV2Router01.sol";
import "./interfaces/ITombSwapUniswapV2Factory.sol";
import "./libraries/SafeMath.sol";

contract TombSwapVaultTokenFactory is Ownable, IVaultTokenFactory {
    using SafeMath for uint256;

    address public optiSwap;
    address public router;
    address public tombSwapFactory;
    address public masterChef;
    address public rewardsToken;

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

    event VaultTokenCreated(
        uint256 indexed pid,
        address vaultToken,
        uint256 vaultTokenIndex
    );

    constructor(
        address _optiSwap,
        address _router,
        address _masterChef,
        address _rewardsToken
    ) public {
        optiSwap = _optiSwap;
        router = _router;
        tombSwapFactory = IUniswapV2Router01(router).factory();
        masterChef = _masterChef;
        rewardsToken = _rewardsToken;
    }

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

    function createVaultToken(uint256 pid)
        external
        returns (address vaultToken)
    {
        require(
            getVaultToken[pid] == address(0),
            "VaultTokenFactory: PID_EXISTS"
        );
        bytes memory bytecode = type(TombSwapVaultToken).creationCode;
        assembly {
            vaultToken := create2(0, add(bytecode, 32), mload(bytecode), pid)
        }
        TombSwapVaultToken(vaultToken)._initialize(
            optiSwap,
            IUniswapV2Router01(router),
            IMasterChef(masterChef),
            rewardsToken,
            pid
        );
        getVaultToken[pid] = vaultToken;
        allVaultTokens.push(vaultToken);
        emit VaultTokenCreated(pid, vaultToken, allVaultTokens.length);
    }

    function swapFeeFactor() public view returns (uint256) {
        return uint256(1000).sub(ITombSwapUniswapV2Factory(tombSwapFactory).swapFee());
    }
}

File 2 of 18 : 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 18 : TombSwapVaultToken.sol
pragma solidity =0.5.16;

import "@openzeppelin/contracts/ownership/Ownable.sol";
import "./PoolToken.sol";
import "./interfaces/IMasterChef.sol";
import "./interfaces/ITombSwapVaultToken.sol";
import "./interfaces/IOptiSwap.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IUniswapV2Router01.sol";
import "./interfaces/ITombSwapUniswapV2Factory.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./libraries/SafeToken.sol";
import "./libraries/Math.sol";

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

contract TombSwapVaultToken is ITombSwapVaultToken, IUniswapV2Pair, PoolToken {
    using SafeToken for address;

    bool public constant isVaultToken = true;

    address public optiSwap;
    IUniswapV2Router01 public router;
    ITombSwapUniswapV2Factory public tombSwapFactory;
    IMasterChef public masterChef;
    address public rewardsToken;
    address public WETH;
    address public token0;
    address public token1;
    uint256 public pid;
    uint256 public constant MIN_REINVEST_BOUNTY = 0.001e18;
    uint256 public constant MAX_REINVEST_BOUNTY = 0.01e18;
    uint256 public REINVEST_BOUNTY = MAX_REINVEST_BOUNTY;

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

    function _initialize(
        address _optiSwap,
        IUniswapV2Router01 _router,
        IMasterChef _masterChef,
        address _rewardsToken,
        uint256 _pid
    ) external {
        require(factory == address(0), "VaultToken: FACTORY_ALREADY_SET"); // sufficient check
        optiSwap = _optiSwap;
        factory = msg.sender;
        _setName("Tarot Vault Token", "vTAROT");
        WETH = _router.WETH();
        router = _router;
        tombSwapFactory = ITombSwapUniswapV2Factory(router.factory());
        masterChef = _masterChef;
        pid = _pid;
        (IERC20 _underlying, , , ) = masterChef.poolInfo(_pid);
        underlying = address(_underlying);
        token0 = IUniswapV2Pair(underlying).token0();
        token1 = IUniswapV2Pair(underlying).token1();
        require(tombSwapFactory.getPair(token0, token1) == underlying, "VaultToken: INVLD_PAIR");
        rewardsToken = _rewardsToken;
        rewardsToken.safeApprove(address(router), uint256(-1));
        WETH.safeApprove(address(router), uint256(-1));
        underlying.safeApprove(address(masterChef), uint256(-1));
    }

    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);
    }

    /*** PoolToken Overrides ***/

    function _update() internal {
        (uint256 _totalBalance, ) = masterChef.userInfo(pid, 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, ) = masterChef.userInfo(
            pid,
            address(this)
        );
        masterChef.deposit(pid, mintAmount);
        (uint256 _totalBalanceAfter, ) = masterChef.userInfo(
            pid,
            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);
        masterChef.withdraw(pid, redeemAmount);
        _safeTransfer(redeemer, redeemAmount);
        emit Redeem(msg.sender, redeemer, redeemAmount, redeemTokens);
    }

    /*** Reinvest ***/

    function _optimalDepositA(
        uint256 _amountA,
        uint256 _reserveA,
        uint256 _swapFeeFactor
    ) internal pure returns (uint256) {
        uint256 a = uint256(1000).add(_swapFeeFactor).mul(_reserveA);
        uint256 b = _amountA.mul(1000).mul(_reserveA).mul(4).mul(
            _swapFeeFactor
        );
        uint256 c = Math.sqrt(a.mul(a).add(b));
        uint256 d = uint256(2).mul(_swapFeeFactor);
        return c.sub(a).div(d);
    }

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

    function swapExactTokensForTokens(
        address tokenIn,
        address tokenOut,
        uint256 amount
    ) internal {
        address[] memory path = new address[](2);
        path[0] = address(tokenIn);
        path[1] = address(tokenOut);
        approveRouter(tokenIn, amount);
        router.swapExactTokensForTokens(amount, 0, path, address(this), now);
    }

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

    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 reinvest() external nonReentrant update {
        require(msg.sender == tx.origin);
        // 1. Withdraw all the rewards.
        masterChef.withdraw(pid, 0);
        uint256 reward = rewardsToken.myBalance();
        if (reward == 0) return;
        // 2. Send the reward bounty to the caller.
        uint256 bounty = reward.mul(REINVEST_BOUNTY) / 1e18;
        rewardsToken.safeTransfer(msg.sender, bounty);
        // 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) {
                (tokenA, tokenB) = (token1, token0);
            } else {
                (tokenA, tokenB) = (token0, token1);
            }
            optiSwapExactTokensForTokens(rewardsToken, tokenA, reward.sub(bounty));
        }
        // 4. Convert tokenA to LP Token underlyings.
        uint256 totalAmountA = tokenA.myBalance();
        assert(totalAmountA > 0);
        (uint256 r0, uint256 r1, ) = IUniswapV2Pair(underlying).getReserves();
        uint256 reserveA = tokenA == token0 ? r0 : r1;
        uint256 swapAmount = _optimalDepositA(
            totalAmountA,
            reserveA,
            swapFeeFactor()
        );
        swapExactTokensForTokens(tokenA, tokenB, swapAmount);
        uint256 liquidity = addLiquidity(
            tokenA,
            tokenB,
            totalAmountA.sub(swapAmount),
            tokenB.myBalance()
        );
        // 5. Stake the LP Tokens.
        masterChef.deposit(pid, liquidity);
        emit Reinvest(msg.sender, reward, bounty);
    }

    function swapFeeFactor() public view returns (uint256) {
        return uint256(1000).sub(tombSwapFactory.swapFee());
    }

    /*** Mirrored From uniswapV2Pair ***/

    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        )
    {
        (reserve0, reserve1, blockTimestampLast) = IUniswapV2Pair(underlying)
        .getReserves();
        // 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"
        );
    }

    function price0CumulativeLast() external view returns (uint256) {
        return IUniswapV2Pair(underlying).price0CumulativeLast();
    }

    function price1CumulativeLast() external view returns (uint256) {
        return IUniswapV2Pair(underlying).price1CumulativeLast();
    }

    /*** Utilities ***/

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

    /*** Modifiers ***/

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

File 4 of 18 : IMasterChef.sol
pragma solidity 0.5.16;

import "./IERC20.sol";

// Making the original MasterChef as an interface leads to compilation fail.
// Use Contract instead of Interface here
contract IMasterChef {
    // Info of each user.
    struct UserInfo {
        uint256 amount; // How many LP tokens the user has provided.
        uint256 rewardDebt; // Reward debt. See explanation below.
    }

    // Info of each pool.
    struct PoolInfo {
        IERC20 lpToken; // Address of LP token contract.
        uint256 allocPoint; // How many allocation points assigned to this pool. Reward tokens to distribute per block.
        uint256 lastRewardBlock; // Last block number that reward token distribution occurs.
        uint256 accRewardTokenPerShare; // Accumulated reward tokens per share, times 1e12. See below.
    }

    // Info of each user that stakes LP tokens.
    mapping(uint256 => PoolInfo) public poolInfo;
    mapping(uint256 => mapping(address => UserInfo)) public userInfo;

    // Deposit LP tokens to MasterChef.
    function deposit(uint256 _pid, uint256 _amount) external {}

    // Withdraw LP tokens from MasterChef.
    function withdraw(uint256 _pid, uint256 _amount) external {}
}

File 5 of 18 : IVaultTokenFactory.sol
pragma solidity >=0.5.0;

interface IVaultTokenFactory {
    event VaultTokenCreated(
        uint256 indexed pid,
        address vaultToken,
        uint256 vaultTokenIndex
    );

    function optiSwap() external view returns (address);

    function router() external view returns (address);

    function masterChef() external view returns (address);

    function rewardsToken() external view returns (address);

    function swapFeeFactor() external view returns (uint256);

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

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

    function allVaultTokensLength() external view returns (uint256);

    function createVaultToken(uint256 pid)
        external
        returns (address vaultToken);
}

File 6 of 18 : 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 7 of 18 : IUniswapV2Router01.sol
pragma solidity >=0.5.0;

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

    function WETH() external pure returns (address);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 8 of 18 : ITombSwapUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface ITombSwapUniswapV2Factory {
    function swapFee() external view returns (uint);
    
    function getPair(address tokenA, address tokenB) external view returns (address pair);
}

File 9 of 18 : 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;
    }
}

File 10 of 18 : 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 11 of 18 : 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 12 of 18 : ITombSwapVaultToken.sol
pragma solidity >=0.5.0;

import "./IMasterChef.sol";
import "./IUniswapV2Router01.sol";

interface ITombSwapVaultToken {
    /*** 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);

    function isVaultToken() external pure returns (bool);

    function router() external view returns (IUniswapV2Router01);

    function masterChef() external view returns (IMasterChef);

    function rewardsToken() external view returns (address);

    function WETH() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function swapFeeFactor() external view returns (uint256);

    function pid() external view returns (uint256);

    function REINVEST_BOUNTY() external pure returns (uint256);

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

    function price0CumulativeLast() external view returns (uint256);

    function price1CumulativeLast() external view returns (uint256);

    function _initialize(
        address optiSwap,
        IUniswapV2Router01 _router,
        IMasterChef _masterChef,
        address _rewardsToken,
        uint256 _pid
    ) external;

    function reinvest() external;
}

File 13 of 18 : 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 14 of 18 : 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 15 of 18 : 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 16 of 18 : 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 17 of 18 : 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 18 of 18 : 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;
}

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":"_masterChef","type":"address"},{"internalType":"address","name":"_rewardsToken","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":"uint256","name":"pid","type":"uint256"},{"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":false,"inputs":[{"internalType":"uint256","name":"pid","type":"uint256"}],"name":"createVaultToken","outputs":[{"internalType":"address","name":"vaultToken","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"masterChef","outputs":[{"internalType":"address","name":"","type":"address"}],"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":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":true,"inputs":[],"name":"swapFeeFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tombSwapFactory","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"}]

608060405234801561001057600080fd5b5060405161410a38038061410a8339818101604052608081101561003357600080fd5b5080516020820151604083015160609093015191929091600061005d6001600160e01b0361018016565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600180546001600160a01b038087166001600160a01b03199283161790925560028054868416921691909117908190556040805163c45a015560e01b81529051919092169163c45a0155916004808301926020929190829003018186803b15801561011157600080fd5b505afa158015610125573d6000803e3d6000fd5b505050506040513d602081101561013b57600080fd5b5051600380546001600160a01b03199081166001600160a01b039384161790915560048054821694831694909417909355600580549093169116179055506101849050565b3390565b613f77806101936000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80638f32d59b1161008c578063d1af0c7d11610066578063d1af0c7d146101c2578063ddf98f51146101ca578063f2fde38b146101d2578063f887ea40146101f8576100ea565b80638f32d59b1461016c578063a9a1e13814610188578063b3ac2cbf146101a5576100ea565b806360c2affa116100c857806360c2affa1461014a57806368f91a4414610152578063715018a61461015a5780638da5cb5b14610164576100ea565b806308ee8d6a146100ef57806329e15d0b14610128578063575a86b214610142575b600080fd5b61010c6004803603602081101561010557600080fd5b5035610200565b604080516001600160a01b039092168252519081900360200190f35b61013061021b565b60408051918252519081900360200190f35b61010c610221565b61010c610230565b61013061023f565b6101626102d2565b005b61010c610375565b610174610384565b604080519115158252519081900360200190f35b61010c6004803603602081101561019e57600080fd5b50356103a8565b61010c600480360360208110156101bb57600080fd5b50356103cf565b61010c6105a9565b61010c6105b8565b610162600480360360208110156101e857600080fd5b50356001600160a01b03166105c7565b61010c61062c565b6006602052600090815260409020546001600160a01b031681565b60075490565b6004546001600160a01b031681565b6001546001600160a01b031681565b60006102cd600360009054906101000a90046001600160a01b03166001600160a01b03166354cf2aeb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561029257600080fd5b505afa1580156102a6573d6000803e3d6000fd5b505050506040513d60208110156102bc57600080fd5b50516103e89063ffffffff61063b16565b905090565b6102da610384565b61032b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600080546001600160a01b0316610399610684565b6001600160a01b031614905090565b600781815481106103b557fe5b6000918252602090912001546001600160a01b0316905081565b6000818152600660205260408120546001600160a01b031615610439576040805162461bcd60e51b815260206004820152601d60248201527f5661756c74546f6b656e466163746f72793a205049445f455849535453000000604482015290519081900360640190fd5b60606040518060200161044b906107bf565b6020820181038252601f19601f820116604052509050828151602083016000f56001546002546004805460055460408051633591f07360e01b81526001600160a01b0396871694810194909452938516602484015290841660448301528316606482015260848101879052905192945090841691633591f0739160a48082019260009290919082900301818387803b1580156104e657600080fd5b505af11580156104fa573d6000803e3d6000fd5b505050600084815260066020908152604080832080546001600160a01b0388166001600160a01b0319918216811790925560078054600181018255958190527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688909501805490911682179055925481519384529183019190915280518693507f42c2f0d6763288ab9d586235f818373d880de5f012d7a67d672822104747a1349281900390910190a250919050565b6005546001600160a01b031681565b6003546001600160a01b031681565b6105cf610384565b610620576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b61062981610688565b50565b6002546001600160a01b031681565b600061067d83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f7700815250610728565b9392505050565b3390565b6001600160a01b0381166106cd5760405162461bcd60e51b8152600401808060200182810382526026815260200180613f1d6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600081848411156107b75760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561077c578181015183820152602001610764565b50505050905090810190601f1680156107a95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b613750806107cd8339019056fe60806040526002805460ff19908116601217909155600b80549091166001179055662386f26fc100006014556137168061003a6000396000f3fe608060405234801561001057600080fd5b50600436106102695760003560e01c80636f307dc311610151578063c45a0155116100c3578063dd62ed3e11610087578063dd62ed3e1461063d578063ddf98f511461066b578063f106845414610673578063f887ea401461067b578063fdb5a03e14610683578063fff6cae91461068b57610269565b8063c45a0155146105cc578063c8c4ff8c146105d4578063d1af0c7d146105dc578063d21220a7146105e4578063d505accf146105ec57610269565b806396fa4c111161011557806396fa4c111461055a578063a9059cbb14610562578063ad5c46481461058e578063ad7a672f14610596578063ba9a7a561461059e578063bc25cf77146105a657610269565b80636f307dc3146104d857806370a08231146104e05780637ecebe001461050657806395a2251f1461052c57806395d89b411461055257610269565b80633ba0b9a9116101ea5780635a3d5493116101ae5780635a3d54931461048a57806360c2affa1461049257806368f91a441461049a5780636a627842146104a25780636c2a3bc5146104c85780636ee27227146104d057610269565b80633ba0b9a91461044d57806346fb738b146104555780634a5d316c14610472578063575a86b21461047a5780635909c0d51461048257610269565b806323b872dd1161023157806323b872dd146103a157806330adf81f146103d7578063313ce567146103df5780633591f073146103fd5780633644e5151461044557610269565b806306fdde031461026e5780630902f1ac146102eb578063095ea7b3146103235780630dfe16811461036357806318160ddd14610387575b600080fd5b610276610693565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102b0578181015183820152602001610298565b50505050905090810190601f1680156102dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102f3610721565b604080516001600160701b03948516815292909316602083015263ffffffff168183015290519081900360600190f35b61034f6004803603604081101561033957600080fd5b506001600160a01b0381351690602001356108f1565b604080519115158252519081900360200190f35b61036b610908565b604080516001600160a01b039092168252519081900360200190f35b61038f610917565b60408051918252519081900360200190f35b61034f600480360360608110156103b757600080fd5b506001600160a01b0381358116916020810135909116906040013561091d565b61038f6109ed565b6103e7610a11565b6040805160ff9092168252519081900360200190f35b610443600480360360a081101561041357600080fd5b506001600160a01b0381358116916020810135821691604082013581169160608101359091169060800135610a1a565b005b61038f610f1d565b61038f610f23565b6104436004803603602081101561046b57600080fd5b5035610f73565b6104436110c3565b61036b611135565b61038f611144565b61038f6111ba565b61036b6111ff565b61038f611213565b61038f600480360360208110156104b857600080fd5b50356001600160a01b03166112a6565b61038f6115b1565b61034f6115b7565b61036b6115bc565b61038f600480360360208110156104f657600080fd5b50356001600160a01b03166115cb565b61038f6004803603602081101561051c57600080fd5b50356001600160a01b03166115dd565b61038f6004803603602081101561054257600080fd5b50356001600160a01b03166115ef565b6102766117fc565b61038f611856565b61034f6004803603604081101561057857600080fd5b506001600160a01b038135169060200135611861565b61036b61186e565b61038f61187d565b61038f611883565b610443600480360360208110156105bc57600080fd5b50356001600160a01b0316611889565b61036b611983565b61038f611992565b61036b61199d565b61036b6119ac565b610443600480360360e081101561060257600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c001356119bb565b61038f6004803603604081101561065357600080fd5b506001600160a01b03813581169160200135166119ff565b61036b611a1c565b61038f611a2b565b61036b611a31565b610443611a40565b610443611e6b565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107195780601f106106ee57610100808354040283529160200191610719565b820191906000526020600020905b8154815290600101906020018083116106fc57829003601f168201915b505050505081565b6000806000600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561077457600080fd5b505afa158015610788573d6000803e3d6000fd5b505050506040513d606081101561079e57600080fd5b50805160208201516040909201516003549195509193509091506107c1576108ec565b600a54600854604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b15801561080957600080fd5b505afa15801561081d573d6000803e3d6000fd5b505050506040513d602081101561083357600080fd5b5051905061086861086382610857856001600160701b038a1663ffffffff611ec716565b9063ffffffff611f2016565b611f62565b945061088a61086382610857856001600160701b03891663ffffffff611ec716565b93506064856001600160701b03161180156108ae57506064846001600160701b0316115b6108e95760405162461bcd60e51b81526004018080602001828103825260218152602001806136c16021913960400191505060405180910390fd5b50505b909192565b60006108fe338484611fba565b5060015b92915050565b6011546001600160a01b031681565b60035481565b6001600160a01b0383166000908152600560209081526040808320338452909152812054600019146109d757604080518082018252601b81527f5461726f743a205452414e534645525f4e4f545f414c4c4f57454400000000006020808301919091526001600160a01b03871660009081526005825283812033825290915291909120546109b291849063ffffffff61201c16565b6001600160a01b03851660009081526005602090815260408083203384529091529020555b6109e28484846120b3565b5060015b9392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b6009546001600160a01b031615610a78576040805162461bcd60e51b815260206004820152601f60248201527f5661756c74546f6b656e3a20464143544f52595f414c52454144595f53455400604482015290519081900360640190fd5b600b80546001600160a01b03871661010002610100600160a81b0319909116179055600980546001600160a01b0319163317905560408051808201825260118152702a30b937ba102b30bab63a102a37b5b2b760791b602080830191909152825180840190935260068352651d95105493d560d21b90830152610afa916121a5565b836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610b3357600080fd5b505afa158015610b47573d6000803e3d6000fd5b505050506040513d6020811015610b5d57600080fd5b5051601080546001600160a01b03199081166001600160a01b0393841617909155600c805490911686831617908190556040805163c45a015560e01b81529051919092169163c45a0155916004828101926020929190829003018186803b158015610bc757600080fd5b505afa158015610bdb573d6000803e3d6000fd5b505050506040513d6020811015610bf157600080fd5b5051600d80546001600160a01b03199081166001600160a01b0393841617909155600e80549091168583161790819055601383905560408051631526fe2760e01b81526004810185905290516000939290921691631526fe2791602480820192608092909190829003018186803b158015610c6b57600080fd5b505afa158015610c7f573d6000803e3d6000fd5b505050506040513d6080811015610c9557600080fd5b5051600880546001600160a01b0319166001600160a01b03808416919091179182905560408051630dfe168160e01b81529051939450911691630dfe168191600480820192602092909190829003018186803b158015610cf457600080fd5b505afa158015610d08573d6000803e3d6000fd5b505050506040513d6020811015610d1e57600080fd5b5051601180546001600160a01b0319166001600160a01b039283161790556008546040805163d21220a760e01b81529051919092169163d21220a7916004808301926020929190829003018186803b158015610d7957600080fd5b505afa158015610d8d573d6000803e3d6000fd5b505050506040513d6020811015610da357600080fd5b5051601280546001600160a01b0319166001600160a01b039283161790819055600854600d546011546040805163e6a4390560e01b815291861660048301529385166024820152925191841693169163e6a43905916044808301926020929190829003018186803b158015610e1757600080fd5b505afa158015610e2b573d6000803e3d6000fd5b505050506040513d6020811015610e4157600080fd5b50516001600160a01b031614610e97576040805162461bcd60e51b81526020600482015260166024820152752b30bab63a2a37b5b2b71d1024a72b26222fa820a4a960511b604482015290519081900360640190fd5b600f80546001600160a01b0319166001600160a01b038581169190911791829055600c54610ecb928216911660001961226d565b600c54601054610ef0916001600160a01b03918216911660001963ffffffff61226d16565b600e54600854610f15916001600160a01b03918216911660001963ffffffff61226d16565b505050505050565b60065481565b600354600a5460009190811580610f38575080155b15610f4f57670de0b6b3a764000092505050610f70565b610f6b8261085783670de0b6b3a764000063ffffffff611ec716565b925050505b90565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015610fb757600080fd5b505afa158015610fcb573d6000803e3d6000fd5b505050506040513d6020811015610fe157600080fd5b50516001600160a01b03161461102f576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b66038d7ea4c68000811015801561104d5750662386f26fc100008111155b6110885760405162461bcd60e51b81526004018080602001828103825260218152602001806136a06021913960400191505060405180910390fd5b60148190556040805182815290517ffa1e13889c5c5294758f01f045a83de15feca61a17e6281f4d11a5110085d9329181900360200190a150565b6009546001600160a01b031615611121576040805162461bcd60e51b815260206004820152601a60248201527f5461726f743a20464143544f52595f414c52454144595f534554000000000000604482015290519081900360640190fd5b600980546001600160a01b03191633179055565b600e546001600160a01b031681565b60085460408051635909c0d560e01b815290516000926001600160a01b031691635909c0d5916004808301926020929190829003018186803b15801561118957600080fd5b505afa15801561119d573d6000803e3d6000fd5b505050506040513d60208110156111b357600080fd5b5051905090565b60085460408051635a3d549360e01b815290516000926001600160a01b031691635a3d5493916004808301926020929190829003018186803b15801561118957600080fd5b600b5461010090046001600160a01b031681565b60006112a1600d60009054906101000a90046001600160a01b03166001600160a01b03166354cf2aeb6040518163ffffffff1660e01b815260040160206040518083038186803b15801561126657600080fd5b505afa15801561127a573d6000803e3d6000fd5b505050506040513d602081101561129057600080fd5b50516103e89063ffffffff6123c616565b905090565b600b5460009060ff166112f3576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600854600090611315906001600160a01b0316612408565b600e54601354604080516393f1a40b60e01b8152600481019290925230602483015280519394506000936001600160a01b03909316926393f1a40b926044808201939291829003018186803b15801561136d57600080fd5b505afa158015611381573d6000803e3d6000fd5b505050506040513d604081101561139757600080fd5b5051600e5460135460408051631c57762b60e31b8152600481019290925260248201869052519293506001600160a01b039091169163e2bbb1589160448082019260009290919082900301818387803b1580156113f357600080fd5b505af1158015611407573d6000803e3d6000fd5b5050600e54601354604080516393f1a40b60e01b815260048101929092523060248301528051600095506001600160a01b0390931693506393f1a40b92604480840193829003018186803b15801561145e57600080fd5b505afa158015611472573d6000803e3d6000fd5b505050506040513d604081101561148857600080fd5b505190506114bf611497610f23565b610857670de0b6b3a76400006114b3858763ffffffff6123c616565b9063ffffffff611ec716565b9350600354600014156114ed576114de846103e863ffffffff6123c616565b93506114ed60006103e8612484565b60008411611542576040805162461bcd60e51b815260206004820152601c60248201527f5661756c74546f6b656e3a204d494e545f414d4f554e545f5a45524f00000000604482015290519081900360640190fd5b61154c8585612484565b604080518481526020810186905281516001600160a01b0388169233927f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee929081900390910190a350505061159f61251b565b600b805460ff19166001179055919050565b60145481565b600181565b6008546001600160a01b031681565b60046020526000908152604090205481565b60076020526000908152604090205481565b600b5460009060ff1661163c576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690553060009081526004602052604090205461167a670de0b6b3a764000061085761166d610f23565b849063ffffffff611ec716565b9150600082116116d1576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e3a2052454445454d5f414d4f554e545f5a45524f0000604482015290519081900360640190fd5b600a54821115611728576040805162461bcd60e51b815260206004820152601d60248201527f5661756c74546f6b656e3a20494e53554646494349454e545f43415348000000604482015290519081900360640190fd5b61173230826125d9565b600e5460135460408051630441a3e760e41b8152600481019290925260248201859052516001600160a01b039092169163441a3e709160448082019260009290919082900301818387803b15801561178957600080fd5b505af115801561179d573d6000803e3d6000fd5b505050506117ab8383612676565b604080518381526020810183905281516001600160a01b0386169233927f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc929081900390910190a35061159f61251b565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156107195780601f106106ee57610100808354040283529160200191610719565b66038d7ea4c6800081565b60006108fe3384846120b3565b6010546001600160a01b031681565b600a5481565b6103e881565b600b5460ff166118d3576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600a54600854604080516370a0823160e01b8152306004820152905161197393859361196e9391926001600160a01b03909116916370a08231916024808301926020929190829003018186803b15801561193657600080fd5b505afa15801561194a573d6000803e3d6000fd5b505050506040513d602081101561196057600080fd5b50519063ffffffff6123c616565b612676565b50600b805460ff19166001179055565b6009546001600160a01b031681565b662386f26fc1000081565b600f546001600160a01b031681565b6012546001600160a01b031681565b6119eb878787878787877f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9612808565b6119f6878787611fba565b50505050505050565b600560209081526000928352604080842090915290825290205481565b600d546001600160a01b031681565b60135481565b600c546001600160a01b031681565b600b5460ff16611a8a576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055333214611aa057600080fd5b600e5460135460408051630441a3e760e41b8152600481019290925260006024830181905290516001600160a01b039093169263441a3e7092604480820193929182900301818387803b158015611af657600080fd5b505af1158015611b0a573d6000803e3d6000fd5b5050600f5460009250611b2691506001600160a01b0316612408565b905080611b335750611e54565b6000670de0b6b3a7640000611b5360145484611ec790919063ffffffff16565b81611b5a57fe5b600f549190049150611b7c906001600160a01b0316338363ffffffff6129dd16565b600f5460115460009182916001600160a01b0390811691161480611bb05750600f546012546001600160a01b039081169116145b15611c0357600f546011546001600160a01b03908116911614611be5576012546011546001600160a01b039182169116611bf9565b6011546012546001600160a01b0391821691165b9092509050611c74565b6010546012546001600160a01b0390811691161415611c365750506012546011546001600160a01b039182169116611c4c565b50506011546012546001600160a01b0391821691165b600f54611c72906001600160a01b031683611c6d878763ffffffff6123c616565b612b30565b505b6000611c88836001600160a01b0316612408565b905060008111611c9457fe5b600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015611ce557600080fd5b505afa158015611cf9573d6000803e3d6000fd5b505050506040513d6060811015611d0f57600080fd5b5080516020909101516011546001600160701b039283169450911691506000906001600160a01b03878116911614611d475781611d49565b825b90506000611d5f8583611d5a611213565b612d60565b9050611d6c878783612dfb565b6000611d9a8888611d83898663ffffffff6123c616565b611d958b6001600160a01b0316612408565b613000565b600e5460135460408051631c57762b60e31b8152600481019290925260248201849052519293506001600160a01b039091169163e2bbb1589160448082019260009290919082900301818387803b158015611df457600080fd5b505af1158015611e08573d6000803e3d6000fd5b5050604080518d8152602081018d905281513394507fc003f45bc224d116b6d079100d4ab57a5b9633244c47a5a92a176c5b79a85f2893509081900390910190a2505050505050505050505b611e5c61251b565b600b805460ff19166001179055565b600b5460ff16611eb5576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055611e5c61251b565b600082611ed657506000610902565b82820282848281611ee357fe5b04146109e65760405162461bcd60e51b815260040180806020018281038252602181526020018061367f6021913960400191505060405180910390fd5b60006109e683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506130cf565b6000600160701b8210611fb2576040805162461bcd60e51b81526020600482015260136024820152722b30bab63a2a37b5b2b71d1029a0a32298989960691b604482015290519081900360640190fd5b50805b919050565b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600081848411156120ab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612070578181015183820152602001612058565b50505050905090810190601f16801561209d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b604080518082018252601881527f5461726f743a205452414e534645525f544f4f5f4849474800000000000000006020808301919091526001600160a01b03861660009081526004909152919091205461211491839063ffffffff61201c16565b6001600160a01b038085166000908152600460205260408082209390935590841681522054612149908263ffffffff61313416565b6001600160a01b0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b81516121b8906000906020850190613594565b5080516121cc906001906020840190613594565b50604051469080605261362d8239604080519182900360520182208651602097880120838301835260018452603160f81b93880193909352815180880191909152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606083015260808201939093523060a0808301919091528351808303909101815260c090910190925250805192019190912060065550565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b602083106122ea5780518252601f1990920191602091820191016122cb565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461234c576040519150601f19603f3d011682016040523d82523d6000602084013e612351565b606091505b509150915081801561237f57508051158061237f575080806020019051602081101561237c57600080fd5b50515b6123bf576040805162461bcd60e51b815260206004820152600c60248201526b2173616665417070726f766560a01b604482015290519081900360640190fd5b5050505050565b60006109e683836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f770081525061201c565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b15801561245257600080fd5b505afa158015612466573d6000803e3d6000fd5b505050506040513d602081101561247c57600080fd5b505192915050565b600354612497908263ffffffff61313416565b6003556001600160a01b0382166000908152600460205260409020546124c3908263ffffffff61313416565b6001600160a01b03831660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600e54601354604080516393f1a40b60e01b8152600481019290925230602483015280516000936001600160a01b0316926393f1a40b926044808301939192829003018186803b15801561256e57600080fd5b505afa158015612582573d6000803e3d6000fd5b505050506040513d604081101561259857600080fd5b5051600a8190556040805182815290519192507f8a0df8ef054fae2c3d2d19a7b322e864870cc9fd3cb07fb9526309c596244bf4919081900360200190a150565b6001600160a01b038216600090815260046020526040902054612602908263ffffffff6123c616565b6001600160a01b03831660009081526004602052604090205560035461262e908263ffffffff6123c616565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600854604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0386811660248301526044808301879052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009560609594169382918083835b602083106127235780518252601f199092019160209182019101612704565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612785576040519150601f19603f3d011682016040523d82523d6000602084013e61278a565b606091505b50915091508180156127b85750805115806127b857508080602001905160208110156127b557600080fd5b50515b612802576040805162461bcd60e51b815260206004820152601660248201527515185c9bdd0e881514905394d1915497d1905253115160521b604482015290519081900360640190fd5b50505050565b4285101561284e576040805162461bcd60e51b815260206004820152600e60248201526d15185c9bdd0e881156141254915160921b604482015290519081900360640190fd5b6006546001600160a01b03808a1660008181526007602090815260408083208054600180820190925582518085018a905280840196909652958e166060860152608085018d905260a085019590955260c08085018c90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff8a166101828501526101a284018990526101c28401889052519193926101e280820193601f1981019281900390910190855afa15801561294a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906129805750896001600160a01b0316816001600160a01b0316145b6129d1576040805162461bcd60e51b815260206004820152601860248201527f5461726f743a20494e56414c49445f5349474e41545552450000000000000000604482015290519081900360640190fd5b50505050505050505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b60208310612a5a5780518252601f199092019160209182019101612a3b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612abc576040519150601f19603f3d011682016040523d82523d6000602084013e612ac1565b606091505b5091509150818015612aef575080511580612aef5750808060200190516020811015612aec57600080fd5b50515b6123bf576040805162461bcd60e51b815260206004820152600d60248201526c10b9b0b332aa3930b739b332b960991b604482015290519081900360640190fd5b6000826001600160a01b0316846001600160a01b03161415612b535750806109e6565b600b546040805163711f958560e11b81526001600160a01b038781166004830152915161010090930490911691600091839163e23f2b0a91602480820192602092909190829003018186803b158015612bab57600080fd5b505afa158015612bbf573d6000803e3d6000fd5b505050506040513d6020811015612bd557600080fd5b505190506001600160a01b038082169086161415612c0257612bf98287878761318e565b925050506109e6565b6000826001600160a01b031663e23f2b0a876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015612c5a57600080fd5b505afa158015612c6e573d6000803e3d6000fd5b505050506040513d6020811015612c8457600080fd5b505190506001600160a01b038781169082161415612cb257612ca88388888861318e565b93505050506109e6565b6000876001600160a01b0316836001600160a01b031614612ce057612cd98489858961318e565b9050612ce3565b50845b816001600160a01b0316836001600160a01b03161415612d1457612d098484898461318e565b9450505050506109e6565b866001600160a01b0316826001600160a01b03161415612d3957612d09838883612b30565b6000612d46848484612b30565b9050612d5485848a8461318e565b955050505050506109e6565b600080612d79846114b36103e88663ffffffff61313416565b90506000612d98846114b360048189818c6103e863ffffffff611ec716565b90506000612dc4612dbf83612db3868063ffffffff611ec716565b9063ffffffff61313416565b613494565b90506000612dd960028763ffffffff611ec716565b9050612def81610857848763ffffffff6123c616565b98975050505050505050565b60408051600280825260608083018452926020830190803883390190505090508381600081518110612e2957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508281600181518110612e5757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050612e8184836134e5565b600c546040516338ed173960e01b8152600481018481526000602483018190523060648401819052426084850181905260a060448601908152875160a487015287516001600160a01b03909716966338ed1739968a968a9594939092909160c40190602080880191028083838b5b83811015612f07578181015183820152602001612eef565b505050509050019650505050505050600060405180830381600087803b158015612f3057600080fd5b505af1158015612f44573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015612f6d57600080fd5b8101908080516040519392919084640100000000821115612f8d57600080fd5b908301906020820185811115612fa257600080fd5b8251866020820283011164010000000082111715612fbf57600080fd5b82525081516020918201928201910280838360005b83811015612fec578181015183820152602001612fd4565b505050509050016040525050505050505050565b600061300c85846134e5565b61301684836134e5565b600c546040805162e8e33760e81b81526001600160a01b0388811660048301528781166024830152604482018790526064820186905260006084830181905260a483018190523060c48401524260e4840152925193169263e8e337009261010480840193606093929083900390910190829087803b15801561309757600080fd5b505af11580156130ab573d6000803e3d6000fd5b505050506040513d60608110156130c157600080fd5b506040015195945050505050565b6000818361311e5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315612070578181015183820152602001612058565b50600083858161312a57fe5b0495945050505050565b6000828201838110156109e6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826001600160a01b0316846001600160a01b031614156131b157508061348c565b60408051630820681160e11b8152600481018490526001600160a01b0386811660248301528581166044830152825160009391891692631040d022926064808301939192829003018186803b15801561320957600080fd5b505afa15801561321d573d6000803e3d6000fd5b505050506040513d604081101561323357600080fd5b508051602090910151925090506001600160a01b038116613285576040805162461bcd60e51b81526020600482015260076024820152662727afa820a4a960c91b604482015290519081900360640190fd5b61329f6001600160a01b038616828563ffffffff6129dd16565b836001600160a01b0316856001600160a01b031610156133a357604080516000808252602082019283905263022c0d9f60e01b835260248201818152604483018690523060648401819052608060848501908152845160a486018190526001600160a01b0388169663022c0d9f968a9590939092909160c48501918083838b5b8381101561333757818101518382015260200161331f565b50505050905090810190601f1680156133645780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561338657600080fd5b505af115801561339a573d6000803e3d6000fd5b5050505061348a565b604080516000808252602082019283905263022c0d9f60e01b835260248201858152604483018290523060648401819052608060848501908152845160a486018190526001600160a01b0388169663022c0d9f968a969590939092909160c48501918083838a5b8381101561342257818101518382015260200161340a565b50505050905090810190601f16801561344f5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561347157600080fd5b505af1158015613485573d6000803e3d6000fd5b505050505b505b949350505050565b600060038211156134d7575080600160028204015b818110156134d1578091506002818285816134c057fe5b0401816134c957fe5b0490506134a9565b50611fb5565b8115611fb557506001919050565b600c5460408051636eb1769f60e11b81523060048201526001600160a01b0392831660248201529051839285169163dd62ed3e916044808301926020929190829003018186803b15801561353857600080fd5b505afa15801561354c573d6000803e3d6000fd5b505050506040513d602081101561356257600080fd5b50511061356e57613590565b600c54613590906001600160a01b03848116911660001963ffffffff61226d16565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106135d557805160ff1916838001178555613602565b82800160010185558215613602579182015b828111156136025782518255916020019190600101906135e7565b5061360e929150613612565b5090565b610f7091905b8082111561360e576000815560010161361856fe454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775661756c74546f6b656e3a20494e564c445f5245494e564553545f424f554e54595661756c74546f6b656e3a20494e53554646494349454e545f5245534552564553a265627a7a7231582014f6d6e5d60f86f85e08ace7190a65e855bc7bfe73e9afb79b4e5ca9caa7abcd64736f6c634300051000324f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a72315820c8e163ffa651fe42afe7903b6523f17458559b3d7cfff683c487f305f7ad6b5764736f6c63430005100032000000000000000000000000d04f1a8182d5670e42ba9ee0ce9ffc71e6d1fc180000000000000000000000006d0176c5ea1e44b08d3dd001b0784ce42f47a3a7000000000000000000000000cc0a87f7e7c693042a9cc703661f5060c80acb430000000000000000000000004cdf39285d7ca8eb3f090fda0c069ba5f4145b37

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

000000000000000000000000d04f1a8182d5670e42ba9ee0ce9ffc71e6d1fc180000000000000000000000006d0176c5ea1e44b08d3dd001b0784ce42f47a3a7000000000000000000000000cc0a87f7e7c693042a9cc703661f5060c80acb430000000000000000000000004cdf39285d7ca8eb3f090fda0c069ba5f4145b37

-----Decoded View---------------
Arg [0] : _optiSwap (address): 0xd04f1a8182d5670e42ba9ee0ce9ffc71e6d1fc18
Arg [1] : _router (address): 0x6d0176c5ea1e44b08d3dd001b0784ce42f47a3a7
Arg [2] : _masterChef (address): 0xcc0a87f7e7c693042a9cc703661f5060c80acb43
Arg [3] : _rewardsToken (address): 0x4cdf39285d7ca8eb3f090fda0c069ba5f4145b37

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000d04f1a8182d5670e42ba9ee0ce9ffc71e6d1fc18
Arg [1] : 0000000000000000000000006d0176c5ea1e44b08d3dd001b0784ce42f47a3a7
Arg [2] : 000000000000000000000000cc0a87f7e7c693042a9cc703661f5060c80acb43
Arg [3] : 0000000000000000000000004cdf39285d7ca8eb3f090fda0c069ba5f4145b37


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
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.