FRAX Price: $0.85 (+6.00%)

Contract

0x41826e06390d06568De8672A3B7fa878C0eca7E9

Overview

FRAX Balance | FXTL Balance

0 FRAX | 1 FXTL

FRAX Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

2 Token Transfers found.

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xaf5F9E97...7ec14097f
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
PheasantNetworkSwap

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 30 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

import "solmate/src/utils/SafeTransferLib.sol";
import "solmate/src/tokens/ERC20.sol";
import { BytesLib } from "solidity-bytes-utils/contracts/BytesLib.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import { IPheasantNetworkSwapParameters } from "./IPheasantNetworkSwapParameters.sol";
import { EnumerableMap } from "../libraries/utils/EnumerableMap.sol";
import { Types } from "../libraries/types/Types.sol";

/**
 * @title PheasantNetworkSwap
 * @dev Pheasant Network Swap contract executes swap transactions and manages fees.
 */
contract PheasantNetworkSwap is Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable {
    using BytesLib for bytes;
    using EnumerableMap for EnumerableMap.Bytes32ToUintMap;

    address constant ETH_ADDRESS = address(0);

    // ========================= Struct =========================

    struct BulkWithdraw {
        address token;
        uint256 fees;
    }

    // ========================= Events =========================

    /// @dev Triggered when the contract has been initialized.
    event SwapInitialized(address owner, address params);
    /// @dev Triggered when the swap parameters contract has been updated.
    event SwapUpdateParams(address params);
    /// @dev Triggered when the native token address has been updated.
    event SwapUpdateNativeToken(address token);
    /// @dev Triggered when the swap trade has been executed.
    event SwapNewTrade(address indexed userAddress, address indexed token, Types.SwapTrade trade);
    /// @dev Triggered when the fee has been withdrawn.
    event SwapWithdrawTrade(
        address indexed userAddress,
        address indexed token,
        bytes32 tradeHash,
        uint256 amount,
        bytes data
    );
    /// @dev Triggered when the fee has been withdrawn in bulk.
    event SwapBulkWithdrawTrade(Types.SwapWithdraw[] withdraws);
    /// @dev Triggered when the fee has been refunded.
    event SwapRefundTrade(
        address indexed userAddress,
        address indexed token,
        bytes32 tradeHash,
        uint256 refunded,
        uint256 fee,
        bytes data
    );

    // ========================= Storage variables =========================

    IPheasantNetworkSwapParameters internal params;
    bool internal isActive;
    EnumerableMap.Bytes32ToUintMap private feeByTrade;

    /// @notice Returns the managed fees by the token address.
    mapping(address => uint256) public feeByToken;

    /// @notice Set native token address.
    address internal native;

    // ========================= Initialize =========================

    /// @notice Triggered when the contract has been initialized.
    /// @param params_ Contract address of the swap parameters.
    /// @param owner_ Address to be the owner of this contract.
    function initialize(address params_, address owner_) public initializer {
        _transferOwnership(owner_);
        __ReentrancyGuard_init();

        params = IPheasantNetworkSwapParameters(params_);
        isActive = true;

        emit SwapInitialized(owner_, params_);
    }

    // ========================= Modifiers =========================

    /// @notice Requires the contract to be active.
    modifier onlyActiveContract() {
        require(isActive, "PheasantNetworkSwap: Contract is not active");
        _;
    }

    /// @notice Refunds excess native tokens to the receiver.
    /// @param refundReceiver Address to receive the refund.
    /// @param token Relayer Fee collection token in order to exclude RelayerFee from the refund amount.
    modifier refundExcessNative(address payable refundReceiver, address token) {
        uint256 initialFee = feeByToken[token];
        uint256 initialBalance = address(this).balance - msg.value;
        _;
        uint256 finalFee = feeByToken[token];
        uint256 finalBalance = 0;
        if (token != ETH_ADDRESS && token != native) {
            finalBalance = address(this).balance;
        } else {
            finalBalance = address(this).balance - (finalFee - initialFee);
        }

        if (finalBalance > initialBalance) {
            SafeTransferLib.safeTransferETH(refundReceiver, finalBalance - initialBalance);
        }
    }

    // ========================= Functions =========================

    /// @notice Toggles the contract's active state.
    /// Allows the contract owner to deactivate the contract when a critical issue is discovered.
    /// or when updating the contract.
    /// @dev Can only be called by the current owner.
    function toggleContractActive() external onlyOwner {
        isActive = !isActive;
    }

    /// @notice Checks if the contract is active.
    /// @return True if the contract is active, otherwise false.
    function getContractStatus() external view returns (bool) {
        return isActive;
    }

    /// @notice Updates the swap parameters contract address.
    /// @dev Can only be called by the current owner.
    function updateParams(IPheasantNetworkSwapParameters newParams) external onlyOwner {
        params = newParams;
        emit SwapUpdateParams(address(params));
    }

    /// @notice Updates the native token address.
    /// @dev Can only be called by the current owner.
    function updateNative(address token) external onlyOwner {
        native = token;
        emit SwapUpdateNativeToken(native);
    }

    /// @notice Executes Swap by calling the DEX Protocol based on the quoted request.
    /// @param request Transaction request made based on the quoted request.
    function execute(
        Types.TransactionRequest calldata request
    ) external payable onlyActiveContract nonReentrant refundExcessNative(payable(msg.sender), request.fromToken) {
        // Validate that router and selector are allowed
        require(params.isAllowed(request.toolContract), "PheasantNetworkSwap: Tool contract not allowed");

        uint256 value = request.value;
        uint256 relayerFee = params.getRelayerFee(request.amount, request.quoteTimestamp);
        feeByToken[request.fromToken] += relayerFee;

        Types.SwapTrade memory trade = Types.SwapTrade(
            request.toChainId,
            request.swapToolIndex,
            request.toolContract,
            request.toToken,
            request.amount,
            relayerFee,
            block.timestamp
        );
        bytes32 tradeKey = generateKey(msg.sender, request.fromToken, keccak256(abi.encode(trade)));
        require(!feeByTrade.contains(tradeKey), "PheasantNetworkSwap: Same trade already exists");

        if (request.fromToken != ETH_ADDRESS) {
            SafeTransferLib.safeTransferFrom(ERC20(request.fromToken), msg.sender, address(this), request.amount);

            // Reset approval to 0 first
            SafeTransferLib.safeApprove(ERC20(request.fromToken), request.toolContract, 0);
            // Set approval to only the required amount
            SafeTransferLib.safeApprove(ERC20(request.fromToken), request.toolContract, request.amount - relayerFee);
        } else {
            require(msg.value == request.value, "PheasantNetworkSwap: Invalid value sent");
            value = request.value - relayerFee;
        }

        // slither-disable-next-line low-level-calls,return-bomb
        (bool success, bytes memory res) = request.toolContract.call{ gas: request.gas, value: value }(request.data);
        if (!success) {
            if (res.length > 4) {
                string memory errorMessage = abi.decode(res.slice(4, res.length - 4), (string));
                revert(errorMessage);
            } else {
                revert("Low-level call failed without revert message");
            }
        }

        // Reset approval to 0 after the call
        if (request.fromToken != ETH_ADDRESS) {
            SafeTransferLib.safeApprove(ERC20(request.fromToken), request.toolContract, 0);
        }

        // Already checked the key absence
        // slither-disable-next-line unused-return
        feeByTrade.set(tradeKey, relayerFee);

        emit SwapNewTrade(msg.sender, request.fromToken, trade);
    }

    /// @notice Withdraws RelayerFee obtained after swap succeeded.
    /// @param request Swap trade information for Withdraw.
    /// @dev Can only be called by the current owner.
    function withdraw(Types.SwapWithdrawRequest calldata request) public payable onlyOwner {
        uint256 fee = _withdraw(request.userAddress, request.token, request.tradeHash);
        tokenTransfer(request.token, owner(), fee);
        emit SwapWithdrawTrade(request.userAddress, request.token, request.tradeHash, fee, request.data);
    }

    /// @notice Withdraws RelayerFee in bulk obtained after swap succeeded.
    /// @param requests Array of Swap trade information for Withdraw.
    /// @dev Can only be called by the current owner.
    function bulkWithdraw(Types.SwapWithdrawRequest[] calldata requests) external payable onlyOwner {
        uint256 length = requests.length;
        require(length <= params.getMaxBulkWithdrawLength(), "PheasantNetworkSwap: Requests length too large");

        Types.SwapWithdraw[] memory withdraws = new Types.SwapWithdraw[](length);

        uint256 firstFee = _withdraw(requests[0].userAddress, requests[0].token, requests[0].tradeHash);
        BulkWithdraw memory _bulkWithdraw = BulkWithdraw(requests[0].token, firstFee);
        withdraws[0] = Types.SwapWithdraw(
            requests[0].data,
            requests[0].tradeHash,
            requests[0].userAddress,
            requests[0].token,
            firstFee
        );

        for (uint256 i = 1; i < length; i++) {
            Types.SwapWithdrawRequest calldata request = requests[i];

            uint256 fee = _withdraw(request.userAddress, request.token, request.tradeHash);

            withdraws[i] = Types.SwapWithdraw(request.data, request.tradeHash, request.userAddress, request.token, fee);

            if (_bulkWithdraw.token != request.token) {
                tokenTransfer(_bulkWithdraw.token, owner(), _bulkWithdraw.fees);
                _bulkWithdraw = BulkWithdraw(request.token, fee);
            } else {
                _bulkWithdraw.fees += fee;
            }
        }

        // Transfer last bulk
        tokenTransfer(_bulkWithdraw.token, owner(), _bulkWithdraw.fees);

        emit SwapBulkWithdrawTrade(withdraws);
    }

    /// @notice Refunds RelayerFee to user on Swap failure.
    /// @param userAddress Address of the user who executed the execute.
    /// @param token Token address of the Swap source.
    /// @param tradeHash Keccak256 hash of SwapTrade.
    /// @param data Swap trade result data to be recorded in the event.
    /// @dev Can only be called by the current owner.
    function refund(
        address userAddress,
        address token,
        bytes32 tradeHash,
        bytes calldata data
    ) public payable onlyOwner {
        uint256 fee = _withdraw(userAddress, token, tradeHash);
        uint256 refundFee = params.getRefundFee(fee);
        uint256 refundToUser = fee - refundFee;
        tokenTransfer(token, userAddress, refundToUser);
        tokenTransfer(token, owner(), refundFee);
        emit SwapRefundTrade(userAddress, token, tradeHash, refundToUser, refundFee, data);
    }

    /// @notice Checks if the trade key is managed by the contract.
    /// @param tradeKey Keccak256 hash of user's trade.
    /// @return Returns true if the trade key is managed by the contract, otherwise returns false.
    function hasTrade(bytes32 tradeKey) external view returns (bool) {
        return feeByTrade.contains(tradeKey);
    }

    // Able to receive ether
    receive() external payable {}

    // ========================= Internal functions =========================

    /// @notice Gets RelayerFee of the key if it is a valid key and removes the key that was managed.
    /// @param userAddress Address of the user who executed the execute.
    /// @param token Token address of the Swap source.
    /// @param tradeHash Keccak256 hash of SwapTrade.
    /// @return Returns RelayerFee of the user's trade.
    function _withdraw(address userAddress, address token, bytes32 tradeHash) internal returns (uint256) {
        bytes32 key = generateKey(userAddress, token, tradeHash);
        (bool keyExists, uint256 fee) = feeByTrade.tryGet(key);
        require(keyExists, "PheasantNetworkSwap: Trade is not exists");

        feeByToken[token] -= fee;

        // Already checked the key absence
        // slither-disable-next-line unused-return
        feeByTrade.remove(key);

        return fee;
    }

    /// @notice Generates the trade key.
    /// @param userAddress Address of the user who executed the execute.
    /// @param token Token address of the Swap source.
    /// @param tradeHash Keccak256 hash of SwapTrade.
    function generateKey(address userAddress, address token, bytes32 tradeHash) internal pure returns (bytes32) {
        return keccak256(abi.encode(userAddress, token, tradeHash));
    }

    /// @notice Transfers native token if token is zero address, otherwise transfers ERC20 token.
    /// @param token Token address of the Swap source.
    /// @param to Address to which the tokens will be sent.
    /// @param amount Amount to be sent.
    function tokenTransfer(address token, address to, uint256 amount) internal {
        if (token == ETH_ADDRESS) {
            SafeTransferLib.safeTransferETH(to, amount);
        } else {
            SafeTransferLib.safeTransfer(ERC20(token), to, amount);
        }
    }
}

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

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

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

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

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

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

