ETH Price: $3,006.58 (+4.36%)
Gas: 2 Gwei

Contract

0xf5f28e0c67892dD013fEA08618aee727b19c77aC
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60806040148458872022-05-26 4:11:46772 days ago1653538306IN
 Create: UniswapVault
0 ETH0.1680147839.83109004

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniswapVault

Compiler Version
v0.8.11+commit.d7f03943

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 19 : UniswapVault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;

import "../../../lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "../../../lib/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "../../../lib/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "../../../lib/v2-core/contracts/interfaces/IUniswapV2Pair.sol";

import "../Vault.sol";
import "./UniswapVaultStorage.sol";

/// @notice Contains the primary logic for Uniswap Vaults
/// @author Recursive Research Inc
contract UniswapVault is Vault, UniswapVaultStorage {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    function initialize(
        address coreAddress,
        uint256 _epochDuration,
        address _token0,
        address _token1,
        uint256 _token0FloorNum,
        uint256 _token1FloorNum,
        address _uniswapFactory,
        address _uniswapRouter
    ) public virtual initializer {
        __UniswapVault_init(
            coreAddress,
            _epochDuration,
            _token0,
            _token1,
            _token0FloorNum,
            _token1FloorNum,
            _uniswapFactory,
            _uniswapRouter
        );
    }

    function __UniswapVault_init(
        address coreAddress,
        uint256 _epochDuration,
        address _token0,
        address _token1,
        uint256 _token0FloorNum,
        uint256 _token1FloorNum,
        address _uniswapFactory,
        address _uniswapRouter
    ) internal onlyInitializing {
        __Vault_init(coreAddress, _epochDuration, _token0, _token1, _token0FloorNum, _token1FloorNum);
        __UniswapVault_init_unchained(_uniswapFactory, _uniswapRouter);
    }

    function __UniswapVault_init_unchained(address _uniswapFactory, address _uniswapRouter) internal onlyInitializing {
        pair = IUniswapV2Factory(_uniswapFactory).getPair(address(token0), address(token1));

        // require that the pair has been created
        require(pair != address(0), "ZERO_ADDRESS");

        factory = _uniswapFactory;
        router = _uniswapRouter;
    }

    // @dev queries the pool reserves and ensure the token ordering is correct
    function getPoolBalances() internal view virtual override returns (uint256, uint256) {
        (uint256 reservesA, uint256 reservesB, ) = IUniswapV2Pair(pair).getReserves();
        return IUniswapV2Pair(pair).token0() == address(token0) ? (reservesA, reservesB) : (reservesB, reservesA);
    }

    // This is provided automatically by the Uniswap router
    function calcAmountIn(
        uint256 amountOut,
        uint256 reserveIn,
        uint256 reserveOut
    ) internal view virtual override returns (uint256) {
        return IUniswapV2Router02(router).getAmountIn(amountOut, reserveIn, reserveOut);
    }

    // Withdraws all liquidity
    // @dev We can ignore the need for frontrunning checks because the `_nextEpoch` function checks
    // that the pool reserves are as expected beforehand
    function _withdrawLiquidity() internal virtual override {
        uint256 lpTokenBalance = IERC20Upgradeable(pair).balanceOf(address(this));
        if (lpTokenBalance == 0) return;

        // use the router to remove liquidity from the uni pool
        // don't need to decrease allowance afterwards because router guarantees the full amount is burned
        // safe to ignore return values because we check balances before and after this call
        IERC20Upgradeable(pair).safeIncreaseAllowance(router, lpTokenBalance);
        IUniswapV2Router02(router).removeLiquidity(
            address(token0),
            address(token1),
            lpTokenBalance,
            0,
            0,
            address(this),
            block.timestamp
        );
    }

    // Deposits available liquidity
    // @dev We can ignore the need for frontrunning checks because the `_nextEpoch` function checks
    // that the pool reserves are as expected beforehand
    // `availableToken0` and `availableToken1` are also known to be greater than 0 since they are checked
    // by `depositLiquidity` in `Vault.sol`
    function _depositLiquidity(uint256 availableToken0, uint256 availableToken1)
        internal
        virtual
        override
        returns (uint256 token0Deposited, uint256 token1Deposited)
    {
        // use the router to deposit `token0` and `token1`
        token0.safeIncreaseAllowance(router, availableToken0);
        token1.safeIncreaseAllowance(router, availableToken1);
        // can safely ignore `liquidity` return value because when withdrawing we check our full balance
        (token0Deposited, token1Deposited, ) = IUniswapV2Router02(router).addLiquidity(
            address(token0),
            address(token1),
            availableToken0,
            availableToken1,
            0,
            0,
            address(this),
            block.timestamp
        );

        // if we didn't deposit the full `availableToken{x}`, reduce allowance for safety
        if (availableToken0 > token0Deposited) {
            token0.safeApprove(router, 0);
        }
        if (availableToken1 > token1Deposited) {
            token1.safeApprove(router, 0);
        }
    }

    // For the default Uniswap vault this does nothing
    function _unstakeLiquidity() internal virtual override {}

    // For the default Uniswap vault this does nothing
    function _stakeLiquidity() internal virtual override {}

    // Swaps tokens
    // @dev We can ignore the need for frontrunning checks because the `_nextEpoch` function checks
    // that the pool reserves are as expected beforehand
    function swap(
        IERC20Upgradeable tokenIn,
        IERC20Upgradeable tokenOut,
        uint256 amountIn
    ) internal virtual override returns (uint256 amountOut, uint256 amountConsumed) {
        if (amountIn == 0) return (0, 0);

        tokenIn.safeIncreaseAllowance(router, amountIn);
        amountOut = IUniswapV2Router02(router).swapExactTokensForTokens(
            amountIn,
            0,
            getPath(address(tokenIn), address(tokenOut)),
            address(this),
            block.timestamp
        )[1];
        amountConsumed = amountIn;
    }

    /// @notice converts two addresses into an address[] type
    function getPath(address _from, address _to) internal pure returns (address[] memory path) {
        path = new address[](2);
        path[0] = _from;
        path[1] = _to;
    }
}

