false
false
0

Contract Address Details

0xD5308A4Bb2D7121A26d0bd11257245F0EFDa2bc4

Contract Name
WrapMintBurn
Creator
0x3e7202–e512dc at 0x9a5df5–ca00b3
Balance
0 SGB
Tokens
Fetching tokens...
Transactions
32,224 Transactions
Transfers
9,483 Transfers
Gas Used
2,779,225,283
Last Balance Update
59085199
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
WrapMintBurn




Optimization enabled
true
Compiler version
v0.8.17+commit.8df45f5f




Optimization runs
200
EVM Version
default




Verified at
2023-06-01T08:45:48.136797Z

Constructor Arguments

0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000032
              

Contract source code

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.15;

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

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

// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

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

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

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

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

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

/**
 * @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 (last updated v4.7.0) (utils/Address.sol)

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

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

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

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

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

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

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

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

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

// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

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

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

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

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

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

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

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

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

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

/// @title Two committee multisig library.
/// @dev Implements a multisig with two committees.
/// A separate quorum must be reached in both committees
/// to approve a given request. A request is rejected if
/// either of the two committees rejects it. Each committee
/// cannot have more than 128 members.
library Multisig {
    /// @dev Thrown when an already existing signer is added.
    error SignerAlreadyExists(address signer);

    /// @dev Thrown when an account that is performing some
    /// signer-only action is not an active signer.
    error SignerNotActive(address signer);

    /// @dev Thrown when attempting to add a new signer
    /// after the max committee size has been reached.
    error MaxCommitteeSizeReached();

    /// @dev Thrown when the configuration parmeters that are
    /// being set are not valid.
    error InvalidConfiguration();

    /// @dev Thrown when a given ID has already been assigned
    /// to an apprroved request.
    error InvalidId();

    /// @dev Thrown when the current next execution index is
    /// greater equal to the new next execution index.
    error InvalidNextExecutionIndex();

    /// @dev Emitted when a new signer is added.
    /// @param signer Address of signer that was added.
    /// @param isFirstCommittee True if the signer was
    /// added to the first committee and false if they were
    /// added to the second committee.
    event AddSigner(address indexed signer, bool indexed isFirstCommittee);

    /// @dev Emitted when an existing signer is removed.
    /// @param signer Address of signer that was removed.
    event RemoveSigner(address indexed signer);

    /// @dev Maximum number of members in each committee.
    /// @notice This number cannot be increased further
    /// with the current implementation. Our implementation
    /// uses bitmasks and the uint8 data type to optimize gas.
    /// These data structures will overflow if maxCommitteeSize
    /// is greater than 128.
    uint8 constant maxCommitteeSize = 128;

    /// @dev Maximum number of members in both committees
    /// combined.
    /// @notice Similarly to maxCommitteeSize, maxSignersSize
    /// also cannot be further increased to more than 256.
    uint16 constant maxSignersSize = 256; // maxCommitteeSize * 2

    /// @dev Request statuses.
    /// @notice `NULL` should be the first element as the first value is used
    /// as the default value in Solidity. The sequence of the other
    /// elements also shouldn't be changed.
    enum RequestStatus {
        NULL, // request which doesn't exist
        Undecided, // request hasn't reached quorum
        Accepted // request has been approved
    }

    /// @notice `Unchanged` should be the first element as the first value is used
    /// as the default value in Solidity. The sequence of the other
    /// elements also shouldn't be changed.
    enum RequestStatusTransition {
        Unchanged,
        NULLToUndecided,
        UndecidedToAccepted
    }

    /// @dev Signer statuses.
    /// @notice `Uninitialized` should be the first element as the first value is used
    /// as the default value in Solidity. The sequence of the other
    /// elements also shouldn't be changed.
    enum SignerStatus {
        Uninitialized,
        Removed,
        FirstCommittee,
        SecondCommittee
    }

    /// @dev Request info.
    /// @param approvalsFirstCommittee Number of approvals
    /// by the first committee.
    /// @param approvalsSecondCommittee Number of approvals
    /// by the second committee.
    /// @param status Status of the request.
    /// @param approvers Bitmask for signers from the two
    /// committees who have accepted the request.
    /// @notice Approvers is a bitmask. For example, a set bit at
    /// position 2 in the approvers bitmask indicates that the
    /// signer with index 2 has approved the request.
    struct Request {
        uint8 approvalsFirstCommittee; // slot 1 (0 - 7 bits)
        uint8 approvalsSecondCommittee; // slot 1 (8 - 15 bits)
        RequestStatus status; // slot 1 (16 - 23 bits)
        // slot 1 (23 - 255 spare bits)
        uint256 approvers; // slot 2
    }

    /// @dev Signer information.
    /// @param status Status of the signer.
    /// @param index Index of the signer.
    struct SignerInfo {
        SignerStatus status;
        uint8 index;
    }

    /// @dev DualMultisig
    /// @param firstCommitteeAcceptanceQuorum Number of acceptances
    /// required to reach quorum in the first committee.
    /// @param secondCommitteeAcceptanceQuorum Number of acceptances
    /// required to reach quorum in the second committee.
    /// @param firstCommitteeSize Size of the first committee.
    /// @param secondCommitteeSize Size of the second committee.
    /// @param nextExecutionIndex Index of the request that will be executed next.
    /// @param signers Mapping from signer address to signer info.
    /// @param requests Mapping from request hash to request info.
    /// @param approvedRequests Mapping request ID to request hash.
    struct DualMultisig {
        uint8 firstCommitteeAcceptanceQuorum; // slot 1 (0 - 7bits)
        uint8 secondCommitteeAcceptanceQuorum; // slot 1 (8 - 15bits)
        uint8 firstCommitteeSize; // slot 1 (16 - 23bits)
        uint8 secondCommitteeSize; // slot 1 (24 - 31bits)
        // slot1 (32 - 255 spare bits)
        uint256 nextExecutionIndex;
        mapping(address => SignerInfo) signers;
        mapping(bytes32 => Request) requests;
        mapping(uint256 => bytes32) approvedRequests;
    }

    /// @param firstCommitteeAcceptanceQuorum Number of acceptances
    /// required to reach quorum in the first committee.
    /// @param secondCommitteeAcceptanceQuorum Number of acceptances
    /// required to reach quorum in the second committee.
    /// @notice Both acceptance quorums should be greater than zero
    /// and less than or equal to maxCommitteeSize.
    struct Config {
        uint8 firstCommitteeAcceptanceQuorum;
        uint8 secondCommitteeAcceptanceQuorum;
    }

    /// @dev Returns a request status for a given request hash.
    /// @param s The relevant multisig to check.
    /// @param hash The hash of the request being checked.
    /// @return The status of the request with the given hash.
    function status(
        DualMultisig storage s,
        bytes32 hash
    ) internal view returns (RequestStatus) {
        return s.requests[hash].status;
    }

    /// @dev Returns whether or not a given address is a signer
    /// in the multisig.
    /// @param s The relevant multisig to check.
    /// @param signer The address of the potential signer.
    /// @return True if the provided address is a signer.
    function isSigner(
        DualMultisig storage s,
        address signer
    ) internal view returns (bool) {
        return s.signers[signer].status >= SignerStatus.FirstCommittee;
    }

    /// @dev Updates a multisig's configuration.
    function configure(DualMultisig storage s, Config memory c) internal {
        if (
            c.firstCommitteeAcceptanceQuorum == 0 ||
            c.firstCommitteeAcceptanceQuorum > maxCommitteeSize ||
            c.secondCommitteeAcceptanceQuorum == 0 ||
            c.secondCommitteeAcceptanceQuorum > maxCommitteeSize
        ) {
            revert InvalidConfiguration();
        }
        s.firstCommitteeAcceptanceQuorum = c.firstCommitteeAcceptanceQuorum;
        s.secondCommitteeAcceptanceQuorum = c.secondCommitteeAcceptanceQuorum;
    }

    /// @dev Adds a new signer.
    /// @param s The multisig to add the signer to.
    /// @param signer The address of the signer to add.
    /// @param isFirstCommittee True if the signer is to be
    /// added to the first committee and false if they are
    /// to be added to the second committee.
    function addSigner(
        DualMultisig storage s,
        address signer,
        bool isFirstCommittee
    ) internal {
        uint8 committeeSize = (
            isFirstCommittee ? s.firstCommitteeSize : s.secondCommitteeSize
        );
        if (committeeSize == maxCommitteeSize) {
            revert MaxCommitteeSizeReached();
        }

        SignerInfo storage signerInfo = s.signers[signer];
        if (signerInfo.status != SignerStatus.Uninitialized) {
            revert SignerAlreadyExists(signer);
        }

        signerInfo.index = s.firstCommitteeSize + s.secondCommitteeSize;
        if (isFirstCommittee) {
            s.firstCommitteeSize++;
            signerInfo.status = SignerStatus.FirstCommittee;
        } else {
            s.secondCommitteeSize++;
            signerInfo.status = SignerStatus.SecondCommittee;
        }

        emit AddSigner(signer, isFirstCommittee);
    }

    /// @dev Removes a signer.
    /// @param s The multisig to remove the signer from.
    /// @param signer The signer to be removed.
    function removeSigner(DualMultisig storage s, address signer) internal {
        SignerInfo storage signerInfo = s.signers[signer];
        if (signerInfo.status < SignerStatus.FirstCommittee) {
            revert SignerNotActive(signer);
        }
        signerInfo.status = SignerStatus.Removed;
        emit RemoveSigner(signer);
    }

    /// @dev Approve a request if its has not already been approved.
    /// @param s The multisig for which to approve the given request.
    /// @param signer The signer approving the request.
    /// @param hash The hash of the request being approved.
    /// @return The request's status transition.
    /// @dev Notice that this code assumes that the hash is generated from
    /// the ID and other data outside of this function. It is important to include
    /// the ID in the hash.
    function tryApprove(
        DualMultisig storage s,
        address signer,
        bytes32 hash,
        uint256 id
    ) internal returns (RequestStatusTransition) {
        Request storage request = s.requests[hash];
        // If the request has already been accepted
        // then simply return.
        if (request.status == RequestStatus.Accepted) {
            return RequestStatusTransition.Unchanged;
        }

        SignerInfo memory signerInfo = s.signers[signer];
        // Make sure that the signer is valid.
        if (signerInfo.status < SignerStatus.FirstCommittee) {
            revert SignerNotActive(signer);
        }

        // Revert if another request with the same ID has
        // already been approved.
        if (s.approvedRequests[id] != bytes32(0)) {
            revert InvalidId();
        }

        uint256 signerMask = 1 << signerInfo.index;
        // Check if the signer has already signed.
        if ((signerMask & request.approvers) != 0) {
            return RequestStatusTransition.Unchanged;
        }

        // Add the signer to the bitmask of approvers.
        request.approvers |= signerMask;
        if (signerInfo.status == SignerStatus.FirstCommittee) {
            ++request.approvalsFirstCommittee;
        } else {
            ++request.approvalsSecondCommittee;
        }

        if (
            request.approvalsFirstCommittee >=
            s.firstCommitteeAcceptanceQuorum &&
            request.approvalsSecondCommittee >=
            s.secondCommitteeAcceptanceQuorum
        ) {
            request.status = RequestStatus.Accepted;
            s.approvedRequests[id] = hash;
            return RequestStatusTransition.UndecidedToAccepted;
        } else if (request.status == RequestStatus.NULL) {
            // If this is the first approval, change the request status
            // to undecided.
            request.status = RequestStatus.Undecided;
            return RequestStatusTransition.NULLToUndecided;
        }
        return RequestStatusTransition.Unchanged;
    }

    /// @dev Get approvers for a given request.
    /// @param s The multisig to get the approvers for.
    /// @param hash The hash of the request.
    /// @return approvers List of approvers.
    /// @return count Count of approvers.
    function getApprovers(
        DualMultisig storage s,
        bytes32 hash
    ) internal view returns (uint16[] memory approvers, uint16 count) {
        uint256 mask = s.requests[hash].approvers;
        uint16 signersCount = s.firstCommitteeSize + s.secondCommitteeSize;
        approvers = new uint16[](signersCount);
        count = 0;
        for (uint16 i = 0; i < signersCount; i++) {
            if ((mask & (1 << i)) != 0) {
                approvers[count] = i;
                count++;
            }
        }

        return (approvers, count);
    }

    /// @dev Forcefully set next next execution index.
    /// @param s The multisig to set the next execution index for.
    /// @param index The new next execution index.
    function forceSetNextExecutionIndex(
        DualMultisig storage s,
        uint256 index
    ) internal {
        if (s.nextExecutionIndex >= index) {
            revert InvalidNextExecutionIndex();
        }
        s.nextExecutionIndex = index;
    }

    /// @dev Try to execute the next approved request.
    /// @param s The multisig whose next request should
    /// be executed.
    /// @param hash The hash of the request being executed.
    /// @param id The ID of the request being executed.
    /// @return True if the execution was successful.
    function tryExecute(
        DualMultisig storage s,
        bytes32 hash,
        uint256 id
    ) internal returns (bool) {
        if (id == s.nextExecutionIndex && s.approvedRequests[id] == hash) {
            s.nextExecutionIndex++;
            return true;
        }
        return false;
    }
}

/// @title Common interface for Wrap contracts on FLR and EVM chains.
interface IWrap is IAccessControlEnumerable {
    /// @dev Thrown when an operation is performed on a paused Wrap contract.
    error ContractPaused();

    /// @dev Thrown when the contract is not paused.
    error ContractNotPaused();

    /// @dev Thrown when the contract is already migrated.
    error ContractMigrated();

    /// @dev Thrown when the token is not allowlisted or the amount
    /// being deposited/approved is not in the range of min/maxAmount.
    error InvalidTokenAmount();

    /// @dev Thrown when the token config is invalid.
    error InvalidTokenConfig();

    /// @dev Thrown when the fee being set is higher than the maximum
    /// fee allowed.
    error FeeExceedsMaxFee();

    /// @dev Thrown when the recipient address is the zero address.
    error InvalidToAddress();

    /// @dev Thrown when the provided blocknumber is not of the most recent 256 blocks.
    error InvalidBlockHash();

    /// @dev Thrown when the daily volume exceeds the dailyLimit.
    error DailyLimitExhausted();

    /// @dev Thrown when the fee recipient address is the zero address.
    error InvalidFeeRecipient();

    /// @dev Emitted when a user deposits.
    /// @param id ID associated with the request.
    /// @param token Token deposited.
    /// @param amount Amount of tokens deposited, minus the fee.
    /// @param to Address to release the funds to.
    /// @param fee Fee subtracted from the original deposited amount.
    event Deposit(
        uint256 indexed id,
        address indexed token,
        uint256 amount,
        address to,
        uint256 fee
    );

    /// @dev Emitted when a new request is created.
    /// @param id ID associated with the request.
    /// @param mirrorToken Mirror token requested.
    /// @param amount Amount of tokens requested.
    /// @param to Address to release the funds to.
    event Requested(
        uint256 indexed id,
        address indexed mirrorToken,
        uint256 amount,
        address to
    );

    /// @dev Emitted when a request gets executed.
    /// @param id ID associated with the request.
    /// @param mirrorToken Mirror token requested.
    /// @param token Token approved.
    /// @param amount Amount approved, minus the fee.
    /// @param to Address to release the funds to.
    /// @param fee Fee charged on top of the approved amount.
    event Executed(
        uint256 indexed id,
        address indexed mirrorToken,
        address indexed token,
        uint256 amount,
        address to,
        uint256 fee
    );

    /// @dev Token information.
    /// @param maxAmount Maximum amount to deposit/approve.
    /// @param minAmount Minimum amount to deposit/approve.
    /// @notice Set max amount to zero to disable the token.
    /// @param dailyLimit Daily volume limit.
    struct TokenInfo {
        uint256 maxAmount;
        uint256 minAmount;
        uint256 dailyLimit;
    }

    /// @dev Token info that is stored in the contact storage.
    /// @param maxAmount Maximum amount to deposit/approve.
    /// @param minAmount Minimum amount to approve.
    /// @param minAmountWithFees Minimum amount to deposit, with fees included.
    /// @param dailyLimit Daily volume limit.
    /// @param consumedLimit Consumed daily volume limit.
    /// @param lastUpdated Last timestamp when the consumed limit was set to 0.
    /// @notice Set max amount to zero to disable the token.
    /// @notice Set daily limit to 0 to disable the daily limit. Consumed limit should
    /// always be less than equal to dailyLimit.
    /// @notice The minAmountWithFees is minAmount + depositFees(minAmount).
    /// On deposit, the amount should be greater than minAmountWithFees such that,
    /// after fee deduction, it is still greater equal than minAmount.
    struct TokenInfoStore {
        uint256 maxAmount;
        uint256 minAmount;
        uint256 minAmountWithFees;
        uint256 dailyLimit;
        uint256 consumedLimit;
        uint256 lastUpdated;
    }

    /// @dev Request information.
    /// @param id ID associated with the request.
    /// @param token Token requested.
    /// @param amount Amount of tokens requested.
    /// @param to Address to release the funds to.
    struct RequestInfo {
        uint256 id;
        address token;
        uint256 amount;
        address to;
    }

    /// @dev Returns whether or not the contract has been paused.
    /// @return paused True if the contract is paused, false otherwise.
    function paused() external view returns (bool paused);

    /// @dev Returns the number of deposits.
    function depositIndex() external view returns (uint256);

    /// @dev Returns the index of the request that will be executed next.
    function nextExecutionIndex() external view returns (uint256);

    /// @dev Returns info about a given validator.
    function validatorInfo(
        address validator
    ) external view returns (Multisig.SignerInfo memory);

    /// @dev Returns the number of attesters and their indeces for a given request hash.
    function attesters(
        bytes32 hash
    ) external view returns (uint16[] memory attesters, uint16 count);

    /// @dev Returns the validator fee basis points.
    function validatorFeeBPS() external view returns (uint16);

    /// @dev Update a token's configuration information.
    /// @param tokenInfo The token's new configuration info.
    /// @notice Set maxAmount to zero to disable the token.
    /// @notice Can only be called by the weak-admin.
    function configureToken(
        address token,
        TokenInfo calldata tokenInfo
    ) external;

    /// @dev Set the multisig configuration.
    /// @param config Multisig config.
    /// @notice Can only be called by the admin.
    function configureMultisig(Multisig.Config calldata config) external;

    /// @dev Configure validator fees.
    /// @param validatorFeeBPS Validator fee in basis points.
    /// @notice Can only be called by the weak-admin.
    function configureValidatorFees(uint16 validatorFeeBPS) external;

    /// @dev Deposit tokens to bridge to the other side.
    /// @param token Token being deposited.
    /// @param amount Amount of tokens being deposited.
    /// @param to Address to release the tokens to on the other side.
    /// @return The ID associated to the request.
    function deposit(
        address token,
        uint256 amount,
        address to
    ) external returns (uint256);

    /// @dev Approve and/or execute a given request.
    /// @param id ID associated with the request.
    /// @param token Token requested.
    /// @param amount Amount of tokens requested.
    /// @param to Address to release the funds to.
    /// @param recentBlockhash Block hash of `recentBlocknumber`
    /// @param recentBlocknumber Recent block number
    function approveExecute(
        uint256 id,
        address token,
        uint256 amount,
        address to,
        bytes32 recentBlockhash,
        uint256 recentBlocknumber
    ) external;

    /// @dev Approve and/or execute requests.
    /// @param requests Requests to approve and/or execute.
    function batchApproveExecute(
        RequestInfo[] calldata requests,
        bytes32 recentBlockhash,
        uint256 recentBlocknumber
    ) external;

    /// @dev Pauses the contract.
    /// @notice The contract can be paused by all addresses
    /// with pause role but can only be unpaused by the weak-admin.
    function pause() external;

    /// @dev Unpauses the contract.
    /// @notice The contract can be paused by all addresses
    /// with pause role but can only be unpaused by the weak-admin.
    function unpause() external;

    /// @dev Add a new validator to the contract.
    /// @param validator Address of the validator.
    /// @param isFirstCommittee True when adding the validator to the first committee.
    /// @param feeRecipient Address of the fee recipient.
    /// false when adding the validator to the second committee.
    /// @notice Can only be called by the admin.
    function addValidator(
        address validator,
        bool isFirstCommittee,
        address feeRecipient
    ) external;

    /// @dev Change fee recipient for a validator.
    /// @param validator Address of the validator.
    /// @param feeRecipient Address of the new fee recipient.
    function configureValidatorFeeRecipient(
        address validator,
        address feeRecipient
    ) external;

    /// @dev Remove existing validator from the contract.
    /// @param validator Address of the validator.
    /// @notice Can only be called by the weak-admin.
    /// @notice The fees accumulated by the validator are distributed before being removed.
    function removeValidator(address validator) external;

    /// @dev Allows to claim accumulated fees for a validator.
    /// @param validator Address of the validator.
    /// @notice Can be triggered by anyone but the fee is transfered to the
    /// set feeRecepient for the validator.
    function claimValidatorFees(address validator) external;

    /// @dev Forcefully set next next execution index.
    /// @param index The new next execution index.
    /// @notice Can only be called by the admin of the contract.
    function forceSetNextExecutionIndex(uint256 index) external;

    /// @dev Migrates the contract to a new address.
    /// @param _newContract Address of the new contract.
    /// @notice This function can only be called once in the lifetime of this
    /// contract by the admin.
    function migrate(address _newContract) external;
}

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

/// @title Interface for the side of Wraps where tokens are minted and burnt.
interface IWrapMintBurn is IWrap {
    /// @dev Returns the total protocol fees accumulated for a given token.
    /// @param token Address of the token for which to check its
    /// corresponding accumulated protocol fees.
    /// @return balance Total accumulated protocol fees for the given token.
    function accumulatedProtocolFees(
        address token
    ) external view returns (uint256 balance);

    /// @dev Returns the protocol fee basis points.
    function protocolFeeBPS() external view returns (uint16);

    /// @dev Configure protocol fees.
    /// @param protocolFeeBPS Protocol fee in basis points.
    /// @notice Can only be called by the weak-admin.
    /// @notice Should update minAmountWithFees for all tokens.
    function configureProtocolFees(uint16 protocolFeeBPS) external;

    /// @dev Link a token to its mirror token. A new token will
    /// be deployed if existingToken is the zero address. Otherwise
    /// the existingToken will be used instead, which means that
    /// a contract migration is underway.
    /// @param tokenName Name of the token to be created.
    /// @param tokenSymbol Symbol of the token to be created.
    /// @param existingToken Address of an existing wrapped token that
    /// will be used instead of deploying a new token. A new token will
    /// be deployed if this is set as the zero address.
    /// @param mirrorToken Address of the token that will be deposited in
    /// the mirror contract.
    /// @param mirrorTokenDecimals Decimals of the mirror token.
    /// @param tokenInfo Info associated with the token.
    /// @return Address of the new wrap token.
    /// @notice Set maxAmount to zero to disable the token.
    /// @notice Can only be called by the weak-admin.
    function createAddToken(
        string memory tokenName,
        string memory tokenSymbol,
        address existingToken,
        address mirrorToken,
        uint8 mirrorTokenDecimals,
        TokenInfo calldata tokenInfo
    ) external returns (address);

    /// @dev Allows the weak-admin to claim the accumulated protocol fees.
    /// @param token Token to claim protocol fees for.
    /// @param recipient Address of the protocol fee recipient.
    /// @notice Can only be called by the weak-admin.
    function claimProtocolFees(address token, address recipient) external;
}

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

interface IERC20MintBurn is IERC20 {
    /// @dev Mints tokens to the given holder.
    /// @param holder Address to mint the tokens to.
    /// @param amount Amount of tokens to mint.
    function mint(address holder, uint256 amount) external;

    /// @dev Burns tokens on the given holder's account.
    /// @param holder Address of the account whose tokens to burn.
    /// @param amount Amount of tokens to burn.
    function burnFrom(address holder, uint256 amount) external;
}

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)

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

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

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

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

// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

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

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

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

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

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

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

// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(uint160(account), 20),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

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

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

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
    using EnumerableSet for EnumerableSet.AddressSet;

    mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
        return _roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
        return _roleMembers[role].length();
    }

    /**
     * @dev Overload {_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override {
        super._grantRole(role, account);
        _roleMembers[role].add(account);
    }

    /**
     * @dev Overload {_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override {
        super._revokeRole(role, account);
        _roleMembers[role].remove(account);
    }
}

abstract contract Wrap is IWrap, AccessControlEnumerable {
    using Multisig for Multisig.DualMultisig;

    using SafeERC20 for IERC20;

    /// @dev The role ID for addresses that can pause the contract.
    bytes32 public constant PAUSE_ROLE = keccak256("PAUSE");

    /// @dev The role ID for addresses that has weak admin power.
    /// Weak admin can perform administrative tasks that don't risk user's funds.
    bytes32 public constant WEAK_ADMIN_ROLE = keccak256("WEAK_ADMIN");

    /// @dev Max protocol/validator fee that can be set by the owner.
    uint16 constant maxFeeBPS = 500; // should be less than 10,000

    /// @dev True if the contracts are paused, false otherwise.
    bool public paused;

    /// @dev Map token address to token info.
    mapping(address => TokenInfoStore) public tokenInfos;

    /// @dev Map mirror token address to token address.
    mapping(address => address) public mirrorTokens;

    /// @dev Map validator to its fee recipient.
    mapping(address => address) public validatorFeeRecipients;

    /// @dev Map tokens to validator index to fee that can be collected.
    mapping(address => mapping(uint256 => uint256)) public feeBalance;

    /// @dev Array of all the tokens added.
    /// @notice A token in the list might not be active.
    address[] public tokens;

    /// @dev Dual multisig to manage validators,
    /// attestations and request quorum.
    Multisig.DualMultisig internal multisig;

    /// @dev The number of deposits.
    uint256 public depositIndex;

    /// @dev Validator fee basis points.
    uint16 public validatorFeeBPS;

    /// @dev Address of the migrated contract.
    address public migratedContract;

    constructor(Multisig.Config memory config, uint16 _validatorFeeBPS) {
        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(WEAK_ADMIN_ROLE, msg.sender);
        _setRoleAdmin(PAUSE_ROLE, WEAK_ADMIN_ROLE);
        multisig.configure(config);
        configureValidatorFees(_validatorFeeBPS);
    }

    /// @dev Hook to execute on deposit.
    /// @param token Address of the token being deposited.
    /// @param amount The amount being deposited.
    /// @return fee The fee charged to the depositor.
    function onDeposit(
        address token,
        uint256 amount
    ) internal virtual returns (uint256 fee);

    /// @dev Returns the fees charged for a given deposit amount.
    /// @param amount The deposit amount in question.
    /// @return fee The fee charged for the given deposit amount.
    function depositFees(
        uint256 amount
    ) internal view virtual returns (uint256 fee);

    /// @dev Hook to execute on successful bridging.
    /// @param token Address of the token being bridged.
    /// @param amount The amount being bridged.
    /// @param to The address where the bridged are being sent to.
    /// @return totalFee Total fee charged to the user.
    /// @return validatorFee Total fee minus the protocol fees.
    function onExecute(
        address token,
        uint256 amount,
        address to
    ) internal virtual returns (uint256 totalFee, uint256 validatorFee);

    /// @dev Hook executed before the bridge migration.
    /// @param _newContract Address of the new contract.
    function onMigrate(address _newContract) internal virtual;

    /// @dev Modifier to check if the contract is not paused.
    modifier isNotPaused() {
        if (paused == true) {
            revert ContractPaused();
        }
        _;
    }

    /// @dev Modifier to check if the contract is paused.
    modifier isPaused() {
        if (paused == false) {
            revert ContractNotPaused();
        }
        _;
    }

    /// @dev Modifier to check that contract is not already migrated.
    modifier notMigrated() {
        if (migratedContract != address(0)) {
            revert ContractMigrated();
        }
        _;
    }

    /// @dev Modifier to make a function callable only when the token and amount is correct.
    modifier isValidTokenAmount(address token, uint256 amount) {
        TokenInfoStore storage t = tokenInfos[token];

        // Notice that amount should be greater than minAmountWithFees.
        // This is required as amount after the fees should be greater
        // than minAmount so that when this is approved it passes the
        // isValidMirrorTokenAmount check.
        // Notice that t.maxAmount is 0 for non existent and disabled tokens.
        // Therefore, this check also ensures txs of such tokens are reverted.
        if (t.maxAmount <= amount || t.minAmountWithFees > amount) {
            revert InvalidTokenAmount();
        }

        if (t.dailyLimit != 0) {
            // Reset daily limit if the day is passed after last update.
            if (block.timestamp > t.lastUpdated + 1 days) {
                t.lastUpdated = block.timestamp;
                t.consumedLimit = 0;
            }

            if (t.consumedLimit + amount > t.dailyLimit) {
                revert DailyLimitExhausted();
            }
            t.consumedLimit += amount;
        }
        _;
    }

    /// @dev Modifier to make a function callable only when the token and amount is correct.
    modifier isValidMirrorTokenAmount(address mirrorToken, uint256 amount) {
        TokenInfoStore memory t = tokenInfos[mirrorTokens[mirrorToken]];
        if (t.maxAmount <= amount || t.minAmount > amount) {
            revert InvalidTokenAmount();
        }
        _;
    }

    /// @dev Modifier to make a function callable only when the recent block hash is valid.
    modifier withValidRecentBlockHash(
        bytes32 recentBlockHash,
        uint256 recentBlockNumber
    ) {
        // Prevent malicious validators from pre-producing attestation signatures.
        // This is helpful in case validators are temporarily compromised.
        // `blockhash(recentBlockNumber)` yields `0x0` when `recentBlockNumber < block.number - 256`.
        if (
            recentBlockHash == bytes32(0) ||
            blockhash(recentBlockNumber) != recentBlockHash
        ) {
            revert InvalidBlockHash();
        }
        _;
    }

    /// @inheritdoc IWrap
    function nextExecutionIndex() external view returns (uint256) {
        return multisig.nextExecutionIndex;
    }

    /// @inheritdoc IWrap
    function validatorInfo(
        address validator
    ) external view returns (Multisig.SignerInfo memory) {
        return multisig.signers[validator];
    }

    /// @inheritdoc IWrap
    function attesters(
        bytes32 hash
    ) external view returns (uint16[] memory attesterIndexes, uint16 count) {
        return multisig.getApprovers(hash);
    }

    /// @dev Internal function to calculate fees by amount and BPS.
    function calculateFee(
        uint256 amount,
        uint16 feeBPS
    ) internal pure returns (uint256) {
        // 10,000 is 100%
        return (amount * feeBPS) / 10000;
    }

    /// @inheritdoc IWrap
    function deposit(
        address token,
        uint256 amount,
        address to
    )
        external
        isNotPaused
        isValidTokenAmount(token, amount)
        returns (uint256 id)
    {
        if (to == address(0)) revert InvalidToAddress();
        id = depositIndex;
        depositIndex++;
        uint256 fee = onDeposit(token, amount);
        emit Deposit(id, token, amount - fee, to, fee);
    }

    /// @dev Internal function to calculate the hash of the request.
    function hashRequest(
        uint256 id,
        address token,
        uint256 amount,
        address to
    ) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(id, token, amount, to));
    }

    /// @dev Internal function to approve and/or execute a given request.
    function _approveExecute(
        uint256 id,
        address mirrorToken,
        uint256 amount,
        address to
    ) private isNotPaused isValidMirrorTokenAmount(mirrorToken, amount) {
        // If the request ID is lower than the last executed ID then simply ignore the request.
        if (id < multisig.nextExecutionIndex) {
            return;
        }

        bytes32 hash = hashRequest(id, mirrorToken, amount, to);
        Multisig.RequestStatusTransition transition = multisig.tryApprove(
            msg.sender,
            hash,
            id
        );
        if (transition == Multisig.RequestStatusTransition.NULLToUndecided) {
            emit Requested(id, mirrorToken, amount, to);
        }

        if (multisig.tryExecute(hash, id)) {
            address token = mirrorTokens[mirrorToken];
            (uint256 totalFee, uint256 validatorFee) = onExecute(
                token,
                amount,
                to
            );
            {
                (uint16[] memory approvers, uint16 approverCount) = multisig
                    .getApprovers(hash);
                uint256 feeToIndividualValidator = validatorFee / approverCount;
                mapping(uint256 => uint256)
                    storage tokenFeeBalance = feeBalance[token];
                for (uint16 i = 0; i < approverCount; i++) {
                    tokenFeeBalance[approvers[i]] += feeToIndividualValidator;
                }
            }
            emit Executed(
                id,
                mirrorToken,
                token,
                amount - totalFee,
                to,
                totalFee
            );
        }
    }

    /// @inheritdoc IWrap
    function approveExecute(
        uint256 id,
        address mirrorToken,
        uint256 amount,
        address to,
        bytes32 recentBlockHash,
        uint256 recentBlockNumber
    ) external withValidRecentBlockHash(recentBlockHash, recentBlockNumber) {
        _approveExecute(id, mirrorToken, amount, to);
    }

    /// @inheritdoc IWrap
    function batchApproveExecute(
        RequestInfo[] calldata requests,
        bytes32 recentBlockHash,
        uint256 recentBlockNumber
    ) external withValidRecentBlockHash(recentBlockHash, recentBlockNumber) {
        for (uint256 i = 0; i < requests.length; i++) {
            _approveExecute(
                requests[i].id,
                requests[i].token,
                requests[i].amount,
                requests[i].to
            );
        }
    }

    function _configureTokenInfo(
        address token,
        uint256 minAmount,
        uint256 maxAmount,
        uint256 dailyLimit,
        bool newToken
    ) internal {
        uint256 currMinAmount = tokenInfos[token].minAmount;
        if (
            minAmount == 0 ||
            (newToken ? currMinAmount != 0 : currMinAmount == 0)
        ) {
            revert InvalidTokenConfig();
        }

        // configuring token also resets the daily volume limit
        TokenInfoStore memory tokenInfoStore = TokenInfoStore(
            maxAmount,
            minAmount,
            minAmount + depositFees(minAmount),
            dailyLimit,
            0,
            block.timestamp
        );
        tokenInfos[token] = tokenInfoStore;
    }

    /// @inheritdoc IWrap
    function configureToken(
        address token,
        TokenInfo calldata tokenInfo
    ) external onlyRole(WEAK_ADMIN_ROLE) {
        _configureTokenInfo(
            token,
            tokenInfo.minAmount,
            tokenInfo.maxAmount,
            tokenInfo.dailyLimit,
            false
        );
    }

    /// @inheritdoc IWrap
    function configureValidatorFees(
        uint16 _validatorFeeBPS
    ) public onlyRole(WEAK_ADMIN_ROLE) {
        if (_validatorFeeBPS > maxFeeBPS) {
            revert FeeExceedsMaxFee();
        }
        validatorFeeBPS = _validatorFeeBPS;
    }

    /// @dev Internal function to add a new token.
    /// @param token Token that will be deposited in the contract.
    /// @param mirrorToken Token that will be deposited in the mirror contract.
    /// @param tokenInfo Token info associated with the token.
    function _addToken(
        address token,
        address mirrorToken,
        TokenInfo calldata tokenInfo
    ) internal {
        if (mirrorTokens[mirrorToken] != address(0)) {
            revert InvalidTokenConfig();
        }

        _configureTokenInfo(
            token,
            tokenInfo.minAmount,
            tokenInfo.maxAmount,
            tokenInfo.dailyLimit,
            true
        );
        tokens.push(token);
        mirrorTokens[mirrorToken] = token;
    }

    /// @inheritdoc IWrap
    function configureMultisig(
        Multisig.Config calldata config
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        multisig.configure(config);
    }

    /// @inheritdoc IWrap
    function pause() external onlyRole(PAUSE_ROLE) {
        paused = true;
    }

    /// @inheritdoc IWrap
    function unpause() external notMigrated onlyRole(WEAK_ADMIN_ROLE) {
        paused = false;
    }

    /// @inheritdoc IWrap
    function addValidator(
        address validator,
        bool isFirstCommittee,
        address feeRecipient
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        multisig.addSigner(validator, isFirstCommittee);
        validatorFeeRecipients[validator] = feeRecipient;
    }

    /// @inheritdoc IWrap
    function removeValidator(
        address validator
    ) external onlyRole(WEAK_ADMIN_ROLE) {
        multisig.removeSigner(validator);
    }

    /// @inheritdoc IWrap
    function configureValidatorFeeRecipient(
        address validator,
        address feeRecipient
    ) external onlyRole(WEAK_ADMIN_ROLE) {
        validatorFeeRecipients[validator] = feeRecipient;
    }

    /// @inheritdoc IWrap
    function claimValidatorFees(address validator) public {
        address feeRecipient = validatorFeeRecipients[validator];

        if (feeRecipient == address(0)) {
            revert InvalidFeeRecipient();
        }

        uint16 index = multisig.signers[validator].index;
        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            uint256 tokenValidatorFee = feeBalance[token][index];
            feeBalance[token][index] = 0;
            IERC20(token).safeTransfer(feeRecipient, tokenValidatorFee);
        }
    }

    /// @inheritdoc IWrap
    function forceSetNextExecutionIndex(
        uint256 index
    ) public onlyRole(DEFAULT_ADMIN_ROLE) {
        multisig.forceSetNextExecutionIndex(index);
    }

    /// @inheritdoc IWrap
    function migrate(
        address _newContract
    ) public isPaused notMigrated onlyRole(DEFAULT_ADMIN_ROLE) {
        onMigrate(_newContract);
        migratedContract = _newContract;
    }
}

/**
 * Copyright (C) 2023 Flare Finance B.V. - All Rights Reserved.
 *
 * This source code and any functionality deriving from it are owned by Flare
 * Finance BV and the use of it is only permitted within the official platforms
 * and/or original products of Flare Finance B.V. and its licensed parties. Any
 * further enquiries regarding this copyright and possible licenses can be directed
 * to partners[at]flr.finance.
 *
 * The source code and any functionality deriving from it are provided "as is",
 * without warranty of any kind, express or implied, including but not limited to
 * the warranties of merchantability, fitness for a particular purpose and
 * noninfringement. In no event shall the authors or copyright holder be liable
 * for any claim, damages or other liability, whether in an action of contract,
 * tort or otherwise, arising in any way out of the use or other dealings or in
 * connection with the source code and any functionality deriving from it.
 */

// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)

// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}

// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)

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

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

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

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

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

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

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

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

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

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

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

/**
 * @dev ERC20 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC20Pausable is ERC20, Pausable {
    /**
     * @dev See {ERC20-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, amount);

        require(!paused(), "ERC20Pausable: token transfer while paused");
    }
}

/**
 * @dev {ERC20} token, including:
 *
 *  - ability for holders to burn (destroy) their tokens
 *  - a minter role that allows for token minting (creation)
 *  - a pauser role that allows to stop all token transfers
 *
 * This contract uses {AccessControl} to lock permissioned functions using the
 * different roles - head to its documentation for details.
 *
 * The account that deploys the contract will be granted the minter and pauser
 * roles, as well as the default admin role, which will let it grant both minter
 * and pauser roles to other accounts.
 *
 * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
 */
contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {
    bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    /**
     * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the
     * account that deploys the contract.
     *
     * See {ERC20-constructor}.
     */
    constructor(string memory name, string memory symbol) ERC20(name, symbol) {
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());

        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(PAUSER_ROLE, _msgSender());
    }

    /**
     * @dev Creates `amount` new tokens for `to`.
     *
     * See {ERC20-_mint}.
     *
     * Requirements:
     *
     * - the caller must have the `MINTER_ROLE`.
     */
    function mint(address to, uint256 amount) public virtual {
        require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint");
        _mint(to, amount);
    }

    /**
     * @dev Pauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_pause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function pause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause");
        _pause();
    }

    /**
     * @dev Unpauses all token transfers.
     *
     * See {ERC20Pausable} and {Pausable-_unpause}.
     *
     * Requirements:
     *
     * - the caller must have the `PAUSER_ROLE`.
     */
    function unpause() public virtual {
        require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause");
        _unpause();
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual override(ERC20, ERC20Pausable) {
        super._beforeTokenTransfer(from, to, amount);
    }
}