File 3 of 13 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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

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

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

    uint256 private _status;

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

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

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

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

        _;

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @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) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

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

        return result;
    }

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

File 8 of 13 : Types.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

/**
 * @title Types
 */

library Types {
    /***********
     * Structs *
     ***********/

    struct TradeParam {
        uint256 tradeThreshold;
        uint256 tradeMinimumAmount;
        uint256 networkCode;
        uint256 tradableBondRatio;
        uint256 disputeDepositAmount;
    }

    struct UserTrade {
        address userAddress;
        uint256 index;
    }

    struct Trade {
        uint256 index;
        address user;
        uint8 tokenTypeIndex;
        uint256 amount;
        uint256 timestamp;
        address to;
        address relayer;
        uint8 status;
        uint256 fee;
        uint256 destCode;
    }

    struct UserCCTPTrade {
        address userAddress;
        uint256 index;
    }

    struct CCTPTrade {
        uint256 index;
        address user;
        uint256 amount;
        uint256 timestamp;
        bytes32 to;
        uint8 status;
        uint256 fee;
        uint32 destinationDomain;
    }

    struct CctpFeeUpdate {
        uint64 executeAfter;
        uint256 newFee;
    }

    struct Evidence {
        uint256 blockNumber;
        bytes32 blockHash;
        bytes[] txReceiptProof;
        bytes[] txProof;
        bytes transaction;
        uint8[] path;
        bytes txReceipt;
        bytes[] rawTx;
        bytes[] rawBlockHeader;
        uint8 txType;
    }

    struct Dispute {
        address disputer;
        uint8 tokenTypeIndex;
        uint256 deposit;
        uint256 disputedTimestamp;
    }

    struct FeeList {
        uint256 high;
        uint256 medium;
        uint256 low;
        uint256 gasPriceThresholdHigh;
        uint256 gasPriceThresholdLow;
    }

    struct FeeListUpdate {
        uint64 executeAfter;
        uint256 networkCode;
        uint8 tokenTypeIndex;
        FeeList newFeeList;
    }

    struct TradeParamUpdate {
        uint64 executeAfter;
        uint8 operation;
        uint256 networkCode;
        uint8 tokenTypeIndex;
        uint256 newValue;
    }

    struct TokenAddressUpdate {
        uint64 executeAfter;
        uint256[] networkCodes;
        uint8[] tokenTypeIndices;
        address[] tokenAddresses;
    }

    struct ManagerUpdate {
        uint64 executeAfter;
        uint8 operation;
        address newManager;
    }

    struct NetworkSettingUpdate {
        uint64 executeAfter;
        uint8[] operations;
        uint256[] networkCodes;
        uint8[] tokenTypeIndices;
        bool[] nativeIsNotETH;
    }

    /// @param data Data of the quoted request.
    /// @param toChainId Chain ID of the Swap destination.
    /// @param swapToolIndex DEX Protocol index (for administrative use).
    /// @param toolContract To address of the quoted request (DEX Protocol contract address).
    /// @param fromToken Token address of the Swap source.
    /// @param toToken Token address of the Swap destination.
    /// @param amount Amount of the Swap source.
    /// @param value Value of the quoted request.
    /// @param gas Gas of the quoted request.
    /// @param quoteTimestamp Timestamp of quote execution for RelayerFee determination.
    struct TransactionRequest {
        bytes data;
        string toChainId;
        uint16 swapToolIndex;
        address toolContract;
        address fromToken;
        address toToken;
        uint256 amount;
        uint256 value;
        uint256 gas;
        uint256 quoteTimestamp;
    }

    /// @param data Swap trade result data to be recorded in the event.
    /// @param tradeHash keccak256 hash of SwapTrade.
    /// @param userAddress Address of the user who executed the execute.
    /// @param token Token address of the Swap source.
    struct SwapWithdrawRequest {
        bytes data;
        bytes32 tradeHash;
        address userAddress;
        address token;
    }

    /// @param toChainId Chain ID of the Swap destination.
    /// @param swapToolIndex DEX Protocol index (for administrative use).
    /// @param toolContract To address of the quoted request (DEX Protocol contract address).
    /// @param toToken Token address of the Swap destination.
    /// @param amount Amount of the Swap source.
    /// @param relayerFee RelayerFee calculated from the amount.
    /// @param quoteTimestamp Timestamp of quote execution for RelayerFee determination.
    struct SwapTrade {
        string toChainId;
        uint16 swapToolIndex;
        address toolContract;
        address toToken;
        uint256 amount;
        uint256 relayerFee;
        uint256 timestamp;
    }

    /// @param data Swap trade result data to be recorded in the event.
    /// @param tradeHash keccak256 hash of SwapTrade.
    /// @param userAddress Address of the user who executed the execute.
    /// @param token Token address of the Swap source.
    /// @param amount Amount of RelayerFee.
    struct SwapWithdraw {
        bytes data;
        bytes32 tradeHash;
        address userAddress;
        address token;
        uint256 amount;
    }
}