File 2 of 19 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable for address;

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

    function safeTransferFrom(
        IERC20Upgradeable 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(
        IERC20Upgradeable 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'
        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(
        IERC20Upgradeable 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(
        IERC20Upgradeable token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - 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(IERC20Upgradeable 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
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 3 of 19 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 4 of 19 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 5 of 19 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

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

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

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

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 6 of 19 : Vault.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;

// Have to use SafeERC20Upgradeable instead of SafeERC20 because SafeERC20 inherits Address.sol,
// which uses delegeatecall functions, which are not allowed by OZ's upgrade process
// See more:
// https://forum.openzeppelin.com/t/error-contract-is-not-upgrade-safe-use-of-delegatecall-is-not-allowed/16859
import "../../lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "../../lib/openzeppelin-contracts-upgradeable/contracts/security/ReentrancyGuardUpgradeable.sol";

import "../external/IWrappy.sol";
import "../refs/CoreReference.sol";
import "./VaultStorage.sol";
import "./IVault.sol";

/// @notice Contains the primary logic for vaults
/// @author Recursive Research Inc
abstract contract Vault is IVault, CoreReference, ReentrancyGuardUpgradeable, VaultStorage {
    using SafeERC20Upgradeable for IERC20Upgradeable;

    bytes32 public constant TOKEN0 = keccak256("TOKEN0");
    bytes32 public constant TOKEN1 = keccak256("TOKEN1");

    uint256 public constant RAY = 1e27;
    uint256 public constant POOL_ERR = 50; // 0.5% error margin allowed
    uint256 public constant DENOM = 10_000;
    uint256 public constant MIN_LP = 1000; // minimum amount of tokens to be deposited as LP

    // ----------- Upgradeable Constructor Pattern -----------

    /// Initializes the vault to point to the Core contract and configures it to have
    /// a given epoch duration, pair of tokens, and floor returns on each Token
    /// @param coreAddress address of the Core contract
    /// @param _epochDuration duration of the epoch in seconds
    /// @param _token0 address of TOKEN0
    /// @param _token1 address of TOKEN1
    /// @param _token0FloorNum the floor returns of the TOKEN0 side (out of `DENOM`). In practice,
    ///     10000 to guarantee lossless returns for the TOKEN0 side.
    /// @param _token1FloorNum the floor returns of the TOKEN1 side (out of `DENOM`). In practice,
    ///     500 to prevent accounting errors.
    function __Vault_init(
        address coreAddress,
        uint256 _epochDuration,
        address _token0,
        address _token1,
        uint256 _token0FloorNum,
        uint256 _token1FloorNum
    ) internal onlyInitializing {
        __CoreReference_init(coreAddress);
        __ReentrancyGuard_init();
        __Vault_init_unchained(_epochDuration, _token0, _token1, _token0FloorNum, _token1FloorNum);
    }

    function __Vault_init_unchained(
        uint256 _epochDuration,
        address _token0,
        address _token1,
        uint256 _token0FloorNum,
        uint256 _token1FloorNum
    ) internal onlyInitializing {
        require(_token0FloorNum > 0, "INVALID_TOKEN0_FLOOR");
        require(_token1FloorNum > 0, "INVALID_TOKEN1_FLOOR");

        isNativeVault = _token0 == core.wrappedNative();

        token0 = IERC20Upgradeable(_token0);
        token1 = IERC20Upgradeable(_token1);

        token0Data.epochToRate[0] = RAY;
        token1Data.epochToRate[0] = RAY;
        epoch = 1;
        epochDuration = _epochDuration;
        token0FloorNum = _token0FloorNum;
        token1FloorNum = _token1FloorNum;
    }

    // ----------- Deposit Requests -----------

    /// @notice schedules a deposit of TOKEN0 into the floor tranche
    /// @dev currently does not support fee on transfer / deflationary tokens.
    /// @param _amount the amount of the TOKEN0 to schedule-deposit if a non native vault,
    ///     and unused if it's a native vault. msg.value must be zero if not a native vault
    ///     typechain does not allow payable function overloading so we can either have 2 different
    ///     names or consolidate them into the same function as we do here
    function depositToken0(uint256 _amount) external payable override whenNotPaused nonReentrant {
        if (isNativeVault) {
            IWrappy(address(token0)).deposit{ value: msg.value }();
            _depositAccounting(token0Data, msg.value, TOKEN0);
        } else {
            require(msg.value == 0, "NOT_NATIVE_VAULT");
            token0.safeTransferFrom(msg.sender, address(this), _amount);
            _depositAccounting(token0Data, _amount, TOKEN0);
        }
    }

    /// @notice schedules a deposit of the TOKEN1 into the ceiling tranche
    /// @dev currently does not support fee on transfer / deflationary tokens.
    /// @param _amount the amount of the TOKEN1 to schedule-deposit
    function depositToken1(uint256 _amount) external override whenNotPaused nonReentrant {
        token1.safeTransferFrom(msg.sender, address(this), _amount);
        _depositAccounting(token1Data, _amount, TOKEN1);
    }

    /// @dev handles the accounting for scheduling deposits in a way that abstracts the logic
    /// @param assetData storage reference to the data for the desired asset
    /// @param _depositAmount the amount of the asset to deposit
    /// @param assetCode code for the type of asset (either `TOKEN0` or `TOKEN1`)
    function _depositAccounting(
        AssetData storage assetData,
        uint256 _depositAmount,
        bytes32 assetCode
    ) private {
        require(_depositAmount > 0, "ZERO_AMOUNT");
        uint256 currEpoch = epoch;

        // Check their prior deposit requests and flush to balanceDay0 if needed
        assetData.balanceDay0[msg.sender] = __updateDepositRequests(assetData, currEpoch, _depositAmount);

        // track total deposit requests
        assetData.depositRequestsTotal += _depositAmount;

        emit DepositScheduled(assetCode, msg.sender, _depositAmount, currEpoch);
    }

    /// @dev for updating the deposit requests with any new deposit amount
    /// or flushing the deposits to balanceDay0 if the epoch of the request has passed
    /// @param assetData storage reference to the data for the desired asset
    /// @param currEpoch current epoch (passed to save a storage read)
    /// @param _depositAmount amount of deposits
    /// @return newBalanceDay0 new balance day 0 of the user (returned to save a storage read)
    function __updateDepositRequests(
        AssetData storage assetData,
        uint256 currEpoch,
        uint256 _depositAmount
    ) private returns (uint256 newBalanceDay0) {
        Request storage req = assetData.depositRequests[msg.sender];

        uint256 balance = assetData.balanceDay0[msg.sender];
        uint256 reqAmount = req.amount;

        // If they have a prior request
        if (reqAmount > 0 && req.epoch < currEpoch) {
            // and if it was from a prior epoch
            // we now know the exchange rate at that epoch,
            // so we can add to their balance
            uint256 conversionRate = assetData.epochToRate[req.epoch];
            // will not overflow even if value = total mc of crypto
            balance += (reqAmount * RAY) / conversionRate;

            reqAmount = 0;
        }

        if (_depositAmount > 0) {
            // if they don't have a prior request, store this one (if this is a non-zero deposit)
            reqAmount += _depositAmount;
            req.epoch = currEpoch;
        }
        req.amount = reqAmount;

        return balance;
    }

    // ----------- Withdraw Requests -----------

    /// @notice schedules a withdrawal of TOKEN0 from the floor tranche
    /// @param _amount amount of Day 0 TOKEN0 to withdraw
    function withdrawToken0(uint256 _amount) external override whenNotPaused nonReentrant {
        _withdrawAccounting(token0Data, _amount, TOKEN0);
    }

    /// @notice schedules a withdrawal of the TOKEN1 from the ceiling tranche
    /// @param _amount amount of Day 0 TOKEN1 to withdraw
    function withdrawToken1(uint256 _amount) external override whenNotPaused nonReentrant {
        _withdrawAccounting(token1Data, _amount, TOKEN1);
    }

    /// @dev handles the accounting for schedules withdrawals in a way that abstracts the logic
    /// @param assetData storage reference to the data for the desired asset
    /// @param _withdrawAmountDay0 the amount of the asset to withdraw
    /// @param assetCode code for the type of asset (either `TOKEN0` or `TOKEN1`)
    function _withdrawAccounting(
        AssetData storage assetData,
        uint256 _withdrawAmountDay0,
        bytes32 assetCode
    ) private {
        require(_withdrawAmountDay0 > 0, "ZERO_AMOUNT");
        uint256 currEpoch = epoch;

        // Check if they have any deposit request that
        // might not have been flushed to the deposit mapping yet
        uint256 userBalanceDay0 = __updateDepositRequests(assetData, currEpoch, 0);

        // See if there were any existing withdraw requests
        Request storage req = assetData.withdrawRequests[msg.sender];
        if (req.amount > 0 && req.epoch < currEpoch) {
            // If there was a request from a previous epoch, we now know the corresponding amount
            // that was withdrawn and we can add it to the accumulated amount of claimable assets
            // tokenAmount * epochToRate will not overflow even if value = total mc of crypto & rate = 3.8e10 * RAY
            assetData.claimable[msg.sender] += (req.amount * assetData.epochToRate[req.epoch]) / RAY;
            req.amount = 0;
        }

        // Subtract the amount they way to withdraw from their deposit amount
        // Want to explicitly send out own reversion message
        require(userBalanceDay0 >= _withdrawAmountDay0, "INSUFFICIENT_BALANCE");
        unchecked {
            assetData.balanceDay0[msg.sender] = userBalanceDay0 - _withdrawAmountDay0;
        }

        // Add it to their withdraw request and log the epoch
        req.amount = _withdrawAmountDay0 + req.amount;
        if (req.epoch < currEpoch) {
            req.epoch = currEpoch;
        }

        // track total withdraw requests
        assetData.withdrawRequestsTotal += _withdrawAmountDay0;

        emit WithdrawScheduled(assetCode, msg.sender, _withdrawAmountDay0, currEpoch);
    }

    // ----------- Claim Functions -----------

    /// @notice allows the user (`msg.sender`) to claim the TOKEN0 they have a right to once
    /// withdrawal requests are processed
    function claimToken0() external override whenNotPaused nonReentrant {
        uint256 claim = _claimAccounting(token0Data, TOKEN0);

        if (isNativeVault) {
            IWrappy(address(token0)).withdraw(claim);
            (bool success, ) = msg.sender.call{ value: claim }("");
            require(success, "TRANSFER_FAILED");
        } else {
            token0.safeTransfer(msg.sender, claim);
        }
    }

    /// @notice allows the user (`msg.sender`) to claim the TOKEN1 they have a right to once
    /// withdrawal requests are processed
    function claimToken1() external override whenNotPaused nonReentrant {
        uint256 claim = _claimAccounting(token1Data, TOKEN1);
        token1.safeTransfer(msg.sender, claim);
    }

    /// @notice calculates the current amount of an asset the user (`msg.sender`) has claim to
    /// after withdrawal requests are processed and abstracts away the accounting logic
    /// @param assetData storage reference to the data for the desired asset
    /// @return _claim amount of the asset the user has a claim to
    /// @param assetCode code for the type of asset (either `TOKEN0` or `TOKEN1`)
    function _claimAccounting(AssetData storage assetData, bytes32 assetCode) private returns (uint256 _claim) {
        Request storage withdrawReq = assetData.withdrawRequests[msg.sender];
        uint256 currEpoch = epoch;
        uint256 withdrawEpoch = withdrawReq.epoch;

        uint256 claimable = assetData.claimable[msg.sender];
        if (withdrawEpoch < currEpoch) {
            // If epoch ended, calculate the amount they can withdraw
            uint256 withdrawAmountDay0 = withdrawReq.amount;
            if (withdrawAmountDay0 > 0) {
                delete assetData.withdrawRequests[msg.sender];
                // tokenAmount * epochToRate will not overflow even if value = total mc of crypto & rate = 3.8e10 * RAY
                claimable += (withdrawAmountDay0 * assetData.epochToRate[withdrawEpoch]) / RAY;
            }
        }

        require(claimable > 0, "NO_CLAIM");
        assetData.claimable[msg.sender] = 0;
        assetData.claimableTotal -= claimable;
        emit AssetsClaimed(assetCode, msg.sender, claimable);
        return claimable;
    }

    // ----------- Balance Functions -----------

    /// @notice gets a user's current TOKEN0 balance
    /// @param user address of the user in which whose balance we are interested
    /// @return deposited amount of deposited TOKEN0 in the protocol
    /// @return pendingDeposit amount of TOKEN0 pending deposit
    /// @return claimable amount of TOKEN0 ready to be withdrawn
    function token0Balance(address user)
        external
        view
        override
        returns (
            uint256 deposited,
            uint256 pendingDeposit,
            uint256 claimable
        )
    {
        return _balance(token0Data, user);
    }

    /// @notice gets a user's current TOKEN1 balance
    /// @param user address of the user in which whose balance we are interested
    /// @return deposited amount of deposited TOKEN1 in the protocol
    /// @return pendingDeposit amount of TOKEN1 pending deposit
    /// @return claimable amount of TOKEN1 ready to be withdrawn
    function token1Balance(address user)
        external
        view
        override
        returns (
            uint256 deposited,
            uint256 pendingDeposit,
            uint256 claimable
        )
    {
        return _balance(token1Data, user);
    }

    /// @dev handles the balance calculations in a way that abstracts the logic
    /// @param assetData storage reference to the data for the desired asset
    /// @param user address of the user in which whose balance we are interested
    /// @return _deposited amount of their asset that is deposited in the protocol
    /// @return _pendingDeposit amount of their asset pending deposit
    /// @return _claimable amount of their asset ready to be withdrawn
    function _balance(AssetData storage assetData, address user)
        private
        view
        returns (
            uint256 _deposited,
            uint256 _pendingDeposit,
            uint256 _claimable
        )
    {
        uint256 currEpoch = epoch;

        uint256 balanceDay0 = assetData.balanceDay0[user];

        // then check if they have any open deposit requests
        Request memory depositReq = assetData.depositRequests[user];
        uint256 depositAmt = depositReq.amount;
        uint256 depositEpoch = depositReq.epoch;

        if (depositAmt > 0) {
            // if they have one from a previous epoch, add the Day 0 amount that
            // deposit is worth
            if (depositEpoch < currEpoch) {
                balanceDay0 += (depositAmt * RAY) / assetData.epochToRate[depositEpoch];
            } else {
                // if they have one from this epoch, set the flat amount
                _pendingDeposit = depositAmt;
            }
        }

        // Check their withdraw requests, because if they made one
        // their deposit balances would have been flushed to here
        Request memory withdrawReq = assetData.withdrawRequests[user];
        _claimable = assetData.claimable[user];
        if (withdrawReq.amount > 0) {
            // if they have one from a previous epoch, calculate that
            // requests day 0 Value
            if (withdrawReq.epoch < currEpoch) {
                _claimable += (withdrawReq.amount * assetData.epochToRate[withdrawReq.epoch]) / RAY;
            } else {
                // if they have one from this epoch, that means the tokens are still active
                balanceDay0 += withdrawReq.amount;
            }
        }

        /* TODO: this would be better calculated if we simulated ending the epoch here
        because this doesn't consider the IL / profits from this current epoch
        but this is fine for now */
        // Note that currEpoch >= 1 since it is initialized to 1 in the constructor
        uint256 currentConversionRate = assetData.epochToRate[currEpoch - 1];

        // tokenAmount * epochToRate will not overflow even if value = total mc of crypto & rate = 3.8e10 * RAY
        return ((balanceDay0 * currentConversionRate) / RAY, _pendingDeposit, _claimable);
    }

    // ----------- Next Epoch Functions -----------

    /// @notice Struct just for wrapper around local variables to avoid the stack limit in `nextEpoch()`
    struct NextEpochVariables {
        uint256 poolBalance;
        uint256 withdrawn;
        uint256 available;
        uint256 original;
        uint256 newRate;
        uint256 newClaimable;
    }

    /// @notice Initiates the next epoch
    /// @param expectedPoolToken0 the approximate amount of TOKEN0 expected to be in the pool (preventing frontrunning)
    /// @param expectedPoolToken1 the approximate amount of TOKEN1 expected to be in the pool (preventing frontrunning)
    function nextEpoch(uint256 expectedPoolToken0, uint256 expectedPoolToken1)
        external
        override
        onlyStrategist
        whenNotPaused
    {
        require(block.timestamp - lastEpochStart >= epochDuration, "EPOCH_DURATION_UNMET");

        AssetDataStatics memory _token0Data = _assetDataStatics(token0Data);
        AssetDataStatics memory _token1Data = _assetDataStatics(token1Data);
        // These are used to avoid hitting the local variable stack limit
        NextEpochVariables memory _token0;
        NextEpochVariables memory _token1;

        uint256 currEpoch = epoch;

        // Total tokens in the liquidity pool and our ownership of those tokens
        (_token0.poolBalance, _token1.poolBalance) = getPoolBalances();
        // will not overflow with reasonable expectedPoolToken amount (DENOM = 10,000)
        require(_token0.poolBalance >= (expectedPoolToken0 * (DENOM - POOL_ERR)) / DENOM, "UNEXPECTED_POOL_BALANCES");
        require(_token0.poolBalance <= (expectedPoolToken0 * (DENOM + POOL_ERR)) / DENOM, "UNEXPECTED_POOL_BALANCES");
        require(_token1.poolBalance >= (expectedPoolToken1 * (DENOM - POOL_ERR)) / DENOM, "UNEXPECTED_POOL_BALANCES");
        require(_token1.poolBalance <= (expectedPoolToken1 * (DENOM + POOL_ERR)) / DENOM, "UNEXPECTED_POOL_BALANCES");
        // !!NOTE: After this point we don't need to worry about front-running anymore because the pool's state has been
        // verified (as long as there is no calls to untrusted external parties)

        // (1) Withdraw liquidity
        (_token0.withdrawn, _token1.withdrawn) = withdrawLiquidity();
        (_token0.poolBalance, _token1.poolBalance) = getPoolBalances();
        _token0.available = _token0.withdrawn + _token0Data.reserves;
        _token1.available = _token1.withdrawn + _token1Data.reserves;

        // (2) Perform the swap

        // Calculate the floor and ceiling returns for each side
        // will not overflow with reasonable amounts (token0/1FloorNum ~ 10,000)
        uint256 token0Floor = _token0Data.reserves + (_token0Data.active * token0FloorNum) / DENOM;
        uint256 token1Floor = _token1Data.reserves + (_token1Data.active * token1FloorNum) / DENOM;
        uint256 token1Ceiling = _token1Data.reserves + _token1Data.active;
        // Add interest to the token1 ceiling (but we don't for this version)
        // token1Ceiling += (_token1Data.active * timePassed * tokenInterest) / (RAY * 365 days);

        if (token0Floor > _token0.available) {
            // The min amount needed to reach the TOKEN0 floor
            uint256 token1NeededToSwap;
            uint256 token0Deficit = token0Floor - _token0.available;
            if (token0Deficit > _token0.poolBalance) {
                token1NeededToSwap = _token1.available;
            } else {
                token1NeededToSwap = calcAmountIn(token0Deficit, _token1.poolBalance, _token0.poolBalance);
            }

            // swap as much token1 as is necessary to get back to the token0 floor, without going
            // under the token1 floor
            uint256 swapAmount = (token1Ceiling + token1NeededToSwap < _token1.available)
                ? _token1.available - token1Ceiling
                : token1NeededToSwap + token1Floor > _token1.available
                ? _token1.available - token1Floor
                : token1NeededToSwap;

            (uint256 amountOut, uint256 amountConsumed) = swap(token1, token0, swapAmount);
            _token0.available += amountOut;
            _token1.available -= amountConsumed;
        } else if (_token1.available >= token1Ceiling) {
            // If we have more token0 than the floor and more token1 than the ceiling so we swap the excess amount
            // all to TOKEN0

            (uint256 amountOut, uint256 amountConsumed) = swap(token1, token0, _token1.available - token1Ceiling);
            _token0.available += amountOut;
            _token1.available -= amountConsumed;
        } else {
            // We have more token0 than the floor but are below the token1 ceiling
            // Min amount of TOKEN0 needed to swap to hit the token1 ceiling
            uint256 token0NeededToSwap;
            uint256 token1Deficit = token1Ceiling - _token1.available;
            if (token1Deficit > _token1.poolBalance) {
                token0NeededToSwap = _token0.poolBalance;
            } else {
                token0NeededToSwap = calcAmountIn(token1Deficit, _token0.poolBalance, _token1.poolBalance);
            }

            if (token0Floor + token0NeededToSwap < _token0.available) {
                // If we can reach the token1 ceiling without going through the TOKEN0 floor
                (uint256 amountOut, uint256 amountConsumed) = swap(token0, token1, token0NeededToSwap);
                _token0.available -= amountConsumed;
                _token1.available += amountOut;
            } else {
                // We swap as much TOKEN0 as we can without going through the TOKEN0 floor
                (uint256 amountOut, uint256 amountConsumed) = swap(token0, token1, _token0.available - token0Floor);
                _token0.available -= amountConsumed;
                _token1.available += amountOut;
            }
        }

        // (3) Add in new deposits and subtract withdrawals
        _token0.original = _token0Data.reserves + _token0Data.active;
        _token1.original = _token1Data.reserves + _token1Data.active;

        // collect protocol fee if profitable
        if (_token0.available > _token0.original) {
            // will not overflow core.protocolFee() < 10,000
            _token0.available -= ((_token0.available - _token0.original) * core.protocolFee()) / core.MAX_FEE();
        }
        if (_token1.available > _token1.original) {
            // will not overflow core.protocolFee() < 10,000
            _token1.available -= ((_token1.available - _token1.original) * core.protocolFee()) / core.MAX_FEE();
        }

        // calculate new rate (before withdraws and deposits) as available tokens divided by
        // tokens that were available at the beginning of the epoch
        // and tally claimable amount (withdraws that are now accounted for) for this token
        // tokenAmount * epochToRate will not overflow even if value = total mc of crypto & rate = 3.8e10 * RAY
        _token0.newRate = _token0.original > 0
            ? (token0Data.epochToRate[currEpoch - 1] * _token0.available) / _token0.original // no overflow
            : token0Data.epochToRate[currEpoch - 1];
        token0Data.epochToRate[currEpoch] = _token0.newRate;
        _token0.newClaimable = (_token0Data.withdrawRequestsTotal * _token0.newRate) / RAY; // no overflow
        token0Data.claimableTotal += _token0.newClaimable;
        _token1.newRate = _token1.original > 0
            ? (token1Data.epochToRate[currEpoch - 1] * _token1.available) / _token1.original // no overflow
            : token1Data.epochToRate[currEpoch - 1];
        token1Data.epochToRate[currEpoch] = _token1.newRate;
        _token1.newClaimable = (_token1Data.withdrawRequestsTotal * _token1.newRate) / RAY; // no overflow
        token1Data.claimableTotal += _token1.newClaimable;

        // calculate available token after deposits and withdraws
        _token0.available = _token0.available + _token0Data.depositRequestsTotal - _token0.newClaimable;
        _token1.available = _token1.available + _token1Data.depositRequestsTotal - _token1.newClaimable;

        token0Data.depositRequestsTotal = 0;
        token0Data.withdrawRequestsTotal = 0;
        token1Data.depositRequestsTotal = 0;
        token1Data.withdrawRequestsTotal = 0;

        // (4) Deposit liquidity back in
        (token0Data.active, token1Data.active) = depositLiquidity(_token0.available, _token1.available);
        token0Data.reserves = _token0.available - token0Data.active;
        token1Data.reserves = _token1.available - token1Data.active;

        epoch += 1;
        lastEpochStart = block.timestamp;

        emit NextEpochStarted(epoch, msg.sender, block.timestamp);
    }

    function _assetDataStatics(AssetData storage assetData) internal view returns (AssetDataStatics memory) {
        return
            AssetDataStatics({
                reserves: assetData.reserves,
                active: assetData.active,
                depositRequestsTotal: assetData.depositRequestsTotal,
                withdrawRequestsTotal: assetData.withdrawRequestsTotal
            });
    }

    // ----------- Abstract Functions Implemented For Each DEX -----------

    function getPoolBalances() internal view virtual returns (uint256 poolToken0, uint256 poolToken1);

    /// @dev This is provided automatically by the Uniswap router
    function calcAmountIn(
        uint256 amountOut,
        uint256 reserveIn,
        uint256 reserveOut
    ) internal view virtual returns (uint256 amountIn);

    /// @dev Withdraws all liquidity
    function withdrawLiquidity() internal returns (uint256 token0Withdrawn, uint256 token1Withdrawn) {
        // the combination of `unstakeLiquidity` and `_withdrawLiquidity` should never result in a decreased
        // balance of either token. If they do, this transaction will revert.
        uint256 token0BalanceBefore = token0.balanceOf(address(this));
        uint256 token1BalanceBefore = token1.balanceOf(address(this));
        _unstakeLiquidity();
        _withdrawLiquidity();
        token0Withdrawn = token0.balanceOf(address(this)) - token0BalanceBefore;
        token1Withdrawn = token1.balanceOf(address(this)) - token1BalanceBefore;
    }

    function _withdrawLiquidity() internal virtual;

    /// @dev Deposits liquidity into the pool
    function depositLiquidity(uint256 availableToken0, uint256 availableToken1)
        internal
        returns (uint256 token0Deposited, uint256 token1Deposited)
    {
        // ensure sufficient liquidity is minted, if < MIN_LP don't activate those funds
        if ((availableToken0 < MIN_LP) || (availableToken1 < MIN_LP)) return (0, 0);
        (token0Deposited, token1Deposited) = _depositLiquidity(availableToken0, availableToken1);
        _stakeLiquidity();
    }

    function _depositLiquidity(uint256 availableToken0, uint256 availableToken1)
        internal
        virtual
        returns (uint256 token0Deposited, uint256 token1Deposited);

    /// @dev Swaps tokens and handles the case where amountIn == 0
    function swap(
        IERC20Upgradeable tokenIn,
        IERC20Upgradeable tokenOut,
        uint256 amountIn
    ) internal virtual returns (uint256 amountOut, uint256 amountConsumed);

    // ----------- Rescue Funds -----------

    /// @notice rescues funds from this contract in dire situations, only when contract is paused
    /// @param tokens array of tokens to rescue
    /// @param amounts list of amounts for each token to rescue. If 0, the full balance
    function rescueTokens(address[] calldata tokens, uint256[] calldata amounts)
        external
        override
        nonReentrant
        onlyGuardian
        whenPaused
    {
        require(tokens.length == amounts.length, "INVALID_INPUTS");

        for (uint256 i = 0; i < tokens.length; i++) {
            uint256 amount = amounts[i];
            if (tokens[i] == address(0)) {
                amount = (amount == 0) ? address(this).balance : amount;
                (bool success, ) = msg.sender.call{ value: amount }("");
                require(success, "TRANSFER_FAILED");
            } else {
                amount = (amount == 0) ? IERC20Upgradeable(tokens[i]).balanceOf(address(this)) : amount;
                IERC20Upgradeable(tokens[i]).safeTransfer(msg.sender, amount);
            }
        }
        emit FundsRescued(msg.sender);
    }

    /// @notice A function that should be called by the guardian to unstake any liquidity before rescuing LP tokens
    function unstakeLiquidity() external override nonReentrant onlyGuardian whenPaused {
        _unstakeLiquidity();
    }

    /// @notice stakes all LP tokens
    function _unstakeLiquidity() internal virtual;

    /// @notice unstakes all LP tokens
    function _stakeLiquidity() internal virtual;

    // ----------- Getter Functions -----------

    function token0ValueLocked() external view override returns (uint256) {
        return token0.balanceOf(address(this)) + token0Data.active;
    }

    function token1ValueLocked() external view override returns (uint256) {
        return token1.balanceOf(address(this)) + token1Data.active;
    }

    function token0BalanceDay0(address user) external view override returns (uint256) {
        return __user_balanceDay0(token0Data, user);
    }

    function epochToToken0Rate(uint256 _epoch) external view override returns (uint256) {
        return token0Data.epochToRate[_epoch];
    }

    function token0WithdrawRequests(address user) external view override returns (uint256) {
        return __user_requestView(token0Data.withdrawRequests[user]);
    }

    function token1BalanceDay0(address user) external view override returns (uint256) {
        return __user_balanceDay0(token1Data, user);
    }

    function epochToToken1Rate(uint256 _epoch) external view override returns (uint256) {
        return token1Data.epochToRate[_epoch];
    }

    function token1WithdrawRequests(address user) external view override returns (uint256) {
        return __user_requestView(token1Data.withdrawRequests[user]);
    }

    /// @dev This function is used to convert the way balances are internally stored to
    /// what makes sense for the user
    function __user_balanceDay0(AssetData storage assetData, address user) internal view returns (uint256) {
        uint256 res = assetData.balanceDay0[user];
        Request memory depositReq = assetData.depositRequests[user];
        if (depositReq.epoch < epoch) {
            // will not overflow even if value = total mc of crypto
            res += (depositReq.amount * RAY) / assetData.epochToRate[depositReq.epoch];
        }
        Request memory withdrawReq = assetData.withdrawRequests[user];
        if (withdrawReq.epoch == epoch) {
            // This amount has not been withdrawn yet so this is still part of
            // their Day 0 Balance
            res += withdrawReq.amount;
        }
        return res;
    }

    /// @dev This function is used to convert the way requests are internally stored to
    /// what makes sense for the user
    function __user_requestView(Request memory req) internal view returns (uint256) {
        if (req.epoch < epoch) {
            return 0;
        }
        return req.amount;
    }

    /// @notice calculates current amount of fees accrued, as the current balance of each token
    /// less the amounts each tokens that are active user funds. token0Data.active is not
    /// included because they are currently in the DEX pool
    function feesAccrued() public view override returns (uint256 token0Fees, uint256 token1Fees) {
        token0Fees =
            token0.balanceOf(address(this)) -
            token0Data.claimableTotal -
            token0Data.reserves -
            token0Data.depositRequestsTotal;
        token1Fees =
            token1.balanceOf(address(this)) -
            token1Data.claimableTotal -
            token1Data.reserves -
            token1Data.depositRequestsTotal;
    }

    /// ------------------- Setters -------------------

    /// @notice sets a new value for the token0 floor
    /// @param _token0FloorNum the new floor token0 returns (out of `DENOM`)
    function setToken0Floor(uint256 _token0FloorNum) external override onlyStrategist {
        require(_token0FloorNum > 0, "INVALID_TOKEN0_FLOOR");
        token0FloorNum = _token0FloorNum;
        emit Token0FloorUpdated(_token0FloorNum);
    }

    /// @notice sets a new value for the token1 floor
    /// @param _token1FloorNum the new floor token1 returns (out of `DENOM`)
    function setToken1Floor(uint256 _token1FloorNum) external override onlyStrategist {
        require(_token1FloorNum > 0, "INVALID_TOKEN1_FLOOR");
        token1FloorNum = _token1FloorNum;
        emit Token1FloorUpdated(_token1FloorNum);
    }

    function setEpochDuration(uint256 _epochDuration) external override onlyStrategist whenPaused {
        epochDuration = _epochDuration;
        emit EpochDurationUpdated(_epochDuration);
    }

    /// @notice sends accrued fees to the core.feeTo() address, the treasury
    function collectFees() external override {
        (uint256 token0Fees, uint256 token1Fees) = feesAccrued();
        if (token0Fees > 0) {
            token0.safeTransfer(core.feeTo(), token0Fees);
        }
        if (token1Fees > 0) {
            token1.safeTransfer(core.feeTo(), token1Fees);
        }
    }

    // To receive any native token sent here (ex. from wrapped native withdraw)
    receive() external payable {
        // no logic upon reciept of native token required
    }
}

File 7 of 19 : UniswapVaultStorage.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;

/// @notice Storage for uniswap vaults
/// @author Recursive Research Inc
abstract contract UniswapVaultStorageUnpadded {
    /// @notice UniswapV2Factory address
    address public factory;

    /// @notice UniswapV2Router02 address
    address public router;

    // @notice UniswapV2Pair address for token0 and token1
    address public pair;
}

abstract contract UniswapVaultStorage is UniswapVaultStorageUnpadded {
    // @dev Padding 100 words of storage for upgradeability. Follows OZ's guidance.
    uint256[100] private __gap;
}

File 8 of 19 : IERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 9 of 19 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @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
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

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

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 10 of 19 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

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

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 11 of 19 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

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

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

    uint256 private _status;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 12 of 19 : IWrappy.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;

interface IWrappy {
    function deposit() external payable;

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

    function withdraw(uint256) external;
}

File 13 of 19 : CoreReference.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;

import "../../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol";

import "../core/ICore.sol";

/// @notice Stores a reference to the core contract
/// @author Recursive Research Inc
abstract contract CoreReference is Initializable {
    ICore public core;
    bool private _paused;

    /// initialize logic contract
    /// This tag here tells OZ to not throw an error on this constructor
    /// Recommended here:
    /// https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#initializing_the_implementation_contract
    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() initializer {}

    /// @dev Emitted when the pause is triggered
    event Paused();

    /// @dev Emitted when the pause is lifted
    event Unpaused();

    function __CoreReference_init(address coreAddress) internal onlyInitializing {
        __CoreReference_init_unchained(coreAddress);
    }

    function __CoreReference_init_unchained(address coreAddress) internal onlyInitializing {
        core = ICore(coreAddress);
    }

    modifier whenNotPaused() {
        require(!paused(), "PAUSED");
        _;
    }

    modifier whenPaused() {
        require(paused(), "NOT_PAUSED");
        _;
    }

    modifier onlyPauser() {
        require(core.hasRole(core.PAUSE_ROLE(), msg.sender), "NOT_PAUSER");
        _;
    }

    modifier onlyGovernor() {
        require(core.hasRole(core.GOVERN_ROLE(), msg.sender), "NOT_GOVERNOR");
        _;
    }

    modifier onlyGuardian() {
        require(core.hasRole(core.GUARDIAN_ROLE(), msg.sender), "NOT_GUARDIAN");
        _;
    }

    modifier onlyStrategist() {
        require(core.hasRole(core.STRATEGIST_ROLE(), msg.sender), "NOT_STRATEGIST");
        _;
    }

    /// @notice view function to see whether or not the contract is paused
    /// @return true if the contract is paused either by the core or independently
    function paused() public view returns (bool) {
        return (core.paused() || _paused);
    }

    function pause() external onlyPauser whenNotPaused {
        _paused = true;
        emit Paused();
    }

    function unpause() external onlyPauser whenPaused {
        _paused = false;
        emit Unpaused();
    }
}

File 14 of 19 : VaultStorage.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.11;

// Need to use IERC20Upgradeable because that is what SafeERC20Upgradeable requires
// but the interface is exactly the same as ERC20s so this still works with ERC20s
import "../../lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/IERC20Upgradeable.sol";

/// @notice Storage for Vault
/// @author Recursive Research Inc
abstract contract VaultStorageUnpadded {
    /// @notice struct for withdraw and deposit requests
    /// @param epoch the epoch when the request was submitted
    /// @param amount size of request, if deposit it's an absolute amount of the underlying.
    ///     If withdraw, specified in "Day 0" amount
    struct Request {
        uint256 epoch;
        uint256 amount;
    }

    /// @notice struct to keep a copy of AssetData in memory during `nextEpoch` call
    struct AssetDataStatics {
        uint256 reserves;
        uint256 active;
        uint256 depositRequestsTotal;
        uint256 withdrawRequestsTotal;
    }

    /// @notice global struct to keep track of all info for an asset
    /// @param reserves total amount not active
    /// @param active total amount paired up in the Dex pool
    /// @param depositRequestsTotal total amount of queued up deposit requests
    /// @param withdrawRequestsTotal total amount of queued up withdraw requests
    /// @param balanceDay0 each user's deposited balance denominated in "day 0 tokens"
    /// @param claimable each user's amount that has been withdrawn from the LP pool and they can claim
    /// @param epochToRate exchange rate of token to day0 tokens by epoch
    /// @param depositRequests each users deposit requests
    /// @param withdrawRequests each users withdraw requests
    struct AssetData {
        uint256 reserves;
        uint256 active;
        uint256 depositRequestsTotal;
        uint256 withdrawRequestsTotal;
        uint256 claimableTotal;
        mapping(address => uint256) balanceDay0;
        mapping(address => uint256) claimable;
        mapping(uint256 => uint256) epochToRate;
        mapping(address => Request) depositRequests;
        mapping(address => Request) withdrawRequests;
    }

    /// @notice true if token0 is wrapped native
    bool public isNativeVault;

    /// @notice token that receives a "floor" return
    IERC20Upgradeable public token0;
    /// @notice token that receives a "ceiling" return
    IERC20Upgradeable public token1;

    /// @notice current epoch, set to 1 on initialization
    uint256 public epoch;
    /// @notice duration of each epoch
    uint256 public epochDuration;
    /// @notice start of last epoch, 0 on initialization
    uint256 public lastEpochStart;

    /// @notice keeps track of relevant data for TOKEN0
    AssetData public token0Data;
    /// @notice keeps track of relevant data for TOKEN1
    AssetData public token1Data;

    /// @notice minimum return for TOKEN0 (out of `vault.DENOM`) as long as TOKEN1 is above its minimum return
    uint256 public token0FloorNum;
    /// @notice minimum return for TOKEN1 (out of `vault.DENOM`)
    uint256 public token1FloorNum;
}

abstract contract VaultStorage is VaultStorageUnpadded {
    // @dev Padding 100 words of storage for upgradeability. Follows OZ's guidance.
    uint256[100] private __gap;
}

File 15 of 19 : IVault.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;

interface IVault {
    /// @dev Emitted when a new epoch is started
    /// @param newEpoch number of the new epoch
    /// @param initiator address of the user who initiated the new epoch
    /// @param startTime timestamp of the start of this new epoch
    event NextEpochStarted(uint256 indexed newEpoch, address indexed initiator, uint256 startTime);

    /// @dev Emitted upon a new deposit request
    /// @param assetCode code for the type of asset (either `TOKEN0` or `TOKEN1`)
    /// @param user address of the user who made the deposit request
    /// @param amount amount of the asset in deposit request
    /// @param epoch epoch of the deposit request
    event DepositScheduled(bytes32 indexed assetCode, address indexed user, uint256 amount, uint256 indexed epoch);

    /// @dev Emitted upon a new withdraw request
    /// @param assetCode code for the type of asset (either `TOKEN0` or `TOKEN1`)
    /// @param user address of the user who made the withdraw request
    /// @param amountDay0 amount of the asset (day 0) in withdraw request
    /// @param epoch epoch of the withdraw request
    event WithdrawScheduled(bytes32 indexed assetCode, address indexed user, uint256 amountDay0, uint256 indexed epoch);

    /// @dev Emitted upon a user claiming their tokens after a withdraw request is processed
    /// @param assetCode code for the type of asset (either `TOKEN0` or `TOKEN1`)
    /// @param user address of the user who is claiming their assets
    /// @param amount amount of the assets (day 0) claimed
    event AssetsClaimed(bytes32 indexed assetCode, address indexed user, uint256 amount);

    /// @dev Emitted upon a guardian rescuing funds
    /// @param guardian address of the guardian who rescued the funds
    event FundsRescued(address indexed guardian);

    /// @dev Emitted upon a strategist updating the token0 floor
    /// @param newFloor the new floor returns on TOKEN0 (out of `RAY`)
    event Token0FloorUpdated(uint256 newFloor);

    /// @dev Emitted upon a strategist updating the token1 floor
    /// @param newFloor the new floor returns on TOKEN1 (out of `RAY`)
    event Token1FloorUpdated(uint256 newFloor);

    event EpochDurationUpdated(uint256 newEpochDuration);

    /// ------------------- Vault Interface -------------------

    function depositToken0(uint256 _amount) external payable;

    function depositToken1(uint256 _amount) external;

    function withdrawToken0(uint256 _amount) external;

    function withdrawToken1(uint256 _amount) external;

    function claimToken0() external;

    function claimToken1() external;

    function token0Balance(address user)
        external
        view
        returns (
            uint256 deposited,
            uint256 pendingDeposit,
            uint256 claimable
        );

    function token1Balance(address user)
        external
        view
        returns (
            uint256 deposited,
            uint256 pendingDeposit,
            uint256 claimable
        );

    function nextEpoch(uint256 expectedPoolToken0, uint256 expectedPoolToken1) external;

    function rescueTokens(address[] calldata tokens, uint256[] calldata amounts) external;

    function collectFees() external;

    function unstakeLiquidity() external;

    /// ------------------- Getters -------------------

    function token0ValueLocked() external view returns (uint256);

    function token1ValueLocked() external view returns (uint256);

    function token0BalanceDay0(address user) external view returns (uint256);

    function epochToToken0Rate(uint256 _epoch) external view returns (uint256);

    function token0WithdrawRequests(address user) external view returns (uint256);

    function token1BalanceDay0(address user) external view returns (uint256);

    function epochToToken1Rate(uint256 _epoch) external view returns (uint256);

    function token1WithdrawRequests(address user) external view returns (uint256);

    function feesAccrued() external view returns (uint256, uint256);

    /// ------------------- Setters -------------------

    function setToken0Floor(uint256 _token0FloorNum) external;

    function setToken1Floor(uint256 _token1FloorNum) external;

    function setEpochDuration(uint256 _epochDuration) external;
}

File 16 of 19 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @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 proxied contracts do not make use of 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.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * 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 {ERC1967Proxy-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.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

File 17 of 19 : ICore.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;

import "./ICorePermissions.sol";

/// @notice Interface for Core
/// @author Recursive Research Inc
interface ICore is ICorePermissions {
    // ----------- Events ---------------------

    /// @dev Emitted when the protocol fee (`protocolFee`) is changed
    ///   out of core.MAX_FEE()
    event ProtocolFeeUpdated(uint256 protocolFee);

    /// @dev Emitted when the protocol fee destination (`feeTo`) is changed
    event FeeToUpdated(address indexed feeTo);

    /// @dev Emitted when the pause is triggered
    event Paused();

    /// @dev Emitted when the pause is lifted
    event Unpaused();

    // @dev Emitted when a vault with address `vault`
    event VaultRegistered(address indexed vault);

    // @dev Emitted when a vault with address `vault`
    event VaultRemoved(address indexed vault);

    // ----------- Default Getters --------------

    /// @dev constant set to 10_000
    function MAX_FEE() external view returns (uint256);

    function feeTo() external view returns (address);

    /// @dev protocol fee out of core.MAX_FEE()
    function protocolFee() external view returns (uint256);

    function wrappedNative() external view returns (address);

    // ----------- Main Core Utility --------------

    function registerVaults(address[] memory vaults) external;

    function removeVaults(address[] memory vaults) external;

    /// @dev set core.protocolFee, out of core.MAX_FEE()
    function setProtocolFee(uint256 _protocolFee) external;

    function setFeeTo(address _feeTo) external;

    // ----------- Protocol Pausing -----------

    function pause() external;

    function unpause() external;

    function paused() external view returns (bool);
}

File 18 of 19 : ICorePermissions.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.11;

import "../../lib/openzeppelin-contracts-upgradeable/contracts/access/IAccessControlUpgradeable.sol";

/// @title Interface for CorePermissions
/// @author Recursive Research Inc
interface ICorePermissions is IAccessControlUpgradeable {
    // ----------- Events ---------------------

    /// @dev Emitted when the whitelist is disabled by `admin`.
    event WhitelistDisabled();

    /// @dev Emitted when the whitelist is disabled by `admin`.
    event WhitelistEnabled();

    // ----------- Governor only state changing api -----------

    function createRole(bytes32 role, bytes32 adminRole) external;

    function whitelistAll(address[] memory addresses) external;

    // ----------- GRANTING ROLES -----------

    function disableWhitelist() external;

    function enableWhitelist() external;

    // ----------- Getters -----------

    function GUARDIAN_ROLE() external view returns (bytes32);

    function GOVERN_ROLE() external view returns (bytes32);

    function PAUSE_ROLE() external view returns (bytes32);

    function STRATEGIST_ROLE() external view returns (bytes32);

    function WHITELISTED_ROLE() external view returns (bytes32);

    function whitelistDisabled() external view returns (bool);

    // ----------- Read Interface -----------

    function isWhitelisted(address _address) external view returns (bool);
}

File 19 of 19 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

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

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"assetCode","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AssetsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"assetCode","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"DepositScheduled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newEpochDuration","type":"uint256"}],"name":"EpochDurationUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"guardian","type":"address"}],"name":"FundsRescued","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newEpoch","type":"uint256"},{"indexed":true,"internalType":"address","name":"initiator","type":"address"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"}],"name":"NextEpochStarted","type":"event"},{"anonymous":false,"inputs":[],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFloor","type":"uint256"}],"name":"Token0FloorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newFloor","type":"uint256"}],"name":"Token1FloorUpdated","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"assetCode","type":"bytes32"},{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountDay0","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"epoch","type":"uint256"}],"name":"WithdrawScheduled","type":"event"},{"inputs":[],"name":"DENOM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_LP","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POOL_ERR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN0","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN1","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimToken0","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimToken1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collectFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"core","outputs":[{"internalType":"contract ICore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositToken0","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositToken1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"epoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"epochDuration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"epochToToken0Rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epoch","type":"uint256"}],"name":"epochToToken1Rate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feesAccrued","outputs":[{"internalType":"uint256","name":"token0Fees","type":"uint256"},{"internalType":"uint256","name":"token1Fees","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"coreAddress","type":"address"},{"internalType":"uint256","name":"_epochDuration","type":"uint256"},{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"uint256","name":"_token0FloorNum","type":"uint256"},{"internalType":"uint256","name":"_token1FloorNum","type":"uint256"},{"internalType":"address","name":"_uniswapFactory","type":"address"},{"internalType":"address","name":"_uniswapRouter","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isNativeVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastEpochStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"expectedPoolToken0","type":"uint256"},{"internalType":"uint256","name":"expectedPoolToken1","type":"uint256"}],"name":"nextEpoch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"rescueTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"router","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_epochDuration","type":"uint256"}],"name":"setEpochDuration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_token0FloorNum","type":"uint256"}],"name":"setToken0Floor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_token1FloorNum","type":"uint256"}],"name":"setToken1Floor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"token0Balance","outputs":[{"internalType":"uint256","name":"deposited","type":"uint256"},{"internalType":"uint256","name":"pendingDeposit","type":"uint256"},{"internalType":"uint256","name":"claimable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"token0BalanceDay0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0Data","outputs":[{"internalType":"uint256","name":"reserves","type":"uint256"},{"internalType":"uint256","name":"active","type":"uint256"},{"internalType":"uint256","name":"depositRequestsTotal","type":"uint256"},{"internalType":"uint256","name":"withdrawRequestsTotal","type":"uint256"},{"internalType":"uint256","name":"claimableTotal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0FloorNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token0ValueLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"token0WithdrawRequests","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"token1Balance","outputs":[{"internalType":"uint256","name":"deposited","type":"uint256"},{"internalType":"uint256","name":"pendingDeposit","type":"uint256"},{"internalType":"uint256","name":"claimable","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"token1BalanceDay0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1Data","outputs":[{"internalType":"uint256","name":"reserves","type":"uint256"},{"internalType":"uint256","name":"active","type":"uint256"},{"internalType":"uint256","name":"depositRequestsTotal","type":"uint256"},{"internalType":"uint256","name":"withdrawRequestsTotal","type":"uint256"},{"internalType":"uint256","name":"claimableTotal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1FloorNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1ValueLocked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"token1WithdrawRequests","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unstakeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawToken0","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawToken1","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b50600062000020600162000087565b9050801562000039576000805461ff0019166101001790555b801562000080576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50620001a8565b60008054610100900460ff161562000120578160ff166001148015620000c05750620000be306200019960201b62002aa31760201c565b155b620001185760405162461bcd60e51b815260206004820152602e602482015260008051602062004c8283398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b506000919050565b60005460ff8084169116106200017f5760405162461bcd60e51b815260206004820152602e602482015260008051602062004c8283398151915260448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016200010f565b506000805460ff191660ff92909216919091179055600190565b6001600160a01b03163b151590565b614aca80620001b86000396000f3fe6080604052600436106102965760003560e01c80638a8090951161015a578063c45a0155116100c1578063ee86e1aa1161007a578063ee86e1aa146107ea578063ef253eb61461080a578063f0365efb1461081f578063f2f4eb2614610835578063f878996a1461085b578063f887ea401461087b57600080fd5b8063c45a01551461073f578063c59197e31461075f578063c87965721461077f578063d21220a714610794578063d5bf91e3146107b4578063e4ed7118146107ca57600080fd5b8063a21b927f11610113578063a21b927f14610688578063a5c0fd05146106a2578063a6241980146106c2578063a8aa1b31146106e2578063ac89695114610702578063c2306acb1461072957600080fd5b80638a809095146105965780638fd57d3e146105ab578063900cf0cf146105e6578063930f7ee8146105fc57806394db05951461064b578063971e3c431461067557600080fd5b8063443ec74d116101fe5780635c08bfc2116101b75780635c08bfc2146104e55780635c975abb146105055780635ee04d781461052a5780636e6c90411461054c57806371210a0d146105615780638456cb591461058157600080fd5b8063443ec74d146104395780634b4c489b1461045b5780634ff0876a14610470578063552033c41461048657806355a723ed146104a55780635a5c9048146104c557600080fd5b80632addf608116102505780632addf6081461038157806330024dfe146103ae5780633bf8d620146103ce5780633f4ba83a146103ee57806340f1d6e01461040357806341213a171461042357600080fd5b80622b34f9146102a2578063037a354c146102e25780630dfe1681146102f757806311e8416c1461033457806316343da41461035657806318bf38441461036c57600080fd5b3661029d57005b600080fd5b3480156102ae57600080fd5b506102cf6102bd3660046143ad565b60009081526049602052604090205490565b6040519081526020015b60405180910390f35b3480156102ee57600080fd5b506102cf61089b565b34801561030357600080fd5b5060335461031c9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016102d9565b34801561034057600080fd5b5061035461034f3660046143ad565b61091c565b005b34801561036257600080fd5b506102cf61271081565b34801561037857600080fd5b506102cf603281565b34801561038d57600080fd5b506102cf61039c3660046143ad565b6000908152603f602052604090205490565b3480156103ba57600080fd5b506103546103c93660046143ad565b610993565b3480156103da57600080fd5b506103546103e936600461440b565b610af0565b3480156103fa57600080fd5b50610354610ec6565b34801561040f57600080fd5b506102cf61041e36600461448c565b61103a565b34801561042f57600080fd5b506102cf604c5481565b34801561044557600080fd5b506102cf600080516020614a7583398151915281565b34801561046757600080fd5b5061035461104d565b34801561047c57600080fd5b506102cf60365481565b34801561049257600080fd5b506102cf676765c793fa10079d601b1b81565b3480156104b157600080fd5b506102cf6104c036600461448c565b6111bb565b3480156104d157600080fd5b506103546104e03660046144a9565b6111f6565b3480156104f157600080fd5b506103546105003660046143ad565b61127b565b34801561051157600080fd5b5061051a6113f4565b60405190151581526020016102d9565b34801561053657600080fd5b506102cf600080516020614a5583398151915281565b34801561055857600080fd5b50610354611483565b34801561056d57600080fd5b5061035461057c3660046143ad565b611607565b34801561058d57600080fd5b50610354611686565b3480156105a257600080fd5b50610354611801565b3480156105b757600080fd5b506105cb6105c636600461448c565b611883565b604080519384526020840192909252908201526060016102d9565b3480156105f257600080fd5b506102cf60355481565b34801561060857600080fd5b50604254604354604454604554604654610623949392919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102d9565b34801561065757600080fd5b506106606118a0565b604080519283526020830191909152016102d9565b6103546106833660046143ad565b6119e4565b34801561069457600080fd5b5060335461051a9060ff1681565b3480156106ae57600080fd5b506103546106bd3660046143ad565b611b3c565b3480156106ce57600080fd5b506105cb6106dd36600461448c565b611ba3565b3480156106ee57600080fd5b5060b45461031c906001600160a01b031681565b34801561070e57600080fd5b50603854603954603a54603b54603c54610623949392919085565b34801561073557600080fd5b506102cf604d5481565b34801561074b57600080fd5b5060b25461031c906001600160a01b031681565b34801561076b57600080fd5b5061035461077a3660046143ad565b611bb3565b34801561078b57600080fd5b50610354611d2c565b3480156107a057600080fd5b5060345461031c906001600160a01b031681565b3480156107c057600080fd5b506102cf60375481565b3480156107d657600080fd5b506102cf6107e536600461448c565b611e6b565b3480156107f657600080fd5b506102cf61080536600461448c565b611ea6565b34801561081657600080fd5b506102cf611eb3565b34801561082b57600080fd5b506102cf6103e881565b34801561084157600080fd5b5060005461031c906201000090046001600160a01b031681565b34801561086757600080fd5b50610354610876366004614537565b611eed565b34801561088757600080fd5b5060b35461031c906001600160a01b031681565b6043546034546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a08231906024015b602060405180830381865afa1580156108e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090d9190614559565b6109179190614588565b905090565b6109246113f4565b1561094a5760405162461bcd60e51b8152600401610941906145a0565b60405180910390fd5b6002600154141561096d5760405162461bcd60e51b8152600401610941906145c0565b600260015561098c603882600080516020614a75833981519152612ab2565b5060018055565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa1580156109ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0e9190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7491906145f7565b610a905760405162461bcd60e51b815260040161094190614619565b610a986113f4565b610ab45760405162461bcd60e51b815260040161094190614641565b60368190556040518181527fbfdcfb557a8f4a07f749e7d744a90c02e13eb5af308b561c2f4f17e58069c836906020015b60405180910390a150565b60026001541415610b135760405162461bcd60e51b8152600401610941906145c0565b60026001556000546040805163093a953d60e21b81529051620100009092046001600160a01b0316916391d148549183916324ea54f4916004808201926020929091908290030181865afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b939190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf991906145f7565b610c345760405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa3aaa0a92224a0a760a11b6044820152606401610941565b610c3c6113f4565b610c585760405162461bcd60e51b815260040161094190614641565b828114610c985760405162461bcd60e51b815260206004820152600e60248201526d494e56414c49445f494e5055545360901b6044820152606401610941565b60005b83811015610e90576000838383818110610cb757610cb7614665565b90506020020135905060006001600160a01b0316868684818110610cdd57610cdd614665565b9050602002016020810190610cf2919061448c565b6001600160a01b03161415610da2578015610d0d5780610d0f565b475b604051909150600090339083908381818185875af1925050503d8060008114610d54576040519150601f19603f3d011682016040523d82523d6000602084013e610d59565b606091505b5050905080610d9c5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610941565b50610e7d565b8015610dae5780610e3f565b858583818110610dc057610dc0614665565b9050602002016020810190610dd5919061448c565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f9190614559565b9050610e7d3382888886818110610e5857610e58614665565b9050602002016020810190610e6d919061448c565b6001600160a01b03169190612c6b565b5080610e888161467b565b915050610c9b565b5060405133907f8d133fdaa7b1c86c6a04057392e7e94c6610ac87bb5b138cf2ce8a3605da342b90600090a25050600180555050565b6000546040805163389ed26760e01b81529051620100009092046001600160a01b0316916391d1485491839163389ed267916004808201926020929091908290030181865afa158015610f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f419190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610f83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa791906145f7565b610fe05760405162461bcd60e51b815260206004820152600a6024820152692727aa2fa820aaa9a2a960b11b6044820152606401610941565b610fe86113f4565b6110045760405162461bcd60e51b815260040161094190614641565b6000805460ff60b01b191681556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d169339190a1565b6000611047603883612cd3565b92915050565b600260015414156110705760405162461bcd60e51b8152600401610941906145c0565b60026001556000546040805163093a953d60e21b81529051620100009092046001600160a01b0316916391d148549183916324ea54f4916004808201926020929091908290030181865afa1580156110cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f09190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611132573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115691906145f7565b6111915760405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa3aaa0a92224a0a760a11b6044820152606401610941565b6111996113f4565b6111b55760405162461bcd60e51b815260040161094190614641565b60018055565b6001600160a01b0381166000908152604b60209081526040808320815180830190925280548252600101549181019190915261104790612dc5565b60006112026001612de5565b9050801561121a576000805461ff0019166101001790555b61122a8989898989898989612e72565b8015611270576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa1580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f69190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611338573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135c91906145f7565b6113785760405162461bcd60e51b815260040161094190614619565b600081116113bf5760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a718afa32627a7a960611b6044820152606401610941565b604d8190556040518181527f028ed94f731ed283cb15743fe60b6ec898df578786d87ea55565a79590c6864390602001610ae5565b60008060029054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146c91906145f7565b80610917575050600054600160b01b900460ff1690565b61148b6113f4565b156114a85760405162461bcd60e51b8152600401610941906145a0565b600260015414156114cb5760405162461bcd60e51b8152600401610941906145c0565b600260015560006114eb6038600080516020614a75833981519152612ebb565b60335490915060ff16156115eb57603354604051632e1a7d4d60e01b8152600481018390526101009091046001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561154357600080fd5b505af1158015611557573d6000803e3d6000fd5b50506040516000925033915083908381818185875af1925050503d806000811461159d576040519150601f19603f3d011682016040523d82523d6000602084013e6115a2565b606091505b50509050806115e55760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610941565b5061098c565b60335461098c9061010090046001600160a01b03163383612c6b565b61160f6113f4565b1561162c5760405162461bcd60e51b8152600401610941906145a0565b6002600154141561164f5760405162461bcd60e51b8152600401610941906145c0565b600260015560345461166c906001600160a01b0316333084612ff8565b61098c604282600080516020614a55833981519152613036565b6000546040805163389ed26760e01b81529051620100009092046001600160a01b0316916391d1485491839163389ed267916004808201926020929091908290030181865afa1580156116dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117019190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611743573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176791906145f7565b6117a05760405162461bcd60e51b815260206004820152600a6024820152692727aa2fa820aaa9a2a960b11b6044820152606401610941565b6117a86113f4565b156117c55760405162461bcd60e51b8152600401610941906145a0565b6000805460ff60b01b1916600160b01b1781556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e7529190a1565b6118096113f4565b156118265760405162461bcd60e51b8152600401610941906145a0565b600260015414156118495760405162461bcd60e51b8152600401610941906145c0565b600260015560006118696042600080516020614a55833981519152612ebb565b60345490915061098c906001600160a01b03163383612c6b565b60008060006118936042856130ef565b9250925092509193909250565b603a54603854603c546033546040516370a0823160e01b815230600482015260009485949093909290916101009091046001600160a01b0316906370a0823190602401602060405180830381865afa158015611900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119249190614559565b61192e9190614696565b6119389190614696565b6119429190614696565b6044546042546046546034546040516370a0823160e01b81523060048201529496509293919290916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561199c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c09190614559565b6119ca9190614696565b6119d49190614696565b6119de9190614696565b90509091565b6119ec6113f4565b15611a095760405162461bcd60e51b8152600401610941906145a0565b60026001541415611a2c5760405162461bcd60e51b8152600401610941906145c0565b600260015560335460ff1615611ac457603360019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611a8c57600080fd5b505af1158015611aa0573d6000803e3d6000fd5b5050505050611abf603834600080516020614a75833981519152613036565b61098c565b3415611b055760405162461bcd60e51b815260206004820152601060248201526f1393d517d3905512559157d59055531560821b6044820152606401610941565b603354611b229061010090046001600160a01b0316333084612ff8565b61098c603882600080516020614a75833981519152613036565b611b446113f4565b15611b615760405162461bcd60e51b8152600401610941906145a0565b60026001541415611b845760405162461bcd60e51b8152600401610941906145c0565b600260015561098c604282600080516020614a55833981519152612ab2565b60008060006118936038856130ef565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa158015611c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2e9190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9491906145f7565b611cb05760405162461bcd60e51b815260040161094190614619565b60008111611cf75760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a7182fa32627a7a960611b6044820152606401610941565b604c8190556040518181527fedc83a6572b1f179b02829c85e794c5f926768aa8450ddd3b9dbfc55b09f9f3c90602001610ae5565b600080611d376118a0565b90925090508115611dd457611dd4600060029054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbc91906146ad565b60335461010090046001600160a01b03169084612c6b565b8015611e6757611e67600060029054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5491906146ad565b6034546001600160a01b03169083612c6b565b5050565b6001600160a01b0381166000908152604160209081526040808320815180830190925280548252600101549181019190915261104790612dc5565b6000611047604283612cd3565b6039546033546040516370a0823160e01b81523060048201526000929161010090046001600160a01b0316906370a08231906024016108cc565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa158015611f44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f689190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce91906145f7565b611fea5760405162461bcd60e51b815260040161094190614619565b611ff26113f4565b1561200f5760405162461bcd60e51b8152600401610941906145a0565b60365460375461201f9042614696565b10156120645760405162461bcd60e51b8152602060048201526014602482015273115413d0d217d1155490551253d397d55393515560621b6044820152606401610941565b60006120706038613297565b9050600061207e6042613297565b90506120b96040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6120f26040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6035546120fd6132f5565b8352835261271061210f603282614696565b61211990896146ca565b61212391906146e9565b835110156121435760405162461bcd60e51b81526004016109419061470b565b612710612151603282614588565b61215b90896146ca565b61216591906146e9565b835111156121855760405162461bcd60e51b81526004016109419061470b565b612710612193603282614696565b61219d90886146ca565b6121a791906146e9565b825110156121c75760405162461bcd60e51b81526004016109419061470b565b6127106121d5603282614588565b6121df90886146ca565b6121e991906146e9565b825111156122095760405162461bcd60e51b81526004016109419061470b565b612211613421565b6020848101919091528401526122256132f5565b835283528451602084015161223a9190614588565b6040840152835160208301516122509190614588565b6040830152604c5460208601516000916127109161226e91906146ca565b61227891906146e9565b86516122849190614588565b90506000612710604d54876020015161229d91906146ca565b6122a791906146e9565b86516122b39190614588565b90506000866020015187600001516122cb9190614588565b905085604001518311156123d2576000808760400151856122ec9190614696565b88519091508111156123045786604001519150612316565b86518851612313918391613611565b91505b60408701516000906123288486614588565b1061235c57604088015161233c8685614588565b11612347578261236c565b8488604001516123579190614696565b61236c565b83886040015161236c9190614696565b6034546033549192506000918291612397916001600160a01b03918216916101009091041685613697565b91509150818b6040018181516123ad9190614588565b90525060408a0180518291906123c4908390614696565b905250612567945050505050565b8085604001511061244f5760345460335460408701516000928392612417926001600160a01b039283169261010090920490911690612412908790614696565b613697565b91509150818860400181815161242d9190614588565b905250604087018051829190612444908390614696565b905250612567915050565b6000808660400151836124629190614696565b87519091508111156124775787519150612489565b87518751612486918391613611565b91505b60408801516124988387614588565b10156124fd5760335460345460009182916124c5916001600160a01b036101009091048116911686613697565b91509150808a6040018181516124db9190614696565b9052506040890180518391906124f2908390614588565b905250612564915050565b60335460345460408a01516000928392612531926101009092046001600160a01b0390811692911690612412908b90614696565b91509150808a6040018181516125479190614696565b90525060408901805183919061255e908390614588565b90525050505b50505b602088015188516125789190614588565b60608701526020870151875161258e9190614588565b606080870191909152860151604087015111156126d057600060029054906101000a90046001600160a01b03166001600160a01b031663bc063e1a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061261c9190614559565b600060029054906101000a90046001600160a01b03166001600160a01b031663b0e21e8a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561266f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126939190614559565b876060015188604001516126a79190614696565b6126b191906146ca565b6126bb91906146e9565b866040018181516126cc9190614696565b9052505b84606001518560400151111561280b57600060029054906101000a90046001600160a01b03166001600160a01b031663bc063e1a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612733573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127579190614559565b600060029054906101000a90046001600160a01b03166001600160a01b031663b0e21e8a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ce9190614559565b866060015187604001516127e29190614696565b6127ec91906146ca565b6127f691906146e9565b856040018181516128079190614696565b9052505b600086606001511161283a57603f6000612826600187614696565b815260200190815260200160002054612876565b60608601516040870151603f6000612853600189614696565b81526020019081526020016000205461286c91906146ca565b61287691906146e9565b608087018181526000868152603f6020526040902091909155516060890151676765c793fa10079d601b1b916128ab916146ca565b6128b591906146e9565b60a08701819052603c80546000906128ce908490614588565b909155505060608501516128ff57604960006128eb600187614696565b81526020019081526020016000205461293b565b6060850151604086015160496000612918600189614696565b81526020019081526020016000205461293191906146ca565b61293b91906146e9565b60808601818152600086815260496020526040902091909155516060880151676765c793fa10079d601b1b91612970916146ca565b61297a91906146e9565b60a0860181905260468054600090612993908490614588565b909155505060a08601516040808a0151908801516129b19190614588565b6129bb9190614696565b8660400181815250508460a00151876040015186604001516129dd9190614588565b6129e79190614696565b60408087018290526000603a819055603b8190556044819055604555870151612a0f91613773565b60435560398190556040870151612a269190614696565b6038556043546040860151612a3b9190614696565b6042556035805460019190600090612a54908490614588565b909155505042603781905560355460405191825233917f9427bfed592ae6253fdc90424d4a4f3130787bd0bfa959312914f6eaf422e5799060200160405180910390a350505050505050505050565b6001600160a01b03163b151590565b60008211612af05760405162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b6044820152606401610941565b6035546000612b008583836137ae565b336000908152600987016020526040902060018101549192509015801590612b285750805483115b15612b9357805460009081526007870160205260409020546001820154676765c793fa10079d601b1b91612b5b916146ca565b612b6591906146e9565b33600090815260068801602052604081208054909190612b86908490614588565b9091555050600060018201555b84821015612bda5760405162461bcd60e51b8152602060048201526014602482015273494e53554646494349454e545f42414c414e434560601b6044820152606401610941565b336000908152600587016020526040902085830390556001810154612bff9086614588565b60018201558054831115612c11578281555b84866003016000828254612c259190614588565b90915550506040518581528390339086907f52266201bc2fd6b76ef485c613769527c5ea4face1c63f7f9e806735b31d48fc9060200160405180910390a4505050505050565b6040516001600160a01b038316602482015260448101829052612cce90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613852565b505050565b6001600160a01b0381166000908152600583016020908152604080832054600886018352818420825180840190935280548084526001909101549383019390935260355490921015612d66578051600090815260078601602090815260409091205490820151612d4f90676765c793fa10079d601b1b906146ca565b612d5991906146e9565b612d639083614588565b91505b6001600160a01b038416600090815260098601602090815260409182902082518084019093528054808452600190910154918301919091526035541415612db9576020810151612db69084614588565b92505b5090949350505050565b565b600060355482600001511015612ddd57506000919050565b506020015190565b60008054610100900460ff1615612e2c578160ff166001148015612e085750303b155b612e245760405162461bcd60e51b815260040161094190614742565b506000919050565b60005460ff808416911610612e535760405162461bcd60e51b815260040161094190614742565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff16612e995760405162461bcd60e51b815260040161094190614790565b612ea7888888888888613924565b612eb18282613971565b5050505050505050565b33600090815260098301602090815260408083206035548154600688019094529184205490929082821015612f4f5760018401548015612f4d57336000908152600989016020908152604080832083815560010183905585835260078b01909152902054676765c793fa10079d601b1b90612f3690836146ca565b612f4091906146e9565b612f4a9083614588565b91505b505b60008111612f8a5760405162461bcd60e51b81526020600482015260086024820152674e4f5f434c41494d60c01b6044820152606401610941565b3360009081526006880160205260408120819055600488018054839290612fb2908490614696565b9091555050604051818152339087907fe269963e621a3253e62b91db52a65eed542266d831178ebc68ad61d54211aca69060200160405180910390a39695505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526130309085906323b872dd60e01b90608401612c97565b50505050565b600082116130745760405162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b6044820152606401610941565b6035546130828482856137ae565b3360009081526005860160205260408120919091556002850180548592906130ab908490614588565b90915550506040518381528190339084907f1e6c0ff7d7fa524ca8d88cabca077adebbf64f902faa7f4b97aa5a1da2620faf9060200160405180910390a450505050565b6035546001600160a01b03821660009081526005840160209081526040808320546008870183528184208251808401909352805480845260019091015493830184905293948594859491939190811561318f578481101561318b57600081815260078b016020526040902054613170676765c793fa10079d601b1b846146ca565b61317a91906146e9565b6131849085614588565b935061318f565b8196505b6001600160a01b038916600081815260098c0160209081526040808320815180830183528154815260019091015481840190815294845260068f019092529091205491519197509015613242578051861115613230578051600090815260078c01602090815260409091205490820151676765c793fa10079d601b1b91613215916146ca565b61321f91906146e9565b6132299088614588565b9650613242565b602081015161323f9086614588565b94505b600060078c018161325460018a614696565b8152602001908152602001600020549050676765c793fa10079d601b1b818761327d91906146ca565b61328791906146e9565b9950505050505050509250925092565b6132c26040518060800160405280600081526020016000815260200160008152602001600081525090565b50604080516080810182528254815260018301546020820152600283015491810191909152600390910154606082015290565b60008060008060b460009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561334e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061337291906147f2565b5060335460b45460408051630dfe168160e01b815290516001600160701b0395861697509390941694506001600160a01b03610100909204821693911691630dfe1681916004808201926020929091908290030181865afa1580156133db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133ff91906146ad565b6001600160a01b031614613414578082613417565b81815b9350935050509091565b6033546040516370a0823160e01b81523060048201526000918291829161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134979190614559565b6034546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156134e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135099190614559565b9050613513613a9e565b6033546040516370a0823160e01b8152306004820152839161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135849190614559565b61358e9190614696565b6034546040516370a0823160e01b815230600482015291955082916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156135db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ff9190614559565b6136099190614696565b925050509091565b60b3546040516385f8c25960e01b81526004810185905260248101849052604481018390526000916001600160a01b0316906385f8c25990606401602060405180830381865afa158015613669573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061368d9190614559565b90505b9392505050565b600080826136aa5750600090508061376b565b60b3546136c4906001600160a01b03878116911685613bd4565b60b3546001600160a01b03166338ed17398460006136e28989613c86565b30426040518663ffffffff1660e01b8152600401613704959493929190614842565b6000604051808303816000875af1158015613723573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261374b91908101906148c9565b60018151811061375d5761375d614665565b602002602001015191508290505b935093915050565b6000806103e884108061378757506103e883105b15613797575060009050806137a7565b6137a18484613d14565b90925090505b9250929050565b336000908152600884016020908152604080832060058701909252822054600182015480158015906137e05750825486115b1561382a57825460009081526007880160205260409020548061380e676765c793fa10079d601b1b846146ca565b61381891906146e9565b6138229084614588565b925060009150505b84156138405761383a8582614588565b86845590505b60019092019190915590509392505050565b60006138a7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e599092919063ffffffff16565b805190915015612cce57808060200190518101906138c591906145f7565b612cce5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610941565b600054610100900460ff1661394b5760405162461bcd60e51b815260040161094190614790565b61395486613e68565b61395c613e9b565b6139698585858585613eca565b505050505050565b600054610100900460ff166139985760405162461bcd60e51b815260040161094190614790565b60335460345460405163e6a4390560e01b81526101009092046001600160a01b039081166004840152908116602483015283169063e6a4390590604401602060405180830381865afa1580156139f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a1691906146ad565b60b480546001600160a01b0319166001600160a01b03929092169182179055613a705760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610941565b60b280546001600160a01b039384166001600160a01b03199182161790915560b38054929093169116179055565b60b4546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b0b9190614559565b905080613b155750565b60b35460b454613b32916001600160a01b03918216911683613bd4565b60b354603354603454604051635d5155ef60e11b81526001600160a01b036101009093048316600482015290821660248201526044810184905260006064820181905260848201523060a48201524260c482015291169063baa2abde9060e40160408051808303816000875af1158015613bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cce9190614987565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015613c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c499190614559565b613c539190614588565b6040516001600160a01b03851660248201526044810182905290915061303090859063095ea7b360e01b90606401612c97565b60408051600280825260608083018452926020830190803683370190505090508281600081518110613cba57613cba614665565b60200260200101906001600160a01b031690816001600160a01b0316815250508181600181518110613cee57613cee614665565b60200260200101906001600160a01b031690816001600160a01b03168152505092915050565b60b3546033546000918291613d3b916001600160a01b036101009092048216911686613bd4565b60b354603454613d58916001600160a01b03918216911685613bd4565b60b35460335460345460405162e8e33760e81b81526001600160a01b03610100909304831660048201529082166024820152604481018790526064810186905260006084820181905260a48201523060c48201524260e482015291169063e8e3370090610104016060604051808303816000875af1158015613dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0291906149ab565b50909250905081841115613e335760b354603354613e33916001600160a01b036101009092048216911660006140b6565b808311156137a75760b3546034546137a7916001600160a01b03918216911660006140b6565b606061368d84846000856141cb565b600054610100900460ff16613e8f5760405162461bcd60e51b815260040161094190614790565b613e98816142fc565b50565b600054610100900460ff16613ec25760405162461bcd60e51b815260040161094190614790565b612dc361434d565b600054610100900460ff16613ef15760405162461bcd60e51b815260040161094190614790565b60008211613f385760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a7182fa32627a7a960611b6044820152606401610941565b60008111613f7f5760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a718afa32627a7a960611b6044820152606401610941565b600060029054906101000a90046001600160a01b03166001600160a01b031663eb6d3a116040518163ffffffff1660e01b8152600401602060405180830381865afa158015613fd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ff691906146ad565b603380546001600160a81b0319166001600160a01b03928316968316968714610100600160a81b031916176101009690960295909517909455603480546001600160a01b031916939094169290921790925560008052676765c793fa10079d601b1b7fe9090a6e551363283803e59daf1c144cd0ac55c420ac8519a53d83ef396a73b381905560496020527f9a0ca60aea446f0de2b73532837f00f56d3ae047e136f7838a520755c00b6e76556001603555603692909255604c55604d55565b8015806141305750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561410a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061412e9190614559565b155b61419b5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610941565b6040516001600160a01b038316602482015260448101829052612cce90849063095ea7b360e01b90606401612c97565b60608247101561422c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610941565b6001600160a01b0385163b6142835760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610941565b600080866001600160a01b0316858760405161429f9190614a05565b60006040518083038185875af1925050503d80600081146142dc576040519150601f19603f3d011682016040523d82523d6000602084013e6142e1565b606091505b50915091506142f1828286614374565b979650505050505050565b600054610100900460ff166143235760405162461bcd60e51b815260040161094190614790565b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b600054610100900460ff166111b55760405162461bcd60e51b815260040161094190614790565b60608315614383575081613690565b8251156143935782518084602001fd5b8160405162461bcd60e51b81526004016109419190614a21565b6000602082840312156143bf57600080fd5b5035919050565b60008083601f8401126143d857600080fd5b50813567ffffffffffffffff8111156143f057600080fd5b6020830191508360208260051b85010111156137a757600080fd5b6000806000806040858703121561442157600080fd5b843567ffffffffffffffff8082111561443957600080fd5b614445888389016143c6565b9096509450602087013591508082111561445e57600080fd5b5061446b878288016143c6565b95989497509550505050565b6001600160a01b0381168114613e9857600080fd5b60006020828403121561449e57600080fd5b813561369081614477565b600080600080600080600080610100898b0312156144c657600080fd5b88356144d181614477565b97506020890135965060408901356144e881614477565b955060608901356144f881614477565b94506080890135935060a0890135925060c089013561451681614477565b915060e089013561452681614477565b809150509295985092959890939650565b6000806040838503121561454a57600080fd5b50508035926020909101359150565b60006020828403121561456b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561459b5761459b614572565b500190565b60208082526006908201526514105554d15160d21b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561460957600080fd5b8151801515811461369057600080fd5b6020808252600e908201526d1393d517d4d51490551151d254d560921b604082015260600190565b6020808252600a90820152691393d517d4105554d15160b21b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060001982141561468f5761468f614572565b5060010190565b6000828210156146a8576146a8614572565b500390565b6000602082840312156146bf57600080fd5b815161369081614477565b60008160001904831182151516156146e4576146e4614572565b500290565b60008261470657634e487b7160e01b600052601260045260246000fd5b500490565b60208082526018908201527f554e45585045435445445f504f4f4c5f42414c414e4345530000000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b80516001600160701b0381168114612e6d57600080fd5b60008060006060848603121561480757600080fd5b614810846147db565b925061481e602085016147db565b9150604084015163ffffffff8116811461483757600080fd5b809150509250925092565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156148925784516001600160a01b03168352938301939183019160010161486d565b50506001600160a01b03969096166060850152505050608001529392505050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156148dc57600080fd5b825167ffffffffffffffff808211156148f457600080fd5b818501915085601f83011261490857600080fd5b81518181111561491a5761491a6148b3565b8060051b604051601f19603f8301168101818110858211171561493f5761493f6148b3565b60405291825284820192508381018501918883111561495d57600080fd5b938501935b8285101561497b57845184529385019392850192614962565b98975050505050505050565b6000806040838503121561499a57600080fd5b505080516020909101519092909150565b6000806000606084860312156149c057600080fd5b8351925060208401519150604084015190509250925092565b60005b838110156149f45781810151838201526020016149dc565b838111156130305750506000910152565b60008251614a178184602087016149d9565b9190910192915050565b6020815260008251806020840152614a408160408501602087016149d9565b601f01601f1916919091016040019291505056fe29904dc0060dfbfbdb4804f541ee5b0af0fb57e8edc680ea7b5d072a031ba9997641f496ba4346db02f2b22bd16e018492f6ace90a44ba1990c58f2989aaa42ba26469706673582212201b40bbe9bae4395b1340e8ad4a153b2c8678bf97ea84b9f736195dd0cf93378764736f6c634300080b0033496e697469616c697a61626c653a20636f6e747261637420697320616c726561

Deployed Bytecode

0x6080604052600436106102965760003560e01c80638a8090951161015a578063c45a0155116100c1578063ee86e1aa1161007a578063ee86e1aa146107ea578063ef253eb61461080a578063f0365efb1461081f578063f2f4eb2614610835578063f878996a1461085b578063f887ea401461087b57600080fd5b8063c45a01551461073f578063c59197e31461075f578063c87965721461077f578063d21220a714610794578063d5bf91e3146107b4578063e4ed7118146107ca57600080fd5b8063a21b927f11610113578063a21b927f14610688578063a5c0fd05146106a2578063a6241980146106c2578063a8aa1b31146106e2578063ac89695114610702578063c2306acb1461072957600080fd5b80638a809095146105965780638fd57d3e146105ab578063900cf0cf146105e6578063930f7ee8146105fc57806394db05951461064b578063971e3c431461067557600080fd5b8063443ec74d116101fe5780635c08bfc2116101b75780635c08bfc2146104e55780635c975abb146105055780635ee04d781461052a5780636e6c90411461054c57806371210a0d146105615780638456cb591461058157600080fd5b8063443ec74d146104395780634b4c489b1461045b5780634ff0876a14610470578063552033c41461048657806355a723ed146104a55780635a5c9048146104c557600080fd5b80632addf608116102505780632addf6081461038157806330024dfe146103ae5780633bf8d620146103ce5780633f4ba83a146103ee57806340f1d6e01461040357806341213a171461042357600080fd5b80622b34f9146102a2578063037a354c146102e25780630dfe1681146102f757806311e8416c1461033457806316343da41461035657806318bf38441461036c57600080fd5b3661029d57005b600080fd5b3480156102ae57600080fd5b506102cf6102bd3660046143ad565b60009081526049602052604090205490565b6040519081526020015b60405180910390f35b3480156102ee57600080fd5b506102cf61089b565b34801561030357600080fd5b5060335461031c9061010090046001600160a01b031681565b6040516001600160a01b0390911681526020016102d9565b34801561034057600080fd5b5061035461034f3660046143ad565b61091c565b005b34801561036257600080fd5b506102cf61271081565b34801561037857600080fd5b506102cf603281565b34801561038d57600080fd5b506102cf61039c3660046143ad565b6000908152603f602052604090205490565b3480156103ba57600080fd5b506103546103c93660046143ad565b610993565b3480156103da57600080fd5b506103546103e936600461440b565b610af0565b3480156103fa57600080fd5b50610354610ec6565b34801561040f57600080fd5b506102cf61041e36600461448c565b61103a565b34801561042f57600080fd5b506102cf604c5481565b34801561044557600080fd5b506102cf600080516020614a7583398151915281565b34801561046757600080fd5b5061035461104d565b34801561047c57600080fd5b506102cf60365481565b34801561049257600080fd5b506102cf676765c793fa10079d601b1b81565b3480156104b157600080fd5b506102cf6104c036600461448c565b6111bb565b3480156104d157600080fd5b506103546104e03660046144a9565b6111f6565b3480156104f157600080fd5b506103546105003660046143ad565b61127b565b34801561051157600080fd5b5061051a6113f4565b60405190151581526020016102d9565b34801561053657600080fd5b506102cf600080516020614a5583398151915281565b34801561055857600080fd5b50610354611483565b34801561056d57600080fd5b5061035461057c3660046143ad565b611607565b34801561058d57600080fd5b50610354611686565b3480156105a257600080fd5b50610354611801565b3480156105b757600080fd5b506105cb6105c636600461448c565b611883565b604080519384526020840192909252908201526060016102d9565b3480156105f257600080fd5b506102cf60355481565b34801561060857600080fd5b50604254604354604454604554604654610623949392919085565b604080519586526020860194909452928401919091526060830152608082015260a0016102d9565b34801561065757600080fd5b506106606118a0565b604080519283526020830191909152016102d9565b6103546106833660046143ad565b6119e4565b34801561069457600080fd5b5060335461051a9060ff1681565b3480156106ae57600080fd5b506103546106bd3660046143ad565b611b3c565b3480156106ce57600080fd5b506105cb6106dd36600461448c565b611ba3565b3480156106ee57600080fd5b5060b45461031c906001600160a01b031681565b34801561070e57600080fd5b50603854603954603a54603b54603c54610623949392919085565b34801561073557600080fd5b506102cf604d5481565b34801561074b57600080fd5b5060b25461031c906001600160a01b031681565b34801561076b57600080fd5b5061035461077a3660046143ad565b611bb3565b34801561078b57600080fd5b50610354611d2c565b3480156107a057600080fd5b5060345461031c906001600160a01b031681565b3480156107c057600080fd5b506102cf60375481565b3480156107d657600080fd5b506102cf6107e536600461448c565b611e6b565b3480156107f657600080fd5b506102cf61080536600461448c565b611ea6565b34801561081657600080fd5b506102cf611eb3565b34801561082b57600080fd5b506102cf6103e881565b34801561084157600080fd5b5060005461031c906201000090046001600160a01b031681565b34801561086757600080fd5b50610354610876366004614537565b611eed565b34801561088757600080fd5b5060b35461031c906001600160a01b031681565b6043546034546040516370a0823160e01b8152306004820152600092916001600160a01b0316906370a08231906024015b602060405180830381865afa1580156108e9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090d9190614559565b6109179190614588565b905090565b6109246113f4565b1561094a5760405162461bcd60e51b8152600401610941906145a0565b60405180910390fd5b6002600154141561096d5760405162461bcd60e51b8152600401610941906145c0565b600260015561098c603882600080516020614a75833981519152612ab2565b5060018055565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa1580156109ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0e9190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610a50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a7491906145f7565b610a905760405162461bcd60e51b815260040161094190614619565b610a986113f4565b610ab45760405162461bcd60e51b815260040161094190614641565b60368190556040518181527fbfdcfb557a8f4a07f749e7d744a90c02e13eb5af308b561c2f4f17e58069c836906020015b60405180910390a150565b60026001541415610b135760405162461bcd60e51b8152600401610941906145c0565b60026001556000546040805163093a953d60e21b81529051620100009092046001600160a01b0316916391d148549183916324ea54f4916004808201926020929091908290030181865afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b939190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf991906145f7565b610c345760405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa3aaa0a92224a0a760a11b6044820152606401610941565b610c3c6113f4565b610c585760405162461bcd60e51b815260040161094190614641565b828114610c985760405162461bcd60e51b815260206004820152600e60248201526d494e56414c49445f494e5055545360901b6044820152606401610941565b60005b83811015610e90576000838383818110610cb757610cb7614665565b90506020020135905060006001600160a01b0316868684818110610cdd57610cdd614665565b9050602002016020810190610cf2919061448c565b6001600160a01b03161415610da2578015610d0d5780610d0f565b475b604051909150600090339083908381818185875af1925050503d8060008114610d54576040519150601f19603f3d011682016040523d82523d6000602084013e610d59565b606091505b5050905080610d9c5760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610941565b50610e7d565b8015610dae5780610e3f565b858583818110610dc057610dc0614665565b9050602002016020810190610dd5919061448c565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015610e1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3f9190614559565b9050610e7d3382888886818110610e5857610e58614665565b9050602002016020810190610e6d919061448c565b6001600160a01b03169190612c6b565b5080610e888161467b565b915050610c9b565b5060405133907f8d133fdaa7b1c86c6a04057392e7e94c6610ac87bb5b138cf2ce8a3605da342b90600090a25050600180555050565b6000546040805163389ed26760e01b81529051620100009092046001600160a01b0316916391d1485491839163389ed267916004808201926020929091908290030181865afa158015610f1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f419190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610f83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa791906145f7565b610fe05760405162461bcd60e51b815260206004820152600a6024820152692727aa2fa820aaa9a2a960b11b6044820152606401610941565b610fe86113f4565b6110045760405162461bcd60e51b815260040161094190614641565b6000805460ff60b01b191681556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d169339190a1565b6000611047603883612cd3565b92915050565b600260015414156110705760405162461bcd60e51b8152600401610941906145c0565b60026001556000546040805163093a953d60e21b81529051620100009092046001600160a01b0316916391d148549183916324ea54f4916004808201926020929091908290030181865afa1580156110cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f09190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611132573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115691906145f7565b6111915760405162461bcd60e51b815260206004820152600c60248201526b2727aa2fa3aaa0a92224a0a760a11b6044820152606401610941565b6111996113f4565b6111b55760405162461bcd60e51b815260040161094190614641565b60018055565b6001600160a01b0381166000908152604b60209081526040808320815180830190925280548252600101549181019190915261104790612dc5565b60006112026001612de5565b9050801561121a576000805461ff0019166101001790555b61122a8989898989898989612e72565b8015611270576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa1580156112d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112f69190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611338573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135c91906145f7565b6113785760405162461bcd60e51b815260040161094190614619565b600081116113bf5760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a718afa32627a7a960611b6044820152606401610941565b604d8190556040518181527f028ed94f731ed283cb15743fe60b6ec898df578786d87ea55565a79590c6864390602001610ae5565b60008060029054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146c91906145f7565b80610917575050600054600160b01b900460ff1690565b61148b6113f4565b156114a85760405162461bcd60e51b8152600401610941906145a0565b600260015414156114cb5760405162461bcd60e51b8152600401610941906145c0565b600260015560006114eb6038600080516020614a75833981519152612ebb565b60335490915060ff16156115eb57603354604051632e1a7d4d60e01b8152600481018390526101009091046001600160a01b031690632e1a7d4d90602401600060405180830381600087803b15801561154357600080fd5b505af1158015611557573d6000803e3d6000fd5b50506040516000925033915083908381818185875af1925050503d806000811461159d576040519150601f19603f3d011682016040523d82523d6000602084013e6115a2565b606091505b50509050806115e55760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610941565b5061098c565b60335461098c9061010090046001600160a01b03163383612c6b565b61160f6113f4565b1561162c5760405162461bcd60e51b8152600401610941906145a0565b6002600154141561164f5760405162461bcd60e51b8152600401610941906145c0565b600260015560345461166c906001600160a01b0316333084612ff8565b61098c604282600080516020614a55833981519152613036565b6000546040805163389ed26760e01b81529051620100009092046001600160a01b0316916391d1485491839163389ed267916004808201926020929091908290030181865afa1580156116dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117019190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611743573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176791906145f7565b6117a05760405162461bcd60e51b815260206004820152600a6024820152692727aa2fa820aaa9a2a960b11b6044820152606401610941565b6117a86113f4565b156117c55760405162461bcd60e51b8152600401610941906145a0565b6000805460ff60b01b1916600160b01b1781556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e7529190a1565b6118096113f4565b156118265760405162461bcd60e51b8152600401610941906145a0565b600260015414156118495760405162461bcd60e51b8152600401610941906145c0565b600260015560006118696042600080516020614a55833981519152612ebb565b60345490915061098c906001600160a01b03163383612c6b565b60008060006118936042856130ef565b9250925092509193909250565b603a54603854603c546033546040516370a0823160e01b815230600482015260009485949093909290916101009091046001600160a01b0316906370a0823190602401602060405180830381865afa158015611900573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119249190614559565b61192e9190614696565b6119389190614696565b6119429190614696565b6044546042546046546034546040516370a0823160e01b81523060048201529496509293919290916001600160a01b03909116906370a0823190602401602060405180830381865afa15801561199c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c09190614559565b6119ca9190614696565b6119d49190614696565b6119de9190614696565b90509091565b6119ec6113f4565b15611a095760405162461bcd60e51b8152600401610941906145a0565b60026001541415611a2c5760405162461bcd60e51b8152600401610941906145c0565b600260015560335460ff1615611ac457603360019054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611a8c57600080fd5b505af1158015611aa0573d6000803e3d6000fd5b5050505050611abf603834600080516020614a75833981519152613036565b61098c565b3415611b055760405162461bcd60e51b815260206004820152601060248201526f1393d517d3905512559157d59055531560821b6044820152606401610941565b603354611b229061010090046001600160a01b0316333084612ff8565b61098c603882600080516020614a75833981519152613036565b611b446113f4565b15611b615760405162461bcd60e51b8152600401610941906145a0565b60026001541415611b845760405162461bcd60e51b8152600401610941906145c0565b600260015561098c604282600080516020614a55833981519152612ab2565b60008060006118936038856130ef565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa158015611c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2e9190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611c70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9491906145f7565b611cb05760405162461bcd60e51b815260040161094190614619565b60008111611cf75760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a7182fa32627a7a960611b6044820152606401610941565b604c8190556040518181527fedc83a6572b1f179b02829c85e794c5f926768aa8450ddd3b9dbfc55b09f9f3c90602001610ae5565b600080611d376118a0565b90925090508115611dd457611dd4600060029054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dbc91906146ad565b60335461010090046001600160a01b03169084612c6b565b8015611e6757611e67600060029054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e5491906146ad565b6034546001600160a01b03169083612c6b565b5050565b6001600160a01b0381166000908152604160209081526040808320815180830190925280548252600101549181019190915261104790612dc5565b6000611047604283612cd3565b6039546033546040516370a0823160e01b81523060048201526000929161010090046001600160a01b0316906370a08231906024016108cc565b600054604080516328de28c960e21b81529051620100009092046001600160a01b0316916391d1485491839163a378a324916004808201926020929091908290030181865afa158015611f44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f689190614559565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015611faa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fce91906145f7565b611fea5760405162461bcd60e51b815260040161094190614619565b611ff26113f4565b1561200f5760405162461bcd60e51b8152600401610941906145a0565b60365460375461201f9042614696565b10156120645760405162461bcd60e51b8152602060048201526014602482015273115413d0d217d1155490551253d397d55393515560621b6044820152606401610941565b60006120706038613297565b9050600061207e6042613297565b90506120b96040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6120f26040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6035546120fd6132f5565b8352835261271061210f603282614696565b61211990896146ca565b61212391906146e9565b835110156121435760405162461bcd60e51b81526004016109419061470b565b612710612151603282614588565b61215b90896146ca565b61216591906146e9565b835111156121855760405162461bcd60e51b81526004016109419061470b565b612710612193603282614696565b61219d90886146ca565b6121a791906146e9565b825110156121c75760405162461bcd60e51b81526004016109419061470b565b6127106121d5603282614588565b6121df90886146ca565b6121e991906146e9565b825111156122095760405162461bcd60e51b81526004016109419061470b565b612211613421565b6020848101919091528401526122256132f5565b835283528451602084015161223a9190614588565b6040840152835160208301516122509190614588565b6040830152604c5460208601516000916127109161226e91906146ca565b61227891906146e9565b86516122849190614588565b90506000612710604d54876020015161229d91906146ca565b6122a791906146e9565b86516122b39190614588565b90506000866020015187600001516122cb9190614588565b905085604001518311156123d2576000808760400151856122ec9190614696565b88519091508111156123045786604001519150612316565b86518851612313918391613611565b91505b60408701516000906123288486614588565b1061235c57604088015161233c8685614588565b11612347578261236c565b8488604001516123579190614696565b61236c565b83886040015161236c9190614696565b6034546033549192506000918291612397916001600160a01b03918216916101009091041685613697565b91509150818b6040018181516123ad9190614588565b90525060408a0180518291906123c4908390614696565b905250612567945050505050565b8085604001511061244f5760345460335460408701516000928392612417926001600160a01b039283169261010090920490911690612412908790614696565b613697565b91509150818860400181815161242d9190614588565b905250604087018051829190612444908390614696565b905250612567915050565b6000808660400151836124629190614696565b87519091508111156124775787519150612489565b87518751612486918391613611565b91505b60408801516124988387614588565b10156124fd5760335460345460009182916124c5916001600160a01b036101009091048116911686613697565b91509150808a6040018181516124db9190614696565b9052506040890180518391906124f2908390614588565b905250612564915050565b60335460345460408a01516000928392612531926101009092046001600160a01b0390811692911690612412908b90614696565b91509150808a6040018181516125479190614696565b90525060408901805183919061255e908390614588565b90525050505b50505b602088015188516125789190614588565b60608701526020870151875161258e9190614588565b606080870191909152860151604087015111156126d057600060029054906101000a90046001600160a01b03166001600160a01b031663bc063e1a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156125f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061261c9190614559565b600060029054906101000a90046001600160a01b03166001600160a01b031663b0e21e8a6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561266f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126939190614559565b876060015188604001516126a79190614696565b6126b191906146ca565b6126bb91906146e9565b866040018181516126cc9190614696565b9052505b84606001518560400151111561280b57600060029054906101000a90046001600160a01b03166001600160a01b031663bc063e1a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612733573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127579190614559565b600060029054906101000a90046001600160a01b03166001600160a01b031663b0e21e8a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156127aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ce9190614559565b866060015187604001516127e29190614696565b6127ec91906146ca565b6127f691906146e9565b856040018181516128079190614696565b9052505b600086606001511161283a57603f6000612826600187614696565b815260200190815260200160002054612876565b60608601516040870151603f6000612853600189614696565b81526020019081526020016000205461286c91906146ca565b61287691906146e9565b608087018181526000868152603f6020526040902091909155516060890151676765c793fa10079d601b1b916128ab916146ca565b6128b591906146e9565b60a08701819052603c80546000906128ce908490614588565b909155505060608501516128ff57604960006128eb600187614696565b81526020019081526020016000205461293b565b6060850151604086015160496000612918600189614696565b81526020019081526020016000205461293191906146ca565b61293b91906146e9565b60808601818152600086815260496020526040902091909155516060880151676765c793fa10079d601b1b91612970916146ca565b61297a91906146e9565b60a0860181905260468054600090612993908490614588565b909155505060a08601516040808a0151908801516129b19190614588565b6129bb9190614696565b8660400181815250508460a00151876040015186604001516129dd9190614588565b6129e79190614696565b60408087018290526000603a819055603b8190556044819055604555870151612a0f91613773565b60435560398190556040870151612a269190614696565b6038556043546040860151612a3b9190614696565b6042556035805460019190600090612a54908490614588565b909155505042603781905560355460405191825233917f9427bfed592ae6253fdc90424d4a4f3130787bd0bfa959312914f6eaf422e5799060200160405180910390a350505050505050505050565b6001600160a01b03163b151590565b60008211612af05760405162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b6044820152606401610941565b6035546000612b008583836137ae565b336000908152600987016020526040902060018101549192509015801590612b285750805483115b15612b9357805460009081526007870160205260409020546001820154676765c793fa10079d601b1b91612b5b916146ca565b612b6591906146e9565b33600090815260068801602052604081208054909190612b86908490614588565b9091555050600060018201555b84821015612bda5760405162461bcd60e51b8152602060048201526014602482015273494e53554646494349454e545f42414c414e434560601b6044820152606401610941565b336000908152600587016020526040902085830390556001810154612bff9086614588565b60018201558054831115612c11578281555b84866003016000828254612c259190614588565b90915550506040518581528390339086907f52266201bc2fd6b76ef485c613769527c5ea4face1c63f7f9e806735b31d48fc9060200160405180910390a4505050505050565b6040516001600160a01b038316602482015260448101829052612cce90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152613852565b505050565b6001600160a01b0381166000908152600583016020908152604080832054600886018352818420825180840190935280548084526001909101549383019390935260355490921015612d66578051600090815260078601602090815260409091205490820151612d4f90676765c793fa10079d601b1b906146ca565b612d5991906146e9565b612d639083614588565b91505b6001600160a01b038416600090815260098601602090815260409182902082518084019093528054808452600190910154918301919091526035541415612db9576020810151612db69084614588565b92505b5090949350505050565b565b600060355482600001511015612ddd57506000919050565b506020015190565b60008054610100900460ff1615612e2c578160ff166001148015612e085750303b155b612e245760405162461bcd60e51b815260040161094190614742565b506000919050565b60005460ff808416911610612e535760405162461bcd60e51b815260040161094190614742565b506000805460ff191660ff92909216919091179055600190565b919050565b600054610100900460ff16612e995760405162461bcd60e51b815260040161094190614790565b612ea7888888888888613924565b612eb18282613971565b5050505050505050565b33600090815260098301602090815260408083206035548154600688019094529184205490929082821015612f4f5760018401548015612f4d57336000908152600989016020908152604080832083815560010183905585835260078b01909152902054676765c793fa10079d601b1b90612f3690836146ca565b612f4091906146e9565b612f4a9083614588565b91505b505b60008111612f8a5760405162461bcd60e51b81526020600482015260086024820152674e4f5f434c41494d60c01b6044820152606401610941565b3360009081526006880160205260408120819055600488018054839290612fb2908490614696565b9091555050604051818152339087907fe269963e621a3253e62b91db52a65eed542266d831178ebc68ad61d54211aca69060200160405180910390a39695505050505050565b6040516001600160a01b03808516602483015283166044820152606481018290526130309085906323b872dd60e01b90608401612c97565b50505050565b600082116130745760405162461bcd60e51b815260206004820152600b60248201526a16915493d7d05353d5539560aa1b6044820152606401610941565b6035546130828482856137ae565b3360009081526005860160205260408120919091556002850180548592906130ab908490614588565b90915550506040518381528190339084907f1e6c0ff7d7fa524ca8d88cabca077adebbf64f902faa7f4b97aa5a1da2620faf9060200160405180910390a450505050565b6035546001600160a01b03821660009081526005840160209081526040808320546008870183528184208251808401909352805480845260019091015493830184905293948594859491939190811561318f578481101561318b57600081815260078b016020526040902054613170676765c793fa10079d601b1b846146ca565b61317a91906146e9565b6131849085614588565b935061318f565b8196505b6001600160a01b038916600081815260098c0160209081526040808320815180830183528154815260019091015481840190815294845260068f019092529091205491519197509015613242578051861115613230578051600090815260078c01602090815260409091205490820151676765c793fa10079d601b1b91613215916146ca565b61321f91906146e9565b6132299088614588565b9650613242565b602081015161323f9086614588565b94505b600060078c018161325460018a614696565b8152602001908152602001600020549050676765c793fa10079d601b1b818761327d91906146ca565b61328791906146e9565b9950505050505050509250925092565b6132c26040518060800160405280600081526020016000815260200160008152602001600081525090565b50604080516080810182528254815260018301546020820152600283015491810191909152600390910154606082015290565b60008060008060b460009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561334e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061337291906147f2565b5060335460b45460408051630dfe168160e01b815290516001600160701b0395861697509390941694506001600160a01b03610100909204821693911691630dfe1681916004808201926020929091908290030181865afa1580156133db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133ff91906146ad565b6001600160a01b031614613414578082613417565b81815b9350935050509091565b6033546040516370a0823160e01b81523060048201526000918291829161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613473573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134979190614559565b6034546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156134e5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135099190614559565b9050613513613a9e565b6033546040516370a0823160e01b8152306004820152839161010090046001600160a01b0316906370a0823190602401602060405180830381865afa158015613560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135849190614559565b61358e9190614696565b6034546040516370a0823160e01b815230600482015291955082916001600160a01b03909116906370a0823190602401602060405180830381865afa1580156135db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135ff9190614559565b6136099190614696565b925050509091565b60b3546040516385f8c25960e01b81526004810185905260248101849052604481018390526000916001600160a01b0316906385f8c25990606401602060405180830381865afa158015613669573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061368d9190614559565b90505b9392505050565b600080826136aa5750600090508061376b565b60b3546136c4906001600160a01b03878116911685613bd4565b60b3546001600160a01b03166338ed17398460006136e28989613c86565b30426040518663ffffffff1660e01b8152600401613704959493929190614842565b6000604051808303816000875af1158015613723573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261374b91908101906148c9565b60018151811061375d5761375d614665565b602002602001015191508290505b935093915050565b6000806103e884108061378757506103e883105b15613797575060009050806137a7565b6137a18484613d14565b90925090505b9250929050565b336000908152600884016020908152604080832060058701909252822054600182015480158015906137e05750825486115b1561382a57825460009081526007880160205260409020548061380e676765c793fa10079d601b1b846146ca565b61381891906146e9565b6138229084614588565b925060009150505b84156138405761383a8582614588565b86845590505b60019092019190915590509392505050565b60006138a7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e599092919063ffffffff16565b805190915015612cce57808060200190518101906138c591906145f7565b612cce5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610941565b600054610100900460ff1661394b5760405162461bcd60e51b815260040161094190614790565b61395486613e68565b61395c613e9b565b6139698585858585613eca565b505050505050565b600054610100900460ff166139985760405162461bcd60e51b815260040161094190614790565b60335460345460405163e6a4390560e01b81526101009092046001600160a01b039081166004840152908116602483015283169063e6a4390590604401602060405180830381865afa1580156139f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a1691906146ad565b60b480546001600160a01b0319166001600160a01b03929092169182179055613a705760405162461bcd60e51b815260206004820152600c60248201526b5a45524f5f4144445245535360a01b6044820152606401610941565b60b280546001600160a01b039384166001600160a01b03199182161790915560b38054929093169116179055565b60b4546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015613ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b0b9190614559565b905080613b155750565b60b35460b454613b32916001600160a01b03918216911683613bd4565b60b354603354603454604051635d5155ef60e11b81526001600160a01b036101009093048316600482015290821660248201526044810184905260006064820181905260848201523060a48201524260c482015291169063baa2abde9060e40160408051808303816000875af1158015613bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cce9190614987565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015613c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c499190614559565b613c539190614588565b6040516001600160a01b03851660248201526044810182905290915061303090859063095ea7b360e01b90606401612c97565b60408051600280825260608083018452926020830190803683370190505090508281600081518110613cba57613cba614665565b60200260200101906001600160a01b031690816001600160a01b0316815250508181600181518110613cee57613cee614665565b60200260200101906001600160a01b031690816001600160a01b03168152505092915050565b60b3546033546000918291613d3b916001600160a01b036101009092048216911686613bd4565b60b354603454613d58916001600160a01b03918216911685613bd4565b60b35460335460345460405162e8e33760e81b81526001600160a01b03610100909304831660048201529082166024820152604481018790526064810186905260006084820181905260a48201523060c48201524260e482015291169063e8e3370090610104016060604051808303816000875af1158015613dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e0291906149ab565b50909250905081841115613e335760b354603354613e33916001600160a01b036101009092048216911660006140b6565b808311156137a75760b3546034546137a7916001600160a01b03918216911660006140b6565b606061368d84846000856141cb565b600054610100900460ff16613e8f5760405162461bcd60e51b815260040161094190614790565b613e98816142fc565b50565b600054610100900460ff16613ec25760405162461bcd60e51b815260040161094190614790565b612dc361434d565b600054610100900460ff16613ef15760405162461bcd60e51b815260040161094190614790565b60008211613f385760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a7182fa32627a7a960611b6044820152606401610941565b60008111613f7f5760405162461bcd60e51b815260206004820152601460248201527324a72b20a624a22faa27a5a2a718afa32627a7a960611b6044820152606401610941565b600060029054906101000a90046001600160a01b03166001600160a01b031663eb6d3a116040518163ffffffff1660e01b8152600401602060405180830381865afa158015613fd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ff691906146ad565b603380546001600160a81b0319166001600160a01b03928316968316968714610100600160a81b031916176101009690960295909517909455603480546001600160a01b031916939094169290921790925560008052676765c793fa10079d601b1b7fe9090a6e551363283803e59daf1c144cd0ac55c420ac8519a53d83ef396a73b381905560496020527f9a0ca60aea446f0de2b73532837f00f56d3ae047e136f7838a520755c00b6e76556001603555603692909255604c55604d55565b8015806141305750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561410a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061412e9190614559565b155b61419b5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b6064820152608401610941565b6040516001600160a01b038316602482015260448101829052612cce90849063095ea7b360e01b90606401612c97565b60608247101561422c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610941565b6001600160a01b0385163b6142835760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610941565b600080866001600160a01b0316858760405161429f9190614a05565b60006040518083038185875af1925050503d80600081146142dc576040519150601f19603f3d011682016040523d82523d6000602084013e6142e1565b606091505b50915091506142f1828286614374565b979650505050505050565b600054610100900460ff166143235760405162461bcd60e51b815260040161094190614790565b600080546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b600054610100900460ff166111b55760405162461bcd60e51b815260040161094190614790565b60608315614383575081613690565b8251156143935782518084602001fd5b8160405162461bcd60e51b81526004016109419190614a21565b6000602082840312156143bf57600080fd5b5035919050565b60008083601f8401126143d857600080fd5b50813567ffffffffffffffff8111156143f057600080fd5b6020830191508360208260051b85010111156137a757600080fd5b6000806000806040858703121561442157600080fd5b843567ffffffffffffffff8082111561443957600080fd5b614445888389016143c6565b9096509450602087013591508082111561445e57600080fd5b5061446b878288016143c6565b95989497509550505050565b6001600160a01b0381168114613e9857600080fd5b60006020828403121561449e57600080fd5b813561369081614477565b600080600080600080600080610100898b0312156144c657600080fd5b88356144d181614477565b97506020890135965060408901356144e881614477565b955060608901356144f881614477565b94506080890135935060a0890135925060c089013561451681614477565b915060e089013561452681614477565b809150509295985092959890939650565b6000806040838503121561454a57600080fd5b50508035926020909101359150565b60006020828403121561456b57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000821982111561459b5761459b614572565b500190565b60208082526006908201526514105554d15160d21b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561460957600080fd5b8151801515811461369057600080fd5b6020808252600e908201526d1393d517d4d51490551151d254d560921b604082015260600190565b6020808252600a90820152691393d517d4105554d15160b21b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060001982141561468f5761468f614572565b5060010190565b6000828210156146a8576146a8614572565b500390565b6000602082840312156146bf57600080fd5b815161369081614477565b60008160001904831182151516156146e4576146e4614572565b500290565b60008261470657634e487b7160e01b600052601260045260246000fd5b500490565b60208082526018908201527f554e45585045435445445f504f4f4c5f42414c414e4345530000000000000000604082015260600190565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b80516001600160701b0381168114612e6d57600080fd5b60008060006060848603121561480757600080fd5b614810846147db565b925061481e602085016147db565b9150604084015163ffffffff8116811461483757600080fd5b809150509250925092565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156148925784516001600160a01b03168352938301939183019160010161486d565b50506001600160a01b03969096166060850152505050608001529392505050565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156148dc57600080fd5b825167ffffffffffffffff808211156148f457600080fd5b818501915085601f83011261490857600080fd5b81518181111561491a5761491a6148b3565b8060051b604051601f19603f8301168101818110858211171561493f5761493f6148b3565b60405291825284820192508381018501918883111561495d57600080fd5b938501935b8285101561497b57845184529385019392850192614962565b98975050505050505050565b6000806040838503121561499a57600080fd5b505080516020909101519092909150565b6000806000606084860312156149c057600080fd5b8351925060208401519150604084015190509250925092565b60005b838110156149f45781810151838201526020016149dc565b838111156130305750506000910152565b60008251614a178184602087016149d9565b9190910192915050565b6020815260008251806020840152614a408160408501602087016149d9565b601f01601f1916919091016040019291505056fe29904dc0060dfbfbdb4804f541ee5b0af0fb57e8edc680ea7b5d072a031ba9997641f496ba4346db02f2b22bd16e018492f6ace90a44ba1990c58f2989aaa42ba26469706673582212201b40bbe9bae4395b1340e8ad4a153b2c8678bf97ea84b9f736195dd0cf93378764736f6c634300080b0033

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.