MON Price: $0.018952 (+3.45%)

Contract

0xe9b0666DFfC176Df6686726CB9aaC78fD83D20d7

Overview

MON Balance

Monad Chain LogoMonad Chain LogoMonad Chain Logo0 MON

MON Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Swap And Bridge508598752026-01-24 18:37:1526 mins ago1769279835IN
0xe9b0666D...fD83D20d7
34,100 MON0.12108308102.91
Swap And Bridge508594652026-01-24 18:34:3229 mins ago1769279672IN
0xe9b0666D...fD83D20d7
3,788 MON0.14758373101.94
Swap And Bridge508325002026-01-24 15:34:463 hrs ago1769268886IN
0xe9b0666D...fD83D20d7
6,400 MON0.15342121102.91
Swap And Bridge507837452026-01-24 10:08:508 hrs ago1769249330IN
0xe9b0666D...fD83D20d7
0 MON0.21950757102
Swap And Bridge507295262026-01-24 4:07:0414 hrs ago1769227624IN
0xe9b0666D...fD83D20d7
541 MON0.09415647101.94
Swap And Bridge506180762026-01-23 15:43:1027 hrs ago1769182990IN
0xe9b0666D...fD83D20d7
0 MON0.09257387102
Swap And Bridge504429632026-01-22 20:14:3346 hrs ago1769112873IN
0xe9b0666D...fD83D20d7
0 MON0.09360722101.94
Swap And Bridge503499512026-01-22 9:53:452 days ago1769075625IN
0xe9b0666D...fD83D20d7
21,700 MON0.30317337102
Swap And Bridge503498332026-01-22 9:52:582 days ago1769075578IN
0xe9b0666D...fD83D20d7
96,000 MON0.14958172102.26285999
Swap And Bridge503487482026-01-22 9:45:452 days ago1769075145IN
0xe9b0666D...fD83D20d7
96,850 MON0.2390047102.08732608
Swap And Bridge503485612026-01-22 9:44:302 days ago1769075070IN
0xe9b0666D...fD83D20d7
96,862 MON0.14082062101.94
Swap And Bridge501434612026-01-21 10:54:153 days ago1768992855IN
0xe9b0666D...fD83D20d7
0 MON0.20062485101.94
Swap And Bridge501432102026-01-21 10:52:353 days ago1768992755IN
0xe9b0666D...fD83D20d7
0 MON0.20280096101.94
Swap And Bridge501425132026-01-21 10:47:563 days ago1768992476IN
0xe9b0666D...fD83D20d7
0 MON0.20829828101.94
Swap And Bridge501422882026-01-21 10:46:253 days ago1768992385IN
0xe9b0666D...fD83D20d7
0 MON0.08425769101.94000002
Swap And Bridge501420782026-01-21 10:45:013 days ago1768992301IN
0xe9b0666D...fD83D20d7
0 MON0.18848634101.94
Swap And Bridge501418502026-01-21 10:43:303 days ago1768992210IN
0xe9b0666D...fD83D20d7
0 MON0.18109772102.91
Swap And Bridge500979532026-01-21 5:50:203 days ago1768974620IN
0xe9b0666D...fD83D20d7
0 MON0.09940383101.94
Swap And Bridge500978602026-01-21 5:49:423 days ago1768974582IN
0xe9b0666D...fD83D20d7
0 MON0.13447099101.94
Swap And Bridge500977262026-01-21 5:48:473 days ago1768974527IN
0xe9b0666D...fD83D20d7
0 MON0.18589044101.94
Swap And Bridge500829782026-01-21 4:10:083 days ago1768968608IN
0xe9b0666D...fD83D20d7
0 MON0.09253878101.94
Swap And Bridge500603772026-01-21 1:39:153 days ago1768959555IN
0xe9b0666D...fD83D20d7
15,927.73891058 MON0.27465968102
Swap And Bridge500508442026-01-21 0:35:363 days ago1768955736IN
0xe9b0666D...fD83D20d7
0 MON0.33222879102.00000001
Swap And Bridge499742182026-01-20 16:04:224 days ago1768925062IN
0xe9b0666D...fD83D20d7
55 MON0.09185436102
Swap And Bridge499412992026-01-20 12:20:034 days ago1768911603IN
0xe9b0666D...fD83D20d7
2.5 MON0.07357076102
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
508598752026-01-24 18:37:1526 mins ago1769279835
0xe9b0666D...fD83D20d7
34,100 MON
508594652026-01-24 18:34:3229 mins ago1769279672
0xe9b0666D...fD83D20d7
3,788 MON
508325002026-01-24 15:34:463 hrs ago1769268886
0xe9b0666D...fD83D20d7
6,400 MON
507295262026-01-24 4:07:0414 hrs ago1769227624
0xe9b0666D...fD83D20d7
541 MON
503499512026-01-22 9:53:452 days ago1769075625
0xe9b0666D...fD83D20d7
21,700 MON
503498332026-01-22 9:52:582 days ago1769075578
0xe9b0666D...fD83D20d7
96,000 MON
503487482026-01-22 9:45:452 days ago1769075145
0xe9b0666D...fD83D20d7
96,850 MON
500603772026-01-21 1:39:153 days ago1768959555
0xe9b0666D...fD83D20d7
15,927.73891058 MON
499742182026-01-20 16:04:224 days ago1768925062
0xe9b0666D...fD83D20d7
55 MON
499412992026-01-20 12:20:034 days ago1768911603
0xe9b0666D...fD83D20d7
2.5 MON
497525452026-01-19 15:03:305 days ago1768835010
0xe9b0666D...fD83D20d7
110.99237277 MON
496215942026-01-19 0:26:335 days ago1768782393
0xe9b0666D...fD83D20d7
10,000 MON
493512372026-01-17 18:21:077 days ago1768674067
0xe9b0666D...fD83D20d7
40 MON
492818422026-01-17 10:37:117 days ago1768646231
0xe9b0666D...fD83D20d7
50 MON
491397572026-01-16 18:48:238 days ago1768589303
0xe9b0666D...fD83D20d7
6,880 MON
491179042026-01-16 16:22:228 days ago1768580542
0xe9b0666D...fD83D20d7
2,392 MON
490859142026-01-16 12:48:478 days ago1768567727
0xe9b0666D...fD83D20d7
81.42617772 MON
490159742026-01-16 5:00:418 days ago1768539641
0xe9b0666D...fD83D20d7
30.92438168 MON
488900692026-01-15 14:54:529 days ago1768488892
0xe9b0666D...fD83D20d7
9,240 MON
488900042026-01-15 14:54:269 days ago1768488866
0xe9b0666D...fD83D20d7
9,240 MON
488658162026-01-15 12:10:059 days ago1768479005
0xe9b0666D...fD83D20d7
156 MON
488089822026-01-15 5:47:319 days ago1768456051
0xe9b0666D...fD83D20d7
46,388 MON
485750412026-01-14 3:33:1910 days ago1768361599
0xe9b0666D...fD83D20d7
5,000 MON
485570572026-01-14 1:33:0710 days ago1768354387
0xe9b0666D...fD83D20d7
44,880 MON
484441882026-01-13 12:58:5711 days ago1768309137
0xe9b0666D...fD83D20d7
199.8 MON
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SpokePoolPeriphery

Compiler Version
v0.8.30+commit.73712a01

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
prague EvmVersion
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts-v4/token/ERC20/utils/SafeERC20.sol";
import { IERC20Permit } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Permit.sol";
import { Address } from "@openzeppelin/contracts-v4/utils/Address.sol";
import { MultiCaller } from "contracts/external/uma/core/contracts/common/implementation/MultiCaller.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts-v4/security/ReentrancyGuard.sol";
import { SignatureChecker } from "@openzeppelin/contracts-v4/utils/cryptography/SignatureChecker.sol";
import { EIP712 } from "@openzeppelin/contracts-v4/utils/cryptography/EIP712.sol";
import { V3SpokePoolInterface } from "./interfaces/V3SpokePoolInterface.sol";
import { IERC20Auth } from "./external/interfaces/IERC20Auth.sol";
import { WETH9Interface } from "./external/interfaces/WETH9Interface.sol";
import { IPermit2 } from "./external/interfaces/IPermit2.sol";
import { PeripherySigningLib } from "./libraries/PeripherySigningLib.sol";
import { SpokePoolPeripheryInterface } from "./interfaces/SpokePoolPeripheryInterface.sol";
import { AddressToBytes32 } from "./libraries/AddressConverters.sol";

/**
 * @title SwapProxy
 * @notice A dedicated proxy contract that isolates swap execution to mitigate frontrunning vulnerabilities.
 * The SpokePoolPeriphery transfers tokens to this contract, which performs the swap and returns tokens back to the periphery.
 * @custom:security-contact [email protected]
 */
contract SwapProxy is ReentrancyGuard {
    using SafeERC20 for IERC20;
    using Address for address;

    // Canonical Permit2 contract address
    IPermit2 public immutable permit2;

    // EIP 1271 magic bytes indicating a valid signature.
    bytes4 private constant EIP1271_VALID_SIGNATURE = 0x1626ba7e;

    // EIP 1271 bytes indicating an invalid signature.
    bytes4 private constant EIP1271_INVALID_SIGNATURE = 0xffffffff;

    // Mapping from (token, spender) to nonce for Permit2 operations
    mapping(address => mapping(address => uint48)) private permit2Nonces;

    // Slot for checking whether this contract is expecting a callback from permit2. Used to confirm whether it should return a valid signature response.
    bool private expectingPermit2Callback;

    // Errors
    error SwapFailed();
    error UnsupportedTransferType();
    error InvalidExchange();

    /**
     * @notice Constructs a new SwapProxy.
     * @param _permit2 Address of the canonical permit2 contract.
     */
    constructor(address _permit2) {
        permit2 = IPermit2(_permit2);
    }

    /**
     * @notice Executes a swap on the given exchange with the provided calldata.
     * @param inputToken The token to swap from
     * @param outputToken The token to swap to
     * @param inputAmount The amount of input tokens to swap
     * @param exchange The exchange to perform the swap
     * @param transferType The method of transferring tokens to the exchange
     * @param routerCalldata The calldata to execute on the exchange
     * @return outputAmount The actual amount of output tokens received from the swap
     */
    function performSwap(
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        address exchange,
        SpokePoolPeripheryInterface.TransferType transferType,
        bytes calldata routerCalldata
    ) external nonReentrant returns (uint256 outputAmount) {
        // Prevent nonce invalidation attack by disallowing exchange to be the permit2 address
        if (exchange == address(permit2)) revert InvalidExchange();

        // We'll return the final balance of output tokens

        // The exchange will either receive funds from this contract via:
        // 1. A direct approval to spend funds on this contract (TransferType.Approval),
        // 2. A direct transfer of funds to the exchange (TransferType.Transfer), or
        // 3. A permit2 approval (TransferType.Permit2Approval)
        if (transferType == SpokePoolPeripheryInterface.TransferType.Approval) {
            IERC20(inputToken).forceApprove(exchange, inputAmount);
        } else if (transferType == SpokePoolPeripheryInterface.TransferType.Transfer) {
            IERC20(inputToken).safeTransfer(exchange, inputAmount);
        } else if (transferType == SpokePoolPeripheryInterface.TransferType.Permit2Approval) {
            IERC20(inputToken).forceApprove(address(permit2), inputAmount);
            expectingPermit2Callback = true;
            permit2.permit(
                address(this), // owner
                IPermit2.PermitSingle({
                    details: IPermit2.PermitDetails({
                        token: inputToken,
                        amount: uint160(inputAmount),
                        expiration: uint48(block.timestamp),
                        nonce: permit2Nonces[inputToken][exchange]++
                    }),
                    spender: exchange,
                    sigDeadline: block.timestamp
                }), // permitSingle
                "" // signature is unused. The only verification for a valid signature is if we are at this code block.
            );
            expectingPermit2Callback = false;
        } else {
            revert UnsupportedTransferType();
        }

        // Execute the swap
        (bool success, ) = exchange.call(routerCalldata);
        if (!success) revert SwapFailed();

        // Get the final output token balance
        uint256 outputBalance = IERC20(outputToken).balanceOf(address(this));

        // Transfer all output tokens back to the periphery
        IERC20(outputToken).safeTransfer(msg.sender, outputBalance);

        // Return the net amount received from the swap
        return outputBalance;
    }

    /**
     * @notice Verifies that the signer is the owner of the signing contract.
     * @dev This function is called by Permit2 during the permit process
     * and we need to return a valid signature result to allow permit2 to succeed.
     */
    function isValidSignature(bytes32, bytes calldata) external view returns (bytes4 magicBytes) {
        magicBytes = (msg.sender == address(permit2) && expectingPermit2Callback)
            ? EIP1271_VALID_SIGNATURE
            : EIP1271_INVALID_SIGNATURE;
    }
}

/**
 * @title SpokePoolPeriphery
 * @notice Contract for performing more complex interactions with an Across spoke pool deployment.
 * @custom:security-contact [email protected]
 */
