ETH Price: $3,994.32 (+2.29%)

Contract

0x0d1c6Da0EB5539f9F790aD106B8f74EABabF46d9
Transaction Hash
Method
Block
From
To
Reinvest1289597892024-12-06 20:52:357 hrs ago1733518355IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000004310010.00000099
Reinvest1289067812024-12-05 15:25:3937 hrs ago1733412339IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000005573720.00000059
Reinvest1288339932024-12-03 22:59:233 days ago1733266763IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001778390.00000067
Reinvest1287922702024-12-02 23:48:374 days ago1733183317IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001920690.0000008
Reinvest1287499922024-12-02 0:19:215 days ago1733098761IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001011240.00000054
Reinvest1287256342024-12-01 10:47:255 days ago1733050045IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000000992830.00000054
Reinvest1287045962024-11-30 23:06:096 days ago1733007969IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001082670.00000067
Reinvest1286811512024-11-30 10:04:396 days ago1732961079IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000000610360.0000007
Reinvest1286666632024-11-30 2:01:437 days ago1732932103IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000000688520.00000907
Reinvest1286526262024-11-29 18:13:497 days ago1732904029IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001101660.00000049
Reinvest1286279542024-11-29 4:31:258 days ago1732854685IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000000448380.00000484
Reinvest1286172832024-11-28 22:35:438 days ago1732833343IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000002791560.00000043
Reinvest1285764772024-11-27 23:55:319 days ago1732751731IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001167590.00001572
Reinvest1285513212024-11-27 9:56:599 days ago1732701419IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000000694910.00000056
Reinvest1285324952024-11-26 23:29:2710 days ago1732663767IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000002148220.00000048
Reinvest1284849762024-11-25 21:05:2911 days ago1732568729IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001694330.00000033
Reinvest1284407672024-11-24 20:31:5112 days ago1732480311IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000002522870.00000044
Reinvest1283944322024-11-23 18:47:2113 days ago1732387641IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001255480.00000118
Reinvest1283546812024-11-22 20:42:1914 days ago1732308139IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001607210.00000038
Reinvest1283147202024-11-21 22:30:1715 days ago1732228217IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001208970.00000829
Reinvest1282709862024-11-20 22:12:2916 days ago1732140749IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001084410.00000359
Reinvest1282279612024-11-19 22:18:1917 days ago1732054699IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000000957640.00000061
Reinvest1281843632024-11-18 22:05:0318 days ago1731967503IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000001094350.00000101
Reinvest1281311812024-11-17 16:32:1919 days ago1731861139IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000002029650.0000006
Reinvest1280451622024-11-15 16:45:0121 days ago1731689101IN
0x0d1c6Da0...ABabF46d9
0 ETH0.0000007626180.00010099
View all transactions

Latest 9 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
1070868472023-07-19 13:14:31506 days ago1689772471
0x0d1c6Da0...ABabF46d9
0 ETH
1070868472023-07-19 13:14:31506 days ago1689772471
0x0d1c6Da0...ABabF46d9
0 ETH
1070867932023-07-19 13:12:43506 days ago1689772363
0x0d1c6Da0...ABabF46d9
0 ETH
1070867932023-07-19 13:12:43506 days ago1689772363
0x0d1c6Da0...ABabF46d9
0 ETH
1063976032023-07-03 14:19:43522 days ago1688393983
0x0d1c6Da0...ABabF46d9
0 ETH
1063976032023-07-03 14:19:43522 days ago1688393983
0x0d1c6Da0...ABabF46d9
0 ETH
1063953392023-07-03 13:04:15522 days ago1688389455
0x0d1c6Da0...ABabF46d9
0 ETH
1063953392023-07-03 13:04:15522 days ago1688389455
0x0d1c6Da0...ABabF46d9
0 ETH
162537332022-07-28 14:56:33862 days ago1659020193  Contract Creation0 ETH

Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x2585D583...7F0F3D18e
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
VeloVaultToken

Compiler Version
v0.5.16+commit.9c3226ce

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : VeloVaultToken.sol
pragma solidity =0.5.16;

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

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

