ETH Price: $3,024.81 (+1.63%)
Gas: 6 Gwei

Contract

0xe9a9B6CE6ae2141Ed7393a61E6CaaDC481780f77
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60806040175122162023-06-19 7:09:59326 days ago1687158599IN
 Create: OpenOceanExchange
0 ETH0.0382156814.41950513

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
OpenOceanExchange

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2023-06-19
*/

/**
 *Submitted for verification at Etherscan.io on 2023-05-10
*/

// File: @openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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


// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

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

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

// File: @openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol


// 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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

// File: @openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol


// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;


/**
 * @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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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);
    }

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

// File: @openzeppelin/contracts/token/ERC20/IERC20.sol


// 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: @openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol


// 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: @openzeppelin/contracts/utils/Address.sol


// OpenZeppelin Contracts (last updated v4.8.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: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol


// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;



/**
 * @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: @openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol


// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;


/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }

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

// File: contracts/interfaces/IOpenOceanCaller.sol


pragma solidity ^0.8.0;


interface IOpenOceanCaller {
    struct CallDescription {
        uint256 target;
        uint256 gasLimit;
        uint256 value;
        bytes data;
    }

    function makeCall(CallDescription memory desc) external;

    function makeCalls(CallDescription[] memory desc) external payable;
}

// File: contracts/libraries/RevertReasonParser.sol


pragma solidity ^0.8.0;

library RevertReasonParser {
    function parse(bytes memory data, string memory prefix) internal pure returns (string memory) {
        // https://solidity.readthedocs.io/en/latest/control-structures.html#revert
        // We assume that revert reason is abi-encoded as Error(string)

        // 68 = 4-byte selector 0x08c379a0 + 32 bytes offset + 32 bytes length
        if (data.length >= 68 && data[0] == "\x08" && data[1] == "\xc3" && data[2] == "\x79" && data[3] == "\xa0") {
            string memory reason;
            // solhint-disable no-inline-assembly
            assembly {
                // 68 = 32 bytes data length + 4-byte selector + 32 bytes offset
                reason := add(data, 68)
            }
            /*
                revert reason is padded up to 32 bytes with ABI encoder: Error(string)
                also sometimes there is extra 32 bytes of zeros padded in the end:
                https://github.com/ethereum/solidity/issues/10170
                because of that we can't check for equality and instead check
                that string length + extra 68 bytes is less than overall data length
            */
            require(data.length >= 68 + bytes(reason).length, "Invalid revert reason");
            return string(abi.encodePacked(prefix, "Error(", reason, ")"));
        }
        // 36 = 4-byte selector 0x4e487b71 + 32 bytes integer
        else if (data.length == 36 && data[0] == "\x4e" && data[1] == "\x48" && data[2] == "\x7b" && data[3] == "\x71") {
            uint256 code;
            // solhint-disable no-inline-assembly
            assembly {
                // 36 = 32 bytes data length + 4-byte selector
                code := mload(add(data, 36))
            }
            return string(abi.encodePacked(prefix, "Panic(", _toHex(code), ")"));
        }

        return string(abi.encodePacked(prefix, "Unknown()"));
    }

    function _toHex(uint256 value) private pure returns (string memory) {
        return _toHex(abi.encodePacked(value));
    }

    function _toHex(bytes memory data) private pure returns (string memory) {
        bytes memory alphabet = "0123456789abcdef";
        bytes memory str = new bytes(2 + data.length * 2);
        str[0] = "0";
        str[1] = "x";
        for (uint256 i = 0; i < data.length; i++) {
            str[2 * i + 2] = alphabet[uint8(data[i] >> 4)];
            str[2 * i + 3] = alphabet[uint8(data[i] & 0x0f)];
        }
        return string(str);
    }
}

// File: @openzeppelin/contracts/utils/math/SafeMath.sol


// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

// File: contracts/libraries/UniversalERC20.sol


pragma solidity ^0.8.0;



library UniversalERC20 {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    IERC20 internal constant ZERO_ADDRESS = IERC20(0x0000000000000000000000000000000000000000);
    IERC20 internal constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
    IERC20 internal constant MATIC_ADDRESS = IERC20(0x0000000000000000000000000000000000001010);

    function universalTransfer(
        IERC20 token,
        address payable to,
        uint256 amount
    ) internal {
        if (amount > 0) {
            if (isETH(token)) {
                (bool result, ) = to.call{value: amount}("");
                require(result, "Failed to transfer ETH");
            } else {
                token.safeTransfer(to, amount);
            }
        }
    }

    function universalApprove(
        IERC20 token,
        address to,
        uint256 amount
    ) internal {
        require(!isETH(token), "Approve called on ETH");

        if (amount == 0) {
            token.safeApprove(to, 0);
        } else {
            uint256 allowance = token.allowance(address(this), to);
            if (allowance < amount) {
                if (allowance > 0) {
                    token.safeApprove(to, 0);
                }
                token.safeApprove(to, amount);
            }
        }
    }

    function universalBalanceOf(IERC20 token, address account) internal view returns (uint256) {
        if (isETH(token)) {
            return account.balance;
        } else {
            return token.balanceOf(account);
        }
    }

    function isETH(IERC20 token) internal pure returns (bool) {
        return
            address(token) == address(ETH_ADDRESS) ||
            address(token) == address(MATIC_ADDRESS) ||
            address(token) == address(ZERO_ADDRESS);
    }
}

// File: contracts/libraries/EthRejector.sol


pragma solidity ^0.8.0;

abstract contract EthRejector {
    receive() external payable {
        // require(msg.sender != tx.origin, "ETH deposit rejected");
    }
}

// File: contracts/libraries/Permitable.sol


pragma solidity ^0.8.0;

