Address Details
contract

0x8a9869c4ba45041A1b853b81fb3006739C98C5eb

Contract Name
LimitOrderProtocol
Creator
0x4c828d–78dc3e at 0x0d1e3a–742ed0
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
7 Transactions
Transfers
0 Transfers
Gas Used
167,163
Last Balance Update
11862310
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
LimitOrderProtocol




Optimization enabled
true
Compiler version
v0.8.11+commit.d7f03943




Optimization runs
1000000
EVM Version
london




Verified at
2022-03-08T20:05:19.429746Z

contracts/LimitOrderProtocol.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "./OrderMixin.sol";
import "./OrderRFQMixin.sol";

/// @title Ubeswap Limit Order Protocol v2
contract LimitOrderProtocol is
    EIP712("Ubeswap Limit Order Protocol", "2"),
    OrderMixin,
    OrderRFQMixin
{
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns(bytes32) {
        return _domainSeparatorV4();
    }
}
        

/_chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  // getRoundData and latestRoundData should both raise "No data present"
  // if they do not have data to report, instead of returning unset values
  // which could be misinterpreted as actual reported values.
  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}
          

/_openzeppelin/contracts/interfaces/IERC1271.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 *
 * _Available since v4.1._
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}
          

/_openzeppelin/contracts/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

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

/_openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

/_openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        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));
        }
    }

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

/_openzeppelin/contracts/utils/Address.sol

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library 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 functionCall(target, data, "Address: low-level call failed");
    }

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

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

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

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

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

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

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

    /**
     * @dev 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) {
        require(isContract(target), "Address: delegate call to non-contract");

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

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

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

/_openzeppelin/contracts/utils/Strings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

/_openzeppelin/contracts/utils/cryptography/ECDSA.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

/_openzeppelin/contracts/utils/cryptography/SignatureChecker.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";
import "../Address.sol";
import "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Gnosis Safe.
 *
 * _Available since v4.1._
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature);
        if (error == ECDSA.RecoverError.NoError && recovered == signer) {
            return true;
        }

        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
        );
        return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271.isValidSignature.selector);
    }
}
          

/_openzeppelin/contracts/utils/cryptography/draft-EIP712.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}
          

/_openzeppelin/contracts/utils/math/SafeCast.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeCast.sol)

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 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
     */
    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 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
     */
    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 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
     */
    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 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
     */
    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 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
     */
    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 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
     */
    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.
     */
    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.
     */
    function toUint256(int256 value) internal pure returns (uint256) {
        require(value >= 0, "SafeCast: value must be positive");
        return uint256(value);
    }

    /**
     * @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) {
        require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
        return int128(value);
    }

    /**
     * @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) {
        require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
        return int64(value);
    }

    /**
     * @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) {
        require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
        return int32(value);
    }

    /**
     * @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) {
        require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
        return int16(value);
    }

    /**
     * @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) {
        require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
        return int8(value);
    }

    /**
     * @dev Converts an unsigned uint256 into a signed int256.
     *
     * Requirements:
     *
     * - input must be less than or equal to maxInt256.
     */
    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);
    }
}
          

/contracts/OrderMixin.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "./helpers/AmountCalculator.sol";
import "./helpers/ChainlinkCalculator.sol";
import "./helpers/NonceManager.sol";
import "./helpers/PredicateHelper.sol";
import "./interfaces/InteractiveNotificationReceiver.sol";
import "./libraries/ArgumentsDecoder.sol";
import "./libraries/Permitable.sol";

/// @title Regular Limit Order mixin
abstract contract OrderMixin is
    EIP712,
    AmountCalculator,
    ChainlinkCalculator,
    NonceManager,
    PredicateHelper,
    Permitable
{
    using Address for address;
    using ArgumentsDecoder for bytes;

    /// @notice Emitted every time order gets filled, including partial fills
    event OrderFilled(
        address indexed maker,
        bytes32 orderHash,
        uint256 remaining
    );

    /// @notice Emitted when order gets cancelled
    event OrderCanceled(
        address indexed maker,
        bytes32 orderHash,
        uint256 remainingRaw
    );

    // Fixed-size order part with core information
    struct StaticOrder {
        uint256 salt;
        address makerAsset;
        address takerAsset;
        address maker;
        address receiver;
        address allowedSender;  // equals to Zero address on public orders
        uint256 makingAmount;
        uint256 takingAmount;
    }

    // `StaticOrder` extension including variable-sized additional order meta information
    struct Order {
        uint256 salt;
        address makerAsset;
        address takerAsset;
        address maker;
        address receiver;
        address allowedSender;  // equals to Zero address on public orders
        uint256 makingAmount;
        uint256 takingAmount;
        bytes makerAssetData;
        bytes takerAssetData;
        bytes getMakerAmount; // this.staticcall(abi.encodePacked(bytes, swapTakerAmount)) => (swapMakerAmount)
        bytes getTakerAmount; // this.staticcall(abi.encodePacked(bytes, swapMakerAmount)) => (swapTakerAmount)
        bytes predicate;      // this.staticcall(bytes) => (bool)
        bytes permit;         // On first fill: permit.1.call(abi.encodePacked(permit.selector, permit.2))
        bytes interaction;
    }

    // Amounts used when filling an order
    struct OrderAmounts {
        uint256 makingAmount;
        uint256 takingAmount;
        uint256 thresholdAmount; // Specifies maximum allowed takingAmount when takingAmount is zero, otherwise specifies minimum allowed makingAmount
    }

    bytes32 constant public LIMIT_ORDER_TYPEHASH = keccak256(
        "Order(uint256 salt,address makerAsset,address takerAsset,address maker,address receiver,address allowedSender,uint256 makingAmount,uint256 takingAmount,bytes makerAssetData,bytes takerAssetData,bytes getMakerAmount,bytes getTakerAmount,bytes predicate,bytes permit,bytes interaction)"
    );
    uint256 constant private _ORDER_DOES_NOT_EXIST = 0;
    uint256 constant private _ORDER_FILLED = 1;

    /// @notice Stores unfilled amounts for each order plus one.
    /// Therefore 0 means order doesn't exist and 1 means order was filled
    mapping(bytes32 => uint256) private _remaining;

    /// @notice Returns unfilled amount for order. Throws if order does not exist
    function remaining(bytes32 orderHash) external view returns(uint256) {
        uint256 amount = _remaining[orderHash];
        require(amount != _ORDER_DOES_NOT_EXIST, "LOP: Unknown order");
        unchecked { amount -= 1; }
        return amount;
    }

    /// @notice Returns unfilled amount for order
    /// @return Result Unfilled amount of order plus one if order exists. Otherwise 0
    function remainingRaw(bytes32 orderHash) external view returns(uint256) {
        return _remaining[orderHash];
    }

    /// @notice Same as `remainingRaw` but for multiple orders
    function remainingsRaw(bytes32[] memory orderHashes) external view returns(uint256[] memory) {
        uint256[] memory results = new uint256[](orderHashes.length);
        for (uint256 i = 0; i < orderHashes.length; i++) {
            results[i] = _remaining[orderHashes[i]];
        }
        return results;
    }

    /**
     * @notice Calls every target with corresponding data. Then reverts with CALL_RESULTS_0101011 where zeroes and ones
     * denote failure or success of the corresponding call
     * @param targets Array of addresses that will be called
     * @param data Array of data that will be passed to each call
     */
    function simulateCalls(address[] calldata targets, bytes[] calldata data) external {
        require(targets.length == data.length, "LOP: array size mismatch");
        bytes memory reason = new bytes(targets.length);
        for (uint256 i = 0; i < targets.length; i++) {
            // solhint-disable-next-line avoid-low-level-calls
            (bool success, bytes memory result) = targets[i].call(data[i]);
            if (success && result.length > 0) {
                success = result.length == 32 && result.decodeBool();
            }
            reason[i] = success ? bytes1("1") : bytes1("0");
        }

        // Always revert and provide per call results
        revert(string(abi.encodePacked("CALL_RESULTS_", reason)));
    }

    /// @notice Cancels order by setting remaining amount to zero
    function cancelOrder(Order memory order) external {
        require(order.maker == msg.sender, "LOP: Access denied");

        bytes32 orderHash = hashOrder(order);
        uint256 orderRemaining = _remaining[orderHash];
        require(orderRemaining != _ORDER_FILLED, "LOP: already filled");
        emit OrderCanceled(msg.sender, orderHash, orderRemaining);
        _remaining[orderHash] = _ORDER_FILLED;
    }

    /// @notice Fills an order. If one doesn't exist (first fill) it will be created using order.makerAssetData
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param orderAmounts Amounts to fill
    function fillOrder(
        Order memory order,
        bytes calldata signature,
        OrderAmounts calldata orderAmounts
    ) external returns(uint256 /* actualMakingAmount */, uint256 /* actualTakingAmount */) {
        return _fillOrderTo(order, signature, orderAmounts, msg.sender, new bytes(0));
    }

    /// @notice Same as `fillOrder` but calls permit first,
    /// allowing to approve token spending and make a swap in one transaction.
    /// Also allows to specify funds destination instead of `msg.sender`
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param orderAmounts Amounts to fill
    /// @param target Address that will receive swap funds
    /// @param permit Should consist of abiencoded token address and encoded `IERC20Permit.permit` call.
    /// @dev See tests for examples
    function fillOrderToWithPermit(
        Order memory order,
        bytes calldata signature,
        OrderAmounts calldata orderAmounts,
        address target,
        bytes calldata permit
    ) external returns(uint256 /* actualMakingAmount */, uint256 /* actualTakingAmount */) {
        require(permit.length >= 20, "LOP: permit length too low");
        (address token, bytes calldata permitData) = permit.decodeTargetAndData();
        _permit(token, permitData);
        return _fillOrderTo(order, signature, orderAmounts, target, new bytes(0));
    }

    /// @notice Same as `fillOrder` but allows to specify funds destination instead of `msg.sender`
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param orderAmounts Amounts to fill
    /// @param target Address that will receive swap funds
    function fillOrderTo(
        Order memory order,
        bytes calldata signature,
        OrderAmounts calldata orderAmounts,
        address target
    ) public returns(uint256 /* actualMakingAmount */, uint256 /* actualTakingAmount */) {
        return _fillOrderTo(
            order,
            signature,
            orderAmounts,
            target,
            new bytes(0)
        );
    }

    /// @notice Same as `fillOrderTo` but allows for additional interaction between asset transfers
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param orderAmounts Amounts to fill
    /// @param target Address that will receive swap funds
    /// @param extraInteraction Optional interaction. If present, is triggered between asset transfers
    function fillOrderToWithExtraInteraction(
        Order memory order,
        bytes calldata signature,
        OrderAmounts calldata orderAmounts,
        address target,
        bytes calldata extraInteraction
    ) public returns(uint256 /* actualMakingAmount */, uint256 /* actualTakingAmount */) {
        return _fillOrderTo(
            order,
            signature,
            orderAmounts,
            target,
            extraInteraction
        );
    }

    /// @notice Base implementation for order filling
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param orderAmounts Amounts to fill
    /// @param target Address that will receive swap funds
    /// @param extraInteraction Optional interaction. If present, is triggered between asset transfers
    function _fillOrderTo(
        Order memory order,
        bytes calldata signature,
        OrderAmounts memory orderAmounts,
        address target,
        bytes memory extraInteraction
    ) internal returns(uint256 /* actualMakingAmount */, uint256 /* actualTakingAmount */) {
        require(target != address(0), "LOP: zero target is forbidden");
        bytes32 orderHash = hashOrder(order);

        {  // Stack too deep
            uint256 remainingMakerAmount = _remaining[orderHash];
            require(remainingMakerAmount != _ORDER_FILLED, "LOP: remaining amount is 0");
            require(order.allowedSender == address(0) || order.allowedSender == msg.sender, "LOP: private order");
            if (remainingMakerAmount == _ORDER_DOES_NOT_EXIST) {
                // First fill: validate order and permit maker asset
                require(SignatureChecker.isValidSignatureNow(order.maker, orderHash, signature), "LOP: bad signature");
                remainingMakerAmount = order.makingAmount;
                if (order.permit.length >= 20) {
                    // proceed only if permit length is enough to store address
                    (address token, bytes memory permit) = order.permit.decodeTargetAndCalldata();
                    _permitMemory(token, permit);
                    require(_remaining[orderHash] == _ORDER_DOES_NOT_EXIST, "LOP: reentrancy detected");
                }
            } else {
                unchecked { remainingMakerAmount -= 1; }
            }

            // Check if order is valid
            if (order.predicate.length > 0) {
                require(checkPredicate(order), "LOP: predicate returned false");
            }

            // Compute maker and taker assets amount
            if ((orderAmounts.takingAmount == 0) == (orderAmounts.makingAmount == 0)) {
                revert("LOP: only one amount should be 0");
            } else if (orderAmounts.takingAmount == 0) {
                uint256 requestedMakingAmount = orderAmounts.makingAmount;
                if (orderAmounts.makingAmount > remainingMakerAmount) {
                    orderAmounts.makingAmount = remainingMakerAmount;
                }
                orderAmounts.takingAmount = _callGetter(order.getTakerAmount, order.makingAmount, orderAmounts.makingAmount, order.takingAmount);
                // check that actual rate is not worse than what was expected
                // orderAmounts.takingAmount / orderAmounts.makingAmount <= orderAmounts.thresholdAmount / requestedMakingAmount
                require(orderAmounts.takingAmount * requestedMakingAmount <= orderAmounts.thresholdAmount * orderAmounts.makingAmount, "LOP: taking amount too high");
            } else {
                uint256 requestedTakingAmount = orderAmounts.takingAmount;
                orderAmounts.makingAmount = _callGetter(order.getMakerAmount, order.takingAmount, orderAmounts.takingAmount, order.makingAmount);
                if (orderAmounts.makingAmount > remainingMakerAmount) {
                    orderAmounts.makingAmount = remainingMakerAmount;
                    orderAmounts.takingAmount = _callGetter(order.getTakerAmount, order.makingAmount, orderAmounts.makingAmount, order.takingAmount);
                }
                // check that actual rate is not worse than what was expected
                // orderAmounts.makingAmount / orderAmounts.takingAmount >= orderAmounts.thresholdAmount / requestedTakingAmount
                require(orderAmounts.makingAmount * requestedTakingAmount >= orderAmounts.thresholdAmount * orderAmounts.takingAmount, "LOP: making amount too low");
            }

            require(orderAmounts.makingAmount > 0 && orderAmounts.takingAmount > 0, "LOP: can't swap 0 amount");

            // Update remaining amount in storage
            unchecked {
                remainingMakerAmount = remainingMakerAmount - orderAmounts.makingAmount;
                _remaining[orderHash] = remainingMakerAmount + 1;
            }
            emit OrderFilled(msg.sender, orderHash, remainingMakerAmount);
        }

        // Maker => Taker
        _makeCall(
            order.makerAsset,
            abi.encodePacked(
                IERC20.transferFrom.selector,
                uint256(uint160(order.maker)),
                uint256(uint160(target)),
                orderAmounts.makingAmount,
                order.makerAssetData
            )
        );

        // Handle external extraInteraction
        if (extraInteraction.length >= 20) {
            // proceed only if interaction length is enough to store address
            (address interactionTarget, bytes memory interactionData) = extraInteraction.decodeTargetAndCalldata();
            InteractiveNotificationReceiver(interactionTarget).notifyFillOrder(
                msg.sender, order.makerAsset, order.takerAsset, orderAmounts.makingAmount, orderAmounts.takingAmount, interactionData
            );
        }
        
        // Taker => Maker
        _makeCall(
            order.takerAsset,
            abi.encodePacked(
                IERC20.transferFrom.selector,
                uint256(uint160(msg.sender)),
                uint256(uint160(order.receiver == address(0) ? order.maker : order.receiver)),
                orderAmounts.takingAmount,
                order.takerAssetData
            )
        );

        // Maker can handle funds interactively
        if (order.interaction.length >= 20) {
            // proceed only if interaction length is enough to store address
            (address interactionTarget, bytes memory interactionData) = order.interaction.decodeTargetAndCalldata();
            InteractiveNotificationReceiver(interactionTarget).notifyFillOrder(
                msg.sender, order.makerAsset, order.takerAsset, orderAmounts.makingAmount, orderAmounts.takingAmount, interactionData
            );
        }

        return (orderAmounts.makingAmount, orderAmounts.takingAmount);
    }

    /// @notice Checks order predicate
    function checkPredicate(Order memory order) public view returns(bool) {
        bytes memory result = address(this).functionStaticCall(order.predicate, "LOP: predicate call failed");
        require(result.length == 32, "LOP: invalid predicate return");
        return result.decodeBool();
    }

    function hashOrder(Order memory order) public view returns(bytes32) {
        StaticOrder memory staticOrder;
        assembly {  // solhint-disable-line no-inline-assembly
            staticOrder := order
        }
        return _hashTypedDataV4(
            keccak256(
                abi.encode(
                    LIMIT_ORDER_TYPEHASH,
                    staticOrder,
                    keccak256(order.makerAssetData),
                    keccak256(order.takerAssetData),
                    keccak256(order.getMakerAmount),
                    keccak256(order.getTakerAmount),
                    keccak256(order.predicate),
                    keccak256(order.permit),
                    keccak256(order.interaction)
                )
            )
        );
    }

    function _makeCall(address asset, bytes memory assetData) private {
        bytes memory result = asset.functionCall(assetData, "LOP: asset.call failed");
        if (result.length > 0) {
            require(result.length == 32 && result.decodeBool(), "LOP: asset.call bad result");
        }
    }

    function _callGetter(bytes memory getter, uint256 orderExpectedAmount, uint256 amount, uint256 orderResultAmount) private view returns(uint256) {
        if (getter.length == 0) {
            // On empty getter calldata only exact amount is allowed
            require(amount == orderExpectedAmount, "LOP: wrong amount");
            return orderResultAmount;
        } else {
            bytes memory result = address(this).functionStaticCall(abi.encodePacked(getter, amount), "LOP: getAmount call failed");
            require(result.length == 32, "LOP: invalid getAmount return");
            return result.decodeUint256();
        }
    }
}
          

