ETH Price: $3,302.63 (+3.18%)

Contract

0x3a3AE0f08cAF7C267305b99B2ce6780BdEEfC25d
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit And Swap...129024872021-07-26 14:55:571273 days ago1627311357IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0198108142
Deposit And Swap...128876242021-07-24 7:15:511276 days ago1627110951IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0049695111
Deposit And Swap...128849452021-07-23 21:09:421276 days ago1627074582IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0083770718
Deposit And Swap...128722662021-07-21 21:44:191278 days ago1626903859IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.008754719.2
Deposit And Swap...128714892021-07-21 18:53:371278 days ago1626893617IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0164108536
Deposit And Swap...128668092021-07-21 1:13:401279 days ago1626830020IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0078674914
Deposit And Swap...128618922021-07-20 6:47:151280 days ago1626763635IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.001401223.00000145
Deposit And Swap...128618492021-07-20 6:37:281280 days ago1626763048IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0015230525
Deposit And Swap...128618482021-07-20 6:37:071280 days ago1626763027IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0119950328
Deposit And Swap...128618172021-07-20 6:29:241280 days ago1626762564IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0102811624
Deposit And Swap...128618032021-07-20 6:26:141280 days ago1626762374IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0089962721.00000145
Deposit And Swap...128617772021-07-20 6:20:151280 days ago1626762015IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0107098525
Deposit And Swap...128617642021-07-20 6:18:381280 days ago1626761918IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0115666327
Deposit And Swap...128617522021-07-20 6:17:031280 days ago1626761823IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0115666327
Deposit And Swap...128617452021-07-20 6:15:521280 days ago1626761752IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0115666327
Deposit And Swap...128617312021-07-20 6:12:501280 days ago1626761570IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0111049327
Deposit And Swap...128617122021-07-20 6:08:541280 days ago1626761334IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0135719133
Deposit And Swap...128616322021-07-20 5:51:351280 days ago1626760295IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0179915442
Deposit And Swap...128611042021-07-20 3:45:151280 days ago1626752715IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0298616872.6
Deposit And Swap...128585462021-07-19 18:15:191280 days ago1626718519IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0198683545
Deposit And Swap...128535012021-07-18 23:14:501281 days ago1626650090IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.00603313
Deposit And Swap...128462102021-07-17 19:48:091282 days ago1626551289IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0092815420
Deposit And Swap...128455252021-07-17 17:17:271282 days ago1626542247IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0193536445
Deposit And Swap...128454942021-07-17 17:10:251282 days ago1626541825IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0197837246
Deposit And Swap...128348382021-07-16 0:48:211284 days ago1626396501IN
0x3a3AE0f0...BdEEfC25d
0 ETH0.0173833835
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RulerZap

Compiler Version
v0.8.0+commit.c7dfd78e

Optimization Enabled:
Yes with 2000 runs

Other Settings:
default evmVersion
File 1 of 13 : RulerZap.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

import "./ERC20/IERC20.sol";
import "./ERC20/IERC20Permit.sol";
import "./ERC20/SafeERC20.sol";
import "./interfaces/IRERC20.sol";
import "./interfaces/IRulerCore.sol";
import "./interfaces/IRouter.sol";
import "./interfaces/IRulerZap.sol";
import "./interfaces/IMetaPool.sol";
import "./utils/Ownable.sol";

/**
 * @title Ruler Protocol Zap
 * @author alan
 * Main logic is in _depositAndAddLiquidity & _depositAndSwapToPaired
 */