/// @title Interface for DAI-style permits
interface IDaiLikePermit {
    function permit(
        address holder,
        address spender,
        uint256 nonce,
        uint256 expiry,
        bool allowed,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

/// @title Base contract with common permit handling logics
contract Permitable {
    function _permit(address token, bytes calldata permit) internal {
        if (permit.length > 0) {
            bool success;
            bytes memory result;
            if (permit.length == 32 * 7) {
                // solhint-disable-next-line avoid-low-level-calls
                (success, result) = token.call(abi.encodePacked(IERC20Permit.permit.selector, permit));
            } else if (permit.length == 32 * 8) {
                // solhint-disable-next-line avoid-low-level-calls
                (success, result) = token.call(abi.encodePacked(IDaiLikePermit.permit.selector, permit));
            } else {
                revert("Wrong permit length");
            }
            if (!success) {
                revert(RevertReasonParser.parse(result, "Permit failed: "));
            }
        }
    }
}

// File: contracts/UniswapV2Exchange.sol



pragma solidity ^0.8.0;


contract UniswapV2Exchange is EthRejector, Permitable {
    uint256 private constant TRANSFER_FROM_CALL_SELECTOR_32 = 0x23b872dd00000000000000000000000000000000000000000000000000000000;
    uint256 private constant WETH_DEPOSIT_CALL_SELECTOR_32 = 0xd0e30db000000000000000000000000000000000000000000000000000000000;
    uint256 private constant WETH_WITHDRAW_CALL_SELECTOR_32 = 0x2e1a7d4d00000000000000000000000000000000000000000000000000000000;
    uint256 private constant ERC20_TRANSFER_CALL_SELECTOR_32 = 0xa9059cbb00000000000000000000000000000000000000000000000000000000;
    uint256 private constant ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
    uint256 private constant REVERSE_MASK = 0x8000000000000000000000000000000000000000000000000000000000000000;
    uint256 private constant WETH_MASK = 0x4000000000000000000000000000000000000000000000000000000000000000;
    uint256 private constant NUMERATOR_MASK = 0x0000000000000000ffffffff0000000000000000000000000000000000000000;
    uint256 private constant WETH = 0x000000000000000000000000C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    uint256 private constant UNISWAP_PAIR_RESERVES_CALL_SELECTOR_32 =
        0x0902f1ac00000000000000000000000000000000000000000000000000000000;
    uint256 private constant UNISWAP_PAIR_SWAP_CALL_SELECTOR_32 =
        0x022c0d9f00000000000000000000000000000000000000000000000000000000;
    uint256 private constant DENOMINATOR = 1000000000;
    uint256 private constant NUMERATOR_OFFSET = 160;

    function callUniswapToWithPermit(
        IERC20 srcToken,
        uint256 amount,
        uint256 minReturn,
        bytes32[] calldata pools,
        bytes calldata permit,
        address payable recipient
    ) external returns (uint256 returnAmount) {
        _permit(address(srcToken), permit);
        return callUniswapTo(srcToken, amount, minReturn, pools, recipient);
    }

    function callUniswapWithPermit(
        IERC20 srcToken,
        uint256 amount,
        uint256 minReturn,
        bytes32[] calldata pools,
        bytes calldata permit
    ) external returns (uint256 returnAmount) {
        _permit(address(srcToken), permit);
        return callUniswap(srcToken, amount, minReturn, pools);
    }

    function callUniswapTo(
        IERC20 srcToken,
        uint256 amount,
        uint256 minReturn,
        bytes32[] calldata /* pools */,
        address payable recipient
    ) public payable returns (uint256 returnAmount) {
        assembly {
            // solhint-disable-line no-inline-assembly
            function reRevert() {
                returndatacopy(0, 0, returndatasize())
                revert(0, returndatasize())
            }

            function revertWithReason(m, len) {
                mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
                mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000)
                mstore(0x40, m)
                revert(0, len)
            }

            function swap(emptyPtr, swapAmount, pair, reversed, numerator, dst) -> ret {
                mstore(emptyPtr, UNISWAP_PAIR_RESERVES_CALL_SELECTOR_32)
                if iszero(staticcall(gas(), pair, emptyPtr, 0x4, emptyPtr, 0x40)) {
                    reRevert()
                }

                let reserve0 := mload(emptyPtr)
                let reserve1 := mload(add(emptyPtr, 0x20))
                if reversed {
                    let tmp := reserve0
                    reserve0 := reserve1
                    reserve1 := tmp
                }
                ret := mul(swapAmount, numerator)
                ret := div(mul(ret, reserve1), add(ret, mul(reserve0, DENOMINATOR)))

                mstore(emptyPtr, UNISWAP_PAIR_SWAP_CALL_SELECTOR_32)
                switch reversed
                case 0 {
                    mstore(add(emptyPtr, 0x04), 0)
                    mstore(add(emptyPtr, 0x24), ret)
                }
                default {
                    mstore(add(emptyPtr, 0x04), ret)
                    mstore(add(emptyPtr, 0x24), 0)
                }
                mstore(add(emptyPtr, 0x44), dst)
                mstore(add(emptyPtr, 0x64), 0x80)
                mstore(add(emptyPtr, 0x84), 0)
                if iszero(call(gas(), pair, 0, emptyPtr, 0xa4, 0, 0)) {
                    reRevert()
                }
            }

            function callSwap(emptyPtr, token, srcAmount, swapCaller, receiver, min) -> ret {
                let poolsOffset := add(calldataload(0x64), 0x4)
                let poolsEndOffset := calldataload(poolsOffset)
                poolsOffset := add(poolsOffset, 0x20)
                poolsEndOffset := add(poolsOffset, mul(0x20, poolsEndOffset))
                let rawPair := calldataload(poolsOffset)
                switch token
                case 0 {
                    if iszero(eq(srcAmount, callvalue())) {
                        revertWithReason(0x00000011696e76616c6964206d73672e76616c75650000000000000000000000, 0x55) // "invalid msg.value"
                    }

                    mstore(emptyPtr, WETH_DEPOSIT_CALL_SELECTOR_32)
                    if iszero(call(gas(), WETH, srcAmount, emptyPtr, 0x4, 0, 0)) {
                        reRevert()
                    }

                    mstore(emptyPtr, ERC20_TRANSFER_CALL_SELECTOR_32)
                    mstore(add(emptyPtr, 0x4), and(rawPair, ADDRESS_MASK))
                    mstore(add(emptyPtr, 0x24), srcAmount)
                    if iszero(call(gas(), WETH, 0, emptyPtr, 0x44, 0, 0)) {
                        reRevert()
                    }
                }
                default {
                    if callvalue() {
                        revertWithReason(0x00000011696e76616c6964206d73672e76616c75650000000000000000000000, 0x55) // "invalid msg.value"
                    }

                    mstore(emptyPtr, TRANSFER_FROM_CALL_SELECTOR_32)
                    mstore(add(emptyPtr, 0x4), swapCaller)
                    mstore(add(emptyPtr, 0x24), and(rawPair, ADDRESS_MASK))
                    mstore(add(emptyPtr, 0x44), srcAmount)
                    if iszero(call(gas(), token, 0, emptyPtr, 0x64, 0, 0)) {
                        reRevert()
                    }
                }

                ret := srcAmount

                for {
                    let i := add(poolsOffset, 0x20)
                } lt(i, poolsEndOffset) {
                    i := add(i, 0x20)
                } {
                    let nextRawPair := calldataload(i)

                    ret := swap(
                        emptyPtr,
                        ret,
                        and(rawPair, ADDRESS_MASK),
                        and(rawPair, REVERSE_MASK),
                        shr(NUMERATOR_OFFSET, and(rawPair, NUMERATOR_MASK)),
                        and(nextRawPair, ADDRESS_MASK)
                    )

                    rawPair := nextRawPair
                }

                ret := swap(
                    emptyPtr,
                    ret,
                    and(rawPair, ADDRESS_MASK),
                    and(rawPair, REVERSE_MASK),
                    shr(NUMERATOR_OFFSET, and(rawPair, NUMERATOR_MASK)),
                    address()
                )

                if lt(ret, min) {
                    revertWithReason(0x000000164d696e2072657475726e206e6f742072656163686564000000000000, 0x5a) // "Min return not reached"
                }

                mstore(emptyPtr, 0xd21220a700000000000000000000000000000000000000000000000000000000)
                if and(rawPair, REVERSE_MASK) {
                    mstore(emptyPtr, 0x0dfe168100000000000000000000000000000000000000000000000000000000)
                }
                if iszero(staticcall(gas(), and(rawPair, ADDRESS_MASK), emptyPtr, 0x4, emptyPtr, 0x40)) {
                    reRevert()
                }
                let dstToken := mload(emptyPtr)

                let finalAmount := div(
                    mul(calldataload(0x44), 0x2710),
                    sub(
                        10000,
                        shr(
                            232,
                            and(
                                calldataload(add(add(calldataload(0x64), 0x4), 0x20)),
                                0x00ffff0000000000000000000000000000000000000000000000000000000000
                            )
                        )
                    )
                )
                switch gt(ret, finalAmount)
                case 1 {
                    switch and(rawPair, WETH_MASK)
                    case 0 {
                        mstore(emptyPtr, ERC20_TRANSFER_CALL_SELECTOR_32)
                        mstore(add(emptyPtr, 0x4), receiver)
                        mstore(add(emptyPtr, 0x24), finalAmount)
                        if iszero(call(gas(), dstToken, 0, emptyPtr, 0x44, 0, 0)) {
                            reRevert()
                        }

                        mstore(add(emptyPtr, 0x4), 0x353c1f0bc78fbbc245b3C93ef77b1DCC5b77D2A0)
                        mstore(add(emptyPtr, 0x24), sub(ret, finalAmount))
                        if iszero(call(gas(), dstToken, 0, emptyPtr, 0x44, 0, 0)) {
                            reRevert()
                        }
                    }
                    default {
                        mstore(emptyPtr, WETH_WITHDRAW_CALL_SELECTOR_32)
                        mstore(add(emptyPtr, 0x04), ret)
                        if iszero(call(gas(), WETH, 0, emptyPtr, 0x24, 0, 0)) {
                            reRevert()
                        }

                        if iszero(call(gas(), receiver, finalAmount, 0, 0, 0, 0)) {
                            reRevert()
                        }

                        if iszero(call(gas(), 0x353c1f0bc78fbbc245b3C93ef77b1DCC5b77D2A0, sub(ret, finalAmount), 0, 0, 0, 0)) {
                            reRevert()
                        }
                    }
                }
                default {
                    switch and(rawPair, WETH_MASK)
                    case 0 {
                        mstore(emptyPtr, ERC20_TRANSFER_CALL_SELECTOR_32)
                        mstore(add(emptyPtr, 0x4), receiver)
                        mstore(add(emptyPtr, 0x24), ret)
                        if iszero(call(gas(), dstToken, 0, emptyPtr, 0x44, 0, 0)) {
                            reRevert()
                        }
                    }
                    default {
                        mstore(emptyPtr, WETH_WITHDRAW_CALL_SELECTOR_32)
                        mstore(add(emptyPtr, 0x04), ret)
                        if iszero(call(gas(), WETH, 0, emptyPtr, 0x24, 0, 0)) {
                            reRevert()
                        }

                        if iszero(call(gas(), receiver, ret, 0, 0, 0, 0)) {
                            reRevert()
                        }
                    }
                }
            }

            let emptyPtr := mload(0x40)
            mstore(0x40, add(emptyPtr, 0xc0))
            returnAmount := callSwap(emptyPtr, srcToken, amount, caller(), recipient, minReturn)
        }
    }

    function callUniswap(
        IERC20 srcToken,
        uint256 amount,
        uint256 minReturn,
        bytes32[] calldata pools
    ) public payable returns (uint256 returnAmount) {
        return callUniswapTo(srcToken, amount, minReturn, pools, payable(msg.sender));
    }
}

// File: @openzeppelin/contracts/utils/math/SafeCast.sol


// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.

pragma solidity ^0.8.0;

/**
 * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
 * checks.
 *
 * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
 * easily result in undesired exploitation or bugs, since developers usually
 * assume that overflows raise errors. `SafeCast` restores this intuition by
 * reverting the transaction when such an operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 *
 * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
 * all math on `uint256` and `int256` and then downcasting.
 */
library SafeCast {
    /**
     * @dev Returns the downcasted uint248 from uint256, reverting on
     * overflow (when the input is greater than largest uint248).
     *
     * Counterpart to Solidity's `uint248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toUint248(uint256 value) internal pure returns (uint248) {
        require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
        return uint248(value);
    }

    /**
     * @dev Returns the downcasted uint240 from uint256, reverting on
     * overflow (when the input is greater than largest uint240).
     *
     * Counterpart to Solidity's `uint240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toUint240(uint256 value) internal pure returns (uint240) {
        require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
        return uint240(value);
    }

    /**
     * @dev Returns the downcasted uint232 from uint256, reverting on
     * overflow (when the input is greater than largest uint232).
     *
     * Counterpart to Solidity's `uint232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toUint232(uint256 value) internal pure returns (uint232) {
        require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
        return uint232(value);
    }

    /**
     * @dev Returns the downcasted uint224 from uint256, reverting on
     * overflow (when the input is greater than largest uint224).
     *
     * Counterpart to Solidity's `uint224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.2._
     */
    function toUint224(uint256 value) internal pure returns (uint224) {
        require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
        return uint224(value);
    }

    /**
     * @dev Returns the downcasted uint216 from uint256, reverting on
     * overflow (when the input is greater than largest uint216).
     *
     * Counterpart to Solidity's `uint216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toUint216(uint256 value) internal pure returns (uint216) {
        require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
        return uint216(value);
    }

    /**
     * @dev Returns the downcasted uint208 from uint256, reverting on
     * overflow (when the input is greater than largest uint208).
     *
     * Counterpart to Solidity's `uint208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toUint208(uint256 value) internal pure returns (uint208) {
        require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
        return uint208(value);
    }

    /**
     * @dev Returns the downcasted uint200 from uint256, reverting on
     * overflow (when the input is greater than largest uint200).
     *
     * Counterpart to Solidity's `uint200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toUint200(uint256 value) internal pure returns (uint200) {
        require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
        return uint200(value);
    }

    /**
     * @dev Returns the downcasted uint192 from uint256, reverting on
     * overflow (when the input is greater than largest uint192).
     *
     * Counterpart to Solidity's `uint192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toUint192(uint256 value) internal pure returns (uint192) {
        require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
        return uint192(value);
    }

    /**
     * @dev Returns the downcasted uint184 from uint256, reverting on
     * overflow (when the input is greater than largest uint184).
     *
     * Counterpart to Solidity's `uint184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toUint184(uint256 value) internal pure returns (uint184) {
        require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
        return uint184(value);
    }

    /**
     * @dev Returns the downcasted uint176 from uint256, reverting on
     * overflow (when the input is greater than largest uint176).
     *
     * Counterpart to Solidity's `uint176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toUint176(uint256 value) internal pure returns (uint176) {
        require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
        return uint176(value);
    }

    /**
     * @dev Returns the downcasted uint168 from uint256, reverting on
     * overflow (when the input is greater than largest uint168).
     *
     * Counterpart to Solidity's `uint168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toUint168(uint256 value) internal pure returns (uint168) {
        require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
        return uint168(value);
    }

    /**
     * @dev Returns the downcasted uint160 from uint256, reverting on
     * overflow (when the input is greater than largest uint160).
     *
     * Counterpart to Solidity's `uint160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toUint160(uint256 value) internal pure returns (uint160) {
        require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
        return uint160(value);
    }

    /**
     * @dev Returns the downcasted uint152 from uint256, reverting on
     * overflow (when the input is greater than largest uint152).
     *
     * Counterpart to Solidity's `uint152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toUint152(uint256 value) internal pure returns (uint152) {
        require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
        return uint152(value);
    }

    /**
     * @dev Returns the downcasted uint144 from uint256, reverting on
     * overflow (when the input is greater than largest uint144).
     *
     * Counterpart to Solidity's `uint144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toUint144(uint256 value) internal pure returns (uint144) {
        require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
        return uint144(value);
    }

    /**
     * @dev Returns the downcasted uint136 from uint256, reverting on
     * overflow (when the input is greater than largest uint136).
     *
     * Counterpart to Solidity's `uint136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toUint136(uint256 value) internal pure returns (uint136) {
        require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
        return uint136(value);
    }

    /**
     * @dev Returns the downcasted uint128 from uint256, reverting on
     * overflow (when the input is greater than largest uint128).
     *
     * Counterpart to Solidity's `uint128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v2.5._
     */
    function toUint128(uint256 value) internal pure returns (uint128) {
        require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
        return uint128(value);
    }

    /**
     * @dev Returns the downcasted uint120 from uint256, reverting on
     * overflow (when the input is greater than largest uint120).
     *
     * Counterpart to Solidity's `uint120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toUint120(uint256 value) internal pure returns (uint120) {
        require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
        return uint120(value);
    }

    /**
     * @dev Returns the downcasted uint112 from uint256, reverting on
     * overflow (when the input is greater than largest uint112).
     *
     * Counterpart to Solidity's `uint112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toUint112(uint256 value) internal pure returns (uint112) {
        require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
        return uint112(value);
    }

    /**
     * @dev Returns the downcasted uint104 from uint256, reverting on
     * overflow (when the input is greater than largest uint104).
     *
     * Counterpart to Solidity's `uint104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toUint104(uint256 value) internal pure returns (uint104) {
        require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
        return uint104(value);
    }

    /**
     * @dev Returns the downcasted uint96 from uint256, reverting on
     * overflow (when the input is greater than largest uint96).
     *
     * Counterpart to Solidity's `uint96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.2._
     */
    function toUint96(uint256 value) internal pure returns (uint96) {
        require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
        return uint96(value);
    }

    /**
     * @dev Returns the downcasted uint88 from uint256, reverting on
     * overflow (when the input is greater than largest uint88).
     *
     * Counterpart to Solidity's `uint88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toUint88(uint256 value) internal pure returns (uint88) {
        require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
        return uint88(value);
    }

    /**
     * @dev Returns the downcasted uint80 from uint256, reverting on
     * overflow (when the input is greater than largest uint80).
     *
     * Counterpart to Solidity's `uint80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toUint80(uint256 value) internal pure returns (uint80) {
        require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
        return uint80(value);
    }

    /**
     * @dev Returns the downcasted uint72 from uint256, reverting on
     * overflow (when the input is greater than largest uint72).
     *
     * Counterpart to Solidity's `uint72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toUint72(uint256 value) internal pure returns (uint72) {
        require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
        return uint72(value);
    }

    /**
     * @dev Returns the downcasted uint64 from uint256, reverting on
     * overflow (when the input is greater than largest uint64).
     *
     * Counterpart to Solidity's `uint64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v2.5._
     */
    function toUint64(uint256 value) internal pure returns (uint64) {
        require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
        return uint64(value);
    }

    /**
     * @dev Returns the downcasted uint56 from uint256, reverting on
     * overflow (when the input is greater than largest uint56).
     *
     * Counterpart to Solidity's `uint56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toUint56(uint256 value) internal pure returns (uint56) {
        require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
        return uint56(value);
    }

    /**
     * @dev Returns the downcasted uint48 from uint256, reverting on
     * overflow (when the input is greater than largest uint48).
     *
     * Counterpart to Solidity's `uint48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toUint48(uint256 value) internal pure returns (uint48) {
        require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
        return uint48(value);
    }

    /**
     * @dev Returns the downcasted uint40 from uint256, reverting on
     * overflow (when the input is greater than largest uint40).
     *
     * Counterpart to Solidity's `uint40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toUint40(uint256 value) internal pure returns (uint40) {
        require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
        return uint40(value);
    }

    /**
     * @dev Returns the downcasted uint32 from uint256, reverting on
     * overflow (when the input is greater than largest uint32).
     *
     * Counterpart to Solidity's `uint32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v2.5._
     */
    function toUint32(uint256 value) internal pure returns (uint32) {
        require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
        return uint32(value);
    }

    /**
     * @dev Returns the downcasted uint24 from uint256, reverting on
     * overflow (when the input is greater than largest uint24).
     *
     * Counterpart to Solidity's `uint24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toUint24(uint256 value) internal pure returns (uint24) {
        require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
        return uint24(value);
    }

    /**
     * @dev Returns the downcasted uint16 from uint256, reverting on
     * overflow (when the input is greater than largest uint16).
     *
     * Counterpart to Solidity's `uint16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v2.5._
     */
    function toUint16(uint256 value) internal pure returns (uint16) {
        require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
        return uint16(value);
    }

    /**
     * @dev Returns the downcasted uint8 from uint256, reverting on
     * overflow (when the input is greater than largest uint8).
     *
     * Counterpart to Solidity's `uint8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v2.5._
     */
    function toUint8(uint256 value) internal pure returns (uint8) {
        require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
        return uint8(value);
    }

    /**
     * @dev Converts a signed int256 into an unsigned uint256.
     *
     * Requirements:
     *
     * - input must be greater than or equal to 0.
     *
     * _Available since v3.0._
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @dev Returns the downcasted int248 from int256, reverting on
     * overflow (when the input is less than smallest int248 or
     * greater than largest int248).
     *
     * Counterpart to Solidity's `int248` operator.
     *
     * Requirements:
     *
     * - input must fit into 248 bits
     *
     * _Available since v4.7._
     */
    function toInt248(int256 value) internal pure returns (int248 downcasted) {
        downcasted = int248(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
    }

    /**
     * @dev Returns the downcasted int240 from int256, reverting on
     * overflow (when the input is less than smallest int240 or
     * greater than largest int240).
     *
     * Counterpart to Solidity's `int240` operator.
     *
     * Requirements:
     *
     * - input must fit into 240 bits
     *
     * _Available since v4.7._
     */
    function toInt240(int256 value) internal pure returns (int240 downcasted) {
        downcasted = int240(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
    }

    /**
     * @dev Returns the downcasted int232 from int256, reverting on
     * overflow (when the input is less than smallest int232 or
     * greater than largest int232).
     *
     * Counterpart to Solidity's `int232` operator.
     *
     * Requirements:
     *
     * - input must fit into 232 bits
     *
     * _Available since v4.7._
     */
    function toInt232(int256 value) internal pure returns (int232 downcasted) {
        downcasted = int232(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
    }

    /**
     * @dev Returns the downcasted int224 from int256, reverting on
     * overflow (when the input is less than smallest int224 or
     * greater than largest int224).
     *
     * Counterpart to Solidity's `int224` operator.
     *
     * Requirements:
     *
     * - input must fit into 224 bits
     *
     * _Available since v4.7._
     */
    function toInt224(int256 value) internal pure returns (int224 downcasted) {
        downcasted = int224(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
    }

    /**
     * @dev Returns the downcasted int216 from int256, reverting on
     * overflow (when the input is less than smallest int216 or
     * greater than largest int216).
     *
     * Counterpart to Solidity's `int216` operator.
     *
     * Requirements:
     *
     * - input must fit into 216 bits
     *
     * _Available since v4.7._
     */
    function toInt216(int256 value) internal pure returns (int216 downcasted) {
        downcasted = int216(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
    }

    /**
     * @dev Returns the downcasted int208 from int256, reverting on
     * overflow (when the input is less than smallest int208 or
     * greater than largest int208).
     *
     * Counterpart to Solidity's `int208` operator.
     *
     * Requirements:
     *
     * - input must fit into 208 bits
     *
     * _Available since v4.7._
     */
    function toInt208(int256 value) internal pure returns (int208 downcasted) {
        downcasted = int208(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
    }

    /**
     * @dev Returns the downcasted int200 from int256, reverting on
     * overflow (when the input is less than smallest int200 or
     * greater than largest int200).
     *
     * Counterpart to Solidity's `int200` operator.
     *
     * Requirements:
     *
     * - input must fit into 200 bits
     *
     * _Available since v4.7._
     */
    function toInt200(int256 value) internal pure returns (int200 downcasted) {
        downcasted = int200(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
    }

    /**
     * @dev Returns the downcasted int192 from int256, reverting on
     * overflow (when the input is less than smallest int192 or
     * greater than largest int192).
     *
     * Counterpart to Solidity's `int192` operator.
     *
     * Requirements:
     *
     * - input must fit into 192 bits
     *
     * _Available since v4.7._
     */
    function toInt192(int256 value) internal pure returns (int192 downcasted) {
        downcasted = int192(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
    }

    /**
     * @dev Returns the downcasted int184 from int256, reverting on
     * overflow (when the input is less than smallest int184 or
     * greater than largest int184).
     *
     * Counterpart to Solidity's `int184` operator.
     *
     * Requirements:
     *
     * - input must fit into 184 bits
     *
     * _Available since v4.7._
     */
    function toInt184(int256 value) internal pure returns (int184 downcasted) {
        downcasted = int184(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
    }

    /**
     * @dev Returns the downcasted int176 from int256, reverting on
     * overflow (when the input is less than smallest int176 or
     * greater than largest int176).
     *
     * Counterpart to Solidity's `int176` operator.
     *
     * Requirements:
     *
     * - input must fit into 176 bits
     *
     * _Available since v4.7._
     */
    function toInt176(int256 value) internal pure returns (int176 downcasted) {
        downcasted = int176(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
    }

    /**
     * @dev Returns the downcasted int168 from int256, reverting on
     * overflow (when the input is less than smallest int168 or
     * greater than largest int168).
     *
     * Counterpart to Solidity's `int168` operator.
     *
     * Requirements:
     *
     * - input must fit into 168 bits
     *
     * _Available since v4.7._
     */
    function toInt168(int256 value) internal pure returns (int168 downcasted) {
        downcasted = int168(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
    }

    /**
     * @dev Returns the downcasted int160 from int256, reverting on
     * overflow (when the input is less than smallest int160 or
     * greater than largest int160).
     *
     * Counterpart to Solidity's `int160` operator.
     *
     * Requirements:
     *
     * - input must fit into 160 bits
     *
     * _Available since v4.7._
     */
    function toInt160(int256 value) internal pure returns (int160 downcasted) {
        downcasted = int160(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
    }

    /**
     * @dev Returns the downcasted int152 from int256, reverting on
     * overflow (when the input is less than smallest int152 or
     * greater than largest int152).
     *
     * Counterpart to Solidity's `int152` operator.
     *
     * Requirements:
     *
     * - input must fit into 152 bits
     *
     * _Available since v4.7._
     */
    function toInt152(int256 value) internal pure returns (int152 downcasted) {
        downcasted = int152(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
    }

    /**
     * @dev Returns the downcasted int144 from int256, reverting on
     * overflow (when the input is less than smallest int144 or
     * greater than largest int144).
     *
     * Counterpart to Solidity's `int144` operator.
     *
     * Requirements:
     *
     * - input must fit into 144 bits
     *
     * _Available since v4.7._
     */
    function toInt144(int256 value) internal pure returns (int144 downcasted) {
        downcasted = int144(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
    }

    /**
     * @dev Returns the downcasted int136 from int256, reverting on
     * overflow (when the input is less than smallest int136 or
     * greater than largest int136).
     *
     * Counterpart to Solidity's `int136` operator.
     *
     * Requirements:
     *
     * - input must fit into 136 bits
     *
     * _Available since v4.7._
     */
    function toInt136(int256 value) internal pure returns (int136 downcasted) {
        downcasted = int136(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
    }

    /**
     * @dev Returns the downcasted int128 from int256, reverting on
     * overflow (when the input is less than smallest int128 or
     * greater than largest int128).
     *
     * Counterpart to Solidity's `int128` operator.
     *
     * Requirements:
     *
     * - input must fit into 128 bits
     *
     * _Available since v3.1._
     */
    function toInt128(int256 value) internal pure returns (int128 downcasted) {
        downcasted = int128(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
    }

    /**
     * @dev Returns the downcasted int120 from int256, reverting on
     * overflow (when the input is less than smallest int120 or
     * greater than largest int120).
     *
     * Counterpart to Solidity's `int120` operator.
     *
     * Requirements:
     *
     * - input must fit into 120 bits
     *
     * _Available since v4.7._
     */
    function toInt120(int256 value) internal pure returns (int120 downcasted) {
        downcasted = int120(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
    }

    /**
     * @dev Returns the downcasted int112 from int256, reverting on
     * overflow (when the input is less than smallest int112 or
     * greater than largest int112).
     *
     * Counterpart to Solidity's `int112` operator.
     *
     * Requirements:
     *
     * - input must fit into 112 bits
     *
     * _Available since v4.7._
     */
    function toInt112(int256 value) internal pure returns (int112 downcasted) {
        downcasted = int112(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
    }

    /**
     * @dev Returns the downcasted int104 from int256, reverting on
     * overflow (when the input is less than smallest int104 or
     * greater than largest int104).
     *
     * Counterpart to Solidity's `int104` operator.
     *
     * Requirements:
     *
     * - input must fit into 104 bits
     *
     * _Available since v4.7._
     */
    function toInt104(int256 value) internal pure returns (int104 downcasted) {
        downcasted = int104(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
    }

    /**
     * @dev Returns the downcasted int96 from int256, reverting on
     * overflow (when the input is less than smallest int96 or
     * greater than largest int96).
     *
     * Counterpart to Solidity's `int96` operator.
     *
     * Requirements:
     *
     * - input must fit into 96 bits
     *
     * _Available since v4.7._
     */
    function toInt96(int256 value) internal pure returns (int96 downcasted) {
        downcasted = int96(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
    }

    /**
     * @dev Returns the downcasted int88 from int256, reverting on
     * overflow (when the input is less than smallest int88 or
     * greater than largest int88).
     *
     * Counterpart to Solidity's `int88` operator.
     *
     * Requirements:
     *
     * - input must fit into 88 bits
     *
     * _Available since v4.7._
     */
    function toInt88(int256 value) internal pure returns (int88 downcasted) {
        downcasted = int88(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
    }

    /**
     * @dev Returns the downcasted int80 from int256, reverting on
     * overflow (when the input is less than smallest int80 or
     * greater than largest int80).
     *
     * Counterpart to Solidity's `int80` operator.
     *
     * Requirements:
     *
     * - input must fit into 80 bits
     *
     * _Available since v4.7._
     */
    function toInt80(int256 value) internal pure returns (int80 downcasted) {
        downcasted = int80(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
    }

    /**
     * @dev Returns the downcasted int72 from int256, reverting on
     * overflow (when the input is less than smallest int72 or
     * greater than largest int72).
     *
     * Counterpart to Solidity's `int72` operator.
     *
     * Requirements:
     *
     * - input must fit into 72 bits
     *
     * _Available since v4.7._
     */
    function toInt72(int256 value) internal pure returns (int72 downcasted) {
        downcasted = int72(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
    }

    /**
     * @dev Returns the downcasted int64 from int256, reverting on
     * overflow (when the input is less than smallest int64 or
     * greater than largest int64).
     *
     * Counterpart to Solidity's `int64` operator.
     *
     * Requirements:
     *
     * - input must fit into 64 bits
     *
     * _Available since v3.1._
     */
    function toInt64(int256 value) internal pure returns (int64 downcasted) {
        downcasted = int64(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
    }

    /**
     * @dev Returns the downcasted int56 from int256, reverting on
     * overflow (when the input is less than smallest int56 or
     * greater than largest int56).
     *
     * Counterpart to Solidity's `int56` operator.
     *
     * Requirements:
     *
     * - input must fit into 56 bits
     *
     * _Available since v4.7._
     */
    function toInt56(int256 value) internal pure returns (int56 downcasted) {
        downcasted = int56(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
    }

    /**
     * @dev Returns the downcasted int48 from int256, reverting on
     * overflow (when the input is less than smallest int48 or
     * greater than largest int48).
     *
     * Counterpart to Solidity's `int48` operator.
     *
     * Requirements:
     *
     * - input must fit into 48 bits
     *
     * _Available since v4.7._
     */
    function toInt48(int256 value) internal pure returns (int48 downcasted) {
        downcasted = int48(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
    }

    /**
     * @dev Returns the downcasted int40 from int256, reverting on
     * overflow (when the input is less than smallest int40 or
     * greater than largest int40).
     *
     * Counterpart to Solidity's `int40` operator.
     *
     * Requirements:
     *
     * - input must fit into 40 bits
     *
     * _Available since v4.7._
     */
    function toInt40(int256 value) internal pure returns (int40 downcasted) {
        downcasted = int40(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
    }

    /**
     * @dev Returns the downcasted int32 from int256, reverting on
     * overflow (when the input is less than smallest int32 or
     * greater than largest int32).
     *
     * Counterpart to Solidity's `int32` operator.
     *
     * Requirements:
     *
     * - input must fit into 32 bits
     *
     * _Available since v3.1._
     */
    function toInt32(int256 value) internal pure returns (int32 downcasted) {
        downcasted = int32(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
    }

    /**
     * @dev Returns the downcasted int24 from int256, reverting on
     * overflow (when the input is less than smallest int24 or
     * greater than largest int24).
     *
     * Counterpart to Solidity's `int24` operator.
     *
     * Requirements:
     *
     * - input must fit into 24 bits
     *
     * _Available since v4.7._
     */
    function toInt24(int256 value) internal pure returns (int24 downcasted) {
        downcasted = int24(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
    }

    /**
     * @dev Returns the downcasted int16 from int256, reverting on
     * overflow (when the input is less than smallest int16 or
     * greater than largest int16).
     *
     * Counterpart to Solidity's `int16` operator.
     *
     * Requirements:
     *
     * - input must fit into 16 bits
     *
     * _Available since v3.1._
     */
    function toInt16(int256 value) internal pure returns (int16 downcasted) {
        downcasted = int16(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
    }

    /**
     * @dev Returns the downcasted int8 from int256, reverting on
     * overflow (when the input is less than smallest int8 or
     * greater than largest int8).
     *
     * Counterpart to Solidity's `int8` operator.
     *
     * Requirements:
     *
     * - input must fit into 8 bits
     *
     * _Available since v3.1._
     */
    function toInt8(int256 value) internal pure returns (int8 downcasted) {
        downcasted = int8(value);
        require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     *
     * _Available since v3.0._
     */
    function toInt256(uint256 value) internal pure returns (int256) {
        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
        require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
        return int256(value);
    }
}

// File: contracts/interfaces/IUniswapV3.sol


pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;

interface IUniswapV3Pool {
    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);
}

/// @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;
}

/// @title Callback for IAlgebraPoolActions#swap
/// @notice Any contract that calls IAlgebraPoolActions#swap must implement this interface
/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces
interface IAlgebraSwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#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 AlgebraPool deployed by the canonical AlgebraFactory.
    /// 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 IAlgebraPoolActions#swap call
    function algebraSwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;
}

interface IiZiSwapFactory {
    /// @notice Get pool of (tokenX, tokenY, fee), address(0) for not exists.
    /// @param tokenX address of tokenX
    /// @param tokenY address of tokenY
    /// @param fee fee amount
    /// @return address of pool
    function pool(address tokenX, address tokenY, uint24 fee) external view returns (address);
}

interface IiZiSwapCallback {
    /// @notice Called to msg.sender in iZiSwapPool#swapY2X(DesireX) call.
    /// @param x Amount of tokenX trader will acquire
    /// @param y Amount of tokenY trader will pay
    /// @param data Any dadta passed though by the msg.sender via the iZiSwapPool#swapY2X(DesireX) call
    function swapY2XCallback(uint256 x, uint256 y, bytes calldata data) external;

    /// @notice Called to msg.sender in iZiSwapPool#swapX2Y(DesireY) call.
    /// @param x Amount of tokenX trader will pay
    /// @param y Amount of tokenY trader will require
    /// @param data Any dadta passed though by the msg.sender via the iZiSwapPool#swapX2Y(DesireY) call
    function swapX2YCallback(uint256 x, uint256 y, bytes calldata data) external;
}

interface IiZiSwapPool {
    function pointDelta() external view returns (int24);

    /// @notice Point status in the pool.
    /// @param point the point
    /// @return liquidSum the total amount of liquidity that uses the point either as left endpoint or right endpoint
    /// @return liquidDelta how much liquidity changes when the pool price crosses the point from left to right
    /// @return accFeeXOut_128 the fee growth on the other side of the point from the current point in tokenX
    /// @return accFeeYOut_128 the fee growth on the other side of the point from the current point in tokenY
    /// @return isEndpt whether the point is an endpoint of a some miner's liquidity, true if liquidSum > 0
    function points(
        int24 point
    ) external view returns (uint128 liquidSum, int128 liquidDelta, uint256 accFeeXOut_128, uint256 accFeeYOut_128, bool isEndpt);

    /// @notice Returns 256 packed point (statusVal>0) boolean values. See PointBitmap for more information.
    function pointBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Swap tokenY for tokenX, given max amount of tokenY user willing to pay.
    /// @param recipient the address to receive tokenX
    /// @param amount the max amount of tokenY user willing to pay
    /// @param highPt the highest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX payed
    /// @return amountY amount of tokenY acquired
    function swapY2X(
        address recipient,
        uint128 amount,
        int24 highPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice Swap tokenY for tokenX, given amount of tokenX user desires.
    /// @param recipient the address to receive tokenX
    /// @param desireX the amount of tokenX user desires
    /// @param highPt the highest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX payed
    /// @return amountY amount of tokenY acquired
    function swapY2XDesireX(
        address recipient,
        uint128 desireX,
        int24 highPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice Swap tokenX for tokenY, given max amount of tokenX user willing to pay.
    /// @param recipient the address to receive tokenY
    /// @param amount the max amount of tokenX user willing to pay
    /// @param lowPt the lowest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX acquired
    /// @return amountY amount of tokenY payed
    function swapX2Y(
        address recipient,
        uint128 amount,
        int24 lowPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice Swap tokenX for tokenY, given amount of tokenY user desires.
    /// @param recipient the address to receive tokenY
    /// @param desireY the amount of tokenY user desires
    /// @param lowPt the lowest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX acquired
    /// @return amountY amount of tokenY payed
    function swapX2YDesireY(
        address recipient,
        uint128 desireY,
        int24 lowPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice LimitOrder info on a given point.
    /// @param point the given point
    /// @return sellingX total amount of tokenX selling on the point
    /// @return earnY total amount of unclaimed earned tokenY
    /// @return accEarnY total amount of earned tokenY(via selling tokenX) by all users at this point as of the last swap
    /// @return sellingY total amount of tokenYselling on the point
    /// @return earnX total amount of unclaimed earned tokenX
    /// @return accEarnX total amount of earned tokenX(via selling tokenY) by all users at this point as of the last swap
    function limitOrderData(
        int24 point
    ) external view returns (uint128 sellingX, uint128 earnY, uint256 accEarnY, uint128 sellingY, uint128 earnX, uint256 accEarnX);
}

/// @title Callback for IPancakeV3PoolActions#swap
/// @notice Any contract that calls IPancakeV3PoolActions#swap must implement this interface
interface IPancakeV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IPancakeV3Pool#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 PancakeV3Pool deployed by the canonical PancakeV3Factory.
    /// 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 IPancakeV3PoolActions#swap call
    function pancakeV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external;
}

interface IMaverickV1Pool {
    /// @notice swap tokens
    /// @param recipient address that will receive the output tokens
    /// @param amount amount of token that is either the input if exactOutput
    //is false or the output if exactOutput is true
    /// @param tokenAIn bool indicating whether tokenA is the input
    /// @param exactOutput bool indicating whether the amount specified is the
    //exact output amount (true)
    /// @param sqrtPriceLimit limiting sqrt price of the swap.  A value of 0
    //indicates no limit.  Limit is only engaged for exactOutput=false.  If the
    //limit is reached only part of the input amount will be swapped and the
    //callback will only require that amount of the swap to be paid.
    /// @param data callback function that swap will call so that the
    //caller can transfer tokens
    function swap(
        address recipient,
        uint256 amount,
        bool tokenAIn,
        bool exactOutput,
        uint256 sqrtPriceLimit,
        bytes calldata data
    ) external returns (uint256 amountIn, uint256 amountOut);
}

interface IMaverickV1SwapCallback {
    function swapCallback(uint256 amountIn, uint256 amountOut, bytes calldata data) external;
}

interface IMaverickV1Factory {
    /// @notice lookup table for whether a pool is owned by the factory
    function isFactoryPool(address pool) external view returns (bool);
}

// File: contracts/interfaces/IWETH.sol


pragma solidity ^0.8.0;

/// @title Interface for WETH tokens
interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256 amount) external;
}

// File: contracts/UniswapV3Exchange.sol


pragma solidity ^0.8.0;






contract UniswapV3Exchange is EthRejector, Permitable, IUniswapV3SwapCallback {
    using Address for address payable;
    using SafeERC20 for IERC20;
    using SafeMath for uint256;

    uint256 private constant _ONE_FOR_ZERO_MASK = 1 << 255;
    uint256 private constant _WETH_WRAP_MASK = 1 << 254;
    uint256 private constant _WETH_UNWRAP_MASK = 1 << 253;
    bytes32 private constant _POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;
    bytes32 private constant _FF_FACTORY = 0xff1F98431c8aD98523631AE4a59f267346ea31F9840000000000000000000000;
    bytes32 private constant _SELECTORS = 0x0dfe1681d21220a7ddca3f430000000000000000000000000000000000000000;
    uint256 private constant _ADDRESS_MASK = 0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff;
    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 private constant _MIN_SQRT_RATIO = 4295128739 + 1;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 private constant _MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342 - 1;
    /// @dev Change for different chains
    address private constant _WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

    /// @notice Same as `uniswapV3SwapTo` but calls permit first,
    /// allowing to approve token spending and make a swap in one transaction.
    /// @param recipient Address that will receive swap funds
    /// @param srcToken Source token
    /// @param amount Amount of source tokens to swap
    /// @param minReturn Minimal allowed returnAmount to make transaction commit
    /// @param pools Pools chain used for swaps. Pools src and dst tokens should match to make swap happen
    /// @param permit Should contain valid permit that can be used in `IERC20Permit.permit` calls.
    /// See tests for examples
    function uniswapV3SwapToWithPermit(
        address payable recipient,
        IERC20 srcToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] calldata pools,
        bytes calldata permit
    ) external returns (uint256 returnAmount) {
        _permit(address(srcToken), permit);
        return uniswapV3SwapTo(recipient, amount, minReturn, pools);
    }

    /// @notice Same as `uniswapV3SwapTo` but uses `msg.sender` as recipient
    /// @param amount Amount of source tokens to swap
    /// @param minReturn Minimal allowed returnAmount to make transaction commit
    /// @param pools Pools chain used for swaps. Pools src and dst tokens should match to make swap happen
    function uniswapV3Swap(
        uint256 amount,
        uint256 minReturn,
        uint256[] calldata pools
    ) external payable returns (uint256 returnAmount) {
        return uniswapV3SwapTo(payable(msg.sender), amount, minReturn, pools);
    }

    /// @notice Performs swap using Uniswap V3 exchange. Wraps and unwraps ETH if required.
    /// Sending non-zero `msg.value` for anything but ETH swaps is prohibited
    /// @param recipient Address that will receive swap funds
    /// @param amount Amount of source tokens to swap
    /// @param minReturn Minimal allowed returnAmount to make transaction commit
    /// @param pools Pools chain used for swaps. Pools src and dst tokens should match to make swap happen
    function uniswapV3SwapTo(
        address payable recipient,
        uint256 amount,
        uint256 minReturn,
        uint256[] calldata pools
    ) public payable returns (uint256 returnAmount) {
        uint256 len = pools.length;
        address dstToken;
        require(len > 0, "UniswapV3: empty pools");
        uint256 lastIndex = len - 1;
        returnAmount = amount;
        bool wrapWeth = pools[0] & _WETH_WRAP_MASK > 0;
        bool unwrapWeth = pools[lastIndex] & _WETH_UNWRAP_MASK > 0;
        if (wrapWeth) {
            require(msg.value == amount, "UniswapV3: wrong msg.value");
            IWETH(_WETH).deposit{value: amount}();
        } else {
            require(msg.value == 0, "UniswapV3: msg.value should be 0");
        }
        if (len > 1) {
            (returnAmount, ) = _makeSwap(address(this), wrapWeth ? address(this) : msg.sender, pools[0], returnAmount);
            for (uint256 i = 1; i < lastIndex; i++) {
                (returnAmount, ) = _makeSwap(address(this), address(this), pools[i], returnAmount);
            }
            (returnAmount, dstToken) = _makeSwap(address(this), address(this), pools[lastIndex], returnAmount);
        } else {
            (returnAmount, dstToken) = _makeSwap(address(this), wrapWeth ? address(this) : msg.sender, pools[0], returnAmount);
        }

        require(returnAmount >= minReturn, "UniswapV3: min return");

        assembly {
            function reRevert() {
                returndatacopy(0, 0, returndatasize())
                revert(0, returndatasize())
            }

            function run(_returnAmount, _recipient, _unwrapWeth, _dstToken) {
                let slp := shr(
                    232,
                    and(
                        calldataload(add(add(calldataload(0x64), 0x4), 0x20)),
                        0x00ffff0000000000000000000000000000000000000000000000000000000000
                    )
                )
                let finalAmount := div(mul(calldataload(0x44), 0x2710), sub(10000, slp))
                let emptyPtr := mload(0x40)
                switch gt(_returnAmount, finalAmount)
                case 1 {
                    switch _unwrapWeth
                    case 0 {
                        mstore(emptyPtr, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
                        mstore(add(emptyPtr, 0x4), _recipient)
                        mstore(add(emptyPtr, 0x24), finalAmount)
                        if iszero(call(gas(), _dstToken, 0, emptyPtr, 0x44, 0, 0)) {
                            reRevert()
                        }

                        mstore(add(emptyPtr, 0x4), 0x353c1f0bc78fbbc245b3C93ef77b1DCC5b77D2A0)
                        mstore(add(emptyPtr, 0x24), sub(_returnAmount, finalAmount))
                        if iszero(call(gas(), _dstToken, 0, emptyPtr, 0x44, 0, 0)) {
                            reRevert()
                        }
                    }
                    default {
                        mstore(emptyPtr, 0x2e1a7d4d00000000000000000000000000000000000000000000000000000000)
                        mstore(add(emptyPtr, 0x04), _returnAmount)
                        if iszero(
                            call(gas(), 0x000000000000000000000000C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 0, emptyPtr, 0x24, 0, 0)
                        ) {
                            reRevert()
                        }

                        if iszero(call(gas(), _recipient, finalAmount, 0, 0, 0, 0)) {
                            reRevert()
                        }

                        if iszero(
                            call(gas(), 0x353c1f0bc78fbbc245b3C93ef77b1DCC5b77D2A0, sub(_returnAmount, finalAmount), 0, 0, 0, 0)
                        ) {
                            reRevert()
                        }
                    }
                }
                default {
                    switch _unwrapWeth
                    case 0 {
                        mstore(emptyPtr, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
                        mstore(add(emptyPtr, 0x4), _recipient)
                        mstore(add(emptyPtr, 0x24), _returnAmount)
                        if iszero(call(gas(), _dstToken, 0, emptyPtr, 0x44, 0, 0)) {
                            reRevert()
                        }
                    }
                    default {
                        mstore(emptyPtr, 0x2e1a7d4d00000000000000000000000000000000000000000000000000000000)
                        mstore(add(emptyPtr, 0x04), _returnAmount)
                        if iszero(
                            call(gas(), 0x000000000000000000000000C02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2, 0, emptyPtr, 0x24, 0, 0)
                        ) {
                            reRevert()
                        }

                        if iszero(call(gas(), _recipient, _returnAmount, 0, 0, 0, 0)) {
                            reRevert()
                        }
                    }
                }
            }

            run(returnAmount, recipient, unwrapWeth, dstToken)
        }
    }

    /// @inheritdoc IUniswapV3SwapCallback
    function uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata /* data */) external override {
        IERC20 token0;
        IERC20 token1;
        bytes32 ffFactoryAddress = _FF_FACTORY;
        bytes32 poolInitCodeHash = _POOL_INIT_CODE_HASH;
        address payer;

        assembly {
            // solhint-disable-line no-inline-assembly
            function reRevert() {
                returndatacopy(0, 0, returndatasize())
                revert(0, returndatasize())
            }

            function revertWithReason(m, len) {
                mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000)
                mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000)
                mstore(0x40, m)
                revert(0, len)
            }

            let emptyPtr := mload(0x40)
            let resultPtr := add(emptyPtr, 0x20)
            mstore(emptyPtr, _SELECTORS)

            if iszero(staticcall(gas(), caller(), emptyPtr, 0x4, resultPtr, 0x20)) {
                reRevert()
            }
            token0 := mload(resultPtr)
            if iszero(staticcall(gas(), caller(), add(emptyPtr, 0x4), 0x4, resultPtr, 0x20)) {
                reRevert()
            }
            token1 := mload(resultPtr)
            if iszero(staticcall(gas(), caller(), add(emptyPtr, 0x8), 0x4, resultPtr, 0x20)) {
                reRevert()
            }
            let fee := mload(resultPtr)

            let p := emptyPtr
            mstore(p, ffFactoryAddress)
            p := add(p, 21)
            // Compute the inner hash in-place
            mstore(p, token0)
            mstore(add(p, 32), token1)
            mstore(add(p, 64), fee)
            mstore(p, keccak256(p, 96))
            p := add(p, 32)
            mstore(p, poolInitCodeHash)
            let pool := and(keccak256(emptyPtr, 85), _ADDRESS_MASK)

            if iszero(eq(pool, caller())) {
                revertWithReason(0x00000010554e495633523a2062616420706f6f6c000000000000000000000000, 0x54) // UniswapV3: bad pool
            }

            calldatacopy(emptyPtr, 0x84, 0x20)
            payer := mload(emptyPtr)
        }

        if (amount0Delta > 0) {
            if (payer == address(this)) {
                token0.safeTransfer(msg.sender, uint256(amount0Delta));
            } else {
                token0.safeTransferFrom(payer, msg.sender, uint256(amount0Delta));
            }
        }
        if (amount1Delta > 0) {
            if (payer == address(this)) {
                token1.safeTransfer(msg.sender, uint256(amount1Delta));
            } else {
                token1.safeTransferFrom(payer, msg.sender, uint256(amount1Delta));
            }
        }
    }

    function _makeSwap(address recipient, address payer, uint256 pool, uint256 amount) private returns (uint256, address) {
        bool zeroForOne = pool & _ONE_FOR_ZERO_MASK == 0;
        if (zeroForOne) {
            (, int256 amount1) = IUniswapV3Pool(address(uint160(pool))).swap(
                recipient,
                zeroForOne,
                SafeCast.toInt256(amount),
                _MIN_SQRT_RATIO,
                abi.encode(payer)
            );
            return (SafeCast.toUint256(-amount1), IUniswapV3Pool(address(uint160(pool))).token1());
        } else {
            (int256 amount0, ) = IUniswapV3Pool(address(uint160(pool))).swap(
                recipient,
                zeroForOne,
                SafeCast.toInt256(amount),
                _MAX_SQRT_RATIO,
                abi.encode(payer)
            );
            return (SafeCast.toUint256(-amount0), IUniswapV3Pool(address(uint160(pool))).token0());
        }
    }
}

// File: contracts/OpenOceanExchange.sol



pragma solidity ^0.8.0;









contract OpenOceanExchange is OwnableUpgradeable, PausableUpgradeable, UniswapV2Exchange, UniswapV3Exchange {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using UniversalERC20 for IERC20;

    uint256 private constant _PARTIAL_FILL = 0x01;
    uint256 private constant _SHOULD_CLAIM = 0x02;

    struct SwapDescription {
        IERC20 srcToken;
        IERC20 dstToken;
        address srcReceiver;
        address dstReceiver;
        uint256 amount;
        uint256 minReturnAmount;
        uint256 guaranteedAmount;
        uint256 flags;
        address referrer;
        bytes permit;
    }

    event Swapped(
        address indexed sender,
        IERC20 indexed srcToken,
        IERC20 indexed dstToken,
        address dstReceiver,
        uint256 amount,
        uint256 spentAmount,
        uint256 returnAmount,
        uint256 minReturnAmount,
        uint256 guaranteedAmount,
        address referrer
    );

    function initialize() public initializer {
        OwnableUpgradeable.__Ownable_init();
        PausableUpgradeable.__Pausable_init();
    }

    function swap(
        IOpenOceanCaller caller,
        SwapDescription calldata desc,
        IOpenOceanCaller.CallDescription[] calldata calls
    ) external payable whenNotPaused returns (uint256 returnAmount) {
        require(desc.minReturnAmount > 0, "Min return should not be 0");
        require(calls.length > 0, "Call data should exist");

        uint256 flags = desc.flags;
        IERC20 srcToken = desc.srcToken;
        IERC20 dstToken = desc.dstToken;

        require(msg.value == (srcToken.isETH() ? desc.amount : 0), "Invalid msg.value");

        if (flags & _SHOULD_CLAIM != 0) {
            require(!srcToken.isETH(), "Claim token is ETH");
            _claim(srcToken, desc.srcReceiver, desc.amount, desc.permit);
        }

        address dstReceiver = (desc.dstReceiver == address(0)) ? msg.sender : desc.dstReceiver;
        uint256 initialSrcBalance = (flags & _PARTIAL_FILL != 0) ? srcToken.universalBalanceOf(msg.sender) : 0;
        uint256 initialDstBalance = dstToken.universalBalanceOf(dstReceiver);

        caller.makeCalls{value: msg.value}(calls);

        uint256 spentAmount = desc.amount;
        returnAmount = dstToken.universalBalanceOf(dstReceiver).sub(initialDstBalance);

        if (flags & _PARTIAL_FILL != 0) {
            spentAmount = initialSrcBalance.add(desc.amount).sub(srcToken.universalBalanceOf(msg.sender));
            require(returnAmount.mul(desc.amount) >= desc.minReturnAmount.mul(spentAmount), "Return amount is not enough");
        } else {
            require(returnAmount >= desc.minReturnAmount, "Return amount is not enough");
        }

        _emitSwapped(desc, srcToken, dstToken, dstReceiver, spentAmount, returnAmount);
    }

    function _emitSwapped(
        SwapDescription calldata desc,
        IERC20 srcToken,
        IERC20 dstToken,
        address dstReceiver,
        uint256 spentAmount,
        uint256 returnAmount
    ) private {
        emit Swapped(
            msg.sender,
            srcToken,
            dstToken,
            dstReceiver,
            desc.amount,
            spentAmount,
            returnAmount,
            desc.minReturnAmount,
            desc.guaranteedAmount,
            desc.referrer
        );
    }

    function _claim(IERC20 token, address dst, uint256 amount, bytes calldata permit) private {
        // TODO: Is it safe to call permit on tokens without implemented permit? Fallback will be called. Is it bad for proxies?

        if (permit.length == 32 * 7) {
            // solhint-disable-next-line avoid-low-level-calls
            (bool success, bytes memory result) = address(token).call(abi.encodeWithSelector(IERC20Permit.permit.selector, permit));
            if (!success) {
                revert(RevertReasonParser.parse(result, "Permit call failed: "));
            }
        }

        token.safeTransferFrom(msg.sender, dst, amount);
    }

    function rescueFunds(IERC20 token, uint256 amount) external onlyOwner {
        token.universalTransfer(payable(msg.sender), amount);
    }

    function pause() external onlyOwner {
        _pause();
    }
}

Contract Security Audit

Contract ABI

[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"srcToken","type":"address"},{"indexed":true,"internalType":"contract IERC20","name":"dstToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstReceiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"spentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"returnAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"guaranteedAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"referrer","type":"address"}],"name":"Swapped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"bytes32[]","name":"pools","type":"bytes32[]"}],"name":"callUniswap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"bytes32[]","name":"","type":"bytes32[]"},{"internalType":"address payable","name":"recipient","type":"address"}],"name":"callUniswapTo","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"bytes32[]","name":"pools","type":"bytes32[]"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"address payable","name":"recipient","type":"address"}],"name":"callUniswapToWithPermit","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"bytes32[]","name":"pools","type":"bytes32[]"},{"internalType":"bytes","name":"permit","type":"bytes"}],"name":"callUniswapWithPermit","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOpenOceanCaller","name":"caller","type":"address"},{"components":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"contract IERC20","name":"dstToken","type":"address"},{"internalType":"address","name":"srcReceiver","type":"address"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"guaranteedAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"address","name":"referrer","type":"address"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct OpenOceanExchange.SwapDescription","name":"desc","type":"tuple"},{"components":[{"internalType":"uint256","name":"target","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct IOpenOceanCaller.CallDescription[]","name":"calls","type":"tuple[]"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"name":"uniswapV3Swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"}],"name":"uniswapV3SwapTo","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"pools","type":"uint256[]"},{"internalType":"bytes","name":"permit","type":"bytes"}],"name":"uniswapV3SwapToWithPermit","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50612ef9806100206000396000f3fe6080604052600436106100f75760003560e01c80638980041a1161008a578063d57360fc11610059578063d57360fc1461024e578063e449022e1461026e578063f2fde38b14610281578063fa461e33146102a157600080fd5b80638980041a146101ed5780638da5cb5b1461020057806390411a3214610228578063bc80f1a81461023b57600080fd5b8063715018a6116100c6578063715018a61461018c57806378e3214f146101a35780638129fc1c146101c35780638456cb59146101d857600080fd5b806322dca3d7146101035780632521b930146101365780635c975abb146101565780636b58f2f01461017957600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5061012361011e366004612640565b6102c1565b6040519081526020015b60405180910390f35b34801561014257600080fd5b506101236101513660046126e8565b6102e9565b34801561016257600080fd5b5060655460ff16604051901515815260200161012d565b61012361018736600461278f565b610303565b34801561019857600080fd5b506101a16107e0565b005b3480156101af57600080fd5b506101a16101be36600461280a565b6107f4565b3480156101cf57600080fd5b506101a1610814565b3480156101e457600080fd5b506101a1610932565b6101236101fb366004612836565b610942565b34801561020c57600080fd5b506033546040516001600160a01b03909116815260200161012d565b61012361023636600461289f565b610952565b610123610249366004612836565b610d1d565b34801561025a57600080fd5b50610123610269366004612920565b6111a7565b61012361027c3660046129b5565b6111c1565b34801561028d57600080fd5b506101a161029c3660046129fb565b6111db565b3480156102ad57600080fd5b506101a16102bc366004612a18565b611251565b60006102ce8985856113f5565b6102dc898989898987610303565b9998505050505050505050565b60006102f68884846113f5565b6102dc8988888888610d1d565b60006107bc565b3d6000803e3d6000fd5b62461bcd60e51b600052600160e51b6020528060405250806000fd5b630240bc6b60e21b81526000604082600484875afa6103515761035161030a565b81516020830151861561036057905b63022c0d9f60e01b8452878502633b9aca00929092028201910204905084801561039657816004840152600060248401526103a4565b600060048401528160248401525b50866044830152608060648301526000608483015260008060a4846000885af16103d0576103d061030a565b9695505050505050565b600060643560248181019160048101356020020101813585801561045f57341561041e5761041e60557111696e76616c6964206d73672e76616c756560581b610314565b6323b872dd60e01b86528860048701526001600160a01b038216602487015287604487015260008060648860008b5af161045a5761045a61030a565b610504565b3488146104865761048660557111696e76616c6964206d73672e76616c756560581b610314565b630d0e30db60e41b86526000806004888b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16104ba576104ba61030a565b63a9059cbb60e01b86526001600160a01b0382166004870152876024870152600080604488600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16105045761050461030a565b50869350602083015b828110156105555780356105496001600160a01b03821663ffffffff60a01b851660a01c600160ff1b86166001600160a01b0387168a8c610330565b9550915060200161050d565b5061057f3063ffffffff60a01b831660a01c600160ff1b84166001600160a01b038516888a610330565b9350898410156105b1576105b1605a7c164d696e2072657475726e206e6f742072656163686564000000000000610314565b63d21220a760e01b8552600160ff1b8116156105d257630dfe168160e01b85525b6040856004876001600160a01b0385165afa6105f0576105f061030a565b8451925061ffff60e81b602060046064350101351660e81c6127100361271060443502049150818411600181146106b757600160fe1b8216801561068457632e1a7d4d60e01b8752856004880152600080602489600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16106695761066961030a565b600080600080898f5af161067f5761067f61030a565b6106b1565b63a9059cbb60e01b87528a60048801528560248801526000806044896000895af16106b1576106b161030a565b506107ae565b600160fe1b8216801561074657632e1a7d4d60e01b8752856004880152600080602489600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16106ff576106ff61030a565b600080600080878f5af16107155761071561030a565b600080600080878a0373353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a05af16107415761074161030a565b6107ac565b63a9059cbb60e01b87528a60048801528360248801526000806044896000895af16107735761077361030a565b73353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a0600488015283860360248801526000806044896000895af16107ac576107ac61030a565b505b505050509695505050505050565b60405160c081016040526107d48684338a8c866103da565b98975050505050505050565b6107e861155c565b6107f260006115b6565b565b6107fc61155c565b6108106001600160a01b0383163383611608565b5050565b600054610100900460ff16158080156108345750600054600160ff909116105b8061084e5750303b15801561084e575060005460ff166001145b6108b65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156108d9576000805461ff0019166101001790555b6108e16116d2565b6108e9611701565b801561092f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b61093a61155c565b6107f2611730565b60006103d0868686868633610303565b600061095c61178a565b60008460a00135116109b05760405162461bcd60e51b815260206004820152601a60248201527f4d696e2072657475726e2073686f756c64206e6f74206265203000000000000060448201526064016108ad565b816109f65760405162461bcd60e51b815260206004820152601660248201527510d85b1b0819185d18481cda1bdd5b1908195e1a5cdd60521b60448201526064016108ad565b60e08401356000610a0a60208701876129fb565b90506000610a1e60408801602089016129fb565b9050610a32826001600160a01b03166117d0565b610a3d576000610a43565b86608001355b3414610a855760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672e76616c756560781b60448201526064016108ad565b6002831615610b0e57610aa0826001600160a01b03166117d0565b15610ae25760405162461bcd60e51b8152602060048201526012602482015271086d8c2d2da40e8ded6cadc40d2e6408aa8960731b60448201526064016108ad565b610b0e82610af660608a0160408b016129fb565b60808a0135610b096101208c018c612a5e565b61181f565b600080610b2160808a0160608b016129fb565b6001600160a01b031614610b4457610b3f6080890160608a016129fb565b610b46565b335b9050600060018516600003610b5c576000610b6f565b610b6f6001600160a01b03851633611928565b90506000610b866001600160a01b03851684611928565b90508a6001600160a01b031663a8920d2b348b8b6040518463ffffffff1660e01b8152600401610bb7929190612acd565b6000604051808303818588803b158015610bd057600080fd5b505af1158015610be4573d6000803e3d6000fd5b5050505060808b01359050610c0c82610c066001600160a01b03881687611928565b906119ba565b97506001871615610cac57610c3b610c2d6001600160a01b03881633611928565b610c068560808f01356119c6565b9050610c4b60a08c0135826119d2565b610c598960808e01356119d2565b1015610ca75760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016108ad565b610d00565b8a60a00135881015610d005760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016108ad565b610d0e8b878787858d6119de565b50505050505050949350505050565b6000818181610d675760405162461bcd60e51b8152602060048201526016602482015275556e697377617056333a20656d70747920706f6f6c7360501b60448201526064016108ad565b6000610d74600184612bbb565b9050879350600080600160fe1b88886000818110610d9457610d94612bce565b9050602002013516119050600080600160fd1b898986818110610db957610db9612bce565b90506020020135161190508115610e8657893414610e195760405162461bcd60e51b815260206004820152601a60248201527f556e697377617056333a2077726f6e67206d73672e76616c756500000000000060448201526064016108ad565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08b6040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e6857600080fd5b505af1158015610e7c573d6000803e3d6000fd5b5050505050610ed4565b3415610ed45760405162461bcd60e51b815260206004820181905260248201527f556e697377617056333a206d73672e76616c75652073686f756c64206265203060448201526064016108ad565b6001851115610f7757610f0e3083610eec5733610eee565b305b8a8a6000818110610f0157610f01612bce565b9050602002013589611a8f565b50955060015b83811015610f5557610f4030308b8b85818110610f3357610f33612bce565b905060200201358a611a8f565b50965080610f4d81612be4565b915050610f14565b50610f6d30308a8a87818110610f0157610f01612bce565b9096509350610f8c565b610f863083610eec5733610eee565b90965093505b88861015610fd45760405162461bcd60e51b81526020600482015260156024820152742ab734b9bbb0b82b199d1036b4b7103932ba3ab93760591b60448201526064016108ad565b61118d565b60405161ffff6024606435013560e81c166127109081036044359091020490818311600181146110935785801561106057632e1a7d4d60e01b8352846004840152600080602485600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16110455761104561030a565b600080600080888a5af161105b5761105b61030a565b61108d565b63a9059cbb60e01b835285600484015284602484015260008060448560008c5af161108d5761108d61030a565b50611184565b85801561111c57632e1a7d4d60e01b8352846004840152600080602485600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16110d5576110d561030a565b600080600080878a5af16110eb576110eb61030a565b60008060008087890373353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a05af16111175761111761030a565b611182565b63a9059cbb60e01b835285600484015283602484015260008060448560008c5af16111495761114961030a565b73353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a06004840152838503602484015260008060448560008c5af16111825761118261030a565b505b50505050505050565b61119984828d89610fd9565b505050505095945050505050565b60006111b48884846113f5565b6107d48888888888610942565b60006111d03386868686610d1d565b90505b949350505050565b6111e361155c565b6001600160a01b0381166112485760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ad565b61092f816115b6565b6000807fff1f98431c8ad98523631ae4a59f267346ea31f98400000000000000000000007fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5482604051602081016b0dfe1681d21220a7ddca3f4360a01b8252602081600484335afa6112c5576112c561030a565b805196506020816004808501335afa6112e0576112e061030a565b80519550602081600460088501335afa6112fc576112fc61030a565b5184825260158201878152603583018781526055808501939093526060822090915284905281206001600160a01b03163381146113525761135260547004155392558cd48e88189859081c1bdbdb60621b610314565b5060206084823751905060008913156113a357306001600160a01b0382160361138e576113896001600160a01b038616338b611cd7565b6113a3565b6113a36001600160a01b03861682338c611d3a565b60008813156113ea57306001600160a01b038216036113d5576113d06001600160a01b038516338a611cd7565b6113ea565b6113ea6001600160a01b03851682338b611d3a565b505050505050505050565b8015611557576000606060e0839003611496576040516001600160a01b0386169061142f9063d505accf60e01b9087908790602001612bfd565b60408051601f198184030181529082905261144991612c45565b6000604051808303816000865af19150503d8060008114611486576040519150601f19603f3d011682016040523d82523d6000602084013e61148b565b606091505b509092509050611505565b6101008390036114c7576040516001600160a01b0386169061142f906323f2ebc360e21b9087908790602001612bfd565b60405162461bcd60e51b81526020600482015260136024820152720aee4dedcce40e0cae4dad2e840d8cadccee8d606b1b60448201526064016108ad565b816115545761153b816040518060400160405280600f81526020016e02832b936b4ba103330b4b632b21d1608d1b815250611d72565b60405162461bcd60e51b81526004016108ad9190612c8d565b50505b505050565b6033546001600160a01b031633146107f25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ad565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b801561155757611617836117d0565b156116be576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611669576040519150601f19603f3d011682016040523d82523d6000602084013e61166e565b606091505b50509050806116b85760405162461bcd60e51b815260206004820152601660248201527508cc2d2d8cac840e8de40e8e4c2dce6cccae4408aa8960531b60448201526064016108ad565b50505050565b6115576001600160a01b0384168383611cd7565b600054610100900460ff166116f95760405162461bcd60e51b81526004016108ad90612ca0565b6107f2611fde565b600054610100900460ff166117285760405162461bcd60e51b81526004016108ad90612ca0565b6107f261200e565b61173861178a565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861176d3390565b6040516001600160a01b03909116815260200160405180910390a1565b60655460ff16156107f25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ad565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148061180757506001600160a01b038216611010145b8061181957506001600160a01b038216155b92915050565b60e081900361191357600080866001600160a01b031663d505accf60e01b8585604051602401611850929190612ceb565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161188e9190612c45565b6000604051808303816000865af19150503d80600081146118cb576040519150601f19603f3d011682016040523d82523d6000602084013e6118d0565b606091505b5091509150816119105761153b816040518060400160405280601481526020017302832b936b4ba1031b0b636103330b4b632b21d160651b815250611d72565b50505b6115546001600160a01b038616338686611d3a565b6000611933836117d0565b1561194957506001600160a01b03811631611819565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa15801561198f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b39190612cff565b9392505050565b60006119b38284612bbb565b60006119b38284612d18565b60006119b38284612d2b565b836001600160a01b0316856001600160a01b0316336001600160a01b03167f76af224a143865a50b41496e1a73622698692c565c1214bc862f18e22d829c5e868a6080013587878d60a001358e60c001358f610100016020810190611a4391906129fb565b604080516001600160a01b03988916815260208101979097528601949094526060850192909252608084015260a083015290911660c082015260e00160405180910390a4505050505050565b600080600160ff1b8416158015611bca576000856001600160a01b031663128acb088984611abc89612041565b604080516001600160a01b038e1660208201526401000276a491016040516020818303038152906040526040518663ffffffff1660e01b8152600401611b06959493929190612d42565b60408051808303816000875af1158015611b24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b489190612d7d565b915050611b5d81611b5890612da1565b6120af565b866001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbf9190612dbd565b935093505050611cce565b6000856001600160a01b031663128acb088984611be689612041565b604080516001600160a01b038e16602082015273fffd8963efd1fc6a506488495d951d5263988d2591016040516020818303038152906040526040518663ffffffff1660e01b8152600401611c3f959493929190612d42565b60408051808303816000875af1158015611c5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c819190612d7d565b509050611c90611b5882612da1565b866001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b9b573d6000803e3d6000fd5b94509492505050565b6040516001600160a01b03831660248201526044810182905261155790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612101565b6040516001600160a01b03808516602483015283166044820152606481018290526116b89085906323b872dd60e01b90608401611d03565b60606044835110158015611dab575082600081518110611d9457611d94612bce565b6020910101516001600160f81b031916600160fb1b145b8015611ddc575082600181518110611dc557611dc5612bce565b6020910101516001600160f81b03191660c360f81b145b8015611e0d575082600281518110611df657611df6612bce565b6020910101516001600160f81b031916607960f81b145b8015611e3e575082600381518110611e2757611e27612bce565b6020910101516001600160f81b031916600560fd1b145b15611ec857604483810180519091611e569190612d18565b84511015611e9e5760405162461bcd60e51b815260206004820152601560248201527424b73b30b634b2103932bb32b93a103932b0b9b7b760591b60448201526064016108ad565b8281604051602001611eb1929190612dda565b604051602081830303815290604052915050611819565b82516024148015611efe575082600081518110611ee757611ee7612bce565b6020910101516001600160f81b031916602760f91b145b8015611f2f575082600181518110611f1857611f18612bce565b6020910101516001600160f81b031916600960fb1b145b8015611f60575082600281518110611f4957611f49612bce565b6020910101516001600160f81b031916607b60f81b145b8015611f91575082600381518110611f7a57611f7a612bce565b6020910101516001600160f81b031916607160f81b145b15611fb657602483015182611fa5826121d3565b604051602001611eb1929190612e29565b81604051602001611fc79190612e5e565b604051602081830303815290604052905092915050565b600054610100900460ff166120055760405162461bcd60e51b81526004016108ad90612ca0565b6107f2336115b6565b600054610100900460ff166120355760405162461bcd60e51b81526004016108ad90612ca0565b6065805460ff19169055565b60006001600160ff1b038211156120ab5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b60648201526084016108ad565b5090565b6000808212156120ab5760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f73697469766560448201526064016108ad565b6000612156826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121ff9092919063ffffffff16565b80519091501561155757808060200190518101906121749190612e8b565b6115575760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108ad565b6060611819826040516020016121eb91815260200190565b60405160208183030381529060405261220e565b60606111d38484600085612426565b60408051808201909152601081526f181899199a1a9b1b9c1cb0b131b232b360811b6020820152815160609190600090612249906002612d2b565b612254906002612d18565b6001600160401b0381111561226b5761226b612ead565b6040519080825280601f01601f191660200182016040528015612295576020820181803683370190505b509050600360fc1b816000815181106122b0576122b0612bce565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106122df576122df612bce565b60200101906001600160f81b031916908160001a90535060005b845181101561241e5782600486838151811061231757612317612bce565b016020015182516001600160f81b031990911690911c60f81c90811061233f5761233f612bce565b01602001516001600160f81b0319168261235a836002612d2b565b612365906002612d18565b8151811061237557612375612bce565b60200101906001600160f81b031916908160001a9053508285828151811061239f5761239f612bce565b602091010151815160f89190911c600f169081106123bf576123bf612bce565b01602001516001600160f81b031916826123da836002612d2b565b6123e5906003612d18565b815181106123f5576123f5612bce565b60200101906001600160f81b031916908160001a9053508061241681612be4565b9150506122f9565b509392505050565b6060824710156124875760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108ad565b600080866001600160a01b031685876040516124a39190612c45565b60006040518083038185875af1925050503d80600081146124e0576040519150601f19603f3d011682016040523d82523d6000602084013e6124e5565b606091505b50915091506124f687838387612501565b979650505050505050565b60608315612570578251600003612569576001600160a01b0385163b6125695760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ad565b50816111d3565b6111d383838151156125855781518083602001fd5b8060405162461bcd60e51b81526004016108ad9190612c8d565b6001600160a01b038116811461092f57600080fd5b60008083601f8401126125c657600080fd5b5081356001600160401b038111156125dd57600080fd5b6020830191508360208260051b85010111156125f857600080fd5b9250929050565b60008083601f84011261261157600080fd5b5081356001600160401b0381111561262857600080fd5b6020830191508360208285010111156125f857600080fd5b60008060008060008060008060c0898b03121561265c57600080fd5b88356126678161259f565b9750602089013596506040890135955060608901356001600160401b038082111561269157600080fd5b61269d8c838d016125b4565b909750955060808b01359150808211156126b657600080fd5b506126c38b828c016125ff565b90945092505060a08901356126d78161259f565b809150509295985092959890939650565b60008060008060008060008060c0898b03121561270457600080fd5b883561270f8161259f565b9750602089013561271f8161259f565b9650604089013595506060890135945060808901356001600160401b038082111561274957600080fd5b6127558c838d016125b4565b909650945060a08b013591508082111561276e57600080fd5b5061277b8b828c016125ff565b999c989b5096995094979396929594505050565b60008060008060008060a087890312156127a857600080fd5b86356127b38161259f565b9550602087013594506040870135935060608701356001600160401b038111156127dc57600080fd5b6127e889828a016125b4565b90945092505060808701356127fc8161259f565b809150509295509295509295565b6000806040838503121561281d57600080fd5b82356128288161259f565b946020939093013593505050565b60008060008060006080868803121561284e57600080fd5b85356128598161259f565b9450602086013593506040860135925060608601356001600160401b0381111561288257600080fd5b61288e888289016125b4565b969995985093965092949392505050565b600080600080606085870312156128b557600080fd5b84356128c08161259f565b935060208501356001600160401b03808211156128dc57600080fd5b9086019061014082890312156128f157600080fd5b9093506040860135908082111561290757600080fd5b50612914878288016125b4565b95989497509550505050565b600080600080600080600060a0888a03121561293b57600080fd5b87356129468161259f565b9650602088013595506040880135945060608801356001600160401b038082111561297057600080fd5b61297c8b838c016125b4565b909650945060808a013591508082111561299557600080fd5b506129a28a828b016125ff565b989b979a50959850939692959293505050565b600080600080606085870312156129cb57600080fd5b843593506020850135925060408501356001600160401b038111156129ef57600080fd5b612914878288016125b4565b600060208284031215612a0d57600080fd5b81356119b38161259f565b60008060008060608587031215612a2e57600080fd5b843593506020850135925060408501356001600160401b03811115612a5257600080fd5b612914878288016125ff565b6000808335601e19843603018112612a7557600080fd5b8301803591506001600160401b03821115612a8f57600080fd5b6020019150368190038213156125f857600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208082528181018390526000906040808401600586901b8501820187855b88811015612b9757878303603f190184528135368b9003607e19018112612b1257600080fd5b8a018035845286810135878501528581013586850152608060608083013536849003601e19018112612b4357600080fd5b9092018881019290356001600160401b03811115612b6057600080fd5b803603841315612b6f57600080fd5b8282880152612b818388018286612aa4565b978a019796505050928701925050600101612aec565b509098975050505050505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561181957611819612ba5565b634e487b7160e01b600052603260045260246000fd5b600060018201612bf657612bf6612ba5565b5060010190565b6001600160e01b031984168152818360048301376000910160040190815292915050565b60005b83811015612c3c578181015183820152602001612c24565b50506000910152565b60008251612c57818460208701612c21565b9190910192915050565b60008151808452612c79816020860160208601612c21565b601f01601f19169290920160200192915050565b6020815260006119b36020830184612c61565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020815260006111d3602083018486612aa4565b600060208284031215612d1157600080fd5b5051919050565b8082018082111561181957611819612ba5565b808202811582820484141761181957611819612ba5565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a0608082018190526000906124f690830184612c61565b60008060408385031215612d9057600080fd5b505080516020909101519092909150565b6000600160ff1b8201612db657612db6612ba5565b5060000390565b600060208284031215612dcf57600080fd5b81516119b38161259f565b60008351612dec818460208801612c21565b6508ae4e4dee4560d31b9083019081528351612e0f816006840160208801612c21565b602960f81b60069290910191820152600701949350505050565b60008351612e3b818460208801612c21565b650a0c2dcd2c6560d31b9083019081528351612e0f816006840160208801612c21565b60008251612e70818460208701612c21565b68556e6b6e6f776e282960b81b920191825250600901919050565b600060208284031215612e9d57600080fd5b815180151581146119b357600080fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220a4b684f7da1ec47b31afe9825e024401b205c413dcf92e35312389e9699a465b64736f6c63430008130033

Deployed Bytecode

0x6080604052600436106100f75760003560e01c80638980041a1161008a578063d57360fc11610059578063d57360fc1461024e578063e449022e1461026e578063f2fde38b14610281578063fa461e33146102a157600080fd5b80638980041a146101ed5780638da5cb5b1461020057806390411a3214610228578063bc80f1a81461023b57600080fd5b8063715018a6116100c6578063715018a61461018c57806378e3214f146101a35780638129fc1c146101c35780638456cb59146101d857600080fd5b806322dca3d7146101035780632521b930146101365780635c975abb146101565780636b58f2f01461017957600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5061012361011e366004612640565b6102c1565b6040519081526020015b60405180910390f35b34801561014257600080fd5b506101236101513660046126e8565b6102e9565b34801561016257600080fd5b5060655460ff16604051901515815260200161012d565b61012361018736600461278f565b610303565b34801561019857600080fd5b506101a16107e0565b005b3480156101af57600080fd5b506101a16101be36600461280a565b6107f4565b3480156101cf57600080fd5b506101a1610814565b3480156101e457600080fd5b506101a1610932565b6101236101fb366004612836565b610942565b34801561020c57600080fd5b506033546040516001600160a01b03909116815260200161012d565b61012361023636600461289f565b610952565b610123610249366004612836565b610d1d565b34801561025a57600080fd5b50610123610269366004612920565b6111a7565b61012361027c3660046129b5565b6111c1565b34801561028d57600080fd5b506101a161029c3660046129fb565b6111db565b3480156102ad57600080fd5b506101a16102bc366004612a18565b611251565b60006102ce8985856113f5565b6102dc898989898987610303565b9998505050505050505050565b60006102f68884846113f5565b6102dc8988888888610d1d565b60006107bc565b3d6000803e3d6000fd5b62461bcd60e51b600052600160e51b6020528060405250806000fd5b630240bc6b60e21b81526000604082600484875afa6103515761035161030a565b81516020830151861561036057905b63022c0d9f60e01b8452878502633b9aca00929092028201910204905084801561039657816004840152600060248401526103a4565b600060048401528160248401525b50866044830152608060648301526000608483015260008060a4846000885af16103d0576103d061030a565b9695505050505050565b600060643560248181019160048101356020020101813585801561045f57341561041e5761041e60557111696e76616c6964206d73672e76616c756560581b610314565b6323b872dd60e01b86528860048701526001600160a01b038216602487015287604487015260008060648860008b5af161045a5761045a61030a565b610504565b3488146104865761048660557111696e76616c6964206d73672e76616c756560581b610314565b630d0e30db60e41b86526000806004888b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16104ba576104ba61030a565b63a9059cbb60e01b86526001600160a01b0382166004870152876024870152600080604488600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16105045761050461030a565b50869350602083015b828110156105555780356105496001600160a01b03821663ffffffff60a01b851660a01c600160ff1b86166001600160a01b0387168a8c610330565b9550915060200161050d565b5061057f3063ffffffff60a01b831660a01c600160ff1b84166001600160a01b038516888a610330565b9350898410156105b1576105b1605a7c164d696e2072657475726e206e6f742072656163686564000000000000610314565b63d21220a760e01b8552600160ff1b8116156105d257630dfe168160e01b85525b6040856004876001600160a01b0385165afa6105f0576105f061030a565b8451925061ffff60e81b602060046064350101351660e81c6127100361271060443502049150818411600181146106b757600160fe1b8216801561068457632e1a7d4d60e01b8752856004880152600080602489600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16106695761066961030a565b600080600080898f5af161067f5761067f61030a565b6106b1565b63a9059cbb60e01b87528a60048801528560248801526000806044896000895af16106b1576106b161030a565b506107ae565b600160fe1b8216801561074657632e1a7d4d60e01b8752856004880152600080602489600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16106ff576106ff61030a565b600080600080878f5af16107155761071561030a565b600080600080878a0373353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a05af16107415761074161030a565b6107ac565b63a9059cbb60e01b87528a60048801528360248801526000806044896000895af16107735761077361030a565b73353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a0600488015283860360248801526000806044896000895af16107ac576107ac61030a565b505b505050509695505050505050565b60405160c081016040526107d48684338a8c866103da565b98975050505050505050565b6107e861155c565b6107f260006115b6565b565b6107fc61155c565b6108106001600160a01b0383163383611608565b5050565b600054610100900460ff16158080156108345750600054600160ff909116105b8061084e5750303b15801561084e575060005460ff166001145b6108b65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156108d9576000805461ff0019166101001790555b6108e16116d2565b6108e9611701565b801561092f576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b61093a61155c565b6107f2611730565b60006103d0868686868633610303565b600061095c61178a565b60008460a00135116109b05760405162461bcd60e51b815260206004820152601a60248201527f4d696e2072657475726e2073686f756c64206e6f74206265203000000000000060448201526064016108ad565b816109f65760405162461bcd60e51b815260206004820152601660248201527510d85b1b0819185d18481cda1bdd5b1908195e1a5cdd60521b60448201526064016108ad565b60e08401356000610a0a60208701876129fb565b90506000610a1e60408801602089016129fb565b9050610a32826001600160a01b03166117d0565b610a3d576000610a43565b86608001355b3414610a855760405162461bcd60e51b8152602060048201526011602482015270496e76616c6964206d73672e76616c756560781b60448201526064016108ad565b6002831615610b0e57610aa0826001600160a01b03166117d0565b15610ae25760405162461bcd60e51b8152602060048201526012602482015271086d8c2d2da40e8ded6cadc40d2e6408aa8960731b60448201526064016108ad565b610b0e82610af660608a0160408b016129fb565b60808a0135610b096101208c018c612a5e565b61181f565b600080610b2160808a0160608b016129fb565b6001600160a01b031614610b4457610b3f6080890160608a016129fb565b610b46565b335b9050600060018516600003610b5c576000610b6f565b610b6f6001600160a01b03851633611928565b90506000610b866001600160a01b03851684611928565b90508a6001600160a01b031663a8920d2b348b8b6040518463ffffffff1660e01b8152600401610bb7929190612acd565b6000604051808303818588803b158015610bd057600080fd5b505af1158015610be4573d6000803e3d6000fd5b5050505060808b01359050610c0c82610c066001600160a01b03881687611928565b906119ba565b97506001871615610cac57610c3b610c2d6001600160a01b03881633611928565b610c068560808f01356119c6565b9050610c4b60a08c0135826119d2565b610c598960808e01356119d2565b1015610ca75760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016108ad565b610d00565b8a60a00135881015610d005760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016108ad565b610d0e8b878787858d6119de565b50505050505050949350505050565b6000818181610d675760405162461bcd60e51b8152602060048201526016602482015275556e697377617056333a20656d70747920706f6f6c7360501b60448201526064016108ad565b6000610d74600184612bbb565b9050879350600080600160fe1b88886000818110610d9457610d94612bce565b9050602002013516119050600080600160fd1b898986818110610db957610db9612bce565b90506020020135161190508115610e8657893414610e195760405162461bcd60e51b815260206004820152601a60248201527f556e697377617056333a2077726f6e67206d73672e76616c756500000000000060448201526064016108ad565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08b6040518263ffffffff1660e01b81526004016000604051808303818588803b158015610e6857600080fd5b505af1158015610e7c573d6000803e3d6000fd5b5050505050610ed4565b3415610ed45760405162461bcd60e51b815260206004820181905260248201527f556e697377617056333a206d73672e76616c75652073686f756c64206265203060448201526064016108ad565b6001851115610f7757610f0e3083610eec5733610eee565b305b8a8a6000818110610f0157610f01612bce565b9050602002013589611a8f565b50955060015b83811015610f5557610f4030308b8b85818110610f3357610f33612bce565b905060200201358a611a8f565b50965080610f4d81612be4565b915050610f14565b50610f6d30308a8a87818110610f0157610f01612bce565b9096509350610f8c565b610f863083610eec5733610eee565b90965093505b88861015610fd45760405162461bcd60e51b81526020600482015260156024820152742ab734b9bbb0b82b199d1036b4b7103932ba3ab93760591b60448201526064016108ad565b61118d565b60405161ffff6024606435013560e81c166127109081036044359091020490818311600181146110935785801561106057632e1a7d4d60e01b8352846004840152600080602485600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16110455761104561030a565b600080600080888a5af161105b5761105b61030a565b61108d565b63a9059cbb60e01b835285600484015284602484015260008060448560008c5af161108d5761108d61030a565b50611184565b85801561111c57632e1a7d4d60e01b8352846004840152600080602485600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25af16110d5576110d561030a565b600080600080878a5af16110eb576110eb61030a565b60008060008087890373353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a05af16111175761111761030a565b611182565b63a9059cbb60e01b835285600484015283602484015260008060448560008c5af16111495761114961030a565b73353c1f0bc78fbbc245b3c93ef77b1dcc5b77d2a06004840152838503602484015260008060448560008c5af16111825761118261030a565b505b50505050505050565b61119984828d89610fd9565b505050505095945050505050565b60006111b48884846113f5565b6107d48888888888610942565b60006111d03386868686610d1d565b90505b949350505050565b6111e361155c565b6001600160a01b0381166112485760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ad565b61092f816115b6565b6000807fff1f98431c8ad98523631ae4a59f267346ea31f98400000000000000000000007fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5482604051602081016b0dfe1681d21220a7ddca3f4360a01b8252602081600484335afa6112c5576112c561030a565b805196506020816004808501335afa6112e0576112e061030a565b80519550602081600460088501335afa6112fc576112fc61030a565b5184825260158201878152603583018781526055808501939093526060822090915284905281206001600160a01b03163381146113525761135260547004155392558cd48e88189859081c1bdbdb60621b610314565b5060206084823751905060008913156113a357306001600160a01b0382160361138e576113896001600160a01b038616338b611cd7565b6113a3565b6113a36001600160a01b03861682338c611d3a565b60008813156113ea57306001600160a01b038216036113d5576113d06001600160a01b038516338a611cd7565b6113ea565b6113ea6001600160a01b03851682338b611d3a565b505050505050505050565b8015611557576000606060e0839003611496576040516001600160a01b0386169061142f9063d505accf60e01b9087908790602001612bfd565b60408051601f198184030181529082905261144991612c45565b6000604051808303816000865af19150503d8060008114611486576040519150601f19603f3d011682016040523d82523d6000602084013e61148b565b606091505b509092509050611505565b6101008390036114c7576040516001600160a01b0386169061142f906323f2ebc360e21b9087908790602001612bfd565b60405162461bcd60e51b81526020600482015260136024820152720aee4dedcce40e0cae4dad2e840d8cadccee8d606b1b60448201526064016108ad565b816115545761153b816040518060400160405280600f81526020016e02832b936b4ba103330b4b632b21d1608d1b815250611d72565b60405162461bcd60e51b81526004016108ad9190612c8d565b50505b505050565b6033546001600160a01b031633146107f25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108ad565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b801561155757611617836117d0565b156116be576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611669576040519150601f19603f3d011682016040523d82523d6000602084013e61166e565b606091505b50509050806116b85760405162461bcd60e51b815260206004820152601660248201527508cc2d2d8cac840e8de40e8e4c2dce6cccae4408aa8960531b60448201526064016108ad565b50505050565b6115576001600160a01b0384168383611cd7565b600054610100900460ff166116f95760405162461bcd60e51b81526004016108ad90612ca0565b6107f2611fde565b600054610100900460ff166117285760405162461bcd60e51b81526004016108ad90612ca0565b6107f261200e565b61173861178a565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861176d3390565b6040516001600160a01b03909116815260200160405180910390a1565b60655460ff16156107f25760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ad565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148061180757506001600160a01b038216611010145b8061181957506001600160a01b038216155b92915050565b60e081900361191357600080866001600160a01b031663d505accf60e01b8585604051602401611850929190612ceb565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161188e9190612c45565b6000604051808303816000865af19150503d80600081146118cb576040519150601f19603f3d011682016040523d82523d6000602084013e6118d0565b606091505b5091509150816119105761153b816040518060400160405280601481526020017302832b936b4ba1031b0b636103330b4b632b21d160651b815250611d72565b50505b6115546001600160a01b038616338686611d3a565b6000611933836117d0565b1561194957506001600160a01b03811631611819565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa15801561198f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b39190612cff565b9392505050565b60006119b38284612bbb565b60006119b38284612d18565b60006119b38284612d2b565b836001600160a01b0316856001600160a01b0316336001600160a01b03167f76af224a143865a50b41496e1a73622698692c565c1214bc862f18e22d829c5e868a6080013587878d60a001358e60c001358f610100016020810190611a4391906129fb565b604080516001600160a01b03988916815260208101979097528601949094526060850192909252608084015260a083015290911660c082015260e00160405180910390a4505050505050565b600080600160ff1b8416158015611bca576000856001600160a01b031663128acb088984611abc89612041565b604080516001600160a01b038e1660208201526401000276a491016040516020818303038152906040526040518663ffffffff1660e01b8152600401611b06959493929190612d42565b60408051808303816000875af1158015611b24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b489190612d7d565b915050611b5d81611b5890612da1565b6120af565b866001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bbf9190612dbd565b935093505050611cce565b6000856001600160a01b031663128acb088984611be689612041565b604080516001600160a01b038e16602082015273fffd8963efd1fc6a506488495d951d5263988d2591016040516020818303038152906040526040518663ffffffff1660e01b8152600401611c3f959493929190612d42565b60408051808303816000875af1158015611c5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c819190612d7d565b509050611c90611b5882612da1565b866001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611b9b573d6000803e3d6000fd5b94509492505050565b6040516001600160a01b03831660248201526044810182905261155790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612101565b6040516001600160a01b03808516602483015283166044820152606481018290526116b89085906323b872dd60e01b90608401611d03565b60606044835110158015611dab575082600081518110611d9457611d94612bce565b6020910101516001600160f81b031916600160fb1b145b8015611ddc575082600181518110611dc557611dc5612bce565b6020910101516001600160f81b03191660c360f81b145b8015611e0d575082600281518110611df657611df6612bce565b6020910101516001600160f81b031916607960f81b145b8015611e3e575082600381518110611e2757611e27612bce565b6020910101516001600160f81b031916600560fd1b145b15611ec857604483810180519091611e569190612d18565b84511015611e9e5760405162461bcd60e51b815260206004820152601560248201527424b73b30b634b2103932bb32b93a103932b0b9b7b760591b60448201526064016108ad565b8281604051602001611eb1929190612dda565b604051602081830303815290604052915050611819565b82516024148015611efe575082600081518110611ee757611ee7612bce565b6020910101516001600160f81b031916602760f91b145b8015611f2f575082600181518110611f1857611f18612bce565b6020910101516001600160f81b031916600960fb1b145b8015611f60575082600281518110611f4957611f49612bce565b6020910101516001600160f81b031916607b60f81b145b8015611f91575082600381518110611f7a57611f7a612bce565b6020910101516001600160f81b031916607160f81b145b15611fb657602483015182611fa5826121d3565b604051602001611eb1929190612e29565b81604051602001611fc79190612e5e565b604051602081830303815290604052905092915050565b600054610100900460ff166120055760405162461bcd60e51b81526004016108ad90612ca0565b6107f2336115b6565b600054610100900460ff166120355760405162461bcd60e51b81526004016108ad90612ca0565b6065805460ff19169055565b60006001600160ff1b038211156120ab5760405162461bcd60e51b815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e2061604482015267371034b73a191a9b60c11b60648201526084016108ad565b5090565b6000808212156120ab5760405162461bcd60e51b815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f73697469766560448201526064016108ad565b6000612156826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121ff9092919063ffffffff16565b80519091501561155757808060200190518101906121749190612e8b565b6115575760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108ad565b6060611819826040516020016121eb91815260200190565b60405160208183030381529060405261220e565b60606111d38484600085612426565b60408051808201909152601081526f181899199a1a9b1b9c1cb0b131b232b360811b6020820152815160609190600090612249906002612d2b565b612254906002612d18565b6001600160401b0381111561226b5761226b612ead565b6040519080825280601f01601f191660200182016040528015612295576020820181803683370190505b509050600360fc1b816000815181106122b0576122b0612bce565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106122df576122df612bce565b60200101906001600160f81b031916908160001a90535060005b845181101561241e5782600486838151811061231757612317612bce565b016020015182516001600160f81b031990911690911c60f81c90811061233f5761233f612bce565b01602001516001600160f81b0319168261235a836002612d2b565b612365906002612d18565b8151811061237557612375612bce565b60200101906001600160f81b031916908160001a9053508285828151811061239f5761239f612bce565b602091010151815160f89190911c600f169081106123bf576123bf612bce565b01602001516001600160f81b031916826123da836002612d2b565b6123e5906003612d18565b815181106123f5576123f5612bce565b60200101906001600160f81b031916908160001a9053508061241681612be4565b9150506122f9565b509392505050565b6060824710156124875760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108ad565b600080866001600160a01b031685876040516124a39190612c45565b60006040518083038185875af1925050503d80600081146124e0576040519150601f19603f3d011682016040523d82523d6000602084013e6124e5565b606091505b50915091506124f687838387612501565b979650505050505050565b60608315612570578251600003612569576001600160a01b0385163b6125695760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ad565b50816111d3565b6111d383838151156125855781518083602001fd5b8060405162461bcd60e51b81526004016108ad9190612c8d565b6001600160a01b038116811461092f57600080fd5b60008083601f8401126125c657600080fd5b5081356001600160401b038111156125dd57600080fd5b6020830191508360208260051b85010111156125f857600080fd5b9250929050565b60008083601f84011261261157600080fd5b5081356001600160401b0381111561262857600080fd5b6020830191508360208285010111156125f857600080fd5b60008060008060008060008060c0898b03121561265c57600080fd5b88356126678161259f565b9750602089013596506040890135955060608901356001600160401b038082111561269157600080fd5b61269d8c838d016125b4565b909750955060808b01359150808211156126b657600080fd5b506126c38b828c016125ff565b90945092505060a08901356126d78161259f565b809150509295985092959890939650565b60008060008060008060008060c0898b03121561270457600080fd5b883561270f8161259f565b9750602089013561271f8161259f565b9650604089013595506060890135945060808901356001600160401b038082111561274957600080fd5b6127558c838d016125b4565b909650945060a08b013591508082111561276e57600080fd5b5061277b8b828c016125ff565b999c989b5096995094979396929594505050565b60008060008060008060a087890312156127a857600080fd5b86356127b38161259f565b9550602087013594506040870135935060608701356001600160401b038111156127dc57600080fd5b6127e889828a016125b4565b90945092505060808701356127fc8161259f565b809150509295509295509295565b6000806040838503121561281d57600080fd5b82356128288161259f565b946020939093013593505050565b60008060008060006080868803121561284e57600080fd5b85356128598161259f565b9450602086013593506040860135925060608601356001600160401b0381111561288257600080fd5b61288e888289016125b4565b969995985093965092949392505050565b600080600080606085870312156128b557600080fd5b84356128c08161259f565b935060208501356001600160401b03808211156128dc57600080fd5b9086019061014082890312156128f157600080fd5b9093506040860135908082111561290757600080fd5b50612914878288016125b4565b95989497509550505050565b600080600080600080600060a0888a03121561293b57600080fd5b87356129468161259f565b9650602088013595506040880135945060608801356001600160401b038082111561297057600080fd5b61297c8b838c016125b4565b909650945060808a013591508082111561299557600080fd5b506129a28a828b016125ff565b989b979a50959850939692959293505050565b600080600080606085870312156129cb57600080fd5b843593506020850135925060408501356001600160401b038111156129ef57600080fd5b612914878288016125b4565b600060208284031215612a0d57600080fd5b81356119b38161259f565b60008060008060608587031215612a2e57600080fd5b843593506020850135925060408501356001600160401b03811115612a5257600080fd5b612914878288016125ff565b6000808335601e19843603018112612a7557600080fd5b8301803591506001600160401b03821115612a8f57600080fd5b6020019150368190038213156125f857600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60208082528181018390526000906040808401600586901b8501820187855b88811015612b9757878303603f190184528135368b9003607e19018112612b1257600080fd5b8a018035845286810135878501528581013586850152608060608083013536849003601e19018112612b4357600080fd5b9092018881019290356001600160401b03811115612b6057600080fd5b803603841315612b6f57600080fd5b8282880152612b818388018286612aa4565b978a019796505050928701925050600101612aec565b509098975050505050505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561181957611819612ba5565b634e487b7160e01b600052603260045260246000fd5b600060018201612bf657612bf6612ba5565b5060010190565b6001600160e01b031984168152818360048301376000910160040190815292915050565b60005b83811015612c3c578181015183820152602001612c24565b50506000910152565b60008251612c57818460208701612c21565b9190910192915050565b60008151808452612c79816020860160208601612c21565b601f01601f19169290920160200192915050565b6020815260006119b36020830184612c61565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020815260006111d3602083018486612aa4565b600060208284031215612d1157600080fd5b5051919050565b8082018082111561181957611819612ba5565b808202811582820484141761181957611819612ba5565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a0608082018190526000906124f690830184612c61565b60008060408385031215612d9057600080fd5b505080516020909101519092909150565b6000600160ff1b8201612db657612db6612ba5565b5060000390565b600060208284031215612dcf57600080fd5b81516119b38161259f565b60008351612dec818460208801612c21565b6508ae4e4dee4560d31b9083019081528351612e0f816006840160208801612c21565b602960f81b60069290910191820152600701949350505050565b60008351612e3b818460208801612c21565b650a0c2dcd2c6560d31b9083019081528351612e0f816006840160208801612c21565b60008251612e70818460208701612c21565b68556e6b6e6f776e282960b81b920191825250600901919050565b600060208284031215612e9d57600080fd5b815180151581146119b357600080fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220a4b684f7da1ec47b31afe9825e024401b205c413dcf92e35312389e9699a465b64736f6c63430008130033

Deployed Bytecode Sourcemap

129526:4320:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;57530:393;;;;;;;;;;-1:-1:-1;57530:393:0;;;;;:::i;:::-;;:::i;:::-;;;2231:25:1;;;2219:2;2204:18;57530:393:0;;;;;;;;118868:387;;;;;;;;;;-1:-1:-1;118868:387:0;;;;;:::i;:::-;;:::i;41106:86::-;;;;;;;;;;-1:-1:-1;41177:7:0;;;;41106:86;;3635:14:1;;3628:22;3610:41;;3598:2;3583:18;41106:86:0;3470:187:1;58281:9124:0;;;;;;:::i;:::-;;:::i;18928:103::-;;;;;;;;;;;;;:::i;:::-;;133631:141;;;;;;;;;;-1:-1:-1;133631:141:0;;;;;:::i;:::-;;:::i;130514:143::-;;;;;;;;;;;;;:::i;133780:63::-;;;;;;;;;;;;;:::i;67413:284::-;;;;;;:::i;:::-;;:::i;18280:87::-;;;;;;;;;;-1:-1:-1;18353:6:0;;18280:87;;-1:-1:-1;;;;;18353:6:0;;;5780:51:1;;5768:2;5753:18;18280:87:0;5634:203:1;130665:1739:0;;;;;;:::i;:::-;;:::i;120328:5246::-;;;;;;:::i;:::-;;:::i;57931:342::-;;;;;;;;;;-1:-1:-1;57931:342:0;;;;;:::i;:::-;;:::i;119586:254::-;;;;;;:::i;:::-;;:::i;19186:201::-;;;;;;;;;;-1:-1:-1;19186:201:0;;;;;:::i;:::-;;:::i;125626:2821::-;;;;;;;;;;-1:-1:-1;125626:2821:0;;;;;:::i;:::-;;:::i;57530:393::-;57770:20;57803:34;57819:8;57830:6;;57803:7;:34::i;:::-;57855:60;57869:8;57879:6;57887:9;57898:5;;57905:9;57855:13;:60::i;:::-;57848:67;57530:393;-1:-1:-1;;;;;;;;;57530:393:0:o;118868:387::-;119110:20;119143:34;119159:8;119170:6;;119143:7;:34::i;:::-;119195:52;119211:9;119222:6;119230:9;119241:5;;119195:15;:52::i;58281:9124::-;58491:20;58604:137;;;58664:16;58661:1;58658;58643:38;58709:16;58706:1;58699:27;58757:308;-1:-1:-1;;;58817:1:0;58810:77;-1:-1:-1;;;58912:4:0;58905:80;59016:1;59010:4;59003:15;;59046:3;59043:1;59036:14;59081:1400;-1:-1:-1;;;59182:8:0;59175:56;59152:3;59308:4;59298:8;59293:3;59283:8;59277:4;59270:5;59259:54;59249:118;;59338:10;;:::i;:::-;59409:8;59403:15;59472:4;59462:8;59458:19;59452:26;59499:8;59496:152;;;59584:8;59496:152;-1:-1:-1;;;59805:52:0;;59673:26;;;59771:11;59757:26;;;;59748:36;;59728:18;;59724:61;;-1:-1:-1;59882:8:0;59908:133;;;;60118:3;60111:4;60101:8;60097:19;60090:32;60172:1;60165:4;60155:8;60151:19;60144:30;59875:318;;59908:133;59966:1;59959:4;59949:8;59945:19;59938:30;60018:3;60011:4;60001:8;59997:19;59990:32;59875:318;;60239:3;60232:4;60222:8;60218:19;60211:32;60289:4;60282;60272:8;60268:19;60261:33;60340:1;60333:4;60323:8;60319:19;60312:30;60410:1;60407;60401:4;60391:8;60388:1;60382:4;60375:5;60370:42;60360:106;;60437:10;;:::i;:::-;59081:1400;;;;;;;;:::o;60497:6702::-;60573:3;60632:4;60619:18;60741:22;;;;;60639:3;60615:28;;60683:25;60758:4;60816:25;60799:43;;60875:25;;60925:5;60948:809;;;;61809:11;61806:178;;;61848:90;61933:4;-1:-1:-1;;;61848:90:0;:::i;:::-;-1:-1:-1;;;62015:8:0;62008:48;62105:10;62099:3;62089:8;62085:18;62078:38;-1:-1:-1;;;;;62170:7:0;62166:26;62159:4;62149:8;62145:19;62138:55;62243:9;62236:4;62226:8;62222:19;62215:38;62326:1;62323;62317:4;62307:8;62304:1;62297:5;62290;62285:43;62275:115;;62357:10;;:::i;:::-;60918:1491;;60948:809;61002:11;60991:9;60988:26;60978:201;;61043:90;61128:4;-1:-1:-1;;;61043:90:0;:::i;:::-;-1:-1:-1;;;61210:8:0;61203:47;61329:1;61326;61321:3;61311:8;61300:9;61294:4;61287:5;61282:49;61272:121;;61360:10;;:::i;:::-;-1:-1:-1;;;61424:8:0;61417:49;-1:-1:-1;;;;;61519:7:0;61515:26;61509:3;61499:8;61495:18;61488:54;61592:9;61585:4;61575:8;61571:19;61564:38;61674:1;61671;61665:4;61655:8;61652:1;61646:4;61639:5;61634:42;61624:114;;61705:10;;:::i;:::-;60918:1491;62436:9;62429:16;;62518:4;62505:11;62501:22;62465:646;62549:14;62546:1;62543:21;62465:646;;;62680:1;62667:15;62713:333;-1:-1:-1;;;;;62997:11:0;62993:30;-1:-1:-1;;;62941:7:0;62937:28;62919:16;62915:51;-1:-1:-1;;;62866:7:0;62862:26;-1:-1:-1;;;;;62813:7:0;62809:26;62779:3;62744:8;62713:333;:::i;:::-;62706:340;-1:-1:-1;63081:11:0;-1:-1:-1;62600:4:0;62593:12;62465:646;;;62469:73;63138:284;63394:9;-1:-1:-1;;;63346:7:0;63342:28;63324:16;63320:51;-1:-1:-1;;;63275:7:0;63271:26;-1:-1:-1;;;;;63226:7:0;63222:26;63196:3;63165:8;63138:284;:::i;:::-;63131:291;;63453:3;63448;63445:12;63442:176;;;63481:90;63566:4;63498:66;63481:90;:::i;:::-;-1:-1:-1;;;63645:8:0;63638:84;-1:-1:-1;;;63747:7:0;63743:26;63740:156;;;-1:-1:-1;;;63800:8:0;63793:84;63740:156;63995:4;63985:8;63980:3;63970:8;-1:-1:-1;;;;;63946:7:0;63942:26;63935:5;63924:76;63914:140;;64025:10;;:::i;:::-;64094:8;64088:15;64072:31;;-1:-1:-1;;;64437:4:0;64431:3;64424:4;64411:18;64407:28;64403:39;64390:53;64352:223;64318:3;64284:318;64252:5;64222:403;64192:6;64185:4;64172:18;64168:31;64142:502;64123:521;;64677:11;64672:3;64669:20;64712:1;64707:1499;;;;-1:-1:-1;;;66262:23:0;;66307:378;;;;-1:-1:-1;;;66749:8:0;66742:48;66844:3;66837:4;66827:8;66823:19;66816:32;66924:1;66921;66915:4;66905:8;66902:1;66896:4;66889:5;66884:42;66874:122;;66959:10;;:::i;:::-;67070:1;67067;67064;67061;67056:3;67046:8;67039:5;67034:38;67024:118;;67105:10;;:::i;:::-;66255:910;;66307:378;-1:-1:-1;;;66348:8:0;66341:49;66443:8;66437:3;66427:8;66423:18;66416:36;66506:3;66499:4;66489:8;66485:19;66478:32;66590:1;66587;66581:4;66571:8;66568:1;66558:8;66551:5;66546:46;66536:126;;66625:10;;:::i;:::-;66255:910;64662:2522;;64707:1499;-1:-1:-1;;;64744:23:0;;64789:712;;;;-1:-1:-1;;;65565:8:0;65558:48;65660:3;65653:4;65643:8;65639:19;65632:32;65740:1;65737;65731:4;65721:8;65718:1;65712:4;65705:5;65700:42;65690:122;;65775:10;;:::i;:::-;65894:1;65891;65888;65885;65872:11;65862:8;65855:5;65850:46;65840:126;;65929:10;;:::i;:::-;66092:1;66089;66086;66083;66069:11;66064:3;66060:21;66016:42;66009:5;66004:90;65994:170;;66127:10;;:::i;:::-;64737:1450;;64789:712;-1:-1:-1;;;64830:8:0;64823:49;64925:8;64919:3;64909:8;64905:18;64898:36;64988:11;64981:4;64971:8;64967:19;64960:40;65080:1;65077;65071:4;65061:8;65058:1;65048:8;65041:5;65036:46;65026:126;;65115:10;;:::i;:::-;65207:42;65201:3;65191:8;65187:18;65180:70;65313:11;65308:3;65304:21;65297:4;65287:8;65283:19;65276:50;65406:1;65403;65397:4;65387:8;65384:1;65374:8;65367:5;65362:46;65352:126;;65441:10;;:::i;:::-;64737:1450;64662:2522;;;;;60497:6702;;;;;;;;:::o;:::-;67237:4;67231:11;67283:4;67273:8;67269:19;67263:4;67256:33;67319:68;67377:9;67366;67356:8;67348:6;67338:8;67328;67319:68;:::i;:::-;67303:84;58281:9124;-1:-1:-1;;;;;;;;58281:9124:0:o;18928:103::-;18166:13;:11;:13::i;:::-;18993:30:::1;19020:1;18993:18;:30::i;:::-;18928:103::o:0;133631:141::-;18166:13;:11;:13::i;:::-;133712:52:::1;-1:-1:-1::0;;;;;133712:23:0;::::1;133744:10;133757:6:::0;133712:23:::1;:52::i;:::-;133631:141:::0;;:::o;130514:143::-;12001:19;12024:13;;;;;;12023:14;;12071:34;;;;-1:-1:-1;12089:12:0;;12104:1;12089:12;;;;:16;12071:34;12070:108;;;-1:-1:-1;12150:4:0;1664:19;:23;;;12111:66;;-1:-1:-1;12160:12:0;;;;;:17;12111:66;12048:204;;;;-1:-1:-1;;;12048:204:0;;10144:2:1;12048:204:0;;;10126:21:1;10183:2;10163:18;;;10156:30;10222:34;10202:18;;;10195:62;-1:-1:-1;;;10273:18:1;;;10266:44;10327:19;;12048:204:0;;;;;;;;;12263:12;:16;;-1:-1:-1;;12263:16:0;12278:1;12263:16;;;12290:67;;;;12325:13;:20;;-1:-1:-1;;12325:20:0;;;;;12290:67;130566:35:::1;:33;:35::i;:::-;130612:37;:35;:37::i;:::-;12383:14:::0;12379:102;;;12430:5;12414:21;;-1:-1:-1;;12414:21:0;;;12455:14;;-1:-1:-1;10509:36:1;;12455:14:0;;10497:2:1;10482:18;12455:14:0;;;;;;;12379:102;11990:498;130514:143::o;133780:63::-;18166:13;:11;:13::i;:::-;133827:8:::1;:6;:8::i;67413:284::-:0;67579:20;67619:70;67633:8;67643:6;67651:9;67662:5;;67677:10;67619:13;:70::i;130665:1739::-;130860:20;40711:19;:17;:19::i;:::-;130924:1:::1;130901:4;:20;;;:24;130893:63;;;::::0;-1:-1:-1;;;130893:63:0;;10758:2:1;130893:63:0::1;::::0;::::1;10740:21:1::0;10797:2;10777:18;;;10770:30;10836:28;10816:18;;;10809:56;10882:18;;130893:63:0::1;10556:350:1::0;130893:63:0::1;130975:16:::0;130967:51:::1;;;::::0;-1:-1:-1;;;130967:51:0;;11113:2:1;130967:51:0::1;::::0;::::1;11095:21:1::0;11152:2;11132:18;;;11125:30;-1:-1:-1;;;11171:18:1;;;11164:52;11233:18;;130967:51:0::1;10911:346:1::0;130967:51:0::1;131047:10;::::0;::::1;;131031:13;131086;;::::0;::::1;131047:4:::0;131086:13:::1;:::i;:::-;131068:31:::0;-1:-1:-1;131110:15:0::1;131128:13;::::0;;;::::1;::::0;::::1;;:::i;:::-;131110:31;;131176:16;:8;-1:-1:-1::0;;;;;131176:14:0::1;;:16::i;:::-;:34;;131209:1;131176:34;;;131195:4;:11;;;131176:34;131162:9;:49;131154:79;;;::::0;-1:-1:-1;;;131154:79:0;;11738:2:1;131154:79:0::1;::::0;::::1;11720:21:1::0;11777:2;11757:18;;;11750:30;-1:-1:-1;;;11796:18:1;;;11789:47;11853:18;;131154:79:0::1;11536:341:1::0;131154:79:0::1;129840:4;131250:21:::0;::::1;:26:::0;131246:182:::1;;131302:16;:8;-1:-1:-1::0;;;;;131302:14:0::1;;:16::i;:::-;131301:17;131293:48;;;::::0;-1:-1:-1;;;131293:48:0;;12084:2:1;131293:48:0::1;::::0;::::1;12066:21:1::0;12123:2;12103:18;;;12096:30;-1:-1:-1;;;12142:18:1;;;12135:48;12200:18;;131293:48:0::1;11882:342:1::0;131293:48:0::1;131356:60;131363:8:::0;131373:16:::1;::::0;;;::::1;::::0;::::1;;:::i;:::-;131391:11;::::0;::::1;;131404;;::::0;::::1;131391:4:::0;131404:11:::1;:::i;:::-;131356:6;:60::i;:::-;131440:19;::::0;131463:16:::1;::::0;;;::::1;::::0;::::1;;:::i;:::-;-1:-1:-1::0;;;;;131463:30:0::1;;131462:64;;131510:16;::::0;;;::::1;::::0;::::1;;:::i;:::-;131462:64;;;131497:10;131462:64;131440:86;;131537:25;129788:4;131566:5;:21;131591:1;131566:26:::0;131565:74:::1;;131638:1;131565:74;;;131596:39;-1:-1:-1::0;;;;;131596:27:0;::::1;131624:10;131596:27;:39::i;:::-;131537:102:::0;-1:-1:-1;131650:25:0::1;131678:40;-1:-1:-1::0;;;;;131678:27:0;::::1;131706:11:::0;131678:27:::1;:40::i;:::-;131650:68;;131731:6;-1:-1:-1::0;;;;;131731:16:0::1;;131755:9;131766:5;;131731:41;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;-1:-1:-1::0;;;;131807:11:0::1;::::0;::::1;;::::0;-1:-1:-1;131844:63:0::1;131889:17:::0;131844:40:::1;-1:-1:-1::0;;;;;131844:27:0;::::1;131872:11:::0;131844:27:::1;:40::i;:::-;:44:::0;::::1;:63::i;:::-;131829:78:::0;-1:-1:-1;129788:4:0::1;131924:21:::0;::::1;:26:::0;131920:386:::1;;131981:79;132020:39;-1:-1:-1::0;;;;;132020:27:0;::::1;132048:10;132020:27;:39::i;:::-;131981:34;:17:::0;132003:11:::1;::::0;::::1;;131981:21;:34::i;:79::-;131967:93:::0;-1:-1:-1;132116:37:0::1;:20;::::0;::::1;;131967:93:::0;132116:24:::1;:37::i;:::-;132083:29;:12:::0;132100:11:::1;::::0;::::1;;132083:16;:29::i;:::-;:70;;132075:110;;;::::0;-1:-1:-1;;;132075:110:0;;15053:2:1;132075:110:0::1;::::0;::::1;15035:21:1::0;15092:2;15072:18;;;15065:30;15131:29;15111:18;;;15104:57;15178:18;;132075:110:0::1;14851:351:1::0;132075:110:0::1;131920:386;;;132242:4;:20;;;132226:12;:36;;132218:76;;;::::0;-1:-1:-1;;;132218:76:0;;15053:2:1;132218:76:0::1;::::0;::::1;15035:21:1::0;15092:2;15072:18;;;15065:30;15131:29;15111:18;;;15104:57;15178:18;;132218:76:0::1;14851:351:1::0;132218:76:0::1;132318:78;132331:4;132337:8;132347;132357:11;132370;132383:12;132318;:78::i;:::-;130882:1522;;;;;;;130665:1739:::0;;;;;;:::o;120328:5246::-;120508:20;120555:5;120508:20;120613:7;120605:42;;;;-1:-1:-1;;;120605:42:0;;15409:2:1;120605:42:0;;;15391:21:1;15448:2;15428:18;;;15421:30;-1:-1:-1;;;15467:18:1;;;15460:52;15529:18;;120605:42:0;15207:346:1;120605:42:0;120658:17;120678:7;120684:1;120678:3;:7;:::i;:::-;120658:27;;120711:6;120696:21;;120728:13;120773:1;-1:-1:-1;;;120744:5:0;;120750:1;120744:8;;;;;;;:::i;:::-;;;;;;;:26;:30;120728:46;;120785:15;120842:1;-1:-1:-1;;;120803:5:0;;120809:9;120803:16;;;;;;;:::i;:::-;;;;;;;:36;:40;120785:58;;120858:8;120854:243;;;120904:6;120891:9;:19;120883:58;;;;-1:-1:-1;;;120883:58:0;;16157:2:1;120883:58:0;;;16139:21:1;16196:2;16176:18;;;16169:30;16235:28;16215:18;;;16208:56;16281:18;;120883:58:0;15955:350:1;120883:58:0;118192:42;-1:-1:-1;;;;;120956:20:0;;120984:6;120956:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;120854:243;;;121034:9;:14;121026:59;;;;-1:-1:-1;;;121026:59:0;;16512:2:1;121026:59:0;;;16494:21:1;;;16531:18;;;16524:30;16590:34;16570:18;;;16563:62;16642:18;;121026:59:0;16310:356:1;121026:59:0;121117:1;121111:3;:7;121107:577;;;121154:87;121172:4;121179:8;:37;;121206:10;121179:37;;;121198:4;121179:37;121218:5;;121224:1;121218:8;;;;;;;:::i;:::-;;;;;;;121228:12;121154:9;:87::i;:::-;-1:-1:-1;121135:106:0;-1:-1:-1;121273:1:0;121256:157;121280:9;121276:1;:13;121256:157;;;121334:63;121352:4;121367;121374:5;;121380:1;121374:8;;;;;;;:::i;:::-;;;;;;;121384:12;121334:9;:63::i;:::-;-1:-1:-1;121315:82:0;-1:-1:-1;121291:3:0;;;;:::i;:::-;;;;121256:157;;;;121454:71;121472:4;121487;121494:5;;121500:9;121494:16;;;;;;;:::i;121454:71::-;121427:98;;-1:-1:-1;121427:98:0;-1:-1:-1;121107:577:0;;;121585:87;121603:4;121610:8;:37;;121637:10;121610:37;;121585:87;121558:114;;-1:-1:-1;121558:114:0;-1:-1:-1;121107:577:0;121720:9;121704:12;:25;;121696:59;;;;-1:-1:-1;;;121696:59:0;;17013:2:1;121696:59:0;;;16995:21:1;17052:2;17032:18;;;17025:30;-1:-1:-1;;;17071:18:1;;;17064:51;17132:18;;121696:59:0;16811:345:1;121696:59:0;121792:137;;121945:3545;122439:4;122433:11;122039:270;122134:39;122155:4;122142:18;122134:39;122121:53;122065:3;122039:270;;122387:5;122383:15;;;122367:4;122354:18;122350:31;;;122346:53;;122469:30;;;122522:1;122517:1768;;;;124341:11;124374:426;;;;-1:-1:-1;;;124864:8:0;124857:84;124995:13;124988:4;124978:8;124974:19;124967:42;125177:1;125174;125168:4;125158:8;125155:1;125087:66;125080:5;125075:104;125035:240;;125238:10;;:::i;:::-;125361:1;125358;125355;125352;125337:13;125325:10;125318:5;125313:50;125303:130;;125396:10;;:::i;:::-;124334:1122;;124374:426;-1:-1:-1;;;124415:8:0;124408:84;124545:10;124539:3;124529:8;124525:18;124518:38;124610:13;124603:4;124593:8;124589:19;124582:42;124705:1;124702;124696:4;124686:8;124683:1;124672:9;124665:5;124660:47;124650:127;;124740:10;;:::i;:::-;124334:1122;122462:3013;;122517:1768;122554:11;122587:761;;;;-1:-1:-1;;;123412:8:0;123405:84;123543:13;123536:4;123526:8;123522:19;123515:42;123725:1;123722;123716:4;123706:8;123703:1;123635:66;123628:5;123623:104;123583:240;;123786:10;;:::i;:::-;123907:1;123904;123901;123898;123885:11;123873:10;123866:5;123861:48;123851:128;;123942:10;;:::i;:::-;124145:1;124142;124139;124136;124122:11;124107:13;124103:31;124059:42;124052:5;124047:100;124007:236;;124206:10;;:::i;:::-;122547:1719;;122587:761;-1:-1:-1;;;122628:8:0;122621:84;122758:10;122752:3;122742:8;122738:18;122731:38;122823:11;122816:4;122806:8;122802:19;122795:40;122916:1;122913;122907:4;122897:8;122894:1;122883:9;122876:5;122871:47;122861:127;;122951:10;;:::i;:::-;123043:42;123037:3;123027:8;123023:18;123016:70;123159:11;123144:13;123140:31;123133:4;123123:8;123119:19;123112:60;123253:1;123250;123244:4;123234:8;123231:1;123220:9;123213:5;123208:47;123198:127;;123288:10;;:::i;:::-;122547:1719;122462:3013;;;;121945:3545;;;;:::o;:::-;125506:50;125547:8;125535:10;125524:9;125510:12;125506:50;:::i;:::-;121777:3790;;;;;120328:5246;;;;;;;:::o;57931:342::-;58133:20;58166:34;58182:8;58193:6;;58166:7;:34::i;:::-;58218:47;58230:8;58240:6;58248:9;58259:5;;58218:11;:47::i;119586:254::-;119730:20;119770:62;119794:10;119807:6;119815:9;119826:5;;119770:15;:62::i;:::-;119763:69;;119586:254;;;;;;;:::o;19186:201::-;18166:13;:11;:13::i;:::-;-1:-1:-1;;;;;19275:22:0;::::1;19267:73;;;::::0;-1:-1:-1;;;19267:73:0;;17363:2:1;19267:73:0::1;::::0;::::1;17345:21:1::0;17402:2;17382:18;;;17375:30;17441:34;17421:18;;;17414:62;-1:-1:-1;;;17492:18:1;;;17485:36;17538:19;;19267:73:0::1;17161:402:1::0;19267:73:0::1;19351:28;19370:8;19351:18;:28::i;125626:2821::-:0;125755:13;;117408:66;117296;125755:13;126518:4;126512:11;126568:4;126558:8;126554:19;-1:-1:-1;;;126594:8:0;126587:28;126695:4;126684:9;126679:3;126669:8;126659;126652:5;126641:59;126631:115;;126721:10;;:::i;:::-;126776:9;126770:16;126760:26;;126874:4;126863:9;126858:3;126852;126842:8;126838:18;126828:8;126821:5;126810:69;126800:125;;126900:10;;:::i;:::-;126955:9;126949:16;126939:26;;127053:4;127042:9;127037:3;127031;127021:8;127017:18;127007:8;127000:5;126989:69;126979:125;;127079:10;;:::i;:::-;127129:16;127192:27;;;127245:2;127238:10;;127310:17;;;127348:10;;;127341:26;;;127388:10;;;;127381:23;;;;127441:2;127428:16;;127418:27;;;127488;;;127545:23;;-1:-1:-1;;;;;127541:43:0;127619:8;127610:18;;127600:177;;127649:90;127734:4;-1:-1:-1;;;127649:90:0;:::i;:::-;127600:177;127822:4;127816;127806:8;127793:34;127850:15;;-1:-1:-1;127907:1:0;127892:16;;127888:271;;;127946:4;-1:-1:-1;;;;;127929:22:0;;;127925:223;;127972:54;-1:-1:-1;;;;;127972:19:0;;127992:10;128012:12;127972:19;:54::i;:::-;127925:223;;;128067:65;-1:-1:-1;;;;;128067:23:0;;128091:5;128098:10;128118:12;128067:23;:65::i;:::-;128188:1;128173:12;:16;128169:271;;;128227:4;-1:-1:-1;;;;;128210:22:0;;;128206:223;;128253:54;-1:-1:-1;;;;;128253:19:0;;128273:10;128293:12;128253:19;:54::i;:::-;128206:223;;;128348:65;-1:-1:-1;;;;;128348:23:0;;128372:5;128379:10;128399:12;128348:23;:65::i;:::-;125744:2703;;;;;125626:2821;;;;:::o;55073:828::-;55152:17;;55148:746;;55186:12;55213:19;55268:6;55251:23;;;55247:514;;55394:54;;-1:-1:-1;;;;;55383:10:0;;;55394:54;;-1:-1:-1;;;55411:28:0;55441:6;;;;55394:54;;;:::i;:::-;;;;-1:-1:-1;;55394:54:0;;;;;;;;;;55383:66;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;55363:86:0;;-1:-1:-1;55363:86:0;-1:-1:-1;55247:514:0;;;55492:6;55475:23;;;55471:290;;55618:56;;-1:-1:-1;;;;;55607:10:0;;;55618:56;;-1:-1:-1;;;55635:30:0;55667:6;;;;55618:56;;;:::i;55471:290::-;55716:29;;-1:-1:-1;;;55716:29:0;;18690:2:1;55716:29:0;;;18672:21:1;18729:2;18709:18;;;18702:30;-1:-1:-1;;;18748:18:1;;;18741:49;18807:18;;55716:29:0;18488:343:1;55471:290:0;55780:7;55775:108;;55815:51;55840:6;55815:51;;;;;;;;;;;;;-1:-1:-1;;;55815:51:0;;;:24;:51::i;:::-;55808:59;;-1:-1:-1;;;55808:59:0;;;;;;;;:::i;55775:108::-;55171:723;;55148:746;55073:828;;;:::o;18445:132::-;18353:6;;-1:-1:-1;;;;;18353:6:0;16400:10;18509:23;18501:68;;;;-1:-1:-1;;;18501:68:0;;19539:2:1;18501:68:0;;;19521:21:1;;;19558:18;;;19551:30;19617:34;19597:18;;;19590:62;19669:18;;18501:68:0;19337:356:1;19547:191:0;19640:6;;;-1:-1:-1;;;;;19657:17:0;;;-1:-1:-1;;;;;;19657:17:0;;;;;;;19690:40;;19640:6;;;19657:17;19640:6;;19690:40;;19621:16;;19690:40;19610:128;19547:191;:::o;52910:408::-;53045:10;;53041:270;;53076:12;53082:5;53076;:12::i;:::-;53072:228;;;53110:11;53127:2;-1:-1:-1;;;;;53127:7:0;53142:6;53127:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;53109:44;;;53180:6;53172:41;;;;-1:-1:-1;;;53172:41:0;;20110:2:1;53172:41:0;;;20092:21:1;20149:2;20129:18;;;20122:30;-1:-1:-1;;;20168:18:1;;;20161:52;20230:18;;53172:41:0;19908:346:1;53172:41:0;53090:139;55073:828;;;:::o;53072:228::-;53254:30;-1:-1:-1;;;;;53254:18:0;;53273:2;53277:6;53254:18;:30::i;17823:97::-;14144:13;;;;;;;14136:69;;;;-1:-1:-1;;;14136:69:0;;;;;;;:::i;:::-;17886:26:::1;:24;:26::i;40276:99::-:0;14144:13;;;;;;;14136:69;;;;-1:-1:-1;;;14136:69:0;;;;;;;:::i;:::-;40340:27:::1;:25;:27::i;41702:118::-:0;40711:19;:17;:19::i;:::-;41762:7:::1;:14:::0;;-1:-1:-1;;41762:14:0::1;41772:4;41762:14;::::0;;41792:20:::1;41799:12;16400:10:::0;;16320:98;41799:12:::1;41792:20;::::0;-1:-1:-1;;;;;5798:32:1;;;5780:51;;5768:2;5753:18;41792:20:0::1;;;;;;;41702:118::o:0;41265:108::-;41177:7;;;;41335:9;41327:38;;;;-1:-1:-1;;;41327:38:0;;20873:2:1;41327:38:0;;;20855:21:1;20912:2;20892:18;;;20885:30;-1:-1:-1;;;20931:18:1;;;20924:46;20987:18;;41327:38:0;20671:340:1;54132:248:0;54184:4;-1:-1:-1;;;;;54221:38:0;;52760:42;54221:38;;:95;;-1:-1:-1;;;;;;54276:40:0;;52858:42;54276:40;54221:95;:151;;;-1:-1:-1;;;;;;54333:39:0;;;54221:151;54201:171;54132:248;-1:-1:-1;;54132:248:0:o;132957:666::-;133211:6;133194:23;;;133190:366;;133299:12;133313:19;133344:5;-1:-1:-1;;;;;133336:19:0;133379:28;;;133409:6;;133356:60;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;133356:60:0;;;;;;;;;;;;;;-1:-1:-1;;;;;133356:60:0;-1:-1:-1;;;;;;133356:60:0;;;;;;;;;;133336:81;;;;133356:60;133336:81;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;133298:119;;;;133437:7;133432:113;;133472:56;133497:6;133472:56;;;;;;;;;;;;;-1:-1:-1;;;133472:56:0;;;:24;:56::i;133432:113::-;133219:337;;133190:366;133568:47;-1:-1:-1;;;;;133568:22:0;;133591:10;133603:3;133608:6;133568:22;:47::i;53884:240::-;53966:7;53990:12;53996:5;53990;:12::i;:::-;53986:131;;;-1:-1:-1;;;;;;54026:15:0;;;54019:22;;53986:131;54081:24;;-1:-1:-1;;;54081:24:0;;-1:-1:-1;;;;;5798:32:1;;;54081:24:0;;;5780:51:1;54081:15:0;;;;;5753:18:1;;54081:24:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;54074:31;53884:240;-1:-1:-1;;;53884:240:0:o;48651:98::-;48709:7;48736:5;48740:1;48736;:5;:::i;48270:98::-;48328:7;48355:5;48359:1;48355;:5;:::i;49008:98::-;49066:7;49093:5;49097:1;49093;:5;:::i;132412:537::-;132718:8;-1:-1:-1;;;;;132648:293:0;132695:8;-1:-1:-1;;;;;132648:293:0;132670:10;-1:-1:-1;;;;;132648:293:0;;132741:11;132767:4;:11;;;132793;132819:12;132846:4;:20;;;132881:4;:21;;;132917:4;:13;;;;;;;;;;:::i;:::-;132648:293;;;-1:-1:-1;;;;;22128:15:1;;;22110:34;;22175:2;22160:18;;22153:34;;;;22203:18;;22196:34;;;;22261:2;22246:18;;22239:34;;;;22304:3;22289:19;;22282:35;22090:3;22333:19;;22326:35;22398:15;;;22392:3;22377:19;;22370:44;22059:3;22044:19;132648:293:0;;;;;;;132412:537;;;;;;:::o;128455:973::-;128555:7;;-1:-1:-1;;;128602:25:0;;:30;128643:778;;;;128677:14;128726:4;-1:-1:-1;;;;;128695:43:0;;128757:9;128785:10;128814:25;128832:6;128814:17;:25::i;:::-;128892:17;;;-1:-1:-1;;;;;5798:32:1;;128892:17:0;;;5780:51:1;117871:14:0;;5753:18:1;128892:17:0;;;;;;;;;;;;128695:229;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;128674:250;;;128947:28;128967:7;128966:8;;;:::i;:::-;128947:18;:28::i;:::-;129008:4;-1:-1:-1;;;;;128977:45:0;;:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;128939:86;;;;;;;;128643:778;129059:14;129110:4;-1:-1:-1;;;;;129079:43:0;;129141:9;129169:10;129198:25;129216:6;129198:17;:25::i;:::-;129276:17;;;-1:-1:-1;;;;;5798:32:1;;129276:17:0;;;5780:51:1;118057:53:0;;5753:18:1;129276:17:0;;;;;;;;;;;;129079:229;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;129058:250:0;-1:-1:-1;129331:28:0;129350:8;129058:250;129350:8;:::i;129331:28::-;129392:4;-1:-1:-1;;;;;129361:45:0;;:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;128455:973;;;;;;;;:::o;35427:211::-;35571:58;;-1:-1:-1;;;;;23844:32:1;;35571:58:0;;;23826:51:1;23893:18;;;23886:34;;;35544:86:0;;35564:5;;-1:-1:-1;;;35594:23:0;23799:18:1;;35571:58:0;;;;-1:-1:-1;;35571:58:0;;;;;;;;;;;;;;-1:-1:-1;;;;;35571:58:0;-1:-1:-1;;;;;;35571:58:0;;;;;;;;;;35544:19;:86::i;35646:248::-;35817:68;;-1:-1:-1;;;;;24189:15:1;;;35817:68:0;;;24171:34:1;24241:15;;24221:18;;;24214:43;24273:18;;;24266:34;;;35790:96:0;;35810:5;;-1:-1:-1;;;35840:27:0;24106:18:1;;35817:68:0;23931:375:1;42897:1893:0;42976:13;43261:2;43246:4;:11;:17;;:38;;;;;43267:4;43272:1;43267:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;43267:7:0;-1:-1:-1;;;43267:17:0;43246:38;:59;;;;;43288:4;43293:1;43288:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;43288:7:0;-1:-1:-1;;;43288:17:0;43246:59;:80;;;;;43309:4;43314:1;43309:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;43309:7:0;-1:-1:-1;;;43309:17:0;43246:80;:101;;;;;43330:4;43335:1;43330:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;43330:7:0;-1:-1:-1;;;43330:17:0;43246:101;43242:1476;;;43580:2;43570:13;;;44076:20;;43570:13;;44071:25;;44076:20;44071:25;:::i;:::-;44056:4;:11;:40;;44048:74;;;;-1:-1:-1;;;44048:74:0;;24513:2:1;44048:74:0;;;24495:21:1;24552:2;24532:18;;;24525:30;-1:-1:-1;;;24571:18:1;;;24564:51;24632:18;;44048:74:0;24311:345:1;44048:74:0;44168:6;44186;44151:47;;;;;;;;;:::i;:::-;;;;;;;;;;;;;44137:62;;;;;43242:1476;44293:4;:11;44308:2;44293:17;:38;;;;;44314:4;44319:1;44314:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;44314:7:0;-1:-1:-1;;;44314:17:0;44293:38;:59;;;;;44335:4;44340:1;44335:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;44335:7:0;-1:-1:-1;;;44335:17:0;44293:59;:80;;;;;44356:4;44361:1;44356:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;44356:7:0;-1:-1:-1;;;44356:17:0;44293:80;:101;;;;;44377:4;44382:1;44377:7;;;;;;;;:::i;:::-;;;;;;-1:-1:-1;;;;;;44377:7:0;-1:-1:-1;;;44377:17:0;44293:101;44289:429;;;44605:2;44595:13;;44589:20;44669:6;44687:12;44589:20;44687:6;:12::i;:::-;44652:53;;;;;;;;;:::i;44289:429::-;44761:6;44744:37;;;;;;;;:::i;:::-;;;;;;;;;;;;;44730:52;;42897:1893;;;;:::o;17928:113::-;14144:13;;;;;;;14136:69;;;;-1:-1:-1;;;14136:69:0;;;;;;;:::i;:::-;18001:32:::1;16400:10:::0;18001:18:::1;:32::i;40383:97::-:0;14144:13;;;;;;;14136:69;;;;-1:-1:-1;;;14136:69:0;;;;;;;:::i;:::-;40457:7:::1;:15:::0;;-1:-1:-1;;40457:15:0::1;::::0;;40383:97::o;103644:301::-;103700:6;-1:-1:-1;;;;;103827:5:0;:34;;103819:87;;;;-1:-1:-1;;;103819:87:0;;26936:2:1;103819:87:0;;;26918:21:1;26975:2;26955:18;;;26948:30;27014:34;26994:18;;;26987:62;-1:-1:-1;;;27065:18:1;;;27058:38;27113:19;;103819:87:0;26734:404:1;103819:87:0;-1:-1:-1;103931:5:0;103644:301::o;85478:171::-;85534:7;85571:1;85562:5;:10;;85554:55;;;;-1:-1:-1;;;85554:55:0;;27345:2:1;85554:55:0;;;27327:21:1;;;27364:18;;;27357:30;27423:34;27403:18;;;27396:62;27475:18;;85554:55:0;27143:356:1;38494:716:0;38918:23;38944:69;38972:4;38944:69;;;;;;;;;;;;;;;;;38952:5;-1:-1:-1;;;;;38944:27:0;;;:69;;;;;:::i;:::-;39028:17;;38918:95;;-1:-1:-1;39028:21:0;39024:179;;39125:10;39114:30;;;;;;;;;;;;:::i;:::-;39106:85;;;;-1:-1:-1;;;39106:85:0;;27988:2:1;39106:85:0;;;27970:21:1;28027:2;28007:18;;;28000:30;28066:34;28046:18;;;28039:62;-1:-1:-1;;;28117:18:1;;;28110:40;28167:19;;39106:85:0;27786:406:1;44798:125:0;44851:13;44884:31;44908:5;44891:23;;;;;;28326:19:1;;28370:2;28361:12;;28197:182;44891:23:0;;;;;;;;;;;;;44884:6;:31::i;29277:229::-;29414:12;29446:52;29468:6;29476:4;29482:1;29485:12;29446:21;:52::i;44931:456::-;45014:42;;;;;;;;;;;;-1:-1:-1;;;45014:42:0;;;;45100:11;;44988:13;;45014:42;:21;;45100:15;;45114:1;45100:15;:::i;:::-;45096:19;;:1;:19;:::i;:::-;-1:-1:-1;;;;;45086:30:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;45086:30:0;;45067:49;;-1:-1:-1;;;45127:3:0;45131:1;45127:6;;;;;;;;:::i;:::-;;;;:12;-1:-1:-1;;;;;45127:12:0;;;;;;;;;-1:-1:-1;;;45150:3:0;45154:1;45150:6;;;;;;;;:::i;:::-;;;;:12;-1:-1:-1;;;;;45150:12:0;;;;;;;;;45178:9;45173:178;45197:4;:11;45193:1;:15;45173:178;;;45247:8;45273:1;45262:4;45267:1;45262:7;;;;;;;;:::i;:::-;;;;;45247:29;;-1:-1:-1;;;;;;45262:7:0;;;:12;;;:7;45256:19;;45247:29;;;;;;:::i;:::-;;;;;-1:-1:-1;;;;;;45247:29:0;45230:3;45234:5;45238:1;45234;:5;:::i;:::-;:9;;45242:1;45234:9;:::i;:::-;45230:14;;;;;;;;:::i;:::-;;;;:46;-1:-1:-1;;;;;45230:46:0;;;;;;;;;45308:8;45323:4;45328:1;45323:7;;;;;;;;:::i;:::-;;;;;;45308:31;;45323:7;;;;;45333:4;45317:21;;45308:31;;;;;;:::i;:::-;;;;;-1:-1:-1;;;;;;45308:31:0;45291:3;45295:5;45299:1;45295;:5;:::i;:::-;:9;;45303:1;45295:9;:::i;:::-;45291:14;;;;;;;;:::i;:::-;;;;:48;-1:-1:-1;;;;;45291:48:0;;;;;;;;-1:-1:-1;45210:3:0;;;;:::i;:::-;;;;45173:178;;;-1:-1:-1;45375:3:0;44931:456;-1:-1:-1;;;44931:456:0:o;30397:455::-;30567:12;30625:5;30600:21;:30;;30592:81;;;;-1:-1:-1;;;30592:81:0;;28718:2:1;30592:81:0;;;28700:21:1;28757:2;28737:18;;;28730:30;28796:34;28776:18;;;28769:62;-1:-1:-1;;;28847:18:1;;;28840:36;28893:19;;30592:81:0;28516:402:1;30592:81:0;30685:12;30699:23;30726:6;-1:-1:-1;;;;;30726:11:0;30745:5;30752:4;30726:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30684:73;;;;30775:69;30802:6;30810:7;30819:10;30831:12;30775:26;:69::i;:::-;30768:76;30397:455;-1:-1:-1;;;;;;;30397:455:0:o;32970:644::-;33155:12;33184:7;33180:427;;;33212:10;:17;33233:1;33212:22;33208:290;;-1:-1:-1;;;;;1664:19:0;;;33422:60;;;;-1:-1:-1;;;33422:60:0;;29125:2:1;33422:60:0;;;29107:21:1;29164:2;29144:18;;;29137:30;29203:31;29183:18;;;29176:59;29252:18;;33422:60:0;28923:353:1;33422:60:0;-1:-1:-1;33519:10:0;33512:17;;33180:427;33562:33;33570:10;33582:12;34317:17;;:21;34313:388;;34549:10;34543:17;34606:15;34593:10;34589:2;34585:19;34578:44;34313:388;34676:12;34669:20;;-1:-1:-1;;;34669:20:0;;;;;;;;:::i;14:139:1:-;-1:-1:-1;;;;;97:31:1;;87:42;;77:70;;143:1;140;133:12;158:367;221:8;231:6;285:3;278:4;270:6;266:17;262:27;252:55;;303:1;300;293:12;252:55;-1:-1:-1;326:20:1;;-1:-1:-1;;;;;358:30:1;;355:50;;;401:1;398;391:12;355:50;438:4;430:6;426:17;414:29;;498:3;491:4;481:6;478:1;474:14;466:6;462:27;458:38;455:47;452:67;;;515:1;512;505:12;452:67;158:367;;;;;:::o;530:347::-;581:8;591:6;645:3;638:4;630:6;626:17;622:27;612:55;;663:1;660;653:12;612:55;-1:-1:-1;686:20:1;;-1:-1:-1;;;;;718:30:1;;715:50;;;761:1;758;751:12;715:50;798:4;790:6;786:17;774:29;;850:3;843:4;834:6;826;822:19;818:30;815:39;812:59;;;867:1;864;857:12;882:1198;1046:6;1054;1062;1070;1078;1086;1094;1102;1155:3;1143:9;1134:7;1130:23;1126:33;1123:53;;;1172:1;1169;1162:12;1123:53;1211:9;1198:23;1230:39;1263:5;1230:39;:::i;:::-;1288:5;-1:-1:-1;1340:2:1;1325:18;;1312:32;;-1:-1:-1;1391:2:1;1376:18;;1363:32;;-1:-1:-1;1446:2:1;1431:18;;1418:32;-1:-1:-1;;;;;1499:14:1;;;1496:34;;;1526:1;1523;1516:12;1496:34;1565:70;1627:7;1618:6;1607:9;1603:22;1565:70;:::i;:::-;1654:8;;-1:-1:-1;1539:96:1;-1:-1:-1;1742:3:1;1727:19;;1714:33;;-1:-1:-1;1759:16:1;;;1756:36;;;1788:1;1785;1778:12;1756:36;;1827:60;1879:7;1868:8;1857:9;1853:24;1827:60;:::i;:::-;1906:8;;-1:-1:-1;1801:86:1;-1:-1:-1;;1993:3:1;1978:19;;1965:33;2007:41;1965:33;2007:41;:::i;:::-;2067:7;2057:17;;;882:1198;;;;;;;;;;;:::o;2267:::-;2431:6;2439;2447;2455;2463;2471;2479;2487;2540:3;2528:9;2519:7;2515:23;2511:33;2508:53;;;2557:1;2554;2547:12;2508:53;2596:9;2583:23;2615:39;2648:5;2615:39;:::i;:::-;2673:5;-1:-1:-1;2730:2:1;2715:18;;2702:32;2743:41;2702:32;2743:41;:::i;:::-;2803:7;-1:-1:-1;2857:2:1;2842:18;;2829:32;;-1:-1:-1;2908:2:1;2893:18;;2880:32;;-1:-1:-1;2963:3:1;2948:19;;2935:33;-1:-1:-1;;;;;3017:14:1;;;3014:34;;;3044:1;3041;3034:12;3014:34;3083:70;3145:7;3136:6;3125:9;3121:22;3083:70;:::i;:::-;3172:8;;-1:-1:-1;3057:96:1;-1:-1:-1;3260:3:1;3245:19;;3232:33;;-1:-1:-1;3277:16:1;;;3274:36;;;3306:1;3303;3296:12;3274:36;;3345:60;3397:7;3386:8;3375:9;3371:24;3345:60;:::i;:::-;2267:1198;;;;-1:-1:-1;2267:1198:1;;-1:-1:-1;2267:1198:1;;;;;;3424:8;-1:-1:-1;;;2267:1198:1:o;3662:889::-;3806:6;3814;3822;3830;3838;3846;3899:3;3887:9;3878:7;3874:23;3870:33;3867:53;;;3916:1;3913;3906:12;3867:53;3955:9;3942:23;3974:39;4007:5;3974:39;:::i;:::-;4032:5;-1:-1:-1;4084:2:1;4069:18;;4056:32;;-1:-1:-1;4135:2:1;4120:18;;4107:32;;-1:-1:-1;4190:2:1;4175:18;;4162:32;-1:-1:-1;;;;;4206:30:1;;4203:50;;;4249:1;4246;4239:12;4203:50;4288:70;4350:7;4341:6;4330:9;4326:22;4288:70;:::i;:::-;4377:8;;-1:-1:-1;4262:96:1;-1:-1:-1;;4464:3:1;4449:19;;4436:33;4478:41;4436:33;4478:41;:::i;:::-;4538:7;4528:17;;;3662:889;;;;;;;;:::o;4556:337::-;4638:6;4646;4699:2;4687:9;4678:7;4674:23;4670:32;4667:52;;;4715:1;4712;4705:12;4667:52;4754:9;4741:23;4773:39;4806:5;4773:39;:::i;:::-;4831:5;4883:2;4868:18;;;;4855:32;;-1:-1:-1;;;4556:337:1:o;4898:731::-;5025:6;5033;5041;5049;5057;5110:3;5098:9;5089:7;5085:23;5081:33;5078:53;;;5127:1;5124;5117:12;5078:53;5166:9;5153:23;5185:39;5218:5;5185:39;:::i;:::-;5243:5;-1:-1:-1;5295:2:1;5280:18;;5267:32;;-1:-1:-1;5346:2:1;5331:18;;5318:32;;-1:-1:-1;5401:2:1;5386:18;;5373:32;-1:-1:-1;;;;;5417:30:1;;5414:50;;;5460:1;5457;5450:12;5414:50;5499:70;5561:7;5552:6;5541:9;5537:22;5499:70;:::i;:::-;4898:731;;;;-1:-1:-1;4898:731:1;;-1:-1:-1;5588:8:1;;5473:96;4898:731;-1:-1:-1;;;4898:731:1:o;5842:934::-;6041:6;6049;6057;6065;6118:2;6106:9;6097:7;6093:23;6089:32;6086:52;;;6134:1;6131;6124:12;6086:52;6173:9;6160:23;6192:39;6225:5;6192:39;:::i;:::-;6250:5;-1:-1:-1;6306:2:1;6291:18;;6278:32;-1:-1:-1;;;;;6359:14:1;;;6356:34;;;6386:1;6383;6376:12;6356:34;6409:22;;;;6465:3;6447:16;;;6443:26;6440:46;;;6482:1;6479;6472:12;6440:46;6505:2;;-1:-1:-1;6560:2:1;6545:18;;6532:32;;6576:16;;;6573:36;;;6605:1;6602;6595:12;6573:36;;6644:72;6708:7;6697:8;6686:9;6682:24;6644:72;:::i;:::-;5842:934;;;;-1:-1:-1;6735:8:1;-1:-1:-1;;;;5842:934:1:o;7511:1040::-;7658:6;7666;7674;7682;7690;7698;7706;7759:3;7747:9;7738:7;7734:23;7730:33;7727:53;;;7776:1;7773;7766:12;7727:53;7815:9;7802:23;7834:39;7867:5;7834:39;:::i;:::-;7892:5;-1:-1:-1;7944:2:1;7929:18;;7916:32;;-1:-1:-1;7995:2:1;7980:18;;7967:32;;-1:-1:-1;8050:2:1;8035:18;;8022:32;-1:-1:-1;;;;;8103:14:1;;;8100:34;;;8130:1;8127;8120:12;8100:34;8169:70;8231:7;8222:6;8211:9;8207:22;8169:70;:::i;:::-;8258:8;;-1:-1:-1;8143:96:1;-1:-1:-1;8346:3:1;8331:19;;8318:33;;-1:-1:-1;8363:16:1;;;8360:36;;;8392:1;8389;8382:12;8360:36;;8431:60;8483:7;8472:8;8461:9;8457:24;8431:60;:::i;:::-;7511:1040;;;;-1:-1:-1;7511:1040:1;;-1:-1:-1;7511:1040:1;;;;8405:86;;-1:-1:-1;;;7511:1040:1:o;8556:573::-;8660:6;8668;8676;8684;8737:2;8725:9;8716:7;8712:23;8708:32;8705:52;;;8753:1;8750;8743:12;8705:52;8789:9;8776:23;8766:33;;8846:2;8835:9;8831:18;8818:32;8808:42;;8901:2;8890:9;8886:18;8873:32;-1:-1:-1;;;;;8920:6:1;8917:30;8914:50;;;8960:1;8957;8950:12;8914:50;8999:70;9061:7;9052:6;9041:9;9037:22;8999:70;:::i;9134:255::-;9193:6;9246:2;9234:9;9225:7;9221:23;9217:32;9214:52;;;9262:1;9259;9252:12;9214:52;9301:9;9288:23;9320:39;9353:5;9320:39;:::i;9394:543::-;9480:6;9488;9496;9504;9557:2;9545:9;9536:7;9532:23;9528:32;9525:52;;;9573:1;9570;9563:12;9525:52;9609:9;9596:23;9586:33;;9666:2;9655:9;9651:18;9638:32;9628:42;;9721:2;9710:9;9706:18;9693:32;-1:-1:-1;;;;;9740:6:1;9737:30;9734:50;;;9780:1;9777;9770:12;9734:50;9819:58;9869:7;9860:6;9849:9;9845:22;9819:58;:::i;12229:521::-;12306:4;12312:6;12372:11;12359:25;12466:2;12462:7;12451:8;12435:14;12431:29;12427:43;12407:18;12403:68;12393:96;;12485:1;12482;12475:12;12393:96;12512:33;;12564:20;;;-1:-1:-1;;;;;;12596:30:1;;12593:50;;;12639:1;12636;12629:12;12593:50;12672:4;12660:17;;-1:-1:-1;12703:14:1;12699:27;;;12689:38;;12686:58;;;12740:1;12737;12730:12;12755:266;12843:6;12838:3;12831:19;12895:6;12888:5;12881:4;12876:3;12872:14;12859:43;-1:-1:-1;12947:1:1;12922:16;;;12940:4;12918:27;;;12911:38;;;;13003:2;12982:15;;;-1:-1:-1;;12978:29:1;12969:39;;;12965:50;;12755:266::o;13026:1820::-;13275:2;13327:21;;;13300:18;;;13383:22;;;13246:4;;13424:2;13442:18;;;13506:1;13502:14;;;13487:30;;13483:39;;13545:6;13246:4;13579:1238;13593:6;13590:1;13587:13;13579:1238;;;13658:22;;;-1:-1:-1;;13654:36:1;13642:49;;13730:20;;13805:14;13801:27;;;-1:-1:-1;;13797:42:1;13773:67;;13763:95;;13854:1;13851;13844:12;13763:95;13884:31;;13970:19;;13955:35;;14040:14;;;14027:28;14010:15;;;14003:53;14106:14;;;14093:28;14076:15;;;14069:53;13938:4;14145;14203:14;;;14190:28;14275:14;14271:26;;;-1:-1:-1;;14267:40:1;14241:67;;14231:95;;14322:1;14319;14312:12;14231:95;14354:32;;;14462:16;;;;-1:-1:-1;14413:21:1;-1:-1:-1;;;;;14494:30:1;;14491:50;;;14537:1;14534;14527:12;14491:50;14590:6;14574:14;14570:27;14561:7;14557:41;14554:61;;;14611:1;14608;14601:12;14554:61;14652:2;14647;14639:6;14635:15;14628:27;14678:59;14733:2;14725:6;14721:15;14713:6;14704:7;14678:59;:::i;:::-;14795:12;;;;14668:69;-1:-1:-1;;;14760:15:1;;;;-1:-1:-1;;13615:1:1;13608:9;13579:1238;;;-1:-1:-1;14834:6:1;;13026:1820;-1:-1:-1;;;;;;;;13026:1820:1:o;15558:127::-;15619:10;15614:3;15610:20;15607:1;15600:31;15650:4;15647:1;15640:15;15674:4;15671:1;15664:15;15690:128;15757:9;;;15778:11;;;15775:37;;;15792:18;;:::i;15823:127::-;15884:10;15879:3;15875:20;15872:1;15865:31;15915:4;15912:1;15905:15;15939:4;15936:1;15929:15;16671:135;16710:3;16731:17;;;16728:43;;16751:18;;:::i;:::-;-1:-1:-1;16798:1:1;16787:13;;16671:135::o;17568:368::-;-1:-1:-1;;;;;;17763:33:1;;17751:46;;17840:6;17832;17828:1;17819:11;;17806:41;17733:3;17870:16;;17888:1;17866:24;17899:13;;;17866:24;17568:368;-1:-1:-1;;17568:368:1:o;17941:250::-;18026:1;18036:113;18050:6;18047:1;18044:13;18036:113;;;18126:11;;;18120:18;18107:11;;;18100:39;18072:2;18065:10;18036:113;;;-1:-1:-1;;18183:1:1;18165:16;;18158:27;17941:250::o;18196:287::-;18325:3;18363:6;18357:13;18379:66;18438:6;18433:3;18426:4;18418:6;18414:17;18379:66;:::i;:::-;18461:16;;;;;18196:287;-1:-1:-1;;18196:287:1:o;18836:271::-;18878:3;18916:5;18910:12;18943:6;18938:3;18931:19;18959:76;19028:6;19021:4;19016:3;19012:14;19005:4;18998:5;18994:16;18959:76;:::i;:::-;19089:2;19068:15;-1:-1:-1;;19064:29:1;19055:39;;;;19096:4;19051:50;;18836:271;-1:-1:-1;;18836:271:1:o;19112:220::-;19261:2;19250:9;19243:21;19224:4;19281:45;19322:2;19311:9;19307:18;19299:6;19281:45;:::i;20259:407::-;20461:2;20443:21;;;20500:2;20480:18;;;20473:30;20539:34;20534:2;20519:18;;20512:62;-1:-1:-1;;;20605:2:1;20590:18;;20583:41;20656:3;20641:19;;20259:407::o;21016:244::-;21173:2;21162:9;21155:21;21136:4;21193:61;21250:2;21239:9;21235:18;21227:6;21219;21193:61;:::i;21265:184::-;21335:6;21388:2;21376:9;21367:7;21363:23;21359:32;21356:52;;;21404:1;21401;21394:12;21356:52;-1:-1:-1;21427:16:1;;21265:184;-1:-1:-1;21265:184:1:o;21454:125::-;21519:9;;;21540:10;;;21537:36;;;21553:18;;:::i;21584:168::-;21657:9;;;21688;;21705:15;;;21699:22;;21685:37;21675:71;;21726:18;;:::i;22425:569::-;-1:-1:-1;;;;;22714:15:1;;;22696:34;;22773:14;;22766:22;22761:2;22746:18;;22739:50;22820:2;22805:18;;22798:34;;;22868:15;;22863:2;22848:18;;22841:43;22676:3;22915;22900:19;;22893:32;;;22639:4;;22942:46;;22968:19;;22960:6;22942:46;:::i;22999:243::-;23076:6;23084;23137:2;23125:9;23116:7;23112:23;23108:32;23105:52;;;23153:1;23150;23143:12;23105:52;-1:-1:-1;;23176:16:1;;23232:2;23217:18;;;23211:25;23176:16;;23211:25;;-1:-1:-1;22999:243:1:o;23247:136::-;23282:3;-1:-1:-1;;;23303:22:1;;23300:48;;23328:18;;:::i;:::-;-1:-1:-1;23368:1:1;23364:13;;23247:136::o;23388:259::-;23458:6;23511:2;23499:9;23490:7;23486:23;23482:32;23479:52;;;23527:1;23524;23517:12;23479:52;23559:9;23553:16;23578:39;23611:5;23578:39;:::i;24661:799::-;25042:3;25080:6;25074:13;25096:66;25155:6;25150:3;25143:4;25135:6;25131:17;25096:66;:::i;:::-;-1:-1:-1;;;25184:16:1;;;25209:23;;;25257:13;;25279:78;25257:13;25344:1;25333:13;;25326:4;25314:17;;25279:78;:::i;:::-;-1:-1:-1;;;25420:1:1;25376:20;;;;25412:10;;;25405:23;25452:1;25444:10;;24661:799;-1:-1:-1;;;;24661:799:1:o;25465:::-;25846:3;25884:6;25878:13;25900:66;25959:6;25954:3;25947:4;25939:6;25935:17;25900:66;:::i;:::-;-1:-1:-1;;;25988:16:1;;;26013:23;;;26061:13;;26083:78;26061:13;26148:1;26137:13;;26130:4;26118:17;;26083:78;:::i;26269:460::-;26501:3;26539:6;26533:13;26555:66;26614:6;26609:3;26602:4;26594:6;26590:17;26555:66;:::i;:::-;-1:-1:-1;;;26643:16:1;;26668:26;;;-1:-1:-1;26721:1:1;26710:13;;26269:460;-1:-1:-1;26269:460:1:o;27504:277::-;27571:6;27624:2;27612:9;27603:7;27599:23;27595:32;27592:52;;;27640:1;27637;27630:12;27592:52;27672:9;27666:16;27725:5;27718:13;27711:21;27704:5;27701:32;27691:60;;27747:1;27744;27737:12;28384:127;28445:10;28440:3;28436:20;28433:1;28426:31;28476:4;28473:1;28466:15;28500:4;28497:1;28490:15

Swarm Source

ipfs://a4b684f7da1ec47b31afe9825e024401b205c413dcf92e35312389e9699a465b

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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