/contracts/OrderRFQMixin.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import "./helpers/AmountCalculator.sol";
import "./libraries/Permitable.sol";

/// @title RFQ Limit Order mixin
abstract contract OrderRFQMixin is EIP712, AmountCalculator, Permitable {
    using SafeERC20 for IERC20;

    /// @notice Emitted when RFQ gets filled
    event OrderFilledRFQ(
        bytes32 orderHash,
        uint256 makingAmount
    );

    struct OrderRFQ {
        uint256 info;  // lowest 64 bits is the order id, next 64 bits is the expiration timestamp
        IERC20 makerAsset;
        IERC20 takerAsset;
        address maker;
        address allowedSender;  // equals to Zero address on public orders
        uint256 makingAmount;
        uint256 takingAmount;
    }

    bytes32 constant public LIMIT_ORDER_RFQ_TYPEHASH = keccak256(
        "OrderRFQ(uint256 info,address makerAsset,address takerAsset,address maker,address allowedSender,uint256 makingAmount,uint256 takingAmount)"
    );

    mapping(address => mapping(uint256 => uint256)) private _invalidator;

    /// @notice Returns bitmask for double-spend invalidators based on lowest byte of order.info and filled quotes
    /// @return Result Each bit represents whether corresponding was already invalidated
    function invalidatorForOrderRFQ(address maker, uint256 slot) external view returns(uint256) {
        return _invalidator[maker][slot];
    }

    /// @notice Cancels order's quote
    function cancelOrderRFQ(uint256 orderInfo) external {
        _invalidateOrder(msg.sender, orderInfo);
    }

    /// @notice Fills order's quote, fully or partially (whichever is possible)
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param makingAmount Making amount
    /// @param takingAmount Taking amount
    function fillOrderRFQ(
        OrderRFQ memory order,
        bytes calldata signature,
        uint256 makingAmount,
        uint256 takingAmount
    ) external returns(uint256, uint256) {
        return fillOrderRFQTo(order, signature, makingAmount, takingAmount, msg.sender);
    }

    /// @notice Fills Same as `fillOrderRFQ` but calls permit first,
    /// allowing to approve token spending and make a swap in one transaction.
    /// Also allows to specify funds destination instead of `msg.sender`
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param makingAmount Making amount
    /// @param takingAmount Taking amount
    /// @param target Address that will receive swap funds
    /// @param permit Should consist of abiencoded token address and encoded `IERC20Permit.permit` call.
    /// @dev See tests for examples
    function fillOrderRFQToWithPermit(
        OrderRFQ memory order,
        bytes calldata signature,
        uint256 makingAmount,
        uint256 takingAmount,
        address target,
        bytes calldata permit
    ) external returns(uint256, uint256) {
        _permit(address(order.takerAsset), permit);
        return fillOrderRFQTo(order, signature, makingAmount, takingAmount, target);
    }

    /// @notice Same as `fillOrderRFQ` but allows to specify funds destination instead of `msg.sender`
    /// @param order Order quote to fill
    /// @param signature Signature to confirm quote ownership
    /// @param makingAmount Making amount
    /// @param takingAmount Taking amount
    /// @param target Address that will receive swap funds
    function fillOrderRFQTo(
        OrderRFQ memory order,
        bytes calldata signature,
        uint256 makingAmount,
        uint256 takingAmount,
        address target
    ) public returns(uint256, uint256) {
        require(target != address(0), "LOP: zero target is forbidden");

        address maker = order.maker;

        // Validate order
        require(order.allowedSender == address(0) || order.allowedSender == msg.sender, "LOP: private order");
        bytes32 orderHash = hashOrderRFQ(order);
        require(SignatureChecker.isValidSignatureNow(maker, orderHash, signature), "LOP: bad signature");

        {  // Stack too deep
            uint256 info = order.info;
            // Check time expiration
            uint256 expiration = uint128(info) >> 64;
            require(expiration == 0 || block.timestamp <= expiration, "LOP: order expired");  // solhint-disable-line not-rely-on-time
            _invalidateOrder(maker, info);
        }

        {  // stack too deep
            uint256 orderMakingAmount = order.makingAmount;
            uint256 orderTakingAmount = order.takingAmount;
            // Compute partial fill if needed
            if (takingAmount == 0 && makingAmount == 0) {
                // Two zeros means whole order
                makingAmount = orderMakingAmount;
                takingAmount = orderTakingAmount;
            }
            else if (takingAmount == 0) {
                require(makingAmount <= orderMakingAmount, "LOP: making amount exceeded");
                takingAmount = getTakerAmount(orderMakingAmount, orderTakingAmount, makingAmount);
            }
            else if (makingAmount == 0) {
                require(takingAmount <= orderTakingAmount, "LOP: taking amount exceeded");
                makingAmount = getMakerAmount(orderMakingAmount, orderTakingAmount, takingAmount);
            }
            else {
                revert("LOP: both amounts are non-zero");
            }
        }

        require(makingAmount > 0 && takingAmount > 0, "LOP: can't swap 0 amount");

        // Maker => Taker, Taker => Maker
        order.makerAsset.safeTransferFrom(maker, target, makingAmount);
        order.takerAsset.safeTransferFrom(msg.sender, maker, takingAmount);

        emit OrderFilledRFQ(orderHash, makingAmount);
        return (makingAmount, takingAmount);
    }

    function hashOrderRFQ(OrderRFQ memory order) public view returns(bytes32) {
        return _hashTypedDataV4(keccak256(abi.encode(LIMIT_ORDER_RFQ_TYPEHASH, order)));
    }

    function _invalidateOrder(address maker, uint256 orderInfo) private {
        uint256 invalidatorSlot = uint64(orderInfo) >> 8;
        uint256 invalidatorBit = 1 << uint8(orderInfo);
        mapping(uint256 => uint256) storage invalidatorStorage = _invalidator[maker];
        uint256 invalidator = invalidatorStorage[invalidatorSlot];
        require(invalidator & invalidatorBit == 0, "LOP: invalidated order");
        invalidatorStorage[invalidatorSlot] = invalidator | invalidatorBit;
    }
}
          

/contracts/helpers/AmountCalculator.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

import "@openzeppelin/contracts/utils/Address.sol";

/// @title A helper contract for calculations related to order amounts
contract AmountCalculator {
    using Address for address;

    /// @notice Calculates maker amount
    /// @return Result Floored maker amount
    function getMakerAmount(uint256 orderMakerAmount, uint256 orderTakerAmount, uint256 swapTakerAmount) public pure returns(uint256) {
        return swapTakerAmount * orderMakerAmount / orderTakerAmount;
    }

    /// @notice Calculates taker amount
    /// @return Result Ceiled taker amount
    function getTakerAmount(uint256 orderMakerAmount, uint256 orderTakerAmount, uint256 swapMakerAmount) public pure returns(uint256) {
        return (swapMakerAmount * orderTakerAmount + orderMakerAmount - 1) / orderMakerAmount;
    }

    /// @notice Performs an arbitrary call to target with data
    /// @return Result Bytes transmuted to uint256
    function arbitraryStaticCall(address target, bytes memory data) external view returns(uint256) {
        (bytes memory result) = target.functionStaticCall(data, "AC: arbitraryStaticCall");
        return abi.decode(result, (uint256));
    }
}
          

/contracts/helpers/ChainlinkCalculator.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";


/// @title A helper contract for interactions with https://docs.chain.link
contract ChainlinkCalculator {
    using SafeCast for int256;

    uint256 private constant _SPREAD_DENOMINATOR = 1e9;
    uint256 private constant _INVERSE_MASK = 1 << 255;

    /// @notice Calculates price of token relative to oracle unit (ETH or USD)
    /// @param inverseAndSpread concatenated inverse flag and spread.
    /// Lowest 254 bits specify spread amount. Spread is scaled by 1e9, i.e. 101% = 1.01e9, 99% = 0.99e9.
    /// Highest bit is set when oracle price should be inverted,
    /// e.g. for DAI-ETH oracle, inverse=false means that we request DAI price in ETH
    /// and inverse=true means that we request ETH price in DAI
    /// @return Amount * spread * oracle price
    function singlePrice(AggregatorV3Interface oracle, uint256 inverseAndSpread, uint256 amount) external view returns(uint256) {
        (, int256 latestAnswer,,,) = oracle.latestRoundData();
        bool inverse = inverseAndSpread & _INVERSE_MASK > 0;
        uint256 spread = inverseAndSpread & (~_INVERSE_MASK);
        if (inverse) {
            return amount * spread * (10 ** oracle.decimals()) / latestAnswer.toUint256() / _SPREAD_DENOMINATOR;
        } else {
            return amount * spread * latestAnswer.toUint256() / (10 ** oracle.decimals()) / _SPREAD_DENOMINATOR;
        }
    }

    /// @notice Calculates price of token A relative to token B. Note that order is important
    /// @return Result Token A relative price times amount
    function doublePrice(AggregatorV3Interface oracle1, AggregatorV3Interface oracle2, uint256 spread, int256 decimalsScale, uint256 amount) external view returns(uint256) {
        require(oracle1.decimals() == oracle2.decimals(), "CC: oracle decimals don't match");
        (, int256 latestAnswer1,,,) = oracle1.latestRoundData();
        (, int256 latestAnswer2,,,) = oracle2.latestRoundData();
        if (decimalsScale > 0) {
            return amount * spread * latestAnswer1.toUint256() * (10 ** decimalsScale.toUint256()) / latestAnswer2.toUint256() / _SPREAD_DENOMINATOR;
        } else if (decimalsScale < 0) {
            return amount * spread * latestAnswer1.toUint256() / latestAnswer2.toUint256() / _SPREAD_DENOMINATOR / (10 ** (-decimalsScale).toUint256());
        } else {
            return amount * spread * latestAnswer1.toUint256() / latestAnswer2.toUint256() / _SPREAD_DENOMINATOR;
        }
    }
}
          