contract RulerZap is Ownable, IRulerZap {
    using SafeERC20 for IERC20;
    IRulerCore public override core;
    IRouter public override router;

    constructor (IRulerCore _core, IRouter _router) {
        require(address(_core) != address(0), "RulerZap: _core is 0");
        require(address(_router) != address(0), "RulerZap: _router is 0");
        core = _core;
        router = _router;
        initializeOwner();
    }

    /**
    * @notice Deposit collateral `_col` to receive paired token `_paired` and rrTokens
    *  - deposits collateral to receive rcTokens and rrTokens
    *  - rcTokens are swapped into paired token through router
    *  - paired token and rrTokens are sent to sender
    */
    function depositAndSwapToPaired(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _minPairedOut,
        address[] calldata _path,
        uint256 _deadline
    ) external override {
        _depositAndSwapToPaired(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _minPairedOut, 
            _path, 
            _deadline
        );
    }

    function depositWithPermitAndSwapToPaired(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _minPairedOut,
        address[] calldata _path,
        uint256 _deadline,
        Permit calldata _colPermit
    ) external override {
        _permit(IERC20Permit(_col), _colPermit);
        _depositAndSwapToPaired(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _minPairedOut, 
            _path, 
            _deadline
        );
    }

    function depositAndSwapWithCurve(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        address _poolAddress,
        int128 _outTokenIndex,
        uint256 _minOut
    ) external override {
        _depositAndSwapWithCurve(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _poolAddress, 
            _outTokenIndex, 
            _minOut
        );
    }

    function depositWithPermitAndSwapWithCurve(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        address _poolAddress,
        int128 _outTokenIndex,
        uint256 _minOut,
        Permit calldata _colPermit
    ) external override {
        _permit(IERC20Permit(_col), _colPermit);
        _depositAndSwapWithCurve(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _poolAddress, 
            _outTokenIndex, 
            _minOut
        );
    }

    /**
    * @notice Deposit collateral `_col` to receive LP tokens and rrTokens
    *  - deposits collateral to receive rcTokens and rrTokens
    *  - transfers paired token from sender
    *  - rcTokens and `_paired` tokens are added as liquidity to receive LP tokens
    *  - LP tokens and rrTokens are sent to sender
    */
    function depositAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline
    ) external override {
        _depositAndAddLiquidity(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin, 
            _pairedDepositMin,
            _deadline
        );
    }

    function depositWithColPermitAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _colPermit
    ) external override {
        _permit(IERC20Permit(_col), _colPermit);
        _depositAndAddLiquidity(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin, 
            _pairedDepositMin,
            _deadline
        );
    }

    function depositWithPairedPermitAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _pairedPermit
    ) external override {
        _permit(IERC20Permit(_paired), _pairedPermit);
        _depositAndAddLiquidity(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin, 
            _pairedDepositMin,
            _deadline
        );
    }

    function depositWithBothPermitsAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _colPermit,
        Permit calldata _pairedPermit
    ) external override {
        _permit(IERC20Permit(_col), _colPermit);
        _permit(IERC20Permit(_paired), _pairedPermit);
        _depositAndAddLiquidity(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _colAmt, 
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin, 
            _pairedDepositMin,
            _deadline
        );
    }

    function mmDepositAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline
    ) external override {
        _mmDepositAndAddLiquidity(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin, 
            _pairedDepositMin,
            _deadline
        );
    }

    function mmDepositWithPermitAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _pairedPermit
    ) external override {
        _permit(IERC20Permit(_paired), _pairedPermit);
        _mmDepositAndAddLiquidity(
            _col, 
            _paired, 
            _expiry, 
            _mintRatio, 
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin, 
            _pairedDepositMin,
            _deadline
        );
    }

    /// @notice This contract should never hold any funds.
    /// Any tokens sent here by accident can be retreived.
    function collect(IERC20 _token) external override onlyOwner {
        uint256 balance = _token.balanceOf(address(this));
        require(balance > 0, "RulerZap: balance is 0");
        _token.safeTransfer(msg.sender, balance);
    }

    function updateCore(IRulerCore _core) external override onlyOwner {
        require(address(_core) != address(0), "RulerZap: _core is 0");
        core = _core;
    }

    function updateRouter(IRouter _router) external override onlyOwner {
        require(address(_router) != address(0), "RulerZap: _router is 0");
        router = _router;
    }

    /// @notice check received amount from swap, tokenOut is always the last in array
    function getAmountOut(
        uint256 _tokenInAmt, 
        address[] calldata _path
    ) external view override returns (uint256) {
        return router.getAmountsOut(_tokenInAmt, _path)[_path.length - 1];
    }

    function _depositAndSwapToPaired(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _minPairedOut,
        address[] calldata _path,
        uint256 _deadline
    ) private {
        require(_colAmt > 0, "RulerZap: _colAmt is 0");
        require(_path.length >= 2, "RulerZap: _path length < 2");
        require(_path[_path.length - 1] == _paired, "RulerZap: output != _paired");
        require(_deadline >= block.timestamp, "RulerZap: _deadline in past");
        (address _rcToken, uint256 _rcTokensReceived, ) = _deposit(_col, _paired, _expiry, _mintRatio, _colAmt);

        require(_path[0] == _rcToken, "RulerZap: input != rcToken");
        _approve(IERC20(_rcToken), address(router), _rcTokensReceived);
        router.swapExactTokensForTokens(_rcTokensReceived, _minPairedOut, _path, msg.sender, _deadline);
    }

    function _depositAndSwapWithCurve(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        address _poolAddress,
        int128 _outTokenIndex,
        uint256 _minOut
    ) private {
        require(_colAmt > 0, "RulerZap: _colAmt is 0");
        require(_outTokenIndex != 0, "RulerZap: _outTokenIndex is 0");
        (address _rcToken, uint256 _rcTokensReceived, ) = _deposit(_col, _paired, _expiry, _mintRatio, _colAmt);
        _approve(IERC20(_rcToken), _poolAddress, _rcTokensReceived);
        IMetaPool(_poolAddress).exchange_underlying(0, _outTokenIndex, _rcTokensReceived, _minOut, msg.sender);
    }

    function _depositAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline
    ) private {
        require(_colAmt > 0, "RulerZap: _colAmt is 0");
        require(_deadline >= block.timestamp, "RulerZap: _deadline in past");
        require(_rcTokenDepositAmt > 0, "RulerZap: 0 rcTokenDepositAmt");
        require(_rcTokenDepositAmt >= _rcTokenDepositMin, "RulerZap: rcToken Amt < min");
        require(_pairedDepositAmt > 0, "RulerZap: 0 pairedDepositAmt");
        require(_pairedDepositAmt >= _pairedDepositMin, "RulerZap: paired Amt < min");

        // deposit collateral to Ruler
        IERC20 rcToken;
        uint256 rcTokensBalBefore;
        { // scope to avoid stack too deep errors
            (address _rcToken, uint256 _rcTokensReceived, uint256 _rcTokensBalBefore) = _deposit(_col, _paired, _expiry, _mintRatio, _colAmt);
            require(_rcTokenDepositAmt <= _rcTokensReceived, "RulerZap: rcToken Amt > minted");
            rcToken = IERC20(_rcToken);
            rcTokensBalBefore = _rcTokensBalBefore;
        }

        // received paired tokens from sender
        IERC20 paired = IERC20(_paired);
        uint256 pairedBalBefore = paired.balanceOf(address(this));
        paired.safeTransferFrom(msg.sender, address(this), _pairedDepositAmt);
        uint256 receivedPaired = paired.balanceOf(address(this)) - pairedBalBefore;
        require(receivedPaired > 0, "RulerZap: paired transfer failed");

        // add liquidity for sender
        _approve(rcToken, address(router), _rcTokenDepositAmt);
        _approve(paired, address(router), _pairedDepositAmt);
        router.addLiquidity(
            address(rcToken), 
            address(paired), 
            _rcTokenDepositAmt, 
            receivedPaired, 
            _rcTokenDepositMin,
            _pairedDepositMin,
            msg.sender,
            _deadline
        );

        // sending leftover tokens back to sender
        uint256 rcTokensLeftover = rcToken.balanceOf(address(this)) - rcTokensBalBefore;
        if (rcTokensLeftover > 0) {
            rcToken.safeTransfer(msg.sender, rcTokensLeftover);
        }
        uint256 pairedTokensLeftover = paired.balanceOf(address(this)) - pairedBalBefore;
        if (pairedTokensLeftover > 0) {
            paired.safeTransfer(msg.sender, pairedTokensLeftover);
        }
    }

    function _mmDepositAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline
    ) private {
        require(_deadline >= block.timestamp, "RulerZap: _deadline in past");
        require(_rcTokenDepositAmt > 0, "RulerZap: 0 rcTokenDepositAmt");
        require(_rcTokenDepositAmt >= _rcTokenDepositMin, "RulerZap: rcToken Amt < min");
        require(_pairedDepositAmt > 0, "RulerZap: 0 pairedDepositAmt");
        require(_pairedDepositAmt >= _pairedDepositMin, "RulerZap: paired Amt < min");

        // transfer all paired tokens from sender to this contract
        IERC20 paired = IERC20(_paired);
        uint256 pairedBalBefore = paired.balanceOf(address(this));
        paired.safeTransferFrom(msg.sender, address(this), _rcTokenDepositAmt + _pairedDepositAmt);
        require(paired.balanceOf(address(this)) - pairedBalBefore == _rcTokenDepositAmt + _pairedDepositAmt, "RulerZap: paired transfer failed");

        // mmDeposit paired to Ruler to receive rcTokens
        ( , , , IRERC20 rcToken, , , , ) = core.pairs(_col, _paired, _expiry, _mintRatio);
        require(address(rcToken) != address(0), "RulerZap: pair not exist");
        uint256 rcTokenBalBefore = rcToken.balanceOf(address(this));
        _approve(paired, address(core), _rcTokenDepositAmt);
        core.mmDeposit(_col, _paired, _expiry, _mintRatio, _rcTokenDepositAmt);
        uint256 rcTokenReceived = rcToken.balanceOf(address(this)) - rcTokenBalBefore;
        require(_rcTokenDepositAmt <= rcTokenReceived, "RulerZap: rcToken Amt > minted");

        // add liquidity for sender
        _approve(rcToken, address(router), _rcTokenDepositAmt);
        _approve(paired, address(router), _pairedDepositAmt);
        router.addLiquidity(
            address(rcToken),
            _paired,
            _rcTokenDepositAmt, 
            _pairedDepositAmt, 
            _rcTokenDepositMin,
            _pairedDepositMin,
            msg.sender,
            _deadline
        );

        // sending leftover tokens (since the beginning of user call) back to sender
        _transferRem(rcToken, rcTokenBalBefore);
        _transferRem(paired, pairedBalBefore);
    }

    function _deposit(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt
    ) private returns (address rcTokenAddr, uint256 rcTokenReceived, uint256 rcTokenBalBefore) {
        ( , , , IRERC20 rcToken, IRERC20 rrToken, , , ) = core.pairs(_col, _paired, _expiry, _mintRatio);
        require(address(rcToken) != address(0) && address(rrToken) != address(0), "RulerZap: pair not exist");
        // receive collateral from sender
        IERC20 collateral = IERC20(_col);
        uint256 colBalBefore = collateral.balanceOf(address(this));
        collateral.safeTransferFrom(msg.sender, address(this), _colAmt);
        uint256 received = collateral.balanceOf(address(this)) - colBalBefore;
        require(received > 0, "RulerZap: col transfer failed");

        // deposit collateral to Ruler
        rcTokenBalBefore = rcToken.balanceOf(address(this));
        uint256 rrTokenBalBefore = rrToken.balanceOf(address(this));
        _approve(collateral, address(core), received);
        core.deposit(_col, _paired, _expiry, _mintRatio, received);

        // send rrToken back to sender, and record received rcTokens
        _transferRem(rrToken, rrTokenBalBefore);
        rcTokenReceived = rcToken.balanceOf(address(this)) - rcTokenBalBefore;
        rcTokenAddr = address(rcToken);
    }

    function _approve(IERC20 _token, address _spender, uint256 _amount) private {
        uint256 allowance = _token.allowance(address(this), _spender);
        if (allowance < _amount) {
            if (allowance != 0) {
                _token.safeApprove(_spender, 0);
            }
            _token.safeApprove(_spender, type(uint256).max);
        }
    }

    function _permit(IERC20Permit _token, Permit calldata permit) private {
        _token.permit(
            permit.owner,
            permit.spender,
            permit.amount,
            permit.deadline,
            permit.v,
            permit.r,
            permit.s
        );
    }

    // transfer remaining amount (since the beginnning of action) back to sender
    function _transferRem(IERC20 _token, uint256 _balBefore) private {
        uint256 tokensLeftover = _token.balanceOf(address(this)) - _balBefore;
        if (tokensLeftover > 0) {
            _token.safeTransfer(msg.sender, tokensLeftover);
        }
    }
}

File 2 of 13 : IERC20.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

/**
 * @title Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function totalSupply() external view returns (uint256);

    function increaseAllowance(address spender, uint256 addedValue) external returns (bool);
    function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool);
}

File 3 of 13 : IERC20Permit.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `amount` as the allowance of `spender` over `owner`'s tokens,
     * given `owner`'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for `permit`, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 5 of 13 : IRERC20.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

import "../ERC20/IERC20.sol";

/**
 * @title RERC20 contract interface, implements {IERC20}. See {RERC20}.
 * @author crypto-pumpkin
 */
interface IRERC20 is IERC20 {
    /// @notice access restriction - owner (R)
    function mint(address _account, uint256 _amount) external returns (bool);
    function burnByRuler(address _account, uint256 _amount) external returns (bool);
}

File 6 of 13 : IRulerCore.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

import "./IRERC20.sol";
import "./IOracle.sol";

/**
 * @title IRulerCore contract interface. See {RulerCore}.
 * @author crypto-pumpkin
 */
interface IRulerCore {
  event RTokenCreated(address);
  event CollateralUpdated(address col, uint256 old, uint256 _new);
  event PairAdded(address indexed collateral, address indexed paired, uint48 expiry, uint256 mintRatio);
  event MarketMakeDeposit(address indexed user, address indexed collateral, address indexed paired, uint48 expiry, uint256 mintRatio, uint256 amount);
  event Deposit(address indexed user, address indexed collateral, address indexed paired, uint48 expiry, uint256 mintRatio, uint256 amount);
  event Repay(address indexed user, address indexed collateral, address indexed paired, uint48 expiry, uint256 mintRatio, uint256 amount);
  event Redeem(address indexed user, address indexed collateral, address indexed paired, uint48 expiry, uint256 mintRatio, uint256 amount);
  event Collect(address indexed user, address indexed collateral, address indexed paired, uint48 expiry, uint256 mintRatio, uint256 amount);
  event AddressUpdated(string _type, address old, address _new);
  event PausedStatusUpdated(bool old, bool _new);
  event RERC20ImplUpdated(address rERC20Impl, address newImpl);
  event FlashLoanRateUpdated(uint256 old, uint256 _new);