// SPDX-License-Identifier: MIT
// NOTE: This file is used in part from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v5.1.0/contracts/utils/structs/EnumerableMap.sol
pragma solidity 0.8.18;

import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // To implement this library for multiple types with as little code repetition as possible, we write it in
    // terms of a generic Map type with bytes32 keys and values. The Map implementation uses private functions,
    // and user-facing implementations such as `UintToAddressMap` are just wrappers around the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit in bytes32.

    /**
     * @dev Query for a nonexistent map key.
     */
    error EnumerableMapNonexistentKey(bytes32 key);

    struct Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
        return map._keys.length();
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool exists, bytes32 value) {
        bytes32 val = map._values[key];
        if (val == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, val);
        }
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        if (value == 0 && !contains(map, key)) {
            revert EnumerableMapNonexistentKey(key);
        }
        return value;
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {
        return map._keys.values();
    }

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
        return set(map._inner, key, bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

    /**
     * @dev Returns the element stored at position `index` in the map. 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(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32 key, uint256 value) {
        (bytes32 atKey, bytes32 val) = at(map._inner, index);
        return (atKey, uint256(val));
    }

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool exists, uint256 value) {
        (bool success, bytes32 val) = tryGet(map._inner, key);
        return (success, uint256(val));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
        return uint256(get(map._inner, key));
    }

    /**
     * @dev Return the an array containing all the keys
     *
     * 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 map grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {
        bytes32[] memory store = keys(map._inner);
        bytes32[] memory result;

        // slither-disable-next-line assembly
        assembly ("memory-safe") {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.18;

interface IPheasantNetworkSwapParameters {
    function relayerAddress() external view returns (address);
    function getRelayerFee(uint256 amount) external view returns (uint256);
    function getRelayerFee(uint256 amount, uint256 timestamp) external view returns (uint256);
    function getRefundFee(uint256 amount) external view returns (uint256);
    function getMaxBulkWithdrawLength() external view returns (uint256);
    function isAllowed(address router) external view returns (bool);
}

// SPDX-License-Identifier: Unlicense
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity >=0.8.0 <0.9.0;


library BytesLib {
    function concat(
        bytes memory _preBytes,
        bytes memory _postBytes
    )
        internal
        pure
        returns (bytes memory)
    {
        bytes memory tempBytes;

        assembly {
            // Get a location of some free memory and store it in tempBytes as
            // Solidity does for memory variables.
            tempBytes := mload(0x40)

            // Store the length of the first bytes array at the beginning of
            // the memory for tempBytes.
            let length := mload(_preBytes)
            mstore(tempBytes, length)

            // Maintain a memory counter for the current write location in the
            // temp bytes array by adding the 32 bytes for the array length to
            // the starting location.
            let mc := add(tempBytes, 0x20)
            // Stop copying when the memory counter reaches the length of the
            // first bytes array.
            let end := add(mc, length)

            for {
                // Initialize a copy counter to the start of the _preBytes data,
                // 32 bytes into its memory.
                let cc := add(_preBytes, 0x20)
            } lt(mc, end) {
                // Increase both counters by 32 bytes each iteration.
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                // Write the _preBytes data into the tempBytes memory 32 bytes
                // at a time.
                mstore(mc, mload(cc))
            }

            // Add the length of _postBytes to the current length of tempBytes
            // and store it as the new length in the first 32 bytes of the
            // tempBytes memory.
            length := mload(_postBytes)
            mstore(tempBytes, add(length, mload(tempBytes)))

            // Move the memory counter back from a multiple of 0x20 to the
            // actual end of the _preBytes data.
            mc := end
            // Stop copying when the memory counter reaches the new combined
            // length of the arrays.
            end := add(mc, length)

            for {
                let cc := add(_postBytes, 0x20)
            } lt(mc, end) {
                mc := add(mc, 0x20)
                cc := add(cc, 0x20)
            } {
                mstore(mc, mload(cc))
            }

            // Update the free-memory pointer by padding our last write location
            // to 32 bytes: add 31 bytes to the end of tempBytes to move to the
            // next 32 byte block, then round down to the nearest multiple of
            // 32. If the sum of the length of the two arrays is zero then add
            // one before rounding down to leave a blank 32 bytes (the length block with 0).
            mstore(0x40, and(
              add(add(end, iszero(add(length, mload(_preBytes)))), 31),
              not(31) // Round down to the nearest 32 bytes.
            ))
        }

        return tempBytes;
    }

    function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
        assembly {
            // Read the first 32 bytes of _preBytes storage, which is the length
            // of the array. (We don't need to use the offset into the slot
            // because arrays use the entire slot.)
            let fslot := sload(_preBytes.slot)
            // Arrays of 31 bytes or less have an even value in their slot,
            // while longer arrays have an odd value. The actual length is
            // the slot divided by two for odd values, and the lowest order
            // byte divided by two for even values.
            // If the slot is even, bitwise and the slot with 255 and divide by
            // two to get the length. If the slot is odd, bitwise and the slot
            // with -1 and divide by two.
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)
            let newlength := add(slength, mlength)
            // slength can contain both the length and contents of the array
            // if length < 32 bytes so let's prepare for that
            // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
            switch add(lt(slength, 32), lt(newlength, 32))
            case 2 {
                // Since the new array still fits in the slot, we just need to
                // update the contents of the slot.
                // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
                sstore(
                    _preBytes.slot,
                    // all the modifications to the slot are inside this
                    // next block
                    add(
                        // we can just add to the slot contents because the
                        // bytes we want to change are the LSBs
                        fslot,
                        add(
                            mul(
                                div(
                                    // load the bytes from memory
                                    mload(add(_postBytes, 0x20)),
                                    // zero all bytes to the right
                                    exp(0x100, sub(32, mlength))
                                ),
                                // and now shift left the number of bytes to
                                // leave space for the length in the slot
                                exp(0x100, sub(32, newlength))
                            ),
                            // increase length by the double of the memory
                            // bytes length
                            mul(mlength, 2)
                        )
                    )
                )
            }
            case 1 {
                // The stored value fits in the slot, but the combined value
                // will exceed it.
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // The contents of the _postBytes array start 32 bytes into
                // the structure. Our first read should obtain the `submod`
                // bytes that can fit into the unused space in the last word
                // of the stored array. To get this, we read 32 bytes starting
                // from `submod`, so the data we read overlaps with the array
                // contents by `submod` bytes. Masking the lowest-order
                // `submod` bytes allows us to add that value directly to the
                // stored value.

                let submod := sub(32, slength)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(
                    sc,
                    add(
                        and(
                            fslot,
                            0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00
                        ),
                        and(mload(mc), mask)
                    )
                )

                for {
                    mc := add(mc, 0x20)
                    sc := add(sc, 1)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
            default {
                // get the keccak hash to get the contents of the array
                mstore(0x0, _preBytes.slot)
                // Start copying to the last used word of the stored array.
                let sc := add(keccak256(0x0, 0x20), div(slength, 32))

                // save new length
                sstore(_preBytes.slot, add(mul(newlength, 2), 1))

                // Copy over the first `submod` bytes of the new data as in
                // case 1 above.
                let slengthmod := mod(slength, 32)
                let mlengthmod := mod(mlength, 32)
                let submod := sub(32, slengthmod)
                let mc := add(_postBytes, submod)
                let end := add(_postBytes, mlength)
                let mask := sub(exp(0x100, submod), 1)

                sstore(sc, add(sload(sc), and(mload(mc), mask)))

                for {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } lt(mc, end) {
                    sc := add(sc, 1)
                    mc := add(mc, 0x20)
                } {
                    sstore(sc, mload(mc))
                }

                mask := exp(0x100, sub(mc, end))

                sstore(sc, mul(div(mload(mc), mask), mask))
            }
        }
    }

    function slice(
        bytes memory _bytes,
        uint256 _start,
        uint256 _length
    )
        internal
        pure
        returns (bytes memory)
    {
        require(_length + 31 >= _length, "slice_overflow");
        require(_bytes.length >= _start + _length, "slice_outOfBounds");

        bytes memory tempBytes;

        assembly {
            switch iszero(_length)
            case 0 {
                // Get a location of some free memory and store it in tempBytes as
                // Solidity does for memory variables.
                tempBytes := mload(0x40)

                // The first word of the slice result is potentially a partial
                // word read from the original array. To read it, we calculate
                // the length of that partial word and start copying that many
                // bytes into the array. The first word we copy will start with
                // data we don't care about, but the last `lengthmod` bytes will
                // land at the beginning of the contents of the new array. When
                // we're done copying, we overwrite the full first word with
                // the actual length of the slice.
                let lengthmod := and(_length, 31)

                // The multiplication in the next line is necessary
                // because when slicing multiples of 32 bytes (lengthmod == 0)
                // the following copy loop was copying the origin's length
                // and then ending prematurely not copying everything it should.
                let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
                let end := add(mc, _length)

                for {
                    // The multiplication in the next line has the same exact purpose
                    // as the one above.
                    let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
                } lt(mc, end) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    mstore(mc, mload(cc))
                }

                mstore(tempBytes, _length)

                //update free-memory pointer
                //allocating the array padded to 32 bytes like the compiler does now
                mstore(0x40, and(add(mc, 31), not(31)))
            }
            //if we want a zero-length slice let's just return a zero-length array
            default {
                tempBytes := mload(0x40)
                //zero out the 32 bytes slice we are about to return
                //we need to do it because Solidity does not garbage collect
                mstore(tempBytes, 0)

                mstore(0x40, add(tempBytes, 0x20))
            }
        }

        return tempBytes;
    }

    function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
        require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
        address tempAddress;

        assembly {
            tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
        }

        return tempAddress;
    }

    function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
        require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
        uint8 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x1), _start))
        }

        return tempUint;
    }

    function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
        require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
        uint16 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x2), _start))
        }

        return tempUint;
    }

    function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
        require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
        uint32 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x4), _start))
        }

        return tempUint;
    }

    function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
        require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
        uint64 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x8), _start))
        }

        return tempUint;
    }

    function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
        require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
        uint96 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0xc), _start))
        }

        return tempUint;
    }

    function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
        require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
        uint128 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x10), _start))
        }

        return tempUint;
    }

    function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
        require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
        uint256 tempUint;

        assembly {
            tempUint := mload(add(add(_bytes, 0x20), _start))
        }

        return tempUint;
    }

    function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
        require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
        bytes32 tempBytes32;

        assembly {
            tempBytes32 := mload(add(add(_bytes, 0x20), _start))
        }

        return tempBytes32;
    }

    function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let mc := add(_preBytes, 0x20)
                let end := add(mc, length)

                for {
                    let cc := add(_postBytes, 0x20)
                // the next line is the loop condition:
                // while(uint256(mc < end) + cb == 2)
                } eq(add(lt(mc, end), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equal_nonAligned(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
        bool success = true;

        assembly {
            let length := mload(_preBytes)

            // if lengths don't match the arrays are not equal
            switch eq(length, mload(_postBytes))
            case 1 {
                // cb is a circuit breaker in the for loop since there's
                //  no said feature for inline assembly loops
                // cb = 1 - don't breaker
                // cb = 0 - break
                let cb := 1

                let endMinusWord := add(_preBytes, length)
                let mc := add(_preBytes, 0x20)
                let cc := add(_postBytes, 0x20)

                for {
                // the next line is the loop condition:
                // while(uint256(mc < endWord) + cb == 2)
                } eq(add(lt(mc, endMinusWord), cb), 2) {
                    mc := add(mc, 0x20)
                    cc := add(cc, 0x20)
                } {
                    // if any of these checks fails then arrays are not equal
                    if iszero(eq(mload(mc), mload(cc))) {
                        // unsuccess:
                        success := 0
                        cb := 0
                    }
                }

                // Only if still successful
                // For <1 word tail bytes
                if gt(success, 0) {
                    // Get the remainder of length/32
                    // length % 32 = AND(length, 32 - 1)
                    let numTailBytes := and(length, 0x1f)
                    let mcRem := mload(mc)
                    let ccRem := mload(cc)
                    for {
                        let i := 0
                    // the next line is the loop condition:
                    // while(uint256(i < numTailBytes) + cb == 2)
                    } eq(add(lt(i, numTailBytes), cb), 2) {
                        i := add(i, 1)
                    } {
                        if iszero(eq(byte(i, mcRem), byte(i, ccRem))) {
                            // unsuccess:
                            success := 0
                            cb := 0
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }

    function equalStorage(
        bytes storage _preBytes,
        bytes memory _postBytes
    )
        internal
        view
        returns (bool)
    {
        bool success = true;

        assembly {
            // we know _preBytes_offset is 0
            let fslot := sload(_preBytes.slot)
            // Decode the length of the stored array like in concatStorage().
            let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
            let mlength := mload(_postBytes)

            // if lengths don't match the arrays are not equal
            switch eq(slength, mlength)
            case 1 {
                // slength can contain both the length and contents of the array
                // if length < 32 bytes so let's prepare for that
                // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
                if iszero(iszero(slength)) {
                    switch lt(slength, 32)
                    case 1 {
                        // blank the last byte which is the length
                        fslot := mul(div(fslot, 0x100), 0x100)

                        if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
                            // unsuccess:
                            success := 0
                        }
                    }
                    default {
                        // cb is a circuit breaker in the for loop since there's
                        //  no said feature for inline assembly loops
                        // cb = 1 - don't breaker
                        // cb = 0 - break
                        let cb := 1

                        // get the keccak hash to get the contents of the array
                        mstore(0x0, _preBytes.slot)
                        let sc := keccak256(0x0, 0x20)

                        let mc := add(_postBytes, 0x20)
                        let end := add(mc, mlength)

                        // the next line is the loop condition:
                        // while(uint256(mc < end) + cb == 2)
                        for {} eq(add(lt(mc, end), cb), 2) {
                            sc := add(sc, 1)
                            mc := add(mc, 0x20)
                        } {
                            if iszero(eq(sload(sc), mload(mc))) {
                                // unsuccess:
                                success := 0
                                cb := 0
                            }
                        }
                    }
                }
            }
            default {
                // unsuccess:
                success := 0
            }
        }

        return success;
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument.
            mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
            success := call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)

            // Set success to whether the call reverted, if not we check it either
            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
                success := iszero(or(iszero(extcodesize(token)), returndatasize())) 
            }
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
            success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)

            // Set success to whether the call reverted, if not we check it either
            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
                success := iszero(or(iszero(extcodesize(token)), returndatasize())) 
            }
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
            success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)

            // Set success to whether the call reverted, if not we check it either
            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
                success := iszero(or(iszero(extcodesize(token)), returndatasize())) 
            }
        }

        require(success, "APPROVE_FAILED");
    }
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 30,
    "details": {
      "yul": true
    }
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"tradeHash","type":"bytes32"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct Types.SwapWithdraw[]","name":"withdraws","type":"tuple[]"}],"name":"SwapBulkWithdrawTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"params","type":"address"}],"name":"SwapInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"components":[{"internalType":"string","name":"toChainId","type":"string"},{"internalType":"uint16","name":"swapToolIndex","type":"uint16"},{"internalType":"address","name":"toolContract","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"timestamp","type":"uint256"}],"indexed":false,"internalType":"struct Types.SwapTrade","name":"trade","type":"tuple"}],"name":"SwapNewTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes32","name":"tradeHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"refunded","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"SwapRefundTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"SwapUpdateNativeToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"params","type":"address"}],"name":"SwapUpdateParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes32","name":"tradeHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"SwapWithdrawTrade","type":"event"},{"inputs":[{"components":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"tradeHash","type":"bytes32"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"token","type":"address"}],"internalType":"struct Types.SwapWithdrawRequest[]","name":"requests","type":"tuple[]"}],"name":"bulkWithdraw","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"string","name":"toChainId","type":"string"},{"internalType":"uint16","name":"swapToolIndex","type":"uint16"},{"internalType":"address","name":"toolContract","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"gas","type":"uint256"},{"internalType":"uint256","name":"quoteTimestamp","type":"uint256"}],"internalType":"struct Types.TransactionRequest","name":"request","type":"tuple"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeByToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"tradeKey","type":"bytes32"}],"name":"hasTrade","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"params_","type":"address"},{"internalType":"address","name":"owner_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bytes32","name":"tradeHash","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"refund","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleContractActive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"updateNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IPheasantNetworkSwapParameters","name":"newParams","type":"address"}],"name":"updateParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"tradeHash","type":"bytes32"},{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"address","name":"token","type":"address"}],"internalType":"struct Types.SwapWithdrawRequest","name":"request","type":"tuple"}],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

0x6080806040523461001657611f71908161001c8239f35b600080fdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806301c270c3146100fb57806307fe2e54146100f65780631385d24c146100f1578063485cc955146100ec5780636a372984146100e7578063715018a6146100e25780638da5cb5b146100dd5780639e84b6b5146100d8578063c032846b146100d3578063c35925e9146100ce578063d3139c17146100c9578063e37ba9b2146100c4578063ec150413146100bf5763f2fde38b0361000e57610bd8565b610ba2565b610abb565b610a4b565b610909565b6108e3565b6108a6565b610863565b610802565b610661565b610564565b610528565b6104b8565b6020806003193601126104a2576004356001600160401b03918282116104a257366023830112156104a25781600401359283116104a2576024820191602436918560051b0101116104a25761014e610c69565b60975461016b906001600160a01b03165b6001600160a01b031690565b926004826040958651928380926321b3209160e01b82525afa801561049d576101a191600091610470575b508294921115611783565b6101aa836117fd565b926101bf856101b9838561187f565b01610e4f565b916101e76060936101d4856101b9868661187f565b866101df868661187f565b0135916119ad565b6101f5846101b9858561187f565b61020f610200610fcf565b6001600160a01b039092168252565b81868201529361029261022b610225868661187f565b80610f8e565b91906102838961023b898961187f565b013561024b8d6101b98b8b61187f565b9061026e61025d886101b98d8d61187f565b94610266610fee565b973691611047565b86528b8601526001600160a01b03168c850152565b6001600160a01b031682840152565b608092838201526102a2886118bc565b526102ac876118bc565b506001935b80851061031b577f504c6b1ba9ab27e29ac0d69892254dd109829b156e18b746c56433be5b04e178610316898b61030c8b8b6102f3815160018060a01b031690565b6033549092906001600160a01b03165b91015191611bc2565b51918291826118ec565b0390a1005b90919293948861032c87848861189a565b916103736103b68385016103a78c61034383610e4f565b968a89019761036b6103646103578b610e4f565b92858d01359384916119ad565b9a80610f8e565b979095610e4f565b926103916103808b610e4f565b96610389610fee565b993691611047565b88528701526001600160a01b0390911690850152565b6001600160a01b031682880152565b83878201526103c5898c6118c9565b526103d0888b6118c9565b5080516001600160a01b03166103e861015f84610e4f565b6001600160a01b039091161461045457805160335461044b9493610426939092610421926001600160a01b0391821692918e9116610303565b610e4f565b90610441610432610fcf565b6001600160a01b039093168352565b88820152956118dd565b939291906102b1565b96905061044b91610469898901918251610f81565b90526118dd565b6104909150843d8611610496575b6104888183610ea9565b810190610f56565b38610196565b503d61047e565b610ee7565b600080fd5b6001600160a01b038116036104a257565b346104a25760203660031901126104a2577fe2e42d7ae303ebbcb22266a6ebb41d9c9678628cd17a59589f3885d68eb2cd8360206004356104f8816104a7565b610500610c69565b609780546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b346104a25760003660031901126104a257610541610c69565b6097805460ff60a01b19811660a091821c60ff161590911b60ff60a01b16179055005b346104a25760403660031901126104a257600435610581816104a7565b6105d1602435610590816104a7565b600054926105b560ff8560081c161580958196610653575b8115610633575b50610d0a565b836105c8600160ff196000541617600055565b61061a57610d6d565b6105d757005b6105e761ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498908060208101610316565b61062e61010061ff00196000541617600055565b610d6d565b303b15915081610645575b50386105af565b6001915060ff16143861063e565b600160ff82161091506105a8565b6003196020368201126104a257600435906001600160401b0382116104a2576101409082360301126104a25760ff60975460a01c16156107a9576002606554146107645760026065556106b660848201610e4f565b6106bf8161088c565b54906106d76106ce3447610e86565b93600401611298565b6106e08161088c565b54906001600160a01b03168015159081610744575b501561072b575050475b818111610711575b6100196001606555565b6107249161071e91610e86565b33611d71565b3880610707565b61073961073f924792610e86565b90610e86565b6106ff565b609c5490915061075c906001600160a01b031661015f565b1415386106f5565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152602b60248201527f5068656173616e744e6574776f726b537761703a20436f6e747261637420697360448201526a206e6f742061637469766560a81b6064820152608490fd5b346104a2576000806003193601126108605761081c610c69565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b346104a25760003660031901126104a2576033546040516001600160a01b039091168152602090f35b6001600160a01b03166000908152609b6020526040902090565b346104a25760203660031901126104a2576004356108c3816104a7565b60018060a01b0316600052609b6020526020604060002054604051908152f35b346104a25760003660031901126104a257602060ff60975460a01c166040519015158152f35b60803660031901126104a257600435610921816104a7565b60243561092d816104a7565b604435606435916001600160401b03908184116104a257366023850112156104a25783600401359182116104a25736602483860101116104a25761096f610c69565b61097a8382876119ad565b609754604051632b383fc560e11b81526004810183905291946001600160a01b0394916020908490602490829089165afa801561049d577fa6cb6e08ad908f9d671a8ebbc0e7146756b08daf9d414bb21dbc891388f0000096610a2294600092610a27575b50816109ea91610e86565b6109f5818b88611bc2565b603354610a0d9083906001600160a01b031688611bc2565b602487604051988998169b169901928661198a565b0390a3005b6109ea919250610a449060203d8111610496576104888183610ea9565b91906109df565b346104a25760203660031901126104a2577f962b9b0a40093afe893ab82fb20c5650da4cbae48c7542c402d3251e261a9a3c6020600435610a8b816104a7565b610a93610c69565b609c80546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b6003196020368201126104a257600435906001600160401b0382116104a2576080826004019183360301126104a2577ffa2c40d0588b37c491b80ca87173fc8d840eb485adec24c45ee23d4289bfa6f4610b7d91610b17610c69565b604484013593610b26856104a7565b610a226024606483013592610b3a846104a7565b013591610b488382896119ad565b93610b52826104a7565b60018060a01b03968791610b6b87846033541686611bc2565b610b748a6104a7565b610225846104a7565b9790926040519687968752602087015260606040870152169716956060840191611762565b346104a25760203660031901126104a2576020610bce6004356000526099602052604060002054151590565b6040519015158152f35b346104a25760203660031901126104a257600435610bf5816104a7565b610bfd610c69565b6001600160a01b03811615610c155761001990610cc1565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b6033546001600160a01b03163303610c7d57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b15610d1157565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b7fff5ca8663ed3b85e7db74cfe850fb10dffe51b162b7a365e56ae32558541497691604091610d9b82610cc1565b610db560ff60005460081c16610db081610def565b610def565b6001606555609780546001600160a81b0319166001600160a01b03928316908117600160a01b1790915583519290911682526020820152a1565b15610df657565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b35610e59816104a7565b90565b634e487b7160e01b600052601160045260246000fd5b600319810191908211610e8157565b610e5c565b91908203918211610e8157565b634e487b7160e01b600052604160045260246000fd5b90601f801991011681019081106001600160401b03821117610eca57604052565b610e93565b908160209103126104a2575180151581036104a25790565b6040513d6000823e3d90fd5b15610efa57565b60405162461bcd60e51b815260206004820152602e60248201527f5068656173616e744e6574776f726b537761703a20546f6f6c20636f6e74726160448201526d18dd081b9bdd08185b1b1bddd95960921b6064820152608490fd5b908160209103126104a2575190565b90601f8201809211610e8157565b6004019081600411610e8157565b91908201809211610e8157565b903590601e19813603018212156104a257018035906001600160401b0382116104a2576020019181360383136104a257565b3561ffff811681036104a25790565b60405190604082018281106001600160401b03821117610eca57604052565b6040519060a082018281106001600160401b03821117610eca57604052565b6040519060e082018281106001600160401b03821117610eca57604052565b6001600160401b038111610eca57601f01601f191660200190565b9291926110538261102c565b916110616040519384610ea9565b8294818452818301116104a2578281602093846000960137010152565b60005b8381106110915750506000910152565b8181015183820152602001611081565b906020916110ba8151809281855285808601910161107e565b601f01601f1916010190565b6020815260e060c06110e484518360208601526101008501906110a1565b9361ffff602082015116604085015260018060a01b038060408301511660608601526060820151166080850152608081015160a085015260a081015182850152015191015290565b1561113357565b60405162461bcd60e51b815260206004820152602e60248201527f5068656173616e744e6574776f726b537761703a2053616d652074726164652060448201526d616c72656164792065786973747360901b6064820152608490fd5b1561119657565b60405162461bcd60e51b815260206004820152602760248201527f5068656173616e744e6574776f726b537761703a20496e76616c69642076616c6044820152661d59481cd95b9d60ca1b6064820152608490fd5b908092918237016000815290565b3d15611224573d9061120a8261102c565b916112186040519384610ea9565b82523d6000602084013e565b606090565b6020818303126104a2578051906001600160401b0382116104a2570181601f820112156104a257805161125b8161102c565b926112696040519485610ea9565b818452602082840101116104a257610e59916020808501910161107e565b906020610e599281815201906110a1565b6097546112ad906001600160a01b031661015f565b9060608101906112f16112bf83610e4f565b6040805163babcc53960e01b81526001600160a01b039092166004830152946020929091908390829081906024820190565b0381855afa801561049d5761130e91600091611674575b50610ef3565b8451634364dd3b60e11b815260c08401356004820181905261012085013560248301529460e08501359491928490849060449082905afa92831561049d57600093611655575b50608082019361136385610e4f565b61136c9061088c565b8481549061137991610f81565b905561138783820184610f8e565b9790611394858b01610fc0565b61139d85610e4f565b906113aa60a08801610e4f565b926113b361100d565b9b36906113bf92611047565b8b5261ffff16848b01526001600160a01b0316898b01526001600160a01b031660608901528060808901528460a08901524260c08901528561140081610e4f565b8a5184810190806114118d846110c6565b03601f19810182526114239082610ea9565b5190206114309133611b7d565b94611448866000526099602052604060002054151590565b156114529061112c565b6001600160a01b039887908a61146785610e4f565b60009687966114fc959193909216156116395750906114b16114a261015f846104218561149961015f6114d799610e4f565b30903390611dbc565b6114ab8b610e4f565b90611e5c565b6114bd61015f8d610e4f565b906114d18c6114cb8c610e4f565b92610e86565b91611eee565b8c6101006114e489610e4f565b916114ef8680610f8e565b95909151809681936111eb565b03940135f16115096111f9565b901561158d57505061155a9284926115549261154961015f7fd3c401dfdd079a8763e51394e4dbd6cdb508ae3474090c4d3aa61fe4195325039998610e4f565b61156e575b506116a1565b50610e4f565b169251806115693394826110c6565b0390a3565b611587906114ab61158161015f88610e4f565b91610e4f565b3861154e565b88925060048151116000146115e0576115dc92916115b8826115b26115c59451610e72565b90611ce6565b8051810182019101611229565b905162461bcd60e51b815291829160048301611287565b0390fd5b825162461bcd60e51b815260206004820152602c60248201527f4c6f772d6c6576656c2063616c6c206661696c656420776974686f757420726560448201526b76657274206d65737361676560a01b6064820152608490fd5b9150508161164b61165093341461118f565b610e86565b6114d7565b61166d919350843d8611610496576104888183610ea9565b9138611354565b6116949150843d861161169a575b61168c8183610ea9565b810190610ecf565b38611308565b503d611682565b610e599181600052609a6020526040600020556116ef565b634e487b7160e01b600052603260045260246000fd5b6098548110156116ea57609860005260206000200190600090565b6116b9565b60008181526099602052604081205461175d5760985490600160401b821015610eca5760018201806098558210156116ea577f2237a976fa961f5921fd19f2b03c925c725d77b20ce8f790c19709c03de4d81490910182905560985491815260996020526040902055600190565b905090565b908060209392818452848401376000828201840152601f01601f1916010190565b1561178a57565b60405162461bcd60e51b815260206004820152602e60248201527f5068656173616e744e6574776f726b537761703a205265717565737473206c6560448201526d6e67746820746f6f206c6172676560901b6064820152608490fd5b6001600160401b038111610eca5760051b60200190565b90611807826117e6565b604061181581519283610ea9565b8382528193611826601f19916117e6565b019060005b8281106118385750505050565b81519060a08201918083106001600160401b03841117610eca576020928452606080825260008491818385015281878501528301526000608083015282870101520161182b565b90156116ea57803590607e19813603018212156104a2570190565b91908110156116ea5760051b81013590607e19813603018212156104a2570190565b8051156116ea5760200190565b80518210156116ea5760209160051b010190565b6000198114610e815760010190565b602080820190808352835180925260409283810182858560051b8401019601946000925b858410611921575050505050505090565b909192939495968580600192603f198582030187528a519061194b825160a08084528301906110a1565b918381015184830152858060a01b0380898301511689840152606090818301511690830152608080910151910152990194019401929594939190611910565b9092608092610e5996948352602083015260408201528160608201520191611762565b91816119b99293611b7d565b6119c281611b4d565b929015611a095760018060a01b0316600052609b6020526040600020908154838103908111610e8157611a05925580600052609a60205260006040812055611aa1565b5090565b60405162461bcd60e51b815260206004820152602860248201527f5068656173616e744e6574776f726b537761703a205472616465206973206e6f604482015267742065786973747360c01b6064820152608490fd5b6098548015611a8b576000198181019190818310156116ea576000916098835260208320010155609855565b634e487b7160e01b600052603160045260246000fd5b6000818152609960205260409020548015611b46576000199181830191808311610e8157609854938401938411610e81578383611afc9460009603611b02575b505050611aec611a5f565b6000526099602052604060002090565b55600190565b611aec611b2491611b15611b3d946116cf565b90549060031b1c9283916116cf565b90919082549060031b91821b91600019901b1916179055565b55388080611ae1565b5050600090565b600052609a6020526040600020548015600014611b7857506099602052604060002054151590600090565b600191565b909160405191602083019360018060a01b038092168552166040830152606082015260608152608081018181106001600160401b03821117610eca5760405251902090565b6001600160a01b0390811692919083611be25750611be09250611d71565b565b906044906020936000936040519263a9059cbb60e01b8452166004830152602482015282855af19081601f3d11600160005114161516611c5c575b5015611c2557565b60405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606490fd5b3b153d1715905038611c1d565b15611c7057565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b15611cad57565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b611cfa82611cf381610f65565b1015611c69565b611d0f8151611d0884610f73565b1115611ca6565b81611d27575050604051600081526020810160405290565b60405191601f8116916004831560051b80858701019484860193010101905b808410611d5e5750508252601f01601f191660405290565b9092835181526020809101930190611d46565b600080809381935af115611d8157565b60405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606490fd5b6040516323b872dd60e01b81526001600160a01b039283166004820152929091166024830152604482019290925260209060009060649082855af19081601f3d11600160005114161516611e4f575b5015611e1357565b60405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606490fd5b3b153d1715905038611e0b565b60405163095ea7b360e01b81526001600160a01b03909216600483015260006024830181905290916020919060449082855af19081601f3d11600160005114161516611ee1575b5015611eab57565b60405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b6044820152606490fd5b3b153d1715905038611ea3565b60405163095ea7b360e01b81526001600160a01b039092166004830152602482019290925260209060009060449082855af19081601f3d11600160005114161516611ee1575015611eab5756fea26469706673582212206d218cf2d12a862ca7c4503a025cf251e3059286bc0661b10c838e590c99d2c864736f6c63430008120033

Deployed Bytecode

0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806301c270c3146100fb57806307fe2e54146100f65780631385d24c146100f1578063485cc955146100ec5780636a372984146100e7578063715018a6146100e25780638da5cb5b146100dd5780639e84b6b5146100d8578063c032846b146100d3578063c35925e9146100ce578063d3139c17146100c9578063e37ba9b2146100c4578063ec150413146100bf5763f2fde38b0361000e57610bd8565b610ba2565b610abb565b610a4b565b610909565b6108e3565b6108a6565b610863565b610802565b610661565b610564565b610528565b6104b8565b6020806003193601126104a2576004356001600160401b03918282116104a257366023830112156104a25781600401359283116104a2576024820191602436918560051b0101116104a25761014e610c69565b60975461016b906001600160a01b03165b6001600160a01b031690565b926004826040958651928380926321b3209160e01b82525afa801561049d576101a191600091610470575b508294921115611783565b6101aa836117fd565b926101bf856101b9838561187f565b01610e4f565b916101e76060936101d4856101b9868661187f565b866101df868661187f565b0135916119ad565b6101f5846101b9858561187f565b61020f610200610fcf565b6001600160a01b039092168252565b81868201529361029261022b610225868661187f565b80610f8e565b91906102838961023b898961187f565b013561024b8d6101b98b8b61187f565b9061026e61025d886101b98d8d61187f565b94610266610fee565b973691611047565b86528b8601526001600160a01b03168c850152565b6001600160a01b031682840152565b608092838201526102a2886118bc565b526102ac876118bc565b506001935b80851061031b577f504c6b1ba9ab27e29ac0d69892254dd109829b156e18b746c56433be5b04e178610316898b61030c8b8b6102f3815160018060a01b031690565b6033549092906001600160a01b03165b91015191611bc2565b51918291826118ec565b0390a1005b90919293948861032c87848861189a565b916103736103b68385016103a78c61034383610e4f565b968a89019761036b6103646103578b610e4f565b92858d01359384916119ad565b9a80610f8e565b979095610e4f565b926103916103808b610e4f565b96610389610fee565b993691611047565b88528701526001600160a01b0390911690850152565b6001600160a01b031682880152565b83878201526103c5898c6118c9565b526103d0888b6118c9565b5080516001600160a01b03166103e861015f84610e4f565b6001600160a01b039091161461045457805160335461044b9493610426939092610421926001600160a01b0391821692918e9116610303565b610e4f565b90610441610432610fcf565b6001600160a01b039093168352565b88820152956118dd565b939291906102b1565b96905061044b91610469898901918251610f81565b90526118dd565b6104909150843d8611610496575b6104888183610ea9565b810190610f56565b38610196565b503d61047e565b610ee7565b600080fd5b6001600160a01b038116036104a257565b346104a25760203660031901126104a2577fe2e42d7ae303ebbcb22266a6ebb41d9c9678628cd17a59589f3885d68eb2cd8360206004356104f8816104a7565b610500610c69565b609780546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b346104a25760003660031901126104a257610541610c69565b6097805460ff60a01b19811660a091821c60ff161590911b60ff60a01b16179055005b346104a25760403660031901126104a257600435610581816104a7565b6105d1602435610590816104a7565b600054926105b560ff8560081c161580958196610653575b8115610633575b50610d0a565b836105c8600160ff196000541617600055565b61061a57610d6d565b6105d757005b6105e761ff001960005416600055565b604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498908060208101610316565b61062e61010061ff00196000541617600055565b610d6d565b303b15915081610645575b50386105af565b6001915060ff16143861063e565b600160ff82161091506105a8565b6003196020368201126104a257600435906001600160401b0382116104a2576101409082360301126104a25760ff60975460a01c16156107a9576002606554146107645760026065556106b660848201610e4f565b6106bf8161088c565b54906106d76106ce3447610e86565b93600401611298565b6106e08161088c565b54906001600160a01b03168015159081610744575b501561072b575050475b818111610711575b6100196001606555565b6107249161071e91610e86565b33611d71565b3880610707565b61073961073f924792610e86565b90610e86565b6106ff565b609c5490915061075c906001600160a01b031661015f565b1415386106f5565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b60405162461bcd60e51b815260206004820152602b60248201527f5068656173616e744e6574776f726b537761703a20436f6e747261637420697360448201526a206e6f742061637469766560a81b6064820152608490fd5b346104a2576000806003193601126108605761081c610c69565b603380546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b346104a25760003660031901126104a2576033546040516001600160a01b039091168152602090f35b6001600160a01b03166000908152609b6020526040902090565b346104a25760203660031901126104a2576004356108c3816104a7565b60018060a01b0316600052609b6020526020604060002054604051908152f35b346104a25760003660031901126104a257602060ff60975460a01c166040519015158152f35b60803660031901126104a257600435610921816104a7565b60243561092d816104a7565b604435606435916001600160401b03908184116104a257366023850112156104a25783600401359182116104a25736602483860101116104a25761096f610c69565b61097a8382876119ad565b609754604051632b383fc560e11b81526004810183905291946001600160a01b0394916020908490602490829089165afa801561049d577fa6cb6e08ad908f9d671a8ebbc0e7146756b08daf9d414bb21dbc891388f0000096610a2294600092610a27575b50816109ea91610e86565b6109f5818b88611bc2565b603354610a0d9083906001600160a01b031688611bc2565b602487604051988998169b169901928661198a565b0390a3005b6109ea919250610a449060203d8111610496576104888183610ea9565b91906109df565b346104a25760203660031901126104a2577f962b9b0a40093afe893ab82fb20c5650da4cbae48c7542c402d3251e261a9a3c6020600435610a8b816104a7565b610a93610c69565b609c80546001600160a01b0319166001600160a01b03929092169182179055604051908152a1005b6003196020368201126104a257600435906001600160401b0382116104a2576080826004019183360301126104a2577ffa2c40d0588b37c491b80ca87173fc8d840eb485adec24c45ee23d4289bfa6f4610b7d91610b17610c69565b604484013593610b26856104a7565b610a226024606483013592610b3a846104a7565b013591610b488382896119ad565b93610b52826104a7565b60018060a01b03968791610b6b87846033541686611bc2565b610b748a6104a7565b610225846104a7565b9790926040519687968752602087015260606040870152169716956060840191611762565b346104a25760203660031901126104a2576020610bce6004356000526099602052604060002054151590565b6040519015158152f35b346104a25760203660031901126104a257600435610bf5816104a7565b610bfd610c69565b6001600160a01b03811615610c155761001990610cc1565b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b6033546001600160a01b03163303610c7d57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b603380546001600160a01b039283166001600160a01b0319821681179092559091167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b15610d1157565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b7fff5ca8663ed3b85e7db74cfe850fb10dffe51b162b7a365e56ae32558541497691604091610d9b82610cc1565b610db560ff60005460081c16610db081610def565b610def565b6001606555609780546001600160a81b0319166001600160a01b03928316908117600160a01b1790915583519290911682526020820152a1565b15610df657565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b35610e59816104a7565b90565b634e487b7160e01b600052601160045260246000fd5b600319810191908211610e8157565b610e5c565b91908203918211610e8157565b634e487b7160e01b600052604160045260246000fd5b90601f801991011681019081106001600160401b03821117610eca57604052565b610e93565b908160209103126104a2575180151581036104a25790565b6040513d6000823e3d90fd5b15610efa57565b60405162461bcd60e51b815260206004820152602e60248201527f5068656173616e744e6574776f726b537761703a20546f6f6c20636f6e74726160448201526d18dd081b9bdd08185b1b1bddd95960921b6064820152608490fd5b908160209103126104a2575190565b90601f8201809211610e8157565b6004019081600411610e8157565b91908201809211610e8157565b903590601e19813603018212156104a257018035906001600160401b0382116104a2576020019181360383136104a257565b3561ffff811681036104a25790565b60405190604082018281106001600160401b03821117610eca57604052565b6040519060a082018281106001600160401b03821117610eca57604052565b6040519060e082018281106001600160401b03821117610eca57604052565b6001600160401b038111610eca57601f01601f191660200190565b9291926110538261102c565b916110616040519384610ea9565b8294818452818301116104a2578281602093846000960137010152565b60005b8381106110915750506000910152565b8181015183820152602001611081565b906020916110ba8151809281855285808601910161107e565b601f01601f1916010190565b6020815260e060c06110e484518360208601526101008501906110a1565b9361ffff602082015116604085015260018060a01b038060408301511660608601526060820151166080850152608081015160a085015260a081015182850152015191015290565b1561113357565b60405162461bcd60e51b815260206004820152602e60248201527f5068656173616e744e6574776f726b537761703a2053616d652074726164652060448201526d616c72656164792065786973747360901b6064820152608490fd5b1561119657565b60405162461bcd60e51b815260206004820152602760248201527f5068656173616e744e6574776f726b537761703a20496e76616c69642076616c6044820152661d59481cd95b9d60ca1b6064820152608490fd5b908092918237016000815290565b3d15611224573d9061120a8261102c565b916112186040519384610ea9565b82523d6000602084013e565b606090565b6020818303126104a2578051906001600160401b0382116104a2570181601f820112156104a257805161125b8161102c565b926112696040519485610ea9565b818452602082840101116104a257610e59916020808501910161107e565b906020610e599281815201906110a1565b6097546112ad906001600160a01b031661015f565b9060608101906112f16112bf83610e4f565b6040805163babcc53960e01b81526001600160a01b039092166004830152946020929091908390829081906024820190565b0381855afa801561049d5761130e91600091611674575b50610ef3565b8451634364dd3b60e11b815260c08401356004820181905261012085013560248301529460e08501359491928490849060449082905afa92831561049d57600093611655575b50608082019361136385610e4f565b61136c9061088c565b8481549061137991610f81565b905561138783820184610f8e565b9790611394858b01610fc0565b61139d85610e4f565b906113aa60a08801610e4f565b926113b361100d565b9b36906113bf92611047565b8b5261ffff16848b01526001600160a01b0316898b01526001600160a01b031660608901528060808901528460a08901524260c08901528561140081610e4f565b8a5184810190806114118d846110c6565b03601f19810182526114239082610ea9565b5190206114309133611b7d565b94611448866000526099602052604060002054151590565b156114529061112c565b6001600160a01b039887908a61146785610e4f565b60009687966114fc959193909216156116395750906114b16114a261015f846104218561149961015f6114d799610e4f565b30903390611dbc565b6114ab8b610e4f565b90611e5c565b6114bd61015f8d610e4f565b906114d18c6114cb8c610e4f565b92610e86565b91611eee565b8c6101006114e489610e4f565b916114ef8680610f8e565b95909151809681936111eb565b03940135f16115096111f9565b901561158d57505061155a9284926115549261154961015f7fd3c401dfdd079a8763e51394e4dbd6cdb508ae3474090c4d3aa61fe4195325039998610e4f565b61156e575b506116a1565b50610e4f565b169251806115693394826110c6565b0390a3565b611587906114ab61158161015f88610e4f565b91610e4f565b3861154e565b88925060048151116000146115e0576115dc92916115b8826115b26115c59451610e72565b90611ce6565b8051810182019101611229565b905162461bcd60e51b815291829160048301611287565b0390fd5b825162461bcd60e51b815260206004820152602c60248201527f4c6f772d6c6576656c2063616c6c206661696c656420776974686f757420726560448201526b76657274206d65737361676560a01b6064820152608490fd5b9150508161164b61165093341461118f565b610e86565b6114d7565b61166d919350843d8611610496576104888183610ea9565b9138611354565b6116949150843d861161169a575b61168c8183610ea9565b810190610ecf565b38611308565b503d611682565b610e599181600052609a6020526040600020556116ef565b634e487b7160e01b600052603260045260246000fd5b6098548110156116ea57609860005260206000200190600090565b6116b9565b60008181526099602052604081205461175d5760985490600160401b821015610eca5760018201806098558210156116ea577f2237a976fa961f5921fd19f2b03c925c725d77b20ce8f790c19709c03de4d81490910182905560985491815260996020526040902055600190565b905090565b908060209392818452848401376000828201840152601f01601f1916010190565b1561178a57565b60405162461bcd60e51b815260206004820152602e60248201527f5068656173616e744e6574776f726b537761703a205265717565737473206c6560448201526d6e67746820746f6f206c6172676560901b6064820152608490fd5b6001600160401b038111610eca5760051b60200190565b90611807826117e6565b604061181581519283610ea9565b8382528193611826601f19916117e6565b019060005b8281106118385750505050565b81519060a08201918083106001600160401b03841117610eca576020928452606080825260008491818385015281878501528301526000608083015282870101520161182b565b90156116ea57803590607e19813603018212156104a2570190565b91908110156116ea5760051b81013590607e19813603018212156104a2570190565b8051156116ea5760200190565b80518210156116ea5760209160051b010190565b6000198114610e815760010190565b602080820190808352835180925260409283810182858560051b8401019601946000925b858410611921575050505050505090565b909192939495968580600192603f198582030187528a519061194b825160a08084528301906110a1565b918381015184830152858060a01b0380898301511689840152606090818301511690830152608080910151910152990194019401929594939190611910565b9092608092610e5996948352602083015260408201528160608201520191611762565b91816119b99293611b7d565b6119c281611b4d565b929015611a095760018060a01b0316600052609b6020526040600020908154838103908111610e8157611a05925580600052609a60205260006040812055611aa1565b5090565b60405162461bcd60e51b815260206004820152602860248201527f5068656173616e744e6574776f726b537761703a205472616465206973206e6f604482015267742065786973747360c01b6064820152608490fd5b6098548015611a8b576000198181019190818310156116ea576000916098835260208320010155609855565b634e487b7160e01b600052603160045260246000fd5b6000818152609960205260409020548015611b46576000199181830191808311610e8157609854938401938411610e81578383611afc9460009603611b02575b505050611aec611a5f565b6000526099602052604060002090565b55600190565b611aec611b2491611b15611b3d946116cf565b90549060031b1c9283916116cf565b90919082549060031b91821b91600019901b1916179055565b55388080611ae1565b5050600090565b600052609a6020526040600020548015600014611b7857506099602052604060002054151590600090565b600191565b909160405191602083019360018060a01b038092168552166040830152606082015260608152608081018181106001600160401b03821117610eca5760405251902090565b6001600160a01b0390811692919083611be25750611be09250611d71565b565b906044906020936000936040519263a9059cbb60e01b8452166004830152602482015282855af19081601f3d11600160005114161516611c5c575b5015611c2557565b60405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606490fd5b3b153d1715905038611c1d565b15611c7057565b60405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606490fd5b15611cad57565b60405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606490fd5b611cfa82611cf381610f65565b1015611c69565b611d0f8151611d0884610f73565b1115611ca6565b81611d27575050604051600081526020810160405290565b60405191601f8116916004831560051b80858701019484860193010101905b808410611d5e5750508252601f01601f191660405290565b9092835181526020809101930190611d46565b600080809381935af115611d8157565b60405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606490fd5b6040516323b872dd60e01b81526001600160a01b039283166004820152929091166024830152604482019290925260209060009060649082855af19081601f3d11600160005114161516611e4f575b5015611e1357565b60405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606490fd5b3b153d1715905038611e0b565b60405163095ea7b360e01b81526001600160a01b03909216600483015260006024830181905290916020919060449082855af19081601f3d11600160005114161516611ee1575b5015611eab57565b60405162461bcd60e51b815260206004820152600e60248201526d1054141493d59157d1905253115160921b6044820152606490fd5b3b153d1715905038611ea3565b60405163095ea7b360e01b81526001600160a01b039092166004830152602482019290925260209060009060449082855af19081601f3d11600160005114161516611ee1575015611eab5756fea26469706673582212206d218cf2d12a862ca7c4503a025cf251e3059286bc0661b10c838e590c99d2c864736f6c63430008120033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

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