contract WrapToken is ERC20PresetMinterPauser {
    uint8 immutable _decimals;

    constructor(
        string memory name_,
        string memory symbol_,
        uint8 decimals_
    ) ERC20PresetMinterPauser(name_, symbol_) {
        _decimals = decimals_;
    }

    /// @dev The number of decimals used to get the token's
    /// user representation.
    /// @return The number of decimals.
    function decimals() public view virtual override returns (uint8) {
        return _decimals;
    }
}

contract WrapMintBurn is IWrapMintBurn, Wrap {
    using Multisig for Multisig.DualMultisig;

    using SafeERC20 for IERC20MintBurn;

    /// @dev Map token address to accumulated protocol fees.
    mapping(address => uint256) public accumulatedProtocolFees;

    /// @dev Protocol fee basis points charged on mint and burn.
    uint16 public protocolFeeBPS;

    // @dev Minter and Pauser roles for the Wraps token.
    bytes32 constant TOKEN_PAUSER_ROLE = keccak256("PAUSER_ROLE");
    bytes32 constant TOKEN_MINTER_ROLE = keccak256("MINTER_ROLE");

    constructor(
        Multisig.Config memory config,
        uint16 _validatorFeeBPS,
        uint16 _protocolFeeBPS
    ) Wrap(config, _validatorFeeBPS) {
        configureProtocolFees(_protocolFeeBPS);
    }

    /// @inheritdoc Wrap
    function depositFees(
        uint256 amount
    ) internal view override returns (uint256 fee) {
        fee = calculateFee(amount, protocolFeeBPS);
    }

    /// @inheritdoc Wrap
    function onDeposit(
        address token,
        uint256 amount
    ) internal override returns (uint256 fee) {
        fee = depositFees(amount);
        accumulatedProtocolFees[token] += fee;

        IERC20MintBurn(token).burnFrom(msg.sender, amount - fee);
        IERC20MintBurn(token).transferFrom(msg.sender, address(this), fee);
    }

    /// @inheritdoc Wrap
    function onExecute(
        address token,
        uint256 amount,
        address to
    ) internal override returns (uint256 totalFee, uint256 validatorFee) {
        uint256 protocolFee = calculateFee(amount, protocolFeeBPS);
        accumulatedProtocolFees[token] += protocolFee;
        validatorFee = calculateFee(amount, validatorFeeBPS);
        totalFee = protocolFee + validatorFee;
        IERC20MintBurn(token).mint(to, amount - totalFee);
        IERC20MintBurn(token).mint(address(this), totalFee);
    }

    function onMigrate(address _newContract) internal override {
        // Transfer ownership of all the token contracts to the new address.
        // Unlike WrapDepositRedeem, this contract doesn't transfer the existing
        // validatorFee and protocolFee to the new contract. Therefore they can
        // still be claimed through this contract after the migration.
        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            // Grant the new contracts all the roles.
            IAccessControl(token).grantRole(DEFAULT_ADMIN_ROLE, _newContract);
            IAccessControl(token).grantRole(TOKEN_MINTER_ROLE, _newContract);
            IAccessControl(token).grantRole(TOKEN_PAUSER_ROLE, _newContract);

            // Renounce all roles from the existing contract.
            IAccessControl(token).renounceRole(
                DEFAULT_ADMIN_ROLE,
                address(this)
            );
            IAccessControl(token).renounceRole(
                TOKEN_MINTER_ROLE,
                address(this)
            );
            IAccessControl(token).renounceRole(
                TOKEN_PAUSER_ROLE,
                address(this)
            );
        }
    }

    /// @inheritdoc IWrapMintBurn
    function configureProtocolFees(
        uint16 _protocolFeeBPS
    ) public onlyRole(WEAK_ADMIN_ROLE) {
        if (_protocolFeeBPS > maxFeeBPS) {
            revert FeeExceedsMaxFee();
        }
        protocolFeeBPS = _protocolFeeBPS;
        for (uint256 i = 0; i < tokens.length; i++) {
            address token = tokens[i];
            TokenInfoStore memory tokenInfo = tokenInfos[token];
            _configureTokenInfo(
                token,
                tokenInfo.minAmount,
                tokenInfo.maxAmount,
                tokenInfo.dailyLimit,
                false
            );
        }
    }

    /// @inheritdoc IWrapMintBurn
    function createAddToken(
        string memory tokenName,
        string memory tokenSymbol,
        address existingToken,
        address mirrorToken,
        uint8 mirrorTokenDecimals,
        TokenInfo calldata tokenInfo
    ) external onlyRole(WEAK_ADMIN_ROLE) returns (address token) {
        token = existingToken == address(0)
            ? address(
                new WrapToken(tokenName, tokenSymbol, mirrorTokenDecimals)
            )
            : existingToken;
        _addToken(token, mirrorToken, tokenInfo);
    }

    /// @inheritdoc IWrapMintBurn
    function claimProtocolFees(
        address token,
        address recipient
    ) public onlyRole(WEAK_ADMIN_ROLE) {
        uint256 protocolFee = accumulatedProtocolFees[token];
        accumulatedProtocolFees[token] = 0;
        IERC20MintBurn(token).safeTransfer(recipient, protocolFee);
    }
}

        

Contract ABI