  struct Pair {
    bool active;
    uint48 expiry;
    address pairedToken;
    IRERC20 rcToken; // ruler capitol token, e.g. RC_Dai_wBTC_2_2021
    IRERC20 rrToken; // ruler repayment token, e.g. RR_Dai_wBTC_2_2021
    uint256 mintRatio; // 1e18, price of collateral / collateralization ratio
    uint256 feeRate; // 1e18
    uint256 colTotal;
  }

  struct Permit {
    address owner;
    address spender;
    uint256 amount;
    uint256 deadline;
    uint8 v;
    bytes32 r;
    bytes32 s;
  }

  // state vars
  function oracle() external view returns (IOracle);
  function version() external pure returns (string memory);
  function flashLoanRate() external view returns (uint256);
  function paused() external view returns (bool);
  function responder() external view returns (address);
  function feeReceiver() external view returns (address);
  function rERC20Impl() external view returns (address);
  function collaterals(uint256 _index) external view returns (address);
  function minColRatioMap(address _col) external view returns (uint256);
  function feesMap(address _token) external view returns (uint256);
  function pairs(address _col, address _paired, uint48 _expiry, uint256 _mintRatio) external view returns (
    bool active, 
    uint48 expiry, 
    address pairedToken, 
    IRERC20 rcToken, 
    IRERC20 rrToken, 
    uint256 mintRatio, 
    uint256 feeRate, 
    uint256 colTotal
  );

  // extra view
  function getCollaterals() external view returns (address[] memory);
  function getPairList(address _col) external view returns (Pair[] memory);
  function viewCollectible(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rcTokenAmt
  ) external view returns (uint256 colAmtToCollect, uint256 pairedAmtToCollect);

  // user action - only when not paused
  function mmDeposit(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rcTokenAmt
  ) external;
  function mmDepositWithPermit(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rcTokenAmt,
    Permit calldata _pairedPermit
  ) external;
  function deposit(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _colAmt
  ) external;
  function depositWithPermit(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _colAmt,
    Permit calldata _colPermit
  ) external;
  function redeem(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rTokenAmt
  ) external;
  function repay(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rrTokenAmt
  ) external;
  function repayWithPermit(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rrTokenAmt,
    Permit calldata _pairedPermit
  ) external;
  function collect(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    uint256 _rcTokenAmt
  ) external;
  function collectFees(IERC20[] calldata _tokens) external;

  // access restriction - owner (dev) & responder
  function setPaused(bool _paused) external;

  // access restriction - owner (dev)
  function addPair(
    address _col,
    address _paired,
    uint48 _expiry,
    string calldata _expiryStr,
    uint256 _mintRatio,
    string calldata _mintRatioStr,
    uint256 _feeRate
  ) external;
  function setPairActive(
    address _col,
    address _paired,
    uint48 _expiry,
    uint256 _mintRatio,
    bool _active
  ) external;
  function updateCollateral(address _col, uint256 _minColRatio) external;
  function setFeeReceiver(address _addr) external;
  function setResponder(address _addr) external;
  function setRERC20Impl(address _addr) external;
  function setOracle(address _addr) external;
  function setFlashLoanRate(uint256 _newRate) external;
}

File 7 of 13 : IRouter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

File 8 of 13 : IRulerZap.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

import "./IRulerCore.sol";
import "./IRouter.sol";
import "../ERC20/IERC20.sol";

interface IRulerZap {
    struct Permit {
        address owner;
        address spender;
        uint256 amount;
        uint256 deadline;
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    // state vars
    function core() external view returns (IRulerCore);
    function router() external view returns (IRouter);

    // extra view
    function getAmountOut(uint256 _tokenInAmt, address[] calldata _path) external view returns (uint256);

    // user interactions
    function depositAndSwapToPaired(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _minPairedOut,
        address[] calldata _path,
        uint256 _deadline
    ) external;

    function depositWithPermitAndSwapToPaired(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _minPairedOut,
        address[] calldata _path,
        uint256 _deadline,
        Permit calldata _colPermit
    ) external;

    function depositAndSwapWithCurve(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        address _poolAddress,
        int128 _outTokenIndex,
        uint256 _minOut
    ) external;

    function depositWithPermitAndSwapWithCurve(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        address _poolAddress,
        int128 _outTokenIndex,
        uint256 _minOut,
        Permit calldata _colPermit
    ) external;

    function depositAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline
    ) external;

    function depositWithColPermitAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _colPermit
    ) external;

    function depositWithPairedPermitAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _pairedPermit
    ) external;

    function depositWithBothPermitsAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _colAmt,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _colPermit,
        Permit calldata _pairedPermit
    ) external;

    function mmDepositAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline
    ) external;

    function mmDepositWithPermitAndAddLiquidity(
        address _col, 
        address _paired,
        uint48 _expiry,
        uint256 _mintRatio,
        uint256 _rcTokenDepositAmt,
        uint256 _pairedDepositAmt,
        uint256 _rcTokenDepositMin,
        uint256 _pairedDepositMin,
        uint256 _deadline,
        Permit calldata _pairedPermit
    ) external;

    // admin
    function collect(IERC20 _token) external;
    function updateCore(IRulerCore _core) external;
    function updateRouter(IRouter _router) external;
}

File 9 of 13 : IMetaPool.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

interface IMetaPool {
    function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 min_dy, address _receiver) external returns (uint256);
}

File 10 of 13 : Ownable.sol
// SPDX-License-Identifier: No License

pragma solidity ^0.8.0;

import "./Initializable.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.
 * @author crypto-pumpkin
 *
 * By initialization, the owner account will be the one that called initializeOwner. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
contract Ownable is Initializable {
    address private _owner;

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

    /**
     * @dev Ruler: Initializes the contract setting the deployer as the initial owner.
     */
    function initializeOwner() internal initializer {
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), _owner);
    }


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

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

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

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

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

pragma solidity ^0.8.0;

library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

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

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

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

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

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

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

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

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 12 of 13 : IOracle.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

interface IOracle {
    function getPriceUSD(address _asset) external view returns (uint256 price);
    function getPricesUSD(address[] calldata _assets) external view returns (uint256[] memory prices);
    
    // admin functions
    function updateFeedETH(address _asset, address _feed) external;
    function updateFeedUSD(address _asset, address _feed) external;
    function setSushiKeeperOracle(address _sushiOracle) external;
    function setUniKeeperOracle(address _uniOracle) external;
}

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

// solhint-disable-next-line compiler-version
pragma solidity ^0.8.0;