contract VeloVaultToken is IVeloVaultToken, PoolToken {
    using SafeToken for address;

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

    address public optiSwap;
    address public router;
    address public voter;
    address public gauge;
    address public pairFactory;
    address public rewardsToken;
    address public WETH;
    address public token0;
    address public token1;

    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 _underlying,
        address _optiSwap,
        address _router,
        address _voter,
        address _pairFactory,
        address _rewardsToken
    ) external {
        require(factory == address(0), "VaultToken: FACTORY_ALREADY_SET"); // sufficient check
        factory = msg.sender;
        _setName("Tarot Vault Token", "vTAROT");
        underlying = _underlying;
        optiSwap = _optiSwap;
        voter = _voter;
        gauge = IVeloVoter(voter).gauges(underlying);
        require(gauge != address(0), "VaultToken: NO_GAUGE");
        router = _router;
        pairFactory = _pairFactory;
        WETH = IVeloRouter(_router).weth();
        (token0, token1) = IBaseV1Pair(_underlying).tokens();
        rewardsToken = _rewardsToken;
        rewardsToken.safeApprove(address(router), uint256(-1));
        WETH.safeApprove(address(router), uint256(-1));
        underlying.safeApprove(address(gauge), 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 = IVeloGauge(gauge).balanceOf(address(this));
        totalBalance = _totalBalance;
        emit Sync(_totalBalance);
    }

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

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

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

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

    /*** Reinvest ***/

    function _optimalDepositA(
        uint256 _amountA,
        uint256 _reserveA
    ) internal view returns (uint256) {
        uint256 swapFee = IVeloPairFactory(pairFactory).getFee(false);
        uint256 swapFeeFactor = uint256(10000).sub(swapFee);
        uint256 a = uint256(10000).add(swapFeeFactor).mul(_reserveA);
        uint256 b = _amountA.mul(10000).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), router) >= amount) return;
        token.safeApprove(address(router), uint256(-1));
    }

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

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

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

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

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

        return rewardsToken.myBalance();
    }

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

    function reinvest() external nonReentrant update {
        require(msg.sender == tx.origin);
        // 1. Withdraw all the rewards.
        uint256 reward = _getReward();
        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);
        swapExactTokensForTokens(tokenA, tokenB, swapAmount);
        uint256 liquidity = addLiquidity(tokenA, tokenB, totalAmountA.sub(swapAmount), tokenB.myBalance());
        // 5. Stake the LP Tokens.
        IVeloGauge(gauge).deposit(liquidity, 0);
        emit Reinvest(msg.sender, reward, bounty);
    }

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

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

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

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

    /*** Mirrored From uniswapV2Pair ***/

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

    /*** Mirrored from BaseV1Pair ***/

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

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

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

    /*** Utilities ***/

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

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

    /*** Modifiers ***/

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

File 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 : 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 4 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 5 of 18 : IVeloVoter.sol
pragma solidity >=0.5.0;

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

File 6 of 18 : IVeloPairFactory.sol
pragma solidity >=0.5.0;

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

File 7 of 18 : IVeloGauge.sol
pragma solidity >=0.5.0;

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

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

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

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

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

File 9 of 18 : IBaseV1Pair.sol
pragma solidity >=0.5.0;

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

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

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

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

File 10 of 18 : IVeloVaultToken.sol
pragma solidity >=0.5.0;