/contracts/helpers/NonceManager.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

/// @title A helper contract for managing nonce of tx sender
contract NonceManager {
    event NonceIncreased(address indexed maker, uint256 newNonce);

    mapping(address => uint256) public nonce;

    /// @notice Advances nonce by one
    function increaseNonce() external {
        advanceNonce(1);
    }

    /// @notice Advances nonce by specified amount
    function advanceNonce(uint8 amount) public {
        uint256 newNonce = nonce[msg.sender] + amount;
        nonce[msg.sender] = newNonce;
        emit NonceIncreased(msg.sender, newNonce);
    }

    /// @notice Checks if `makerAddress` has specified `makerNonce`
    /// @return Result True if `makerAddress` has specified nonce. Otherwise, false
    function nonceEquals(address makerAddress, uint256 makerNonce) external view returns(bool) {
        return nonce[makerAddress] == makerNonce;
    }
}
          

/contracts/helpers/PredicateHelper.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;

import "@openzeppelin/contracts/utils/Address.sol";


/// @title A helper contract for executing boolean functions on arbitrary target call results
contract PredicateHelper {
    using Address for address;

    /// @notice Calls every target with corresponding data
    /// @return Result True if call to any target returned True. Otherwise, false
    function or(address[] calldata targets, bytes[] calldata data) external view returns(bool) {
        require(targets.length == data.length, "PH: input array size mismatch");
        for (uint256 i = 0; i < targets.length; i++) {
            bytes memory result = targets[i].functionStaticCall(data[i], "PH: 'or' subcall failed");
            require(result.length == 32, "PH: invalid call result");
            if (abi.decode(result, (bool))) {
                return true;
            }
        }
        return false;
    }

    /// @notice Calls every target with corresponding data
    /// @return Result True if calls to all targets returned True. Otherwise, false
    function and(address[] calldata targets, bytes[] calldata data) external view returns(bool) {
        require(targets.length == data.length, "PH: input array size mismatch");
        for (uint256 i = 0; i < targets.length; i++) {
            bytes memory result = targets[i].functionStaticCall(data[i], "PH: 'and' subcall failed");
            require(result.length == 32, "PH: invalid call result");
            if (!abi.decode(result, (bool))) {
                return false;
            }
        }
        return true;
    }

    /// @notice Calls target with specified data and tests if it's equal to the value
    /// @param value Value to test
    /// @return Result True if call to target returns the same value as `value`. Otherwise, false
    function eq(uint256 value, address target, bytes memory data) external view returns(bool) {
        bytes memory result = target.functionStaticCall(data, "PH: eq");
        require(result.length == 32, "PH: invalid call result");
        return abi.decode(result, (uint256)) == value;
    }

    /// @notice Calls target with specified data and tests if it's lower than value
    /// @param value Value to test
    /// @return Result True if call to target returns value which is lower than `value`. Otherwise, false
    function lt(uint256 value, address target, bytes memory data) external view returns(bool) {
        bytes memory result = target.functionStaticCall(data, "PH: lt");
        require(result.length == 32, "PH: invalid call result");
        return abi.decode(result, (uint256)) < value;
    }

    /// @notice Calls target with specified data and tests if it's bigger than value
    /// @param value Value to test
    /// @return Result True if call to target returns value which is bigger than `value`. Otherwise, false
    function gt(uint256 value, address target, bytes memory data) external view returns(bool) {
        bytes memory result = target.functionStaticCall(data, "PH: gt");
        require(result.length == 32, "PH: invalid call result");
        return abi.decode(result, (uint256)) > value;
    }

    /// @notice Checks passed time against block timestamp
    /// @return Result True if current block timestamp is lower than `time`. Otherwise, false
    function timestampBelow(uint256 time) external view returns(bool) {
        return block.timestamp < time;  // solhint-disable-line not-rely-on-time
    }
}
          

/contracts/interfaces/IDaiLikePermit.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

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

/contracts/interfaces/InteractiveNotificationReceiver.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

/// @title Interface for interactor which acts between `maker => taker` and `taker => maker` transfers.
interface InteractiveNotificationReceiver {
    /// @notice Callback method that gets called after taker transferred funds to maker but before
    /// the opposite transfer happened
    function notifyFillOrder(
        address taker,
        address makerAsset,
        address takerAsset,
        uint256 makingAmount,
        uint256 takingAmount,
        bytes memory interactiveData
    ) external;
}
          

/contracts/libraries/ArgumentsDecoder.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

/// @title Library with gas efficient alternatives to `abi.decode`
library ArgumentsDecoder {
    function decodeUint256(bytes memory data) internal pure returns(uint256) {
        uint256 value;
        assembly { // solhint-disable-line no-inline-assembly
            value := mload(add(data, 0x20))
        }
        return value;
    }

    function decodeBool(bytes memory data) internal pure returns(bool) {
        bool value;
        assembly { // solhint-disable-line no-inline-assembly
            value := eq(mload(add(data, 0x20)), 1)
        }
        return value;
    }

    function decodeTargetAndCalldata(bytes memory data) internal pure returns(address, bytes memory) {
        address target;
        bytes memory args;
        assembly {  // solhint-disable-line no-inline-assembly
            target := mload(add(data, 0x14))
            args := add(data, 0x14)
            mstore(args, sub(mload(data), 0x14))
        }
        return (target, args);
    }

    function decodeTargetAndData(bytes calldata data) internal pure returns(address, bytes calldata) {
        address target;
        bytes calldata args;
        assembly {  // solhint-disable-line no-inline-assembly
            target := shr(96, calldataload(data.offset))
        }
        args = data[20:];
        return (target, args);
    }
}
          

/contracts/libraries/Permitable.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;

import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "./RevertReasonParser.sol";
import "../interfaces/IDaiLikePermit.sol";

/// @title Base contract with common permit handling logics
abstract 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: "));
            }
        }
    }

    function _permitMemory(address token, bytes memory 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: "));
            }
        }
    }
}
          

/contracts/libraries/RevertReasonParser.sol

// SPDX-License-Identifier: MIT

pragma solidity 0.8.11;
pragma abicoder v1;


