POL Price: $0.317588 (+2.72%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ZkBobPool

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 24 : ZkBobPool.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-periphery/contracts/interfaces/IPeripheryImmutableState.sol";
import "@uniswap/v3-periphery/contracts/interfaces/external/IWETH9.sol";
import "../interfaces/ITransferVerifier.sol";
import "../interfaces/ITreeVerifier.sol";
import "../interfaces/IMintableERC20.sol";
import "../interfaces/IOperatorManager.sol";
import "../interfaces/IERC20Permit.sol";
import "../interfaces/ITokenSeller.sol";
import "./utils/Parameters.sol";
import "./utils/ZkBobAccounting.sol";
import "../utils/Ownable.sol";
import "../proxy/EIP1967Admin.sol";

/**
 * @title ZkBobPool
 * Shielded transactions pool for BOB tokens.
 */
contract ZkBobPool is EIP1967Admin, Ownable, Parameters, ZkBobAccounting {
    using SafeERC20 for IERC20;

    uint256 internal constant MAX_POOL_ID = 0xffffff;
    uint256 internal constant TOKEN_DENOMINATOR = 1_000_000_000;

    uint256 public immutable pool_id;
    ITransferVerifier public immutable transfer_verifier;
    ITreeVerifier public immutable tree_verifier;
    address public immutable token;

    IOperatorManager public operatorManager;

    mapping(uint256 => uint256) public nullifiers;
    mapping(uint256 => uint256) public roots;
    bytes32 public all_messages_hash;

    mapping(address => uint256) public accumulatedFee;

    ITokenSeller public tokenSeller;

    event UpdateTokenSeller(address seller);
    event UpdateOperatorManager(address manager);
    event WithdrawFee(address indexed operator, uint256 fee);

    event Message(uint256 indexed index, bytes32 indexed hash, bytes message);

    constructor(uint256 __pool_id, address _token, ITransferVerifier _transfer_verifier, ITreeVerifier _tree_verifier) {
        require(__pool_id <= MAX_POOL_ID, "ZkBobPool: exceeds max pool id");
        require(Address.isContract(_token), "ZkBobPool: not a contract");
        require(Address.isContract(address(_transfer_verifier)), "ZkBobPool: not a contract");
        require(Address.isContract(address(_tree_verifier)), "ZkBobPool: not a contract");
        pool_id = __pool_id;
        token = _token;
        transfer_verifier = _transfer_verifier;
        tree_verifier = _tree_verifier;
    }

    /**
     * @dev Throws if called by any account other than the current relayer operator.
     */
    modifier onlyOperator() {
        require(operatorManager.isOperator(_msgSender()), "ZkBobPool: not an operator");
        _;
    }

    /**
     * @dev Initializes pool proxy storage.
     * Callable only once and only through EIP1967Proxy constructor / upgradeToAndCall.
     * @param _root initial empty merkle tree root.
     * @param _tvlCap initial upper cap on the entire pool tvl, 18 decimals.
     * @param _dailyDepositCap initial daily limit on the sum of all deposits, 18 decimals.
     * @param _dailyWithdrawalCap initial daily limit on the sum of all withdrawals, 18 decimals.
     * @param _dailyUserDepositCap initial daily limit on the sum of all per-address deposits, 18 decimals.
     * @param _dailyUserDepositCap initial daily limit on the sum of all per-address deposits, 18 decimals.
     * @param _depositCap initial limit on the amount of a single deposit, 18 decimals.
     */
    function initialize(
        uint256 _root,
        uint256 _tvlCap,
        uint256 _dailyDepositCap,
        uint256 _dailyWithdrawalCap,
        uint256 _dailyUserDepositCap,
        uint256 _depositCap
    )
        external
    {
        require(msg.sender == address(this), "ZkBobPool: not initializer");
        require(roots[0] == 0, "ZkBobPool: already initialized");
        require(_root != 0, "ZkBobPool: zero root");
        roots[0] = _root;
        _setLimits(
            0,
            _tvlCap / TOKEN_DENOMINATOR,
            _dailyDepositCap / TOKEN_DENOMINATOR,
            _dailyWithdrawalCap / TOKEN_DENOMINATOR,
            _dailyUserDepositCap / TOKEN_DENOMINATOR,
            _depositCap / TOKEN_DENOMINATOR
        );
    }

    /**
     * @dev Updates token seller contract used for native coin withdrawals.
     * Callable only by the contract owner / proxy admin.
     * @param _seller new token seller contract implementation. address(0) will deactivate native withdrawals.
     */
    function setTokenSeller(address _seller) external onlyOwner {
        tokenSeller = ITokenSeller(_seller);
        emit UpdateTokenSeller(_seller);
    }

    /**
     * @dev Updates used operator manager contract.
     * Callable only by the contract owner / proxy admin.
     * @param _operatorManager new operator manager implementation.
     */
    function setOperatorManager(IOperatorManager _operatorManager) external onlyOwner {
        require(address(_operatorManager) != address(0), "ZkBobPool: manager is zero address");
        operatorManager = _operatorManager;
        emit UpdateOperatorManager(address(_operatorManager));
    }

    /**
     * @dev Tells the denominator for converting BOB into zkBOB units.
     * 1e18 BOB units = 1e9 zkBOB units.
     */
    function denominator() external pure returns (uint256) {
        return TOKEN_DENOMINATOR;
    }

    /**
     * @dev Tells the current merkle tree index, which will be used for the next operation.
     * Each operation increases merkle tree size by 128, so index is equal to the total number of seen operations, multiplied by 128.
     * @return next operator merkle index.
     */
    function pool_index() external view returns (uint256) {
        return _txCount() << 7;
    }

    function _root() internal view override returns (uint256) {
        return roots[_transfer_index()];
    }

    function _pool_id() internal view override returns (uint256) {
        return pool_id;
    }

    /**
     * @dev Perform a zkBob pool transaction.
     * Callable only by the current operator.
     * Method uses a custom ABI encoding scheme described in CustomABIDecoder.
     * Single transact() call performs either deposit, withdrawal or shielded transfer operation.
     */
    function transact() external onlyOperator {
        address user;
        uint256 txType = _tx_type();
        if (txType == 0) {
            user = _deposit_spender();
        } else if (txType == 2) {
            user = _memo_receiver();
        } else if (txType == 3) {
            user = _memo_permit_holder();
        }
        int256 transfer_token_delta = _transfer_token_amount();
        (,, uint256 txCount) = _recordOperation(user, transfer_token_delta);

        uint256 nullifier = _transfer_nullifier();
        {
            uint256 _pool_index = txCount << 7;

            require(nullifiers[nullifier] == 0, "ZkBobPool: doublespend detected");
            require(_transfer_index() <= _pool_index, "ZkBobPool: transfer index out of bounds");
            require(transfer_verifier.verifyProof(_transfer_pub(), _transfer_proof()), "ZkBobPool: bad transfer proof");
            require(
                tree_verifier.verifyProof(_tree_pub(roots[_pool_index]), _tree_proof()), "ZkBobPool: bad tree proof"
            );

            nullifiers[nullifier] = uint256(keccak256(abi.encodePacked(_transfer_out_commit(), _transfer_delta())));
            _pool_index += 128;
            roots[_pool_index] = _tree_root_after();
            bytes memory message = _memo_message();
            bytes32 message_hash = keccak256(message);
            bytes32 _all_messages_hash = keccak256(abi.encodePacked(all_messages_hash, message_hash));
            all_messages_hash = _all_messages_hash;
            emit Message(_pool_index, _all_messages_hash, message);
        }

        uint256 fee = _memo_fee();
        int256 token_amount = transfer_token_delta + int256(fee);
        int256 energy_amount = _transfer_energy_amount();

        if (txType == 0) {
            // Deposit
            require(transfer_token_delta > 0 && energy_amount == 0, "ZkBobPool: incorrect deposit amounts");
            IERC20(token).safeTransferFrom(user, address(this), uint256(token_amount) * TOKEN_DENOMINATOR);
        } else if (txType == 1) {
            // Transfer
            require(token_amount == 0 && energy_amount == 0, "ZkBobPool: incorrect transfer amounts");
        } else if (txType == 2) {
            // Withdraw
            require(token_amount <= 0 && energy_amount <= 0, "ZkBobPool: incorrect withdraw amounts");

            uint256 native_amount = _memo_native_amount() * TOKEN_DENOMINATOR;
            uint256 withdraw_amount = uint256(-token_amount) * TOKEN_DENOMINATOR;

            if (native_amount > 0) {
                ITokenSeller seller = tokenSeller;
                if (address(seller) != address(0)) {
                    IERC20(token).safeTransfer(address(seller), native_amount);
                    (, uint256 refunded) = seller.sellForETH(user, native_amount);
                    withdraw_amount = withdraw_amount - native_amount + refunded;
                }
            }

            if (withdraw_amount > 0) {
                IERC20(token).safeTransfer(user, withdraw_amount);
            }

            // energy withdrawals are not yet implemented, any transaction with non-zero energy_amount will revert
            // future version of the protocol will support energy withdrawals through negative energy_amount
            if (energy_amount < 0) {
                revert("ZkBobPool: XP claiming is not yet enabled");
            }
        } else if (txType == 3) {
            // Permittable token deposit
            require(transfer_token_delta > 0 && energy_amount == 0, "ZkBobPool: incorrect deposit amounts");
            (uint8 v, bytes32 r, bytes32 s) = _permittable_deposit_signature();
            IERC20Permit(token).receiveWithSaltedPermit(
                user, uint256(token_amount) * TOKEN_DENOMINATOR, _memo_permit_deadline(), bytes32(nullifier), v, r, s
            );
        } else {
            revert("ZkBobPool: Incorrect transaction type");
        }

        if (fee > 0) {
            accumulatedFee[msg.sender] += fee;
        }
    }

    /**
     * @dev Withdraws accumulated fee on behalf of an operator.
     * Callable only by the operator itself, or by a pre-configured operator fee receiver address.
     * @param _operator address of an operator account to withdraw fee from.
     * @param _to address of the accumulated fee tokens receiver.
     */
    function withdrawFee(address _operator, address _to) external {
        require(
            _operator == msg.sender || operatorManager.isOperatorFeeReceiver(_operator, msg.sender),
            "ZkBobPool: not authorized"
        );
        uint256 fee = accumulatedFee[_operator] * TOKEN_DENOMINATOR;
        require(fee > 0, "ZkBobPool: no fee to withdraw");
        IERC20(token).safeTransfer(_to, fee);
        accumulatedFee[_operator] = 0;
        emit WithdrawFee(_operator, fee);
    }

    /**
     * @dev Updates pool usage limits.
     * Callable only by the contract owner / proxy admin.
     * @param _tier pool limits tier (0-254).
     * @param _tvlCap new upper cap on the entire pool tvl, 18 decimals.
     * @param _dailyDepositCap new daily limit on the sum of all deposits, 18 decimals.
     * @param _dailyWithdrawalCap new daily limit on the sum of all withdrawals, 18 decimals.
     * @param _dailyUserDepositCap new daily limit on the sum of all per-address deposits, 18 decimals.
     * @param _dailyUserDepositCap new daily limit on the sum of all per-address deposits, 18 decimals.
     * @param _depositCap new limit on the amount of a single deposit, 18 decimals.
     */
    function setLimits(
        uint8 _tier,
        uint256 _tvlCap,
        uint256 _dailyDepositCap,
        uint256 _dailyWithdrawalCap,
        uint256 _dailyUserDepositCap,
        uint256 _depositCap
    )
        external
        onlyOwner
    {
        _setLimits(
            _tier,
            _tvlCap / TOKEN_DENOMINATOR,
            _dailyDepositCap / TOKEN_DENOMINATOR,
            _dailyWithdrawalCap / TOKEN_DENOMINATOR,
            _dailyUserDepositCap / TOKEN_DENOMINATOR,
            _depositCap / TOKEN_DENOMINATOR
        );
    }

    /**
     * @dev Resets daily limit usage for the current day.
     * Callable only by the contract owner / proxy admin.
     */
    function resetDailyLimits() external onlyOwner {
        _resetDailyLimits();
    }

    /**
     * @dev Updates users limit tiers.
     * Callable only by the contract owner / proxy admin.
     * @param _tier pool limits tier (0-255).
     * 0 is the default tier.
     * 1-254 are custom pool limit tiers, configured at runtime.
     * 255 is the special tier with zero limits, used to effectively prevent some address from accessing the pool.
     * @param _users list of user account addresses to assign a tier for.
     */
    function setUsersTier(uint8 _tier, address[] memory _users) external onlyOwner {
        _setUsersTier(_tier, _users);
    }

    /**
     * @dev Tells if caller is the contract owner.
     * Gives ownership rights to the proxy admin as well.
     * @return true, if caller is the contract owner or proxy admin.
     */
    function _isOwner() internal view override returns (bool) {
        return super._isOwner() || _admin() == _msgSender();
    }
}

File 2 of 24 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

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

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 3 of 24 : IERC20.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 IERC20 {
    /**
     * @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 4 of 24 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 5 of 24 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

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

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

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

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

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        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));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

File 6 of 24 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 7 of 24 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 8 of 24 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

File 9 of 24 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 10 of 24 : IUniswapV3SwapCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IUniswapV3PoolActions#swap
/// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface
interface IUniswapV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call
    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

File 11 of 24 : IPeripheryImmutableState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Immutable state
/// @notice Functions that return immutable state of the router
interface IPeripheryImmutableState {
    /// @return Returns the address of the Uniswap V3 factory
    function factory() external view returns (address);

    /// @return Returns the address of WETH9
    function WETH9() external view returns (address);
}

File 12 of 24 : ISwapRouter.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';

/// @title Router token swapping functionality
/// @notice Functions for swapping tokens via Uniswap V3
interface ISwapRouter is IUniswapV3SwapCallback {
    struct ExactInputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);

    struct ExactInputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountIn;
        uint256 amountOutMinimum;
    }

    /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata
    /// @return amountOut The amount of the received token
    function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);

    struct ExactOutputSingleParams {
        address tokenIn;
        address tokenOut;
        uint24 fee;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
        uint160 sqrtPriceLimitX96;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another token
    /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);

    struct ExactOutputParams {
        bytes path;
        address recipient;
        uint256 deadline;
        uint256 amountOut;
        uint256 amountInMaximum;
    }

    /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed)
    /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata
    /// @return amountIn The amount of the input token
    function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn);
}

File 13 of 24 : IWETH9.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity =0.8.15;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';

/// @title Interface for WETH9
interface IWETH9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

File 14 of 24 : IERC20Permit.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity 0.8.15;

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

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

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external view returns (bytes32);

    function SALTED_PERMIT_TYPEHASH() external view returns (bytes32);

    function receiveWithPermit(
        address _holder,
        uint256 _value,
        uint256 _deadline,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
    )
        external;

    function receiveWithSaltedPermit(
        address _holder,
        uint256 _value,
        uint256 _deadline,
        bytes32 _salt,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
    )
        external;
}

File 15 of 24 : IMintableERC20.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity 0.8.15;

interface IMintableERC20 {
    function mint(address to, uint256 amount) external;
}

File 16 of 24 : IOperatorManager.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

interface IOperatorManager {
    function isOperator(address _addr) external view returns (bool);

    function isOperatorFeeReceiver(address _operator, address _addr) external view returns (bool);

    function operatorURI() external view returns (string memory);
}

File 17 of 24 : ITokenSeller.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity 0.8.15;

interface ITokenSeller {
    /**
     * @dev Sells tokens for ETH.
     * Prior to calling this function, contract balance of token0 should be greater than or equal to the sold amount.
     * @param _receiver native ETH receiver.
     * @param _amount amount of tokens to sell.
     * @return (received eth amount, refunded token amount).
     */
    function sellForETH(address _receiver, uint256 _amount) external returns (uint256, uint256);

    /**
     * @dev Estimates amount of received ETH, when selling given amount of tokens via sellForETH function.
     * @param _amount amount of tokens to sell.
     * @return received eth amount.
     */
    function quoteSellForETH(uint256 _amount) external returns (uint256);
}

File 18 of 24 : ITransferVerifier.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

interface ITransferVerifier {
    function verifyProof(uint256[5] memory input, uint256[8] memory p) external view returns (bool);
}

File 19 of 24 : ITreeVerifier.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

interface ITreeVerifier {
    function verifyProof(uint256[3] memory input, uint256[8] memory p) external view returns (bool);
}

File 20 of 24 : EIP1967Admin.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity 0.8.15;

/**
 * @title EIP1967Admin
 * @dev Upgradeable proxy pattern implementation according to minimalistic EIP1967.
 */
contract EIP1967Admin {
    // EIP 1967
    // bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1)
    uint256 internal constant EIP1967_ADMIN_STORAGE = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    modifier onlyAdmin() {
        require(msg.sender == _admin(), "EIP1967Admin: not an admin");
        _;
    }

    function _admin() internal view returns (address res) {
        assembly {
            res := sload(EIP1967_ADMIN_STORAGE)
        }
    }
}

File 21 of 24 : Ownable.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity 0.8.15;

import "@openzeppelin/contracts/access/Ownable.sol" as OZOwnable;

/**
 * @title Ownable
 */
contract Ownable is OZOwnable.Ownable {
    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view override {
        require(_isOwner(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Tells if caller is the contract owner.
     * @return true, if caller is the contract owner.
     */
    function _isOwner() internal view virtual returns (bool) {
        return owner() == _msgSender();
    }
}

File 22 of 24 : CustomABIDecoder.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

contract CustomABIDecoder {
    uint256 constant transfer_nullifier_pos = 4;
    uint256 constant transfer_nullifier_size = 32;
    uint256 constant uint256_size = 32;

    function _loaduint256(uint256 pos) internal pure returns (uint256 r) {
        assembly {
            r := calldataload(pos)
        }
    }

    function _transfer_nullifier() internal pure returns (uint256 r) {
        r = _loaduint256(transfer_nullifier_pos);
    }

    uint256 constant transfer_out_commit_pos = transfer_nullifier_pos + transfer_nullifier_size;
    uint256 constant transfer_out_commit_size = 32;

    function _transfer_out_commit() internal pure returns (uint256 r) {
        r = _loaduint256(transfer_out_commit_pos);
    }

    uint256 constant transfer_index_pos = transfer_out_commit_pos + transfer_out_commit_size;
    uint256 constant transfer_index_size = 6;

    function _transfer_index() internal pure returns (uint48 r) {
        r = uint48(_loaduint256(transfer_index_pos + transfer_index_size - uint256_size));
    }

    uint256 constant transfer_energy_amount_pos = transfer_index_pos + transfer_index_size;
    uint256 constant transfer_energy_amount_size = 14;

    function _transfer_energy_amount() internal pure returns (int112 r) {
        r = int112(uint112(_loaduint256(transfer_energy_amount_pos + transfer_energy_amount_size - uint256_size)));
    }

    uint256 constant transfer_token_amount_pos = transfer_energy_amount_pos + transfer_energy_amount_size;
    uint256 constant transfer_token_amount_size = 8;

    function _transfer_token_amount() internal pure returns (int64 r) {
        r = int64(uint64(_loaduint256(transfer_token_amount_pos + transfer_token_amount_size - uint256_size)));
    }

    uint256 constant transfer_proof_pos = transfer_token_amount_pos + transfer_token_amount_size;
    uint256 constant transfer_proof_size = 256;

    function _transfer_proof() internal pure returns (uint256[8] calldata r) {
        uint256 pos = transfer_proof_pos;
        assembly {
            r := pos
        }
    }

    uint256 constant tree_root_after_pos = transfer_proof_pos + transfer_proof_size;
    uint256 constant tree_root_after_size = 32;

    function _tree_root_after() internal pure returns (uint256 r) {
        r = _loaduint256(tree_root_after_pos);
    }

    uint256 constant tree_proof_pos = tree_root_after_pos + tree_root_after_size;
    uint256 constant tree_proof_size = 256;

    function _tree_proof() internal pure returns (uint256[8] calldata r) {
        uint256 pos = tree_proof_pos;
        assembly {
            r := pos
        }
    }

    uint256 constant tx_type_pos = tree_proof_pos + tree_proof_size;
    uint256 constant tx_type_size = 2;
    uint256 constant tx_type_mask = (1 << (tx_type_size * 8)) - 1;

    function _tx_type() internal pure returns (uint256 r) {
        r = _loaduint256(tx_type_pos + tx_type_size - uint256_size) & tx_type_mask;
    }

    uint256 constant memo_data_size_pos = tx_type_pos + tx_type_size;
    uint256 constant memo_data_size_size = 2;
    uint256 constant memo_data_size_mask = (1 << (memo_data_size_size * 8)) - 1;

    uint256 constant memo_data_pos = memo_data_size_pos + memo_data_size_size;

    function _memo_data_size() internal pure returns (uint256 r) {
        r = _loaduint256(memo_data_size_pos + memo_data_size_size - uint256_size) & memo_data_size_mask;
    }

    function _memo_data() internal pure returns (bytes calldata r) {
        uint256 offset = memo_data_pos;
        uint256 length = _memo_data_size();
        assembly {
            r.offset := offset
            r.length := length
        }
    }

    function _sign_r_vs_pos() internal pure returns (uint256) {
        return memo_data_pos + _memo_data_size();
    }

    uint256 constant sign_r_vs_size = 64;

    function _sign_r_vs() internal pure returns (bytes32 r, bytes32 vs) {
        uint256 offset = _sign_r_vs_pos();
        assembly {
            r := calldataload(offset)
            vs := calldataload(add(offset, 32))
        }
    }

    uint256 constant transfer_delta_size =
        transfer_index_size + transfer_energy_amount_size + transfer_token_amount_size;
    uint256 constant transfer_delta_mask = (1 << (transfer_delta_size * 8)) - 1;

    function _transfer_delta() internal pure returns (uint256 r) {
        r = _loaduint256(transfer_index_pos + transfer_delta_size - uint256_size) & transfer_delta_mask;
    }

    function _memo_fixed_size() internal pure returns (uint256 r) {
        uint256 t = _tx_type();
        if (t == 0 || t == 1) {
            // fee
            // 8
            r = 8;
        } else if (t == 2) {
            // fee + native amount + recipient
            // 8 + 8 + 20
            r = 36;
        } else if (t == 3) {
            // fee + deadline + address
            // 8 + 8 + 20
            r = 36;
        } else {
            revert();
        }
    }

    function _memo_message() internal pure returns (bytes calldata r) {
        uint256 memo_fixed_size = _memo_fixed_size();
        uint256 offset = memo_data_pos + memo_fixed_size;
        uint256 length = _memo_data_size() - memo_fixed_size;
        assembly {
            r.offset := offset
            r.length := length
        }
    }

    uint256 constant memo_fee_pos = memo_data_pos;
    uint256 constant memo_fee_size = 8;
    uint256 constant memo_fee_mask = (1 << (memo_fee_size * 8)) - 1;

    function _memo_fee() internal pure returns (uint256 r) {
        r = _loaduint256(memo_fee_pos + memo_fee_size - uint256_size) & memo_fee_mask;
    }

    // Withdraw specific data

    uint256 constant memo_native_amount_pos = memo_fee_pos + memo_fee_size;
    uint256 constant memo_native_amount_size = 8;
    uint256 constant memo_native_amount_mask = (1 << (memo_native_amount_size * 8)) - 1;

    function _memo_native_amount() internal pure returns (uint256 r) {
        r = _loaduint256(memo_native_amount_pos + memo_native_amount_size - uint256_size) & memo_native_amount_mask;
    }

    uint256 constant memo_receiver_pos = memo_native_amount_pos + memo_native_amount_size;
    uint256 constant memo_receiver_size = 20;

    function _memo_receiver() internal pure returns (address r) {
        r = address(uint160(_loaduint256(memo_receiver_pos + memo_receiver_size - uint256_size)));
    }

    // Permittable token deposit specific data

    uint256 constant memo_permit_deadline_pos = memo_fee_pos + memo_fee_size;
    uint256 constant memo_permit_deadline_size = 8;

    function _memo_permit_deadline() internal pure returns (uint64 r) {
        r = uint64(_loaduint256(memo_permit_deadline_pos + memo_permit_deadline_size - uint256_size));
    }

    uint256 constant memo_permit_holder_pos = memo_permit_deadline_pos + memo_permit_deadline_size;
    uint256 constant memo_permit_holder_size = 20;

    function _memo_permit_holder() internal pure returns (address r) {
        r = address(uint160(_loaduint256(memo_permit_holder_pos + memo_permit_holder_size - uint256_size)));
    }
}

File 23 of 24 : Parameters.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "./CustomABIDecoder.sol";

abstract contract Parameters is CustomABIDecoder {
    uint256 constant R = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
    bytes32 constant S_MASK = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

    function _root() internal view virtual returns (uint256);
    function _pool_id() internal view virtual returns (uint256);

    function _transfer_pub() internal view returns (uint256[5] memory r) {
        r[0] = _root();
        r[1] = _transfer_nullifier();
        r[2] = _transfer_out_commit();
        r[3] = _transfer_delta() + (_pool_id() << (transfer_delta_size * 8));
        r[4] = uint256(keccak256(_memo_data())) % R;
    }

    function _tree_pub(uint256 _root_before) internal view returns (uint256[3] memory r) {
        r[0] = _root_before;
        r[1] = _tree_root_after();
        r[2] = _transfer_out_commit();
    }

    // NOTE only valid in the context of normal deposit (tx_type=0)
    function _deposit_spender() internal pure returns (address) {
        (bytes32 r, bytes32 vs) = _sign_r_vs();
        return ECDSA.recover(ECDSA.toEthSignedMessageHash(bytes32(_transfer_nullifier())), r, vs);
    }

    // NOTE only valid in the context of permittable token deposit (tx_type=3)
    function _permittable_deposit_signature() internal pure returns (uint8, bytes32, bytes32) {
        (bytes32 r, bytes32 vs) = _sign_r_vs();
        return (uint8((uint256(vs) >> 255) + 27), r, vs & S_MASK);
    }
}

File 24 of 24 : ZkBobAccounting.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity 0.8.15;

/**
 * @title ZkBobAccounting
 * @dev On chain accounting for zkBob operations, limits and stats.
 * Units: 1 BOB = 1e18 wei = 1e9 zkBOB units
 * Limitations: Contract will only work correctly as long as pool tvl does not exceed 4.7e12 BOB (4.7 trillion)
 * and overall transaction count does not exceed 4.3e9 (4.3 billion). Pool usage limits cannot exceed 4.3e9 BOB (4.3 billion) per day.
 */
contract ZkBobAccounting {
    uint256 internal constant PRECISION = 1_000_000_000;
    uint256 internal constant SLOT_DURATION = 1 hours;
    uint256 internal constant DAY_SLOTS = 1 days / SLOT_DURATION;
    uint256 internal constant WEEK_SLOTS = 1 weeks / SLOT_DURATION;

    struct Slot0 {
        // max seen average tvl over period of at least 1 week (granularity of 1e9), might not be precise
        // max possible tvl - type(uint56).max * 1e9 zkBOB units ~= 7.2e16 BOB
        uint56 maxWeeklyAvgTvl;
        // max number of pool interactions over 1 week, might not be precise
        // max possible tx count - type(uint32).max ~= 4.3e9 transactions
        uint32 maxWeeklyTxCount;
        // 1 week behind snapshot time slot (granularity of 1 hour)
        // max possible timestamp - Dec 08 3883
        uint24 tailSlot;
        // active snapshot time slot (granularity of 1 hour)
        // max possible timestamp - Dec 08 3883
        uint24 headSlot;
        // cumulative sum of tvl over txCount interactions (granularity of 1e9)
        // max possible cumulative tvl ~= type(uint32).max * type(uint56).max = 4.3e9 transactions * 7.2e16 BOB
        uint88 cumTvl;
        // number of successful pool interactions since launch
        // max possible tx count - type(uint32).max ~= 4.3e9 transactions
        uint32 txCount;
    }

    struct Slot1 {
        // current pool tvl (granularity of 1)
        // max possible tvl - type(uint72).max * 1 zkBOB units ~= 4.7e21 zkBOB units ~= 4.7e12 BOB
        uint72 tvl;
        // today deposit sum (granularity of 1e9)
        // max possible sum - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB
        uint32 dailyDeposit;
        // today withdrawal sum (granularity of 1e9)
        // max possible sum - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB
        uint32 dailyWithdrawal;
    }

    struct PoolLimits {
        // max cap on the entire pool tvl (granularity of 1e9)
        // max possible cap - type(uint56).max * 1e9 zkBOB units ~= 7.2e16 BOB
        uint56 tvlCap;
        // max cap on the daily deposits sum (granularity of 1e9)
        // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB
        uint32 dailyDepositCap;
        // max cap on the daily withdrawal sum (granularity of 1e9)
        // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB
        uint32 dailyWithdrawalCap;
        // max cap on the daily deposits sum for single user (granularity of 1e9)
        // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB
        uint32 dailyUserDepositCap;
        // max cap on single deposit (granularity of 1e9)
        // max possible cap - type(uint32).max * 1e9 zkBOB units ~= 4.3e9 BOB
        uint32 depositCap;
    }

    struct Snapshot {
        uint24 nextSlot; // next slot to from the queue
        uint32 txCount; // number of successful pool interactions since launch at the time of the snapshot
        uint88 cumTvl; // cumulative sum of tvl over txCount interactions (granularity of 1e9)
    }

    struct UserStats {
        uint16 day; // last update day number
        uint72 dailyDeposit; // sum of user deposits during given day
        uint8 tier; // user limits tier, 0 being the default tier
    }

    struct Limits {
        uint256 tvlCap;
        uint256 tvl;
        uint256 dailyDepositCap;
        uint256 dailyDepositCapUsage;
        uint256 dailyWithdrawalCap;
        uint256 dailyWithdrawalCapUsage;
        uint256 dailyUserDepositCap;
        uint256 dailyUserDepositCapUsage;
        uint256 depositCap;
        uint8 tier;
    }

    Slot0 private slot0;
    Slot1 private slot1;
    mapping(uint256 => PoolLimits) private poolLimits; // pool limits per tier
    mapping(uint256 => Snapshot) private snapshots; // single linked list of hourly snapshots
    mapping(address => UserStats) private userStats;

    event UpdateLimits(uint8 indexed tier, PoolLimits limits);
    event UpdateTier(address user, uint8 tier);

    /**
     * @dev Returns currently configured limits and remaining quotas for the given user as of the current block.
     * @param _user user for which to retrieve limits.
     * @return limits (denominated in zkBOB units = 1e-9 BOB)
     */
    function getLimitsFor(address _user) external view returns (Limits memory) {
        Slot0 memory s0 = slot0;
        Slot1 memory s1 = slot1;
        UserStats memory us = userStats[_user];
        PoolLimits memory pl = poolLimits[uint256(us.tier)];
        uint24 curSlot = uint24(block.timestamp / SLOT_DURATION);
        uint24 today = curSlot / uint24(DAY_SLOTS);
        return Limits({
            tvlCap: pl.tvlCap * PRECISION,
            tvl: s1.tvl,
            dailyDepositCap: pl.dailyDepositCap * PRECISION,
            dailyDepositCapUsage: (s0.headSlot / DAY_SLOTS == today) ? s1.dailyDeposit * PRECISION : 0,
            dailyWithdrawalCap: pl.dailyWithdrawalCap * PRECISION,
            dailyWithdrawalCapUsage: (s0.headSlot / DAY_SLOTS == today) ? s1.dailyWithdrawal * PRECISION : 0,
            dailyUserDepositCap: pl.dailyUserDepositCap * PRECISION,
            dailyUserDepositCapUsage: (us.day == today) ? us.dailyDeposit : 0,
            depositCap: pl.depositCap * PRECISION,
            tier: us.tier
        });
    }

    function _recordOperation(
        address _user,
        int256 _txAmount
    )
        internal
        returns (uint56 maxWeeklyAvgTvl, uint32 maxWeeklyTxCount, uint256 txCount)
    {
        Slot0 memory s0 = slot0;
        Slot1 memory s1 = slot1;
        uint24 curSlot = uint24(block.timestamp / SLOT_DURATION);
        txCount = uint256(s0.txCount);

        // for full correctness, next line should use "while" instead of "if"
        // however, in order to keep constant gas usage, "if" is being used
        // this can lead to a longer sliding window (> 1 week) in some cases,
        // but eventually it will converge back to the 1 week target
        if (s0.txCount > 0 && curSlot - s0.tailSlot > WEEK_SLOTS) {
            // if tail is more than 1 week behind, we move tail pointer to the next snapshot
            Snapshot memory sn = snapshots[s0.tailSlot];
            delete snapshots[s0.tailSlot];
            s0.tailSlot = sn.nextSlot;
            uint32 weeklyTxCount = s0.txCount - sn.txCount;
            if (weeklyTxCount > s0.maxWeeklyTxCount) {
                s0.maxWeeklyTxCount = weeklyTxCount;
            }
            uint56 avgTvl = uint56((s0.cumTvl - sn.cumTvl) / weeklyTxCount);
            if (avgTvl > s0.maxWeeklyAvgTvl) {
                s0.maxWeeklyAvgTvl = avgTvl;
            }
        }

        if (s0.headSlot < curSlot) {
            snapshots[s0.headSlot] = Snapshot(curSlot, s0.txCount, s0.cumTvl);
        }

        // update head stats
        s0.cumTvl += s1.tvl / uint72(PRECISION);
        s0.txCount++;

        _processTVLChange(s0, s1, _user, _txAmount);

        s0.headSlot = curSlot;
        slot0 = s0;
        return (s0.maxWeeklyAvgTvl, s0.maxWeeklyTxCount, txCount);
    }

    function _processTVLChange(Slot0 memory s0, Slot1 memory s1, address _user, int256 _txAmount) internal {
        uint16 curDay = uint16(block.timestamp / SLOT_DURATION / DAY_SLOTS);

        bool isDayTransition = curDay > s0.headSlot / DAY_SLOTS;

        if (_txAmount == 0) {
            if (isDayTransition) {
                (s1.dailyDeposit, s1.dailyWithdrawal) = (0, 0);
                slot1 = s1;
            }
            return;
        }

        UserStats memory us = userStats[_user];
        PoolLimits memory pl = poolLimits[us.tier];

        if (_txAmount > 0) {
            uint256 depositAmount = uint256(_txAmount);
            s1.tvl += uint72(depositAmount);

            // check all sorts of limits when processing a deposit
            require(depositAmount <= uint256(pl.depositCap) * PRECISION, "ZkBobAccounting: single deposit cap exceeded");
            require(uint256(s1.tvl) <= uint256(pl.tvlCap) * PRECISION, "ZkBobAccounting: tvl cap exceeded");

            if (curDay > us.day) {
                // user snapshot is outdated, day number and daily sum could be reset
                userStats[_user] = UserStats(curDay, uint72(depositAmount), us.tier);
            } else {
                us.dailyDeposit += uint72(depositAmount);
                require(
                    uint256(us.dailyDeposit) <= uint256(pl.dailyUserDepositCap) * PRECISION,
                    "ZkBobAccounting: daily user deposit cap exceeded"
                );
                userStats[_user] = us;
            }

            if (isDayTransition) {
                // latest deposit was on an earlier day, reset daily deposit sum
                s1.dailyDeposit = uint32(depositAmount / PRECISION);
                s1.dailyWithdrawal = 0;
            } else {
                s1.dailyDeposit += uint32(depositAmount / PRECISION);
                require(s1.dailyDeposit <= pl.dailyDepositCap, "ZkBobAccounting: daily deposit cap exceeded");
            }
        } else {
            uint256 withdrawAmount = uint256(-_txAmount);
            require(withdrawAmount <= type(uint32).max * PRECISION, "ZkBobAccounting: withdrawal amount too large");
            s1.tvl -= uint72(withdrawAmount);

            if (isDayTransition) {
                s1.dailyDeposit = 0;
                // latest withdrawal was on an earlier day, reset daily deposit sum
                s1.dailyWithdrawal = uint32(withdrawAmount / PRECISION);
            } else {
                s1.dailyWithdrawal += uint32(withdrawAmount / PRECISION);
                require(s1.dailyWithdrawal <= pl.dailyWithdrawalCap, "ZkBobAccounting: daily withdrawal cap exceeded");
            }
        }

        slot1 = s1;
    }

    function _resetDailyLimits() internal {
        (slot1.dailyDeposit, slot1.dailyWithdrawal) = (0, 0);
    }

    function _setLimits(
        uint8 _tier,
        uint256 _tvlCap,
        uint256 _dailyDepositCap,
        uint256 _dailyWithdrawalCap,
        uint256 _dailyUserDepositCap,
        uint256 _depositCap
    )
        internal
    {
        require(_tier < 255, "ZkBobAccounting: invalid limit tier");
        require(_depositCap > 0, "ZkBobAccounting: zero deposit cap");
        require(_tvlCap <= type(uint56).max * PRECISION, "ZkBobAccounting: tvl cap too large");
        require(_dailyDepositCap <= type(uint32).max * PRECISION, "ZkBobAccounting: daily deposit cap too large");
        require(_dailyWithdrawalCap <= type(uint32).max * PRECISION, "ZkBobAccounting: daily withdrawal cap too large");
        require(_dailyUserDepositCap >= _depositCap, "ZkBobAccounting: daily user deposit cap too low");
        require(_dailyDepositCap >= _dailyUserDepositCap, "ZkBobAccounting: daily deposit cap too low");
        require(_tvlCap >= _dailyDepositCap, "ZkBobAccounting: tvl cap too low");
        require(_dailyWithdrawalCap > 0, "ZkBobAccounting: zero daily withdrawal cap");
        PoolLimits memory pl = PoolLimits({
            tvlCap: uint56(_tvlCap / PRECISION),
            dailyDepositCap: uint32(_dailyDepositCap / PRECISION),
            dailyWithdrawalCap: uint32(_dailyWithdrawalCap / PRECISION),
            dailyUserDepositCap: uint32(_dailyUserDepositCap / PRECISION),
            depositCap: uint32(_depositCap / PRECISION)
        });
        poolLimits[_tier] = pl;
        emit UpdateLimits(_tier, pl);
    }

    function _setUsersTier(uint8 _tier, address[] memory _users) internal {
        require(_tier == 255 || poolLimits[uint256(_tier)].tvlCap > 0, "ZkBobAccounting: non-existing pool limits tier");
        for (uint256 i = 0; i < _users.length; i++) {
            address user = _users[i];
            userStats[user].tier = _tier;
            emit UpdateTier(user, _tier);
        }
    }

    function _txCount() internal view returns (uint256) {
        return slot0.txCount;
    }
}

Settings
{
  "remappings": [
    "@gnosis/=lib/@gnosis/",
    "@gnosis/auction/=lib/@gnosis/auction/contracts/",
    "@openzeppelin/=lib/@openzeppelin/contracts/",
    "@openzeppelin/contracts/=lib/@openzeppelin/contracts/contracts/",
    "@uniswap/=lib/@uniswap/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"__pool_id","type":"uint256"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"contract ITransferVerifier","name":"_transfer_verifier","type":"address"},{"internalType":"contract ITreeVerifier","name":"_tree_verifier","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"hash","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"message","type":"bytes"}],"name":"Message","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"tier","type":"uint8"},{"components":[{"internalType":"uint56","name":"tvlCap","type":"uint56"},{"internalType":"uint32","name":"dailyDepositCap","type":"uint32"},{"internalType":"uint32","name":"dailyWithdrawalCap","type":"uint32"},{"internalType":"uint32","name":"dailyUserDepositCap","type":"uint32"},{"internalType":"uint32","name":"depositCap","type":"uint32"}],"indexed":false,"internalType":"struct ZkBobAccounting.PoolLimits","name":"limits","type":"tuple"}],"name":"UpdateLimits","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"manager","type":"address"}],"name":"UpdateOperatorManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint8","name":"tier","type":"uint8"}],"name":"UpdateTier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"seller","type":"address"}],"name":"UpdateTokenSeller","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"WithdrawFee","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accumulatedFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"all_messages_hash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"denominator","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"getLimitsFor","outputs":[{"components":[{"internalType":"uint256","name":"tvlCap","type":"uint256"},{"internalType":"uint256","name":"tvl","type":"uint256"},{"internalType":"uint256","name":"dailyDepositCap","type":"uint256"},{"internalType":"uint256","name":"dailyDepositCapUsage","type":"uint256"},{"internalType":"uint256","name":"dailyWithdrawalCap","type":"uint256"},{"internalType":"uint256","name":"dailyWithdrawalCapUsage","type":"uint256"},{"internalType":"uint256","name":"dailyUserDepositCap","type":"uint256"},{"internalType":"uint256","name":"dailyUserDepositCapUsage","type":"uint256"},{"internalType":"uint256","name":"depositCap","type":"uint256"},{"internalType":"uint8","name":"tier","type":"uint8"}],"internalType":"struct ZkBobAccounting.Limits","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_root","type":"uint256"},{"internalType":"uint256","name":"_tvlCap","type":"uint256"},{"internalType":"uint256","name":"_dailyDepositCap","type":"uint256"},{"internalType":"uint256","name":"_dailyWithdrawalCap","type":"uint256"},{"internalType":"uint256","name":"_dailyUserDepositCap","type":"uint256"},{"internalType":"uint256","name":"_depositCap","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nullifiers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorManager","outputs":[{"internalType":"contract IOperatorManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool_id","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pool_index","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetDailyLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"roots","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_tier","type":"uint8"},{"internalType":"uint256","name":"_tvlCap","type":"uint256"},{"internalType":"uint256","name":"_dailyDepositCap","type":"uint256"},{"internalType":"uint256","name":"_dailyWithdrawalCap","type":"uint256"},{"internalType":"uint256","name":"_dailyUserDepositCap","type":"uint256"},{"internalType":"uint256","name":"_depositCap","type":"uint256"}],"name":"setLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOperatorManager","name":"_operatorManager","type":"address"}],"name":"setOperatorManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_seller","type":"address"}],"name":"setTokenSeller","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_tier","type":"uint8"},{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"setUsersTier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenSeller","outputs":[{"internalType":"contract ITokenSeller","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transact","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transfer_verifier","outputs":[{"internalType":"contract ITransferVerifier","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tree_verifier","outputs":[{"internalType":"contract ITreeVerifier","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101006040523480156200001257600080fd5b50604051620040f5380380620040f583398101604081905262000035916200022d565b6200004033620001b5565b62ffffff841115620000995760405162461bcd60e51b815260206004820152601e60248201527f5a6b426f62506f6f6c3a2065786365656473206d617820706f6f6c206964000060448201526064015b60405180910390fd5b620000af836200020560201b620016aa1760201c565b620000ec5760405162461bcd60e51b81526020600482015260196024820152600080516020620040d5833981519152604482015260640162000090565b62000102826200020560201b620016aa1760201c565b6200013f5760405162461bcd60e51b81526020600482015260196024820152600080516020620040d5833981519152604482015260640162000090565b62000155816200020560201b620016aa1760201c565b620001925760405162461bcd60e51b81526020600482015260196024820152600080516020620040d5833981519152604482015260640162000090565b6080939093526001600160a01b0391821660e052811660a0521660c05262000289565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03163b151590565b6001600160a01b03811681146200022a57600080fd5b50565b600080600080608085870312156200024457600080fd5b845193506020850151620002588162000214565b60408601519093506200026b8162000214565b60608601519092506200027e8162000214565b939692955090935050565b60805160a05160c05160e051613dda620002fb6000396000818161037301528181610eeb01528181611056015281816111250152818161120601526115730152600081816101f80152610c5e0152600081816101920152610b5e0152600081816102b001526122a40152613dda6000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c80638fff4676116100c3578063c879c6d81161007c578063c879c6d81461030d578063d21e82ab14610320578063d847f40614610340578063e0ec037414610348578063f2fde38b1461035b578063fc0c546a1461036e57600080fd5b80638fff46761461029957806396ce0795146102a15780639d8ad6e4146102ab578063af989083146102d2578063c2b40ae4146102da578063c41100fa146102fa57600080fd5b80634279a99e116101155780634279a99e1461021a578063508400401461023a57806354b591531461025a578063715018a61461026d5780637a22393b146102755780638da5cb5b1461028857600080fd5b80630c6248de1461015d578063171ef3001461018d5780631dd69d06146101b45780632d7aa82b146101cb5780632f84c96f146101e05780633701f979146101f3575b600080fd5b600b54610170906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101707f000000000000000000000000000000000000000000000000000000000000000081565b6101bd60095481565b604051908152602001610184565b6101de6101d93660046136b6565b610395565b005b600654610170906001600160a01b031681565b6101707f000000000000000000000000000000000000000000000000000000000000000081565b61022d61022836600461371e565b61052d565b6040516101849190613742565b6101bd61024836600461371e565b600a6020526000908152604090205481565b6101de6102683660046137cf565b6108a3565b6101de6108bd565b6101de61028336600461371e565b6108d1565b6000546001600160a01b0316610170565b6101bd61092e565b633b9aca006101bd565b6101bd7f000000000000000000000000000000000000000000000000000000000000000081565b6101de610950565b6101bd6102e8366004613819565b60086020526000908152604090205481565b6101de61030836600461371e565b611363565b6101de61031b366004613832565b61141a565b6101bd61032e366004613819565b60076020526000908152604090205481565b6101de6115f4565b6101de610356366004613881565b61161b565b6101de61036936600461371e565b611631565b6101707f000000000000000000000000000000000000000000000000000000000000000081565b3330146103e95760405162461bcd60e51b815260206004820152601a60248201527f5a6b426f62506f6f6c3a206e6f7420696e697469616c697a657200000000000060448201526064015b60405180910390fd5b6000805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c754156104615760405162461bcd60e51b815260206004820152601e60248201527f5a6b426f62506f6f6c3a20616c726561647920696e697469616c697a6564000060448201526064016103e0565b856000036104a85760405162461bcd60e51b8152602060048201526014602482015273169ad09bd8941bdbdb0e881e995c9bc81c9bdbdd60621b60448201526064016103e0565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7879055610525906104e8633b9aca0088613985565b6104f6633b9aca0088613985565b610504633b9aca0088613985565b610512633b9aca0088613985565b610520633b9aca0088613985565b6116b9565b505050505050565b610586604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600060ff1681525090565b6040805160c08101825260015466ffffffffffffff8082168352600160381b80830463ffffffff908116602080870191909152600160581b80860462ffffff908116888a0152600160701b870416606080890191909152600160881b87046001600160581b03166080808a0191909152600160e01b909704841660a0808a019190915289518083018b526002546001600160481b038082168352600160481b8204881683880152600160681b9091048716828d01526001600160a01b038e166000908152600587528c81208d518087018f52905461ffff81168252620100008104909316818901529186900460ff16828e018190528152600387528c81208d519485018e5254998a168452978904871695830195909552928704851699810199909952600160781b8604841690890152600160981b90940490911693860193909352929390926106d8610e1042613985565b905060006106eb610e1062015180613985565b6106f59083613999565b9050604051806101400160405280633b9aca00856000015166ffffffffffffff1661072091906139bb565b815260200186600001516001600160481b03168152602001633b9aca00856020015163ffffffff1661075291906139bb565b815260200162ffffff831661076c610e1062015180613985565b896060015162ffffff166107809190613985565b1461078c5760006107a6565b633b9aca00876020015163ffffffff166107a691906139bb565b8152602001633b9aca00856040015163ffffffff166107c591906139bb565b815260200162ffffff83166107df610e1062015180613985565b896060015162ffffff166107f39190613985565b146107ff576000610819565b633b9aca00876040015163ffffffff1661081991906139bb565b8152602001633b9aca00856060015163ffffffff1661083891906139bb565b81526020018262ffffff16866000015161ffff161461085857600061085e565b85602001515b6001600160481b03168152602001633b9aca00856080015163ffffffff1661088691906139bb565b8152602001856040015160ff168152509650505050505050919050565b6108ab611c18565b610525866104e8633b9aca0088613985565b6108c5611c18565b6108cf6000611c6c565b565b6108d9611c18565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fdf71641930ea322cb32f687f4d292a0af694c81216254f204c930092593d8282906020015b60405180910390a150565b6000600761094960015463ffffffff600160e01b9091041690565b901b905090565b6006546001600160a01b0316636d70f7ae336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca91906139da565b610a165760405162461bcd60e51b815260206004820152601a60248201527f5a6b426f62506f6f6c3a206e6f7420616e206f70657261746f7200000000000060448201526064016103e0565b600080610a21611cbc565b905080600003610a3a57610a33611d5c565b9150610a5d565b80600203610a4a57610a33611ddd565b80600303610a5d57610a5a611ddd565b91505b6000610a67611e2f565b60070b90506000610a788483611e48565b925050506000610a8760043590565b60008181526007602081905260409091205491925083901b9015610aed5760405162461bcd60e51b815260206004820152601f60248201527f5a6b426f62506f6f6c3a20646f75626c657370656e642064657465637465640060448201526064016103e0565b80610af6612243565b65ffffffffffff161115610b5c5760405162461bcd60e51b815260206004820152602760248201527f5a6b426f62506f6f6c3a207472616e7366657220696e646578206f7574206f6660448201526620626f756e647360c81b60648201526084016103e0565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166368444dc7610b93612258565b610b9b61232e565b6040518363ffffffff1660e01b8152600401610bb89291906139fc565b602060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf991906139da565b610c455760405162461bcd60e51b815260206004820152601d60248201527f5a6b426f62506f6f6c3a20626164207472616e736665722070726f6f6600000060448201526064016103e0565b6000818152600860205260409020546001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906345bb94c190610c8e90612372565b610c9661239c565b6040518363ffffffff1660e01b8152600401610cb3929190613a3c565b602060405180830381865afa158015610cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf491906139da565b610d405760405162461bcd60e51b815260206004820152601960248201527f5a6b426f62506f6f6c3a2062616420747265652070726f6f660000000000000060448201526064016103e0565b610d486123ca565b610d506123db565b60408051602081019390935282015260600160408051601f19818403018152918152815160209283012060008581526007909352912055610d92608082613a7c565b9050610d9c61243a565b600082815260086020526040812091909155610db6612487565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525084516020808701919091206009546040519798509096929550610e1794509250859101918252602082015260400190565b6040516020818303038152906040528051906020012090508060098190555080847f7d39f8a6bc8929456fba511441be7361aa014ac6f8e21b99990ce9e1c737353685604051610e679190613aec565b60405180910390a3505050506000610e7d61253a565b90506000610e8b8286613aff565b90506000610e97612577565b600d0b905086600003610f1857600086138015610eb2575080155b610ece5760405162461bcd60e51b81526004016103e090613b40565b610f138830610ee1633b9aca00866139bb565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692919061258e565b61132e565b86600103610f865781158015610f2c575080155b610f135760405162461bcd60e51b815260206004820152602560248201527f5a6b426f62506f6f6c3a20696e636f7272656374207472616e7366657220616d6044820152646f756e747360d81b60648201526084016103e0565b866002036111b65760008213158015610fa0575060008113155b610ffa5760405162461bcd60e51b815260206004820152602560248201527f5a6b426f62506f6f6c3a20696e636f727265637420776974686472617720616d6044820152646f756e747360d81b60648201526084016103e0565b6000633b9aca006110096125ff565b61101391906139bb565b90506000633b9aca0061102585613b84565b61102f91906139bb565b9050811561111257600b546001600160a01b031680156111105761107d6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016828561263d565b604051630802e33b60e41b81526001600160a01b038c81166004830152602482018590526000919083169063802e33b09060440160408051808303816000875af11580156110cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f39190613ba0565b91508190506111028585613bc4565b61110c9190613a7c565b9250505b505b801561114c5761114c6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168b8361263d565b60008312156111af5760405162461bcd60e51b815260206004820152602960248201527f5a6b426f62506f6f6c3a20585020636c61696d696e67206973206e6f742079656044820152681d08195b98589b195960ba1b60648201526084016103e0565b505061132e565b866003036112d8576000861380156111cc575080155b6111e85760405162461bcd60e51b81526004016103e090613b40565b60008060006111f5612672565b919450925090506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663fa3e36e78c61123a633b9aca00896139bb565b6112426126a9565b60405160e085901b6001600160e01b03191681526001600160a01b039093166004840152602483019190915267ffffffffffffffff166044820152606481018a905260ff8616608482015260a4810185905260c4810184905260e401600060405180830381600087803b1580156112b857600080fd5b505af11580156112cc573d6000803e3d6000fd5b5050505050505061132e565b60405162461bcd60e51b815260206004820152602560248201527f5a6b426f62506f6f6c3a20496e636f7272656374207472616e73616374696f6e604482015264207479706560d81b60648201526084016103e0565b821561135957336000908152600a602052604081208054859290611353908490613a7c565b90915550505b5050505050505050565b61136b611c18565b6001600160a01b0381166113cc5760405162461bcd60e51b815260206004820152602260248201527f5a6b426f62506f6f6c3a206d616e61676572206973207a65726f206164647265604482015261737360f01b60648201526084016103e0565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f267052ecaebdd552dc1b20904f59d83d51ae7add7514165322a7da9ef6cf543b90602001610923565b6001600160a01b0382163314806114a05750600654604051632bb6fe4d60e21b81526001600160a01b0384811660048301523360248301529091169063aedbf93490604401602060405180830381865afa15801561147c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a091906139da565b6114ec5760405162461bcd60e51b815260206004820152601960248201527f5a6b426f62506f6f6c3a206e6f7420617574686f72697a65640000000000000060448201526064016103e0565b6001600160a01b0382166000908152600a602052604081205461151490633b9aca00906139bb565b9050600081116115665760405162461bcd60e51b815260206004820152601d60248201527f5a6b426f62506f6f6c3a206e6f2066656520746f20776974686472617700000060448201526064016103e0565b61159a6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016838361263d565b6001600160a01b0383166000818152600a602052604080822091909155517f66bf9186b00db666fc37aaffbb95a050c66e599e000c785c1dff0467d868f1b1906115e79084815260200190565b60405180910390a2505050565b6115fc611c18565b6108cf6002805470ffffffffffffffff00000000000000000019169055565b611623611c18565b61162d82826126cc565b5050565b611639611c18565b6001600160a01b03811661169e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103e0565b6116a781611c6c565b50565b6001600160a01b03163b151590565b60ff8660ff16106117185760405162461bcd60e51b815260206004820152602360248201527f5a6b426f624163636f756e74696e673a20696e76616c6964206c696d6974207460448201526234b2b960e91b60648201526084016103e0565b600081116117725760405162461bcd60e51b815260206004820152602160248201527f5a6b426f624163636f756e74696e673a207a65726f206465706f7369742063616044820152600760fc1b60648201526084016103e0565b611787633b9aca0066ffffffffffffff6139bb565b8511156117e15760405162461bcd60e51b815260206004820152602260248201527f5a6b426f624163636f756e74696e673a2074766c2063617020746f6f206c6172604482015261676560f01b60648201526084016103e0565b6117f3633b9aca0063ffffffff6139bb565b8411156118575760405162461bcd60e51b815260206004820152602c60248201527f5a6b426f624163636f756e74696e673a206461696c79206465706f736974206360448201526b617020746f6f206c6172676560a01b60648201526084016103e0565b611869633b9aca0063ffffffff6139bb565b8311156118d05760405162461bcd60e51b815260206004820152602f60248201527f5a6b426f624163636f756e74696e673a206461696c792077697468647261776160448201526e6c2063617020746f6f206c6172676560881b60648201526084016103e0565b808210156119385760405162461bcd60e51b815260206004820152602f60248201527f5a6b426f624163636f756e74696e673a206461696c792075736572206465706f60448201526e7369742063617020746f6f206c6f7760881b60648201526084016103e0565b8184101561199b5760405162461bcd60e51b815260206004820152602a60248201527f5a6b426f624163636f756e74696e673a206461696c79206465706f7369742063604482015269617020746f6f206c6f7760b01b60648201526084016103e0565b838510156119eb5760405162461bcd60e51b815260206004820181905260248201527f5a6b426f624163636f756e74696e673a2074766c2063617020746f6f206c6f7760448201526064016103e0565b60008311611a4e5760405162461bcd60e51b815260206004820152602a60248201527f5a6b426f624163636f756e74696e673a207a65726f206461696c792077697468604482015269064726177616c206361760b41b60648201526084016103e0565b60006040518060a00160405280633b9aca0088611a6b9190613985565b66ffffffffffffff168152602001611a87633b9aca0088613985565b63ffffffff168152602001611aa0633b9aca0087613985565b63ffffffff168152602001611ab9633b9aca0086613985565b63ffffffff168152602001611ad2633b9aca0085613985565b63ffffffff90811690915260ff8916600081815260036020908152604091829020855181549287015184880151606089015160808a01518916600160981b0263ffffffff60981b19918a16600160781b0263ffffffff60781b19938b16600160581b029390931667ffffffffffffffff60581b1994909a16600160381b026001600160581b031990971666ffffffffffffff909516949094179590951791909116969096179590951791909116939093179092559051919250907f780d4bec13f18df7b4768ba3fa12ace2a0a4765ca5f44d61dc060da612f5236d90611c07908490600060a08201905066ffffffffffffff8351168252602083015163ffffffff8082166020850152806040860151166040850152806060860151166060850152806080860151166080850152505092915050565b60405180910390a250505050505050565b611c20612809565b6108cf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001611ccc600260086139bb565b6001901b611cda9190613bc4565b611d566020600261010082816008600e600684611cf8816004613a7c565b611d029190613a7c565b611d0c9190613a7c565b611d169190613a7c565b611d209190613a7c565b611d2a9190613a7c565b611d349190613a7c565b611d3e9190613a7c565b611d489190613a7c565b611d529190613bc4565b3590565b16905090565b6000806000611d6961284d565b91509150611dd6611dcf611d7c60043590565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b838361286a565b9250505090565b6000611e2a60206014600880600280610100868185600e600684611e02816004613a7c565b611e0c9190613a7c565b611e169190613a7c565b611e209190613a7c565b611cf89190613a7c565b905090565b6000611e2a60206008600e600683611d20816004613a7c565b6040805160c08101825260015466ffffffffffffff8116825263ffffffff600160381b8204811660208085019190915262ffffff600160581b8404811685870152600160701b8404166060808601919091526001600160581b03600160881b8504166080860152600160e01b909304821660a0850152845192830185526002546001600160481b0381168452600160481b8104831691840191909152600160681b900416928101929092526000918291829182611f07610e1042613985565b60a084015163ffffffff16945090508315801590611f455750611f2f610e1062093a80613985565b6040840151611f3e9083613bdb565b62ffffff16115b1561205b576040838101805162ffffff9081166000908152600460208181528583208651606081018852905480861682526301000000810463ffffffff16828401908152600160381b9091046001600160581b03168289015286518616855292909152948220805471ffffffffffffffffffffffffffffffffffff1916905584519092169092525160a0860151611fdc9190613bff565b9050846020015163ffffffff168163ffffffff1611156120035763ffffffff811660208601525b60008163ffffffff16836040015187608001516120209190613c1c565b61202a9190613c3c565b9050856000015166ffffffffffffff168166ffffffffffffff1611156120575766ffffffffffffff811686525b5050505b8062ffffff16836060015162ffffff16101561210f57604080516060808201835262ffffff808516835260a087015163ffffffff908116602080860191825260808a01516001600160581b03908116878901908152958b01518516600090815260049092529690209451855491519451909616600160381b0271ffffffffffffffffffffff00000000000000199490921663010000000266ffffffffffffff19909116959092169490941717169190911790555b815161212090633b9aca0090613c56565b6001600160481b03168360800181815161213a9190613c70565b6001600160581b031690525060a0830180519061215682613c9b565b63ffffffff1690525061216b83838a8a612890565b62ffffff9081166060840181905283516001805460208701516040880151608089015160a09099015163ffffffff908116600160e01b026001600160e01b036001600160581b03909b16600160881b029a909a1670ffffffffffffffffffffffffffffffffff600160701b90980262ffffff60701b1993909916600160581b029290921665ffffffffffff60581b19918416600160381b026001600160581b031990951666ffffffffffffff881617949094171692909217959095179390931692909217949094179055919450909250509250925092565b6000611e2a6020600681611d34816004613a7c565b61226061367a565b612268612f61565b8152600435602082015261227a6123ca565b6040820152600861228d600e6006613a7c565b6122979190613a7c565b6122a29060086139bb565b7f0000000000000000000000000000000000000000000000000000000000000000901b6122cd6123db565b6122d79190613a7c565b60608201527f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001612305612f8b565b604051612313929190613cd4565b6040519081900390206123269190613ce4565b608082015290565b3660006008600e60066020612344816004613a7c565b61234e9190613a7c565b6123589190613a7c565b6123629190613a7c565b61236c9190613a7c565b92915050565b61237a613698565b81815261238561243a565b60208201526123926123ca565b6040820152919050565b36600060206101006008600e6006846123b6816004613a7c565b6123c09190613a7c565b6123449190613a7c565b6000611e2a611d5260206004613a7c565b6000600160086123ed600e6006613a7c565b6123f79190613a7c565b6124029060086139bb565b6001901b6124109190613bc4565b611d5660206008612423600e6006613a7c565b61242d9190613a7c565b6020611d34816004613a7c565b6000611e2a6101006008600e60066020612455816004613a7c565b61245f9190613a7c565b6124699190613a7c565b6124739190613a7c565b61247d9190613a7c565b611d529190613a7c565b3660008061249361301b565b90506000816002806101006020816008600e6006846124b3816004613a7c565b6124bd9190613a7c565b6124c79190613a7c565b6124d19190613a7c565b6124db9190613a7c565b6124e59190613a7c565b6124ef9190613a7c565b6124f99190613a7c565b6125039190613a7c565b61250d9190613a7c565b6125179190613a7c565b9050600082612524613062565b61252e9190613bc4565b91959194509092505050565b600060016125496008806139bb565b6001901b6125579190613bc4565b611d5660206008600280610100848185600e600684611e16816004613a7c565b6000611e2a6020600e600682611d2a816004613a7c565b6040516001600160a01b03808516602483015283166044820152606481018290526125f99085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261309f565b50505050565b6000600161260e6008806139bb565b6001901b61261c9190613bc4565b611d566020600880600280610100858185600e600684611e0c816004613a7c565b6040516001600160a01b03831660248201526044810182905261266d90849063a9059cbb60e01b906064016125c2565b505050565b600080600080600061268261284d565b909250905061269660ff82901c601b613a7c565b959194506001600160ff1b031692509050565b6000611e2a6020600880600280610100858185600e600684611e0c816004613a7c565b8160ff1660ff14806126f8575060ff821660009081526003602052604090205466ffffffffffffff1615155b61275b5760405162461bcd60e51b815260206004820152602e60248201527f5a6b426f624163636f756e74696e673a206e6f6e2d6578697374696e6720706f60448201526d37b6103634b6b4ba39903a34b2b960911b60648201526084016103e0565b60005b815181101561266d57600082828151811061277b5761277b613cbe565b6020908102919091018101516001600160a01b038116600081815260058452604090819020805460ff60581b1916600160581b60ff8b16908102919091179091558151928352938201939093529092507f1283ebeb150dffd4da976f64c81e074fd4dc895cb64995dc46f13c9fd96a9551910160405180910390a1508061280181613cf8565b91505061275e565b6000612813613171565b80611e2a57507fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035433905b6001600160a01b031614905090565b600080600061285a613185565b8035946020909101359350915050565b600080600061287a86868661320e565b9150915061288781613247565b50949350505050565b60006128a1610e1062015180613985565b6128ad610e1042613985565b6128b79190613985565b905060006128ca610e1062015180613985565b866060015162ffffff166128de9190613985565b8261ffff161190508260000361293557801561292e57600060408601819052602086015284516002805470ffffffffffffffffffffffffffffffffff19166001600160481b039092169190911790555b50506125f9565b6001600160a01b0384166000908152600560209081526040808320815160608082018452915461ffff811682526001600160481b03620100008204168286015260ff600160581b9182900416828501819052865260038552838620845160a081018652905466ffffffffffffff8116825263ffffffff600160381b8204811697830197909752918204861694810194909452600160781b8104851692840192909252600160981b90910490921660808201529091851315612d91578651859081908990612a03908390613d11565b6001600160481b03169052506080820151612a2990633b9aca009063ffffffff166139bb565b811115612a8d5760405162461bcd60e51b815260206004820152602c60248201527f5a6b426f624163636f756e74696e673a2073696e676c65206465706f7369742060448201526b18d85c08195e18d95959195960a21b60648201526084016103e0565b8151612aa790633b9aca009066ffffffffffffff166139bb565b88516001600160481b03161115612b0a5760405162461bcd60e51b815260206004820152602160248201527f5a6b426f624163636f756e74696e673a2074766c2063617020657863656564656044820152601960fa1b60648201526084016103e0565b826000015161ffff168561ffff161115612bad576040805160608101825261ffff87811682526001600160481b0384811660208085019182528886015160ff9081168688019081526001600160a01b038f166000908152600590935296909120945185549251965194166001600160581b0319909216919091176201000095909216949094021760ff60581b1916600160581b9190931602919091179055612cc3565b8083602001818151612bbf9190613d11565b6001600160481b03169052506060820151612be590633b9aca009063ffffffff166139bb565b83602001516001600160481b03161115612c5a5760405162461bcd60e51b815260206004820152603060248201527f5a6b426f624163636f756e74696e673a206461696c792075736572206465706f60448201526f1cda5d0818d85c08195e18d95959195960821b60648201526084016103e0565b6001600160a01b03871660009081526005602090815260409182902085518154928701519387015160ff16600160581b0260ff60581b196001600160481b0390951662010000026001600160581b031990941661ffff9092169190911792909217929092161790555b8315612cee57612cd7633b9aca0082613985565b63ffffffff16602089015260006040890152612d8b565b612cfc633b9aca0082613985565b88602001818151612d0d9190613d33565b63ffffffff908116909152602080850151908b0151908216911611159050612d8b5760405162461bcd60e51b815260206004820152602b60248201527f5a6b426f624163636f756e74696e673a206461696c79206465706f736974206360448201526a185c08195e18d95959195960aa1b60648201526084016103e0565b50612eff565b6000612d9c86613b84565b9050612db0633b9aca0063ffffffff6139bb565b811115612e145760405162461bcd60e51b815260206004820152602c60248201527f5a6b426f624163636f756e74696e673a207769746864726177616c20616d6f7560448201526b6e7420746f6f206c6172676560a01b60648201526084016103e0565b8088600001818151612e269190613d52565b6001600160481b03169052508315612e5d5760006020890152612e4d633b9aca0082613985565b63ffffffff166040890152612efd565b612e6b633b9aca0082613985565b88604001818151612e7c9190613d33565b63ffffffff908116909152604080850151908b0151908216911611159050612efd5760405162461bcd60e51b815260206004820152602e60248201527f5a6b426f624163636f756e74696e673a206461696c792077697468647261776160448201526d1b0818d85c08195e18d95959195960921b60648201526084016103e0565b505b505084516002805460208801516040909801516001600160481b039093166cffffffffffffffffffffffffff1990911617600160481b63ffffffff988916021763ffffffff60681b1916600160681b9790921696909602179094555050505050565b600060086000612f6f612243565b65ffffffffffff16815260200190815260200160002054905090565b366000806002806101006020816008600e600684612faa816004613a7c565b612fb49190613a7c565b612fbe9190613a7c565b612fc89190613a7c565b612fd29190613a7c565b612fdc9190613a7c565b612fe69190613a7c565b612ff09190613a7c565b612ffa9190613a7c565b6130049190613a7c565b90506000613010613062565b919491935090915050565b600080613026611cbc565b90508015806130355750806001145b1561304257600891505090565b8060020361305257602491505090565b8060030361015857602491505090565b60006001613072600260086139bb565b6001901b6130809190613bc4565b611d56602060028061010083816008600e600684611e20816004613a7c565b60006130f4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133fd9092919063ffffffff16565b80519091501561266d578080602001905181019061311291906139da565b61266d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103e0565b6000805433906001600160a01b031661283e565b600061318f613062565b6002806101006020816008600e6006846131aa816004613a7c565b6131b49190613a7c565b6131be9190613a7c565b6131c89190613a7c565b6131d29190613a7c565b6131dc9190613a7c565b6131e69190613a7c565b6131f09190613a7c565b6131fa9190613a7c565b6132049190613a7c565b611e2a9190613a7c565b6000806001600160ff1b0383168161322b60ff86901c601b613a7c565b905061323987828885613414565b935093505050935093915050565b600081600481111561325b5761325b613d72565b036132635750565b600181600481111561327757613277613d72565b036132c45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103e0565b60028160048111156132d8576132d8613d72565b036133255760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103e0565b600381600481111561333957613339613d72565b036133915760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016103e0565b60048160048111156133a5576133a5613d72565b036116a75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016103e0565b606061340c8484600085613501565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561344b57506000905060036134f8565b8460ff16601b1415801561346357508460ff16601c14155b1561347457506000905060046134f8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156134c8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166134f1576000600192509250506134f8565b9150600090505b94509492505050565b6060824710156135625760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103e0565b600080866001600160a01b0316858760405161357e9190613d88565b60006040518083038185875af1925050503d80600081146135bb576040519150601f19603f3d011682016040523d82523d6000602084013e6135c0565b606091505b50915091506135d1878383876135dc565b979650505050505050565b6060831561364b578251600003613644576001600160a01b0385163b6136445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103e0565b508161340c565b61340c83838151156136605781518083602001fd5b8060405162461bcd60e51b81526004016103e09190613aec565b6040518060a001604052806005906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008060008060008060c087890312156136cf57600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6001600160a01b03811681146116a757600080fd5b8035613719816136f9565b919050565b60006020828403121561373057600080fd5b813561373b816136f9565b9392505050565b600061014082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e0830152610100808401518184015250610120808401516137b68285018260ff169052565b505092915050565b803560ff8116811461371957600080fd5b60008060008060008060c087890312156137e857600080fd5b6137f1876137be565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60006020828403121561382b57600080fd5b5035919050565b6000806040838503121561384557600080fd5b8235613850816136f9565b91506020830135613860816136f9565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561389457600080fd5b61389d836137be565b915060208084013567ffffffffffffffff808211156138bb57600080fd5b818601915086601f8301126138cf57600080fd5b8135818111156138e1576138e161386b565b8060051b604051601f19603f830116810181811085821117156139065761390661386b565b60405291825284820192508381018501918983111561392457600080fd5b938501935b828510156139495761393a8561370e565b84529385019392850192613929565b8096505050505050509250929050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261399457613994613959565b500490565b600062ffffff808416806139af576139af613959565b92169190910492915050565b60008160001904831182151516156139d5576139d561396f565b500290565b6000602082840312156139ec57600080fd5b8151801515811461373b57600080fd5b6101a08101818460005b6005811015613a25578151835260209283019290910190600101613a06565b5050506101008360a0840137600081529392505050565b6101608101818460005b6003811015613a65578151835260209283019290910190600101613a46565b505050610100836060840137600081529392505050565b60008219821115613a8f57613a8f61396f565b500190565b60005b83811015613aaf578181015183820152602001613a97565b838111156125f95750506000910152565b60008151808452613ad8816020860160208601613a94565b601f01601f19169290920160200192915050565b60208152600061373b6020830184613ac0565b600080821280156001600160ff1b0384900385131615613b2157613b2161396f565b600160ff1b8390038412811615613b3a57613b3a61396f565b50500190565b60208082526024908201527f5a6b426f62506f6f6c3a20696e636f7272656374206465706f73697420616d6f604082015263756e747360e01b606082015260800190565b6000600160ff1b8201613b9957613b9961396f565b5060000390565b60008060408385031215613bb357600080fd5b505080516020909101519092909150565b600082821015613bd657613bd661396f565b500390565b600062ffffff83811690831681811015613bf757613bf761396f565b039392505050565b600063ffffffff83811690831681811015613bf757613bf761396f565b60006001600160581b0383811690831681811015613bf757613bf761396f565b60006001600160581b03808416806139af576139af613959565b60006001600160481b03808416806139af576139af613959565b60006001600160581b03808316818516808303821115613c9257613c9261396f565b01949350505050565b600063ffffffff808316818103613cb457613cb461396f565b6001019392505050565b634e487b7160e01b600052603260045260246000fd5b8183823760009101908152919050565b600082613cf357613cf3613959565b500690565b600060018201613d0a57613d0a61396f565b5060010190565b60006001600160481b03808316818516808303821115613c9257613c9261396f565b600063ffffffff808316818516808303821115613c9257613c9261396f565b60006001600160481b0383811690831681811015613bf757613bf761396f565b634e487b7160e01b600052602160045260246000fd5b60008251613d9a818460208701613a94565b919091019291505056fea2646970667358221220f0370c77d27cbb1029f1b2332db0bfd83269373c9404ebb73446a4bdda7664e064736f6c634300080f00335a6b426f62506f6f6c3a206e6f74206120636f6e7472616374000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b00000000000000000000000051585f5af7b5f0bbf7f91fe8919fbff362a2fd9500000000000000000000000082907eaeb25d248dc82033e45b00a3e012ba2d0d

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638fff4676116100c3578063c879c6d81161007c578063c879c6d81461030d578063d21e82ab14610320578063d847f40614610340578063e0ec037414610348578063f2fde38b1461035b578063fc0c546a1461036e57600080fd5b80638fff46761461029957806396ce0795146102a15780639d8ad6e4146102ab578063af989083146102d2578063c2b40ae4146102da578063c41100fa146102fa57600080fd5b80634279a99e116101155780634279a99e1461021a578063508400401461023a57806354b591531461025a578063715018a61461026d5780637a22393b146102755780638da5cb5b1461028857600080fd5b80630c6248de1461015d578063171ef3001461018d5780631dd69d06146101b45780632d7aa82b146101cb5780632f84c96f146101e05780633701f979146101f3575b600080fd5b600b54610170906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101707f00000000000000000000000051585f5af7b5f0bbf7f91fe8919fbff362a2fd9581565b6101bd60095481565b604051908152602001610184565b6101de6101d93660046136b6565b610395565b005b600654610170906001600160a01b031681565b6101707f00000000000000000000000082907eaeb25d248dc82033e45b00a3e012ba2d0d81565b61022d61022836600461371e565b61052d565b6040516101849190613742565b6101bd61024836600461371e565b600a6020526000908152604090205481565b6101de6102683660046137cf565b6108a3565b6101de6108bd565b6101de61028336600461371e565b6108d1565b6000546001600160a01b0316610170565b6101bd61092e565b633b9aca006101bd565b6101bd7f000000000000000000000000000000000000000000000000000000000000000081565b6101de610950565b6101bd6102e8366004613819565b60086020526000908152604090205481565b6101de61030836600461371e565b611363565b6101de61031b366004613832565b61141a565b6101bd61032e366004613819565b60076020526000908152604090205481565b6101de6115f4565b6101de610356366004613881565b61161b565b6101de61036936600461371e565b611631565b6101707f000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b81565b3330146103e95760405162461bcd60e51b815260206004820152601a60248201527f5a6b426f62506f6f6c3a206e6f7420696e697469616c697a657200000000000060448201526064015b60405180910390fd5b6000805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c754156104615760405162461bcd60e51b815260206004820152601e60248201527f5a6b426f62506f6f6c3a20616c726561647920696e697469616c697a6564000060448201526064016103e0565b856000036104a85760405162461bcd60e51b8152602060048201526014602482015273169ad09bd8941bdbdb0e881e995c9bc81c9bdbdd60621b60448201526064016103e0565b600080805260086020527f5eff886ea0ce6ca488a3d6e336d6c0f75f46d19b42c06ce5ee98e42c96d256c7879055610525906104e8633b9aca0088613985565b6104f6633b9aca0088613985565b610504633b9aca0088613985565b610512633b9aca0088613985565b610520633b9aca0088613985565b6116b9565b505050505050565b610586604051806101400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600060ff1681525090565b6040805160c08101825260015466ffffffffffffff8082168352600160381b80830463ffffffff908116602080870191909152600160581b80860462ffffff908116888a0152600160701b870416606080890191909152600160881b87046001600160581b03166080808a0191909152600160e01b909704841660a0808a019190915289518083018b526002546001600160481b038082168352600160481b8204881683880152600160681b9091048716828d01526001600160a01b038e166000908152600587528c81208d518087018f52905461ffff81168252620100008104909316818901529186900460ff16828e018190528152600387528c81208d519485018e5254998a168452978904871695830195909552928704851699810199909952600160781b8604841690890152600160981b90940490911693860193909352929390926106d8610e1042613985565b905060006106eb610e1062015180613985565b6106f59083613999565b9050604051806101400160405280633b9aca00856000015166ffffffffffffff1661072091906139bb565b815260200186600001516001600160481b03168152602001633b9aca00856020015163ffffffff1661075291906139bb565b815260200162ffffff831661076c610e1062015180613985565b896060015162ffffff166107809190613985565b1461078c5760006107a6565b633b9aca00876020015163ffffffff166107a691906139bb565b8152602001633b9aca00856040015163ffffffff166107c591906139bb565b815260200162ffffff83166107df610e1062015180613985565b896060015162ffffff166107f39190613985565b146107ff576000610819565b633b9aca00876040015163ffffffff1661081991906139bb565b8152602001633b9aca00856060015163ffffffff1661083891906139bb565b81526020018262ffffff16866000015161ffff161461085857600061085e565b85602001515b6001600160481b03168152602001633b9aca00856080015163ffffffff1661088691906139bb565b8152602001856040015160ff168152509650505050505050919050565b6108ab611c18565b610525866104e8633b9aca0088613985565b6108c5611c18565b6108cf6000611c6c565b565b6108d9611c18565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527fdf71641930ea322cb32f687f4d292a0af694c81216254f204c930092593d8282906020015b60405180910390a150565b6000600761094960015463ffffffff600160e01b9091041690565b901b905090565b6006546001600160a01b0316636d70f7ae336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa1580156109a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ca91906139da565b610a165760405162461bcd60e51b815260206004820152601a60248201527f5a6b426f62506f6f6c3a206e6f7420616e206f70657261746f7200000000000060448201526064016103e0565b600080610a21611cbc565b905080600003610a3a57610a33611d5c565b9150610a5d565b80600203610a4a57610a33611ddd565b80600303610a5d57610a5a611ddd565b91505b6000610a67611e2f565b60070b90506000610a788483611e48565b925050506000610a8760043590565b60008181526007602081905260409091205491925083901b9015610aed5760405162461bcd60e51b815260206004820152601f60248201527f5a6b426f62506f6f6c3a20646f75626c657370656e642064657465637465640060448201526064016103e0565b80610af6612243565b65ffffffffffff161115610b5c5760405162461bcd60e51b815260206004820152602760248201527f5a6b426f62506f6f6c3a207472616e7366657220696e646578206f7574206f6660448201526620626f756e647360c81b60648201526084016103e0565b7f00000000000000000000000051585f5af7b5f0bbf7f91fe8919fbff362a2fd956001600160a01b03166368444dc7610b93612258565b610b9b61232e565b6040518363ffffffff1660e01b8152600401610bb89291906139fc565b602060405180830381865afa158015610bd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bf991906139da565b610c455760405162461bcd60e51b815260206004820152601d60248201527f5a6b426f62506f6f6c3a20626164207472616e736665722070726f6f6600000060448201526064016103e0565b6000818152600860205260409020546001600160a01b037f00000000000000000000000082907eaeb25d248dc82033e45b00a3e012ba2d0d16906345bb94c190610c8e90612372565b610c9661239c565b6040518363ffffffff1660e01b8152600401610cb3929190613a3c565b602060405180830381865afa158015610cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cf491906139da565b610d405760405162461bcd60e51b815260206004820152601960248201527f5a6b426f62506f6f6c3a2062616420747265652070726f6f660000000000000060448201526064016103e0565b610d486123ca565b610d506123db565b60408051602081019390935282015260600160408051601f19818403018152918152815160209283012060008581526007909352912055610d92608082613a7c565b9050610d9c61243a565b600082815260086020526040812091909155610db6612487565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525084516020808701919091206009546040519798509096929550610e1794509250859101918252602082015260400190565b6040516020818303038152906040528051906020012090508060098190555080847f7d39f8a6bc8929456fba511441be7361aa014ac6f8e21b99990ce9e1c737353685604051610e679190613aec565b60405180910390a3505050506000610e7d61253a565b90506000610e8b8286613aff565b90506000610e97612577565b600d0b905086600003610f1857600086138015610eb2575080155b610ece5760405162461bcd60e51b81526004016103e090613b40565b610f138830610ee1633b9aca00866139bb565b6001600160a01b037f000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b1692919061258e565b61132e565b86600103610f865781158015610f2c575080155b610f135760405162461bcd60e51b815260206004820152602560248201527f5a6b426f62506f6f6c3a20696e636f7272656374207472616e7366657220616d6044820152646f756e747360d81b60648201526084016103e0565b866002036111b65760008213158015610fa0575060008113155b610ffa5760405162461bcd60e51b815260206004820152602560248201527f5a6b426f62506f6f6c3a20696e636f727265637420776974686472617720616d6044820152646f756e747360d81b60648201526084016103e0565b6000633b9aca006110096125ff565b61101391906139bb565b90506000633b9aca0061102585613b84565b61102f91906139bb565b9050811561111257600b546001600160a01b031680156111105761107d6001600160a01b037f000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b16828561263d565b604051630802e33b60e41b81526001600160a01b038c81166004830152602482018590526000919083169063802e33b09060440160408051808303816000875af11580156110cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f39190613ba0565b91508190506111028585613bc4565b61110c9190613a7c565b9250505b505b801561114c5761114c6001600160a01b037f000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b168b8361263d565b60008312156111af5760405162461bcd60e51b815260206004820152602960248201527f5a6b426f62506f6f6c3a20585020636c61696d696e67206973206e6f742079656044820152681d08195b98589b195960ba1b60648201526084016103e0565b505061132e565b866003036112d8576000861380156111cc575080155b6111e85760405162461bcd60e51b81526004016103e090613b40565b60008060006111f5612672565b919450925090506001600160a01b037f000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b1663fa3e36e78c61123a633b9aca00896139bb565b6112426126a9565b60405160e085901b6001600160e01b03191681526001600160a01b039093166004840152602483019190915267ffffffffffffffff166044820152606481018a905260ff8616608482015260a4810185905260c4810184905260e401600060405180830381600087803b1580156112b857600080fd5b505af11580156112cc573d6000803e3d6000fd5b5050505050505061132e565b60405162461bcd60e51b815260206004820152602560248201527f5a6b426f62506f6f6c3a20496e636f7272656374207472616e73616374696f6e604482015264207479706560d81b60648201526084016103e0565b821561135957336000908152600a602052604081208054859290611353908490613a7c565b90915550505b5050505050505050565b61136b611c18565b6001600160a01b0381166113cc5760405162461bcd60e51b815260206004820152602260248201527f5a6b426f62506f6f6c3a206d616e61676572206973207a65726f206164647265604482015261737360f01b60648201526084016103e0565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527f267052ecaebdd552dc1b20904f59d83d51ae7add7514165322a7da9ef6cf543b90602001610923565b6001600160a01b0382163314806114a05750600654604051632bb6fe4d60e21b81526001600160a01b0384811660048301523360248301529091169063aedbf93490604401602060405180830381865afa15801561147c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114a091906139da565b6114ec5760405162461bcd60e51b815260206004820152601960248201527f5a6b426f62506f6f6c3a206e6f7420617574686f72697a65640000000000000060448201526064016103e0565b6001600160a01b0382166000908152600a602052604081205461151490633b9aca00906139bb565b9050600081116115665760405162461bcd60e51b815260206004820152601d60248201527f5a6b426f62506f6f6c3a206e6f2066656520746f20776974686472617700000060448201526064016103e0565b61159a6001600160a01b037f000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b16838361263d565b6001600160a01b0383166000818152600a602052604080822091909155517f66bf9186b00db666fc37aaffbb95a050c66e599e000c785c1dff0467d868f1b1906115e79084815260200190565b60405180910390a2505050565b6115fc611c18565b6108cf6002805470ffffffffffffffff00000000000000000019169055565b611623611c18565b61162d82826126cc565b5050565b611639611c18565b6001600160a01b03811661169e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103e0565b6116a781611c6c565b50565b6001600160a01b03163b151590565b60ff8660ff16106117185760405162461bcd60e51b815260206004820152602360248201527f5a6b426f624163636f756e74696e673a20696e76616c6964206c696d6974207460448201526234b2b960e91b60648201526084016103e0565b600081116117725760405162461bcd60e51b815260206004820152602160248201527f5a6b426f624163636f756e74696e673a207a65726f206465706f7369742063616044820152600760fc1b60648201526084016103e0565b611787633b9aca0066ffffffffffffff6139bb565b8511156117e15760405162461bcd60e51b815260206004820152602260248201527f5a6b426f624163636f756e74696e673a2074766c2063617020746f6f206c6172604482015261676560f01b60648201526084016103e0565b6117f3633b9aca0063ffffffff6139bb565b8411156118575760405162461bcd60e51b815260206004820152602c60248201527f5a6b426f624163636f756e74696e673a206461696c79206465706f736974206360448201526b617020746f6f206c6172676560a01b60648201526084016103e0565b611869633b9aca0063ffffffff6139bb565b8311156118d05760405162461bcd60e51b815260206004820152602f60248201527f5a6b426f624163636f756e74696e673a206461696c792077697468647261776160448201526e6c2063617020746f6f206c6172676560881b60648201526084016103e0565b808210156119385760405162461bcd60e51b815260206004820152602f60248201527f5a6b426f624163636f756e74696e673a206461696c792075736572206465706f60448201526e7369742063617020746f6f206c6f7760881b60648201526084016103e0565b8184101561199b5760405162461bcd60e51b815260206004820152602a60248201527f5a6b426f624163636f756e74696e673a206461696c79206465706f7369742063604482015269617020746f6f206c6f7760b01b60648201526084016103e0565b838510156119eb5760405162461bcd60e51b815260206004820181905260248201527f5a6b426f624163636f756e74696e673a2074766c2063617020746f6f206c6f7760448201526064016103e0565b60008311611a4e5760405162461bcd60e51b815260206004820152602a60248201527f5a6b426f624163636f756e74696e673a207a65726f206461696c792077697468604482015269064726177616c206361760b41b60648201526084016103e0565b60006040518060a00160405280633b9aca0088611a6b9190613985565b66ffffffffffffff168152602001611a87633b9aca0088613985565b63ffffffff168152602001611aa0633b9aca0087613985565b63ffffffff168152602001611ab9633b9aca0086613985565b63ffffffff168152602001611ad2633b9aca0085613985565b63ffffffff90811690915260ff8916600081815260036020908152604091829020855181549287015184880151606089015160808a01518916600160981b0263ffffffff60981b19918a16600160781b0263ffffffff60781b19938b16600160581b029390931667ffffffffffffffff60581b1994909a16600160381b026001600160581b031990971666ffffffffffffff909516949094179590951791909116969096179590951791909116939093179092559051919250907f780d4bec13f18df7b4768ba3fa12ace2a0a4765ca5f44d61dc060da612f5236d90611c07908490600060a08201905066ffffffffffffff8351168252602083015163ffffffff8082166020850152806040860151166040850152806060860151166060850152806080860151166080850152505092915050565b60405180910390a250505050505050565b611c20612809565b6108cf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006001611ccc600260086139bb565b6001901b611cda9190613bc4565b611d566020600261010082816008600e600684611cf8816004613a7c565b611d029190613a7c565b611d0c9190613a7c565b611d169190613a7c565b611d209190613a7c565b611d2a9190613a7c565b611d349190613a7c565b611d3e9190613a7c565b611d489190613a7c565b611d529190613bc4565b3590565b16905090565b6000806000611d6961284d565b91509150611dd6611dcf611d7c60043590565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b838361286a565b9250505090565b6000611e2a60206014600880600280610100868185600e600684611e02816004613a7c565b611e0c9190613a7c565b611e169190613a7c565b611e209190613a7c565b611cf89190613a7c565b905090565b6000611e2a60206008600e600683611d20816004613a7c565b6040805160c08101825260015466ffffffffffffff8116825263ffffffff600160381b8204811660208085019190915262ffffff600160581b8404811685870152600160701b8404166060808601919091526001600160581b03600160881b8504166080860152600160e01b909304821660a0850152845192830185526002546001600160481b0381168452600160481b8104831691840191909152600160681b900416928101929092526000918291829182611f07610e1042613985565b60a084015163ffffffff16945090508315801590611f455750611f2f610e1062093a80613985565b6040840151611f3e9083613bdb565b62ffffff16115b1561205b576040838101805162ffffff9081166000908152600460208181528583208651606081018852905480861682526301000000810463ffffffff16828401908152600160381b9091046001600160581b03168289015286518616855292909152948220805471ffffffffffffffffffffffffffffffffffff1916905584519092169092525160a0860151611fdc9190613bff565b9050846020015163ffffffff168163ffffffff1611156120035763ffffffff811660208601525b60008163ffffffff16836040015187608001516120209190613c1c565b61202a9190613c3c565b9050856000015166ffffffffffffff168166ffffffffffffff1611156120575766ffffffffffffff811686525b5050505b8062ffffff16836060015162ffffff16101561210f57604080516060808201835262ffffff808516835260a087015163ffffffff908116602080860191825260808a01516001600160581b03908116878901908152958b01518516600090815260049092529690209451855491519451909616600160381b0271ffffffffffffffffffffff00000000000000199490921663010000000266ffffffffffffff19909116959092169490941717169190911790555b815161212090633b9aca0090613c56565b6001600160481b03168360800181815161213a9190613c70565b6001600160581b031690525060a0830180519061215682613c9b565b63ffffffff1690525061216b83838a8a612890565b62ffffff9081166060840181905283516001805460208701516040880151608089015160a09099015163ffffffff908116600160e01b026001600160e01b036001600160581b03909b16600160881b029a909a1670ffffffffffffffffffffffffffffffffff600160701b90980262ffffff60701b1993909916600160581b029290921665ffffffffffff60581b19918416600160381b026001600160581b031990951666ffffffffffffff881617949094171692909217959095179390931692909217949094179055919450909250509250925092565b6000611e2a6020600681611d34816004613a7c565b61226061367a565b612268612f61565b8152600435602082015261227a6123ca565b6040820152600861228d600e6006613a7c565b6122979190613a7c565b6122a29060086139bb565b7f0000000000000000000000000000000000000000000000000000000000000000901b6122cd6123db565b6122d79190613a7c565b60608201527f30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001612305612f8b565b604051612313929190613cd4565b6040519081900390206123269190613ce4565b608082015290565b3660006008600e60066020612344816004613a7c565b61234e9190613a7c565b6123589190613a7c565b6123629190613a7c565b61236c9190613a7c565b92915050565b61237a613698565b81815261238561243a565b60208201526123926123ca565b6040820152919050565b36600060206101006008600e6006846123b6816004613a7c565b6123c09190613a7c565b6123449190613a7c565b6000611e2a611d5260206004613a7c565b6000600160086123ed600e6006613a7c565b6123f79190613a7c565b6124029060086139bb565b6001901b6124109190613bc4565b611d5660206008612423600e6006613a7c565b61242d9190613a7c565b6020611d34816004613a7c565b6000611e2a6101006008600e60066020612455816004613a7c565b61245f9190613a7c565b6124699190613a7c565b6124739190613a7c565b61247d9190613a7c565b611d529190613a7c565b3660008061249361301b565b90506000816002806101006020816008600e6006846124b3816004613a7c565b6124bd9190613a7c565b6124c79190613a7c565b6124d19190613a7c565b6124db9190613a7c565b6124e59190613a7c565b6124ef9190613a7c565b6124f99190613a7c565b6125039190613a7c565b61250d9190613a7c565b6125179190613a7c565b9050600082612524613062565b61252e9190613bc4565b91959194509092505050565b600060016125496008806139bb565b6001901b6125579190613bc4565b611d5660206008600280610100848185600e600684611e16816004613a7c565b6000611e2a6020600e600682611d2a816004613a7c565b6040516001600160a01b03808516602483015283166044820152606481018290526125f99085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261309f565b50505050565b6000600161260e6008806139bb565b6001901b61261c9190613bc4565b611d566020600880600280610100858185600e600684611e0c816004613a7c565b6040516001600160a01b03831660248201526044810182905261266d90849063a9059cbb60e01b906064016125c2565b505050565b600080600080600061268261284d565b909250905061269660ff82901c601b613a7c565b959194506001600160ff1b031692509050565b6000611e2a6020600880600280610100858185600e600684611e0c816004613a7c565b8160ff1660ff14806126f8575060ff821660009081526003602052604090205466ffffffffffffff1615155b61275b5760405162461bcd60e51b815260206004820152602e60248201527f5a6b426f624163636f756e74696e673a206e6f6e2d6578697374696e6720706f60448201526d37b6103634b6b4ba39903a34b2b960911b60648201526084016103e0565b60005b815181101561266d57600082828151811061277b5761277b613cbe565b6020908102919091018101516001600160a01b038116600081815260058452604090819020805460ff60581b1916600160581b60ff8b16908102919091179091558151928352938201939093529092507f1283ebeb150dffd4da976f64c81e074fd4dc895cb64995dc46f13c9fd96a9551910160405180910390a1508061280181613cf8565b91505061275e565b6000612813613171565b80611e2a57507fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035433905b6001600160a01b031614905090565b600080600061285a613185565b8035946020909101359350915050565b600080600061287a86868661320e565b9150915061288781613247565b50949350505050565b60006128a1610e1062015180613985565b6128ad610e1042613985565b6128b79190613985565b905060006128ca610e1062015180613985565b866060015162ffffff166128de9190613985565b8261ffff161190508260000361293557801561292e57600060408601819052602086015284516002805470ffffffffffffffffffffffffffffffffff19166001600160481b039092169190911790555b50506125f9565b6001600160a01b0384166000908152600560209081526040808320815160608082018452915461ffff811682526001600160481b03620100008204168286015260ff600160581b9182900416828501819052865260038552838620845160a081018652905466ffffffffffffff8116825263ffffffff600160381b8204811697830197909752918204861694810194909452600160781b8104851692840192909252600160981b90910490921660808201529091851315612d91578651859081908990612a03908390613d11565b6001600160481b03169052506080820151612a2990633b9aca009063ffffffff166139bb565b811115612a8d5760405162461bcd60e51b815260206004820152602c60248201527f5a6b426f624163636f756e74696e673a2073696e676c65206465706f7369742060448201526b18d85c08195e18d95959195960a21b60648201526084016103e0565b8151612aa790633b9aca009066ffffffffffffff166139bb565b88516001600160481b03161115612b0a5760405162461bcd60e51b815260206004820152602160248201527f5a6b426f624163636f756e74696e673a2074766c2063617020657863656564656044820152601960fa1b60648201526084016103e0565b826000015161ffff168561ffff161115612bad576040805160608101825261ffff87811682526001600160481b0384811660208085019182528886015160ff9081168688019081526001600160a01b038f166000908152600590935296909120945185549251965194166001600160581b0319909216919091176201000095909216949094021760ff60581b1916600160581b9190931602919091179055612cc3565b8083602001818151612bbf9190613d11565b6001600160481b03169052506060820151612be590633b9aca009063ffffffff166139bb565b83602001516001600160481b03161115612c5a5760405162461bcd60e51b815260206004820152603060248201527f5a6b426f624163636f756e74696e673a206461696c792075736572206465706f60448201526f1cda5d0818d85c08195e18d95959195960821b60648201526084016103e0565b6001600160a01b03871660009081526005602090815260409182902085518154928701519387015160ff16600160581b0260ff60581b196001600160481b0390951662010000026001600160581b031990941661ffff9092169190911792909217929092161790555b8315612cee57612cd7633b9aca0082613985565b63ffffffff16602089015260006040890152612d8b565b612cfc633b9aca0082613985565b88602001818151612d0d9190613d33565b63ffffffff908116909152602080850151908b0151908216911611159050612d8b5760405162461bcd60e51b815260206004820152602b60248201527f5a6b426f624163636f756e74696e673a206461696c79206465706f736974206360448201526a185c08195e18d95959195960aa1b60648201526084016103e0565b50612eff565b6000612d9c86613b84565b9050612db0633b9aca0063ffffffff6139bb565b811115612e145760405162461bcd60e51b815260206004820152602c60248201527f5a6b426f624163636f756e74696e673a207769746864726177616c20616d6f7560448201526b6e7420746f6f206c6172676560a01b60648201526084016103e0565b8088600001818151612e269190613d52565b6001600160481b03169052508315612e5d5760006020890152612e4d633b9aca0082613985565b63ffffffff166040890152612efd565b612e6b633b9aca0082613985565b88604001818151612e7c9190613d33565b63ffffffff908116909152604080850151908b0151908216911611159050612efd5760405162461bcd60e51b815260206004820152602e60248201527f5a6b426f624163636f756e74696e673a206461696c792077697468647261776160448201526d1b0818d85c08195e18d95959195960921b60648201526084016103e0565b505b505084516002805460208801516040909801516001600160481b039093166cffffffffffffffffffffffffff1990911617600160481b63ffffffff988916021763ffffffff60681b1916600160681b9790921696909602179094555050505050565b600060086000612f6f612243565b65ffffffffffff16815260200190815260200160002054905090565b366000806002806101006020816008600e600684612faa816004613a7c565b612fb49190613a7c565b612fbe9190613a7c565b612fc89190613a7c565b612fd29190613a7c565b612fdc9190613a7c565b612fe69190613a7c565b612ff09190613a7c565b612ffa9190613a7c565b6130049190613a7c565b90506000613010613062565b919491935090915050565b600080613026611cbc565b90508015806130355750806001145b1561304257600891505090565b8060020361305257602491505090565b8060030361015857602491505090565b60006001613072600260086139bb565b6001901b6130809190613bc4565b611d56602060028061010083816008600e600684611e20816004613a7c565b60006130f4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166133fd9092919063ffffffff16565b80519091501561266d578080602001905181019061311291906139da565b61266d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016103e0565b6000805433906001600160a01b031661283e565b600061318f613062565b6002806101006020816008600e6006846131aa816004613a7c565b6131b49190613a7c565b6131be9190613a7c565b6131c89190613a7c565b6131d29190613a7c565b6131dc9190613a7c565b6131e69190613a7c565b6131f09190613a7c565b6131fa9190613a7c565b6132049190613a7c565b611e2a9190613a7c565b6000806001600160ff1b0383168161322b60ff86901c601b613a7c565b905061323987828885613414565b935093505050935093915050565b600081600481111561325b5761325b613d72565b036132635750565b600181600481111561327757613277613d72565b036132c45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103e0565b60028160048111156132d8576132d8613d72565b036133255760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103e0565b600381600481111561333957613339613d72565b036133915760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016103e0565b60048160048111156133a5576133a5613d72565b036116a75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016103e0565b606061340c8484600085613501565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561344b57506000905060036134f8565b8460ff16601b1415801561346357508460ff16601c14155b1561347457506000905060046134f8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156134c8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166134f1576000600192509250506134f8565b9150600090505b94509492505050565b6060824710156135625760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016103e0565b600080866001600160a01b0316858760405161357e9190613d88565b60006040518083038185875af1925050503d80600081146135bb576040519150601f19603f3d011682016040523d82523d6000602084013e6135c0565b606091505b50915091506135d1878383876135dc565b979650505050505050565b6060831561364b578251600003613644576001600160a01b0385163b6136445760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103e0565b508161340c565b61340c83838151156136605781518083602001fd5b8060405162461bcd60e51b81526004016103e09190613aec565b6040518060a001604052806005906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60008060008060008060c087890312156136cf57600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6001600160a01b03811681146116a757600080fd5b8035613719816136f9565b919050565b60006020828403121561373057600080fd5b813561373b816136f9565b9392505050565b600061014082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c083015160c083015260e083015160e0830152610100808401518184015250610120808401516137b68285018260ff169052565b505092915050565b803560ff8116811461371957600080fd5b60008060008060008060c087890312156137e857600080fd5b6137f1876137be565b9860208801359850604088013597606081013597506080810135965060a00135945092505050565b60006020828403121561382b57600080fd5b5035919050565b6000806040838503121561384557600080fd5b8235613850816136f9565b91506020830135613860816136f9565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561389457600080fd5b61389d836137be565b915060208084013567ffffffffffffffff808211156138bb57600080fd5b818601915086601f8301126138cf57600080fd5b8135818111156138e1576138e161386b565b8060051b604051601f19603f830116810181811085821117156139065761390661386b565b60405291825284820192508381018501918983111561392457600080fd5b938501935b828510156139495761393a8561370e565b84529385019392850192613929565b8096505050505050509250929050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261399457613994613959565b500490565b600062ffffff808416806139af576139af613959565b92169190910492915050565b60008160001904831182151516156139d5576139d561396f565b500290565b6000602082840312156139ec57600080fd5b8151801515811461373b57600080fd5b6101a08101818460005b6005811015613a25578151835260209283019290910190600101613a06565b5050506101008360a0840137600081529392505050565b6101608101818460005b6003811015613a65578151835260209283019290910190600101613a46565b505050610100836060840137600081529392505050565b60008219821115613a8f57613a8f61396f565b500190565b60005b83811015613aaf578181015183820152602001613a97565b838111156125f95750506000910152565b60008151808452613ad8816020860160208601613a94565b601f01601f19169290920160200192915050565b60208152600061373b6020830184613ac0565b600080821280156001600160ff1b0384900385131615613b2157613b2161396f565b600160ff1b8390038412811615613b3a57613b3a61396f565b50500190565b60208082526024908201527f5a6b426f62506f6f6c3a20696e636f7272656374206465706f73697420616d6f604082015263756e747360e01b606082015260800190565b6000600160ff1b8201613b9957613b9961396f565b5060000390565b60008060408385031215613bb357600080fd5b505080516020909101519092909150565b600082821015613bd657613bd661396f565b500390565b600062ffffff83811690831681811015613bf757613bf761396f565b039392505050565b600063ffffffff83811690831681811015613bf757613bf761396f565b60006001600160581b0383811690831681811015613bf757613bf761396f565b60006001600160581b03808416806139af576139af613959565b60006001600160481b03808416806139af576139af613959565b60006001600160581b03808316818516808303821115613c9257613c9261396f565b01949350505050565b600063ffffffff808316818103613cb457613cb461396f565b6001019392505050565b634e487b7160e01b600052603260045260246000fd5b8183823760009101908152919050565b600082613cf357613cf3613959565b500690565b600060018201613d0a57613d0a61396f565b5060010190565b60006001600160481b03808316818516808303821115613c9257613c9261396f565b600063ffffffff808316818516808303821115613c9257613c9261396f565b60006001600160481b0383811690831681811015613bf757613bf761396f565b634e487b7160e01b600052602160045260246000fd5b60008251613d9a818460208701613a94565b919091019291505056fea2646970667358221220f0370c77d27cbb1029f1b2332db0bfd83269373c9404ebb73446a4bdda7664e064736f6c634300080f0033

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

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b00000000000000000000000051585f5af7b5f0bbf7f91fe8919fbff362a2fd9500000000000000000000000082907eaeb25d248dc82033e45b00a3e012ba2d0d

-----Decoded View---------------
Arg [0] : __pool_id (uint256): 0
Arg [1] : _token (address): 0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B
Arg [2] : _transfer_verifier (address): 0x51585f5Af7B5f0bbf7F91fE8919fbfF362A2fd95
Arg [3] : _tree_verifier (address): 0x82907eAeB25D248dC82033E45b00A3E012Ba2d0D

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 000000000000000000000000b0b195aefa3650a6908f15cdac7d92f8a5791b0b
Arg [2] : 00000000000000000000000051585f5af7b5f0bbf7f91fe8919fbff362a2fd95
Arg [3] : 00000000000000000000000082907eaeb25d248dc82033e45b00a3e012ba2d0d


Block Transaction 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

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.