[{"type":"constructor","inputs":[{"type":"tuple","name":"config","internalType":"struct Multisig.Config","components":[{"type":"uint8"},{"type":"uint8"}]},{"type":"uint16","name":"_validatorFeeBPS","internalType":"uint16"},{"type":"uint16","name":"_protocolFeeBPS","internalType":"uint16"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"PAUSE_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"WEAK_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"accumulatedProtocolFees","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addValidator","inputs":[{"type":"address","name":"validator","internalType":"address"},{"type":"bool","name":"isFirstCommittee","internalType":"bool"},{"type":"address","name":"feeRecipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"approveExecute","inputs":[{"type":"uint256","name":"id","internalType":"uint256"},{"type":"address","name":"mirrorToken","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"},{"type":"bytes32","name":"recentBlockHash","internalType":"bytes32"},{"type":"uint256","name":"recentBlockNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16[]","name":"attesterIndexes","internalType":"uint16[]"},{"type":"uint16","name":"count","internalType":"uint16"}],"name":"attesters","inputs":[{"type":"bytes32","name":"hash","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchApproveExecute","inputs":[{"type":"tuple[]","name":"requests","internalType":"struct IWrap.RequestInfo[]","components":[{"type":"uint256"},{"type":"address"},{"type":"uint256"},{"type":"address"}]},{"type":"bytes32","name":"recentBlockHash","internalType":"bytes32"},{"type":"uint256","name":"recentBlockNumber","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimProtocolFees","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimValidatorFees","inputs":[{"type":"address","name":"validator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureMultisig","inputs":[{"type":"tuple","name":"config","internalType":"struct Multisig.Config","components":[{"type":"uint8"},{"type":"uint8"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureProtocolFees","inputs":[{"type":"uint16","name":"_protocolFeeBPS","internalType":"uint16"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureToken","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"tuple","name":"tokenInfo","internalType":"struct IWrap.TokenInfo","components":[{"type":"uint256"},{"type":"uint256"},{"type":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureValidatorFeeRecipient","inputs":[{"type":"address","name":"validator","internalType":"address"},{"type":"address","name":"feeRecipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"configureValidatorFees","inputs":[{"type":"uint16","name":"_validatorFeeBPS","internalType":"uint16"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"token","internalType":"address"}],"name":"createAddToken","inputs":[{"type":"string","name":"tokenName","internalType":"string"},{"type":"string","name":"tokenSymbol","internalType":"string"},{"type":"address","name":"existingToken","internalType":"address"},{"type":"address","name":"mirrorToken","internalType":"address"},{"type":"uint8","name":"mirrorTokenDecimals","internalType":"uint8"},{"type":"tuple","name":"tokenInfo","internalType":"struct IWrap.TokenInfo","components":[{"type":"uint256"},{"type":"uint256"},{"type":"uint256"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"id","internalType":"uint256"}],"name":"deposit","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"to","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"depositIndex","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeBalance","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"forceSetNextExecutionIndex","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"migrate","inputs":[{"type":"address","name":"_newContract","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"migratedContract","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"mirrorTokens","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nextExecutionIndex","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"protocolFeeBPS","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeValidator","inputs":[{"type":"address","name":"validator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"maxAmount","internalType":"uint256"},{"type":"uint256","name":"minAmount","internalType":"uint256"},{"type":"uint256","name":"minAmountWithFees","internalType":"uint256"},{"type":"uint256","name":"dailyLimit","internalType":"uint256"},{"type":"uint256","name":"consumedLimit","internalType":"uint256"},{"type":"uint256","name":"lastUpdated","internalType":"uint256"}],"name":"tokenInfos","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"tokens","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint16","name":"","internalType":"uint16"}],"name":"validatorFeeBPS","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"validatorFeeRecipients","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct Multisig.SignerInfo","components":[{"type":"uint8"},{"type":"uint8"}]}],"name":"validatorInfo","inputs":[{"type":"address","name":"validator","internalType":"address"}]},{"type":"event","name":"Deposit","inputs":[{"type":"uint256","name":"id","indexed":true},{"type":"address","name":"token","indexed":true},{"type":"uint256","name":"amount","indexed":false},{"type":"address","name":"to","indexed":false},{"type":"uint256","name":"fee","indexed":false}],"anonymous":false},{"type":"event","name":"Executed","inputs":[{"type":"uint256","name":"id","indexed":true},{"type":"address","name":"mirrorToken","indexed":true},{"type":"address","name":"token","indexed":true},{"type":"uint256","name":"amount","indexed":false},{"type":"address","name":"to","indexed":false},{"type":"uint256","name":"fee","indexed":false}],"anonymous":false},{"type":"event","name":"Requested","inputs":[{"type":"uint256","name":"id","indexed":true},{"type":"address","name":"mirrorToken","indexed":true},{"type":"uint256","name":"amount","indexed":false},{"type":"address","name":"to","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"bytes32","name":"previousAdminRole","indexed":true},{"type":"bytes32","name":"newAdminRole","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"address","name":"account","indexed":true},{"type":"address","name":"sender","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","indexed":true},{"type":"address","name":"account","indexed":true},{"type":"address","name":"sender","indexed":true}],"anonymous":false},{"type":"error","name":"ContractMigrated","inputs":[]},{"type":"error","name":"ContractNotPaused","inputs":[]},{"type":"error","name":"ContractPaused","inputs":[]},{"type":"error","name":"DailyLimitExhausted","inputs":[]},{"type":"error","name":"FeeExceedsMaxFee","inputs":[]},{"type":"error","name":"InvalidBlockHash","inputs":[]},{"type":"error","name":"InvalidConfiguration","inputs":[]},{"type":"error","name":"InvalidFeeRecipient","inputs":[]},{"type":"error","name":"InvalidId","inputs":[]},{"type":"error","name":"InvalidNextExecutionIndex","inputs":[]},{"type":"error","name":"InvalidToAddress","inputs":[]},{"type":"error","name":"InvalidTokenAmount","inputs":[]},{"type":"error","name":"InvalidTokenConfig","inputs":[]},{"type":"error","name":"MaxCommitteeSizeReached","inputs":[]},{"type":"error","name":"SignerAlreadyExists","inputs":[{"type":"address","name":"signer","internalType":"address"}]},{"type":"error","name":"SignerNotActive","inputs":[{"type":"address","name":"signer","internalType":"address"}]}]
              

Contract Creation Code

0x60806040523480156200001157600080fd5b5060405162005d4238038062005d42833981016040819052620000349162000853565b828262000043600033620000d6565b6200005e60008051602062005d2283398151915233620000d6565b620000997ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f660008051602062005d22833981519152620000e6565b620000b48260086200013160201b620012051790919060201c565b620000bf81620001b1565b50620000cd9050816200020d565b50505062000a80565b620000e2828262000321565b5050565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b805160ff1615806200014957508051608060ff909116115b806200015a5750602081015160ff16155b80620001705750608060ff16816020015160ff16115b156200018f5760405163c52a9bd360e01b815260040160405180910390fd5b8051825460209092015160ff9081166101000261ffff19909316911617179055565b60008051602062005d22833981519152620001cc816200035f565b6101f461ffff83161115620001f457604051634efbf5f560e01b815260040160405180910390fd5b50600e805461ffff191661ffff92909216919091179055565b60008051602062005d2283398151915262000228816200035f565b6101f461ffff831611156200025057604051634efbf5f560e01b815260040160405180910390fd5b6010805461ffff191661ffff841617905560005b6007548110156200031c57600060078281548110620002875762000287620008f7565b60009182526020808320909101546001600160a01b031680835260038083526040808520815160c0810183528154808252600183015496820187905260028301549382019390935292810154606084018190526004820154608085015260059091015460a08401529295509093620003049386939092916200036e565b50508080620003139062000923565b91505062000264565b505050565b6200033882826200046c60201b620012851760201c565b60008281526001602090815260409091206200031c9183906200130d6200050c821b17901c565b6200036b81336200052c565b50565b6001600160a01b038516600090815260036020526040902060010154841580620003a5575081620003a1578015620003a5565b8015155b15620003c4576040516303ff3dd760e11b815260040160405180910390fd5b60006040518060c00160405280868152602001878152602001620003ee88620005d060201b60201c565b620003fa90896200093f565b815260208082019690965260006040808301829052426060938401526001600160a01b03909a1681526003808852908a902083518155968301516001880155988201516002870155810151978501979097555050506080840151600482015560a0909301516005909301929092555050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620004c83390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000523836001600160a01b038416620005e7565b90505b92915050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e25762000576816001600160a01b031660146200063960201b620013241760201c565b6200058c8360206200132462000639821b17811c565b6040516020016200059f9291906200097b565b60408051601f198184030181529082905262461bcd60e51b8252620005c791600401620009f4565b60405180910390fd5b6010546000906200052690839061ffff16620007f2565b6000818152600183016020526040812054620006305750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000526565b50600062000526565b606060006200064a83600262000a29565b620006579060026200093f565b6001600160401b0381111562000671576200067162000813565b6040519080825280601f01601f1916602001820160405280156200069c576020820181803683370190505b509050600360fc1b81600081518110620006ba57620006ba620008f7565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620006ec57620006ec620008f7565b60200101906001600160f81b031916908160001a90535060006200071284600262000a29565b6200071f9060016200093f565b90505b6001811115620007a1576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110620007575762000757620008f7565b1a60f81b828281518110620007705762000770620008f7565b60200101906001600160f81b031916908160001a90535060049490941c93620007998162000a43565b905062000722565b508315620005235760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401620005c7565b60006127106200080761ffff84168562000a29565b62000523919062000a5d565b634e487b7160e01b600052604160045260246000fd5b805160ff811681146200083b57600080fd5b919050565b805161ffff811681146200083b57600080fd5b600080600083850360808112156200086a57600080fd5b60408112156200087957600080fd5b50604080519081016001600160401b0381118282101715620008ab57634e487b7160e01b600052604160045260246000fd5b604052620008b98562000829565b8152620008c96020860162000829565b60208201529250620008de6040850162000840565b9150620008ee6060850162000840565b90509250925092565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016200093857620009386200090d565b5060010190565b808201808211156200052657620005266200090d565b60005b838110156200097257818101518382015260200162000958565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351620009b581601785016020880162000955565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351620009e881602884016020880162000955565b01602801949350505050565b602081526000825180602084015262000a1581604085016020870162000955565b601f01601f19169190910160400192915050565b80820281158282048414176200052657620005266200090d565b60008162000a555762000a556200090d565b506000190190565b60008262000a7b57634e487b7160e01b600052601260045260246000fd5b500490565b6152928062000a906000396000f3fe60806040523480156200001157600080fd5b5060043610620002915760003560e01c8063842e8b811162000161578063a217fddf11620000d3578063d17349071162000092578063d1734907146200069e578063d547741f14620006b5578063dff7330714620006cc578063eec9c9de14620006d5578063f45346dc1462000703578063feaeb43e146200071a57600080fd5b8063a217fddf14620005d5578063ba46ae7214620005de578063c3e4a8661462000659578063ca15c8731462000670578063ce5494bb146200068757600080fd5b80638e26a48811620001205780638e26a488146200055e5780639010d07c146200058157806391d1485414620005985780639267b15314620005af57806396daa32214620005c657600080fd5b8063842e8b8114620004ec5780638456cb59146200050f578063858146361462000519578063883910d7146200053057806388f14da3146200054757600080fd5b80634f64b2be116200020757806366d372e811620001c657806366d372e8146200046c5780636d1b96b4146200048357806373445f00146200049a5780637486fa4e14620004b157806377c654a314620004cb5780637b89893914620004e257600080fd5b80634f64b2be14620003f2578063511e1f0c14620004095780635bfb29aa14620004205780635c975abb1462000437578063651107bd146200044557600080fd5b8063389ed2671162000254578063389ed267146200036c5780633f4ba83a146200039457806340a141ff146200039e57806347adf63014620003b55780634f1811dd14620003cc57600080fd5b806301ffc9a71462000296578063248a9ca314620002c25780632f2ff15d14620002f757806336568abe146200031057806336cdca741462000327575b600080fd5b620002ad620002a736600462002bf7565b62000746565b60405190151581526020015b60405180910390f35b620002e8620002d336600462002c23565b60009081526020819052604090206001015490565b604051908152602001620002b9565b6200030e6200030836600462002c5a565b62000774565b005b6200030e6200032136600462002c5a565b620007a2565b620003536200033836600462002c89565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001620002b9565b620002e87ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f681565b6200030e62000828565b6200030e620003af36600462002c89565b62000881565b6200030e620003c636600462002ca7565b620008a9565b620003e3620003dd36600462002c89565b620008d4565b604051620002b9919062002cd6565b620003536200040336600462002c23565b62000951565b6200030e6200041a36600462002c89565b6200097c565b620003536200043136600462002de3565b62000a5f565b600254620002ad9060ff1681565b6200045c6200045636600462002c23565b62000aeb565b604051620002b992919062002e99565b6200030e6200047d36600462002eee565b62000b05565b6200030e6200049436600462002f4b565b62000b4d565b6200030e620004ab36600462002fe1565b62000c4d565b600e5462000353906201000090046001600160a01b031681565b6200030e620004dc3660046200302d565b62000c99565b620002e8600d5481565b600e54620004fb9061ffff1681565b60405161ffff9091168152602001620002b9565b6200030e62000cdf565b620002e86000805160206200523d83398151915281565b6200030e620005413660046200305c565b62000d1b565b6200030e620005583660046200305c565b62000e2a565b620002e86200056f36600462002c89565b600f6020526000908152604090205481565b620003536200059236600462003082565b62000e86565b620002ad620005a936600462002c5a565b62000ea7565b6200030e620005c0366004620030a5565b62000ed0565b601054620004fb9061ffff1681565b620002e8600081565b6200062b620005ef36600462002c89565b60036020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154905086565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001620002b9565b6200030e6200066a3660046200302d565b62000f04565b620002e86200068136600462002c23565b62000f4e565b6200030e6200069836600462002c89565b62000f67565b6200030e620006af36600462002c23565b62001004565b6200030e620006c636600462002c5a565b6200101e565b600954620002e8565b620002e8620006e6366004620030d5565b600660209081526000928352604080842090915290825290205481565b620002e86200071436600462003102565b62001047565b620003536200072b36600462002c89565b6004602052600090815260409020546001600160a01b031681565b60006001600160e01b03198216635a05180f60e01b14806200076e57506200076e82620014de565b92915050565b600082815260208190526040902060010154620007918162001515565b6200079d838362001524565b505050565b6001600160a01b0381163314620008185760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6200082482826200154a565b5050565b600e546201000090046001600160a01b0316156200085957604051631fa7b44b60e11b815260040160405180910390fd5b6000805160206200523d833981519152620008748162001515565b506002805460ff19169055565b6000805160206200523d8339815191526200089c8162001515565b6200082460088362001570565b6000620008b68162001515565b62000824620008cb368490038401846200313a565b60089062001205565b60408051808201909152600080825260208201526001600160a01b0382166000908152600a60205260409081902081518083019092528054829060ff16600381111562000925576200092562002cc0565b600381111562000939576200093962002cc0565b81529054610100900460ff1660209091015292915050565b600781815481106200096257600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b038082166000908152600560205260409020541680620009b657604051630ed1b8b360e31b815260040160405180910390fd5b6001600160a01b0382166000908152600a6020526040812054610100900460ff16905b60075481101562000a5957600060078281548110620009fc57620009fc6200319d565b6000918252602080832091909101546001600160a01b031680835260068252604080842061ffff881685529092529082208054929055915062000a4182868362001616565b5050808062000a5090620031c9565b915050620009d9565b50505050565b60006000805160206200523d83398151915262000a7c8162001515565b6001600160a01b0386161562000a93578562000ad1565b87878560405162000aa49062002be9565b62000ab29392919062003239565b604051809103906000f08015801562000acf573d6000803e3d6000fd5b505b915062000ae08286856200166a565b509695505050505050565b6060600062000afc60088462001727565b91509150915091565b818181158062000b16575081814014155b1562000b3557604051631f03465b60e11b815260040160405180910390fd5b62000b438888888862001834565b5050505050505050565b818181158062000b5e575081814014155b1562000b7d57604051631f03465b60e11b815260040160405180910390fd5b60005b8581101562000c445762000c2f87878381811062000ba25762000ba26200319d565b9050608002016000013588888481811062000bc15762000bc16200319d565b905060800201602001602081019062000bdb919062002c89565b89898581811062000bf05762000bf06200319d565b905060800201604001358a8a8681811062000c0f5762000c0f6200319d565b905060800201606001602081019062000c29919062002c89565b62001834565b8062000c3b81620031c9565b91505062000b80565b50505050505050565b600062000c5a8162001515565b62000c686008858562001b0d565b506001600160a01b03928316600090815260056020526040902080546001600160a01b031916919093161790915550565b6000805160206200523d83398151915262000cb48162001515565b6001600160a01b0383166000818152600f6020526040812080549190559062000a5990848362001616565b7ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f662000d0b8162001515565b506002805460ff19166001179055565b6000805160206200523d83398151915262000d368162001515565b6101f461ffff8316111562000d5e57604051634efbf5f560e01b815260040160405180910390fd5b6010805461ffff191661ffff841617905560005b6007548110156200079d5760006007828154811062000d955762000d956200319d565b60009182526020808320909101546001600160a01b031680835260038083526040808520815160c0810183528154808252600183015496820187905260028301549382019390935292810154606084018190526004820154608085015260059091015460a0840152929550909362000e1293869390929162001cc2565b5050808062000e2190620031c9565b91505062000d72565b6000805160206200523d83398151915262000e458162001515565b6101f461ffff8316111562000e6d57604051634efbf5f560e01b815260040160405180910390fd5b50600e805461ffff191661ffff92909216919091179055565b600082815260016020526040812062000ea0908362001dba565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206200523d83398151915262000eeb8162001515565b6200079d83602084013584356040860135600062001cc2565b6000805160206200523d83398151915262000f1f8162001515565b506001600160a01b03918216600090815260056020526040902080546001600160a01b03191691909216179055565b60008181526001602052604081206200076e9062001dc8565b60025460ff16151560000362000f905760405163dcdde9dd60e01b815260040160405180910390fd5b600e546201000090046001600160a01b03161562000fc157604051631fa7b44b60e11b815260040160405180910390fd5b600062000fce8162001515565b62000fd98262001dd3565b50600e80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6000620010118162001515565b62000824600883620020ec565b6000828152602081905260409020600101546200103b8162001515565b6200079d83836200154a565b60025460009060ff161515600103620010735760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038416600090815260036020526040902080548591859182101580620010a35750818160020154115b15620010c257604051632160733960e01b815260040160405180910390fd5b6003810154156200114a576005810154620010e1906201518062003276565b421115620010f757426005820155600060048201555b80600301548282600401546200110e919062003276565b11156200112e57604051635ee26fb960e11b815260040160405180910390fd5b8181600401600082825462001144919062003276565b90915550505b6001600160a01b0385166200117257604051638aa3a72f60e01b815260040160405180910390fd5b600d80549450849060006200118783620031c9565b919050555060006200119a888862002119565b90506001600160a01b038816857f3a58bc9c7c305b0dba42522c856c30706aadce643b5dc3c0a1a0c41fec127d99620011d4848b6200328c565b604080519182526001600160a01b038b166020830152810185905260600160405180910390a3505050509392505050565b805160ff1615806200121d57508051608060ff909116115b806200122e5750602081015160ff16155b80620012445750608060ff16816020015160ff16115b15620012635760405163c52a9bd360e01b815260040160405180910390fd5b8051825460209092015160ff9081166101000261ffff19909316911617179055565b62001291828262000ea7565b62000824576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620012c93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000ea0836001600160a01b03841662002257565b6060600062001335836002620032a2565b6200134290600262003276565b67ffffffffffffffff8111156200135d576200135d62002d13565b6040519080825280601f01601f19166020018201604052801562001388576020820181803683370190505b509050600360fc1b81600081518110620013a657620013a66200319d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620013d857620013d86200319d565b60200101906001600160f81b031916908160001a9053506000620013fe846002620032a2565b6200140b90600162003276565b90505b60018111156200148d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200144357620014436200319d565b1a60f81b8282815181106200145c576200145c6200319d565b60200101906001600160f81b031916908160001a90535060049490941c936200148581620032bc565b90506200140e565b50831562000ea05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016200080f565b60006001600160e01b03198216637965db0b60e01b14806200076e57506301ffc9a760e01b6001600160e01b03198316146200076e565b620015218133620022a9565b50565b62001530828262001285565b60008281526001602052604090206200079d90826200130d565b62001556828262002318565b60008281526001602052604090206200079d908262002380565b6001600160a01b03811660009081526002808401602052604090912090815460ff166003811115620015a657620015a662002cc0565b1015620015d257604051633a5a4c2160e01b81526001600160a01b03831660048201526024016200080f565b805460ff191660011781556040516001600160a01b038316907f1803740ef72fc16e647c10fe2d31cf61a1578081960c2e3fb7f5aa957e82f55090600090a2505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526200079d90849062002397565b6001600160a01b038281166000908152600460205260409020541615620016a4576040516303ff3dd760e11b815260040160405180910390fd5b620016bd83602083013583356040850135600162001cc2565b5060078054600181019091557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b039384166001600160a01b0319918216811790925591909216600090815260046020526040902080549091169091179055565b6000818152600383016020526040812060010154835460609291908290620017629060ff6301000000820481169162010000900416620032d6565b60ff1690508067ffffffffffffffff81111562001783576200178362002d13565b604051908082528060200260200182016040528015620017ad578160200160208202803683370190505b5093506000925060005b8161ffff168161ffff1610156200182a57600161ffff82161b831615620018155780858561ffff1681518110620017f257620017f26200319d565b61ffff90921660209283029190910190910152836200181181620032f2565b9450505b806200182181620032f2565b915050620017b7565b5050509250929050565b60025460ff1615156001036200185d5760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038084166000908152600460208181526040808420549094168352600380825292849020845160c081018652815480825260018301549382019390935260028201549581019590955292830154606085015290820154608084015260059091015460a08301528491849182101580620018e05750818160200151115b15620018ff57604051632160733960e01b815260040160405180910390fd5b600954871062000c44576000620019198888888862002470565b905060006200192c600833848c620024c5565b9050600181600281111562001945576200194562002cc0565b036200199357604080518881526001600160a01b0388811660208301528a16918b917fcd73aecbef9bf19bece4b777ca57590ee572e85a62ff5602b7ab7eb73ddcb443910160405180910390a35b620019a16008838b62002744565b1562001b02576001600160a01b038089166000908152600460205260408120549091169080620019d3838b8b6200279c565b9092509050600080620019e860088862001727565b90925090506000620019ff61ffff83168562003316565b6001600160a01b03871660009081526006602052604081209192505b8361ffff168161ffff16101562001a8f5782826000878461ffff168151811062001a495762001a496200319d565b602002602001015161ffff168152602001908152602001600020600082825462001a74919062003276565b9091555081905062001a8681620032f2565b91505062001a1b565b5050505050826001600160a01b03168b6001600160a01b03168d7f775fb71ba106691d4fd81c953ace830d359f3b850e98fbc2a1ebf420af86428a858e62001ad891906200328c565b604080519182526001600160a01b038f166020830152810187905260600160405180910390a45050505b505050505050505050565b60008162001b275783546301000000900460ff1662001b33565b835462010000900460ff165b9050607f1960ff82160162001b5b5760405163ab2bf70360e01b815260040160405180910390fd5b6001600160a01b0383166000908152600285016020526040812090815460ff16600381111562001b8f5762001b8f62002cc0565b1462001bba5760405163899ec36960e01b81526001600160a01b03851660048201526024016200080f565b845462001bda9060ff6301000000820481169162010000900416620032d6565b815460ff919091166101000261ff0019909116178155821562001c3f57845462010000900460ff1685600262001c108362003339565b82546101009290920a60ff81810219909316919092169190910217905550805460ff1916600217815562001c83565b84546301000000900460ff1685600362001c598362003339565b82546101009290920a60ff81810219909316919092169190910217905550805460ff191660031781555b604051831515906001600160a01b038616907f986fcaacc4ec3bd003cca4a358313c174dbc682df73d495e8af308dc55b027a190600090a35050505050565b6001600160a01b03851660009081526003602052604090206001015484158062001cf957508162001cf557801562001cf9565b8015155b1562001d18576040516303ff3dd760e11b815260040160405180910390fd5b60006040518060c0016040528086815260200187815260200162001d3c88620028f6565b62001d48908962003276565b815260208082019690965260006040808301829052426060938401526001600160a01b03909a1681526003808852908a902083518155968301516001880155988201516002870155810151978501979097555050506080840151600482015560a0909301516005909301929092555050565b600062000ea083836200290d565b60006200076e825490565b60005b600754811015620008245760006007828154811062001df95762001df96200319d565b6000918252602082200154604051632f2ff15d60e01b815260048101929092526001600160a01b0385811660248401521691508190632f2ff15d90604401600060405180830381600087803b15801562001e5257600080fd5b505af115801562001e67573d6000803e3d6000fd5b5050604051632f2ff15d60e01b81527f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a660048201526001600160a01b03868116602483015284169250632f2ff15d9150604401600060405180830381600087803b15801562001ed557600080fd5b505af115801562001eea573d6000803e3d6000fd5b5050604051632f2ff15d60e01b81527f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60048201526001600160a01b03868116602483015284169250632f2ff15d9150604401600060405180830381600087803b15801562001f5857600080fd5b505af115801562001f6d573d6000803e3d6000fd5b5050604051631b2b455f60e11b8152600060048201523060248201526001600160a01b03841692506336568abe9150604401600060405180830381600087803b15801562001fba57600080fd5b505af115801562001fcf573d6000803e3d6000fd5b5050604051631b2b455f60e11b81527f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a660048201523060248201526001600160a01b03841692506336568abe9150604401600060405180830381600087803b1580156200203b57600080fd5b505af115801562002050573d6000803e3d6000fd5b5050604051631b2b455f60e11b81527f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60048201523060248201526001600160a01b03841692506336568abe9150604401600060405180830381600087803b158015620020bc57600080fd5b505af1158015620020d1573d6000803e3d6000fd5b50505050508080620020e390620031c9565b91505062001dd6565b8082600101541062002111576040516307faab4f60e11b815260040160405180910390fd5b600190910155565b60006200212682620028f6565b6001600160a01b0384166000908152600f60205260408120805492935083929091906200215590849062003276565b90915550506001600160a01b0383166379cc6790336200217684866200328c565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015620021bd57600080fd5b505af1158015620021d2573d6000803e3d6000fd5b50506040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03861692506323b872dd91506064016020604051808303816000875af11580156200222a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200225091906200335b565b5092915050565b6000818152600183016020526040812054620022a0575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200076e565b5060006200076e565b620022b5828262000ea7565b6200082457620022d0816001600160a01b0316601462001324565b620022dd83602062001324565b604051602001620022f09291906200337b565b60408051601f198184030181529082905262461bcd60e51b82526200080f91600401620033f4565b62002324828262000ea7565b1562000824576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600062000ea0836001600160a01b0384166200293a565b6000620023ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662002a3e9092919063ffffffff16565b8051909150156200079d57808060200190518101906200240f91906200335b565b6200079d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200080f565b6040805160208082018790526bffffffffffffffffffffffff19606087811b8216848601526054840187905285901b16607483015282518083036068018152608890920190925280519101205b949350505050565b600082815260038501602052604081206002815462010000900460ff166002811115620024f657620024f662002cc0565b0362002507576000915050620024bd565b6001600160a01b038516600090815260028701602052604080822081518083019092528054829060ff16600381111562002545576200254562002cc0565b600381111562002559576200255962002cc0565b81529054610100900460ff16602090910152905060028151600381111562002585576200258562002cc0565b1015620025b157604051633a5a4c2160e01b81526001600160a01b03871660048201526024016200080f565b600084815260048801602052604090205415620025e157604051631bf4348160e31b815260040160405180910390fd5b602081015160018381015460ff9092161b90811615620026085760009350505050620024bd565b600183018054821790556002825160038111156200262a576200262a62002cc0565b03620026635782548390600090620026459060ff1662003339565b91906101000a81548160ff021916908360ff16021790555062002696565b825483906001906200267d90610100900460ff1662003339565b91906101000a81548160ff021916908360ff1602179055505b8754835460ff918216911610801590620026c257508754835460ff610100928390048116929091041610155b15620026f5575050805462ff000019166202000017905550600081815260048501602052604090208290556002620024bd565b6000835462010000900460ff16600281111562002716576200271662002cc0565b0362002736575050805462ff0000191662010000179055506001620024bd565b506000979650505050505050565b6000836001015482148015620027695750600082815260048501602052604090205483145b1562002792576001840180549060006200278383620031c9565b91905055506001905062000ea0565b5060009392505050565b60105460009081908190620027b790869061ffff1662002a4f565b6001600160a01b0387166000908152600f6020526040812080549293508392909190620027e690849062003276565b9091555050600e54620027ff90869061ffff1662002a4f565b91506200280d828262003276565b92506001600160a01b0386166340c10f19856200282b86896200328c565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156200287257600080fd5b505af115801562002887573d6000803e3d6000fd5b50506040516340c10f1960e01b8152306004820152602481018690526001600160a01b03891692506340c10f199150604401600060405180830381600087803b158015620028d457600080fd5b505af1158015620028e9573d6000803e3d6000fd5b5050505050935093915050565b6010546000906200076e90839061ffff1662002a4f565b60008260000182815481106200292757620029276200319d565b9060005260206000200154905092915050565b6000818152600183016020526040812054801562002a33576000620029616001836200328c565b855490915060009062002977906001906200328c565b9050818114620029e35760008660000182815481106200299b576200299b6200319d565b9060005260206000200154905080876000018481548110620029c157620029c16200319d565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080620029f757620029f762003409565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506200076e565b60009150506200076e565b6060620024bd848460008562002a70565b600061271062002a6461ffff841685620032a2565b62000ea0919062003316565b60608247101562002ad35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200080f565b6001600160a01b0385163b62002b2c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200080f565b600080866001600160a01b0316858760405162002b4a91906200341f565b60006040518083038185875af1925050503d806000811462002b89576040519150601f19603f3d011682016040523d82523d6000602084013e62002b8e565b606091505b509150915062002ba082828662002bab565b979650505050505050565b6060831562002bbc57508162000ea0565b82511562002bcd5782518084602001fd5b8160405162461bcd60e51b81526004016200080f9190620033f4565b611dff806200343e83390190565b60006020828403121562002c0a57600080fd5b81356001600160e01b03198116811462000ea057600080fd5b60006020828403121562002c3657600080fd5b5035919050565b80356001600160a01b038116811462002c5557600080fd5b919050565b6000806040838503121562002c6e57600080fd5b8235915062002c806020840162002c3d565b90509250929050565b60006020828403121562002c9c57600080fd5b62000ea08262002c3d565b60006040828403121562002cba57600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b815160408201906004811062002cfc57634e487b7160e01b600052602160045260246000fd5b8083525060ff602084015116602083015292915050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011262002d3b57600080fd5b813567ffffffffffffffff8082111562002d595762002d5962002d13565b604051601f8301601f19908116603f0116810190828211818310171562002d845762002d8462002d13565b8160405283815286602085880101111562002d9e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560ff8116811462002c5557600080fd5b60006060828403121562002cba57600080fd5b600080600080600080610100878903121562002dfe57600080fd5b863567ffffffffffffffff8082111562002e1757600080fd5b62002e258a838b0162002d29565b9750602089013591508082111562002e3c57600080fd5b5062002e4b89828a0162002d29565b95505062002e5c6040880162002c3d565b935062002e6c6060880162002c3d565b925062002e7c6080880162002dbe565b915062002e8d8860a0890162002dd0565b90509295509295509295565b604080825283519082018190526000906020906060840190828701845b8281101562002ed857815161ffff168452928401929084019060010162002eb6565b50505061ffff9490941692019190915250919050565b60008060008060008060c0878903121562002f0857600080fd5b8635955062002f1a6020880162002c3d565b94506040870135935062002f316060880162002c3d565b92506080870135915060a087013590509295509295509295565b6000806000806060858703121562002f6257600080fd5b843567ffffffffffffffff8082111562002f7b57600080fd5b818701915087601f83011262002f9057600080fd5b81358181111562002fa057600080fd5b8860208260071b850101111562002fb657600080fd5b6020928301999098509187013596604001359550909350505050565b80151581146200152157600080fd5b60008060006060848603121562002ff757600080fd5b620030028462002c3d565b92506020840135620030148162002fd2565b9150620030246040850162002c3d565b90509250925092565b600080604083850312156200304157600080fd5b6200304c8362002c3d565b915062002c806020840162002c3d565b6000602082840312156200306f57600080fd5b813561ffff8116811462000ea057600080fd5b600080604083850312156200309657600080fd5b50508035926020909101359150565b60008060808385031215620030b957600080fd5b620030c48362002c3d565b915062002c80846020850162002dd0565b60008060408385031215620030e957600080fd5b620030f48362002c3d565b946020939093013593505050565b6000806000606084860312156200311857600080fd5b620031238462002c3d565b925060208401359150620030246040850162002c3d565b6000604082840312156200314d57600080fd5b6040516040810181811067ffffffffffffffff8211171562003173576200317362002d13565b604052620031818362002dbe565b8152620031916020840162002dbe565b60208201529392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620031de57620031de620031b3565b5060010190565b60005b8381101562003202578181015183820152602001620031e8565b50506000910152565b6000815180845262003225816020860160208601620031e5565b601f01601f19169290920160200192915050565b6060815260006200324e60608301866200320b565b82810360208401526200326281866200320b565b91505060ff83166040830152949350505050565b808201808211156200076e576200076e620031b3565b818103818111156200076e576200076e620031b3565b80820281158282048414176200076e576200076e620031b3565b600081620032ce57620032ce620031b3565b506000190190565b60ff81811683821601908111156200076e576200076e620031b3565b600061ffff8083168181036200330c576200330c620031b3565b6001019392505050565b6000826200333457634e487b7160e01b600052601260045260246000fd5b500490565b600060ff821660ff8103620033525762003352620031b3565b60010192915050565b6000602082840312156200336e57600080fd5b815162000ea08162002fd2565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351620033b5816017850160208801620031e5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351620033e8816028840160208801620031e5565b01602801949350505050565b60208152600062000ea060208301846200320b565b634e487b7160e01b600052603160045260246000fd5b6000825162003433818460208701620031e5565b919091019291505056fe60a06040523480156200001157600080fd5b5060405162001dff38038062001dff833981016040819052620000349162000302565b82828181600562000046838262000415565b50600662000055828262000415565b50506007805460ff19169055506200006f600033620000d8565b6200009b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000d8565b620000c77f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620000d8565b505060ff1660805250620004e19050565b620000e48282620000e8565b5050565b620000ff82826200012b60201b6200095f1760201c565b600082815260016020908152604090912062000126918390620009e3620001cb821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e4576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001873390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620001e2836001600160a01b038416620001eb565b90505b92915050565b60008181526001830160205260408120546200023457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001e5565b506000620001e5565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200026557600080fd5b81516001600160401b03808211156200028257620002826200023d565b604051601f8301601f19908116603f01168101908282118183101715620002ad57620002ad6200023d565b81604052838152602092508683858801011115620002ca57600080fd5b600091505b83821015620002ee5785820183015181830184015290820190620002cf565b600093810190920192909252949350505050565b6000806000606084860312156200031857600080fd5b83516001600160401b03808211156200033057600080fd5b6200033e8783880162000253565b945060208601519150808211156200035557600080fd5b50620003648682870162000253565b925050604084015160ff811681146200037c57600080fd5b809150509250925092565b600181811c908216806200039c57607f821691505b602082108103620003bd57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200012657600081815260208120601f850160051c81016020861015620003ec5750805b601f850160051c820191505b818110156200040d57828155600101620003f8565b505050505050565b81516001600160401b038111156200043157620004316200023d565b620004498162000442845462000387565b84620003c3565b602080601f831160018114620004815760008415620004685750858301515b600019600386901b1c1916600185901b1785556200040d565b600085815260208120601f198616915b82811015620004b25788860151825594840194600190910190840162000491565b5085821015620004d15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051611902620004fd600039600061027d01526119026000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063a457c2d711610097578063d539139311610071578063d5391393146103d1578063d547741f146103f8578063dd62ed3e1461040b578063e63ab1e91461041e57600080fd5b8063a457c2d714610398578063a9059cbb146103ab578063ca15c873146103be57600080fd5b80639010d07c116100d35780639010d07c1461034a57806391d148541461037557806395d89b4114610388578063a217fddf1461039057600080fd5b806370a082311461030657806379cc67901461032f5780638456cb591461034257600080fd5b8063313ce567116101665780633f4ba83a116101405780633f4ba83a146102cd57806340c10f19146102d557806342966c68146102e85780635c975abb146102fb57600080fd5b8063313ce5671461027657806336568abe146102a757806339509351146102ba57600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022b578063248a9ca31461023e5780632f2ff15d1461026157600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d73660046115c2565b610445565b60405190151581526020015b60405180910390f35b6101f9610470565b6040516101e89190611610565b6101dc61021436600461165f565b610502565b6004545b6040519081526020016101e8565b6101dc610239366004611689565b61051a565b61021d61024c3660046116c5565b60009081526020819052604090206001015490565b61027461026f3660046116de565b61053e565b005b60405160ff7f00000000000000000000000000000000000000000000000000000000000000001681526020016101e8565b6102746102b53660046116de565b610568565b6101dc6102c836600461165f565b6105eb565b61027461060d565b6102746102e336600461165f565b6106b3565b6102746102f63660046116c5565b610752565b60075460ff166101dc565b61021d61031436600461170a565b6001600160a01b031660009081526002602052604090205490565b61027461033d36600461165f565b61075f565b610274610774565b61035d610358366004611725565b610818565b6040516001600160a01b0390911681526020016101e8565b6101dc6103833660046116de565b610837565b6101f9610860565b61021d600081565b6101dc6103a636600461165f565b61086f565b6101dc6103b936600461165f565b6108ea565b61021d6103cc3660046116c5565b6108f8565b61021d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102746104063660046116de565b61090f565b61021d610419366004611747565b610934565b61021d7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006001600160e01b03198216635a05180f60e01b148061046a575061046a826109f8565b92915050565b60606005805461047f90611771565b80601f01602080910402602001604051908101604052809291908181526020018280546104ab90611771565b80156104f85780601f106104cd576101008083540402835291602001916104f8565b820191906000526020600020905b8154815290600101906020018083116104db57829003601f168201915b5050505050905090565b600033610510818585610a2d565b5060019392505050565b600033610528858285610b51565b610533858585610bcb565b506001949350505050565b60008281526020819052604090206001015461055981610da4565b6105638383610dae565b505050565b6001600160a01b03811633146105dd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105e78282610dd0565b5050565b6000336105108185856105fe8383610934565b61060891906117c1565b610a2d565b6106377f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610837565b6106a95760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105d4565b6106b1610df2565b565b6106dd7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610837565b6107485760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105d4565b6105e78282610e44565b61075c3382610f2f565b50565b61076a823383610b51565b6105e78282610f2f565b61079e7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610837565b6108105760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105d4565b6106b1611089565b600082815260016020526040812061083090836110c6565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60606006805461047f90611771565b6000338161087d8286610934565b9050838110156108dd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105d4565b6105338286868403610a2d565b600033610510818585610bcb565b600081815260016020526040812061046a906110d2565b60008281526020819052604090206001015461092a81610da4565b6105638383610dd0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6109698282610837565b6105e7576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561099f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610830836001600160a01b0384166110dc565b60006001600160e01b03198216637965db0b60e01b148061046a57506301ffc9a760e01b6001600160e01b031983161461046a565b6001600160a01b038316610a8f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105d4565b6001600160a01b038216610af05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105d4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610b5d8484610934565b90506000198114610bc55781811015610bb85760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105d4565b610bc58484848403610a2d565b50505050565b6001600160a01b038316610c2f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105d4565b6001600160a01b038216610c915760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105d4565b610c9c83838361112b565b6001600160a01b03831660009081526002602052604090205481811015610d145760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105d4565b6001600160a01b03808516600090815260026020526040808220858503905591851681529081208054849290610d4b9084906117c1565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610d9791815260200190565b60405180910390a3610bc5565b61075c8133611136565b610db8828261095f565b600082815260016020526040902061056390826109e3565b610dda828261119a565b600082815260016020526040902061056390826111ff565b610dfa611214565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610e9a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105d4565b610ea66000838361112b565b8060046000828254610eb891906117c1565b90915550506001600160a01b03821660009081526002602052604081208054839290610ee59084906117c1565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610f8f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105d4565b610f9b8260008361112b565b6001600160a01b0382166000908152600260205260409020548181101561100f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105d4565b6001600160a01b038316600090815260026020526040812083830390556004805484929061103e9084906117d4565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b61109161125d565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e273390565b600061083083836112a3565b600061046a825490565b60008181526001830160205260408120546111235750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561046a565b50600061046a565b6105638383836112cd565b6111408282610837565b6105e757611158816001600160a01b03166014611333565b611163836020611333565b6040516020016111749291906117e7565b60408051601f198184030181529082905262461bcd60e51b82526105d491600401611610565b6111a48282610837565b156105e7576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610830836001600160a01b0384166114cf565b60075460ff166106b15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105d4565b60075460ff16156106b15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105d4565b60008260000182815481106112ba576112ba61185c565b9060005260206000200154905092915050565b60075460ff16156105635760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105d4565b60606000611342836002611872565b61134d9060026117c1565b67ffffffffffffffff81111561136557611365611889565b6040519080825280601f01601f19166020018201604052801561138f576020820181803683370190505b509050600360fc1b816000815181106113aa576113aa61185c565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106113d9576113d961185c565b60200101906001600160f81b031916908160001a90535060006113fd846002611872565b6114089060016117c1565b90505b6001811115611480576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061143c5761143c61185c565b1a60f81b8282815181106114525761145261185c565b60200101906001600160f81b031916908160001a90535060049490941c936114798161189f565b905061140b565b5083156108305760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d4565b600081815260018301602052604081205480156115b85760006114f36001836117d4565b8554909150600090611507906001906117d4565b905081811461156c5760008660000182815481106115275761152761185c565b906000526020600020015490508087600001848154811061154a5761154a61185c565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061157d5761157d6118b6565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061046a565b600091505061046a565b6000602082840312156115d457600080fd5b81356001600160e01b03198116811461083057600080fd5b60005b838110156116075781810151838201526020016115ef565b50506000910152565b602081526000825180602084015261162f8160408501602087016115ec565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461165a57600080fd5b919050565b6000806040838503121561167257600080fd5b61167b83611643565b946020939093013593505050565b60008060006060848603121561169e57600080fd5b6116a784611643565b92506116b560208501611643565b9150604084013590509250925092565b6000602082840312156116d757600080fd5b5035919050565b600080604083850312156116f157600080fd5b8235915061170160208401611643565b90509250929050565b60006020828403121561171c57600080fd5b61083082611643565b6000806040838503121561173857600080fd5b50508035926020909101359150565b6000806040838503121561175a57600080fd5b61176383611643565b915061170160208401611643565b600181811c9082168061178557607f821691505b6020821081036117a557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561046a5761046a6117ab565b8181038181111561046a5761046a6117ab565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161181f8160178501602088016115ec565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516118508160288401602088016115ec565b01602801949350505050565b634e487b7160e01b600052603260045260246000fd5b808202811582820484141761046a5761046a6117ab565b634e487b7160e01b600052604160045260246000fd5b6000816118ae576118ae6117ab565b506000190190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220f6070dfc0e95ca26b4f4c30364955d43a8953da748e317fa9d7a3a64368a969064736f6c63430008110033930fce5230a9f921042304dfd119e1ad0bbc7d9c38c01b0505d47cf8b65d228ca264697066735822122045a38382fc06139f8441e5b84c1b8c7471d260bd6c11511259b36df4665e912564736f6c63430008110033930fce5230a9f921042304dfd119e1ad0bbc7d9c38c01b0505d47cf8b65d228c0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000032

Deployed ByteCode

0x60806040523480156200001157600080fd5b5060043610620002915760003560e01c8063842e8b811162000161578063a217fddf11620000d3578063d17349071162000092578063d1734907146200069e578063d547741f14620006b5578063dff7330714620006cc578063eec9c9de14620006d5578063f45346dc1462000703578063feaeb43e146200071a57600080fd5b8063a217fddf14620005d5578063ba46ae7214620005de578063c3e4a8661462000659578063ca15c8731462000670578063ce5494bb146200068757600080fd5b80638e26a48811620001205780638e26a488146200055e5780639010d07c146200058157806391d1485414620005985780639267b15314620005af57806396daa32214620005c657600080fd5b8063842e8b8114620004ec5780638456cb59146200050f578063858146361462000519578063883910d7146200053057806388f14da3146200054757600080fd5b80634f64b2be116200020757806366d372e811620001c657806366d372e8146200046c5780636d1b96b4146200048357806373445f00146200049a5780637486fa4e14620004b157806377c654a314620004cb5780637b89893914620004e257600080fd5b80634f64b2be14620003f2578063511e1f0c14620004095780635bfb29aa14620004205780635c975abb1462000437578063651107bd146200044557600080fd5b8063389ed2671162000254578063389ed267146200036c5780633f4ba83a146200039457806340a141ff146200039e57806347adf63014620003b55780634f1811dd14620003cc57600080fd5b806301ffc9a71462000296578063248a9ca314620002c25780632f2ff15d14620002f757806336568abe146200031057806336cdca741462000327575b600080fd5b620002ad620002a736600462002bf7565b62000746565b60405190151581526020015b60405180910390f35b620002e8620002d336600462002c23565b60009081526020819052604090206001015490565b604051908152602001620002b9565b6200030e6200030836600462002c5a565b62000774565b005b6200030e6200032136600462002c5a565b620007a2565b620003536200033836600462002c89565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001620002b9565b620002e87ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f681565b6200030e62000828565b6200030e620003af36600462002c89565b62000881565b6200030e620003c636600462002ca7565b620008a9565b620003e3620003dd36600462002c89565b620008d4565b604051620002b9919062002cd6565b620003536200040336600462002c23565b62000951565b6200030e6200041a36600462002c89565b6200097c565b620003536200043136600462002de3565b62000a5f565b600254620002ad9060ff1681565b6200045c6200045636600462002c23565b62000aeb565b604051620002b992919062002e99565b6200030e6200047d36600462002eee565b62000b05565b6200030e6200049436600462002f4b565b62000b4d565b6200030e620004ab36600462002fe1565b62000c4d565b600e5462000353906201000090046001600160a01b031681565b6200030e620004dc3660046200302d565b62000c99565b620002e8600d5481565b600e54620004fb9061ffff1681565b60405161ffff9091168152602001620002b9565b6200030e62000cdf565b620002e86000805160206200523d83398151915281565b6200030e620005413660046200305c565b62000d1b565b6200030e620005583660046200305c565b62000e2a565b620002e86200056f36600462002c89565b600f6020526000908152604090205481565b620003536200059236600462003082565b62000e86565b620002ad620005a936600462002c5a565b62000ea7565b6200030e620005c0366004620030a5565b62000ed0565b601054620004fb9061ffff1681565b620002e8600081565b6200062b620005ef36600462002c89565b60036020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154905086565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001620002b9565b6200030e6200066a3660046200302d565b62000f04565b620002e86200068136600462002c23565b62000f4e565b6200030e6200069836600462002c89565b62000f67565b6200030e620006af36600462002c23565b62001004565b6200030e620006c636600462002c5a565b6200101e565b600954620002e8565b620002e8620006e6366004620030d5565b600660209081526000928352604080842090915290825290205481565b620002e86200071436600462003102565b62001047565b620003536200072b36600462002c89565b6004602052600090815260409020546001600160a01b031681565b60006001600160e01b03198216635a05180f60e01b14806200076e57506200076e82620014de565b92915050565b600082815260208190526040902060010154620007918162001515565b6200079d838362001524565b505050565b6001600160a01b0381163314620008185760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6200082482826200154a565b5050565b600e546201000090046001600160a01b0316156200085957604051631fa7b44b60e11b815260040160405180910390fd5b6000805160206200523d833981519152620008748162001515565b506002805460ff19169055565b6000805160206200523d8339815191526200089c8162001515565b6200082460088362001570565b6000620008b68162001515565b62000824620008cb368490038401846200313a565b60089062001205565b60408051808201909152600080825260208201526001600160a01b0382166000908152600a60205260409081902081518083019092528054829060ff16600381111562000925576200092562002cc0565b600381111562000939576200093962002cc0565b81529054610100900460ff1660209091015292915050565b600781815481106200096257600080fd5b6000918252602090912001546001600160a01b0316905081565b6001600160a01b038082166000908152600560205260409020541680620009b657604051630ed1b8b360e31b815260040160405180910390fd5b6001600160a01b0382166000908152600a6020526040812054610100900460ff16905b60075481101562000a5957600060078281548110620009fc57620009fc6200319d565b6000918252602080832091909101546001600160a01b031680835260068252604080842061ffff881685529092529082208054929055915062000a4182868362001616565b5050808062000a5090620031c9565b915050620009d9565b50505050565b60006000805160206200523d83398151915262000a7c8162001515565b6001600160a01b0386161562000a93578562000ad1565b87878560405162000aa49062002be9565b62000ab29392919062003239565b604051809103906000f08015801562000acf573d6000803e3d6000fd5b505b915062000ae08286856200166a565b509695505050505050565b6060600062000afc60088462001727565b91509150915091565b818181158062000b16575081814014155b1562000b3557604051631f03465b60e11b815260040160405180910390fd5b62000b438888888862001834565b5050505050505050565b818181158062000b5e575081814014155b1562000b7d57604051631f03465b60e11b815260040160405180910390fd5b60005b8581101562000c445762000c2f87878381811062000ba25762000ba26200319d565b9050608002016000013588888481811062000bc15762000bc16200319d565b905060800201602001602081019062000bdb919062002c89565b89898581811062000bf05762000bf06200319d565b905060800201604001358a8a8681811062000c0f5762000c0f6200319d565b905060800201606001602081019062000c29919062002c89565b62001834565b8062000c3b81620031c9565b91505062000b80565b50505050505050565b600062000c5a8162001515565b62000c686008858562001b0d565b506001600160a01b03928316600090815260056020526040902080546001600160a01b031916919093161790915550565b6000805160206200523d83398151915262000cb48162001515565b6001600160a01b0383166000818152600f6020526040812080549190559062000a5990848362001616565b7ffcb9fcbfa83b897fb2d5cf4b58962164105c1e71489a37ef3ae0db3fdce576f662000d0b8162001515565b506002805460ff19166001179055565b6000805160206200523d83398151915262000d368162001515565b6101f461ffff8316111562000d5e57604051634efbf5f560e01b815260040160405180910390fd5b6010805461ffff191661ffff841617905560005b6007548110156200079d5760006007828154811062000d955762000d956200319d565b60009182526020808320909101546001600160a01b031680835260038083526040808520815160c0810183528154808252600183015496820187905260028301549382019390935292810154606084018190526004820154608085015260059091015460a0840152929550909362000e1293869390929162001cc2565b5050808062000e2190620031c9565b91505062000d72565b6000805160206200523d83398151915262000e458162001515565b6101f461ffff8316111562000e6d57604051634efbf5f560e01b815260040160405180910390fd5b50600e805461ffff191661ffff92909216919091179055565b600082815260016020526040812062000ea0908362001dba565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206200523d83398151915262000eeb8162001515565b6200079d83602084013584356040860135600062001cc2565b6000805160206200523d83398151915262000f1f8162001515565b506001600160a01b03918216600090815260056020526040902080546001600160a01b03191691909216179055565b60008181526001602052604081206200076e9062001dc8565b60025460ff16151560000362000f905760405163dcdde9dd60e01b815260040160405180910390fd5b600e546201000090046001600160a01b03161562000fc157604051631fa7b44b60e11b815260040160405180910390fd5b600062000fce8162001515565b62000fd98262001dd3565b50600e80546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b6000620010118162001515565b62000824600883620020ec565b6000828152602081905260409020600101546200103b8162001515565b6200079d83836200154a565b60025460009060ff161515600103620010735760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038416600090815260036020526040902080548591859182101580620010a35750818160020154115b15620010c257604051632160733960e01b815260040160405180910390fd5b6003810154156200114a576005810154620010e1906201518062003276565b421115620010f757426005820155600060048201555b80600301548282600401546200110e919062003276565b11156200112e57604051635ee26fb960e11b815260040160405180910390fd5b8181600401600082825462001144919062003276565b90915550505b6001600160a01b0385166200117257604051638aa3a72f60e01b815260040160405180910390fd5b600d80549450849060006200118783620031c9565b919050555060006200119a888862002119565b90506001600160a01b038816857f3a58bc9c7c305b0dba42522c856c30706aadce643b5dc3c0a1a0c41fec127d99620011d4848b6200328c565b604080519182526001600160a01b038b166020830152810185905260600160405180910390a3505050509392505050565b805160ff1615806200121d57508051608060ff909116115b806200122e5750602081015160ff16155b80620012445750608060ff16816020015160ff16115b15620012635760405163c52a9bd360e01b815260040160405180910390fd5b8051825460209092015160ff9081166101000261ffff19909316911617179055565b62001291828262000ea7565b62000824576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620012c93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000ea0836001600160a01b03841662002257565b6060600062001335836002620032a2565b6200134290600262003276565b67ffffffffffffffff8111156200135d576200135d62002d13565b6040519080825280601f01601f19166020018201604052801562001388576020820181803683370190505b509050600360fc1b81600081518110620013a657620013a66200319d565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110620013d857620013d86200319d565b60200101906001600160f81b031916908160001a9053506000620013fe846002620032a2565b6200140b90600162003276565b90505b60018111156200148d576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200144357620014436200319d565b1a60f81b8282815181106200145c576200145c6200319d565b60200101906001600160f81b031916908160001a90535060049490941c936200148581620032bc565b90506200140e565b50831562000ea05760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016200080f565b60006001600160e01b03198216637965db0b60e01b14806200076e57506301ffc9a760e01b6001600160e01b03198316146200076e565b620015218133620022a9565b50565b62001530828262001285565b60008281526001602052604090206200079d90826200130d565b62001556828262002318565b60008281526001602052604090206200079d908262002380565b6001600160a01b03811660009081526002808401602052604090912090815460ff166003811115620015a657620015a662002cc0565b1015620015d257604051633a5a4c2160e01b81526001600160a01b03831660048201526024016200080f565b805460ff191660011781556040516001600160a01b038316907f1803740ef72fc16e647c10fe2d31cf61a1578081960c2e3fb7f5aa957e82f55090600090a2505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526200079d90849062002397565b6001600160a01b038281166000908152600460205260409020541615620016a4576040516303ff3dd760e11b815260040160405180910390fd5b620016bd83602083013583356040850135600162001cc2565b5060078054600181019091557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b039384166001600160a01b0319918216811790925591909216600090815260046020526040902080549091169091179055565b6000818152600383016020526040812060010154835460609291908290620017629060ff6301000000820481169162010000900416620032d6565b60ff1690508067ffffffffffffffff81111562001783576200178362002d13565b604051908082528060200260200182016040528015620017ad578160200160208202803683370190505b5093506000925060005b8161ffff168161ffff1610156200182a57600161ffff82161b831615620018155780858561ffff1681518110620017f257620017f26200319d565b61ffff90921660209283029190910190910152836200181181620032f2565b9450505b806200182181620032f2565b915050620017b7565b5050509250929050565b60025460ff1615156001036200185d5760405163ab35696f60e01b815260040160405180910390fd5b6001600160a01b038084166000908152600460208181526040808420549094168352600380825292849020845160c081018652815480825260018301549382019390935260028201549581019590955292830154606085015290820154608084015260059091015460a08301528491849182101580620018e05750818160200151115b15620018ff57604051632160733960e01b815260040160405180910390fd5b600954871062000c44576000620019198888888862002470565b905060006200192c600833848c620024c5565b9050600181600281111562001945576200194562002cc0565b036200199357604080518881526001600160a01b0388811660208301528a16918b917fcd73aecbef9bf19bece4b777ca57590ee572e85a62ff5602b7ab7eb73ddcb443910160405180910390a35b620019a16008838b62002744565b1562001b02576001600160a01b038089166000908152600460205260408120549091169080620019d3838b8b6200279c565b9092509050600080620019e860088862001727565b90925090506000620019ff61ffff83168562003316565b6001600160a01b03871660009081526006602052604081209192505b8361ffff168161ffff16101562001a8f5782826000878461ffff168151811062001a495762001a496200319d565b602002602001015161ffff168152602001908152602001600020600082825462001a74919062003276565b9091555081905062001a8681620032f2565b91505062001a1b565b5050505050826001600160a01b03168b6001600160a01b03168d7f775fb71ba106691d4fd81c953ace830d359f3b850e98fbc2a1ebf420af86428a858e62001ad891906200328c565b604080519182526001600160a01b038f166020830152810187905260600160405180910390a45050505b505050505050505050565b60008162001b275783546301000000900460ff1662001b33565b835462010000900460ff165b9050607f1960ff82160162001b5b5760405163ab2bf70360e01b815260040160405180910390fd5b6001600160a01b0383166000908152600285016020526040812090815460ff16600381111562001b8f5762001b8f62002cc0565b1462001bba5760405163899ec36960e01b81526001600160a01b03851660048201526024016200080f565b845462001bda9060ff6301000000820481169162010000900416620032d6565b815460ff919091166101000261ff0019909116178155821562001c3f57845462010000900460ff1685600262001c108362003339565b82546101009290920a60ff81810219909316919092169190910217905550805460ff1916600217815562001c83565b84546301000000900460ff1685600362001c598362003339565b82546101009290920a60ff81810219909316919092169190910217905550805460ff191660031781555b604051831515906001600160a01b038616907f986fcaacc4ec3bd003cca4a358313c174dbc682df73d495e8af308dc55b027a190600090a35050505050565b6001600160a01b03851660009081526003602052604090206001015484158062001cf957508162001cf557801562001cf9565b8015155b1562001d18576040516303ff3dd760e11b815260040160405180910390fd5b60006040518060c0016040528086815260200187815260200162001d3c88620028f6565b62001d48908962003276565b815260208082019690965260006040808301829052426060938401526001600160a01b03909a1681526003808852908a902083518155968301516001880155988201516002870155810151978501979097555050506080840151600482015560a0909301516005909301929092555050565b600062000ea083836200290d565b60006200076e825490565b60005b600754811015620008245760006007828154811062001df95762001df96200319d565b6000918252602082200154604051632f2ff15d60e01b815260048101929092526001600160a01b0385811660248401521691508190632f2ff15d90604401600060405180830381600087803b15801562001e5257600080fd5b505af115801562001e67573d6000803e3d6000fd5b5050604051632f2ff15d60e01b81527f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a660048201526001600160a01b03868116602483015284169250632f2ff15d9150604401600060405180830381600087803b15801562001ed557600080fd5b505af115801562001eea573d6000803e3d6000fd5b5050604051632f2ff15d60e01b81527f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60048201526001600160a01b03868116602483015284169250632f2ff15d9150604401600060405180830381600087803b15801562001f5857600080fd5b505af115801562001f6d573d6000803e3d6000fd5b5050604051631b2b455f60e11b8152600060048201523060248201526001600160a01b03841692506336568abe9150604401600060405180830381600087803b15801562001fba57600080fd5b505af115801562001fcf573d6000803e3d6000fd5b5050604051631b2b455f60e11b81527f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a660048201523060248201526001600160a01b03841692506336568abe9150604401600060405180830381600087803b1580156200203b57600080fd5b505af115801562002050573d6000803e3d6000fd5b5050604051631b2b455f60e11b81527f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a60048201523060248201526001600160a01b03841692506336568abe9150604401600060405180830381600087803b158015620020bc57600080fd5b505af1158015620020d1573d6000803e3d6000fd5b50505050508080620020e390620031c9565b91505062001dd6565b8082600101541062002111576040516307faab4f60e11b815260040160405180910390fd5b600190910155565b60006200212682620028f6565b6001600160a01b0384166000908152600f60205260408120805492935083929091906200215590849062003276565b90915550506001600160a01b0383166379cc6790336200217684866200328c565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015620021bd57600080fd5b505af1158015620021d2573d6000803e3d6000fd5b50506040516323b872dd60e01b8152336004820152306024820152604481018490526001600160a01b03861692506323b872dd91506064016020604051808303816000875af11580156200222a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200225091906200335b565b5092915050565b6000818152600183016020526040812054620022a0575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200076e565b5060006200076e565b620022b5828262000ea7565b6200082457620022d0816001600160a01b0316601462001324565b620022dd83602062001324565b604051602001620022f09291906200337b565b60408051601f198184030181529082905262461bcd60e51b82526200080f91600401620033f4565b62002324828262000ea7565b1562000824576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600062000ea0836001600160a01b0384166200293a565b6000620023ee826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662002a3e9092919063ffffffff16565b8051909150156200079d57808060200190518101906200240f91906200335b565b6200079d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200080f565b6040805160208082018790526bffffffffffffffffffffffff19606087811b8216848601526054840187905285901b16607483015282518083036068018152608890920190925280519101205b949350505050565b600082815260038501602052604081206002815462010000900460ff166002811115620024f657620024f662002cc0565b0362002507576000915050620024bd565b6001600160a01b038516600090815260028701602052604080822081518083019092528054829060ff16600381111562002545576200254562002cc0565b600381111562002559576200255962002cc0565b81529054610100900460ff16602090910152905060028151600381111562002585576200258562002cc0565b1015620025b157604051633a5a4c2160e01b81526001600160a01b03871660048201526024016200080f565b600084815260048801602052604090205415620025e157604051631bf4348160e31b815260040160405180910390fd5b602081015160018381015460ff9092161b90811615620026085760009350505050620024bd565b600183018054821790556002825160038111156200262a576200262a62002cc0565b03620026635782548390600090620026459060ff1662003339565b91906101000a81548160ff021916908360ff16021790555062002696565b825483906001906200267d90610100900460ff1662003339565b91906101000a81548160ff021916908360ff1602179055505b8754835460ff918216911610801590620026c257508754835460ff610100928390048116929091041610155b15620026f5575050805462ff000019166202000017905550600081815260048501602052604090208290556002620024bd565b6000835462010000900460ff16600281111562002716576200271662002cc0565b0362002736575050805462ff0000191662010000179055506001620024bd565b506000979650505050505050565b6000836001015482148015620027695750600082815260048501602052604090205483145b1562002792576001840180549060006200278383620031c9565b91905055506001905062000ea0565b5060009392505050565b60105460009081908190620027b790869061ffff1662002a4f565b6001600160a01b0387166000908152600f6020526040812080549293508392909190620027e690849062003276565b9091555050600e54620027ff90869061ffff1662002a4f565b91506200280d828262003276565b92506001600160a01b0386166340c10f19856200282b86896200328c565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156200287257600080fd5b505af115801562002887573d6000803e3d6000fd5b50506040516340c10f1960e01b8152306004820152602481018690526001600160a01b03891692506340c10f199150604401600060405180830381600087803b158015620028d457600080fd5b505af1158015620028e9573d6000803e3d6000fd5b5050505050935093915050565b6010546000906200076e90839061ffff1662002a4f565b60008260000182815481106200292757620029276200319d565b9060005260206000200154905092915050565b6000818152600183016020526040812054801562002a33576000620029616001836200328c565b855490915060009062002977906001906200328c565b9050818114620029e35760008660000182815481106200299b576200299b6200319d565b9060005260206000200154905080876000018481548110620029c157620029c16200319d565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080620029f757620029f762003409565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506200076e565b60009150506200076e565b6060620024bd848460008562002a70565b600061271062002a6461ffff841685620032a2565b62000ea0919062003316565b60608247101562002ad35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200080f565b6001600160a01b0385163b62002b2c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200080f565b600080866001600160a01b0316858760405162002b4a91906200341f565b60006040518083038185875af1925050503d806000811462002b89576040519150601f19603f3d011682016040523d82523d6000602084013e62002b8e565b606091505b509150915062002ba082828662002bab565b979650505050505050565b6060831562002bbc57508162000ea0565b82511562002bcd5782518084602001fd5b8160405162461bcd60e51b81526004016200080f9190620033f4565b611dff806200343e83390190565b60006020828403121562002c0a57600080fd5b81356001600160e01b03198116811462000ea057600080fd5b60006020828403121562002c3657600080fd5b5035919050565b80356001600160a01b038116811462002c5557600080fd5b919050565b6000806040838503121562002c6e57600080fd5b8235915062002c806020840162002c3d565b90509250929050565b60006020828403121562002c9c57600080fd5b62000ea08262002c3d565b60006040828403121562002cba57600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b815160408201906004811062002cfc57634e487b7160e01b600052602160045260246000fd5b8083525060ff602084015116602083015292915050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011262002d3b57600080fd5b813567ffffffffffffffff8082111562002d595762002d5962002d13565b604051601f8301601f19908116603f0116810190828211818310171562002d845762002d8462002d13565b8160405283815286602085880101111562002d9e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560ff8116811462002c5557600080fd5b60006060828403121562002cba57600080fd5b600080600080600080610100878903121562002dfe57600080fd5b863567ffffffffffffffff8082111562002e1757600080fd5b62002e258a838b0162002d29565b9750602089013591508082111562002e3c57600080fd5b5062002e4b89828a0162002d29565b95505062002e5c6040880162002c3d565b935062002e6c6060880162002c3d565b925062002e7c6080880162002dbe565b915062002e8d8860a0890162002dd0565b90509295509295509295565b604080825283519082018190526000906020906060840190828701845b8281101562002ed857815161ffff168452928401929084019060010162002eb6565b50505061ffff9490941692019190915250919050565b60008060008060008060c0878903121562002f0857600080fd5b8635955062002f1a6020880162002c3d565b94506040870135935062002f316060880162002c3d565b92506080870135915060a087013590509295509295509295565b6000806000806060858703121562002f6257600080fd5b843567ffffffffffffffff8082111562002f7b57600080fd5b818701915087601f83011262002f9057600080fd5b81358181111562002fa057600080fd5b8860208260071b850101111562002fb657600080fd5b6020928301999098509187013596604001359550909350505050565b80151581146200152157600080fd5b60008060006060848603121562002ff757600080fd5b620030028462002c3d565b92506020840135620030148162002fd2565b9150620030246040850162002c3d565b90509250925092565b600080604083850312156200304157600080fd5b6200304c8362002c3d565b915062002c806020840162002c3d565b6000602082840312156200306f57600080fd5b813561ffff8116811462000ea057600080fd5b600080604083850312156200309657600080fd5b50508035926020909101359150565b60008060808385031215620030b957600080fd5b620030c48362002c3d565b915062002c80846020850162002dd0565b60008060408385031215620030e957600080fd5b620030f48362002c3d565b946020939093013593505050565b6000806000606084860312156200311857600080fd5b620031238462002c3d565b925060208401359150620030246040850162002c3d565b6000604082840312156200314d57600080fd5b6040516040810181811067ffffffffffffffff8211171562003173576200317362002d13565b604052620031818362002dbe565b8152620031916020840162002dbe565b60208201529392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201620031de57620031de620031b3565b5060010190565b60005b8381101562003202578181015183820152602001620031e8565b50506000910152565b6000815180845262003225816020860160208601620031e5565b601f01601f19169290920160200192915050565b6060815260006200324e60608301866200320b565b82810360208401526200326281866200320b565b91505060ff83166040830152949350505050565b808201808211156200076e576200076e620031b3565b818103818111156200076e576200076e620031b3565b80820281158282048414176200076e576200076e620031b3565b600081620032ce57620032ce620031b3565b506000190190565b60ff81811683821601908111156200076e576200076e620031b3565b600061ffff8083168181036200330c576200330c620031b3565b6001019392505050565b6000826200333457634e487b7160e01b600052601260045260246000fd5b500490565b600060ff821660ff8103620033525762003352620031b3565b60010192915050565b6000602082840312156200336e57600080fd5b815162000ea08162002fd2565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351620033b5816017850160208801620031e5565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351620033e8816028840160208801620031e5565b01602801949350505050565b60208152600062000ea060208301846200320b565b634e487b7160e01b600052603160045260246000fd5b6000825162003433818460208701620031e5565b919091019291505056fe60a06040523480156200001157600080fd5b5060405162001dff38038062001dff833981016040819052620000349162000302565b82828181600562000046838262000415565b50600662000055828262000415565b50506007805460ff19169055506200006f600033620000d8565b6200009b7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633620000d8565b620000c77f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33620000d8565b505060ff1660805250620004e19050565b620000e48282620000e8565b5050565b620000ff82826200012b60201b6200095f1760201c565b600082815260016020908152604090912062000126918390620009e3620001cb821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620000e4576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001873390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620001e2836001600160a01b038416620001eb565b90505b92915050565b60008181526001830160205260408120546200023457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001e5565b506000620001e5565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200026557600080fd5b81516001600160401b03808211156200028257620002826200023d565b604051601f8301601f19908116603f01168101908282118183101715620002ad57620002ad6200023d565b81604052838152602092508683858801011115620002ca57600080fd5b600091505b83821015620002ee5785820183015181830184015290820190620002cf565b600093810190920192909252949350505050565b6000806000606084860312156200031857600080fd5b83516001600160401b03808211156200033057600080fd5b6200033e8783880162000253565b945060208601519150808211156200035557600080fd5b50620003648682870162000253565b925050604084015160ff811681146200037c57600080fd5b809150509250925092565b600181811c908216806200039c57607f821691505b602082108103620003bd57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200012657600081815260208120601f850160051c81016020861015620003ec5750805b601f850160051c820191505b818110156200040d57828155600101620003f8565b505050505050565b81516001600160401b038111156200043157620004316200023d565b620004498162000442845462000387565b84620003c3565b602080601f831160018114620004815760008415620004685750858301515b600019600386901b1c1916600185901b1785556200040d565b600085815260208120601f198616915b82811015620004b25788860151825594840194600190910190840162000491565b5085821015620004d15787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051611902620004fd600039600061027d01526119026000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c806370a08231116100f9578063a457c2d711610097578063d539139311610071578063d5391393146103d1578063d547741f146103f8578063dd62ed3e1461040b578063e63ab1e91461041e57600080fd5b8063a457c2d714610398578063a9059cbb146103ab578063ca15c873146103be57600080fd5b80639010d07c116100d35780639010d07c1461034a57806391d148541461037557806395d89b4114610388578063a217fddf1461039057600080fd5b806370a082311461030657806379cc67901461032f5780638456cb591461034257600080fd5b8063313ce567116101665780633f4ba83a116101405780633f4ba83a146102cd57806340c10f19146102d557806342966c68146102e85780635c975abb146102fb57600080fd5b8063313ce5671461027657806336568abe146102a757806339509351146102ba57600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022b578063248a9ca31461023e5780632f2ff15d1461026157600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d73660046115c2565b610445565b60405190151581526020015b60405180910390f35b6101f9610470565b6040516101e89190611610565b6101dc61021436600461165f565b610502565b6004545b6040519081526020016101e8565b6101dc610239366004611689565b61051a565b61021d61024c3660046116c5565b60009081526020819052604090206001015490565b61027461026f3660046116de565b61053e565b005b60405160ff7f00000000000000000000000000000000000000000000000000000000000000001681526020016101e8565b6102746102b53660046116de565b610568565b6101dc6102c836600461165f565b6105eb565b61027461060d565b6102746102e336600461165f565b6106b3565b6102746102f63660046116c5565b610752565b60075460ff166101dc565b61021d61031436600461170a565b6001600160a01b031660009081526002602052604090205490565b61027461033d36600461165f565b61075f565b610274610774565b61035d610358366004611725565b610818565b6040516001600160a01b0390911681526020016101e8565b6101dc6103833660046116de565b610837565b6101f9610860565b61021d600081565b6101dc6103a636600461165f565b61086f565b6101dc6103b936600461165f565b6108ea565b61021d6103cc3660046116c5565b6108f8565b61021d7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102746104063660046116de565b61090f565b61021d610419366004611747565b610934565b61021d7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b60006001600160e01b03198216635a05180f60e01b148061046a575061046a826109f8565b92915050565b60606005805461047f90611771565b80601f01602080910402602001604051908101604052809291908181526020018280546104ab90611771565b80156104f85780601f106104cd576101008083540402835291602001916104f8565b820191906000526020600020905b8154815290600101906020018083116104db57829003601f168201915b5050505050905090565b600033610510818585610a2d565b5060019392505050565b600033610528858285610b51565b610533858585610bcb565b506001949350505050565b60008281526020819052604090206001015461055981610da4565b6105638383610dae565b505050565b6001600160a01b03811633146105dd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105e78282610dd0565b5050565b6000336105108185856105fe8383610934565b61060891906117c1565b610a2d565b6106377f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610837565b6106a95760405162461bcd60e51b815260206004820152603960248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20756e70617573650000000000000060648201526084016105d4565b6106b1610df2565b565b6106dd7f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a633610837565b6107485760405162461bcd60e51b815260206004820152603660248201527f45524332305072657365744d696e7465725061757365723a206d7573742068616044820152751d99481b5a5b9d195c881c9bdb19481d1bc81b5a5b9d60521b60648201526084016105d4565b6105e78282610e44565b61075c3382610f2f565b50565b61076a823383610b51565b6105e78282610f2f565b61079e7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a33610837565b6108105760405162461bcd60e51b815260206004820152603760248201527f45524332305072657365744d696e7465725061757365723a206d75737420686160448201527f76652070617573657220726f6c6520746f20706175736500000000000000000060648201526084016105d4565b6106b1611089565b600082815260016020526040812061083090836110c6565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60606006805461047f90611771565b6000338161087d8286610934565b9050838110156108dd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016105d4565b6105338286868403610a2d565b600033610510818585610bcb565b600081815260016020526040812061046a906110d2565b60008281526020819052604090206001015461092a81610da4565b6105638383610dd0565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b6109698282610837565b6105e7576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561099f3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610830836001600160a01b0384166110dc565b60006001600160e01b03198216637965db0b60e01b148061046a57506301ffc9a760e01b6001600160e01b031983161461046a565b6001600160a01b038316610a8f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105d4565b6001600160a01b038216610af05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105d4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000610b5d8484610934565b90506000198114610bc55781811015610bb85760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016105d4565b610bc58484848403610a2d565b50505050565b6001600160a01b038316610c2f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105d4565b6001600160a01b038216610c915760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105d4565b610c9c83838361112b565b6001600160a01b03831660009081526002602052604090205481811015610d145760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016105d4565b6001600160a01b03808516600090815260026020526040808220858503905591851681529081208054849290610d4b9084906117c1565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610d9791815260200190565b60405180910390a3610bc5565b61075c8133611136565b610db8828261095f565b600082815260016020526040902061056390826109e3565b610dda828261119a565b600082815260016020526040902061056390826111ff565b610dfa611214565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6001600160a01b038216610e9a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016105d4565b610ea66000838361112b565b8060046000828254610eb891906117c1565b90915550506001600160a01b03821660009081526002602052604081208054839290610ee59084906117c1565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b038216610f8f5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016105d4565b610f9b8260008361112b565b6001600160a01b0382166000908152600260205260409020548181101561100f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016105d4565b6001600160a01b038316600090815260026020526040812083830390556004805484929061103e9084906117d4565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3505050565b61109161125d565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610e273390565b600061083083836112a3565b600061046a825490565b60008181526001830160205260408120546111235750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561046a565b50600061046a565b6105638383836112cd565b6111408282610837565b6105e757611158816001600160a01b03166014611333565b611163836020611333565b6040516020016111749291906117e7565b60408051601f198184030181529082905262461bcd60e51b82526105d491600401611610565b6111a48282610837565b156105e7576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610830836001600160a01b0384166114cf565b60075460ff166106b15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016105d4565b60075460ff16156106b15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016105d4565b60008260000182815481106112ba576112ba61185c565b9060005260206000200154905092915050565b60075460ff16156105635760405162461bcd60e51b815260206004820152602a60248201527f45524332305061757361626c653a20746f6b656e207472616e736665722077686044820152691a5b19481c185d5cd95960b21b60648201526084016105d4565b60606000611342836002611872565b61134d9060026117c1565b67ffffffffffffffff81111561136557611365611889565b6040519080825280601f01601f19166020018201604052801561138f576020820181803683370190505b509050600360fc1b816000815181106113aa576113aa61185c565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106113d9576113d961185c565b60200101906001600160f81b031916908160001a90535060006113fd846002611872565b6114089060016117c1565b90505b6001811115611480576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061143c5761143c61185c565b1a60f81b8282815181106114525761145261185c565b60200101906001600160f81b031916908160001a90535060049490941c936114798161189f565b905061140b565b5083156108305760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d4565b600081815260018301602052604081205480156115b85760006114f36001836117d4565b8554909150600090611507906001906117d4565b905081811461156c5760008660000182815481106115275761152761185c565b906000526020600020015490508087600001848154811061154a5761154a61185c565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061157d5761157d6118b6565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061046a565b600091505061046a565b6000602082840312156115d457600080fd5b81356001600160e01b03198116811461083057600080fd5b60005b838110156116075781810151838201526020016115ef565b50506000910152565b602081526000825180602084015261162f8160408501602087016115ec565b601f01601f19169190910160400192915050565b80356001600160a01b038116811461165a57600080fd5b919050565b6000806040838503121561167257600080fd5b61167b83611643565b946020939093013593505050565b60008060006060848603121561169e57600080fd5b6116a784611643565b92506116b560208501611643565b9150604084013590509250925092565b6000602082840312156116d757600080fd5b5035919050565b600080604083850312156116f157600080fd5b8235915061170160208401611643565b90509250929050565b60006020828403121561171c57600080fd5b61083082611643565b6000806040838503121561173857600080fd5b50508035926020909101359150565b6000806040838503121561175a57600080fd5b61176383611643565b915061170160208401611643565b600181811c9082168061178557607f821691505b6020821081036117a557634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561046a5761046a6117ab565b8181038181111561046a5761046a6117ab565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161181f8160178501602088016115ec565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516118508160288401602088016115ec565b01602801949350505050565b634e487b7160e01b600052603260045260246000fd5b808202811582820484141761046a5761046a6117ab565b634e487b7160e01b600052604160045260246000fd5b6000816118ae576118ae6117ab565b506000190190565b634e487b7160e01b600052603160045260246000fdfea2646970667358221220f6070dfc0e95ca26b4f4c30364955d43a8953da748e317fa9d7a3a64368a969064736f6c63430008110033930fce5230a9f921042304dfd119e1ad0bbc7d9c38c01b0505d47cf8b65d228ca264697066735822122045a38382fc06139f8441e5b84c1b8c7471d260bd6c11511259b36df4665e912564736f6c63430008110033