contract SpokePoolPeriphery is SpokePoolPeripheryInterface, ReentrancyGuard, MultiCaller, EIP712 {
    using SafeERC20 for IERC20;
    using Address for address;
    using AddressToBytes32 for address;

    // Canonical Permit2 contract address.
    IPermit2 public immutable permit2;

    // Swap proxy used for isolating all swap operations
    SwapProxy public immutable swapProxy;

    // Mapping from user address to their current nonce
    mapping(address => uint256) public permitNonces;

    event SwapBeforeBridge(
        address exchange,
        bytes exchangeCalldata,
        address indexed swapToken,
        address indexed acrossInputToken,
        uint256 swapTokenAmount,
        uint256 acrossInputAmount,
        bytes32 indexed acrossOutputToken,
        uint256 acrossOutputAmount
    );

    /****************************************
     *                ERRORS                *
     ****************************************/
    error MinimumExpectedInputAmount();
    error InvalidMsgValue();
    error InvalidSignature();
    error InvalidMinExpectedInputAmount();
    error InvalidNonce();

    /**
     * @notice Construct a new Periphery contract.
     * @param _permit2 Address of the canonical permit2 contract.
     */
    constructor(IPermit2 _permit2) EIP712("ACROSS-PERIPHERY", "1.0.0") {
        require(address(_permit2) != address(0), "Permit2 cannot be zero address");
        require(_isContract(address(_permit2)), "Permit2 must be a contract");
        permit2 = _permit2;

        // Deploy the swap proxy with reference to the permit2 address
        swapProxy = new SwapProxy(address(_permit2));
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     */
    function depositNative(
        address spokePool,
        bytes32 recipient,
        address inputToken,
        uint256 inputAmount,
        bytes32 outputToken,
        uint256 outputAmount,
        uint256 destinationChainId,
        bytes32 exclusiveRelayer,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityParameter,
        bytes memory message
    ) external payable override nonReentrant {
        // Set msg.sender as the depositor so that msg.sender can speed up the deposit.
        V3SpokePoolInterface(spokePool).deposit{ value: msg.value }(
            msg.sender.toBytes32(),
            recipient,
            inputToken.toBytes32(),
            outputToken,
            inputAmount,
            outputAmount,
            destinationChainId,
            exclusiveRelayer,
            quoteTimestamp,
            fillDeadline,
            exclusivityParameter,
            message
        );
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     * @dev Revert case: When enableProportionalAdjustment is true, the calculation
     * depositData.outputAmount * returnAmount may overflow if the product exceeds 2^256-1,
     * causing immediate transaction revert even when the final division result would fit.
     * This case should be extremely rare as both values would need to be > 1e18 * 1e18.
     * Users will only see a generic failure without explanatory error message.
     * @dev Does not support native tokens as swap output. Only ERC20 tokens can be deposited via this function.
     */
    function swapAndBridge(SwapAndDepositData calldata swapAndDepositData) external payable override nonReentrant {
        // If a user performs a swapAndBridge with the swap token as the native token, wrap the value and treat the rest of transaction
        // as though the user deposited a wrapped native token.
        if (msg.value != 0) {
            if (msg.value != swapAndDepositData.swapTokenAmount) revert InvalidMsgValue();
            // Assume swapToken implements WETH9 interface if sending value
            WETH9Interface(swapAndDepositData.swapToken).deposit{ value: msg.value }();
        } else {
            // Transfer ERC20 tokens from sender to this contract
            IERC20(swapAndDepositData.swapToken).safeTransferFrom(
                msg.sender,
                address(this),
                swapAndDepositData.swapTokenAmount
            );
        }

        _swapAndBridge(swapAndDepositData);
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     * @dev Revert case: When enableProportionalAdjustment is true, the calculation
     * depositData.outputAmount * returnAmount may overflow if the product exceeds 2^256-1,
     * causing immediate transaction revert even when the final division result would fit.
     * This case should be extremely rare as both values would need to be > 1e18 * 1e18.
     * Users will only see a generic failure without explanatory error message.
     * @dev Does not support native tokens as swap output. Only ERC20 tokens can be deposited via this function.
     */
    function swapAndBridgeWithPermit(
        address signatureOwner,
        SwapAndDepositData calldata swapAndDepositData,
        uint256 deadline,
        bytes calldata permitSignature,
        bytes calldata swapAndDepositDataSignature
    ) external override nonReentrant {
        (bytes32 r, bytes32 s, uint8 v) = PeripherySigningLib.deserializeSignature(permitSignature);
        // Load variables used in this function onto the stack.
        address _swapToken = swapAndDepositData.swapToken;
        uint256 _swapTokenAmount = swapAndDepositData.swapTokenAmount;
        uint256 _submissionFeeAmount = swapAndDepositData.submissionFees.amount;
        address _submissionFeeRecipient = swapAndDepositData.submissionFees.recipient;
        uint256 _pullAmount = _submissionFeeAmount + _swapTokenAmount;

        // For permit transactions, we wrap the call in a try/catch block so that the transaction will continue even if the call to
        // permit fails. For example, this may be useful if the permit signature, which can be redeemed by anyone, is executed by somebody
        // other than this contract.
        try IERC20Permit(_swapToken).permit(signatureOwner, address(this), _pullAmount, deadline, v, r, s) {} catch {}
        IERC20(_swapToken).safeTransferFrom(signatureOwner, address(this), _pullAmount);
        _paySubmissionFees(_swapToken, _submissionFeeRecipient, _submissionFeeAmount);
        // Verify and increment nonce to prevent replay attacks.
        _validateAndIncrementNonce(signatureOwner, swapAndDepositData.nonce);
        // Verify that the signatureOwner signed the input swapAndDepositData.
        _validateSignature(
            signatureOwner,
            PeripherySigningLib.hashSwapAndDepositData(swapAndDepositData),
            swapAndDepositDataSignature
        );
        _swapAndBridge(swapAndDepositData);
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     * @dev Revert case: When enableProportionalAdjustment is true, the calculation
     * depositData.outputAmount * returnAmount may overflow if the product exceeds 2^256-1,
     * causing immediate transaction revert even when the final division result would fit.
     * This case should be extremely rare as both values would need to be > 1e18 * 1e18.
     * Users will only see a generic failure without explanatory error message.
     * @dev Does not support native tokens as swap output. Only ERC20 tokens can be deposited via this function.
     */
    function swapAndBridgeWithPermit2(
        address signatureOwner,
        SwapAndDepositData calldata swapAndDepositData,
        IPermit2.PermitTransferFrom calldata permit,
        bytes calldata signature
    ) external override nonReentrant {
        bytes32 witness = PeripherySigningLib.hashSwapAndDepositData(swapAndDepositData);
        uint256 _submissionFeeAmount = swapAndDepositData.submissionFees.amount;
        IPermit2.SignatureTransferDetails memory transferDetails = IPermit2.SignatureTransferDetails({
            to: address(this),
            requestedAmount: swapAndDepositData.swapTokenAmount + _submissionFeeAmount
        });

        permit2.permitWitnessTransferFrom(
            permit,
            transferDetails,
            signatureOwner,
            witness,
            PeripherySigningLib.EIP712_SWAP_AND_DEPOSIT_TYPE_STRING,
            signature
        );
        _paySubmissionFees(
            swapAndDepositData.swapToken,
            swapAndDepositData.submissionFees.recipient,
            _submissionFeeAmount
        );
        _swapAndBridge(swapAndDepositData);
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     * @dev Revert case: When enableProportionalAdjustment is true, the calculation
     * depositData.outputAmount * returnAmount may overflow if the product exceeds 2^256-1,
     * causing immediate transaction revert even when the final division result would fit.
     * This case should be extremely rare as both values would need to be > 1e18 * 1e18.
     * Users will only see a generic failure without explanatory error message.
     * @dev Does not support native tokens as swap output. Only ERC20 tokens can be deposited via this function.
     */
    function swapAndBridgeWithAuthorization(
        address signatureOwner,
        SwapAndDepositData calldata swapAndDepositData,
        uint256 validAfter,
        uint256 validBefore,
        bytes calldata receiveWithAuthSignature,
        bytes calldata swapAndDepositDataSignature
    ) external override nonReentrant {
        (bytes32 r, bytes32 s, uint8 v) = PeripherySigningLib.deserializeSignature(receiveWithAuthSignature);
        uint256 _submissionFeeAmount = swapAndDepositData.submissionFees.amount;
        // While any contract can vacuously implement `receiveWithAuthorization` (or just have a fallback),
        // if tokens were not sent to this contract, by this call to swapData.swapToken, this function will revert
        // when attempting to swap tokens it does not own.
        IERC20Auth(address(swapAndDepositData.swapToken)).receiveWithAuthorization(
            signatureOwner,
            address(this),
            swapAndDepositData.swapTokenAmount + _submissionFeeAmount,
            validAfter,
            validBefore,
            bytes32(swapAndDepositData.nonce),
            v,
            r,
            s
        );
        _paySubmissionFees(
            swapAndDepositData.swapToken,
            swapAndDepositData.submissionFees.recipient,
            _submissionFeeAmount
        );

        // Note: No need to validate our internal nonce for receiveWithAuthorization
        // as EIP-3009 has its own nonce mechanism that prevents replay attacks.
        //
        // Design Decision: We reuse the receiveWithAuthorization nonce for our signatures,
        // but not for permit, which creates a theoretical replay attack that we think is
        // incredibly unlikely because this would require:
        // 1. A token implementing both ERC-2612 and ERC-3009
        // 2. A user using the same nonces for swapAndBridgeWithPermit and for swapAndBridgeWithAuthorization
        // 3. Issuing these signatures within a short amount of time (limited by fillDeadlineBuffer)
        // Verify that the signatureOwner signed the input swapAndDepositData.
        _validateSignature(
            signatureOwner,
            PeripherySigningLib.hashSwapAndDepositData(swapAndDepositData),
            swapAndDepositDataSignature
        );
        _swapAndBridge(swapAndDepositData);
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     */
    function depositWithPermit(
        address signatureOwner,
        DepositData calldata depositData,
        uint256 deadline,
        bytes calldata permitSignature,
        bytes calldata depositDataSignature
    ) external override nonReentrant {
        (bytes32 r, bytes32 s, uint8 v) = PeripherySigningLib.deserializeSignature(permitSignature);
        // Load variables used in this function onto the stack.
        address _inputToken = depositData.baseDepositData.inputToken;
        uint256 _inputAmount = depositData.inputAmount;
        uint256 _submissionFeeAmount = depositData.submissionFees.amount;
        address _submissionFeeRecipient = depositData.submissionFees.recipient;
        uint256 _pullAmount = _submissionFeeAmount + _inputAmount;

        // For permit transactions, we wrap the call in a try/catch block so that the transaction will continue even if the call to
        // permit fails. For example, this may be useful if the permit signature, which can be redeemed by anyone, is executed by somebody
        // other than this contract.
        try IERC20Permit(_inputToken).permit(signatureOwner, address(this), _pullAmount, deadline, v, r, s) {} catch {}
        IERC20(_inputToken).safeTransferFrom(signatureOwner, address(this), _pullAmount);
        _paySubmissionFees(_inputToken, _submissionFeeRecipient, _submissionFeeAmount);

        // Verify and increment nonce to prevent replay attacks.
        _validateAndIncrementNonce(signatureOwner, depositData.nonce);
        // Verify that the signatureOwner signed the input depositData.
        _validateSignature(signatureOwner, PeripherySigningLib.hashDepositData(depositData), depositDataSignature);
        _deposit(
            depositData.spokePool,
            depositData.baseDepositData.depositor,
            depositData.baseDepositData.recipient,
            _inputToken,
            depositData.baseDepositData.outputToken,
            _inputAmount,
            depositData.baseDepositData.outputAmount,
            depositData.baseDepositData.destinationChainId,
            depositData.baseDepositData.exclusiveRelayer,
            depositData.baseDepositData.quoteTimestamp,
            depositData.baseDepositData.fillDeadline,
            depositData.baseDepositData.exclusivityParameter,
            depositData.baseDepositData.message
        );
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     */
    function depositWithPermit2(
        address signatureOwner,
        DepositData calldata depositData,
        IPermit2.PermitTransferFrom calldata permit,
        bytes calldata signature
    ) external override nonReentrant {
        bytes32 witness = PeripherySigningLib.hashDepositData(depositData);
        uint256 _submissionFeeAmount = depositData.submissionFees.amount;
        IPermit2.SignatureTransferDetails memory transferDetails = IPermit2.SignatureTransferDetails({
            to: address(this),
            requestedAmount: depositData.inputAmount + _submissionFeeAmount
        });

        permit2.permitWitnessTransferFrom(
            permit,
            transferDetails,
            signatureOwner,
            witness,
            PeripherySigningLib.EIP712_DEPOSIT_TYPE_STRING,
            signature
        );
        _paySubmissionFees(
            depositData.baseDepositData.inputToken,
            depositData.submissionFees.recipient,
            _submissionFeeAmount
        );

        _deposit(
            depositData.spokePool,
            depositData.baseDepositData.depositor,
            depositData.baseDepositData.recipient,
            depositData.baseDepositData.inputToken,
            depositData.baseDepositData.outputToken,
            depositData.inputAmount,
            depositData.baseDepositData.outputAmount,
            depositData.baseDepositData.destinationChainId,
            depositData.baseDepositData.exclusiveRelayer,
            depositData.baseDepositData.quoteTimestamp,
            depositData.baseDepositData.fillDeadline,
            depositData.baseDepositData.exclusivityParameter,
            depositData.baseDepositData.message
        );
    }

    /**
     * @inheritdoc SpokePoolPeripheryInterface
     */
    function depositWithAuthorization(
        address signatureOwner,
        DepositData calldata depositData,
        uint256 validAfter,
        uint256 validBefore,
        bytes calldata receiveWithAuthSignature,
        bytes calldata depositDataSignature
    ) external override nonReentrant {
        // Load variables used multiple times onto the stack.
        uint256 _inputAmount = depositData.inputAmount;
        uint256 _submissionFeeAmount = depositData.submissionFees.amount;

        // Redeem the receiveWithAuthSignature.
        (bytes32 r, bytes32 s, uint8 v) = PeripherySigningLib.deserializeSignature(receiveWithAuthSignature);
        IERC20Auth(depositData.baseDepositData.inputToken).receiveWithAuthorization(
            signatureOwner,
            address(this),
            _inputAmount + _submissionFeeAmount,
            validAfter,
            validBefore,
            bytes32(depositData.nonce),
            v,
            r,
            s
        );
        _paySubmissionFees(
            depositData.baseDepositData.inputToken,
            depositData.submissionFees.recipient,
            _submissionFeeAmount
        );

        // Note: No need to validate our internal nonce for receiveWithAuthorization
        // as EIP-3009 has its own nonce mechanism that prevents replay attacks.
        //
        // Design Decision: We reuse the receiveWithAuthorization nonce for our signatures,
        // but not for permit, which creates a theoretical replay attack that we think is
        // incredibly unlikely because this would require:
        // 1. A token implementing both ERC-2612 and ERC-3009
        // 2. A user using the same nonces for depositWithPermit and for depositWithAuthorization
        // 3. Issuing these signatures within a short amount of time (limited by fillDeadlineBuffer)
        // Verify that the signatureOwner signed the input depositData.
        _validateSignature(signatureOwner, PeripherySigningLib.hashDepositData(depositData), depositDataSignature);
        _deposit(
            depositData.spokePool,
            depositData.baseDepositData.depositor,
            depositData.baseDepositData.recipient,
            depositData.baseDepositData.inputToken,
            depositData.baseDepositData.outputToken,
            _inputAmount,
            depositData.baseDepositData.outputAmount,
            depositData.baseDepositData.destinationChainId,
            depositData.baseDepositData.exclusiveRelayer,
            depositData.baseDepositData.quoteTimestamp,
            depositData.baseDepositData.fillDeadline,
            depositData.baseDepositData.exclusivityParameter,
            depositData.baseDepositData.message
        );
    }

    /**
     * @notice Returns the contract's EIP712 domain separator, used to sign hashed DepositData/SwapAndDepositData types.
     */
    function domainSeparator() external view returns (bytes32) {
        return _domainSeparatorV4();
    }

    /**
     * @notice Validates that the typed data hash corresponds to the input signature owner and corresponding signature.
     * @param signatureOwner The alledged signer of the input hash.
     * @param typedDataHash The EIP712 data hash to check the signature against.
     * @param signature The signature to validate.
     */
    function _validateSignature(address signatureOwner, bytes32 typedDataHash, bytes calldata signature) private view {
        if (!SignatureChecker.isValidSignatureNow(signatureOwner, _hashTypedDataV4(typedDataHash), signature)) {
            revert InvalidSignature();
        }
    }

    /**
     * @notice Validates and increments the user's nonce to prevent replay attacks.
     * @param user The user whose nonce is being validated.
     * @param providedNonce The provided nonce value.
     */
    function _validateAndIncrementNonce(address user, uint256 providedNonce) private {
        if (permitNonces[user] != providedNonce) {
            revert InvalidNonce();
        }
        permitNonces[user]++;
    }

    /**
     * @notice Approves the spoke pool and calls `depositV3` function with the specified input parameters.
     * @param depositor The address on the origin chain which should be treated as the depositor by Across, and will therefore receive refunds if this deposit
     * is unfilled.
     * @param recipient The address on the destination chain which should receive outputAmount of outputToken.
     * @param inputToken The token to deposit on the origin chain.
     * @param outputToken The token to receive on the destination chain.
     * @param inputAmount The amount of the input token to deposit.
     * @param outputAmount The amount of the output token to receive.
     * @param destinationChainId The network ID for the destination chain.
     * @param exclusiveRelayer The optional address for an Across relayer which may fill the deposit exclusively.
     * @param quoteTimestamp The timestamp at which the relay and LP fee was calculated.
     * @param fillDeadline The timestamp at which the deposit must be filled before it will be refunded by Across.
     * @param exclusivityParameter The deadline or offset during which the exclusive relayer has rights to fill the deposit without contention.
     * @param message The message to execute on the destination chain.
     */
    function _deposit(
        address spokePool,
        address depositor,
        bytes32 recipient,
        address inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 destinationChainId,
        bytes32 exclusiveRelayer,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityParameter,
        bytes calldata message
    ) private {
        IERC20(inputToken).forceApprove(spokePool, inputAmount);
        V3SpokePoolInterface(spokePool).deposit(
            depositor.toBytes32(),
            recipient,
            inputToken.toBytes32(),
            outputToken,
            inputAmount,
            outputAmount,
            destinationChainId,
            exclusiveRelayer,
            quoteTimestamp,
            fillDeadline,
            exclusivityParameter,
            message
        );
    }

    /**
     * @notice Swaps a token on the origin chain before depositing into the Across spoke pool atomically.
     * @param swapAndDepositData The parameters to use when calling both the swap on an exchange and bridging via an Across spoke pool.
     */
    function _swapAndBridge(SwapAndDepositData calldata swapAndDepositData) private {
        // Load variables we use multiple times onto the stack.
        IERC20 _swapToken = IERC20(swapAndDepositData.swapToken);
        IERC20 _acrossInputToken = IERC20(swapAndDepositData.depositData.inputToken);
        address _exchange = swapAndDepositData.exchange;
        uint256 _swapTokenAmount = swapAndDepositData.swapTokenAmount;

        // Transfer tokens to the swap proxy for executing the swap
        _swapToken.safeTransfer(address(swapProxy), _swapTokenAmount);

        // Execute the swap via the swap proxy using the appropriate transfer type
        // This function will swap _swapToken for _acrossInputToken and return the amount of _acrossInputToken received
        uint256 returnAmount = swapProxy.performSwap(
            address(_swapToken),
            address(_acrossInputToken),
            _swapTokenAmount,
            _exchange,
            swapAndDepositData.transferType,
            swapAndDepositData.routerCalldata
        );

        // Sanity check that received amount from swap is enough to submit Across deposit with.
        if (returnAmount < swapAndDepositData.minExpectedInputTokenAmount) revert MinimumExpectedInputAmount();

        // Calculate adjusted output amount based on whether proportional adjustment is enabled
        if (swapAndDepositData.minExpectedInputTokenAmount == 0) revert InvalidMinExpectedInputAmount();
        uint256 adjustedOutputAmount;
        if (swapAndDepositData.enableProportionalAdjustment) {
            // Adjust the output amount proportionally based on the returned input amount
            adjustedOutputAmount =
                (swapAndDepositData.depositData.outputAmount * returnAmount) /
                swapAndDepositData.minExpectedInputTokenAmount;
        } else {
            // Use the fixed output amount without adjustment
            adjustedOutputAmount = swapAndDepositData.depositData.outputAmount;
        }

        emit SwapBeforeBridge(
            _exchange,
            swapAndDepositData.routerCalldata,
            address(_swapToken),
            address(_acrossInputToken),
            _swapTokenAmount,
            returnAmount,
            swapAndDepositData.depositData.outputToken,
            adjustedOutputAmount
        );

        // Deposit the swapped tokens into Across and bridge them using remainder of input params.
        _deposit(
            swapAndDepositData.spokePool,
            swapAndDepositData.depositData.depositor,
            swapAndDepositData.depositData.recipient,
            address(_acrossInputToken),
            swapAndDepositData.depositData.outputToken,
            returnAmount,
            adjustedOutputAmount,
            swapAndDepositData.depositData.destinationChainId,
            swapAndDepositData.depositData.exclusiveRelayer,
            swapAndDepositData.depositData.quoteTimestamp,
            swapAndDepositData.depositData.fillDeadline,
            swapAndDepositData.depositData.exclusivityParameter,
            swapAndDepositData.depositData.message
        );
    }

    function _paySubmissionFees(address feeToken, address recipient, uint256 amount) private {
        if (amount > 0) {
            // Use msg.sender as recipient if recipient is zero address, otherwise use the specified recipient
            address feeRecipient = recipient == address(0) ? msg.sender : recipient;
            IERC20(feeToken).safeTransfer(feeRecipient, amount);
        }
    }

    /**
     * @notice Internal function to check if an address is a contract
     * @dev This is a replacement for OpenZeppelin's isContract function which is deprecated
     * @param addr The address to check
     * @return True if the address is a contract, false otherwise
     */
    function _isContract(address addr) private view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(addr)
        }
        return size > 0;
    }
}

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

pragma solidity ^0.8.0;

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

File 3 of 24 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

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

pragma solidity ^0.8.0;

/**
 * @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 ReentrancyGuard {
    // 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;

    constructor() {
        _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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

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

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

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

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

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

pragma solidity ^0.8.0;

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

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

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature)
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

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

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

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

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/*
 * @notice Minimal interface for an EIP-3009 compliant token.
 * https://eips.ethereum.org/EIPS/eip-3009
 */
interface IERC20Auth {
    /**
     * @notice Receive a transfer with a signed authorization from the payer
     * @dev This has an additional check to ensure that the payee's address matches
     * the caller of this function to prevent front-running attacks. (See security
     * considerations)
     * @param from          Payer's address (Authorizer)
     * @param to            Payee's address
     * @param value         Amount to be transferred
     * @param validAfter    The time after which this is valid (unix time)
     * @param validBefore   The time before which this is valid (unix time)
     * @param nonce         Unique nonce
     * @param v             v of the signature
     * @param r             r of the signature
     * @param s             s of the signature
     */
    function receiveWithAuthorization(
        address from,
        address to,
        uint256 value,
        uint256 validAfter,
        uint256 validBefore,
        bytes32 nonce,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;
}

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

interface IPermit2 {
    struct PermitDetails {
        address token;
        uint160 amount;
        uint48 expiration;
        uint48 nonce;
    }

    struct PermitSingle {
        PermitDetails details;
        address spender;
        uint256 sigDeadline;
    }

    struct TokenPermissions {
        address token;
        uint256 amount;
    }

    struct PermitTransferFrom {
        TokenPermissions permitted;
        uint256 nonce;
        uint256 deadline;
    }

    struct SignatureTransferDetails {
        address to;
        uint256 requestedAmount;
    }

    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;

    function permitWitnessTransferFrom(
        PermitTransferFrom memory permit,
        SignatureTransferDetails calldata transferDetails,
        address owner,
        bytes32 witness,
        string calldata witnessTypeString,
        bytes calldata signature
    ) external;

    function transferFrom(address from, address to, uint160 amount, address token) external;
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/**
 * @notice Interface for the WETH9 contract.
 */
interface WETH9Interface {
    /**
     * @notice Burn Wrapped Ether and receive native Ether.
     * @param wad Amount of WETH to unwrap and send to caller.
     */
    function withdraw(uint256 wad) external;

    /**
     * @notice Lock native Ether and mint Wrapped Ether ERC20
     * @dev msg.value is amount of Wrapped Ether to mint/Ether to lock.
     */
    function deposit() external payable;

    /**
     * @notice Get balance of WETH held by `guy`.
     * @param guy Address to get balance of.
     * @return wad Amount of WETH held by `guy`.
     */
    function balanceOf(address guy) external view returns (uint256 wad);

    /**
     * @notice Transfer `wad` of WETH from caller to `guy`.
     * @param guy Address to send WETH to.
     * @param wad Amount of WETH to send.
     * @return ok True if transfer succeeded.
     */
    function transfer(address guy, uint256 wad) external returns (bool);
}

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

// This contract is taken from Uniswap's multi call implementation (https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/base/Multicall.sol)
// and was modified to be solidity 0.8 compatible. Additionally, the method was restricted to only work with msg.value
// set to 0 to avoid any nasty attack vectors on function calls that use value sent with deposits.

/// @title MultiCaller
/// @notice Enables calling multiple methods in a single call to the contract
contract MultiCaller {
    function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(data[i]);

            if (!success) {
                // Next 5 lines from https://ethereum.stackexchange.com/a/83577
                if (result.length < 68) revert();
                assembly {
                    result := add(result, 0x04)
                }
                revert(abi.decode(result, (string)));
            }

            results[i] = result;
        }
    }
}

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

import { IERC20 } from "@openzeppelin/contracts-v4/token/ERC20/IERC20.sol";
import { IERC20Permit } from "@openzeppelin/contracts-v4/token/ERC20/extensions/IERC20Permit.sol";
import { IPermit2 } from "../external/interfaces/IPermit2.sol";

/**
 * @title SpokePoolPeriphery
 * @notice Contract for performing more complex interactions with an Across spoke pool deployment.
 * @custom:security-contact [email protected]
 */
interface SpokePoolPeripheryInterface {
    // Enum describing the method of transferring tokens to an exchange.
    enum TransferType {
        // Approve the exchange so that it may transfer tokens from this contract.
        Approval, // 0
        // Transfer tokens to the exchange before calling it in this contract.
        Transfer, // 1
        // Approve the exchange by authorizing a transfer with Permit2.
        Permit2Approval // 2
    }

    // Submission fees can be set by user to pay whoever submits the transaction in a gasless flow.
    // These are assumed to be in the same currency that is input into the contract.
    struct Fees {
        // Amount of fees to pay recipient for submitting transaction.
        uint256 amount;
        // Recipient of fees amount.
        address recipient;
    }

    // Params we'll need caller to pass in to specify an Across Deposit. The input token will be swapped into first
    // before submitting a bridge deposit, which is why we don't include the input token amount as it is not known
    // until after the swap.
    struct BaseDepositData {
        // Token deposited on origin chain.
        address inputToken;
        // Token received on destination chain.
        bytes32 outputToken;
        // Amount of output token to be received by recipient.
        uint256 outputAmount;
        // The account credited with deposit who can submit speedups to the Across deposit.
        address depositor;
        // The account that will receive the output token on the destination chain. If the output token is
        // wrapped native token, then if this is an EOA then they will receive native token on the destination
        // chain and if this is a contract then they will receive an ERC20.
        bytes32 recipient;
        // The destination chain identifier.
        uint256 destinationChainId;
        // The account that can exclusively fill the deposit before the exclusivity parameter.
        bytes32 exclusiveRelayer;
        // Timestamp of the deposit used by system to charge fees. Must be within short window of time into the past
        // relative to this chain's current time or deposit will revert.
        uint32 quoteTimestamp;
        // The timestamp on the destination chain after which this deposit can no longer be filled.
        uint32 fillDeadline;
        // The timestamp or offset on the destination chain after which anyone can fill the deposit. A detailed description on
        // how the parameter is interpreted by the V3 spoke pool can be found at https://github.com/across-protocol/contracts/blob/fa67f5e97eabade68c67127f2261c2d44d9b007e/contracts/SpokePool.sol#L476
        uint32 exclusivityParameter;
        // Data that is forwarded to the recipient if the recipient is a contract.
        bytes message;
    }

    // Minimum amount of parameters needed to perform a swap on an exchange specified. We include information beyond just the router calldata
    // and exchange address so that we may ensure that the swap was performed properly.
    struct SwapAndDepositData {
        // Amount of fees to pay for submitting transaction. Unused in gasful flows.
        Fees submissionFees;
        // Deposit data to use when interacting with the Across spoke pool.
        BaseDepositData depositData;
        // Token to swap.
        address swapToken;
        // Address of the exchange to use in the swap.
        address exchange;
        // Method of transferring tokens to the exchange.
        TransferType transferType;
        // Amount of the token to swap on the exchange.
        uint256 swapTokenAmount;
        // Minimum output amount of the exchange, and, by extension, the minimum required amount to deposit into an Across spoke pool.
        uint256 minExpectedInputTokenAmount;
        // The calldata to use when calling the exchange.
        bytes routerCalldata;
        // When enabled (true), if the swap returns more tokens than minExpectedInputTokenAmount,
        // the outputAmount will be increased proportionally.
        // When disabled (false), the original outputAmount is used regardless of how many tokens are returned.
        bool enableProportionalAdjustment;
        // Address of the SpokePool to use for depositing tokens after swap.
        address spokePool;
        // User nonce to prevent replay attacks.
        uint256 nonce;
    }

    // Extended deposit data to be used specifically for signing off on periphery deposits.
    struct DepositData {
        // Amount of fees to pay for submitting transaction. Unused in gasful flows.
        Fees submissionFees;
        // Deposit data describing the parameters for the V3 Across deposit.
        BaseDepositData baseDepositData;
        // The precise input amount to deposit into the spoke pool.
        uint256 inputAmount;
        // Address of the SpokePool to use for depositing tokens.
        address spokePool;
        // User nonce to prevent replay attacks.
        uint256 nonce;
    }

    /**
     * @notice Passthrough function to `depositV3()` on the SpokePool contract for native token deposits.
     * @dev Protects the caller from losing their ETH (or other native token) by reverting if the SpokePool address
     * they intended to call does not exist on this chain. Because this contract can be deployed at the same address
     * everywhere callers should be protected even if the transaction is submitted to an unintended network.
     * This contract should only be used for native token deposits, as this problem only exists for native tokens.
     * @param recipient Address (as bytes32) to receive funds on destination chain.
     * @param inputToken Token to lock into this contract to initiate deposit.
     * @param inputAmount Amount of tokens to deposit.
     * @param outputAmount Amount of tokens to receive on destination chain.
     * @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.
     * @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid
     * to LP pool on HubPool.
     * @param message Arbitrary data that can be used to pass additional information to the recipient along with the tokens.
     * Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
     * @param exclusiveRelayer Address (as bytes32) of the relayer who has exclusive rights to fill this deposit. Can be set to
     * 0x0 if no period is desired. If so, then must set exclusivityParameter to 0.
     * @param exclusivityParameter Timestamp or offset, after which any relayer can fill this deposit. Must set
     * to 0 if exclusiveRelayer is set to 0x0, and vice versa.
     * @param fillDeadline Timestamp after which this deposit can no longer be filled.
     */
    function depositNative(
        address spokePool,
        bytes32 recipient,
        address inputToken,
        uint256 inputAmount,
        bytes32 outputToken,
        uint256 outputAmount,
        uint256 destinationChainId,
        bytes32 exclusiveRelayer,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityParameter,
        bytes memory message
    ) external payable;

    /**
     * @notice Swaps tokens on this chain via specified router before submitting Across deposit atomically.
     * Caller can specify their slippage tolerance for the swap and Across deposit params.
     * @dev If msg.value is sent, the swapToken in swapAndDepositData must implement the WETH9 interface for wrapping native tokens.
     * @param swapAndDepositData Specifies the data needed to perform a swap on a generic exchange.
     */
    function swapAndBridge(SwapAndDepositData calldata swapAndDepositData) external payable;

    /**
     * @notice Swaps an EIP-2612 token on this chain via specified router before submitting Across deposit atomically.
     * Caller can specify their slippage tolerance for the swap and Across deposit params.
     * @dev If the swapToken does not implement `permit` to the specifications of EIP-2612, the permit call result will be ignored and the function will continue.
     * @dev If the swapToken in swapData does not implement `permit` to the specifications of EIP-2612, this function will fail.
     * @dev The nonce for the swapAndDepositData signature must be retrieved from permitNonces(signatureOwner).
     * @dev Design Decision: We use separate nonce tracking for permit-based functions versus
     * receiveWithAuthorization-based functions, which creates a theoretical replay attack that we think is
     * incredibly unlikely because this would require:
     * 1. A token implementing both ERC-2612 and ERC-3009
     * 2. A user using the same nonces for swapAndBridgeWithPermit and for swapAndBridgeWithAuthorization
     * 3. Issuing these signatures within a short amount of time (limited by fillDeadlineBuffer)
     * @param signatureOwner The owner of the permit signature and swapAndDepositData signature. Assumed to be the depositor for the Across spoke pool.
     * @param swapAndDepositData Specifies the params we need to perform a swap on a generic exchange.
     * @param deadline Deadline before which the permit signature is valid.
     * @param permitSignature Permit signature encoded as (bytes32 r, bytes32 s, uint8 v).
     * @param swapAndDepositDataSignature The signature against the input swapAndDepositData encoded as (bytes32 r, bytes32 s, uint8 v).
     */
    function swapAndBridgeWithPermit(
        address signatureOwner,
        SwapAndDepositData calldata swapAndDepositData,
        uint256 deadline,
        bytes calldata permitSignature,
        bytes calldata swapAndDepositDataSignature
    ) external;

    /**
     * @notice Uses permit2 to transfer tokens from a user before swapping a token on this chain via specified router and submitting an Across deposit atomically.
     * Caller can specify their slippage tolerance for the swap and Across deposit params.
     * @dev This function assumes the caller has properly set an allowance for the permit2 contract on this network.
     * @dev This function assumes that the amount of token to be swapped is equal to the amount of the token to be received from permit2.
     * @param signatureOwner The owner of the permit2 signature and depositor for the Across spoke pool.
     * @param swapAndDepositData Specifies the params we need to perform a swap on a generic exchange.
     * @param permit The permit data signed over by the owner.
     * @param signature The permit2 signature to verify against the deposit data.
     */
    function swapAndBridgeWithPermit2(
        address signatureOwner,
        SwapAndDepositData calldata swapAndDepositData,
        IPermit2.PermitTransferFrom calldata permit,
        bytes calldata signature
    ) external;

    /**
     * @notice Swaps an EIP-3009 token on this chain via specified router before submitting Across deposit atomically.
     * Caller can specify their slippage tolerance for the swap and Across deposit params.
     * @dev If swapToken does not implement `receiveWithAuthorization` to the specifications of EIP-3009, this call will revert.
     * @dev The nonce for the receiveWithAuthorization signature should match the nonce in the SwapAndDepositData.
     * This nonce is managed by the ERC-3009 token contract.
     * @param signatureOwner The owner of the EIP3009 signature and swapAndDepositData signature. Assumed to be the depositor for the Across spoke pool.
     * @param swapAndDepositData Specifies the params we need to perform a swap on a generic exchange.
     * @param validAfter The unix time after which the `receiveWithAuthorization` signature is valid.
     * @param validBefore The unix time before which the `receiveWithAuthorization` signature is valid.
     * @param receiveWithAuthSignature EIP3009 signature encoded as (bytes32 r, bytes32 s, uint8 v).
     * @param swapAndDepositDataSignature The signature against the input swapAndDepositData encoded as (bytes32 r, bytes32 s, uint8 v).
     */
    function swapAndBridgeWithAuthorization(
        address signatureOwner,
        SwapAndDepositData calldata swapAndDepositData,
        uint256 validAfter,
        uint256 validBefore,
        bytes calldata receiveWithAuthSignature,
        bytes calldata swapAndDepositDataSignature
    ) external;

    /**
     * @notice Deposits an EIP-2612 token Across input token into the Spoke Pool contract.
     * @dev If the token does not implement `permit` to the specifications of EIP-2612, the permit call result will be ignored and the function will continue.
     * @dev If `acrossInputToken` does not implement `permit` to the specifications of EIP-2612, this function will fail.
     * @dev The nonce for the depositData signature must be retrieved from permitNonces(signatureOwner).
     * @dev Design Decision: We use separate nonce tracking for permit-based functions versus
     * receiveWithAuthorization-based functions, which creates a theoretical replay attack that we think is
     * incredibly unlikely because this would require:
     * 1. A token implementing both ERC-2612 and ERC-3009
     * 2. A user using the same nonces for depositWithPermit and for depositWithAuthorization
     * 3. Issuing these signatures within a short amount of time (limited by fillDeadlineBuffer)
     * @param signatureOwner The owner of the permit signature and depositData signature. Assumed to be the depositor for the Across spoke pool.
     * @param depositData Specifies the Across deposit params to send.
     * @param deadline Deadline before which the permit signature is valid.
     * @param permitSignature Permit signature encoded as (bytes32 r, bytes32 s, uint8 v).
     * @param depositDataSignature The signature against the input depositData encoded as (bytes32 r, bytes32 s, uint8 v).
     */
    function depositWithPermit(
        address signatureOwner,
        DepositData calldata depositData,
        uint256 deadline,
        bytes calldata permitSignature,
        bytes calldata depositDataSignature
    ) external;

    /**
     * @notice Uses permit2 to transfer and submit an Across deposit to the Spoke Pool contract.
     * @dev This function assumes the caller has properly set an allowance for the permit2 contract on this network.
     * @dev This function assumes that the amount of token to be swapped is equal to the amount of the token to be received from permit2.
     * @param signatureOwner The owner of the permit2 signature and depositor for the Across spoke pool.
     * @param depositData Specifies the Across deposit params we'll send after the swap.
     * @param permit The permit data signed over by the owner.
     * @param signature The permit2 signature to verify against the deposit data.
     */
    function depositWithPermit2(
        address signatureOwner,
        DepositData calldata depositData,
        IPermit2.PermitTransferFrom calldata permit,
        bytes calldata signature
    ) external;

    /**
     * @notice Deposits an EIP-3009 compliant Across input token into the Spoke Pool contract.
     * @dev If `acrossInputToken` does not implement `receiveWithAuthorization` to the specifications of EIP-3009, this call will revert.
     * @dev The nonce for the receiveWithAuthorization signature should match the nonce in the DepositData.
     * This nonce is managed by the ERC-3009 token contract.
     * @param signatureOwner The owner of the EIP3009 signature and depositData signature. Assumed to be the depositor for the Across spoke pool.
     * @param depositData Specifies the Across deposit params to send.
     * @param validAfter The unix time after which the `receiveWithAuthorization` signature is valid.
     * @param validBefore The unix time before which the `receiveWithAuthorization` signature is valid.
     * @param receiveWithAuthSignature EIP3009 signature encoded as (bytes32 r, bytes32 s, uint8 v).
     * @param depositDataSignature The signature against the input depositData encoded as (bytes32 r, bytes32 s, uint8 v).
     */
    function depositWithAuthorization(
        address signatureOwner,
        DepositData calldata depositData,
        uint256 validAfter,
        uint256 validBefore,
        bytes calldata receiveWithAuthSignature,
        bytes calldata depositDataSignature
    ) external;

    /**
     * @notice Returns the current permit nonce for a user.
     * @param user The user whose nonce to return.
     * @return The current permit nonce for the user.
     */
    function permitNonces(address user) external view returns (uint256);
}

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

// Contains structs and functions used by SpokePool contracts to facilitate universal settlement.
interface V3SpokePoolInterface {
    /**************************************
     *              ENUMS                 *
     **************************************/

    // Fill status tracks on-chain state of deposit, uniquely identified by relayHash.
    enum FillStatus {
        Unfilled,
        RequestedSlowFill,
        Filled
    }
    // Fill type is emitted in the FilledRelay event to assist Dataworker with determining which types of
    // fills to refund (e.g. only fast fills) and whether a fast fill created a sow fill excess.
    enum FillType {
        FastFill,
        // Fast fills are normal fills that do not replace a slow fill request.
        ReplacedSlowFill,
        // Replaced slow fills are fast fills that replace a slow fill request. This type is used by the Dataworker
        // to know when to send excess funds from the SpokePool to the HubPool because they can no longer be used
        // for a slow fill execution.
        SlowFill
    }
    // Slow fills are requested via requestSlowFill and executed by executeSlowRelayLeaf after a bundle containing
    // the slow fill is validated.

    /**************************************
     *              STRUCTS               *
     **************************************/

    // This struct represents the data to fully specify a **unique** relay submitted on this chain.
    // This data is hashed with the chainId() and saved by the SpokePool to prevent collisions and protect against
    // replay attacks on other chains. If any portion of this data differs, the relay is considered to be
    // completely distinct.
    struct V3RelayData {
        // The bytes32 that made the deposit on the origin chain.
        bytes32 depositor;
        // The recipient bytes32 on the destination chain.
        bytes32 recipient;
        // This is the exclusive relayer who can fill the deposit before the exclusivity deadline.
        bytes32 exclusiveRelayer;
        // Token that is deposited on origin chain by depositor.
        bytes32 inputToken;
        // Token that is received on destination chain by recipient.
        bytes32 outputToken;
        // The amount of input token deposited by depositor.
        uint256 inputAmount;
        // The amount of output token to be received by recipient.
        uint256 outputAmount;
        // Origin chain id.
        uint256 originChainId;
        // The id uniquely identifying this deposit on the origin chain.
        uint256 depositId;
        // The timestamp on the destination chain after which this deposit can no longer be filled.
        uint32 fillDeadline;
        // The timestamp on the destination chain after which any relayer can fill the deposit.
        uint32 exclusivityDeadline;
        // Data that is forwarded to the recipient.
        bytes message;
    }

    // Same as V3RelayData but using addresses instead of bytes32 & depositId is uint32.
    // Will be deprecated in favor of V3RelayData in the future.
    struct V3RelayDataLegacy {
        address depositor;
        address recipient;
        address exclusiveRelayer;
        address inputToken;
        address outputToken;
        uint256 inputAmount;
        uint256 outputAmount;
        uint256 originChainId;
        uint32 depositId;
        uint32 fillDeadline;
        uint32 exclusivityDeadline;
        bytes message;
    }

    // Contains parameters passed in by someone who wants to execute a slow relay leaf.
    struct V3SlowFill {
        V3RelayData relayData;
        uint256 chainId;
        uint256 updatedOutputAmount;
    }

    // Contains information about a relay to be sent along with additional information that is not unique to the
    // relay itself but is required to know how to process the relay. For example, "updatedX" fields can be used
    // by the relayer to modify fields of the relay with the depositor's permission, and "repaymentChainId" is specified
    // by the relayer to determine where to take a relayer refund, but doesn't affect the uniqueness of the relay.
    struct V3RelayExecutionParams {
        V3RelayData relay;
        bytes32 relayHash;
        uint256 updatedOutputAmount;
        bytes32 updatedRecipient;
        bytes updatedMessage;
        uint256 repaymentChainId;
    }

    // Packs together parameters emitted in FilledRelay because there are too many emitted otherwise.
    // Similar to V3RelayExecutionParams, these parameters are not used to uniquely identify the deposit being
    // filled so they don't have to be unpacked by all clients.
    struct V3RelayExecutionEventInfo {
        bytes32 updatedRecipient;
        bytes32 updatedMessageHash;
        uint256 updatedOutputAmount;
        FillType fillType;
    }

    // Represents the parameters required for a V3 deposit operation in the SpokePool.
    struct DepositV3Params {
        bytes32 depositor;
        bytes32 recipient;
        bytes32 inputToken;
        bytes32 outputToken;
        uint256 inputAmount;
        uint256 outputAmount;
        uint256 destinationChainId;
        bytes32 exclusiveRelayer;
        uint256 depositId;
        uint32 quoteTimestamp;
        uint32 fillDeadline;
        uint32 exclusivityParameter;
        bytes message;
    }

    /**************************************
     *              EVENTS                *
     **************************************/

    event FundsDeposited(
        bytes32 inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 indexed destinationChainId,
        uint256 indexed depositId,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        bytes32 indexed depositor,
        bytes32 recipient,
        bytes32 exclusiveRelayer,
        bytes message
    );

    event RequestedSpeedUpDeposit(
        uint256 updatedOutputAmount,
        uint256 indexed depositId,
        bytes32 indexed depositor,
        bytes32 updatedRecipient,
        bytes updatedMessage,
        bytes depositorSignature
    );

    event FilledRelay(
        bytes32 inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 repaymentChainId,
        uint256 indexed originChainId,
        uint256 indexed depositId,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        bytes32 exclusiveRelayer,
        bytes32 indexed relayer,
        bytes32 depositor,
        bytes32 recipient,
        bytes32 messageHash,
        V3RelayExecutionEventInfo relayExecutionInfo
    );

    event RequestedSlowFill(
        bytes32 inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 indexed originChainId,
        uint256 indexed depositId,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        bytes32 exclusiveRelayer,
        bytes32 depositor,
        bytes32 recipient,
        bytes32 messageHash
    );

    event ClaimedRelayerRefund(
        bytes32 indexed l2TokenAddress,
        bytes32 indexed refundAddress,
        uint256 amount,
        address indexed caller
    );

    /**************************************
     *              FUNCTIONS             *
     **************************************/

    function deposit(
        bytes32 depositor,
        bytes32 recipient,
        bytes32 inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 destinationChainId,
        bytes32 exclusiveRelayer,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        bytes calldata message
    ) external payable;

    function depositV3(
        address depositor,
        address recipient,
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 destinationChainId,
        address exclusiveRelayer,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        bytes calldata message
    ) external payable;

    function depositNow(
        bytes32 depositor,
        bytes32 recipient,
        bytes32 inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 destinationChainId,
        bytes32 exclusiveRelayer,
        uint32 fillDeadlineOffset,
        uint32 exclusivityDeadline,
        bytes calldata message
    ) external payable;

    function depositV3Now(
        address depositor,
        address recipient,
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 destinationChainId,
        address exclusiveRelayer,
        uint32 fillDeadlineOffset,
        uint32 exclusivityDeadline,
        bytes calldata message
    ) external payable;

    function unsafeDeposit(
        bytes32 depositor,
        bytes32 recipient,
        bytes32 inputToken,
        bytes32 outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 destinationChainId,
        bytes32 exclusiveRelayer,
        uint256 depositNonce,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityParameter,
        bytes calldata message
    ) external payable;

    function speedUpDeposit(
        bytes32 depositor,
        uint256 depositId,
        uint256 updatedOutputAmount,
        bytes32 updatedRecipient,
        bytes calldata updatedMessage,
        bytes calldata depositorSignature
    ) external;

    function speedUpV3Deposit(
        address depositor,
        uint256 depositId,
        uint256 updatedOutputAmount,
        address updatedRecipient,
        bytes calldata updatedMessage,
        bytes calldata depositorSignature
    ) external;

    function fillRelay(
        V3RelayData calldata relayData,
        uint256 repaymentChainId,
        bytes32 repaymentAddress
    ) external;

    function fillV3Relay(V3RelayDataLegacy calldata relayData, uint256 repaymentChainId) external;

    function fillRelayWithUpdatedDeposit(
        V3RelayData calldata relayData,
        uint256 repaymentChainId,
        bytes32 repaymentAddress,
        uint256 updatedOutputAmount,
        bytes32 updatedRecipient,
        bytes calldata updatedMessage,
        bytes calldata depositorSignature
    ) external;

    function requestSlowFill(V3RelayData calldata relayData) external;

    function executeSlowRelayLeaf(
        V3SlowFill calldata slowFillLeaf,
        uint32 rootBundleId,
        bytes32[] calldata proof
    ) external;

    function claimRelayerRefund(bytes32 l2TokenAddress, bytes32 refundAddress) external;

    /**************************************
     *              ERRORS                *
     **************************************/

    error DisabledRoute();
    error InvalidQuoteTimestamp();
    error InvalidFillDeadline();
    error InvalidExclusiveRelayer();
    error MsgValueDoesNotMatchInputAmount();
    error NotExclusiveRelayer();
    error NoSlowFillsInExclusivityWindow();
    error RelayFilled();
    error InvalidSlowFillRequest();
    error ExpiredFillDeadline();
    error InvalidMerkleProof();
    error InvalidChainId();
    error InvalidMerkleLeaf();
    error ClaimedMerkleLeaf();
    error InvalidPayoutAdjustmentPct();
    error WrongERC7683OrderId();
    error LowLevelCallFailed(bytes data);
    error InsufficientSpokePoolBalanceToExecuteLeaf();
    error NoRelayerRefundToClaim();

    /**************************************
     *             LEGACY EVENTS          *
     **************************************/

    // Note: these events are unused, but included in the ABI for ease of migration.
    event V3FundsDeposited(
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 indexed destinationChainId,
        uint32 indexed depositId,
        uint32 quoteTimestamp,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        address indexed depositor,
        address recipient,
        address exclusiveRelayer,
        bytes message
    );

    event RequestedSpeedUpV3Deposit(
        uint256 updatedOutputAmount,
        uint32 indexed depositId,
        address indexed depositor,
        address updatedRecipient,
        bytes updatedMessage,
        bytes depositorSignature
    );

    // Legacy struct only used to preserve the FilledV3Relay event definition.
    struct LegacyV3RelayExecutionEventInfo {
        address updatedRecipient;
        bytes updatedMessage;
        uint256 updatedOutputAmount;
        FillType fillType;
    }

    event FilledV3Relay(
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 repaymentChainId,
        uint256 indexed originChainId,
        uint32 indexed depositId,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        address exclusiveRelayer,
        address indexed relayer,
        address depositor,
        address recipient,
        bytes message,
        LegacyV3RelayExecutionEventInfo relayExecutionInfo
    );

    event RequestedV3SlowFill(
        address inputToken,
        address outputToken,
        uint256 inputAmount,
        uint256 outputAmount,
        uint256 indexed originChainId,
        uint32 indexed depositId,
        uint32 fillDeadline,
        uint32 exclusivityDeadline,
        address exclusiveRelayer,
        address depositor,
        address recipient,
        bytes message
    );
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

library Bytes32ToAddress {
    /**************************************
     *              ERRORS                *
     **************************************/
    error InvalidBytes32();

    function toAddress(bytes32 _bytes32) internal pure returns (address) {
        checkAddress(_bytes32);
        return address(uint160(uint256(_bytes32)));
    }

    function toAddressUnchecked(bytes32 _bytes32) internal pure returns (address) {
        return address(uint160(uint256(_bytes32)));
    }

    function checkAddress(bytes32 _bytes32) internal pure {
        if (uint256(_bytes32) >> 160 != 0) {
            revert InvalidBytes32();
        }
    }
}

library AddressToBytes32 {
    function toBytes32(address _address) internal pure returns (bytes32) {
        return bytes32(uint256(uint160(_address)));
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import { SpokePoolPeripheryInterface } from "../interfaces/SpokePoolPeripheryInterface.sol";

library PeripherySigningLib {
    string internal constant EIP712_FEES_TYPE = "Fees(uint256 amount,address recipient)";
    string internal constant EIP712_BASE_DEPOSIT_DATA_TYPE =
        "BaseDepositData(address inputToken,bytes32 outputToken,uint256 outputAmount,address depositor,bytes32 recipient,uint256 destinationChainId,bytes32 exclusiveRelayer,uint32 quoteTimestamp,uint32 fillDeadline,uint32 exclusivityParameter,bytes message)";
    string internal constant EIP712_DEPOSIT_DATA_TYPE =
        "DepositData(Fees submissionFees,BaseDepositData baseDepositData,uint256 inputAmount,address spokePool,uint256 nonce)";
    string internal constant EIP712_SWAP_AND_DEPOSIT_DATA_TYPE =
        "SwapAndDepositData(Fees submissionFees,BaseDepositData depositData,address swapToken,address exchange,uint8 transferType,uint256 swapTokenAmount,uint256 minExpectedInputTokenAmount,bytes routerCalldata,bool enableProportionalAdjustment,address spokePool,uint256 nonce)";

    // EIP712 Type hashes.
    bytes32 internal constant EIP712_FEES_TYPEHASH = keccak256(abi.encodePacked(EIP712_FEES_TYPE));
    bytes32 internal constant EIP712_BASE_DEPOSIT_DATA_TYPEHASH =
        keccak256(abi.encodePacked(EIP712_BASE_DEPOSIT_DATA_TYPE));
    bytes32 internal constant EIP712_DEPOSIT_DATA_TYPEHASH =
        keccak256(abi.encodePacked(EIP712_DEPOSIT_DATA_TYPE, EIP712_BASE_DEPOSIT_DATA_TYPE, EIP712_FEES_TYPE));
    bytes32 internal constant EIP712_SWAP_AND_DEPOSIT_DATA_TYPEHASH =
        keccak256(abi.encodePacked(EIP712_SWAP_AND_DEPOSIT_DATA_TYPE, EIP712_BASE_DEPOSIT_DATA_TYPE, EIP712_FEES_TYPE));

    // EIP712 Type strings.
    string internal constant TOKEN_PERMISSIONS_TYPE = "TokenPermissions(address token,uint256 amount)";
    string internal constant EIP712_SWAP_AND_DEPOSIT_TYPE_STRING =
        string(
            abi.encodePacked(
                "SwapAndDepositData witness)",
                EIP712_BASE_DEPOSIT_DATA_TYPE,
                EIP712_FEES_TYPE,
                EIP712_SWAP_AND_DEPOSIT_DATA_TYPE,
                TOKEN_PERMISSIONS_TYPE
            )
        );
    string internal constant EIP712_DEPOSIT_TYPE_STRING =
        string(
            abi.encodePacked(
                "DepositData witness)",
                EIP712_BASE_DEPOSIT_DATA_TYPE,
                EIP712_DEPOSIT_DATA_TYPE,
                EIP712_FEES_TYPE,
                TOKEN_PERMISSIONS_TYPE
            )
        );

    error InvalidSignature();

    /**
     * @notice Creates the EIP712 compliant hashed data corresponding to the BaseDepositData struct.
     * @param baseDepositData Input struct whose values are hashed.
     * @dev BaseDepositData is only used as a nested struct for both DepositData and SwapAndDepositData.
     */
    function hashBaseDepositData(
        SpokePoolPeripheryInterface.BaseDepositData calldata baseDepositData
    ) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    EIP712_BASE_DEPOSIT_DATA_TYPEHASH,
                    baseDepositData.inputToken,
                    baseDepositData.outputToken,
                    baseDepositData.outputAmount,
                    baseDepositData.depositor,
                    baseDepositData.recipient,
                    baseDepositData.destinationChainId,
                    baseDepositData.exclusiveRelayer,
                    baseDepositData.quoteTimestamp,
                    baseDepositData.fillDeadline,
                    baseDepositData.exclusivityParameter,
                    keccak256(baseDepositData.message)
                )
            );
    }

    /**
     * @notice Creates the EIP712 compliant hashed data corresponding to the Fees struct.
     * @param fees Input struct whose values are hashed.
     * @dev Fees is only used as a nested struct for both DepositData and SwapAndDepositData.
     */
    function hashFees(SpokePoolPeripheryInterface.Fees calldata fees) internal pure returns (bytes32) {
        return keccak256(abi.encode(EIP712_FEES_TYPEHASH, fees.amount, fees.recipient));
    }

    /**
     * @notice Creates the EIP712 compliant hashed data corresponding to the DepositData struct.
     * @param depositData Input struct whose values are hashed.
     */
    function hashDepositData(
        SpokePoolPeripheryInterface.DepositData calldata depositData
    ) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    EIP712_DEPOSIT_DATA_TYPEHASH,
                    hashFees(depositData.submissionFees),
                    hashBaseDepositData(depositData.baseDepositData),
                    depositData.inputAmount,
                    depositData.spokePool,
                    depositData.nonce
                )
            );
    }

    /**
     * @notice Creates the EIP712 compliant hashed data corresponding to the SwapAndDepositData struct.
     * @param swapAndDepositData Input struct whose values are hashed.
     */
    function hashSwapAndDepositData(
        SpokePoolPeripheryInterface.SwapAndDepositData calldata swapAndDepositData
    ) internal pure returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    EIP712_SWAP_AND_DEPOSIT_DATA_TYPEHASH,
                    hashFees(swapAndDepositData.submissionFees),
                    hashBaseDepositData(swapAndDepositData.depositData),
                    swapAndDepositData.swapToken,
                    swapAndDepositData.exchange,
                    swapAndDepositData.transferType,
                    swapAndDepositData.swapTokenAmount,
                    swapAndDepositData.minExpectedInputTokenAmount,
                    keccak256(swapAndDepositData.routerCalldata),
                    swapAndDepositData.enableProportionalAdjustment,
                    swapAndDepositData.spokePool,
                    swapAndDepositData.nonce
                )
            );
    }

    /**
     * @notice Reads an input bytes, and, assuming it is a signature for a 32-byte hash, returns the v, r, and s values.
     * @param _signature The input signature to deserialize.
     */
    function deserializeSignature(bytes calldata _signature) internal pure returns (bytes32 r, bytes32 s, uint8 v) {
        if (_signature.length != 65) revert InvalidSignature();
        v = uint8(_signature[64]);
        r = bytes32(_signature[0:32]);
        s = bytes32(_signature[32:64]);
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "viaIR": true,
  "evmVersion": "prague",
  "debug": {
    "revertStrings": "strip"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract IPermit2","name":"_permit2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidMinExpectedInputAmount","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"InvalidNonce","type":"error"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"MinimumExpectedInputAmount","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"exchange","type":"address"},{"indexed":false,"internalType":"bytes","name":"exchangeCalldata","type":"bytes"},{"indexed":true,"internalType":"address","name":"swapToken","type":"address"},{"indexed":true,"internalType":"address","name":"acrossInputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"swapTokenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"acrossInputAmount","type":"uint256"},{"indexed":true,"internalType":"bytes32","name":"acrossOutputToken","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"acrossOutputAmount","type":"uint256"}],"name":"SwapBeforeBridge","type":"event"},{"inputs":[{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"depositNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"signatureOwner","type":"address"},{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"baseDepositData","type":"tuple"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.DepositData","name":"depositData","type":"tuple"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes","name":"receiveWithAuthSignature","type":"bytes"},{"internalType":"bytes","name":"depositDataSignature","type":"bytes"}],"name":"depositWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signatureOwner","type":"address"},{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"baseDepositData","type":"tuple"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.DepositData","name":"depositData","type":"tuple"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"permitSignature","type":"bytes"},{"internalType":"bytes","name":"depositDataSignature","type":"bytes"}],"name":"depositWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signatureOwner","type":"address"},{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"baseDepositData","type":"tuple"},{"internalType":"uint256","name":"inputAmount","type":"uint256"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.DepositData","name":"depositData","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IPermit2.TokenPermissions","name":"permitted","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IPermit2.PermitTransferFrom","name":"permit","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"depositWithPermit2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"contract IPermit2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"permitNonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"depositData","type":"tuple"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"enum SpokePoolPeripheryInterface.TransferType","name":"transferType","type":"uint8"},{"internalType":"uint256","name":"swapTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minExpectedInputTokenAmount","type":"uint256"},{"internalType":"bytes","name":"routerCalldata","type":"bytes"},{"internalType":"bool","name":"enableProportionalAdjustment","type":"bool"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.SwapAndDepositData","name":"swapAndDepositData","type":"tuple"}],"name":"swapAndBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"signatureOwner","type":"address"},{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"depositData","type":"tuple"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"enum SpokePoolPeripheryInterface.TransferType","name":"transferType","type":"uint8"},{"internalType":"uint256","name":"swapTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minExpectedInputTokenAmount","type":"uint256"},{"internalType":"bytes","name":"routerCalldata","type":"bytes"},{"internalType":"bool","name":"enableProportionalAdjustment","type":"bool"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.SwapAndDepositData","name":"swapAndDepositData","type":"tuple"},{"internalType":"uint256","name":"validAfter","type":"uint256"},{"internalType":"uint256","name":"validBefore","type":"uint256"},{"internalType":"bytes","name":"receiveWithAuthSignature","type":"bytes"},{"internalType":"bytes","name":"swapAndDepositDataSignature","type":"bytes"}],"name":"swapAndBridgeWithAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signatureOwner","type":"address"},{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"depositData","type":"tuple"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"enum SpokePoolPeripheryInterface.TransferType","name":"transferType","type":"uint8"},{"internalType":"uint256","name":"swapTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minExpectedInputTokenAmount","type":"uint256"},{"internalType":"bytes","name":"routerCalldata","type":"bytes"},{"internalType":"bool","name":"enableProportionalAdjustment","type":"bool"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.SwapAndDepositData","name":"swapAndDepositData","type":"tuple"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"permitSignature","type":"bytes"},{"internalType":"bytes","name":"swapAndDepositDataSignature","type":"bytes"}],"name":"swapAndBridgeWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signatureOwner","type":"address"},{"components":[{"components":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct SpokePoolPeripheryInterface.Fees","name":"submissionFees","type":"tuple"},{"components":[{"internalType":"address","name":"inputToken","type":"address"},{"internalType":"bytes32","name":"outputToken","type":"bytes32"},{"internalType":"uint256","name":"outputAmount","type":"uint256"},{"internalType":"address","name":"depositor","type":"address"},{"internalType":"bytes32","name":"recipient","type":"bytes32"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"bytes32","name":"exclusiveRelayer","type":"bytes32"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"uint32","name":"fillDeadline","type":"uint32"},{"internalType":"uint32","name":"exclusivityParameter","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"}],"internalType":"struct SpokePoolPeripheryInterface.BaseDepositData","name":"depositData","type":"tuple"},{"internalType":"address","name":"swapToken","type":"address"},{"internalType":"address","name":"exchange","type":"address"},{"internalType":"enum SpokePoolPeripheryInterface.TransferType","name":"transferType","type":"uint8"},{"internalType":"uint256","name":"swapTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minExpectedInputTokenAmount","type":"uint256"},{"internalType":"bytes","name":"routerCalldata","type":"bytes"},{"internalType":"bool","name":"enableProportionalAdjustment","type":"bool"},{"internalType":"address","name":"spokePool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct SpokePoolPeripheryInterface.SwapAndDepositData","name":"swapAndDepositData","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IPermit2.TokenPermissions","name":"permitted","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IPermit2.PermitTransferFrom","name":"permit","type":"tuple"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"swapAndBridgeWithPermit2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"swapProxy","outputs":[{"internalType":"contract SwapProxy","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6101a080604052346101fb57602081614397803803809161002082856101ff565b8339810103126101fb57516001600160a01b038116908181036101fb5760405161004b6040826101ff565b6010815260208101906f4143524f53532d50455249504845525960801b8252604051916100796040846101ff565b600583526020830191640312e302e360dc1b835260015f5561009a81610222565b610120526100a7846103bd565b61014052519020918260e05251902080610100524660a0526040519060208201927f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f8452604083015260608201524660808201523060a082015260a0815261011060c0826101ff565b5190206080523060c05281156101fb57813b156101fb576101605260405190610afc8083016001600160401b038111848210176101e757602092849261389b843981520301905ff080156101dc57610180526040516133a590816104f6823960805181612e94015260a05181612f4b015260c05181612e65015260e05181612ee301526101005181612f0901526101205181610a2e01526101405181610a570152610160518181816102ba015281816105fc0152610dde0152610180518181816108e5015261221c0152f35b6040513d5f823e3d90fd5b634e487b7160e01b5f52604160045260245ffd5b5f80fd5b601f909101601f19168101906001600160401b038211908210176101e757604052565b908151602081105f1461029c575090601f81511161025c57602081519101516020821061024d571790565b5f198260200360031b1b161790565b604460209160405192839163305a27a960e01b83528160048401528051918291826024860152018484015e5f828201840152601f01601f19168101030190fd5b6001600160401b0381116101e757600154600181811c911680156103b3575b602082101461039f57601f811161036c575b50602092601f821160011461030b57928192935f92610300575b50508160011b915f199060031b1c19161760015560ff90565b015190505f806102e7565b601f1982169360015f52805f20915f5b868110610354575083600195961061033c575b505050811b0160015560ff90565b01515f1960f88460031b161c191690555f808061032e565b9192602060018192868501518155019401920161031b565b60015f52601f60205f20910160051c810190601f830160051c015b81811061039457506102cd565b5f8155600101610387565b634e487b7160e01b5f52602260045260245ffd5b90607f16906102bb565b908151602081105f146103e8575090601f81511161025c57602081519101516020821061024d571790565b6001600160401b0381116101e757600254600181811c911680156104eb575b602082101461039f57601f81116104b8575b50602092601f821160011461045757928192935f9261044c575b50508160011b915f199060031b1c19161760025560ff90565b015190505f80610433565b601f1982169360025f52805f20915f5b8681106104a05750836001959610610488575b505050811b0160025560ff90565b01515f1960f88460031b161c191690555f808061047a565b91926020600181928685015181550194019201610467565b60025f52601f60205f20910160051c810190601f830160051c015b8181106104e05750610419565b5f81556001016104d3565b90607f169061040756fe60806040526004361015610011575f80fd5b5f3560e01c8063110560ad146100f457806312261ee7146100ef5780631542ce53146100ea578063191d0ffc146100e5578063501f1053146100e057806356da359a146100db578063656a20e6146100d65780636ec4be90146100d1578063805e1148146100cc57806384b0196e146100c7578063ac9650d8146100c2578063b3cfd79e146100bd578063d2aca1a4146100b85763f698da25146100b3575f80fd5b610f8a565b610d09565b610c5a565b610bca565b6109f8565b610909565b61089b565b6107ff565b610529565b61044b565b6103e4565b610338565b610270565b61010c565b90816101809103126101085790565b5f80fd5b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101085760043567ffffffffffffffff8111610108576101569036906004016100f9565b61015e611fed565b341561023c5760c081013534036102145761019a61018161018160608401610fca565b73ffffffffffffffffffffffffffffffffffffffff1690565b90813b15610108575f600492604051938480927fd0e30db000000000000000000000000000000000000000000000000000000000825234905af191821561020f576101ea926101f5575b506121b7565b6101f360015f55565b005b806102035f6102099361071c565b80610266565b5f6101e4565b610fd4565b7f1841b4e1000000000000000000000000000000000000000000000000000000005f5260045ffd5b8061026161025261018160606101ea9501610fca565b60c08301359030903390611ffc565b6121b7565b5f91031261010857565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b73ffffffffffffffffffffffffffffffffffffffff81160361010857565b908160c09103126101085790565b9181601f840112156101085782359167ffffffffffffffff8311610108576020838186019501011161010857565b346101085760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610373816102de565b60243567ffffffffffffffff8111610108576103939036906004016102fc565b6044359160643567ffffffffffffffff8111610108576103b790369060040161030a565b906084359467ffffffffffffffff8611610108576103dc6101f396369060040161030a565b959094610fdf565b346101085760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101085773ffffffffffffffffffffffffffffffffffffffff600435610434816102de565b165f526003602052602060405f2054604051908152f35b346101085760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610486816102de565b60243567ffffffffffffffff8111610108576104a69036906004016100f9565b6044359160643560843567ffffffffffffffff8111610108576104cd90369060040161030a565b9160a4359567ffffffffffffffff8711610108576104f26101f397369060040161030a565b9690956112c7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc608091011261010857604490565b346101085760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610564816102de565b60243567ffffffffffffffff8111610108576105849036906004016100f9565b61058d366104fa565b9160c43567ffffffffffffffff8111610108576105ae90369060040161030a565b90916105b8611fed565b6105c184612b96565b948435936105d38560c088013561125a565b906105dc610762565b30815291602083015273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169261062561177c565b843b15610108575f96879361066a926040519c8d998a9889977f137c29fe00000000000000000000000000000000000000000000000000000000895260048901611852565b03925af190811561020f576101ea93610261926106a1575b5061068f60608401610fca565b61069b60208501610fca565b90612543565b806102035f6106af9361071c565b5f610682565b63ffffffff81160361010857565b61010435906106d1826106b5565b565b61012435906106d1826106b5565b61014435906106d1826106b5565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761075d57604052565b6106ef565b604051906106d160408361071c565b67ffffffffffffffff811161075d57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9291926107b782610771565b916107c5604051938461071c565b829481845281830111610108578281602093845f960137010152565b9080601f83011215610108578160206107fc933591016107ab565b90565b6101807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610836816102de565b60243590604435610846816102de565b60643560843560e43560c43560a43561085d6106c3565b936108666106d3565b9561086f6106e1565b97610164359a67ffffffffffffffff8c11610108576108956101f39c36906004016107e1565b9a61190e565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346101085760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610944816102de565b60243567ffffffffffffffff8111610108576109649036906004016100f9565b6044359160643567ffffffffffffffff81116101085761098890369060040161030a565b906084359467ffffffffffffffff8611610108576109ad6101f396369060040161030a565b959094611a06565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857610af4610a527f0000000000000000000000000000000000000000000000000000000000000000612c79565b610a7b7f0000000000000000000000000000000000000000000000000000000000000000612d96565b6020604051610a8a828261071c565b5f815281610b02818301947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe083013687376040519788977f0f00000000000000000000000000000000000000000000000000000000000000895260e0858a015260e08901906109b5565b9087820360408901526109b5565b914660608701523060808701525f60a087015285830360c087015251918281520192915f5b828110610b3657505050500390f35b835185528695509381019392810192600101610b27565b602081016020825282518091526040820191602060408360051b8301019401925f915b838310610b7f57505050505090565b9091929394602080610bbb837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0866001960301875289516109b5565b97019301930191939290610b70565b346101085760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101085760043567ffffffffffffffff811161010857366023820112156101085780600401359067ffffffffffffffff8211610108573660248360051b8301011161010857610c56916024610c4a9201611ca6565b60405191829182610b4d565b0390f35b346101085760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610c95816102de565b60243567ffffffffffffffff811161010857610cb59036906004016102fc565b6044359160643560843567ffffffffffffffff811161010857610cdc90369060040161030a565b9160a4359567ffffffffffffffff871161010857610d016101f397369060040161030a565b969095611d30565b346101085760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610d44816102de565b60243567ffffffffffffffff811161010857610d649036906004016102fc565b610d6d366104fa565b60c43567ffffffffffffffff811161010857610d8d90369060040161030a565b610d98949194611fed565b610da184612636565b91843593606086013596610db5868961125a565b90610dbe610762565b30815291602083015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001692610e07611f87565b843b15610108575f968793610e4c926040519a8b998a9889977f137c29fe00000000000000000000000000000000000000000000000000000000895260048901611852565b03925af1801561020f57610f76575b506040820190610e6b82846111fa565b610e7490610fca565b90610e8160208501610fca565b610e8a92612543565b610e9660808301610fca565b90610ea181846111fa565b606001610ead90610fca565b92610eb882826111fa565b6080013594610ec783836111fa565b610ed090610fca565b90610edb84846111fa565b6020013590610eea85856111fa565b60400135610ef886866111fa565b60a0013591610f0787876111fa565b60c0013593610f1688886111fa565b60e001610f229061126c565b95610f2d89896111fa565b61010001610f3a9061126c565b97610f458a826111fa565b61012001610f529061126c565b99610f5c916111fa565b6101408101610f6a91611276565b9b6101ea9d919b6128bb565b806102035f610f849361071c565b5f610e5b565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610108576020610fc2612e4e565b604051908152f35b356107fc816102de565b6040513d5f823e3d90fd5b919293610ff49194610fef611fed565b6124e5565b6040869893979298019461101061100b87896111fa565b610fca565b9760608801359988359261102660208b01610fca565b946110318d8661125a565b9273ffffffffffffffffffffffffffffffffffffffff8d1694853b15610108576040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c16600482015230602482015260448101869052606481019490945260ff92909216608484015260a483019190915260c48201525f8160e48183875af16111e6575b508630906110db93611ffc565b6110e59188612543565b6110f360a0860135846125aa565b6110fc85612636565b611105936126f7565b61111160808301610fca565b9161111c82826111fa565b60600161112890610fca565b9361113383836111fa565b608001359561114284846111fa565b602001359061115185856111fa565b6040013561115f86866111fa565b60a001359161116e87876111fa565b60c001359361117d88886111fa565b60e0016111899061126c565b9561119489896111fa565b610100016111a19061126c565b976111ac8a826111fa565b610120016111b99061126c565b996111c3916111fa565b61014081016111d191611276565b9b6111dd9d919b6128bb565b6106d160015f55565b806102035f6111f49361071c565b5f6110ce565b9035907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffea181360301821215610108570190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b9190820180921161126757565b61122d565b356107fc816106b5565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610108570180359067ffffffffffffffff82116101085760200191813603831361010857565b919693946112da91969395610fef611fed565b95919787359860608901976112f46101816101818b610fca565b916113038c60c08d013561125a565b916101608c0135843b15610108576040517fef55bec600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a16600482015230602482015260448101949094526064840195909552608483019690965260a482019390935260ff90941660c485015260e48401919091526101048301919091525f90829061012490829084905af196871561020f576113c3610261966113cf936111dd9a6113de575b50610fca565b61069b60208901610fca565b6113d885612b96565b906126f7565b806102035f6113ec9361071c565b5f6113bd565b604051906114026101208361071c565b60f882527f506172616d657465722c6279746573206d657373616765290000000000000000610100837f426173654465706f73697444617461286164647265737320696e707574546f6b60208201527f656e2c62797465733332206f7574707574546f6b656e2c75696e74323536206f60408201527f7574707574416d6f756e742c61646472657373206465706f7369746f722c627960608201527f746573333220726563697069656e742c75696e743235362064657374696e617460808201527f696f6e436861696e49642c62797465733332206578636c757369766552656c6160a08201527f7965722c75696e7433322071756f746554696d657374616d702c75696e74333260c08201527f2066696c6c446561646c696e652c75696e743332206578636c7573697669747960e08201520152565b6040519061154860608361071c565b602682527f7069656e742900000000000000000000000000000000000000000000000000006040837f466565732875696e7432353620616d6f756e742c61646472657373207265636960208201520152565b604051906115aa6101408361071c565b61010c82527f6e74323536206e6f6e6365290000000000000000000000000000000000000000610120837f53776170416e644465706f736974446174612846656573207375626d6973736960208201527f6f6e466565732c426173654465706f73697444617461206465706f736974446160408201527f74612c616464726573732073776170546f6b656e2c616464726573732065786360608201527f68616e67652c75696e7438207472616e73666572547970652c75696e7432353660808201527f2073776170546f6b656e416d6f756e742c75696e74323536206d696e4578706560a08201527f63746564496e707574546f6b656e416d6f756e742c627974657320726f75746560c08201527f7243616c6c646174612c626f6f6c20656e61626c6550726f706f7274696f6e6160e08201527f6c41646a7573746d656e742c616464726573732073706f6b65506f6f6c2c75696101008201520152565b6040519061171860608361071c565b602e82527f696e7432353620616d6f756e74290000000000000000000000000000000000006040837f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c7560208201520152565b805191908290602001825e015f815290565b6117e26107fc61178a6113f2565b6117e8611795611539565b6117e26117a061159a565b6117e26117ab611709565b936040519889977f53776170416e644465706f73697444617461207769746e65737329000000000060208a0152603b89019061176a565b9061176a565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261071c565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093818652868601375f8582860101520116010190565b9593906118ff9360206107fc99979460606118e69473ffffffffffffffffffffffffffffffffffffffff8135611887816102de565b168c5283810135848d0152604081013560408d0152013560608b015273ffffffffffffffffffffffffffffffffffffffff81511660808b0152015160a089015260c088019073ffffffffffffffffffffffffffffffffffffffff169052565b60e08601526101406101008601526101408501906109b5565b92610120818503910152611814565b73ffffffffffffffffffffffffffffffffffffffff80919c98949a969299959c9b97939b61193a611fed565b169a16988a3b15610108576040519b8c9a8b9a7fad5425c6000000000000000000000000000000000000000000000000000000008c523360048d015260248c015260448b015260648a0152608489015260a488015260c487015260e486015263ffffffff1661010485015263ffffffff1661012484015263ffffffff166101448301526101648201610180905261018482016119d5916109b5565b0381345a945f95f1801561020f576119f2575b506106d160015f55565b806102035f611a009361071c565b5f6119e8565b93611a179195929693610fef611fed565b94916060870135611a27816102de565b60c088013590883592611a46611a3f60208c01610fca565b938561125a565b73ffffffffffffffffffffffffffffffffffffffff8316803b15610108576040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8916600482015230602482015260448101839052606481019d909d5260ff9a909a1660848d015260a48c019190915260c48b01949094526111dd9961026198611b0595611b00929091905f8160e48183865af1611b14575b50873091611ffc565b612543565b6113cf610160860135826125aa565b806102035f611b229361071c565b5f611af7565b67ffffffffffffffff811161075d5760051b60200190565b90611b4a82611b28565b611b57604051918261071c565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0611b858294611b28565b01905f5b828110611b9557505050565b806060602080938501015201611b89565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b90821015611bee57611bea9160051b810190611276565b9091565b611ba6565b908092918237015f815290565b3d15611c2a573d90611c1182610771565b91611c1f604051938461071c565b82523d5f602084013e565b606090565b6020818303126101085780519067ffffffffffffffff8211610108570181601f8201121561010857805190611c6382610771565b92611c71604051948561071c565b8284526020838301011161010857815f9260208093018386015e8301015290565b8051821015611bee5760209160051b010190565b919091611cb283611b40565b925f5b818110611cc157505050565b5f80611cce838587611bd3565b90611cde60405180938193611bf3565b0390305af4611ceb611c00565b9015611d115790600191611cff8288611c92565b52611d0a8187611c92565b5001611cb5565b6044815110610108578060248060046101089401518301019101611c2f565b9390959196928695611d40611fed565b6060870135988735938492611d54916124e5565b9093918c60408c019b8c611d67916111fa565b611d7090610fca565b73ffffffffffffffffffffffffffffffffffffffff1693611d909161125a565b9160a08d0135843b15610108576040517fef55bec600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d16600482015230602482015260448101949094526064840195909552608483019690965260a482019390935260ff90941660c485015260e48401919091526101048301919091525f90829061012490829084905af1801561020f57611ec6575b50611e4485876111fa565b611e4d90610fca565b90611e5a60208801610fca565b611e6392612543565b611e6c85612636565b611e75936126f7565b611e8160808301610fca565b90611e8c81846111fa565b606001611e9890610fca565b92611ea382826111fa565b6080013594611eb283836111fa565b611ebb90610fca565b9061114284846111fa565b806102035f611ed49361071c565b5f611e39565b60405190611ee960a08361071c565b607482527f65506f6f6c2c75696e74323536206e6f6e6365290000000000000000000000006080837f4465706f736974446174612846656573207375626d697373696f6e466565732c60208201527f426173654465706f7369744461746120626173654465706f736974446174612c60408201527f75696e7432353620696e707574416d6f756e742c616464726573732073706f6b60608201520152565b6117e26107fc611f956113f2565b6117e8611fa0611eda565b6117e2611fab611539565b6117e2611fb6611709565b936040519889977f4465706f73697444617461207769746e6573732900000000000000000000000060208a0152603489019061176a565b60025f54146101085760025f55565b90919273ffffffffffffffffffffffffffffffffffffffff6106d19481604051957f23b872dd00000000000000000000000000000000000000000000000000000000602088015216602486015216604484015260648301526064825261206360848361071c565b612f86565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b3560038110156101085790565b90816020910312610108575190565b9060038210156120be5752565b612068565b9260c09473ffffffffffffffffffffffffffffffffffffffff918261210795816107fc9c9a96168852166020870152604086015216606084015260808301906120b1565b8160a08201520191611814565b8015150361010857565b356107fc81612114565b8181029291811591840414171561126757565b8115612145570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b92916080949796959273ffffffffffffffffffffffffffffffffffffffff6121a89316855260a0602086015260a0850191611814565b95604083015260608201520152565b6121c360608201610fca565b73ffffffffffffffffffffffffffffffffffffffff16604082016121e781846111fa565b6121f090610fca565b73ffffffffffffffffffffffffffffffffffffffff169061221360808501610fca565b9360c0810135857f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169561225d838883613024565b73ffffffffffffffffffffffffffffffffffffffff958616951661228360a08501612095565b9683878361010088019a6122978c8a611276565b916040519e8f9687967fc0437b7c00000000000000000000000000000000000000000000000000000000885260048801966122d1976120c3565b03815a6020945f91f197881561020f575f986124b4575b5060e08401359182891061248c57821561246457869261230b610120870161211e565b1561244c5761233361233b9161232e8c60406123278c8c6111fa565b0135612128565b61213b565b985b86611276565b91898b6123488a8a6111fa565b602001359760405195869561235d9587612172565b037f32da500ab49223322bf87d13ba63ef4e5efd139c75f982183d27f59fc31fb25091a461238e6101408201610fca565b9261239983836111fa565b6060016123a590610fca565b946123b084846111fa565b60800135966123bf85856111fa565b60200135916123ce86866111fa565b60a00135916123dd87876111fa565b60c00135936123ec88886111fa565b60e0016123f89061126c565b9561240389896111fa565b610100016124109061126c565b9761241b8a826111fa565b610120016124289061126c565b99612432916111fa565b610140810161244091611276565b9b6106d19d919b6128bb565b5061233b604061245c88886111fa565b013598612335565b7f2d696302000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f0492ff87000000000000000000000000000000000000000000000000000000005f5260045ffd5b6124d791985060203d6020116124de575b6124cf818361071c565b8101906120a2565b965f6122e8565b503d6124c5565b9190916041830361251b578260401015611bee57604081013560f81c908360201161010857803593604011610108576020013591565b7f8baa579f000000000000000000000000000000000000000000000000000000005f5260045ffd5b9190918161255057505050565b6106d19273ffffffffffffffffffffffffffffffffffffffff811661258e575073ffffffffffffffffffffffffffffffffffffffff33915b16613024565b73ffffffffffffffffffffffffffffffffffffffff9091612588565b73ffffffffffffffffffffffffffffffffffffffff1690815f52600360205260405f20540361260e575f52600360205260405f2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611267576001019055565b7f756688fe000000000000000000000000000000000000000000000000000000005f5260045ffd5b61263e611eda565b6117e261266b61264c6113f2565b6117e8612657611539565b6040519485936117e260208601809961176a565b5190209061267881613086565b9073ffffffffffffffffffffffffffffffffffffffff6126a361269e60408401846111fa565b61310e565b91606081013560a06080830135926126ba846102de565b01359360405195602087019788526040870152606086015260808501521660a083015260c082015260c081526126f160e08261071c565b51902090565b9291604261274292612707612e4e565b90604051917f1901000000000000000000000000000000000000000000000000000000000000835260028301526022820152209236916107ab565b9161274d838361328b565b60058194929410156120be57159283612833575b508215612775575b50501590505b61251b57565b5f938493506127c56117e89160405192839160208301957f1626ba7e00000000000000000000000000000000000000000000000000000000875260248401526040604484015260648301906109b5565b51915afa6127d1611c00565b9080612827575b806127ea575b61276f91505f80612769565b50602081805181010312610108577f1626ba7e00000000000000000000000000000000000000000000000000000000602061276f920151146127de565b506020815110156127d8565b73ffffffffffffffffffffffffffffffffffffffff83811691161492505f612761565b9892956101809a9563ffffffff9993956107fc9f9d9993988b999760208e8c9a8152015260408d015260608c015260808b015260a08a015260c089015260e0880152166101008601521661012084015216610140820152816101608201520191611814565b6101816129be859b969f9a95889e99949f9a959d986129d89473ffffffffffffffffffffffffffffffffffffffff91826101819416905f806040519261297f8461295360208201937f095ea7b300000000000000000000000000000000000000000000000000000000855289602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810186528561071c565b83519082865af161298e611c00565b81612ab3575b5080612aa9575b15612a3b575b5050169f73ffffffffffffffffffffffffffffffffffffffff1690565b9a73ffffffffffffffffffffffffffffffffffffffff1690565b9a8c3b15610108576040517fad5425c60000000000000000000000000000000000000000000000000000000081529d8e9c8d9c612a189c60048f01612856565b03815a5f948591f1801561020f57612a2d5750565b806102035f6106d19361071c565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff841660248201525f6044820152612aa2929061206390612a9c81606481016117e8565b82612f86565b5f806129a1565b50813b151561299b565b8051801592508215612ac8575b50505f612994565b612adb9250602080918301019101612f71565b5f80612ac0565b612aea61159a565b6117e26126f161264c6113f2565b99979593919c9b9a98969492909c6101808b019d8b5260208b015260408a015273ffffffffffffffffffffffffffffffffffffffff16606089015273ffffffffffffffffffffffffffffffffffffffff16608088015260a08701612b5b916120b1565b60c086015260e0850152610100840152151561012083015273ffffffffffffffffffffffffffffffffffffffff166101408201526101600152565b612b9e612ae2565b90612ba881613086565b91612bb660408301836111fa565b612bbf9061310e565b90612bcc60608401610fca565b92612bd960808201610fca565b90612be660a08201612095565b60c082013560e0830135612bfe610100850185611276565b3690612c09926107ab565b80519060200120916101208501612c1f9061211e565b93612c2d6101408701610fca565b956101600135966040519a8b9a60208c019d612c499b8f612af8565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810182526126f1908261071c565b60ff8114612c8a576107fc90613234565b506040515f6001548060011c91600182168015612d8c575b602084108114612d5f5783855284926020840191908115612d285750600114612cd3575b506107fc9250038261071c565b60015f90815291507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b848310612d1157506107fc9350015f612cc6565b805482840152859350602090920191600101612cfd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168252506107fc93151560051b0190505f612cc6565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b92607f1692612ca2565b60ff8114612da7576107fc90613234565b506040515f6002548060011c91600182168015612e44575b602084108114612d5f5783855284926020840191908115612d285750600114612def57506107fc9250038261071c565b60025f90815291507f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b848310612e2d57506107fc9350015f612cc6565b805482840152859350602090920191600101612e19565b92607f1692612dbf565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016301480612f48575b15612eb6577f000000000000000000000000000000000000000000000000000000000000000090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f000000000000000000000000000000000000000000000000000000000000000060408201527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260a081526126f160c08261071c565b507f00000000000000000000000000000000000000000000000000000000000000004614612e8d565b9081602091031261010857516107fc81612114565b9073ffffffffffffffffffffffffffffffffffffffff612ff492165f8060405193612fb260408661071c565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af1612fee611c00565b91613344565b805190811591821561300a575b50501561010857565b61301d9250602080918301019101612f71565b5f80613001565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff9290921660248301526044808301939093529181526106d19161206360648361071c565b61308e611539565b6040516130a3816117e860208201809561176a565b5190209073ffffffffffffffffffffffffffffffffffffffff602082359201356130cc816102de565b60405192602084019485526040840152166060820152606081526126f160808261071c565b6130f96113f2565b6040516126f1816117e860208201809561176a565b6131166130f1565b9061312081610fca565b916020820135906040830135926060810161313a90610fca565b90608081013560a082013560c083013561315660e0850161126c565b91613164610100860161126c565b93613172610120870161126c565b95610140810161318191611276565b369061318c926107ab565b80519060200120966040519a8b9a60208c019d612c499b8f99979593919c9b9a98969492909c6101808b019d8b5273ffffffffffffffffffffffffffffffffffffffff1660208b015260408a0152606089015273ffffffffffffffffffffffffffffffffffffffff16608088015260a087015260c086015260e085015263ffffffff1661010084015263ffffffff1661012083015263ffffffff166101408201526101600152565b60ff811690601f8211613263576040519161325060408461071c565b6020808452838101919036833783525290565b7fb3512b0c000000000000000000000000000000000000000000000000000000005f5260045ffd5b9060418151145f146132b357611bea91602082015190606060408401519301515f1a906132bc565b50505f90600290565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411613339576020935f9360ff60809460405194855216868401526040830152606082015282805260015afa1561020f575f5173ffffffffffffffffffffffffffffffffffffffff81161561333157905f90565b505f90600190565b505050505f90600390565b9192501561336057815115613357575090565b3b156101085790565b50805190811561010857602001fdfea2646970667358221220c0aa13f751c576ba0deb892a2885a51d9a6d9598753672920a6f762298b2291564736f6c634300081e003360a034607a57601f610afc38819003918201601f19168301916001600160401b03831184841017607e57808492602094604052833981010312607a57516001600160a01b03811690819003607a5760015f55608052604051610a699081610093823960805181818161012b015281816105bc01526106b30152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe6080806040526004361015610012575f80fd5b5f905f3560e01c90816312261ee71461066b575080631626ba7e146105545763c0437b7c1461003f575f80fd5b346104a65760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a65760043573ffffffffffffffffffffffffffffffffffffffff81168091036104a6576024359073ffffffffffffffffffffffffffffffffffffffff82168092036104a6576044359060643573ffffffffffffffffffffffffffffffffffffffff8116918282036104a6576084359260038410156104a65760a43567ffffffffffffffff81116104a6576101049036906004016106d7565b92909160025f54146104a65760025f5573ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001680821461052c57899680610255575050509061016a85968587946107a3565b826040519384928337810182815203925af1610184610746565b501561022d57604051907f70a08231000000000000000000000000000000000000000000000000000000008252306004830152602082602481845afa9182156102225783926101e9575b506020926101e08360019333906108f0565b55604051908152f35b9091506020813d60201161021a575b8161020560209383610705565b8101031261021657519060206101ce565b8280fd5b3d91506101f8565b6040513d85823e3d90fd5b6004827f81ceff30000000000000000000000000000000000000000000000000000000008152fd5b60018103610273575050509061026e85968587946108f0565b61016a565b6002919392949698959750145f14610504576102908483836107a3565b60017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006002541617600255805f52600160205260405f20835f5260205260405f209081549165ffffffffffff83169265ffffffffffff84146104d7577fffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000166001840165ffffffffffff1617905560405194608086019167ffffffffffffffff8311878410176104aa5773ffffffffffffffffffffffffffffffffffffffff92604052865216602085015265ffffffffffff421660408501526060840152604051926060840184811067ffffffffffffffff8211176104aa5760405283526020830191825260408301428152813b156104a65765ffffffffffff935f6060936101249373ffffffffffffffffffffffffffffffffffffffff8397604051998a9889977f2b67b5700000000000000000000000000000000000000000000000000000000089523060048a0152518481511660248a01528460208201511660448a01528260408201511660648a01520151166084870152511660a48501525160c484015261010060e4840152816101048401525af1801561049b57610482575b50918492918380937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff006002541660025561016a565b61049191929395505f90610705565b5f9391905f61044d565b6040513d5f823e3d90fd5b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b7f4b26f70d000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f40892c33000000000000000000000000000000000000000000000000000000005f5260045ffd5b346104a65760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a65760243567ffffffffffffffff81116104a6576105a39036906004016106d7565b505073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001633148061065f575b156106375760207f1626ba7e000000000000000000000000000000000000000000000000000000005b7fffffffff0000000000000000000000000000000000000000000000000000000060405191168152f35b60207fffffffff0000000000000000000000000000000000000000000000000000000061060d565b5060ff600254166105e4565b346104a6575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126104a65760209073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b9181601f840112156104a65782359167ffffffffffffffff83116104a657602083818601950101116104a657565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176104aa57604052565b3d1561079e573d9067ffffffffffffffff82116104aa5760405191610793601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200184610705565b82523d5f602084013e565b606090565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000006020820190815273ffffffffffffffffffffffffffffffffffffffff841660248301526044808301959095529381529192610803606484610705565b5f8073ffffffffffffffffffffffffffffffffffffffff84169285519082855af19061082d610746565b826108be575b50816108b3575b501561084557505050565b6108ac6108b19373ffffffffffffffffffffffffffffffffffffffff604051917f095ea7b30000000000000000000000000000000000000000000000000000000060208401521660248201525f6044820152604481526108a6606482610705565b8261096a565b61096a565b565b90503b15155f61083a565b805191925081159182156108d6575b5050905f610833565b6108e99250602080918301019101610952565b5f806108cd565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff9290921660248301526044808301939093529181526108b1916108ac606483610705565b908160209103126104a6575180151581036104a65790565b9073ffffffffffffffffffffffffffffffffffffffff6109d892165f8060405193610996604086610705565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af16109d2610746565b91610a08565b80519081159182156109ee575b5050156104a657565b610a019250602080918301019101610952565b5f806109e5565b91925015610a2457815115610a1b575090565b3b156104a65790565b5080519081156104a657602001fdfea2646970667358221220692ab35a712c437c02cdb3d7cd7daa057cd3a307823bc589e912276373f8cffe64736f6c634300081e0033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3

Deployed Bytecode

0x60806040526004361015610011575f80fd5b5f3560e01c8063110560ad146100f457806312261ee7146100ef5780631542ce53146100ea578063191d0ffc146100e5578063501f1053146100e057806356da359a146100db578063656a20e6146100d65780636ec4be90146100d1578063805e1148146100cc57806384b0196e146100c7578063ac9650d8146100c2578063b3cfd79e146100bd578063d2aca1a4146100b85763f698da25146100b3575f80fd5b610f8a565b610d09565b610c5a565b610bca565b6109f8565b610909565b61089b565b6107ff565b610529565b61044b565b6103e4565b610338565b610270565b61010c565b90816101809103126101085790565b5f80fd5b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101085760043567ffffffffffffffff8111610108576101569036906004016100f9565b61015e611fed565b341561023c5760c081013534036102145761019a61018161018160608401610fca565b73ffffffffffffffffffffffffffffffffffffffff1690565b90813b15610108575f600492604051938480927fd0e30db000000000000000000000000000000000000000000000000000000000825234905af191821561020f576101ea926101f5575b506121b7565b6101f360015f55565b005b806102035f6102099361071c565b80610266565b5f6101e4565b610fd4565b7f1841b4e1000000000000000000000000000000000000000000000000000000005f5260045ffd5b8061026161025261018160606101ea9501610fca565b60c08301359030903390611ffc565b6121b7565b5f91031261010857565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857602060405173ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3168152f35b73ffffffffffffffffffffffffffffffffffffffff81160361010857565b908160c09103126101085790565b9181601f840112156101085782359167ffffffffffffffff8311610108576020838186019501011161010857565b346101085760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610373816102de565b60243567ffffffffffffffff8111610108576103939036906004016102fc565b6044359160643567ffffffffffffffff8111610108576103b790369060040161030a565b906084359467ffffffffffffffff8611610108576103dc6101f396369060040161030a565b959094610fdf565b346101085760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101085773ffffffffffffffffffffffffffffffffffffffff600435610434816102de565b165f526003602052602060405f2054604051908152f35b346101085760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610486816102de565b60243567ffffffffffffffff8111610108576104a69036906004016100f9565b6044359160643560843567ffffffffffffffff8111610108576104cd90369060040161030a565b9160a4359567ffffffffffffffff8711610108576104f26101f397369060040161030a565b9690956112c7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbc608091011261010857604490565b346101085760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610564816102de565b60243567ffffffffffffffff8111610108576105849036906004016100f9565b61058d366104fa565b9160c43567ffffffffffffffff8111610108576105ae90369060040161030a565b90916105b8611fed565b6105c184612b96565b948435936105d38560c088013561125a565b906105dc610762565b30815291602083015273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3169261062561177c565b843b15610108575f96879361066a926040519c8d998a9889977f137c29fe00000000000000000000000000000000000000000000000000000000895260048901611852565b03925af190811561020f576101ea93610261926106a1575b5061068f60608401610fca565b61069b60208501610fca565b90612543565b806102035f6106af9361071c565b5f610682565b63ffffffff81160361010857565b61010435906106d1826106b5565b565b61012435906106d1826106b5565b61014435906106d1826106b5565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff82111761075d57604052565b6106ef565b604051906106d160408361071c565b67ffffffffffffffff811161075d57601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b9291926107b782610771565b916107c5604051938461071c565b829481845281830111610108578281602093845f960137010152565b9080601f83011215610108578160206107fc933591016107ab565b90565b6101807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610836816102de565b60243590604435610846816102de565b60643560843560e43560c43560a43561085d6106c3565b936108666106d3565b9561086f6106e1565b97610164359a67ffffffffffffffff8c11610108576108956101f39c36906004016107e1565b9a61190e565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857602060405173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000004734e36f56f1a4acbacf61c03f7b773b631b95a3168152f35b346101085760a07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610944816102de565b60243567ffffffffffffffff8111610108576109649036906004016100f9565b6044359160643567ffffffffffffffff81116101085761098890369060040161030a565b906084359467ffffffffffffffff8611610108576109ad6101f396369060040161030a565b959094611a06565b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f602080948051918291828752018686015e5f8582860101520116010190565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857610af4610a527f4143524f53532d50455249504845525900000000000000000000000000000010612c79565b610a7b7f312e302e30000000000000000000000000000000000000000000000000000005612d96565b6020604051610a8a828261071c565b5f815281610b02818301947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe083013687376040519788977f0f00000000000000000000000000000000000000000000000000000000000000895260e0858a015260e08901906109b5565b9087820360408901526109b5565b914660608701523060808701525f60a087015285830360c087015251918281520192915f5b828110610b3657505050500390f35b835185528695509381019392810192600101610b27565b602081016020825282518091526040820191602060408360051b8301019401925f915b838310610b7f57505050505090565b9091929394602080610bbb837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0866001960301875289516109b5565b97019301930191939290610b70565b346101085760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101085760043567ffffffffffffffff811161010857366023820112156101085780600401359067ffffffffffffffff8211610108573660248360051b8301011161010857610c56916024610c4a9201611ca6565b60405191829182610b4d565b0390f35b346101085760c07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610c95816102de565b60243567ffffffffffffffff811161010857610cb59036906004016102fc565b6044359160643560843567ffffffffffffffff811161010857610cdc90369060040161030a565b9160a4359567ffffffffffffffff871161010857610d016101f397369060040161030a565b969095611d30565b346101085760e07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010857600435610d44816102de565b60243567ffffffffffffffff811161010857610d649036906004016102fc565b610d6d366104fa565b60c43567ffffffffffffffff811161010857610d8d90369060040161030a565b610d98949194611fed565b610da184612636565b91843593606086013596610db5868961125a565b90610dbe610762565b30815291602083015273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba31692610e07611f87565b843b15610108575f968793610e4c926040519a8b998a9889977f137c29fe00000000000000000000000000000000000000000000000000000000895260048901611852565b03925af1801561020f57610f76575b506040820190610e6b82846111fa565b610e7490610fca565b90610e8160208501610fca565b610e8a92612543565b610e9660808301610fca565b90610ea181846111fa565b606001610ead90610fca565b92610eb882826111fa565b6080013594610ec783836111fa565b610ed090610fca565b90610edb84846111fa565b6020013590610eea85856111fa565b60400135610ef886866111fa565b60a0013591610f0787876111fa565b60c0013593610f1688886111fa565b60e001610f229061126c565b95610f2d89896111fa565b61010001610f3a9061126c565b97610f458a826111fa565b61012001610f529061126c565b99610f5c916111fa565b6101408101610f6a91611276565b9b6101ea9d919b6128bb565b806102035f610f849361071c565b5f610e5b565b34610108575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610108576020610fc2612e4e565b604051908152f35b356107fc816102de565b6040513d5f823e3d90fd5b919293610ff49194610fef611fed565b6124e5565b6040869893979298019461101061100b87896111fa565b610fca565b9760608801359988359261102660208b01610fca565b946110318d8661125a565b9273ffffffffffffffffffffffffffffffffffffffff8d1694853b15610108576040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c16600482015230602482015260448101869052606481019490945260ff92909216608484015260a483019190915260c48201525f8160e48183875af16111e6575b508630906110db93611ffc565b6110e59188612543565b6110f360a0860135846125aa565b6110fc85612636565b611105936126f7565b61111160808301610fca565b9161111c82826111fa565b60600161112890610fca565b9361113383836111fa565b608001359561114284846111fa565b602001359061115185856111fa565b6040013561115f86866111fa565b60a001359161116e87876111fa565b60c001359361117d88886111fa565b60e0016111899061126c565b9561119489896111fa565b610100016111a19061126c565b976111ac8a826111fa565b610120016111b99061126c565b996111c3916111fa565b61014081016111d191611276565b9b6111dd9d919b6128bb565b6106d160015f55565b806102035f6111f49361071c565b5f6110ce565b9035907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffea181360301821215610108570190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b9190820180921161126757565b61122d565b356107fc816106b5565b9035907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe181360301821215610108570180359067ffffffffffffffff82116101085760200191813603831361010857565b919693946112da91969395610fef611fed565b95919787359860608901976112f46101816101818b610fca565b916113038c60c08d013561125a565b916101608c0135843b15610108576040517fef55bec600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a16600482015230602482015260448101949094526064840195909552608483019690965260a482019390935260ff90941660c485015260e48401919091526101048301919091525f90829061012490829084905af196871561020f576113c3610261966113cf936111dd9a6113de575b50610fca565b61069b60208901610fca565b6113d885612b96565b906126f7565b806102035f6113ec9361071c565b5f6113bd565b604051906114026101208361071c565b60f882527f506172616d657465722c6279746573206d657373616765290000000000000000610100837f426173654465706f73697444617461286164647265737320696e707574546f6b60208201527f656e2c62797465733332206f7574707574546f6b656e2c75696e74323536206f60408201527f7574707574416d6f756e742c61646472657373206465706f7369746f722c627960608201527f746573333220726563697069656e742c75696e743235362064657374696e617460808201527f696f6e436861696e49642c62797465733332206578636c757369766552656c6160a08201527f7965722c75696e7433322071756f746554696d657374616d702c75696e74333260c08201527f2066696c6c446561646c696e652c75696e743332206578636c7573697669747960e08201520152565b6040519061154860608361071c565b602682527f7069656e742900000000000000000000000000000000000000000000000000006040837f466565732875696e7432353620616d6f756e742c61646472657373207265636960208201520152565b604051906115aa6101408361071c565b61010c82527f6e74323536206e6f6e6365290000000000000000000000000000000000000000610120837f53776170416e644465706f736974446174612846656573207375626d6973736960208201527f6f6e466565732c426173654465706f73697444617461206465706f736974446160408201527f74612c616464726573732073776170546f6b656e2c616464726573732065786360608201527f68616e67652c75696e7438207472616e73666572547970652c75696e7432353660808201527f2073776170546f6b656e416d6f756e742c75696e74323536206d696e4578706560a08201527f63746564496e707574546f6b656e416d6f756e742c627974657320726f75746560c08201527f7243616c6c646174612c626f6f6c20656e61626c6550726f706f7274696f6e6160e08201527f6c41646a7573746d656e742c616464726573732073706f6b65506f6f6c2c75696101008201520152565b6040519061171860608361071c565b602e82527f696e7432353620616d6f756e74290000000000000000000000000000000000006040837f546f6b656e5065726d697373696f6e73286164647265737320746f6b656e2c7560208201520152565b805191908290602001825e015f815290565b6117e26107fc61178a6113f2565b6117e8611795611539565b6117e26117a061159a565b6117e26117ab611709565b936040519889977f53776170416e644465706f73697444617461207769746e65737329000000000060208a0152603b89019061176a565b9061176a565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810183528261071c565b601f82602094937fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe093818652868601375f8582860101520116010190565b9593906118ff9360206107fc99979460606118e69473ffffffffffffffffffffffffffffffffffffffff8135611887816102de565b168c5283810135848d0152604081013560408d0152013560608b015273ffffffffffffffffffffffffffffffffffffffff81511660808b0152015160a089015260c088019073ffffffffffffffffffffffffffffffffffffffff169052565b60e08601526101406101008601526101408501906109b5565b92610120818503910152611814565b73ffffffffffffffffffffffffffffffffffffffff80919c98949a969299959c9b97939b61193a611fed565b169a16988a3b15610108576040519b8c9a8b9a7fad5425c6000000000000000000000000000000000000000000000000000000008c523360048d015260248c015260448b015260648a0152608489015260a488015260c487015260e486015263ffffffff1661010485015263ffffffff1661012484015263ffffffff166101448301526101648201610180905261018482016119d5916109b5565b0381345a945f95f1801561020f576119f2575b506106d160015f55565b806102035f611a009361071c565b5f6119e8565b93611a179195929693610fef611fed565b94916060870135611a27816102de565b60c088013590883592611a46611a3f60208c01610fca565b938561125a565b73ffffffffffffffffffffffffffffffffffffffff8316803b15610108576040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8916600482015230602482015260448101839052606481019d909d5260ff9a909a1660848d015260a48c019190915260c48b01949094526111dd9961026198611b0595611b00929091905f8160e48183865af1611b14575b50873091611ffc565b612543565b6113cf610160860135826125aa565b806102035f611b229361071c565b5f611af7565b67ffffffffffffffff811161075d5760051b60200190565b90611b4a82611b28565b611b57604051918261071c565b8281527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0611b858294611b28565b01905f5b828110611b9557505050565b806060602080938501015201611b89565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b90821015611bee57611bea9160051b810190611276565b9091565b611ba6565b908092918237015f815290565b3d15611c2a573d90611c1182610771565b91611c1f604051938461071c565b82523d5f602084013e565b606090565b6020818303126101085780519067ffffffffffffffff8211610108570181601f8201121561010857805190611c6382610771565b92611c71604051948561071c565b8284526020838301011161010857815f9260208093018386015e8301015290565b8051821015611bee5760209160051b010190565b919091611cb283611b40565b925f5b818110611cc157505050565b5f80611cce838587611bd3565b90611cde60405180938193611bf3565b0390305af4611ceb611c00565b9015611d115790600191611cff8288611c92565b52611d0a8187611c92565b5001611cb5565b6044815110610108578060248060046101089401518301019101611c2f565b9390959196928695611d40611fed565b6060870135988735938492611d54916124e5565b9093918c60408c019b8c611d67916111fa565b611d7090610fca565b73ffffffffffffffffffffffffffffffffffffffff1693611d909161125a565b9160a08d0135843b15610108576040517fef55bec600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8d16600482015230602482015260448101949094526064840195909552608483019690965260a482019390935260ff90941660c485015260e48401919091526101048301919091525f90829061012490829084905af1801561020f57611ec6575b50611e4485876111fa565b611e4d90610fca565b90611e5a60208801610fca565b611e6392612543565b611e6c85612636565b611e75936126f7565b611e8160808301610fca565b90611e8c81846111fa565b606001611e9890610fca565b92611ea382826111fa565b6080013594611eb283836111fa565b611ebb90610fca565b9061114284846111fa565b806102035f611ed49361071c565b5f611e39565b60405190611ee960a08361071c565b607482527f65506f6f6c2c75696e74323536206e6f6e6365290000000000000000000000006080837f4465706f736974446174612846656573207375626d697373696f6e466565732c60208201527f426173654465706f7369744461746120626173654465706f736974446174612c60408201527f75696e7432353620696e707574416d6f756e742c616464726573732073706f6b60608201520152565b6117e26107fc611f956113f2565b6117e8611fa0611eda565b6117e2611fab611539565b6117e2611fb6611709565b936040519889977f4465706f73697444617461207769746e6573732900000000000000000000000060208a0152603489019061176a565b60025f54146101085760025f55565b90919273ffffffffffffffffffffffffffffffffffffffff6106d19481604051957f23b872dd00000000000000000000000000000000000000000000000000000000602088015216602486015216604484015260648301526064825261206360848361071c565b612f86565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b3560038110156101085790565b90816020910312610108575190565b9060038210156120be5752565b612068565b9260c09473ffffffffffffffffffffffffffffffffffffffff918261210795816107fc9c9a96168852166020870152604086015216606084015260808301906120b1565b8160a08201520191611814565b8015150361010857565b356107fc81612114565b8181029291811591840414171561126757565b8115612145570490565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b92916080949796959273ffffffffffffffffffffffffffffffffffffffff6121a89316855260a0602086015260a0850191611814565b95604083015260608201520152565b6121c360608201610fca565b73ffffffffffffffffffffffffffffffffffffffff16604082016121e781846111fa565b6121f090610fca565b73ffffffffffffffffffffffffffffffffffffffff169061221360808501610fca565b9360c0810135857f0000000000000000000000004734e36f56f1a4acbacf61c03f7b773b631b95a373ffffffffffffffffffffffffffffffffffffffff169561225d838883613024565b73ffffffffffffffffffffffffffffffffffffffff958616951661228360a08501612095565b9683878361010088019a6122978c8a611276565b916040519e8f9687967fc0437b7c00000000000000000000000000000000000000000000000000000000885260048801966122d1976120c3565b03815a6020945f91f197881561020f575f986124b4575b5060e08401359182891061248c57821561246457869261230b610120870161211e565b1561244c5761233361233b9161232e8c60406123278c8c6111fa565b0135612128565b61213b565b985b86611276565b91898b6123488a8a6111fa565b602001359760405195869561235d9587612172565b037f32da500ab49223322bf87d13ba63ef4e5efd139c75f982183d27f59fc31fb25091a461238e6101408201610fca565b9261239983836111fa565b6060016123a590610fca565b946123b084846111fa565b60800135966123bf85856111fa565b60200135916123ce86866111fa565b60a00135916123dd87876111fa565b60c00135936123ec88886111fa565b60e0016123f89061126c565b9561240389896111fa565b610100016124109061126c565b9761241b8a826111fa565b610120016124289061126c565b99612432916111fa565b610140810161244091611276565b9b6106d19d919b6128bb565b5061233b604061245c88886111fa565b013598612335565b7f2d696302000000000000000000000000000000000000000000000000000000005f5260045ffd5b7f0492ff87000000000000000000000000000000000000000000000000000000005f5260045ffd5b6124d791985060203d6020116124de575b6124cf818361071c565b8101906120a2565b965f6122e8565b503d6124c5565b9190916041830361251b578260401015611bee57604081013560f81c908360201161010857803593604011610108576020013591565b7f8baa579f000000000000000000000000000000000000000000000000000000005f5260045ffd5b9190918161255057505050565b6106d19273ffffffffffffffffffffffffffffffffffffffff811661258e575073ffffffffffffffffffffffffffffffffffffffff33915b16613024565b73ffffffffffffffffffffffffffffffffffffffff9091612588565b73ffffffffffffffffffffffffffffffffffffffff1690815f52600360205260405f20540361260e575f52600360205260405f2080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611267576001019055565b7f756688fe000000000000000000000000000000000000000000000000000000005f5260045ffd5b61263e611eda565b6117e261266b61264c6113f2565b6117e8612657611539565b6040519485936117e260208601809961176a565b5190209061267881613086565b9073ffffffffffffffffffffffffffffffffffffffff6126a361269e60408401846111fa565b61310e565b91606081013560a06080830135926126ba846102de565b01359360405195602087019788526040870152606086015260808501521660a083015260c082015260c081526126f160e08261071c565b51902090565b9291604261274292612707612e4e565b90604051917f1901000000000000000000000000000000000000000000000000000000000000835260028301526022820152209236916107ab565b9161274d838361328b565b60058194929410156120be57159283612833575b508215612775575b50501590505b61251b57565b5f938493506127c56117e89160405192839160208301957f1626ba7e00000000000000000000000000000000000000000000000000000000875260248401526040604484015260648301906109b5565b51915afa6127d1611c00565b9080612827575b806127ea575b61276f91505f80612769565b50602081805181010312610108577f1626ba7e00000000000000000000000000000000000000000000000000000000602061276f920151146127de565b506020815110156127d8565b73ffffffffffffffffffffffffffffffffffffffff83811691161492505f612761565b9892956101809a9563ffffffff9993956107fc9f9d9993988b999760208e8c9a8152015260408d015260608c015260808b015260a08a015260c089015260e0880152166101008601521661012084015216610140820152816101608201520191611814565b6101816129be859b969f9a95889e99949f9a959d986129d89473ffffffffffffffffffffffffffffffffffffffff91826101819416905f806040519261297f8461295360208201937f095ea7b300000000000000000000000000000000000000000000000000000000855289602484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810186528561071c565b83519082865af161298e611c00565b81612ab3575b5080612aa9575b15612a3b575b5050169f73ffffffffffffffffffffffffffffffffffffffff1690565b9a73ffffffffffffffffffffffffffffffffffffffff1690565b9a8c3b15610108576040517fad5425c60000000000000000000000000000000000000000000000000000000081529d8e9c8d9c612a189c60048f01612856565b03815a5f948591f1801561020f57612a2d5750565b806102035f6106d19361071c565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff841660248201525f6044820152612aa2929061206390612a9c81606481016117e8565b82612f86565b5f806129a1565b50813b151561299b565b8051801592508215612ac8575b50505f612994565b612adb9250602080918301019101612f71565b5f80612ac0565b612aea61159a565b6117e26126f161264c6113f2565b99979593919c9b9a98969492909c6101808b019d8b5260208b015260408a015273ffffffffffffffffffffffffffffffffffffffff16606089015273ffffffffffffffffffffffffffffffffffffffff16608088015260a08701612b5b916120b1565b60c086015260e0850152610100840152151561012083015273ffffffffffffffffffffffffffffffffffffffff166101408201526101600152565b612b9e612ae2565b90612ba881613086565b91612bb660408301836111fa565b612bbf9061310e565b90612bcc60608401610fca565b92612bd960808201610fca565b90612be660a08201612095565b60c082013560e0830135612bfe610100850185611276565b3690612c09926107ab565b80519060200120916101208501612c1f9061211e565b93612c2d6101408701610fca565b956101600135966040519a8b9a60208c019d612c499b8f612af8565b037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0810182526126f1908261071c565b60ff8114612c8a576107fc90613234565b506040515f6001548060011c91600182168015612d8c575b602084108114612d5f5783855284926020840191908115612d285750600114612cd3575b506107fc9250038261071c565b60015f90815291507fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b848310612d1157506107fc9350015f612cc6565b805482840152859350602090920191600101612cfd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168252506107fc93151560051b0190505f612cc6565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b92607f1692612ca2565b60ff8114612da7576107fc90613234565b506040515f6002548060011c91600182168015612e44575b602084108114612d5f5783855284926020840191908115612d285750600114612def57506107fc9250038261071c565b60025f90815291507f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace5b848310612e2d57506107fc9350015f612cc6565b805482840152859350602090920191600101612e19565b92607f1692612dbf565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000e9b0666dffc176df6686726cb9aac78fd83d20d716301480612f48575b15612eb6577f45a7637009e3cec840496ee723ce144a4c4373a68755d29e8bfc1c65b52d58b090565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527fafd5622567c84701f37e83c885d8754f537c255908e4a737decee493a17d951460408201527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808201523060a082015260a081526126f160c08261071c565b507f000000000000000000000000000000000000000000000000000000000000008f4614612e8d565b9081602091031261010857516107fc81612114565b9073ffffffffffffffffffffffffffffffffffffffff612ff492165f8060405193612fb260408661071c565b602085527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564602086015260208151910182855af1612fee611c00565b91613344565b805190811591821561300a575b50501561010857565b61301d9250602080918301019101612f71565b5f80613001565b6040517fa9059cbb00000000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff9290921660248301526044808301939093529181526106d19161206360648361071c565b61308e611539565b6040516130a3816117e860208201809561176a565b5190209073ffffffffffffffffffffffffffffffffffffffff602082359201356130cc816102de565b60405192602084019485526040840152166060820152606081526126f160808261071c565b6130f96113f2565b6040516126f1816117e860208201809561176a565b6131166130f1565b9061312081610fca565b916020820135906040830135926060810161313a90610fca565b90608081013560a082013560c083013561315660e0850161126c565b91613164610100860161126c565b93613172610120870161126c565b95610140810161318191611276565b369061318c926107ab565b80519060200120966040519a8b9a60208c019d612c499b8f99979593919c9b9a98969492909c6101808b019d8b5273ffffffffffffffffffffffffffffffffffffffff1660208b015260408a0152606089015273ffffffffffffffffffffffffffffffffffffffff16608088015260a087015260c086015260e085015263ffffffff1661010084015263ffffffff1661012083015263ffffffff166101408201526101600152565b60ff811690601f8211613263576040519161325060408461071c565b6020808452838101919036833783525290565b7fb3512b0c000000000000000000000000000000000000000000000000000000005f5260045ffd5b9060418151145f146132b357611bea91602082015190606060408401519301515f1a906132bc565b50505f90600290565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411613339576020935f9360ff60809460405194855216868401526040830152606082015282805260015afa1561020f575f5173ffffffffffffffffffffffffffffffffffffffff81161561333157905f90565b505f90600190565b505050505f90600390565b9192501561336057815115613357575090565b3b156101085790565b50805190811561010857602001fdfea2646970667358221220c0aa13f751c576ba0deb892a2885a51d9a6d9598753672920a6f762298b2291564736f6c634300081e0033

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

000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3

-----Decoded View---------------
Arg [0] : _permit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3


Block Transaction 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
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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