/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 * 
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {UpgradeableProxy-constructor}.
 * 
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {

    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || _isConstructor() || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

    /// @dev Returns true if and only if the function is running in the constructor
    function _isConstructor() private view returns (bool) {
        // extcodesize checks the size of the code stored in an address, and
        // address returns the current address. Since the code is still not
        // deployed when running a constructor, any checks on its code size will
        // yield zero, making it an effective way to detect if a contract is
        // under construction or not.
        address self = address(this);
        uint256 cs;
        // solhint-disable-next-line no-inline-assembly
        assembly { cs := extcodesize(self) }
        return cs == 0;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IRulerCore","name":"_core","type":"address"},{"internalType":"contract IRouter","name":"_router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"}],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"core","outputs":[{"internalType":"contract IRulerCore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositMin","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"depositAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"uint256","name":"_minPairedOut","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"depositAndSwapToPaired","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"int128","name":"_outTokenIndex","type":"int128"},{"internalType":"uint256","name":"_minOut","type":"uint256"}],"name":"depositAndSwapWithCurve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositMin","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_colPermit","type":"tuple"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_pairedPermit","type":"tuple"}],"name":"depositWithBothPermitsAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositMin","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_colPermit","type":"tuple"}],"name":"depositWithColPermitAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositMin","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_pairedPermit","type":"tuple"}],"name":"depositWithPairedPermitAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"uint256","name":"_minPairedOut","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_colPermit","type":"tuple"}],"name":"depositWithPermitAndSwapToPaired","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_colAmt","type":"uint256"},{"internalType":"address","name":"_poolAddress","type":"address"},{"internalType":"int128","name":"_outTokenIndex","type":"int128"},{"internalType":"uint256","name":"_minOut","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_colPermit","type":"tuple"}],"name":"depositWithPermitAndSwapWithCurve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenInAmt","type":"uint256"},{"internalType":"address[]","name":"_path","type":"address[]"}],"name":"getAmountOut","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositMin","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"mmDepositAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_col","type":"address"},{"internalType":"address","name":"_paired","type":"address"},{"internalType":"uint48","name":"_expiry","type":"uint48"},{"internalType":"uint256","name":"_mintRatio","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositAmt","type":"uint256"},{"internalType":"uint256","name":"_rcTokenDepositMin","type":"uint256"},{"internalType":"uint256","name":"_pairedDepositMin","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","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"}],"internalType":"struct IRulerZap.Permit","name":"_pairedPermit","type":"tuple"}],"name":"mmDepositWithPermitAndAddLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"contract IRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRulerCore","name":"_core","type":"address"}],"name":"updateCore","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IRouter","name":"_router","type":"address"}],"name":"updateRouter","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620032df380380620032df8339810160408190526200003491620001b9565b6001600160a01b038216620000665760405162461bcd60e51b81526004016200005d9062000245565b60405180910390fd5b6001600160a01b0381166200008f5760405162461bcd60e51b81526004016200005d906200027c565b600180546001600160a01b038085166001600160a01b0319928316179092556002805492841692909116919091179055620000c9620000d1565b5050620002c9565b600054610100900460ff1680620000ed5750620000ed620001b3565b80620000fc575060005460ff16155b6200011b5760405162461bcd60e51b81526004016200005d90620001f7565b600054610100900460ff1615801562000147576000805460ff1961ff0019909116610100171660011790555b600080546201000033810262010000600160b01b0319909216919091178083556040519190046001600160a01b031691907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a38015620001b0576000805461ff00191690555b50565b303b1590565b60008060408385031215620001cc578182fd5b8251620001d981620002b3565b6020840151909250620001ec81620002b3565b809150509250929050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526014908201527f52756c65725a61703a205f636f72652069732030000000000000000000000000604082015260600190565b60208082526016908201527f52756c65725a61703a205f726f75746572206973203000000000000000000000604082015260600190565b6001600160a01b0381168114620001b057600080fd5b61300680620002d96000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c8063666572d9116100cd578063c851cc3211610081578063f2f4eb2611610066578063f2f4eb2614610295578063f2fde38b1461029d578063f887ea40146102b057610151565b8063c851cc321461026f578063d06af0b01461028257610151565b8063896d7caa116100b2578063896d7caa1461021e5780638da5cb5b14610231578063b8239ebb1461024f57610151565b8063666572d914610203578063715018a61461021657610151565b80630d32d15d1161012457806313b9312b1161010957806313b9312b146101ca5780632c14dea5146101dd5780633e347e1a146101f057610151565b80630d32d15d146101a45780630fd7046c146101b757610151565b8063010bafd31461015657806306ec16f81461016b5780630aaba9161461017e5780630cbfb6af14610191575b600080fd5b610169610164366004612120565b6102b8565b005b610169610179366004611fd9565b6102d4565b61016961018c366004612271565b6103c6565b61016961019f3660046121bf565b6103d7565b6101696101b2366004612085565b6103fe565b6101696101c53660046123ff565b610418565b6101696101d8366004611ffc565b610441565b6101696101eb3660046124a0565b61045b565b6101696101fe366004611fd9565b61048f565b6101696102113660046122f1565b61051f565b61016961053a565b61016961022c366004612376565b6105d1565b6102396105e3565b60405161024691906127c6565b60405180910390f35b61026261025d3660046126ca565b6105f8565b6040516102469190612eb3565b61016961027d366004611fd9565b6106d4565b6101696102903660046123ff565b610764565b61023961076e565b6101696102ab366004611fd9565b61077d565b610239610852565b6102c9898989898989898989610861565b505050505050505050565b6000546201000090046001600160a01b0316331461030d5760405162461bcd60e51b815260040161030490612b9e565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a082319061033c9030906004016127c6565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c91906126b2565b9050600081116103ae5760405162461bcd60e51b815260040161030490612a54565b6103c26001600160a01b0383163383610a6d565b5050565b6102c9898989898989898989610af5565b6103e18a8261107d565b6103f28a8a8a8a8a8a8a8a8a610861565b50505050505050505050565b610408898261107d565b6102c98989898989898989611125565b6104228b8261107d565b6104348b8b8b8b8b8b8b8b8b8b611229565b5050505050505050505050565b6104518888888888888888611125565b5050505050505050565b6104658c8361107d565b61046f8b8261107d565b6104818c8c8c8c8c8c8c8c8c8c611229565b505050505050505050505050565b6000546201000090046001600160a01b031633146104bf5760405162461bcd60e51b815260040161030490612b9e565b6001600160a01b0381166104e55760405162461bcd60e51b815260040161030490612bd3565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610529898261107d565b6103f28a8a8a8a8a8a8a8a8a610af5565b6000546201000090046001600160a01b0316331461056a5760405162461bcd60e51b815260040161030490612b9e565b60008054604051620100009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff169055565b6103f28a8a8a8a8a8a8a8a8a8a611229565b6000546201000090046001600160a01b031690565b6002546040517fd06ca61f0000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063d06ca61f9061064690879087908790600401612ebc565b60006040518083038186803b15801561065e57600080fd5b505afa158015610672573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261069a9190810190612552565b6106a5600184612f35565b815181106106c357634e487b7160e01b600052603260045260246000fd5b602002602001015190509392505050565b6000546201000090046001600160a01b031633146107045760405162461bcd60e51b815260040161030490612b9e565b6001600160a01b03811661072a5760405162461bcd60e51b815260040161030490612e0e565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6104228a8261107d565b6001546001600160a01b031681565b6000546201000090046001600160a01b031633146107ad5760405162461bcd60e51b815260040161030490612b9e565b6001600160a01b0381166107d35760405162461bcd60e51b8152600401610304906129f7565b600080546040516001600160a01b03808516936201000090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6002546001600160a01b031681565b600085116108815760405162461bcd60e51b8152600401610304906129c0565b60028210156108a25760405162461bcd60e51b815260040161030490612c41565b6001600160a01b03881683836108b9600182612f35565b8181106108d657634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108eb9190611fd9565b6001600160a01b0316146109115760405162461bcd60e51b815260040161030490612e45565b428110156109315760405162461bcd60e51b815260040161030490612dd7565b6000806109418b8b8b8b8b61169e565b5091509150816001600160a01b03168585600081811061097157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109869190611fd9565b6001600160a01b0316146109ac5760405162461bcd60e51b815260040161030490612caf565b6002546109c49083906001600160a01b031683611b15565b6002546040517f38ed17390000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906338ed173990610a179084908a908a908a9033908b90600401612edf565b600060405180830381600087803b158015610a3157600080fd5b505af1158015610a45573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104819190810190612552565b610af08363a9059cbb60e01b8484604051602401610a8c92919061290c565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611c0e565b505050565b42811015610b155760405162461bcd60e51b815260040161030490612dd7565b60008511610b355760405162461bcd60e51b815260040161030490612a8b565b82851015610b555760405162461bcd60e51b815260040161030490612af9565b60008411610b755760405162461bcd60e51b815260040161030490612c0a565b81841015610b955760405162461bcd60e51b815260040161030490612b30565b6040516370a0823160e01b815288906000906001600160a01b038316906370a0823190610bc69030906004016127c6565b60206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1691906126b2565b9050610c393330610c27898b612f1d565b6001600160a01b038616929190611c9d565b610c438688612f1d565b6040516370a0823160e01b815282906001600160a01b038516906370a0823190610c719030906004016127c6565b60206040518083038186803b158015610c8957600080fd5b505afa158015610c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc191906126b2565b610ccb9190612f35565b14610ce85760405162461bcd60e51b81526004016103049061298b565b6001546040517f40aa607a0000000000000000000000000000000000000000000000000000000081526000916001600160a01b0316906340aa607a90610d38908f908f908f908f906004016128a2565b6101006040518083038186803b158015610d5157600080fd5b505afa158015610d65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d899190612626565b50505050935050505060006001600160a01b0316816001600160a01b03161415610dc55760405162461bcd60e51b815260040161030490612ac2565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610df49030906004016127c6565b60206040518083038186803b158015610e0c57600080fd5b505afa158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4491906126b2565b600154909150610e5f9085906001600160a01b03168b611b15565b600160009054906101000a90046001600160a01b03166001600160a01b0316637c6204128e8e8e8e8e6040518663ffffffff1660e01b8152600401610ea89594939291906128d3565b600060405180830381600087803b158015610ec257600080fd5b505af1158015610ed6573d6000803e3d6000fd5b50505050600081836001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f0991906127c6565b60206040518083038186803b158015610f2157600080fd5b505afa158015610f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5991906126b2565b610f639190612f35565b9050808a1115610f855760405162461bcd60e51b815260040161030490612e7c565b600254610f9d9084906001600160a01b03168c611b15565b600254610fb59086906001600160a01b03168b611b15565b600260009054906101000a90046001600160a01b03166001600160a01b031663e8e33700848f8d8d8d8d338e6040518963ffffffff1660e01b8152600401611004989796959493929190612818565b606060405180830381600087803b15801561101e57600080fd5b505af1158015611032573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110569190612714565b5050506110638383611cbe565b61106d8585611cbe565b5050505050505050505050505050565b6001600160a01b03821663d505accf6110996020840184611fd9565b6110a96040850160208601611fd9565b604085013560608601356110c360a0880160808901612741565b8760a001358860c001356040518863ffffffff1660e01b81526004016110ef9796959493929190612861565b600060405180830381600087803b15801561110957600080fd5b505af115801561111d573d6000803e3d6000fd5b505050505050565b600084116111455760405162461bcd60e51b8152600401610304906129c0565b81600f0b600014156111695760405162461bcd60e51b815260040161030490612b67565b6000806111798a8a8a8a8a61169e565b5091509150611189828683611b15565b6040517f44ee19860000000000000000000000000000000000000000000000000000000081526001600160a01b038616906344ee1986906111d7906000908890869089903390600401612925565b602060405180830381600087803b1580156111f157600080fd5b505af1158015611205573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043491906126b2565b600086116112495760405162461bcd60e51b8152600401610304906129c0565b428110156112695760405162461bcd60e51b815260040161030490612dd7565b600085116112895760405162461bcd60e51b815260040161030490612a8b565b828510156112a95760405162461bcd60e51b815260040161030490612af9565b600084116112c95760405162461bcd60e51b815260040161030490612c0a565b818410156112e95760405162461bcd60e51b815260040161030490612b30565b60008060008060006112fe8f8f8f8f8f61169e565b925092509250818a11156113245760405162461bcd60e51b815260040161030490612e7c565b6040516370a0823160e01b815292945092508c91600091506001600160a01b038316906370a082319061135b9030906004016127c6565b60206040518083038186803b15801561137357600080fd5b505afa158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ab91906126b2565b90506113c26001600160a01b03831633308b611c9d565b600081836001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113f191906127c6565b60206040518083038186803b15801561140957600080fd5b505afa15801561141d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144191906126b2565b61144b9190612f35565b90506000811161146d5760405162461bcd60e51b81526004016103049061298b565b6002546114859086906001600160a01b03168c611b15565b60025461149d9084906001600160a01b03168b611b15565b600260009054906101000a90046001600160a01b03166001600160a01b031663e8e3370086858d858d8d338e6040518963ffffffff1660e01b81526004016114ec989796959493929190612818565b606060405180830381600087803b15801561150657600080fd5b505af115801561151a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153e9190612714565b505050600084866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161157091906127c6565b60206040518083038186803b15801561158857600080fd5b505afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906126b2565b6115ca9190612f35565b905080156115e6576115e66001600160a01b0387163383610a6d565b600083856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161161591906127c6565b60206040518083038186803b15801561162d57600080fd5b505afa158015611641573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166591906126b2565b61166f9190612f35565b9050801561168b5761168b6001600160a01b0386163383610a6d565b5050505050505050505050505050505050565b6001546040517f40aa607a00000000000000000000000000000000000000000000000000000000815260009182918291829182916001600160a01b0316906340aa607a906116f6908d908d908d908d906004016128a2565b6101006040518083038186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117479190612626565b5050509450945050505060006001600160a01b0316826001600160a01b03161415801561177c57506001600160a01b03811615155b6117985760405162461bcd60e51b815260040161030490612ac2565b6040516370a0823160e01b81528a906000906001600160a01b038316906370a08231906117c99030906004016127c6565b60206040518083038186803b1580156117e157600080fd5b505afa1580156117f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181991906126b2565b90506118306001600160a01b03831633308b611c9d565b600081836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161185f91906127c6565b60206040518083038186803b15801561187757600080fd5b505afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118af91906126b2565b6118b99190612f35565b9050600081116118db5760405162461bcd60e51b815260040161030490612ce6565b6040516370a0823160e01b81526001600160a01b038616906370a08231906119079030906004016127c6565b60206040518083038186803b15801561191f57600080fd5b505afa158015611933573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195791906126b2565b95506000846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161198791906127c6565b60206040518083038186803b15801561199f57600080fd5b505afa1580156119b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d791906126b2565b6001549091506119f29085906001600160a01b031684611b15565b600160009054906101000a90046001600160a01b03166001600160a01b031663ff9940608f8f8f8f876040518663ffffffff1660e01b8152600401611a3b9594939291906128d3565b600060405180830381600087803b158015611a5557600080fd5b505af1158015611a69573d6000803e3d6000fd5b50505050611a778582611cbe565b6040516370a0823160e01b815287906001600160a01b038816906370a0823190611aa59030906004016127c6565b60206040518083038186803b158015611abd57600080fd5b505afa158015611ad1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af591906126b2565b611aff9190612f35565b9750859850505050505050955095509592505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063dd62ed3e90611b5f90309087906004016127da565b60206040518083038186803b158015611b7757600080fd5b505afa158015611b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611baf91906126b2565b905081811015611c08578015611bd457611bd46001600160a01b038516846000611d63565b611c086001600160a01b038516847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611d63565b50505050565b6000611c63826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611e3f9092919063ffffffff16565b805190915015610af05780806020019051810190611c81919061260c565b610af05760405162461bcd60e51b815260040161030490612d1d565b611c08846323b872dd60e01b858585604051602401610a8c939291906127f4565b600081836001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ced91906127c6565b60206040518083038186803b158015611d0557600080fd5b505afa158015611d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3d91906126b2565b611d479190612f35565b90508015610af057610af06001600160a01b0384163383610a6d565b801580611e0457506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063dd62ed3e90611db290309086906004016127da565b60206040518083038186803b158015611dca57600080fd5b505afa158015611dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0291906126b2565b155b611e205760405162461bcd60e51b815260040161030490612d7a565b610af08363095ea7b360e01b8484604051602401610a8c92919061290c565b6060611e4e8484600085611e56565b949350505050565b6060611e6185611f19565b611e7d5760405162461bcd60e51b815260040161030490612c78565b600080866001600160a01b03168587604051611e9991906127aa565b60006040518083038185875af1925050503d8060008114611ed6576040519150601f19603f3d011682016040523d82523d6000602084013e611edb565b606091505b50915091508115611eef579150611e4e9050565b805115611eff5780518082602001fd5b8360405162461bcd60e51b81526004016103049190612958565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611f4d57508115155b925050505b919050565b60008083601f840112611f68578081fd5b50813567ffffffffffffffff811115611f7f578182fd5b6020830191508360208083028501011115611f9957600080fd5b9250929050565b80518015158114611f5257600080fd5b8035600f81900b8114611f5257600080fd5b600060e08284031215611fd3578081fd5b50919050565b600060208284031215611fea578081fd5b8135611ff581612fa4565b9392505050565b600080600080600080600080610100898b031215612018578384fd5b883561202381612fa4565b9750602089013561203381612fa4565b9650604089013561204381612fbc565b9550606089013594506080890135935060a089013561206181612fa4565b925061206f60c08a01611fb0565b915060e089013590509295985092959890939650565b60008060008060008060008060006101e08a8c0312156120a3578081fd5b89356120ae81612fa4565b985060208a01356120be81612fa4565b975060408a01356120ce81612fbc565b965060608a0135955060808a0135945060a08a01356120ec81612fa4565b93506120fa60c08b01611fb0565b925060e08a013591506121118b6101008c01611fc2565b90509295985092959850929598565b60008060008060008060008060006101008a8c03121561213e578485fd5b893561214981612fa4565b985060208a013561215981612fa4565b975060408a013561216981612fbc565b965060608a0135955060808a0135945060a08a0135935060c08a013567ffffffffffffffff811115612199578384fd5b6121a58c828d01611f57565b9a9d999c50979a9699959894979660e00135949350505050565b6000806000806000806000806000806101e08b8d0312156121de578384fd5b8a356121e981612fa4565b995060208b01356121f981612fa4565b985060408b013561220981612fbc565b975060608b0135965060808b0135955060a08b0135945060c08b013567ffffffffffffffff811115612239578485fd5b6122458d828e01611f57565b90955093505060e08b013591506122608c6101008d01611fc2565b90509295989b9194979a5092959850565b60008060008060008060008060006101208a8c03121561228f578283fd5b893561229a81612fa4565b985060208a01356122aa81612fa4565b975060408a01356122ba81612fbc565b989b979a5097986060810135985060808101359760a0820135975060c0820135965060e08201359550610100909101359350915050565b6000806000806000806000806000806102008b8d031215612310578384fd5b8a3561231b81612fa4565b995060208b013561232b81612fa4565b985060408b013561233b81612fbc565b975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013591506122608c6101208d01611fc2565b6000806000806000806000806000806101408b8d031215612395578384fd5b8a356123a081612fa4565b995060208b01356123b081612fa4565b985060408b01356123c081612fbc565b999c989b5098996060810135995060808101359860a0820135985060c0820135975060e082013596506101008201359550610120909101359350915050565b60008060008060008060008060008060006102208c8e031215612420578485fd5b8b3561242b81612fa4565b9a5060208c013561243b81612fa4565b995060408c013561244b81612fbc565b985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c013593506101008c013592506101208c0135915061248e8d6101408e01611fc2565b90509295989b509295989b9093969950565b6000806000806000806000806000806000806103008d8f0312156124c2578586fd5b8c356124cd81612fa4565b9b5060208d01356124dd81612fa4565b9a5060408d01356124ed81612fbc565b995060608d0135985060808d0135975060a08d0135965060c08d0135955060e08d013594506101008d013593506101208d013592506125308e6101408f01611fc2565b91506125408e6102208f01611fc2565b90509295989b509295989b509295989b565b60006020808385031215612564578182fd5b825167ffffffffffffffff8082111561257b578384fd5b818501915085601f83011261258e578384fd5b8151818111156125a0576125a0612f8e565b838102604051858282010181811085821117156125bf576125bf612f8e565b604052828152858101935084860182860187018a10156125dd578788fd5b8795505b838610156125ff5780518552600195909501949386019386016125e1565b5098975050505050505050565b60006020828403121561261d578081fd5b611ff582611fa0565b600080600080600080600080610100898b031215612642578182fd5b61264b89611fa0565b9750602089015161265b81612fbc565b60408a015190975061266c81612fa4565b60608a015190965061267d81612fa4565b60808a015190955061268e81612fa4565b60a08a015160c08b015160e0909b0151999c989b5096999598909790945092505050565b6000602082840312156126c3578081fd5b5051919050565b6000806000604084860312156126de578081fd5b83359250602084013567ffffffffffffffff8111156126fb578182fd5b61270786828701611f57565b9497909650939450505050565b600080600060608486031215612728578081fd5b8351925060208401519150604084015190509250925092565b600060208284031215612752578081fd5b813560ff81168114611ff5578182fd5b60008284526020808501945082825b8581101561279f57813561278481612fa4565b6001600160a01b031687529582019590820190600101612771565b509495945050505050565b600082516127bc818460208701612f4c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039889168152968816602088015260408701959095526060860193909352608085019190915260a084015290921660c082015260e08101919091526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03948516815292909316602083015265ffffffffffff166040820152606081019190915260800190565b6001600160a01b03958616815293909416602084015265ffffffffffff9190911660408301526060820152608081019190915260a00190565b6001600160a01b03929092168252602082015260400190565b600f95860b81529390940b6020840152604083019190915260608201526001600160a01b03909116608082015260a00190565b6000602082528251806020840152612977816040850160208701612f4c565b601f01601f19169190910160400192915050565b6020808252818101527f52756c65725a61703a20706169726564207472616e73666572206661696c6564604082015260600190565b60208082526016908201527f52756c65725a61703a205f636f6c416d74206973203000000000000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526016908201527f52756c65725a61703a2062616c616e6365206973203000000000000000000000604082015260600190565b6020808252601d908201527f52756c65725a61703a2030207263546f6b656e4465706f736974416d74000000604082015260600190565b60208082526018908201527f52756c65725a61703a2070616972206e6f742065786973740000000000000000604082015260600190565b6020808252601b908201527f52756c65725a61703a207263546f6b656e20416d74203c206d696e0000000000604082015260600190565b6020808252601a908201527f52756c65725a61703a2070616972656420416d74203c206d696e000000000000604082015260600190565b6020808252601d908201527f52756c65725a61703a205f6f7574546f6b656e496e6465782069732030000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526014908201527f52756c65725a61703a205f636f72652069732030000000000000000000000000604082015260600190565b6020808252601c908201527f52756c65725a61703a2030207061697265644465706f736974416d7400000000604082015260600190565b6020808252601a908201527f52756c65725a61703a205f70617468206c656e677468203c2032000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601a908201527f52756c65725a61703a20696e70757420213d207263546f6b656e000000000000604082015260600190565b6020808252601d908201527f52756c65725a61703a20636f6c207472616e73666572206661696c6564000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606082015260800190565b6020808252601b908201527f52756c65725a61703a205f646561646c696e6520696e20706173740000000000604082015260600190565b60208082526016908201527f52756c65725a61703a205f726f75746572206973203000000000000000000000604082015260600190565b6020808252601b908201527f52756c65725a61703a206f757470757420213d205f7061697265640000000000604082015260600190565b6020808252601e908201527f52756c65725a61703a207263546f6b656e20416d74203e206d696e7465640000604082015260600190565b90815260200190565b600084825260406020830152612ed6604083018486612762565b95945050505050565b600087825286602083015260a06040830152612eff60a083018688612762565b6001600160a01b039490941660608301525060800152949350505050565b60008219821115612f3057612f30612f78565b500190565b600082821015612f4757612f47612f78565b500390565b60005b83811015612f67578181015183820152602001612f4f565b83811115611c085750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612fb957600080fd5b50565b65ffffffffffff81168114612fb957600080fdfea264697066735822122023a42f235f91dbdcaf06af65eb3070e734ca3bcb8f812d906613c543b44262b964736f6c63430008000033000000000000000000000000f19f4490a7fccfef2dab8199acdb2dc1b9027c18000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101515760003560e01c8063666572d9116100cd578063c851cc3211610081578063f2f4eb2611610066578063f2f4eb2614610295578063f2fde38b1461029d578063f887ea40146102b057610151565b8063c851cc321461026f578063d06af0b01461028257610151565b8063896d7caa116100b2578063896d7caa1461021e5780638da5cb5b14610231578063b8239ebb1461024f57610151565b8063666572d914610203578063715018a61461021657610151565b80630d32d15d1161012457806313b9312b1161010957806313b9312b146101ca5780632c14dea5146101dd5780633e347e1a146101f057610151565b80630d32d15d146101a45780630fd7046c146101b757610151565b8063010bafd31461015657806306ec16f81461016b5780630aaba9161461017e5780630cbfb6af14610191575b600080fd5b610169610164366004612120565b6102b8565b005b610169610179366004611fd9565b6102d4565b61016961018c366004612271565b6103c6565b61016961019f3660046121bf565b6103d7565b6101696101b2366004612085565b6103fe565b6101696101c53660046123ff565b610418565b6101696101d8366004611ffc565b610441565b6101696101eb3660046124a0565b61045b565b6101696101fe366004611fd9565b61048f565b6101696102113660046122f1565b61051f565b61016961053a565b61016961022c366004612376565b6105d1565b6102396105e3565b60405161024691906127c6565b60405180910390f35b61026261025d3660046126ca565b6105f8565b6040516102469190612eb3565b61016961027d366004611fd9565b6106d4565b6101696102903660046123ff565b610764565b61023961076e565b6101696102ab366004611fd9565b61077d565b610239610852565b6102c9898989898989898989610861565b505050505050505050565b6000546201000090046001600160a01b0316331461030d5760405162461bcd60e51b815260040161030490612b9e565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a082319061033c9030906004016127c6565b60206040518083038186803b15801561035457600080fd5b505afa158015610368573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038c91906126b2565b9050600081116103ae5760405162461bcd60e51b815260040161030490612a54565b6103c26001600160a01b0383163383610a6d565b5050565b6102c9898989898989898989610af5565b6103e18a8261107d565b6103f28a8a8a8a8a8a8a8a8a610861565b50505050505050505050565b610408898261107d565b6102c98989898989898989611125565b6104228b8261107d565b6104348b8b8b8b8b8b8b8b8b8b611229565b5050505050505050505050565b6104518888888888888888611125565b5050505050505050565b6104658c8361107d565b61046f8b8261107d565b6104818c8c8c8c8c8c8c8c8c8c611229565b505050505050505050505050565b6000546201000090046001600160a01b031633146104bf5760405162461bcd60e51b815260040161030490612b9e565b6001600160a01b0381166104e55760405162461bcd60e51b815260040161030490612bd3565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b610529898261107d565b6103f28a8a8a8a8a8a8a8a8a610af5565b6000546201000090046001600160a01b0316331461056a5760405162461bcd60e51b815260040161030490612b9e565b60008054604051620100009091046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080547fffffffffffffffffffff0000000000000000000000000000000000000000ffff169055565b6103f28a8a8a8a8a8a8a8a8a8a611229565b6000546201000090046001600160a01b031690565b6002546040517fd06ca61f0000000000000000000000000000000000000000000000000000000081526000916001600160a01b03169063d06ca61f9061064690879087908790600401612ebc565b60006040518083038186803b15801561065e57600080fd5b505afa158015610672573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261069a9190810190612552565b6106a5600184612f35565b815181106106c357634e487b7160e01b600052603260045260246000fd5b602002602001015190509392505050565b6000546201000090046001600160a01b031633146107045760405162461bcd60e51b815260040161030490612b9e565b6001600160a01b03811661072a5760405162461bcd60e51b815260040161030490612e0e565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6104228a8261107d565b6001546001600160a01b031681565b6000546201000090046001600160a01b031633146107ad5760405162461bcd60e51b815260040161030490612b9e565b6001600160a01b0381166107d35760405162461bcd60e51b8152600401610304906129f7565b600080546040516001600160a01b03808516936201000090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6002546001600160a01b031681565b600085116108815760405162461bcd60e51b8152600401610304906129c0565b60028210156108a25760405162461bcd60e51b815260040161030490612c41565b6001600160a01b03881683836108b9600182612f35565b8181106108d657634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108eb9190611fd9565b6001600160a01b0316146109115760405162461bcd60e51b815260040161030490612e45565b428110156109315760405162461bcd60e51b815260040161030490612dd7565b6000806109418b8b8b8b8b61169e565b5091509150816001600160a01b03168585600081811061097157634e487b7160e01b600052603260045260246000fd5b90506020020160208101906109869190611fd9565b6001600160a01b0316146109ac5760405162461bcd60e51b815260040161030490612caf565b6002546109c49083906001600160a01b031683611b15565b6002546040517f38ed17390000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906338ed173990610a179084908a908a908a9033908b90600401612edf565b600060405180830381600087803b158015610a3157600080fd5b505af1158015610a45573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526104819190810190612552565b610af08363a9059cbb60e01b8484604051602401610a8c92919061290c565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611c0e565b505050565b42811015610b155760405162461bcd60e51b815260040161030490612dd7565b60008511610b355760405162461bcd60e51b815260040161030490612a8b565b82851015610b555760405162461bcd60e51b815260040161030490612af9565b60008411610b755760405162461bcd60e51b815260040161030490612c0a565b81841015610b955760405162461bcd60e51b815260040161030490612b30565b6040516370a0823160e01b815288906000906001600160a01b038316906370a0823190610bc69030906004016127c6565b60206040518083038186803b158015610bde57600080fd5b505afa158015610bf2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1691906126b2565b9050610c393330610c27898b612f1d565b6001600160a01b038616929190611c9d565b610c438688612f1d565b6040516370a0823160e01b815282906001600160a01b038516906370a0823190610c719030906004016127c6565b60206040518083038186803b158015610c8957600080fd5b505afa158015610c9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cc191906126b2565b610ccb9190612f35565b14610ce85760405162461bcd60e51b81526004016103049061298b565b6001546040517f40aa607a0000000000000000000000000000000000000000000000000000000081526000916001600160a01b0316906340aa607a90610d38908f908f908f908f906004016128a2565b6101006040518083038186803b158015610d5157600080fd5b505afa158015610d65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d899190612626565b50505050935050505060006001600160a01b0316816001600160a01b03161415610dc55760405162461bcd60e51b815260040161030490612ac2565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610df49030906004016127c6565b60206040518083038186803b158015610e0c57600080fd5b505afa158015610e20573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4491906126b2565b600154909150610e5f9085906001600160a01b03168b611b15565b600160009054906101000a90046001600160a01b03166001600160a01b0316637c6204128e8e8e8e8e6040518663ffffffff1660e01b8152600401610ea89594939291906128d3565b600060405180830381600087803b158015610ec257600080fd5b505af1158015610ed6573d6000803e3d6000fd5b50505050600081836001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401610f0991906127c6565b60206040518083038186803b158015610f2157600080fd5b505afa158015610f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5991906126b2565b610f639190612f35565b9050808a1115610f855760405162461bcd60e51b815260040161030490612e7c565b600254610f9d9084906001600160a01b03168c611b15565b600254610fb59086906001600160a01b03168b611b15565b600260009054906101000a90046001600160a01b03166001600160a01b031663e8e33700848f8d8d8d8d338e6040518963ffffffff1660e01b8152600401611004989796959493929190612818565b606060405180830381600087803b15801561101e57600080fd5b505af1158015611032573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110569190612714565b5050506110638383611cbe565b61106d8585611cbe565b5050505050505050505050505050565b6001600160a01b03821663d505accf6110996020840184611fd9565b6110a96040850160208601611fd9565b604085013560608601356110c360a0880160808901612741565b8760a001358860c001356040518863ffffffff1660e01b81526004016110ef9796959493929190612861565b600060405180830381600087803b15801561110957600080fd5b505af115801561111d573d6000803e3d6000fd5b505050505050565b600084116111455760405162461bcd60e51b8152600401610304906129c0565b81600f0b600014156111695760405162461bcd60e51b815260040161030490612b67565b6000806111798a8a8a8a8a61169e565b5091509150611189828683611b15565b6040517f44ee19860000000000000000000000000000000000000000000000000000000081526001600160a01b038616906344ee1986906111d7906000908890869089903390600401612925565b602060405180830381600087803b1580156111f157600080fd5b505af1158015611205573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061043491906126b2565b600086116112495760405162461bcd60e51b8152600401610304906129c0565b428110156112695760405162461bcd60e51b815260040161030490612dd7565b600085116112895760405162461bcd60e51b815260040161030490612a8b565b828510156112a95760405162461bcd60e51b815260040161030490612af9565b600084116112c95760405162461bcd60e51b815260040161030490612c0a565b818410156112e95760405162461bcd60e51b815260040161030490612b30565b60008060008060006112fe8f8f8f8f8f61169e565b925092509250818a11156113245760405162461bcd60e51b815260040161030490612e7c565b6040516370a0823160e01b815292945092508c91600091506001600160a01b038316906370a082319061135b9030906004016127c6565b60206040518083038186803b15801561137357600080fd5b505afa158015611387573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ab91906126b2565b90506113c26001600160a01b03831633308b611c9d565b600081836001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113f191906127c6565b60206040518083038186803b15801561140957600080fd5b505afa15801561141d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144191906126b2565b61144b9190612f35565b90506000811161146d5760405162461bcd60e51b81526004016103049061298b565b6002546114859086906001600160a01b03168c611b15565b60025461149d9084906001600160a01b03168b611b15565b600260009054906101000a90046001600160a01b03166001600160a01b031663e8e3370086858d858d8d338e6040518963ffffffff1660e01b81526004016114ec989796959493929190612818565b606060405180830381600087803b15801561150657600080fd5b505af115801561151a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061153e9190612714565b505050600084866001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161157091906127c6565b60206040518083038186803b15801561158857600080fd5b505afa15801561159c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c091906126b2565b6115ca9190612f35565b905080156115e6576115e66001600160a01b0387163383610a6d565b600083856001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161161591906127c6565b60206040518083038186803b15801561162d57600080fd5b505afa158015611641573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166591906126b2565b61166f9190612f35565b9050801561168b5761168b6001600160a01b0386163383610a6d565b5050505050505050505050505050505050565b6001546040517f40aa607a00000000000000000000000000000000000000000000000000000000815260009182918291829182916001600160a01b0316906340aa607a906116f6908d908d908d908d906004016128a2565b6101006040518083038186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117479190612626565b5050509450945050505060006001600160a01b0316826001600160a01b03161415801561177c57506001600160a01b03811615155b6117985760405162461bcd60e51b815260040161030490612ac2565b6040516370a0823160e01b81528a906000906001600160a01b038316906370a08231906117c99030906004016127c6565b60206040518083038186803b1580156117e157600080fd5b505afa1580156117f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061181991906126b2565b90506118306001600160a01b03831633308b611c9d565b600081836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161185f91906127c6565b60206040518083038186803b15801561187757600080fd5b505afa15801561188b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118af91906126b2565b6118b99190612f35565b9050600081116118db5760405162461bcd60e51b815260040161030490612ce6565b6040516370a0823160e01b81526001600160a01b038616906370a08231906119079030906004016127c6565b60206040518083038186803b15801561191f57600080fd5b505afa158015611933573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195791906126b2565b95506000846001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161198791906127c6565b60206040518083038186803b15801561199f57600080fd5b505afa1580156119b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d791906126b2565b6001549091506119f29085906001600160a01b031684611b15565b600160009054906101000a90046001600160a01b03166001600160a01b031663ff9940608f8f8f8f876040518663ffffffff1660e01b8152600401611a3b9594939291906128d3565b600060405180830381600087803b158015611a5557600080fd5b505af1158015611a69573d6000803e3d6000fd5b50505050611a778582611cbe565b6040516370a0823160e01b815287906001600160a01b038816906370a0823190611aa59030906004016127c6565b60206040518083038186803b158015611abd57600080fd5b505afa158015611ad1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af591906126b2565b611aff9190612f35565b9750859850505050505050955095509592505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063dd62ed3e90611b5f90309087906004016127da565b60206040518083038186803b158015611b7757600080fd5b505afa158015611b8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611baf91906126b2565b905081811015611c08578015611bd457611bd46001600160a01b038516846000611d63565b611c086001600160a01b038516847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611d63565b50505050565b6000611c63826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611e3f9092919063ffffffff16565b805190915015610af05780806020019051810190611c81919061260c565b610af05760405162461bcd60e51b815260040161030490612d1d565b611c08846323b872dd60e01b858585604051602401610a8c939291906127f4565b600081836001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ced91906127c6565b60206040518083038186803b158015611d0557600080fd5b505afa158015611d19573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3d91906126b2565b611d479190612f35565b90508015610af057610af06001600160a01b0384163383610a6d565b801580611e0457506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081526001600160a01b0384169063dd62ed3e90611db290309086906004016127da565b60206040518083038186803b158015611dca57600080fd5b505afa158015611dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0291906126b2565b155b611e205760405162461bcd60e51b815260040161030490612d7a565b610af08363095ea7b360e01b8484604051602401610a8c92919061290c565b6060611e4e8484600085611e56565b949350505050565b6060611e6185611f19565b611e7d5760405162461bcd60e51b815260040161030490612c78565b600080866001600160a01b03168587604051611e9991906127aa565b60006040518083038185875af1925050503d8060008114611ed6576040519150601f19603f3d011682016040523d82523d6000602084013e611edb565b606091505b50915091508115611eef579150611e4e9050565b805115611eff5780518082602001fd5b8360405162461bcd60e51b81526004016103049190612958565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611f4d57508115155b925050505b919050565b60008083601f840112611f68578081fd5b50813567ffffffffffffffff811115611f7f578182fd5b6020830191508360208083028501011115611f9957600080fd5b9250929050565b80518015158114611f5257600080fd5b8035600f81900b8114611f5257600080fd5b600060e08284031215611fd3578081fd5b50919050565b600060208284031215611fea578081fd5b8135611ff581612fa4565b9392505050565b600080600080600080600080610100898b031215612018578384fd5b883561202381612fa4565b9750602089013561203381612fa4565b9650604089013561204381612fbc565b9550606089013594506080890135935060a089013561206181612fa4565b925061206f60c08a01611fb0565b915060e089013590509295985092959890939650565b60008060008060008060008060006101e08a8c0312156120a3578081fd5b89356120ae81612fa4565b985060208a01356120be81612fa4565b975060408a01356120ce81612fbc565b965060608a0135955060808a0135945060a08a01356120ec81612fa4565b93506120fa60c08b01611fb0565b925060e08a013591506121118b6101008c01611fc2565b90509295985092959850929598565b60008060008060008060008060006101008a8c03121561213e578485fd5b893561214981612fa4565b985060208a013561215981612fa4565b975060408a013561216981612fbc565b965060608a0135955060808a0135945060a08a0135935060c08a013567ffffffffffffffff811115612199578384fd5b6121a58c828d01611f57565b9a9d999c50979a9699959894979660e00135949350505050565b6000806000806000806000806000806101e08b8d0312156121de578384fd5b8a356121e981612fa4565b995060208b01356121f981612fa4565b985060408b013561220981612fbc565b975060608b0135965060808b0135955060a08b0135945060c08b013567ffffffffffffffff811115612239578485fd5b6122458d828e01611f57565b90955093505060e08b013591506122608c6101008d01611fc2565b90509295989b9194979a5092959850565b60008060008060008060008060006101208a8c03121561228f578283fd5b893561229a81612fa4565b985060208a01356122aa81612fa4565b975060408a01356122ba81612fbc565b989b979a5097986060810135985060808101359760a0820135975060c0820135965060e08201359550610100909101359350915050565b6000806000806000806000806000806102008b8d031215612310578384fd5b8a3561231b81612fa4565b995060208b013561232b81612fa4565b985060408b013561233b81612fbc565b975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b013592506101008b013591506122608c6101208d01611fc2565b6000806000806000806000806000806101408b8d031215612395578384fd5b8a356123a081612fa4565b995060208b01356123b081612fa4565b985060408b01356123c081612fbc565b999c989b5098996060810135995060808101359860a0820135985060c0820135975060e082013596506101008201359550610120909101359350915050565b60008060008060008060008060008060006102208c8e031215612420578485fd5b8b3561242b81612fa4565b9a5060208c013561243b81612fa4565b995060408c013561244b81612fbc565b985060608c0135975060808c0135965060a08c0135955060c08c0135945060e08c013593506101008c013592506101208c0135915061248e8d6101408e01611fc2565b90509295989b509295989b9093969950565b6000806000806000806000806000806000806103008d8f0312156124c2578586fd5b8c356124cd81612fa4565b9b5060208d01356124dd81612fa4565b9a5060408d01356124ed81612fbc565b995060608d0135985060808d0135975060a08d0135965060c08d0135955060e08d013594506101008d013593506101208d013592506125308e6101408f01611fc2565b91506125408e6102208f01611fc2565b90509295989b509295989b509295989b565b60006020808385031215612564578182fd5b825167ffffffffffffffff8082111561257b578384fd5b818501915085601f83011261258e578384fd5b8151818111156125a0576125a0612f8e565b838102604051858282010181811085821117156125bf576125bf612f8e565b604052828152858101935084860182860187018a10156125dd578788fd5b8795505b838610156125ff5780518552600195909501949386019386016125e1565b5098975050505050505050565b60006020828403121561261d578081fd5b611ff582611fa0565b600080600080600080600080610100898b031215612642578182fd5b61264b89611fa0565b9750602089015161265b81612fbc565b60408a015190975061266c81612fa4565b60608a015190965061267d81612fa4565b60808a015190955061268e81612fa4565b60a08a015160c08b015160e0909b0151999c989b5096999598909790945092505050565b6000602082840312156126c3578081fd5b5051919050565b6000806000604084860312156126de578081fd5b83359250602084013567ffffffffffffffff8111156126fb578182fd5b61270786828701611f57565b9497909650939450505050565b600080600060608486031215612728578081fd5b8351925060208401519150604084015190509250925092565b600060208284031215612752578081fd5b813560ff81168114611ff5578182fd5b60008284526020808501945082825b8581101561279f57813561278481612fa4565b6001600160a01b031687529582019590820190600101612771565b509495945050505050565b600082516127bc818460208701612f4c565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b039889168152968816602088015260408701959095526060860193909352608085019190915260a084015290921660c082015260e08101919091526101000190565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b6001600160a01b03948516815292909316602083015265ffffffffffff166040820152606081019190915260800190565b6001600160a01b03958616815293909416602084015265ffffffffffff9190911660408301526060820152608081019190915260a00190565b6001600160a01b03929092168252602082015260400190565b600f95860b81529390940b6020840152604083019190915260608201526001600160a01b03909116608082015260a00190565b6000602082528251806020840152612977816040850160208701612f4c565b601f01601f19169190910160400192915050565b6020808252818101527f52756c65725a61703a20706169726564207472616e73666572206661696c6564604082015260600190565b60208082526016908201527f52756c65725a61703a205f636f6c416d74206973203000000000000000000000604082015260600190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201527f6464726573730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526016908201527f52756c65725a61703a2062616c616e6365206973203000000000000000000000604082015260600190565b6020808252601d908201527f52756c65725a61703a2030207263546f6b656e4465706f736974416d74000000604082015260600190565b60208082526018908201527f52756c65725a61703a2070616972206e6f742065786973740000000000000000604082015260600190565b6020808252601b908201527f52756c65725a61703a207263546f6b656e20416d74203c206d696e0000000000604082015260600190565b6020808252601a908201527f52756c65725a61703a2070616972656420416d74203c206d696e000000000000604082015260600190565b6020808252601d908201527f52756c65725a61703a205f6f7574546f6b656e496e6465782069732030000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526014908201527f52756c65725a61703a205f636f72652069732030000000000000000000000000604082015260600190565b6020808252601c908201527f52756c65725a61703a2030207061697265644465706f736974416d7400000000604082015260600190565b6020808252601a908201527f52756c65725a61703a205f70617468206c656e677468203c2032000000000000604082015260600190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252601a908201527f52756c65725a61703a20696e70757420213d207263546f6b656e000000000000604082015260600190565b6020808252601d908201527f52756c65725a61703a20636f6c207472616e73666572206661696c6564000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526036908201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60408201527f20746f206e6f6e2d7a65726f20616c6c6f77616e636500000000000000000000606082015260800190565b6020808252601b908201527f52756c65725a61703a205f646561646c696e6520696e20706173740000000000604082015260600190565b60208082526016908201527f52756c65725a61703a205f726f75746572206973203000000000000000000000604082015260600190565b6020808252601b908201527f52756c65725a61703a206f757470757420213d205f7061697265640000000000604082015260600190565b6020808252601e908201527f52756c65725a61703a207263546f6b656e20416d74203e206d696e7465640000604082015260600190565b90815260200190565b600084825260406020830152612ed6604083018486612762565b95945050505050565b600087825286602083015260a06040830152612eff60a083018688612762565b6001600160a01b039490941660608301525060800152949350505050565b60008219821115612f3057612f30612f78565b500190565b600082821015612f4757612f47612f78565b500390565b60005b83811015612f67578181015183820152602001612f4f565b83811115611c085750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612fb957600080fd5b50565b65ffffffffffff81168114612fb957600080fdfea264697066735822122023a42f235f91dbdcaf06af65eb3070e734ca3bcb8f812d906613c543b44262b964736f6c63430008000033

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

000000000000000000000000f19f4490a7fccfef2dab8199acdb2dc1b9027c18000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f

-----Decoded View---------------
Arg [0] : _core (address): 0xF19f4490A7fCCfEf2DaB8199ACDB2Dc1B9027C18
Arg [1] : _router (address): 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000f19f4490a7fccfef2dab8199acdb2dc1b9027c18
Arg [1] : 000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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