interface IVeloVaultToken {
    /*** 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 stable() external pure returns (bool);

    function optiSwap() external view returns (address);

    function router() external view returns (address);

    function voter() external view returns (address);

    function pairFactory() external view returns (address);

    function rewardsToken() external view returns (address);

    function WETH() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function REINVEST_BOUNTY() external view returns (uint256);

    function updateReinvestBounty(uint256 _newReinvestBounty) external;

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

    function observationLength() external view returns (uint);

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

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

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

    function reinvest() external;

    function getReward() external returns (uint256);

    function getBlockTimestamp() external view returns (uint32);

    function adminClaimRewards(address[] calldata _tokens) external;

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

File 11 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 12 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 13 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 14 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 15 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 16 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 17 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;
}

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

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"uint256","name":"mintAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"mintTokens","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"address","name":"redeemer","type":"address"},{"indexed":false,"internalType":"uint256","name":"redeemAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"redeemTokens","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bounty","type":"uint256"}],"name":"Reinvest","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"}],"name":"Sync","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_newReinvestBounty","type":"uint256"}],"name":"UpdateReinvestBounty","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MAX_REINVEST_BOUNTY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MIN_REINVEST_BOUNTY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"REINVEST_BOUNTY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_underlying","type":"address"},{"internalType":"address","name":"_optiSwap","type":"address"},{"internalType":"address","name":"_router","type":"address"},{"internalType":"address","name":"_voter","type":"address"},{"internalType":"address","name":"_pairFactory","type":"address"},{"internalType":"address","name":"_rewardsToken","type":"address"}],"name":"_initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"_setFactory","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"adminClaimRewards","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"adminRescueTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentCumulativePrices","outputs":[{"internalType":"uint256","name":"reserve0Cumulative","type":"uint256"},{"internalType":"uint256","name":"reserve1Cumulative","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"exchangeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"gauge","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getBlockTimestamp","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"reserve0","type":"uint112"},{"internalType":"uint112","name":"reserve1","type":"uint112"},{"internalType":"uint32","name":"blockTimestampLast","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"getReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isVaultToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"minter","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"mintTokens","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"observationLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"observations","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"reserve0Cumulative","type":"uint256"},{"internalType":"uint256","name":"reserve1Cumulative","type":"uint256"}],"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":"pairFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"redeemer","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"redeemAmount","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"reinvest","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"underlying","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_newReinvestBounty","type":"uint256"}],"name":"updateReinvestBounty","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"voter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102a05760003560e01c8063796b89b911610167578063c8c4ff8c116100ce578063ebeb31db11610087578063ebeb31db14610746578063ef3469e51461074e578063f887ea40146107bc578063fb71e1c8146107c4578063fdb5a03e14610812578063fff6cae91461081a576102a0565b8063c8c4ff8c146106a7578063d1af0c7d146106af578063d21220a7146106b7578063d505accf146106bf578063dd62ed3e14610710578063e14f870d1461073e576102a0565b8063a9059cbb11610120578063a9059cbb14610635578063ad5c464814610661578063ad7a672f14610669578063ba9a7a5614610671578063bc25cf7714610679578063c45a01551461069f576102a0565b8063796b89b9146105b05780637ecebe00146105d157806395a2251f146105f757806395d89b411461061d57806396fa4c1114610625578063a6f19c841461062d576102a0565b80633644e5151161020b57806360c2affa116101c457806360c2affa146105445780636a6278421461054c5780636c2a3bc5146105725780636ee272271461057a5780636f307dc31461058257806370a082311461058a576102a0565b80633644e515146104ff5780633ba0b9a9146105075780633d18b9121461050f57806346c96aac1461051757806346fb738b1461051f5780634a5d316c1461053c576102a0565b806322be3de11161025d57806322be3de1146103fe57806323b872dd14610406578063252c09d71461043c57806329a105221461045957806330adf81f146104d9578063313ce567146104e1576102a0565b806306fdde03146102a55780630902f1ac14610322578063095ea7b31461035a5780630dfe16811461039a57806318160ddd146103be5780631df8c717146103d8575b600080fd5b6102ad610822565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102e75781810151838201526020016102cf565b50505050905090810190601f1680156103145780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61032a6108b0565b604080516001600160701b03948516815292909316602083015263ffffffff168183015290519081900360600190f35b6103866004803603604081101561037057600080fd5b506001600160a01b038135169060200135610abe565b604080519115158252519081900360200190f35b6103a2610ad5565b604080516001600160a01b039092168252519081900360200190f35b6103c6610ae4565b60408051918252519081900360200190f35b6103e0610aea565b60408051938452602084019290925282820152519081900360600190f35b610386610b80565b6103866004803603606081101561041c57600080fd5b506001600160a01b03813581169160208101359091169060400135610b85565b6103e06004803603602081101561045257600080fd5b5035610c55565b6104d76004803603604081101561046f57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561049957600080fd5b8201836020820111156104ab57600080fd5b803590602001918460208302840111600160201b831117156104cc57600080fd5b509092509050610cec565b005b6103c6611048565b6104e961106c565b6040805160ff9092168252519081900360200190f35b6103c6611075565b6103c661107b565b6103c66110cb565b6103a2611148565b6104d76004803603602081101561053557600080fd5b5035611157565b6104d76112a7565b6103a2611319565b6103c66004803603602081101561056257600080fd5b50356001600160a01b031661132d565b6103c6611626565b61038661162c565b6103a2611631565b6103c6600480360360208110156105a057600080fd5b50356001600160a01b0316611640565b6105b8611652565b6040805163ffffffff9092168252519081900360200190f35b6103c6600480360360208110156105e757600080fd5b50356001600160a01b031661165c565b6103c66004803603602081101561060d57600080fd5b50356001600160a01b031661166e565b6102ad611871565b6103c66118cb565b6103a26118d6565b6103866004803603604081101561064b57600080fd5b506001600160a01b0381351690602001356118e5565b6103a26118f2565b6103c6611901565b6103c6611907565b6104d76004803603602081101561068f57600080fd5b50356001600160a01b031661190d565b6103a2611a07565b6103c6611a16565b6103a2611a21565b6103a2611a30565b6104d7600480360360e08110156106d557600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060ff6080820135169060a08101359060c00135611a3f565b6103c66004803603604081101561072657600080fd5b506001600160a01b0381358116916020013516611a83565b6103a2611aa0565b6103c6611aaf565b6104d76004803603602081101561076457600080fd5b810190602081018135600160201b81111561077e57600080fd5b82018360208201111561079057600080fd5b803590602001918460208302840111600160201b831117156107b157600080fd5b509092509050611b25565b6103a2611ce1565b6104d7600480360360c08110156107da57600080fd5b506001600160a01b038135811691602081013582169160408201358116916060810135821691608082013581169160a0013516611cf0565b6104d7612084565b6104d7612426565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a85780601f1061087d576101008083540402835291602001916108a8565b820191906000526020600020905b81548152906001019060200180831161088b57829003601f168201915b505050505081565b600080600080600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561090757600080fd5b505afa15801561091b573d6000803e3d6000fd5b505050506040513d606081101561093157600080fd5b50805160208201516040909201516001600160701b0391821695509116925063ffffffff16905061096183612482565b955061096c82612482565b9450600160201b810693506003546000141561098b5750610ab9915050565b600a54600854604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd916004808301926020929190829003018186803b1580156109d357600080fd5b505afa1580156109e7573d6000803e3d6000fd5b505050506040513d60208110156109fd57600080fd5b50519050610a32610a2d82610a21856001600160701b038d1663ffffffff6124da16565b9063ffffffff61253316565b612482565b9750610a54610a2d82610a21856001600160701b038c1663ffffffff6124da16565b96506064886001600160701b0316118015610a7857506064876001600160701b0316115b610ab35760405162461bcd60e51b8152600401808060200182810382526021815260200180613d716021913960400191505060405180910390fd5b50505050505b909192565b6000610acb338484612575565b5060015b92915050565b6012546001600160a01b031681565b60035481565b6000806000600860009054906101000a90046001600160a01b03166001600160a01b0316631df8c7176040518163ffffffff1660e01b815260040160606040518083038186803b158015610b3d57600080fd5b505afa158015610b51573d6000803e3d6000fd5b505050506040513d6060811015610b6757600080fd5b5080516020820151604090920151909591945092509050565b600081565b6001600160a01b038316600090815260056020908152604080832033845290915281205460001914610c3f57604080518082018252601b81527f5461726f743a205452414e534645525f4e4f545f414c4c4f57454400000000006020808301919091526001600160a01b0387166000908152600582528381203382529091529190912054610c1a91849063ffffffff6125d716565b6001600160a01b03851660009081526005602090815260408083203384529091529020555b610c4a84848461266e565b5060015b9392505050565b6008546040805163252c09d760e01b8152600481018490529051600092839283926001600160a01b039092169163252c09d791602480820192606092909190829003018186803b158015610ca857600080fd5b505afa158015610cbc573d6000803e3d6000fd5b505050506040513d6060811015610cd257600080fd5b508051602082015160409092015190969195509350915050565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d6020811015610d5a57600080fd5b50516001600160a01b031614610da8576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b600b5460ff16610df2576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690556001600160a01b038316610e4e576040805162461bcd60e51b81526020600482015260146024820152735661756c74546f6b656e3a20494e564c445f544f60601b604482015290519081900360640190fd5b60005b81811015611035576000838383818110610e6757fe5b6008546001600160a01b036020909202939093013581169350919091168214159050610eda576040805162461bcd60e51b815260206004820152601960248201527f5661756c74546f6b656e3a2049535f554e4445524c59494e4700000000000000604482015290519081900360640190fd5b6010546001600160a01b0382811691161415610f3d576040805162461bcd60e51b815260206004820152601c60248201527f5661756c74546f6b656e3a2049535f524557415244535f544f4b454e00000000604482015290519081900360640190fd5b6012546001600160a01b0382811691161415610f99576040805162461bcd60e51b815260206004820152601660248201527505661756c74546f6b656e3a2049535f544f4b454e5f360541b604482015290519081900360640190fd5b6013546001600160a01b0382811691161415610ff5576040805162461bcd60e51b81526020600482015260166024820152755661756c74546f6b656e3a2049535f544f4b454e5f3160501b604482015290519081900360640190fd5b6000611009826001600160a01b0316612760565b9050801561102b5761102b6001600160a01b038316878363ffffffff6127dc16565b5050600101610e51565b5050600b805460ff191660011790555050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60025460ff1681565b60065481565b600354600a5460009190811580611090575080155b156110a757670de0b6b3a7640000925050506110c8565b6110c382610a2183670de0b6b3a764000063ffffffff6124da16565b925050505b90565b600b5460009060ff16611118576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff1916905533321461112e57600080fd5b611136612936565b9050600b805460ff1916600117905590565b600d546001600160a01b031681565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b15801561119b57600080fd5b505afa1580156111af573d6000803e3d6000fd5b505050506040513d60208110156111c557600080fd5b50516001600160a01b031614611213576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b66038d7ea4c6800081101580156112315750662386f26fc100008111155b61126c5760405162461bcd60e51b8152600401808060200182810382526021815260200180613d506021913960400191505060405180910390fd5b60148190556040805182815290517ffa1e13889c5c5294758f01f045a83de15feca61a17e6281f4d11a5110085d9329181900360200190a150565b6009546001600160a01b031615611305576040805162461bcd60e51b815260206004820152601a60248201527f5461726f743a20464143544f52595f414c52454144595f534554000000000000604482015290519081900360640190fd5b600980546001600160a01b03191633179055565b600b5461010090046001600160a01b031681565b600b5460009060ff1661137a576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff1916905560085460009061139c906001600160a01b0316612760565b600e54604080516370a0823160e01b815230600482015290519293506000926001600160a01b03909216916370a0823191602480820192602092909190829003018186803b1580156113ed57600080fd5b505afa158015611401573d6000803e3d6000fd5b505050506040513d602081101561141757600080fd5b5051600e5460408051631c57762b60e31b81526004810186905260006024820181905291519394506001600160a01b039092169263e2bbb15892604480820193929182900301818387803b15801561146e57600080fd5b505af1158015611482573d6000803e3d6000fd5b5050600e54604080516370a0823160e01b81523060048201529051600094506001600160a01b0390921692506370a08231916024808301926020929190829003018186803b1580156114d357600080fd5b505afa1580156114e7573d6000803e3d6000fd5b505050506040513d60208110156114fd57600080fd5b5051905061153461150c61107b565b610a21670de0b6b3a7640000611528858763ffffffff612a4f16565b9063ffffffff6124da16565b93506003546000141561156257611553846103e863ffffffff612a4f16565b935061156260006103e8612a91565b600084116115b7576040805162461bcd60e51b815260206004820152601c60248201527f5661756c74546f6b656e3a204d494e545f414d4f554e545f5a45524f00000000604482015290519081900360640190fd5b6115c18585612a91565b604080518481526020810186905281516001600160a01b0388169233927f2f00e3cdd69a77be7ed215ec7b2a36784dd158f921fca79ac29deffa353fe6ee929081900390910190a3505050611614612b28565b600b805460ff19166001179055919050565b60145481565b600181565b6008546001600160a01b031681565b60046020526000908152604090205481565b63ffffffff421690565b60076020526000908152604090205481565b600b5460009060ff166116bb576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055306000908152600460205260409020546116f9670de0b6b3a7640000610a216116ec61107b565b849063ffffffff6124da16565b915060008211611750576040805162461bcd60e51b815260206004820152601e60248201527f5661756c74546f6b656e3a2052454445454d5f414d4f554e545f5a45524f0000604482015290519081900360640190fd5b600a548211156117a7576040805162461bcd60e51b815260206004820152601d60248201527f5661756c74546f6b656e3a20494e53554646494349454e545f43415348000000604482015290519081900360640190fd5b6117b13082612bde565b600e5460408051632e1a7d4d60e01b81526004810185905290516001600160a01b0390921691632e1a7d4d9160248082019260009290919082900301818387803b1580156117fe57600080fd5b505af1158015611812573d6000803e3d6000fd5b505050506118208383612c7b565b604080518381526020810183905281516001600160a01b0386169233927f3f693fff038bb8a046aa76d9516190ac7444f7d69cf952c4cbdc086fdef2d6fc929081900390910190a350611614612b28565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156108a85780601f1061087d576101008083540402835291602001916108a8565b66038d7ea4c6800081565b600e546001600160a01b031681565b6000610acb33848461266e565b6011546001600160a01b031681565b600a5481565b6103e881565b600b5460ff16611957576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600a54600854604080516370a0823160e01b815230600482015290516119f79385936119f29391926001600160a01b03909116916370a08231916024808301926020929190829003018186803b1580156119ba57600080fd5b505afa1580156119ce573d6000803e3d6000fd5b505050506040513d60208110156119e457600080fd5b50519063ffffffff612a4f16565b612c7b565b50600b805460ff19166001179055565b6009546001600160a01b031681565b662386f26fc1000081565b6010546001600160a01b031681565b6013546001600160a01b031681565b611a6f878787878787877f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9612e0d565b611a7a878787612575565b50505050505050565b600560209081526000928352604080842090915290825290205481565b600f546001600160a01b031681565b6008546040805163ebeb31db60e01b815290516000926001600160a01b03169163ebeb31db916004808301926020929190829003018186803b158015611af457600080fd5b505afa158015611b08573d6000803e3d6000fd5b505050506040513d6020811015611b1e57600080fd5b5051905090565b60095460408051638da5cb5b60e01b8152905133926001600160a01b031691638da5cb5b916004808301926020929190829003018186803b158015611b6957600080fd5b505afa158015611b7d573d6000803e3d6000fd5b505050506040513d6020811015611b9357600080fd5b50516001600160a01b031614611be1576040805162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b604482015290519081900360640190fd5b600b5460ff16611c2b576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055600e54604080516331279d3d60e01b8152306004820181815260248301938452604483018690526001600160a01b03909416936331279d3d9391928792879291606401846020850280828437600081840152601f19601f820116905080830192505050945050505050600060405180830381600087803b158015611cb857600080fd5b505af1158015611ccc573d6000803e3d6000fd5b5050600b805460ff1916600117905550505050565b600c546001600160a01b031681565b6009546001600160a01b031615611d4e576040805162461bcd60e51b815260206004820152601f60248201527f5661756c74546f6b656e3a20464143544f52595f414c52454144595f53455400604482015290519081900360640190fd5b600980546001600160a01b0319163317905560408051808201825260118152702a30b937ba102b30bab63a102a37b5b2b760791b602080830191909152825180840190935260068352651d95105493d560d21b90830152611dae91612fe2565b600880546001600160a01b03199081166001600160a01b038981169190911792839055600b8054610100600160a81b0319166101008a841602179055600d805490921686821617918290556040805163b9a09fd560e01b815293821660048501525191169163b9a09fd5916024808301926020929190829003018186803b158015611e3857600080fd5b505afa158015611e4c573d6000803e3d6000fd5b505050506040513d6020811015611e6257600080fd5b5051600e80546001600160a01b0319166001600160a01b03928316179081905516611ecb576040805162461bcd60e51b81526020600482015260146024820152735661756c74546f6b656e3a204e4f5f474155474560601b604482015290519081900360640190fd5b600c80546001600160a01b038087166001600160a01b03199283168117909355600f80549186169190921617905560408051633fc8cef360e01b81529051633fc8cef391600480820192602092909190829003018186803b158015611f2f57600080fd5b505afa158015611f43573d6000803e3d6000fd5b505050506040513d6020811015611f5957600080fd5b5051601180546001600160a01b0319166001600160a01b0392831617905560408051634eb1c24560e11b8152815192891692639d63848a92600480840193919291829003018186803b158015611fae57600080fd5b505afa158015611fc2573d6000803e3d6000fd5b505050506040513d6040811015611fd857600080fd5b508051602090910151601380546001600160a01b03199081166001600160a01b039384161790915560128054821693831693909317909255601080549092168382161791829055600c5461203292821691166000196130aa565b600c54601154612057916001600160a01b03918216911660001963ffffffff6130aa16565b600e5460085461207c916001600160a01b03918216911660001963ffffffff6130aa16565b505050505050565b600b5460ff166120ce576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff191690553332146120e457600080fd5b60006120ee612936565b9050806120fb575061240f565b6000670de0b6b3a764000061211b601454846124da90919063ffffffff16565b8161212257fe5b6010549190049150612144906001600160a01b0316338363ffffffff6127dc16565b60105460125460009182916001600160a01b039081169116148061217857506010546013546001600160a01b039081169116145b156121cb576010546012546001600160a01b039081169116146121ad576013546012546001600160a01b0391821691166121c1565b6012546013546001600160a01b0391821691165b909250905061223c565b6011546013546001600160a01b03908116911614156121fe5750506013546012546001600160a01b039182169116612214565b50506012546013546001600160a01b0391821691165b60105461223a906001600160a01b031683612235878763ffffffff612a4f16565b6131fc565b505b6000612250836001600160a01b0316612760565b90506000811161225c57fe5b600080600860009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156122ad57600080fd5b505afa1580156122c1573d6000803e3d6000fd5b505050506040513d60608110156122d757600080fd5b5080516020909101516012546001600160701b039283169450911691506000906001600160a01b0387811691161461230f5781612311565b825b9050600061231f858361342c565b905061232c87878361355c565b600061235a8888612343898663ffffffff612a4f16565b6123558b6001600160a01b0316612760565b6136a7565b600e5460408051631c57762b60e31b81526004810184905260006024820181905291519394506001600160a01b039092169263e2bbb15892604480820193929182900301818387803b1580156123af57600080fd5b505af11580156123c3573d6000803e3d6000fd5b5050604080518d8152602081018d905281513394507fc003f45bc224d116b6d079100d4ab57a5b9633244c47a5a92a176c5b79a85f2893509081900390910190a2505050505050505050505b612417612b28565b600b805460ff19166001179055565b600b5460ff16612470576040805162461bcd60e51b815260206004820152601060248201526f15185c9bdd0e8814915153951154915160821b604482015290519081900360640190fd5b600b805460ff19169055612417612b28565b6000600160701b82106124d2576040805162461bcd60e51b81526020600482015260136024820152722b30bab63a2a37b5b2b71d1029a0a32298989960691b604482015290519081900360640190fd5b50805b919050565b6000826124e957506000610acf565b828202828482816124f657fe5b0414610c4e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613d2f6021913960400191505060405180910390fd5b6000610c4e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061377f565b6001600160a01b03808416600081815260056020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600081848411156126665760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561262b578181015183820152602001612613565b50505050905090810190601f1680156126585780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b604080518082018252601881527f5461726f743a205452414e534645525f544f4f5f4849474800000000000000006020808301919091526001600160a01b0386166000908152600490915291909120546126cf91839063ffffffff6125d716565b6001600160a01b038085166000908152600460205260408082209390935590841681522054612704908263ffffffff6137e416565b6001600160a01b0380841660008181526004602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b1580156127aa57600080fd5b505afa1580156127be573d6000803e3d6000fd5b505050506040513d60208110156127d457600080fd5b505192915050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b602083106128595780518252601f19909201916020918201910161283a565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146128bb576040519150601f19603f3d011682016040523d82523d6000602084013e6128c0565b606091505b50915091508180156128ee5750805115806128ee57508080602001905160208110156128eb57600080fd5b50515b61292f576040805162461bcd60e51b815260206004820152600d60248201526c10b9b0b332aa3930b739b332b960991b604482015290519081900360640190fd5b5050505050565b6040805160018082528183019092526000916060919060208083019080388339505060105482519293506001600160a01b03169183915060009061297657fe5b6001600160a01b03928316602091820292909201810191909152600e54604080516331279d3d60e01b815230600482018181526024830193845287516044840152875194909616956331279d3d959194889491939192606490920191858101910280838360005b838110156129f55781810151838201526020016129dd565b505050509050019350505050600060405180830381600087803b158015612a1b57600080fd5b505af1158015612a2f573d6000803e3d6000fd5b5050601054612a4992506001600160a01b03169050612760565b91505090565b6000610c4e83836040518060400160405280601f81526020017f536166654d6174683a207375627472616374696f6e20756e646572666c6f77008152506125d7565b600354612aa4908263ffffffff6137e416565b6003556001600160a01b038216600090815260046020526040902054612ad0908263ffffffff6137e416565b6001600160a01b03831660008181526004602090815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600e54604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015612b7357600080fd5b505afa158015612b87573d6000803e3d6000fd5b505050506040513d6020811015612b9d57600080fd5b5051600a8190556040805182815290519192507f8a0df8ef054fae2c3d2d19a7b322e864870cc9fd3cb07fb9526309c596244bf4919081900360200190a150565b6001600160a01b038216600090815260046020526040902054612c07908263ffffffff612a4f16565b6001600160a01b038316600090815260046020526040902055600354612c33908263ffffffff612a4f16565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600854604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0386811660248301526044808301879052845180840390910181526064909201845291810180516001600160e01b031663a9059cbb60e01b1781529251815160009560609594169382918083835b60208310612d285780518252601f199092019160209182019101612d09565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612d8a576040519150601f19603f3d011682016040523d82523d6000602084013e612d8f565b606091505b5091509150818015612dbd575080511580612dbd5750808060200190516020811015612dba57600080fd5b50515b612e07576040805162461bcd60e51b815260206004820152601660248201527515185c9bdd0e881514905394d1915497d1905253115160521b604482015290519081900360640190fd5b50505050565b42851015612e53576040805162461bcd60e51b815260206004820152600e60248201526d15185c9bdd0e881156141254915160921b604482015290519081900360640190fd5b6006546001600160a01b03808a1660008181526007602090815260408083208054600180820190925582518085018a905280840196909652958e166060860152608085018d905260a085019590955260c08085018c90528151808603909101815260e08501825280519083012061190160f01b6101008601526101028501969096526101228085019690965280518085039096018652610142840180825286519683019690962095839052610162840180825286905260ff8a166101828501526101a284018990526101c28401889052519193926101e280820193601f1981019281900390910190855afa158015612f4f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615801590612f855750896001600160a01b0316816001600160a01b0316145b612fd6576040805162461bcd60e51b815260206004820152601860248201527f5461726f743a20494e56414c49445f5349474e41545552450000000000000000604482015290519081900360640190fd5b50505050505050505050565b8151612ff5906000906020850190613c44565b508051613009906001906020840190613c44565b506040514690806052613cdd8239604080519182900360520182208651602097880120838301835260018452603160f81b93880193909352815180880191909152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6606083015260808201939093523060a0808301919091528351808303909101815260c090910190925250805192019190912060065550565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663095ea7b360e01b178152925182516000946060949389169392918291908083835b602083106131275780518252601f199092019160209182019101613108565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613189576040519150601f19603f3d011682016040523d82523d6000602084013e61318e565b606091505b50915091508180156131bc5750805115806131bc57508080602001905160208110156131b957600080fd5b50515b61292f576040805162461bcd60e51b815260206004820152600c60248201526b2173616665417070726f766560a01b604482015290519081900360640190fd5b6000826001600160a01b0316846001600160a01b0316141561321f575080610c4e565b600b546040805163711f958560e11b81526001600160a01b038781166004830152915161010090930490911691600091839163e23f2b0a91602480820192602092909190829003018186803b15801561327757600080fd5b505afa15801561328b573d6000803e3d6000fd5b505050506040513d60208110156132a157600080fd5b505190506001600160a01b0380821690861614156132ce576132c58287878761383e565b92505050610c4e565b6000826001600160a01b031663e23f2b0a876040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561332657600080fd5b505afa15801561333a573d6000803e3d6000fd5b505050506040513d602081101561335057600080fd5b505190506001600160a01b03878116908216141561337e576133748388888861383e565b9350505050610c4e565b6000876001600160a01b0316836001600160a01b0316146133ac576133a58489858961383e565b90506133af565b50845b816001600160a01b0316836001600160a01b031614156133e0576133d58484898461383e565b945050505050610c4e565b866001600160a01b0316826001600160a01b03161415613405576133d58388836131fc565b60006134128484846131fc565b905061342085848a8461383e565b95505050505050610c4e565b600f5460408051632895a2f560e11b81526000600482018190529151919283926001600160a01b039091169163512b45ea916024808301926020929190829003018186803b15801561347d57600080fd5b505afa158015613491573d6000803e3d6000fd5b505050506040513d60208110156134a757600080fd5b5051905060006134bf6127108363ffffffff612a4f16565b905060006134d9856115286127108563ffffffff6137e416565b905060006134f8836115286004818a818d61271063ffffffff6124da16565b9050600061352461351f83613513868063ffffffff6124da16565b9063ffffffff6137e416565b613b44565b9050600061353960028663ffffffff6124da16565b905061354f81610a21848763ffffffff612a4f16565b9998505050505050505050565b6135668382613b95565b600c54604080516313dcfc5960e01b8152600481018490526000602482018190526001600160a01b0387811660448401528681166064840152608483018290523060a48401524260c4840152925192909316926313dcfc599260e48084019382900301818387803b1580156135da57600080fd5b505af11580156135ee573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561361757600080fd5b8101908080516040519392919084600160201b82111561363657600080fd5b90830190602082018581111561364b57600080fd5b82518660208202830111600160201b8211171561366757600080fd5b82525081516020918201928201910280838360005b8381101561369457818101518382015260200161367c565b5050505090500160405250505050505050565b60006136b38584613b95565b6136bd8483613b95565b600c5460408051635a47ddc360e01b81526001600160a01b0388811660048301528781166024830152600060448301819052606483018890526084830187905260a4830181905260c483018190523060e4840152426101048401529251931692635a47ddc39261012480840193606093929083900390910190829087803b15801561374757600080fd5b505af115801561375b573d6000803e3d6000fd5b505050506040513d606081101561377157600080fd5b506040015195945050505050565b600081836137ce5760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561262b578181015183820152602001612613565b5060008385816137da57fe5b0495945050505050565b600082820183811015610c4e576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826001600160a01b0316846001600160a01b03161415613861575080613b3c565b60408051630820681160e11b8152600481018490526001600160a01b0386811660248301528581166044830152825160009391891692631040d022926064808301939192829003018186803b1580156138b957600080fd5b505afa1580156138cd573d6000803e3d6000fd5b505050506040513d60408110156138e357600080fd5b508051602090910151925090506001600160a01b038116613935576040805162461bcd60e51b81526020600482015260076024820152662727afa820a4a960c91b604482015290519081900360640190fd5b61394f6001600160a01b038616828563ffffffff6127dc16565b836001600160a01b0316856001600160a01b03161015613a5357604080516000808252602082019283905263022c0d9f60e01b835260248201818152604483018690523060648401819052608060848501908152845160a486018190526001600160a01b0388169663022c0d9f968a9590939092909160c48501918083838b5b838110156139e75781810151838201526020016139cf565b50505050905090810190601f168015613a145780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015613a3657600080fd5b505af1158015613a4a573d6000803e3d6000fd5b50505050613b3a565b604080516000808252602082019283905263022c0d9f60e01b835260248201858152604483018290523060648401819052608060848501908152845160a486018190526001600160a01b0388169663022c0d9f968a969590939092909160c48501918083838a5b83811015613ad2578181015183820152602001613aba565b50505050905090810190601f168015613aff5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b158015613b2157600080fd5b505af1158015613b35573d6000803e3d6000fd5b505050505b505b949350505050565b60006003821115613b87575080600160028204015b81811015613b8157809150600281828581613b7057fe5b040181613b7957fe5b049050613b59565b506124d5565b81156124d557506001919050565b600c5460408051636eb1769f60e11b81523060048201526001600160a01b0392831660248201529051839285169163dd62ed3e916044808301926020929190829003018186803b158015613be857600080fd5b505afa158015613bfc573d6000803e3d6000fd5b505050506040513d6020811015613c1257600080fd5b505110613c1e57613c40565b600c54613c40906001600160a01b03848116911660001963ffffffff6130aa16565b5050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10613c8557805160ff1916838001178555613cb2565b82800160010185558215613cb2579182015b82811115613cb2578251825591602001919060010190613c97565b50613cbe929150613cc2565b5090565b6110c891905b80821115613cbe5760008155600101613cc856fe454950373132446f6d61696e28737472696e67206e616d652c737472696e672076657273696f6e2c75696e7432353620636861696e49642c6164647265737320766572696679696e67436f6e747261637429536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775661756c74546f6b656e3a20494e564c445f5245494e564553545f424f554e54595661756c74546f6b656e3a20494e53554646494349454e545f5245534552564553a265627a7a72315820f024fec9caf7acefbe33e356d46fed0a78d701341bb1e04a2789a34e6069d2f764736f6c63430005100032

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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