/// @title Library that allows to parse unsuccessful arbitrary calls revert reasons.
/// See https://solidity.readthedocs.io/en/latest/control-structures.html#revert for details.
/// Note that we assume revert reason being abi-encoded as Error(string) so it may fail to parse reason
/// if structured reverts appear in the future.
///
/// All unsuccessful parsings get encoded as Unknown(data) string
library RevertReasonParser {
    bytes4 constant private _PANIC_SELECTOR = bytes4(keccak256("Panic(uint256)"));
    bytes4 constant private _ERROR_SELECTOR = bytes4(keccak256("Error(string)"));

    function parse(bytes memory data, string memory prefix) internal pure returns (string memory) {
        if (data.length >= 4) {
            bytes4 selector;

            assembly {  // solhint-disable-line no-inline-assembly
                selector := mload(add(data, 0x20))
            }

            // 68 = 4-byte selector + 32 bytes offset + 32 bytes length
            if (selector == _ERROR_SELECTOR && data.length >= 68) {
                uint256 offset;
                bytes memory reason;
                assembly {  // solhint-disable-line no-inline-assembly
                    // 36 = 32 bytes data length + 4-byte selector
                    offset := mload(add(data, 36))
                    reason := add(data, add(36, offset))
                }
                /*
                    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 offset + string length + extra 36 bytes is less than overall data length
                */
                require(data.length >= 36 + offset + reason.length, "Invalid revert reason");
                return string(abi.encodePacked(prefix, "Error(", reason, ")"));
            }
            // 36 = 4-byte selector + 32 bytes integer
            else if (selector == _PANIC_SELECTOR && data.length == 36) {
                uint256 code;
                assembly {  // solhint-disable-line no-inline-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(", _toHex(data), ")"));
    }

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

    function _toHex(bytes memory data) private pure returns(string memory) {
        bytes16 alphabet = 0x30313233343536373839616263646566;
        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);
    }
}
          

Contract ABI

[{"type":"event","name":"NonceIncreased","inputs":[{"type":"address","name":"maker","internalType":"address","indexed":true},{"type":"uint256","name":"newNonce","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OrderCanceled","inputs":[{"type":"address","name":"maker","internalType":"address","indexed":true},{"type":"bytes32","name":"orderHash","internalType":"bytes32","indexed":false},{"type":"uint256","name":"remainingRaw","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OrderFilled","inputs":[{"type":"address","name":"maker","internalType":"address","indexed":true},{"type":"bytes32","name":"orderHash","internalType":"bytes32","indexed":false},{"type":"uint256","name":"remaining","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OrderFilledRFQ","inputs":[{"type":"bytes32","name":"orderHash","internalType":"bytes32","indexed":false},{"type":"uint256","name":"makingAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DOMAIN_SEPARATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"LIMIT_ORDER_RFQ_TYPEHASH","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"LIMIT_ORDER_TYPEHASH","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"advanceNonce","inputs":[{"type":"uint8","name":"amount","internalType":"uint8"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"and","inputs":[{"type":"address[]","name":"targets","internalType":"address[]"},{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"arbitraryStaticCall","inputs":[{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelOrder","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelOrderRFQ","inputs":[{"type":"uint256","name":"orderInfo","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"checkPredicate","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"doublePrice","inputs":[{"type":"address","name":"oracle1","internalType":"contract AggregatorV3Interface"},{"type":"address","name":"oracle2","internalType":"contract AggregatorV3Interface"},{"type":"uint256","name":"spread","internalType":"uint256"},{"type":"int256","name":"decimalsScale","internalType":"int256"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"eq","inputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrder","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"tuple","name":"orderAmounts","internalType":"struct OrderMixin.OrderAmounts","components":[{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"uint256","name":"thresholdAmount","internalType":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrderRFQ","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderRFQMixin.OrderRFQ","components":[{"type":"uint256","name":"info","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"contract IERC20"},{"type":"address","name":"takerAsset","internalType":"contract IERC20"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrderRFQTo","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderRFQMixin.OrderRFQ","components":[{"type":"uint256","name":"info","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"contract IERC20"},{"type":"address","name":"takerAsset","internalType":"contract IERC20"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"address","name":"target","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrderRFQToWithPermit","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderRFQMixin.OrderRFQ","components":[{"type":"uint256","name":"info","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"contract IERC20"},{"type":"address","name":"takerAsset","internalType":"contract IERC20"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"permit","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrderTo","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"tuple","name":"orderAmounts","internalType":"struct OrderMixin.OrderAmounts","components":[{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"uint256","name":"thresholdAmount","internalType":"uint256"}]},{"type":"address","name":"target","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrderToWithExtraInteraction","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"tuple","name":"orderAmounts","internalType":"struct OrderMixin.OrderAmounts","components":[{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"uint256","name":"thresholdAmount","internalType":"uint256"}]},{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"extraInteraction","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"fillOrderToWithPermit","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"tuple","name":"orderAmounts","internalType":"struct OrderMixin.OrderAmounts","components":[{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"uint256","name":"thresholdAmount","internalType":"uint256"}]},{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"permit","internalType":"bytes"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getMakerAmount","inputs":[{"type":"uint256","name":"orderMakerAmount","internalType":"uint256"},{"type":"uint256","name":"orderTakerAmount","internalType":"uint256"},{"type":"uint256","name":"swapTakerAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTakerAmount","inputs":[{"type":"uint256","name":"orderMakerAmount","internalType":"uint256"},{"type":"uint256","name":"orderTakerAmount","internalType":"uint256"},{"type":"uint256","name":"swapMakerAmount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"gt","inputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"hashOrder","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderMixin.Order","components":[{"type":"uint256","name":"salt","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"address"},{"type":"address","name":"takerAsset","internalType":"address"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"receiver","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"},{"type":"bytes","name":"makerAssetData","internalType":"bytes"},{"type":"bytes","name":"takerAssetData","internalType":"bytes"},{"type":"bytes","name":"getMakerAmount","internalType":"bytes"},{"type":"bytes","name":"getTakerAmount","internalType":"bytes"},{"type":"bytes","name":"predicate","internalType":"bytes"},{"type":"bytes","name":"permit","internalType":"bytes"},{"type":"bytes","name":"interaction","internalType":"bytes"}]}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"hashOrderRFQ","inputs":[{"type":"tuple","name":"order","internalType":"struct OrderRFQMixin.OrderRFQ","components":[{"type":"uint256","name":"info","internalType":"uint256"},{"type":"address","name":"makerAsset","internalType":"contract IERC20"},{"type":"address","name":"takerAsset","internalType":"contract IERC20"},{"type":"address","name":"maker","internalType":"address"},{"type":"address","name":"allowedSender","internalType":"address"},{"type":"uint256","name":"makingAmount","internalType":"uint256"},{"type":"uint256","name":"takingAmount","internalType":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"increaseNonce","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"invalidatorForOrderRFQ","inputs":[{"type":"address","name":"maker","internalType":"address"},{"type":"uint256","name":"slot","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"lt","inputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"address","name":"target","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nonce","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"nonceEquals","inputs":[{"type":"address","name":"makerAddress","internalType":"address"},{"type":"uint256","name":"makerNonce","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"or","inputs":[{"type":"address[]","name":"targets","internalType":"address[]"},{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"remaining","inputs":[{"type":"bytes32","name":"orderHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"remainingRaw","inputs":[{"type":"bytes32","name":"orderHash","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"remainingsRaw","inputs":[{"type":"bytes32[]","name":"orderHashes","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"simulateCalls","inputs":[{"type":"address[]","name":"targets","internalType":"address[]"},{"type":"bytes[]","name":"data","internalType":"bytes[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"singlePrice","inputs":[{"type":"address","name":"oracle","internalType":"contract AggregatorV3Interface"},{"type":"uint256","name":"inverseAndSpread","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"timestampBelow","inputs":[{"type":"uint256","name":"time","internalType":"uint256"}]}]
              

Contract Creation Code

0x6101406040523480156200001257600080fd5b50604080518082018252601c81527f55626573776170204c696d6974204f726465722050726f746f636f6c000000006020808301918252835180850190945260018452601960f91b908401528151902060e08190527fad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a56101008190524660a0529192917f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620001068184846040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6080523060c05261012052506200011c92505050565b60805160a05160c05160e05161010051610120516159bb6200016c6000396000612d4601526000612d9501526000612d7001526000612cc901526000612cf301526000612d1d01526159bb6000f3fe608060405234801561001057600080fd5b50600436106102415760003560e01c80638673377311610145578063bf15fcd8116100bd578063d0a3b6651161008c578063f35bf8d111610071578063f35bf8d114610570578063f4a215c314610583578063fa1cb9f21461059657600080fd5b8063d0a3b6651461054a578063e61333011461055d57600080fd5b8063bf15fcd8146104e2578063c05435f1146104f5578063c53a029214610508578063cf6fc6e31461051057600080fd5b8063a65a0e7111610114578063b244b450116100f9578063b244b450146104a9578063baba5855146104bc578063bc1ed74c146104cf57600080fd5b8063a65a0e7114610483578063b0c54b6d1461049657600080fd5b8063867337731461042a578063871919d51461043d578063942461bb14610450578063961d5b1e1461047057600080fd5b80634cc4a27b116101d857806370ae92d2116101a75780637e54f0921161018c5780637e54f092146103e45780637f29a59d14610404578063825caba11461041757600080fd5b806370ae92d2146103af57806372c244a8146103cf57600080fd5b80634cc4a27b1461031f57806354dd5f741461033257806356f161241461035957806363592c2b1461039c57600080fd5b806332565d611161021457806332565d61146102de578063331f9d1b146102f15780633644e515146103045780633b845bda1461030c57600080fd5b8063057702e91461024657806306bf53d01461026e57806312adf923146102a3578063296637bf146102cb575b600080fd5b61025961025436600461489d565b6105a9565b60405190151581526020015b60405180910390f35b6102957f74ab4f0cde46aaf927859983f7d04002116dd057d4c4941f6dbfb775c3e31f4581565b604051908152602001610265565b6102b66102b1366004614b00565b61069f565b60408051928352602083019190915201610265565b6102956102d9366004614b7c565b6106f9565b6102596102ec36600461489d565b61072f565b6102956102ff366004614ba8565b61081e565b610295610b64565b61029561031a366004614ca1565b610b73565b6102b661032d366004614cbd565b610c3d565b6102957f7b63e94209420c4f6a2a8ca90b36938c948908697db47a5dc7f8e692ead4991a81565b610295610367366004614d6b565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600260209081526040808320938352929052205490565b6102596103aa366004614d97565b421090565b6102956103bd366004614db0565b60006020819052908152604090205481565b6103e26103dd366004614dcd565b610c6e565b005b6102956103f2366004614d97565b60009081526001602052604090205490565b6103e2610412366004614e35565b610cdb565b6103e2610425366004614d97565b610f8e565b6102b6610438366004614ea1565b610f9b565b61025961044b36600461489d565b610fc9565b61046361045e366004614f32565b6110b8565b6040516102659190614fcc565b61025961047e366004614e35565b611171565b610259610491366004615010565b61136d565b6102b66104a4366004615045565b611431565b6103e26104b7366004615010565b6114ef565b6102b66104ca366004615103565b61164c565b6102956104dd366004614d97565b611b54565b6102956104f0366004615182565b611bf2565b6102956105033660046151d2565b611c76565b6103e2611e5a565b61025961051e366004614d6b565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152602081905260409020541490565b6102b6610558366004615207565b611e66565b61025961056b366004614e35565b611e77565b6102b661057e366004615045565b612042565b610295610591366004614b7c565b6120a7565b6102956105a4366004615010565b6120b4565b60008061060c836040518060400160405280600681526020017f50483a20677400000000000000000000000000000000000000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b9050805160201461067e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c7400000000000000000060448201526064015b60405180910390fd5b84818060200190518101906106939190615270565b119150505b9392505050565b6000806106eb8686866106b736889003880188615289565b3360005b6040519080825280601f01601f1916602001820160405280156106e5576020820181803683370190505b506122b6565b915091505b94509492505050565b6000836001816107098686615314565b6107139190615351565b61071d9190615369565b6107279190615380565b949350505050565b600080610792836040518060400160405280600681526020017f50483a20657100000000000000000000000000000000000000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b905080516020146107ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b84818060200190518101906108149190615270565b1495945050505050565b60008473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561086b573d6000803e3d6000fd5b505050506040513d602081101561088157600080fd5b5051604080517f313ce567000000000000000000000000000000000000000000000000000000008152905160ff9092169173ffffffffffffffffffffffffffffffffffffffff89169163313ce5679160048083019260209291908290030181865afa1580156108f4573d6000803e3d6000fd5b505050506040513d602081101561090a57600080fd5b505160ff161461097b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43433a206f7261636c6520646563696d616c7320646f6e2774206d6174636800604482015290519081900360640190fd5b60008673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156109c8573d6000803e3d6000fd5b505050506040513d60a08110156109de57600080fd5b5060200151604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905191925060009173ffffffffffffffffffffffffffffffffffffffff89169163feaf968c9160048083019260a09291908290030181865afa158015610a54573d6000803e3d6000fd5b505050506040513d60a0811015610a6a57600080fd5b506020015190506000851315610ae057633b9aca00610a8882612c3f565b610a9187612c3f565b610a9c90600a6154db565b610aa585612c3f565b610aaf8a89615314565b610ab99190615314565b610ac39190615314565b610acd9190615380565b610ad79190615380565b92505050610b5b565b6000851215610b3a57610afa610af5866154e7565b612c3f565b610b0590600a6154db565b633b9aca00610b1383612c3f565b610b1c85612c3f565b610b268a89615314565b610b309190615314565b610ac39190615380565b633b9aca00610b4882612c3f565b610b5184612c3f565b610ab98988615314565b95945050505050565b6000610b6e612caf565b905090565b6000610c377f74ab4f0cde46aaf927859983f7d04002116dd057d4c4941f6dbfb775c3e31f4583604051602001610c1c92919060006101008201905083825282516020830152602083015173ffffffffffffffffffffffffffffffffffffffff80821660408501528060408601511660608501528060608601511660808501528060808601511660a0850152505060a083015160c083015260c083015160e08301529392505050565b60405160208183030381529060405280519060200120612de3565b92915050565b600080610c4f8a604001518585612e4c565b610c5d8a8a8a8a8a8a61164c565b915091509850989650505050505050565b33600090815260208190526040812054610c8c9060ff841690615351565b33600081815260208181526040918290208490558151848152915193945091927ffc69110dd11eb791755e4abd6b7d281bae236de95736d38a23782814be5e10db929181900390910190a25050565b828114610d44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a2061727261792073697a65206d69736d6174636800000000000000006044820152606401610675565b60008367ffffffffffffffff811115610d5f57610d5f614767565b6040519080825280601f01601f191660200182016040528015610d89576020820181803683370190505b50905060005b84811015610f1e57600080878784818110610dac57610dac615520565b9050602002016020810190610dc19190614db0565b73ffffffffffffffffffffffffffffffffffffffff16868685818110610de957610de9615520565b9050602002810190610dfb919061554f565b604051610e099291906155b4565b6000604051808303816000865af19150503d8060008114610e46576040519150601f19603f3d011682016040523d82523d6000602084013e610e4b565b606091505b5091509150818015610e5e575060008151115b15610e7b5780516020148015610e78575060208101516001145b91505b81610ea6577f3000000000000000000000000000000000000000000000000000000000000000610ec8565b7f31000000000000000000000000000000000000000000000000000000000000005b848481518110610eda57610eda615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050508080610f16906155c4565b915050610d8f565b5080604051602001610f309190615629565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610675916004016156b8565b610f98338261319b565b50565b600080610fbb878787610fb336899003890189615289565b8760006106bb565b915091509550959350505050565b60008061102c836040518060400160405280600681526020017f50483a206c7400000000000000000000000000000000000000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b90508051602014611099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b84818060200190518101906110ae9190615270565b1095945050505050565b60606000825167ffffffffffffffff8111156110d6576110d6614767565b6040519080825280602002602001820160405280156110ff578160200160208202803683370190505b50905060005b835181101561116a576001600085838151811061112457611124615520565b602002602001015181526020019081526020016000205482828151811061114d5761114d615520565b602090810291909101015280611162816155c4565b915050611105565b5092915050565b60008382146111dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f50483a20696e7075742061727261792073697a65206d69736d617463680000006044820152606401610675565b60005b848110156113615760006112be8585848181106111fe576111fe615520565b9050602002810190611210919061554f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152601881527f50483a2027616e64272073756263616c6c206661696c65640000000000000000602082015291508a9050898681811061128c5761128c615520565b90506020020160208101906112a19190614db0565b73ffffffffffffffffffffffffffffffffffffffff16919061218f565b9050805160201461132b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b8080602001905181019061133f91906156cb565b61134e57600092505050610727565b5080611359816155c4565b9150506111df565b50600195945050505050565b61018081015160408051808201909152601a81527f4c4f503a207072656469636174652063616c6c206661696c6564000000000000602082015260009182916113b791309161218f565b90508051602014611424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a20696e76616c6964207072656469636174652072657475726e0000006044820152606401610675565b6020810151600114610698565b600080601483101561149f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a207065726d6974206c656e67746820746f6f206c6f770000000000006044820152606401610675565b60003660006114ae8787613267565b9250925092506114bf838383612e4c565b6114dc8c8c8c6114d4368e90038e018e615289565b8c60006106bb565b9450945050505097509795505050505050565b606081015173ffffffffffffffffffffffffffffffffffffffff163314611572576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a204163636573732064656e69656400000000000000000000000000006044820152606401610675565b600061157d826120b4565b6000818152600160208190526040909120549192508114156115fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4c4f503a20616c72656164792066696c6c6564000000000000000000000000006044820152606401610675565b604080518381526020810183905233917fcbfa7d191838ece7ba4783ca3a30afd316619b7f368094b57ee7ffde9a923db1910160405180910390a25060009081526001602081905260409091205550565b60008073ffffffffffffffffffffffffffffffffffffffff83166116cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a207a65726f2074617267657420697320666f7262696464656e0000006044820152606401610675565b6060880151608089015173ffffffffffffffffffffffffffffffffffffffff1615806117115750608089015173ffffffffffffffffffffffffffffffffffffffff1633145b611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a2070726976617465206f7264657200000000000000000000000000006044820152606401610675565b60006117828a610b73565b90506117c582828b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061329092505050565b61182b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a20626164207369676e617475726500000000000000000000000000006044820152606401610675565b895167ffffffffffffffff604082901c168015806118495750804211155b6118af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a206f72646572206578706972656400000000000000000000000000006044820152606401610675565b6118b9848361319b565b505060a08a015160c08b0151871580156118d1575088155b156118e157819850809750611a45565b876119625781891115611950576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c4f503a206d616b696e6720616d6f756e7420657863656564656400000000006044820152606401610675565b61195b82828b6106f9565b9750611a45565b886119e357808811156119d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c4f503a2074616b696e6720616d6f756e7420657863656564656400000000006044820152606401610675565b6119dc82828a6120a7565b9850611a45565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4c4f503a20626f746820616d6f756e747320617265206e6f6e2d7a65726f00006044820152606401610675565b5050600087118015611a575750600086115b611abd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a2063616e27742073776170203020616d6f756e7400000000000000006044820152606401610675565b60208a0151611ae49073ffffffffffffffffffffffffffffffffffffffff1683878a61347f565b60408a0151611b0b9073ffffffffffffffffffffffffffffffffffffffff1633848961347f565b60408051828152602081018990527fc3b639f02b125bfa160e50739b8c44eb2d1b6908e2b6d5925c6d770f2ca78127910160405180910390a15094989397509295505050505050565b60008181526001602052604081205480611bca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a20556e6b6e6f776e206f7264657200000000000000000000000000006044820152606401610675565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b600080611c55836040518060400160405280601781526020017f41433a2061726269747261727953746174696343616c6c0000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b9050808060200190516020811015611c6c57600080fd5b5051949350505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611cc4573d6000803e3d6000fd5b505050506040513d60a0811015611cda57600080fd5b506020015190507f80000000000000000000000000000000000000000000000000000000000000008416158015907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861690611dde57633b9aca00611d3e84612c3f565b8873ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d89573d6000803e3d6000fd5b505050506040513d6020811015611d9f57600080fd5b5051611dac90600a6156ed565b611db68489615314565b611dc09190615314565b611dca9190615380565b611dd49190615380565b9350505050610698565b633b9aca008773ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e2e573d6000803e3d6000fd5b505050506040513d6020811015611e4457600080fd5b5051611e5190600a6156ed565b611dac85612c3f565b611e646001610c6e565b565b600080610fbb87878787873361164c565b6000838214611ee2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f50483a20696e7075742061727261792073697a65206d69736d617463680000006044820152606401610675565b60005b84811015612036576000611f92858584818110611f0457611f04615520565b9050602002810190611f16919061554f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152601781527f50483a20276f72272073756263616c6c206661696c6564000000000000000000602082015291508a9050898681811061128c5761128c615520565b90508051602014611fff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b8080602001905181019061201391906156cb565b1561202357600192505050610727565b508061202e816155c4565b915050611ee5565b50600095945050505050565b60008061209789898961205a368b90038b018b615289565b8989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122b692505050565b9150915097509795505050505050565b60008261071d8584615314565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290528290506106987f7b63e94209420c4f6a2a8ca90b36938c948908697db47a5dc7f8e692ead4991a8285610100015180519060200120866101200151805190602001208761014001518051906020012088610160015180519060200120896101800151805190602001208a6101a00151805190602001208b6101c0015180519060200120604051602001610c1c999897969594939291906156fc565b606073ffffffffffffffffffffffffffffffffffffffff84163b612234576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f416464726573733a207374617469632063616c6c20746f206e6f6e2d636f6e7460448201527f72616374000000000000000000000000000000000000000000000000000000006064820152608401610675565b6000808573ffffffffffffffffffffffffffffffffffffffff168560405161225c91906157e9565b600060405180830381855afa9150503d8060008114612297576040519150601f19603f3d011682016040523d82523d6000602084013e61229c565b606091505b50915091506122ac82828661351a565b9695505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff8416612336576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a207a65726f2074617267657420697320666f7262696464656e0000006044820152606401610675565b6000612341896120b4565b6000818152600160208190526040909120549192508114156123bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a2072656d61696e696e6720616d6f756e7420697320300000000000006044820152606401610675565b60a08a015173ffffffffffffffffffffffffffffffffffffffff1615806123ff575060a08a015173ffffffffffffffffffffffffffffffffffffffff1633145b612465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a2070726976617465206f7264657200000000000000000000000000006044820152606401610675565b806125f2576124af8a60600151838b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061329092505050565b612515576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a20626164207369676e617475726500000000000000000000000000006044820152606401610675565b8960c00151905060148a6101a0015151106125ed576000806125668c6101a0015160148101805191517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0181529091565b91509150612574828261356d565b600084815260016020526040902054156125ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a207265656e7472616e637920646574656374656400000000000000006044820152606401610675565b50505b612615565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b6101808a015151156126905761262a8a61136d565b612690576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a207072656469636174652072657475726e65642066616c73650000006044820152606401610675565b865160208801511590151415612702576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4c4f503a206f6e6c79206f6e6520616d6f756e742073686f756c6420626520306044820152606401610675565b60208701516127ca57865181811115612719578188525b6127368b61016001518c60c001518a600001518e60e001516137f2565b60208901528751604089015161274c9190615314565b81896020015161275c9190615314565b11156127c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c4f503a2074616b696e6720616d6f756e7420746f6f206869676800000000006044820152606401610675565b506128a7565b60208701516101408b015160e08c015160c08d01516127ec92919084906137f2565b80895282101561281c578188526101608b015160c08c015160e08d015161281692919085906137f2565b60208901525b876020015188604001516128309190615314565b885161283d908390615314565b10156128a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a206d616b696e6720616d6f756e7420746f6f206c6f770000000000006044820152606401610675565b505b8651158015906128bb575060008760200151115b612921576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a2063616e27742073776170203020616d6f756e7400000000000000006044820152606401610675565b8651600083815260016020818152604092839020939094039081019092558051848152928301829052909133917fb9ed0243fdf00f0545c63a0af8850c090d86bb46682baec4bf3c496814fe4f02910160405180910390a2506020808a015160608b015188516101008d01516040516129f3956129df947f23b872dd000000000000000000000000000000000000000000000000000000009473ffffffffffffffffffffffffffffffffffffffff91821694918e1693909201615805565b604051602081830303815290604052613960565b6014845110612abf57600080612a338660148101805191517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0181529091565b915091508173ffffffffffffffffffffffffffffffffffffffff1663cf21c775338d602001518e604001518c600001518d60200151876040518763ffffffff1660e01b8152600401612a8a96959493929190615862565b600060405180830381600087803b158015612aa457600080fd5b505af1158015612ab8573d6000803e3d6000fd5b5050505050505b604089015160808a0151612b5291907f23b872dd0000000000000000000000000000000000000000000000000000000090339073ffffffffffffffffffffffffffffffffffffffff1615612b17578c60800151612b1d565b8c606001515b73ffffffffffffffffffffffffffffffffffffffff168a602001518e61012001516040516020016129df959493929190615805565b6014896101c001515110612c2857600080612b9c8b6101c0015160148101805191517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0181529091565b915091508173ffffffffffffffffffffffffffffffffffffffff1663cf21c775338d602001518e604001518c600001518d60200151876040518763ffffffff1660e01b8152600401612bf396959493929190615862565b600060405180830381600087803b158015612c0d57600080fd5b505af1158015612c21573d6000803e3d6000fd5b5050505050505b505083516020850151909150965096945050505050565b600080821215612cab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f7369746976656044820152606401610675565b5090565b60003073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016148015612d1557507f000000000000000000000000000000000000000000000000000000000000000046145b15612d3f57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000610c37612df0612caf565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b8015613196576000606060e0831415612f89576040517fd505accf000000000000000000000000000000000000000000000000000000006020820181815273ffffffffffffffffffffffffffffffffffffffff881692879187916024018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310612f1757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612eda565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612f79576040519150601f19603f3d011682016040523d82523d6000602084013e612f7e565b606091505b5090925090506130b1565b61010083141561304a576040517f8fcbaf0c000000000000000000000000000000000000000000000000000000006020820181815273ffffffffffffffffffffffffffffffffffffffff8816928791879160240183838082843780830192505050935050505060405160208183030381529060405260405180828051906020019080838360208310612f1757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612eda565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e67207065726d6974206c656e67746800000000000000000000000000604482015290519081900360640190fd5b81613193576130f5816040518060400160405280600f81526020017f5065726d6974206661696c65643a200000000000000000000000000000000000815250613a47565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613158578181015183820152602001613140565b50505050905090810190601f1680156131855780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505b505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020908152604080832066ffffffffffffff600886901c16808552928190529220549091600160ff85161b918083161561324f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4c4f503a20696e76616c696461746564206f72646572000000000000000000006044820152606401610675565b60009384526020919091526040909220911790555050565b60003681843560601c828261327f876014818b6158af565b939650945091925050509250925092565b600080600061329f8585613fe2565b909250905060008160048111156132b8576132b86158d9565b1480156132f057508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561330057600192505050610698565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401613335929190615908565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516133be91906157e9565b600060405180830381855afa9150503d80600081146133f9576040519150601f19603f3d011682016040523d82523d6000602084013e6133fe565b606091505b5091509150818015613411575080516020145b8015613473575080517f1626ba7e000000000000000000000000000000000000000000000000000000009061344f9083016020908101908401615921565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052613514908590614052565b50505050565b60608315613529575081610698565b8251156135395782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067591906156b8565b8051156137ee5760006060825160e0141561370b578373ffffffffffffffffffffffffffffffffffffffff1663d505accf60e01b8460405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b6020831061361757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135da565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b6020831061369957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161365c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146136fb576040519150601f19603f3d011682016040523d82523d6000602084013e613700565b606091505b5090925090506137aa565b8251610100141561304a578373ffffffffffffffffffffffffffffffffffffffff16638fcbaf0c60e01b8460405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083836020831061361757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135da565b81613514576130f5816040518060400160405280600f81526020017f5065726d6974206661696c65643a200000000000000000000000000000000000815250613a47565b5050565b600084516000141561386e57838314613867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4c4f503a2077726f6e6720616d6f756e740000000000000000000000000000006044820152606401610675565b5080610727565b60006138e88685604051602001613886929190615963565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828201909152601a82527f4c4f503a20676574416d6f756e742063616c6c206661696c65640000000000006020830152309161218f565b90508051602014613955576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a20696e76616c696420676574416d6f756e742072657475726e0000006044820152606401610675565b602001519050610727565b60006139c2826040518060400160405280601681526020017f4c4f503a2061737365742e63616c6c206661696c6564000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff1661415e9092919063ffffffff16565b80519091501561319657805160201480156139e1575060208101516001145b613196576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a2061737365742e63616c6c2062616420726573756c740000000000006044820152606401610675565b60606004835110613e765760208301517fffffffff0000000000000000000000000000000000000000000000000000000081167f08c379a000000000000000000000000000000000000000000000000000000000148015613aaa57506044845110155b15613cab57602484810151808601820180519192909190613acc908490615351565b613ad69190615351565b86511015613b4557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c69642072657665727420726561736f6e0000000000000000000000604482015290519081900360640190fd5b84816040516020018083805190602001908083835b60208310613b9757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613b5a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527f4572726f72280000000000000000000000000000000000000000000000000000919093019081528451600690910192850191508083835b60208310613c4457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613c07565b6001836020036101000a038019825116818451168082178552505050505050905001807f2900000000000000000000000000000000000000000000000000000000000000815250600101925050506040516020818303038152906040529350505050610c37565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f4e487b7100000000000000000000000000000000000000000000000000000000148015613cfd575083516024145b15613e7457602484015183613d118261416d565b6040516020018083805190602001908083835b60208310613d6157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613d24565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527f50616e6963280000000000000000000000000000000000000000000000000000919093019081528451600690910192850191508083835b60208310613e0e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613dd1565b6001836020036101000a038019825116818451168082178552505050505050905001807f29000000000000000000000000000000000000000000000000000000000000008152506001019250505060405160208183030381529060405292505050610c37565b505b81613e8084614193565b6040516020018083805190602001908083835b60208310613ed057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613e93565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527f556e6b6e6f776e28000000000000000000000000000000000000000000000000919093019081528451600890910192850191508083835b60208310613f7d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613f40565b6001836020036101000a038019825116818451168082178552505050505050905001807f290000000000000000000000000000000000000000000000000000000000000081525060010192505050604051602081830303815290604052905092915050565b6000808251604114156140195760208301516040840151606085015160001a61400d87828585614438565b9450945050505061404b565b825160401415614043576020830151604084015161403886838361454d565b93509350505061404b565b506000905060025b9250929050565b60006140b4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661415e9092919063ffffffff16565b80519091501561319657808060200190518101906140d291906156cb565b613196576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610675565b6060610727848460008561459f565b6060610c3782604051602001808281526020019150506040516020818303038152906040525b80516060907f3031323334353637383961626364656600000000000000000000000000000000906000906141c8906002615314565b6141d3906002615351565b67ffffffffffffffff8111156141eb576141eb614767565b6040519080825280601f01601f191660200182016040528015614215576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061424c5761424c615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106142af576142af615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060005b8451811015614430578260048683815181106142ff576142ff615520565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016901c60f81c6010811061433b5761433b615520565b1a60f81b8261434b836002615314565b614356906002615351565b8151811061436657614366615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350828582815181106143a8576143a8615520565b60209101015160f81c600f16601081106143c4576143c4615520565b1a60f81b826143d4836002615314565b6143df906003615351565b815181106143ef576143ef615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080614428816155c4565b9150506142e1565b509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561446f57506000905060036106f0565b8460ff16601b1415801561448757508460ff16601c14155b1561449857506000905060046106f0565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144ec573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116614540576000600192509250506106f0565b9660009650945050505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161458360ff86901c601b615351565b905061459187828885614438565b935093505050935093915050565b606082471015614631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610675565b73ffffffffffffffffffffffffffffffffffffffff85163b6146af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610675565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516146d891906157e9565b60006040518083038185875af1925050503d8060008114614715576040519150601f19603f3d011682016040523d82523d6000602084013e61471a565b606091505b509150915061472a82828661351a565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610f9857600080fd5b803561476281614735565b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516101e0810167ffffffffffffffff811182821017156147ba576147ba614767565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561480757614807614767565b604052919050565b600082601f83011261482057600080fd5b813567ffffffffffffffff81111561483a5761483a614767565b61486b60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016147c0565b81815284602083860101111561488057600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156148b257600080fd5b8335925060208401356148c481614735565b9150604084013567ffffffffffffffff8111156148e057600080fd5b6148ec8682870161480f565b9150509250925092565b60006101e0828403121561490957600080fd5b614911614796565b90508135815261492360208301614757565b602082015261493460408301614757565b604082015261494560608301614757565b606082015261495660808301614757565b608082015261496760a08301614757565b60a082015260c082013560c082015260e082013560e08201526101008083013567ffffffffffffffff8082111561499d57600080fd5b6149a98683870161480f565b838501526101209250828501359150808211156149c557600080fd5b6149d18683870161480f565b838501526101409250828501359150808211156149ed57600080fd5b6149f98683870161480f565b83850152610160925082850135915080821115614a1557600080fd5b614a218683870161480f565b83850152610180925082850135915080821115614a3d57600080fd5b614a498683870161480f565b838501526101a0925082850135915080821115614a6557600080fd5b614a718683870161480f565b838501526101c0925082850135915080821115614a8d57600080fd5b50614a9a8582860161480f565b82840152505092915050565b60008083601f840112614ab857600080fd5b50813567ffffffffffffffff811115614ad057600080fd5b60208301915083602082850101111561404b57600080fd5b600060608284031215614afa57600080fd5b50919050565b60008060008060a08587031215614b1657600080fd5b843567ffffffffffffffff80821115614b2e57600080fd5b614b3a888389016148f6565b95506020870135915080821115614b5057600080fd5b50614b5d87828801614aa6565b9094509250614b7190508660408701614ae8565b905092959194509250565b600080600060608486031215614b9157600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215614bc057600080fd5b8535614bcb81614735565b94506020860135614bdb81614735565b94979496505050506040830135926060810135926080909101359150565b600060e08284031215614c0b57600080fd5b60405160e0810181811067ffffffffffffffff82111715614c2e57614c2e614767565b604052823581529050806020830135614c4681614735565b60208201526040830135614c5981614735565b60408201526060830135614c6c81614735565b60608201526080830135614c7f81614735565b8060808301525060a083013560a082015260c083013560c08201525092915050565b600060e08284031215614cb357600080fd5b6106988383614bf9565b600080600080600080600080610180898b031215614cda57600080fd5b614ce48a8a614bf9565b975060e089013567ffffffffffffffff80821115614d0157600080fd5b614d0d8c838d01614aa6565b90995097506101008b013596506101208b013595506101408b01359150614d3382614735565b9093506101608a01359080821115614d4a57600080fd5b50614d578b828c01614aa6565b999c989b5096995094979396929594505050565b60008060408385031215614d7e57600080fd5b8235614d8981614735565b946020939093013593505050565b600060208284031215614da957600080fd5b5035919050565b600060208284031215614dc257600080fd5b813561069881614735565b600060208284031215614ddf57600080fd5b813560ff8116811461069857600080fd5b60008083601f840112614e0257600080fd5b50813567ffffffffffffffff811115614e1a57600080fd5b6020830191508360208260051b850101111561404b57600080fd5b60008060008060408587031215614e4b57600080fd5b843567ffffffffffffffff80821115614e6357600080fd5b614e6f88838901614df0565b90965094506020870135915080821115614e8857600080fd5b50614e9587828801614df0565b95989497509550505050565b600080600080600060c08688031215614eb957600080fd5b853567ffffffffffffffff80821115614ed157600080fd5b614edd89838a016148f6565b96506020880135915080821115614ef357600080fd5b50614f0088828901614aa6565b9095509350614f1490508760408801614ae8565b915060a0860135614f2481614735565b809150509295509295909350565b60006020808385031215614f4557600080fd5b823567ffffffffffffffff80821115614f5d57600080fd5b818501915085601f830112614f7157600080fd5b813581811115614f8357614f83614767565b8060051b9150614f948483016147c0565b8181529183018401918481019088841115614fae57600080fd5b938501935b8385101561347357843582529385019390850190614fb3565b6020808252825182820181905260009190848201906040850190845b8181101561500457835183529284019291840191600101614fe8565b50909695505050505050565b60006020828403121561502257600080fd5b813567ffffffffffffffff81111561503957600080fd5b610727848285016148f6565b600080600080600080600060e0888a03121561506057600080fd5b873567ffffffffffffffff8082111561507857600080fd5b6150848b838c016148f6565b985060208a013591508082111561509a57600080fd5b6150a68b838c01614aa6565b90985096508691506150bb8b60408c01614ae8565b955060a08a013591506150cd82614735565b90935060c089013590808211156150e357600080fd5b506150f08a828b01614aa6565b989b979a50959850939692959293505050565b600080600080600080610160878903121561511d57600080fd5b6151278888614bf9565b955060e087013567ffffffffffffffff81111561514357600080fd5b61514f89828a01614aa6565b9096509450506101008701359250610120870135915061014087013561517481614735565b809150509295509295509295565b6000806040838503121561519557600080fd5b82356151a081614735565b9150602083013567ffffffffffffffff8111156151bc57600080fd5b6151c88582860161480f565b9150509250929050565b6000806000606084860312156151e757600080fd5b83356151f281614735565b95602085013595506040909401359392505050565b6000806000806000610140868803121561522057600080fd5b61522a8787614bf9565b945060e086013567ffffffffffffffff81111561524657600080fd5b61525288828901614aa6565b96999098509596610100810135966101209091013595509350505050565b60006020828403121561528257600080fd5b5051919050565b60006060828403121561529b57600080fd5b6040516060810181811067ffffffffffffffff821117156152be576152be614767565b80604052508235815260208301356020820152604083013560408201528091505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561534c5761534c6152e5565b500290565b60008219821115615364576153646152e5565b500190565b60008282101561537b5761537b6152e5565b500390565b6000826153b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600181815b8085111561541457817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156153fa576153fa6152e5565b8085161561540757918102915b93841c93908002906153c0565b509250929050565b60008261542b57506001610c37565b8161543857506000610c37565b816001811461544e576002811461545857615474565b6001915050610c37565b60ff841115615469576154696152e5565b50506001821b610c37565b5060208310610133831016604e8410600b8410161715615497575081810a610c37565b6154a183836153bb565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156154d3576154d36152e5565b029392505050565b6000610698838361541c565b60007f8000000000000000000000000000000000000000000000000000000000000000821415615519576155196152e5565b5060000390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261558457600080fd5b83018035915067ffffffffffffffff82111561559f57600080fd5b60200191503681900382131561404b57600080fd5b8183823760009101908152919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156155f6576155f66152e5565b5060010190565b60005b83811015615618578181015183820152602001615600565b838111156135145750506000910152565b7f43414c4c5f524553554c54535f0000000000000000000000000000000000000081526000825161566181600d8501602087016155fd565b91909101600d0192915050565b600081518084526156868160208601602086016155fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610698602083018461566e565b6000602082840312156156dd57600080fd5b8151801515811461069857600080fd5b600061069860ff84168361541c565b6000610200820190508a82528951602083015260208a015173ffffffffffffffffffffffffffffffffffffffff80821660408501528060408d01511660608501528060608d0151166080850152505060808a015161577260a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a08a015173ffffffffffffffffffffffffffffffffffffffff811660c08401525060c08a015160e083015260e08a015161010083015288610120830152876101408301528661016083015285610180830152846101a0830152836101c0830152826101e08301529a9950505050505050505050565b600082516157fb8184602087016155fd565b9190910192915050565b7fffffffff0000000000000000000000000000000000000000000000000000000086168152846004820152836024820152826044820152600082516158518160648501602087016155fd565b919091016064019695505050505050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a083015261347360c083018461566e565b600080858511156158bf57600080fd5b838611156158cc57600080fd5b5050820193919092039150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000610727604083018461566e565b60006020828403121561593357600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461069857600080fd5b600083516159758184602088016155fd565b919091019182525060200191905056fea26469706673582212200047c8b6224a27ed4c26de9279d2e9968d6089f758d23fbc2235d8cebc3ffe6564736f6c634300080b0033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106102415760003560e01c80638673377311610145578063bf15fcd8116100bd578063d0a3b6651161008c578063f35bf8d111610071578063f35bf8d114610570578063f4a215c314610583578063fa1cb9f21461059657600080fd5b8063d0a3b6651461054a578063e61333011461055d57600080fd5b8063bf15fcd8146104e2578063c05435f1146104f5578063c53a029214610508578063cf6fc6e31461051057600080fd5b8063a65a0e7111610114578063b244b450116100f9578063b244b450146104a9578063baba5855146104bc578063bc1ed74c146104cf57600080fd5b8063a65a0e7114610483578063b0c54b6d1461049657600080fd5b8063867337731461042a578063871919d51461043d578063942461bb14610450578063961d5b1e1461047057600080fd5b80634cc4a27b116101d857806370ae92d2116101a75780637e54f0921161018c5780637e54f092146103e45780637f29a59d14610404578063825caba11461041757600080fd5b806370ae92d2146103af57806372c244a8146103cf57600080fd5b80634cc4a27b1461031f57806354dd5f741461033257806356f161241461035957806363592c2b1461039c57600080fd5b806332565d611161021457806332565d61146102de578063331f9d1b146102f15780633644e515146103045780633b845bda1461030c57600080fd5b8063057702e91461024657806306bf53d01461026e57806312adf923146102a3578063296637bf146102cb575b600080fd5b61025961025436600461489d565b6105a9565b60405190151581526020015b60405180910390f35b6102957f74ab4f0cde46aaf927859983f7d04002116dd057d4c4941f6dbfb775c3e31f4581565b604051908152602001610265565b6102b66102b1366004614b00565b61069f565b60408051928352602083019190915201610265565b6102956102d9366004614b7c565b6106f9565b6102596102ec36600461489d565b61072f565b6102956102ff366004614ba8565b61081e565b610295610b64565b61029561031a366004614ca1565b610b73565b6102b661032d366004614cbd565b610c3d565b6102957f7b63e94209420c4f6a2a8ca90b36938c948908697db47a5dc7f8e692ead4991a81565b610295610367366004614d6b565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152600260209081526040808320938352929052205490565b6102596103aa366004614d97565b421090565b6102956103bd366004614db0565b60006020819052908152604090205481565b6103e26103dd366004614dcd565b610c6e565b005b6102956103f2366004614d97565b60009081526001602052604090205490565b6103e2610412366004614e35565b610cdb565b6103e2610425366004614d97565b610f8e565b6102b6610438366004614ea1565b610f9b565b61025961044b36600461489d565b610fc9565b61046361045e366004614f32565b6110b8565b6040516102659190614fcc565b61025961047e366004614e35565b611171565b610259610491366004615010565b61136d565b6102b66104a4366004615045565b611431565b6103e26104b7366004615010565b6114ef565b6102b66104ca366004615103565b61164c565b6102956104dd366004614d97565b611b54565b6102956104f0366004615182565b611bf2565b6102956105033660046151d2565b611c76565b6103e2611e5a565b61025961051e366004614d6b565b73ffffffffffffffffffffffffffffffffffffffff919091166000908152602081905260409020541490565b6102b6610558366004615207565b611e66565b61025961056b366004614e35565b611e77565b6102b661057e366004615045565b612042565b610295610591366004614b7c565b6120a7565b6102956105a4366004615010565b6120b4565b60008061060c836040518060400160405280600681526020017f50483a20677400000000000000000000000000000000000000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b9050805160201461067e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c7400000000000000000060448201526064015b60405180910390fd5b84818060200190518101906106939190615270565b119150505b9392505050565b6000806106eb8686866106b736889003880188615289565b3360005b6040519080825280601f01601f1916602001820160405280156106e5576020820181803683370190505b506122b6565b915091505b94509492505050565b6000836001816107098686615314565b6107139190615351565b61071d9190615369565b6107279190615380565b949350505050565b600080610792836040518060400160405280600681526020017f50483a20657100000000000000000000000000000000000000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b905080516020146107ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b84818060200190518101906108149190615270565b1495945050505050565b60008473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561086b573d6000803e3d6000fd5b505050506040513d602081101561088157600080fd5b5051604080517f313ce567000000000000000000000000000000000000000000000000000000008152905160ff9092169173ffffffffffffffffffffffffffffffffffffffff89169163313ce5679160048083019260209291908290030181865afa1580156108f4573d6000803e3d6000fd5b505050506040513d602081101561090a57600080fd5b505160ff161461097b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f43433a206f7261636c6520646563696d616c7320646f6e2774206d6174636800604482015290519081900360640190fd5b60008673ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156109c8573d6000803e3d6000fd5b505050506040513d60a08110156109de57600080fd5b5060200151604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905191925060009173ffffffffffffffffffffffffffffffffffffffff89169163feaf968c9160048083019260a09291908290030181865afa158015610a54573d6000803e3d6000fd5b505050506040513d60a0811015610a6a57600080fd5b506020015190506000851315610ae057633b9aca00610a8882612c3f565b610a9187612c3f565b610a9c90600a6154db565b610aa585612c3f565b610aaf8a89615314565b610ab99190615314565b610ac39190615314565b610acd9190615380565b610ad79190615380565b92505050610b5b565b6000851215610b3a57610afa610af5866154e7565b612c3f565b610b0590600a6154db565b633b9aca00610b1383612c3f565b610b1c85612c3f565b610b268a89615314565b610b309190615314565b610ac39190615380565b633b9aca00610b4882612c3f565b610b5184612c3f565b610ab98988615314565b95945050505050565b6000610b6e612caf565b905090565b6000610c377f74ab4f0cde46aaf927859983f7d04002116dd057d4c4941f6dbfb775c3e31f4583604051602001610c1c92919060006101008201905083825282516020830152602083015173ffffffffffffffffffffffffffffffffffffffff80821660408501528060408601511660608501528060608601511660808501528060808601511660a0850152505060a083015160c083015260c083015160e08301529392505050565b60405160208183030381529060405280519060200120612de3565b92915050565b600080610c4f8a604001518585612e4c565b610c5d8a8a8a8a8a8a61164c565b915091509850989650505050505050565b33600090815260208190526040812054610c8c9060ff841690615351565b33600081815260208181526040918290208490558151848152915193945091927ffc69110dd11eb791755e4abd6b7d281bae236de95736d38a23782814be5e10db929181900390910190a25050565b828114610d44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a2061727261792073697a65206d69736d6174636800000000000000006044820152606401610675565b60008367ffffffffffffffff811115610d5f57610d5f614767565b6040519080825280601f01601f191660200182016040528015610d89576020820181803683370190505b50905060005b84811015610f1e57600080878784818110610dac57610dac615520565b9050602002016020810190610dc19190614db0565b73ffffffffffffffffffffffffffffffffffffffff16868685818110610de957610de9615520565b9050602002810190610dfb919061554f565b604051610e099291906155b4565b6000604051808303816000865af19150503d8060008114610e46576040519150601f19603f3d011682016040523d82523d6000602084013e610e4b565b606091505b5091509150818015610e5e575060008151115b15610e7b5780516020148015610e78575060208101516001145b91505b81610ea6577f3000000000000000000000000000000000000000000000000000000000000000610ec8565b7f31000000000000000000000000000000000000000000000000000000000000005b848481518110610eda57610eda615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050508080610f16906155c4565b915050610d8f565b5080604051602001610f309190615629565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a0000000000000000000000000000000000000000000000000000000008252610675916004016156b8565b610f98338261319b565b50565b600080610fbb878787610fb336899003890189615289565b8760006106bb565b915091509550959350505050565b60008061102c836040518060400160405280600681526020017f50483a206c7400000000000000000000000000000000000000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b90508051602014611099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b84818060200190518101906110ae9190615270565b1095945050505050565b60606000825167ffffffffffffffff8111156110d6576110d6614767565b6040519080825280602002602001820160405280156110ff578160200160208202803683370190505b50905060005b835181101561116a576001600085838151811061112457611124615520565b602002602001015181526020019081526020016000205482828151811061114d5761114d615520565b602090810291909101015280611162816155c4565b915050611105565b5092915050565b60008382146111dc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f50483a20696e7075742061727261792073697a65206d69736d617463680000006044820152606401610675565b60005b848110156113615760006112be8585848181106111fe576111fe615520565b9050602002810190611210919061554f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152601881527f50483a2027616e64272073756263616c6c206661696c65640000000000000000602082015291508a9050898681811061128c5761128c615520565b90506020020160208101906112a19190614db0565b73ffffffffffffffffffffffffffffffffffffffff16919061218f565b9050805160201461132b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b8080602001905181019061133f91906156cb565b61134e57600092505050610727565b5080611359816155c4565b9150506111df565b50600195945050505050565b61018081015160408051808201909152601a81527f4c4f503a207072656469636174652063616c6c206661696c6564000000000000602082015260009182916113b791309161218f565b90508051602014611424576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a20696e76616c6964207072656469636174652072657475726e0000006044820152606401610675565b6020810151600114610698565b600080601483101561149f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a207065726d6974206c656e67746820746f6f206c6f770000000000006044820152606401610675565b60003660006114ae8787613267565b9250925092506114bf838383612e4c565b6114dc8c8c8c6114d4368e90038e018e615289565b8c60006106bb565b9450945050505097509795505050505050565b606081015173ffffffffffffffffffffffffffffffffffffffff163314611572576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a204163636573732064656e69656400000000000000000000000000006044820152606401610675565b600061157d826120b4565b6000818152600160208190526040909120549192508114156115fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4c4f503a20616c72656164792066696c6c6564000000000000000000000000006044820152606401610675565b604080518381526020810183905233917fcbfa7d191838ece7ba4783ca3a30afd316619b7f368094b57ee7ffde9a923db1910160405180910390a25060009081526001602081905260409091205550565b60008073ffffffffffffffffffffffffffffffffffffffff83166116cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a207a65726f2074617267657420697320666f7262696464656e0000006044820152606401610675565b6060880151608089015173ffffffffffffffffffffffffffffffffffffffff1615806117115750608089015173ffffffffffffffffffffffffffffffffffffffff1633145b611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a2070726976617465206f7264657200000000000000000000000000006044820152606401610675565b60006117828a610b73565b90506117c582828b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061329092505050565b61182b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a20626164207369676e617475726500000000000000000000000000006044820152606401610675565b895167ffffffffffffffff604082901c168015806118495750804211155b6118af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a206f72646572206578706972656400000000000000000000000000006044820152606401610675565b6118b9848361319b565b505060a08a015160c08b0151871580156118d1575088155b156118e157819850809750611a45565b876119625781891115611950576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c4f503a206d616b696e6720616d6f756e7420657863656564656400000000006044820152606401610675565b61195b82828b6106f9565b9750611a45565b886119e357808811156119d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c4f503a2074616b696e6720616d6f756e7420657863656564656400000000006044820152606401610675565b6119dc82828a6120a7565b9850611a45565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f4c4f503a20626f746820616d6f756e747320617265206e6f6e2d7a65726f00006044820152606401610675565b5050600087118015611a575750600086115b611abd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a2063616e27742073776170203020616d6f756e7400000000000000006044820152606401610675565b60208a0151611ae49073ffffffffffffffffffffffffffffffffffffffff1683878a61347f565b60408a0151611b0b9073ffffffffffffffffffffffffffffffffffffffff1633848961347f565b60408051828152602081018990527fc3b639f02b125bfa160e50739b8c44eb2d1b6908e2b6d5925c6d770f2ca78127910160405180910390a15094989397509295505050505050565b60008181526001602052604081205480611bca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a20556e6b6e6f776e206f7264657200000000000000000000000000006044820152606401610675565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0192915050565b600080611c55836040518060400160405280601781526020017f41433a2061726269747261727953746174696343616c6c0000000000000000008152508673ffffffffffffffffffffffffffffffffffffffff1661218f9092919063ffffffff16565b9050808060200190516020811015611c6c57600080fd5b5051949350505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015611cc4573d6000803e3d6000fd5b505050506040513d60a0811015611cda57600080fd5b506020015190507f80000000000000000000000000000000000000000000000000000000000000008416158015907f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff861690611dde57633b9aca00611d3e84612c3f565b8873ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d89573d6000803e3d6000fd5b505050506040513d6020811015611d9f57600080fd5b5051611dac90600a6156ed565b611db68489615314565b611dc09190615314565b611dca9190615380565b611dd49190615380565b9350505050610698565b633b9aca008773ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e2e573d6000803e3d6000fd5b505050506040513d6020811015611e4457600080fd5b5051611e5190600a6156ed565b611dac85612c3f565b611e646001610c6e565b565b600080610fbb87878787873361164c565b6000838214611ee2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f50483a20696e7075742061727261792073697a65206d69736d617463680000006044820152606401610675565b60005b84811015612036576000611f92858584818110611f0457611f04615520565b9050602002810190611f16919061554f565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505060408051808201909152601781527f50483a20276f72272073756263616c6c206661696c6564000000000000000000602082015291508a9050898681811061128c5761128c615520565b90508051602014611fff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f50483a20696e76616c69642063616c6c20726573756c740000000000000000006044820152606401610675565b8080602001905181019061201391906156cb565b1561202357600192505050610727565b508061202e816155c4565b915050611ee5565b50600095945050505050565b60008061209789898961205a368b90038b018b615289565b8989898080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122b692505050565b9150915097509795505050505050565b60008261071d8584615314565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290528290506106987f7b63e94209420c4f6a2a8ca90b36938c948908697db47a5dc7f8e692ead4991a8285610100015180519060200120866101200151805190602001208761014001518051906020012088610160015180519060200120896101800151805190602001208a6101a00151805190602001208b6101c0015180519060200120604051602001610c1c999897969594939291906156fc565b606073ffffffffffffffffffffffffffffffffffffffff84163b612234576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f416464726573733a207374617469632063616c6c20746f206e6f6e2d636f6e7460448201527f72616374000000000000000000000000000000000000000000000000000000006064820152608401610675565b6000808573ffffffffffffffffffffffffffffffffffffffff168560405161225c91906157e9565b600060405180830381855afa9150503d8060008114612297576040519150601f19603f3d011682016040523d82523d6000602084013e61229c565b606091505b50915091506122ac82828661351a565b9695505050505050565b60008073ffffffffffffffffffffffffffffffffffffffff8416612336576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a207a65726f2074617267657420697320666f7262696464656e0000006044820152606401610675565b6000612341896120b4565b6000818152600160208190526040909120549192508114156123bf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a2072656d61696e696e6720616d6f756e7420697320300000000000006044820152606401610675565b60a08a015173ffffffffffffffffffffffffffffffffffffffff1615806123ff575060a08a015173ffffffffffffffffffffffffffffffffffffffff1633145b612465576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a2070726976617465206f7264657200000000000000000000000000006044820152606401610675565b806125f2576124af8a60600151838b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061329092505050565b612515576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4c4f503a20626164207369676e617475726500000000000000000000000000006044820152606401610675565b8960c00151905060148a6101a0015151106125ed576000806125668c6101a0015160148101805191517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0181529091565b91509150612574828261356d565b600084815260016020526040902054156125ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a207265656e7472616e637920646574656374656400000000000000006044820152606401610675565b50505b612615565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b6101808a015151156126905761262a8a61136d565b612690576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a207072656469636174652072657475726e65642066616c73650000006044820152606401610675565b865160208801511590151415612702576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4c4f503a206f6e6c79206f6e6520616d6f756e742073686f756c6420626520306044820152606401610675565b60208701516127ca57865181811115612719578188525b6127368b61016001518c60c001518a600001518e60e001516137f2565b60208901528751604089015161274c9190615314565b81896020015161275c9190615314565b11156127c4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4c4f503a2074616b696e6720616d6f756e7420746f6f206869676800000000006044820152606401610675565b506128a7565b60208701516101408b015160e08c015160c08d01516127ec92919084906137f2565b80895282101561281c578188526101608b015160c08c015160e08d015161281692919085906137f2565b60208901525b876020015188604001516128309190615314565b885161283d908390615314565b10156128a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a206d616b696e6720616d6f756e7420746f6f206c6f770000000000006044820152606401610675565b505b8651158015906128bb575060008760200151115b612921576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4c4f503a2063616e27742073776170203020616d6f756e7400000000000000006044820152606401610675565b8651600083815260016020818152604092839020939094039081019092558051848152928301829052909133917fb9ed0243fdf00f0545c63a0af8850c090d86bb46682baec4bf3c496814fe4f02910160405180910390a2506020808a015160608b015188516101008d01516040516129f3956129df947f23b872dd000000000000000000000000000000000000000000000000000000009473ffffffffffffffffffffffffffffffffffffffff91821694918e1693909201615805565b604051602081830303815290604052613960565b6014845110612abf57600080612a338660148101805191517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0181529091565b915091508173ffffffffffffffffffffffffffffffffffffffff1663cf21c775338d602001518e604001518c600001518d60200151876040518763ffffffff1660e01b8152600401612a8a96959493929190615862565b600060405180830381600087803b158015612aa457600080fd5b505af1158015612ab8573d6000803e3d6000fd5b5050505050505b604089015160808a0151612b5291907f23b872dd0000000000000000000000000000000000000000000000000000000090339073ffffffffffffffffffffffffffffffffffffffff1615612b17578c60800151612b1d565b8c606001515b73ffffffffffffffffffffffffffffffffffffffff168a602001518e61012001516040516020016129df959493929190615805565b6014896101c001515110612c2857600080612b9c8b6101c0015160148101805191517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec0181529091565b915091508173ffffffffffffffffffffffffffffffffffffffff1663cf21c775338d602001518e604001518c600001518d60200151876040518763ffffffff1660e01b8152600401612bf396959493929190615862565b600060405180830381600087803b158015612c0d57600080fd5b505af1158015612c21573d6000803e3d6000fd5b5050505050505b505083516020850151909150965096945050505050565b600080821215612cab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f53616665436173743a2076616c7565206d75737420626520706f7369746976656044820152606401610675565b5090565b60003073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000008a9869c4ba45041a1b853b81fb3006739c98c5eb16148015612d1557507f000000000000000000000000000000000000000000000000000000000000a4ec46145b15612d3f57507faf3fabddde7970a4a4f29e37d42b08fc866643dc748dc6a52a906e1e890aff2290565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527fa5ee32952e71a6d243a8ad50d86af643752eec9722a096d9ad82be73d61fefa0828401527fad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a560608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6000610c37612df0612caf565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b8015613196576000606060e0831415612f89576040517fd505accf000000000000000000000000000000000000000000000000000000006020820181815273ffffffffffffffffffffffffffffffffffffffff881692879187916024018383808284378083019250505093505050506040516020818303038152906040526040518082805190602001908083835b60208310612f1757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612eda565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612f79576040519150601f19603f3d011682016040523d82523d6000602084013e612f7e565b606091505b5090925090506130b1565b61010083141561304a576040517f8fcbaf0c000000000000000000000000000000000000000000000000000000006020820181815273ffffffffffffffffffffffffffffffffffffffff8816928791879160240183838082843780830192505050935050505060405160208183030381529060405260405180828051906020019080838360208310612f1757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101612eda565b604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e67207065726d6974206c656e67746800000000000000000000000000604482015290519081900360640190fd5b81613193576130f5816040518060400160405280600f81526020017f5065726d6974206661696c65643a200000000000000000000000000000000000815250613a47565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613158578181015183820152602001613140565b50505050905090810190601f1680156131855780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50505b505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020908152604080832066ffffffffffffff600886901c16808552928190529220549091600160ff85161b918083161561324f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4c4f503a20696e76616c696461746564206f72646572000000000000000000006044820152606401610675565b60009384526020919091526040909220911790555050565b60003681843560601c828261327f876014818b6158af565b939650945091925050509250925092565b600080600061329f8585613fe2565b909250905060008160048111156132b8576132b86158d9565b1480156132f057508573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561330057600192505050610698565b6000808773ffffffffffffffffffffffffffffffffffffffff16631626ba7e60e01b8888604051602401613335929190615908565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516133be91906157e9565b600060405180830381855afa9150503d80600081146133f9576040519150601f19603f3d011682016040523d82523d6000602084013e6133fe565b606091505b5091509150818015613411575080516020145b8015613473575080517f1626ba7e000000000000000000000000000000000000000000000000000000009061344f9083016020908101908401615921565b7fffffffff0000000000000000000000000000000000000000000000000000000016145b98975050505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052613514908590614052565b50505050565b60608315613529575081610698565b8251156135395782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067591906156b8565b8051156137ee5760006060825160e0141561370b578373ffffffffffffffffffffffffffffffffffffffff1663d505accf60e01b8460405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b6020831061361757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135da565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040526040518082805190602001908083835b6020831061369957805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161365c565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146136fb576040519150601f19603f3d011682016040523d82523d6000602084013e613700565b606091505b5090925090506137aa565b8251610100141561304a578373ffffffffffffffffffffffffffffffffffffffff16638fcbaf0c60e01b8460405160200180837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083836020831061361757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016135da565b81613514576130f5816040518060400160405280600f81526020017f5065726d6974206661696c65643a200000000000000000000000000000000000815250613a47565b5050565b600084516000141561386e57838314613867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4c4f503a2077726f6e6720616d6f756e740000000000000000000000000000006044820152606401610675565b5080610727565b60006138e88685604051602001613886929190615963565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828201909152601a82527f4c4f503a20676574416d6f756e742063616c6c206661696c65640000000000006020830152309161218f565b90508051602014613955576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4c4f503a20696e76616c696420676574416d6f756e742072657475726e0000006044820152606401610675565b602001519050610727565b60006139c2826040518060400160405280601681526020017f4c4f503a2061737365742e63616c6c206661696c6564000000000000000000008152508573ffffffffffffffffffffffffffffffffffffffff1661415e9092919063ffffffff16565b80519091501561319657805160201480156139e1575060208101516001145b613196576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4c4f503a2061737365742e63616c6c2062616420726573756c740000000000006044820152606401610675565b60606004835110613e765760208301517fffffffff0000000000000000000000000000000000000000000000000000000081167f08c379a000000000000000000000000000000000000000000000000000000000148015613aaa57506044845110155b15613cab57602484810151808601820180519192909190613acc908490615351565b613ad69190615351565b86511015613b4557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f496e76616c69642072657665727420726561736f6e0000000000000000000000604482015290519081900360640190fd5b84816040516020018083805190602001908083835b60208310613b9757805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613b5a565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527f4572726f72280000000000000000000000000000000000000000000000000000919093019081528451600690910192850191508083835b60208310613c4457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613c07565b6001836020036101000a038019825116818451168082178552505050505050905001807f2900000000000000000000000000000000000000000000000000000000000000815250600101925050506040516020818303038152906040529350505050610c37565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f4e487b7100000000000000000000000000000000000000000000000000000000148015613cfd575083516024145b15613e7457602484015183613d118261416d565b6040516020018083805190602001908083835b60208310613d6157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613d24565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527f50616e6963280000000000000000000000000000000000000000000000000000919093019081528451600690910192850191508083835b60208310613e0e57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613dd1565b6001836020036101000a038019825116818451168082178552505050505050905001807f29000000000000000000000000000000000000000000000000000000000000008152506001019250505060405160208183030381529060405292505050610c37565b505b81613e8084614193565b6040516020018083805190602001908083835b60208310613ed057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613e93565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01801990921691161790527f556e6b6e6f776e28000000000000000000000000000000000000000000000000919093019081528451600890910192850191508083835b60208310613f7d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101613f40565b6001836020036101000a038019825116818451168082178552505050505050905001807f290000000000000000000000000000000000000000000000000000000000000081525060010192505050604051602081830303815290604052905092915050565b6000808251604114156140195760208301516040840151606085015160001a61400d87828585614438565b9450945050505061404b565b825160401415614043576020830151604084015161403886838361454d565b93509350505061404b565b506000905060025b9250929050565b60006140b4826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661415e9092919063ffffffff16565b80519091501561319657808060200190518101906140d291906156cb565b613196576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610675565b6060610727848460008561459f565b6060610c3782604051602001808281526020019150506040516020818303038152906040525b80516060907f3031323334353637383961626364656600000000000000000000000000000000906000906141c8906002615314565b6141d3906002615351565b67ffffffffffffffff8111156141eb576141eb614767565b6040519080825280601f01601f191660200182016040528015614215576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061424c5761424c615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106142af576142af615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060005b8451811015614430578260048683815181106142ff576142ff615520565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016901c60f81c6010811061433b5761433b615520565b1a60f81b8261434b836002615314565b614356906002615351565b8151811061436657614366615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350828582815181106143a8576143a8615520565b60209101015160f81c600f16601081106143c4576143c4615520565b1a60f81b826143d4836002615314565b6143df906003615351565b815181106143ef576143ef615520565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080614428816155c4565b9150506142e1565b509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561446f57506000905060036106f0565b8460ff16601b1415801561448757508460ff16601c14155b1561449857506000905060046106f0565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156144ec573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116614540576000600192509250506106f0565b9660009650945050505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161458360ff86901c601b615351565b905061459187828885614438565b935093505050935093915050565b606082471015614631576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610675565b73ffffffffffffffffffffffffffffffffffffffff85163b6146af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610675565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516146d891906157e9565b60006040518083038185875af1925050503d8060008114614715576040519150601f19603f3d011682016040523d82523d6000602084013e61471a565b606091505b509150915061472a82828661351a565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610f9857600080fd5b803561476281614735565b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040516101e0810167ffffffffffffffff811182821017156147ba576147ba614767565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561480757614807614767565b604052919050565b600082601f83011261482057600080fd5b813567ffffffffffffffff81111561483a5761483a614767565b61486b60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016147c0565b81815284602083860101111561488057600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156148b257600080fd5b8335925060208401356148c481614735565b9150604084013567ffffffffffffffff8111156148e057600080fd5b6148ec8682870161480f565b9150509250925092565b60006101e0828403121561490957600080fd5b614911614796565b90508135815261492360208301614757565b602082015261493460408301614757565b604082015261494560608301614757565b606082015261495660808301614757565b608082015261496760a08301614757565b60a082015260c082013560c082015260e082013560e08201526101008083013567ffffffffffffffff8082111561499d57600080fd5b6149a98683870161480f565b838501526101209250828501359150808211156149c557600080fd5b6149d18683870161480f565b838501526101409250828501359150808211156149ed57600080fd5b6149f98683870161480f565b83850152610160925082850135915080821115614a1557600080fd5b614a218683870161480f565b83850152610180925082850135915080821115614a3d57600080fd5b614a498683870161480f565b838501526101a0925082850135915080821115614a6557600080fd5b614a718683870161480f565b838501526101c0925082850135915080821115614a8d57600080fd5b50614a9a8582860161480f565b82840152505092915050565b60008083601f840112614ab857600080fd5b50813567ffffffffffffffff811115614ad057600080fd5b60208301915083602082850101111561404b57600080fd5b600060608284031215614afa57600080fd5b50919050565b60008060008060a08587031215614b1657600080fd5b843567ffffffffffffffff80821115614b2e57600080fd5b614b3a888389016148f6565b95506020870135915080821115614b5057600080fd5b50614b5d87828801614aa6565b9094509250614b7190508660408701614ae8565b905092959194509250565b600080600060608486031215614b9157600080fd5b505081359360208301359350604090920135919050565b600080600080600060a08688031215614bc057600080fd5b8535614bcb81614735565b94506020860135614bdb81614735565b94979496505050506040830135926060810135926080909101359150565b600060e08284031215614c0b57600080fd5b60405160e0810181811067ffffffffffffffff82111715614c2e57614c2e614767565b604052823581529050806020830135614c4681614735565b60208201526040830135614c5981614735565b60408201526060830135614c6c81614735565b60608201526080830135614c7f81614735565b8060808301525060a083013560a082015260c083013560c08201525092915050565b600060e08284031215614cb357600080fd5b6106988383614bf9565b600080600080600080600080610180898b031215614cda57600080fd5b614ce48a8a614bf9565b975060e089013567ffffffffffffffff80821115614d0157600080fd5b614d0d8c838d01614aa6565b90995097506101008b013596506101208b013595506101408b01359150614d3382614735565b9093506101608a01359080821115614d4a57600080fd5b50614d578b828c01614aa6565b999c989b5096995094979396929594505050565b60008060408385031215614d7e57600080fd5b8235614d8981614735565b946020939093013593505050565b600060208284031215614da957600080fd5b5035919050565b600060208284031215614dc257600080fd5b813561069881614735565b600060208284031215614ddf57600080fd5b813560ff8116811461069857600080fd5b60008083601f840112614e0257600080fd5b50813567ffffffffffffffff811115614e1a57600080fd5b6020830191508360208260051b850101111561404b57600080fd5b60008060008060408587031215614e4b57600080fd5b843567ffffffffffffffff80821115614e6357600080fd5b614e6f88838901614df0565b90965094506020870135915080821115614e8857600080fd5b50614e9587828801614df0565b95989497509550505050565b600080600080600060c08688031215614eb957600080fd5b853567ffffffffffffffff80821115614ed157600080fd5b614edd89838a016148f6565b96506020880135915080821115614ef357600080fd5b50614f0088828901614aa6565b9095509350614f1490508760408801614ae8565b915060a0860135614f2481614735565b809150509295509295909350565b60006020808385031215614f4557600080fd5b823567ffffffffffffffff80821115614f5d57600080fd5b818501915085601f830112614f7157600080fd5b813581811115614f8357614f83614767565b8060051b9150614f948483016147c0565b8181529183018401918481019088841115614fae57600080fd5b938501935b8385101561347357843582529385019390850190614fb3565b6020808252825182820181905260009190848201906040850190845b8181101561500457835183529284019291840191600101614fe8565b50909695505050505050565b60006020828403121561502257600080fd5b813567ffffffffffffffff81111561503957600080fd5b610727848285016148f6565b600080600080600080600060e0888a03121561506057600080fd5b873567ffffffffffffffff8082111561507857600080fd5b6150848b838c016148f6565b985060208a013591508082111561509a57600080fd5b6150a68b838c01614aa6565b90985096508691506150bb8b60408c01614ae8565b955060a08a013591506150cd82614735565b90935060c089013590808211156150e357600080fd5b506150f08a828b01614aa6565b989b979a50959850939692959293505050565b600080600080600080610160878903121561511d57600080fd5b6151278888614bf9565b955060e087013567ffffffffffffffff81111561514357600080fd5b61514f89828a01614aa6565b9096509450506101008701359250610120870135915061014087013561517481614735565b809150509295509295509295565b6000806040838503121561519557600080fd5b82356151a081614735565b9150602083013567ffffffffffffffff8111156151bc57600080fd5b6151c88582860161480f565b9150509250929050565b6000806000606084860312156151e757600080fd5b83356151f281614735565b95602085013595506040909401359392505050565b6000806000806000610140868803121561522057600080fd5b61522a8787614bf9565b945060e086013567ffffffffffffffff81111561524657600080fd5b61525288828901614aa6565b96999098509596610100810135966101209091013595509350505050565b60006020828403121561528257600080fd5b5051919050565b60006060828403121561529b57600080fd5b6040516060810181811067ffffffffffffffff821117156152be576152be614767565b80604052508235815260208301356020820152604083013560408201528091505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561534c5761534c6152e5565b500290565b60008219821115615364576153646152e5565b500190565b60008282101561537b5761537b6152e5565b500390565b6000826153b6577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600181815b8085111561541457817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156153fa576153fa6152e5565b8085161561540757918102915b93841c93908002906153c0565b509250929050565b60008261542b57506001610c37565b8161543857506000610c37565b816001811461544e576002811461545857615474565b6001915050610c37565b60ff841115615469576154696152e5565b50506001821b610c37565b5060208310610133831016604e8410600b8410161715615497575081810a610c37565b6154a183836153bb565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156154d3576154d36152e5565b029392505050565b6000610698838361541c565b60007f8000000000000000000000000000000000000000000000000000000000000000821415615519576155196152e5565b5060000390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261558457600080fd5b83018035915067ffffffffffffffff82111561559f57600080fd5b60200191503681900382131561404b57600080fd5b8183823760009101908152919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156155f6576155f66152e5565b5060010190565b60005b83811015615618578181015183820152602001615600565b838111156135145750506000910152565b7f43414c4c5f524553554c54535f0000000000000000000000000000000000000081526000825161566181600d8501602087016155fd565b91909101600d0192915050565b600081518084526156868160208601602086016155fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610698602083018461566e565b6000602082840312156156dd57600080fd5b8151801515811461069857600080fd5b600061069860ff84168361541c565b6000610200820190508a82528951602083015260208a015173ffffffffffffffffffffffffffffffffffffffff80821660408501528060408d01511660608501528060608d0151166080850152505060808a015161577260a084018273ffffffffffffffffffffffffffffffffffffffff169052565b5060a08a015173ffffffffffffffffffffffffffffffffffffffff811660c08401525060c08a015160e083015260e08a015161010083015288610120830152876101408301528661016083015285610180830152846101a0830152836101c0830152826101e08301529a9950505050505050505050565b600082516157fb8184602087016155fd565b9190910192915050565b7fffffffff0000000000000000000000000000000000000000000000000000000086168152846004820152836024820152826044820152600082516158518160648501602087016155fd565b919091016064019695505050505050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a083015261347360c083018461566e565b600080858511156158bf57600080fd5b838611156158cc57600080fd5b5050820193919092039150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b828152604060208201526000610727604083018461566e565b60006020828403121561593357600080fd5b81517fffffffff000000000000000000000000000000000000000000000000000000008116811461069857600080fd5b600083516159758184602088016155fd565b919091019182525060200191905056fea26469706673582212200047c8b6224a27ed4c26de9279d2e9968d6089f758d23fbc2235d8cebc3ffe6564736f6c634300080b0033