ETH Price: $3,412.50 (+1.62%)
Gas: 6 Gwei

Contract

0x1dD057d8Ece7Bcfb16daCD0C0449DB088e1eC2c2
 
Transaction Hash
Method
Block
From
To
Execute Swap203103022024-07-15 7:04:2324 hrs ago1721027063IN
0x1dD057d8...88e1eC2c2
0 ETH0.000693572.60603316
Execute Swap Wit...203102902024-07-15 7:01:5924 hrs ago1721026919IN
0x1dD057d8...88e1eC2c2
0 ETH0.000870823.0552527
Execute Swap203102742024-07-15 6:58:4724 hrs ago1721026727IN
0x1dD057d8...88e1eC2c2
0 ETH0.001027084.47926897
Execute Swap203102502024-07-15 6:53:5924 hrs ago1721026439IN
0x1dD057d8...88e1eC2c2
0 ETH0.00012363.68902355
Execute Swap203102502024-07-15 6:53:5924 hrs ago1721026439IN
0x1dD057d8...88e1eC2c2
0 ETH0.00078023.06105405
Execute Swap Wit...202837972024-07-11 14:14:594 days ago1720707299IN
0x1dD057d8...88e1eC2c2
0 ETH0.002547787.73632899
Execute Swap Wit...202822122024-07-11 8:57:114 days ago1720688231IN
0x1dD057d8...88e1eC2c2
0 ETH0.001132553.92994311
Execute Swap Wit...202821932024-07-11 8:53:234 days ago1720688003IN
0x1dD057d8...88e1eC2c2
0 ETH0.001086364.35391882
Execute Swap202805512024-07-11 3:22:595 days ago1720668179IN
0x1dD057d8...88e1eC2c2
0.036 ETH0.001297595.06200912
Execute Swap Wit...202802242024-07-11 2:17:235 days ago1720664243IN
0x1dD057d8...88e1eC2c2
0 ETH0.000675592.4175846
Execute Swap Wit...202761212024-07-10 12:32:475 days ago1720614767IN
0x1dD057d8...88e1eC2c2
0 ETH0.001847346.70580435
Execute Swap202746962024-07-10 7:46:355 days ago1720597595IN
0x1dD057d8...88e1eC2c2
0.05 ETH0.000771724.1218954
Execute Swap Wit...202613132024-07-08 10:52:117 days ago1720435931IN
0x1dD057d8...88e1eC2c2
0 ETH0.001025642.36843951
Execute Swap Wit...202384132024-07-05 6:07:5911 days ago1720159679IN
0x1dD057d8...88e1eC2c2
0 ETH0.0031723312.24510375
Execute Swap202341582024-07-04 15:51:3511 days ago1720108295IN
0x1dD057d8...88e1eC2c2
0 ETH0.0031479210.03089232
Execute Swap202324972024-07-04 10:16:5911 days ago1720088219IN
0x1dD057d8...88e1eC2c2
0.1 ETH0.001913969.37088391
Execute Swap202305522024-07-04 3:45:5912 days ago1720064759IN
0x1dD057d8...88e1eC2c2
0 ETH0.000786082.56848627
Execute Swap202173812024-07-02 7:36:5913 days ago1719905819IN
0x1dD057d8...88e1eC2c2
0 ETH0.001213554.83754451
Execute Swap202173012024-07-02 7:20:3513 days ago1719904835IN
0x1dD057d8...88e1eC2c2
0.003 ETH0.000735633.01405476
Execute Swap202171682024-07-02 6:53:4714 days ago1719903227IN
0x1dD057d8...88e1eC2c2
0 ETH0.000511752.04149834
Execute Swap202171522024-07-02 6:50:3514 days ago1719903035IN
0x1dD057d8...88e1eC2c2
0.003 ETH0.000600332.3722999
Execute Swap201884402024-06-28 6:37:5918 days ago1719556679IN
0x1dD057d8...88e1eC2c2
0.018 ETH0.000559082.7378393
Execute Swap201884292024-06-28 6:35:4718 days ago1719556547IN
0x1dD057d8...88e1eC2c2
0.018 ETH0.000459392.45511258
Execute Swap Wit...201814962024-06-27 7:21:1118 days ago1719472871IN
0x1dD057d8...88e1eC2c2
0 ETH0.001403363.89246406
Execute Swap Wit...201749142024-06-26 9:17:5919 days ago1719393479IN
0x1dD057d8...88e1eC2c2
0 ETH0.000856753.13622471
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
202837972024-07-11 14:14:594 days ago1720707299
0x1dD057d8...88e1eC2c2
0.02708415 ETH
202837972024-07-11 14:14:594 days ago1720707299
0x1dD057d8...88e1eC2c2
0.02708415 ETH
202805512024-07-11 3:22:595 days ago1720668179
0x1dD057d8...88e1eC2c2
0.036 ETH
202802242024-07-11 2:17:235 days ago1720664243
0x1dD057d8...88e1eC2c2
0.00598144 ETH
202802242024-07-11 2:17:235 days ago1720664243
0x1dD057d8...88e1eC2c2
0.00598144 ETH
202761212024-07-10 12:32:475 days ago1720614767
0x1dD057d8...88e1eC2c2
0.00264105 ETH
202761212024-07-10 12:32:475 days ago1720614767
0x1dD057d8...88e1eC2c2
0.00264105 ETH
202746962024-07-10 7:46:355 days ago1720597595
0x1dD057d8...88e1eC2c2
0.05 ETH
202613132024-07-08 10:52:117 days ago1720435931
0x1dD057d8...88e1eC2c2
0.03143331 ETH
202613132024-07-08 10:52:117 days ago1720435931
0x1dD057d8...88e1eC2c2
0.03143331 ETH
202384132024-07-05 6:07:5911 days ago1720159679
0x1dD057d8...88e1eC2c2
0.10495631 ETH
202384132024-07-05 6:07:5911 days ago1720159679
0x1dD057d8...88e1eC2c2
0.10495631 ETH
202341582024-07-04 15:51:3511 days ago1720108295
0x1dD057d8...88e1eC2c2
0.09979847 ETH
202324972024-07-04 10:16:5911 days ago1720088219
0x1dD057d8...88e1eC2c2
0.1 ETH
202305522024-07-04 3:45:5912 days ago1720064759
0x1dD057d8...88e1eC2c2
0.00615909 ETH
202305522024-07-04 3:45:5912 days ago1720064759
0x1dD057d8...88e1eC2c2
0.00615909 ETH
202173012024-07-02 7:20:3513 days ago1719904835
0x1dD057d8...88e1eC2c2
0.003 ETH
202171682024-07-02 6:53:4714 days ago1719903227
0x1dD057d8...88e1eC2c2
0.00297423 ETH
202171682024-07-02 6:53:4714 days ago1719903227
0x1dD057d8...88e1eC2c2
0.00297423 ETH
202171522024-07-02 6:50:3514 days ago1719903035
0x1dD057d8...88e1eC2c2
0.003 ETH
201884402024-06-28 6:37:5918 days ago1719556679
0x1dD057d8...88e1eC2c2
0.018 ETH
201884292024-06-28 6:35:4718 days ago1719556547
0x1dD057d8...88e1eC2c2
0.018 ETH
201814962024-06-27 7:21:1118 days ago1719472871
0x1dD057d8...88e1eC2c2
0.02824573 ETH
201814962024-06-27 7:21:1118 days ago1719472871
0x1dD057d8...88e1eC2c2
0.02824573 ETH
201582022024-06-24 1:15:3522 days ago1719191735
0x1dD057d8...88e1eC2c2
0.02 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GenericSwap

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 1000 runs

Other Settings:
london EvmVersion
File 1 of 20 : GenericSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { TokenCollector } from "./abstracts/TokenCollector.sol";
import { EIP712 } from "./abstracts/EIP712.sol";
import { IGenericSwap } from "./interfaces/IGenericSwap.sol";
import { IStrategy } from "./interfaces/IStrategy.sol";
import { GenericSwapData, getGSDataHash } from "./libraries/GenericSwapData.sol";
import { Asset } from "./libraries/Asset.sol";
import { SignatureValidator } from "./libraries/SignatureValidator.sol";

contract GenericSwap is IGenericSwap, TokenCollector, EIP712 {
    using Asset for address;

    mapping(bytes32 => bool) private filledSwap;

    constructor(address _uniswapPermit2, address _allowanceTarget) TokenCollector(_uniswapPermit2, _allowanceTarget) {}

    receive() external payable {}

    /// @param swapData Swap data
    /// @return returnAmount Output amount of the swap
    function executeSwap(GenericSwapData calldata swapData, bytes calldata takerTokenPermit) external payable override returns (uint256 returnAmount) {
        returnAmount = _executeSwap(swapData, msg.sender, takerTokenPermit);

        _emitGSExecuted(getGSDataHash(swapData), swapData, msg.sender, returnAmount);
    }

    /// @param swapData Swap data
    /// @param taker Claimed taker address
    /// @param takerSig Taker signature
    /// @return returnAmount Output amount of the swap
    function executeSwapWithSig(
        GenericSwapData calldata swapData,
        bytes calldata takerTokenPermit,
        address taker,
        bytes calldata takerSig
    ) external payable override returns (uint256 returnAmount) {
        bytes32 swapHash = getGSDataHash(swapData);
        bytes32 gs712Hash = getEIP712Hash(swapHash);
        if (filledSwap[swapHash]) revert AlreadyFilled();
        filledSwap[swapHash] = true;
        if (!SignatureValidator.validateSignature(taker, gs712Hash, takerSig)) revert InvalidSignature();

        returnAmount = _executeSwap(swapData, taker, takerTokenPermit);

        _emitGSExecuted(swapHash, swapData, taker, returnAmount);
    }

    function _executeSwap(
        GenericSwapData calldata _swapData,
        address _authorizedUser,
        bytes calldata _takerTokenPermit
    ) private returns (uint256 returnAmount) {
        if (_swapData.expiry < block.timestamp) revert ExpiredOrder();
        if (_swapData.recipient == address(0)) revert ZeroAddress();

        address _inputToken = _swapData.takerToken;
        address _outputToken = _swapData.makerToken;

        if (_inputToken.isETH()) {
            if (msg.value != _swapData.takerTokenAmount) revert InvalidMsgValue();
        } else {
            if (msg.value != 0) revert InvalidMsgValue();
            _collect(_inputToken, _authorizedUser, _swapData.maker, _swapData.takerTokenAmount, _takerTokenPermit);
        }

        IStrategy(_swapData.maker).executeStrategy{ value: msg.value }(_inputToken, _outputToken, _swapData.takerTokenAmount, _swapData.strategyData);

        returnAmount = _outputToken.getBalance(address(this));
        if (returnAmount > 1) {
            unchecked {
                --returnAmount;
            }
        }
        if (returnAmount < _swapData.minMakerTokenAmount) revert InsufficientOutput();

        _outputToken.transferTo(_swapData.recipient, returnAmount);
    }

    function _emitGSExecuted(bytes32 _gsOfferHash, GenericSwapData calldata _swapData, address _taker, uint256 returnAmount) internal {
        emit Swap(
            _gsOfferHash,
            _swapData.maker,
            _taker,
            _swapData.recipient,
            _swapData.takerToken,
            _swapData.takerTokenAmount,
            _swapData.makerToken,
            returnAmount,
            _swapData.salt
        );
    }
}

File 2 of 20 : TokenCollector.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { IERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import { IUniswapPermit2 } from "../interfaces/IUniswapPermit2.sol";
import { IAllowanceTarget } from "../interfaces/IAllowanceTarget.sol";

abstract contract TokenCollector {
    using SafeERC20 for IERC20;

    error Permit2DataEmpty();

    enum Source {
        TokenlonAllowanceTarget,
        Token,
        TokenPermit,
        Permit2AllowanceTransfer,
        Permit2SignatureTransfer
    }

    address public immutable permit2;
    address public immutable allowanceTarget;

    constructor(address _permit2, address _allowanceTarget) {
        permit2 = _permit2;
        allowanceTarget = _allowanceTarget;
    }

    function _collect(address token, address from, address to, uint256 amount, bytes calldata data) internal {
        Source src = Source(uint8(data[0]));

        if (src == Source.TokenlonAllowanceTarget) {
            return IAllowanceTarget(allowanceTarget).spendFromUserTo(from, token, to, amount);
        } else if (src == Source.Token) {
            return IERC20(token).safeTransferFrom(from, to, amount);
        } else if (src == Source.TokenPermit) {
            (bool success, bytes memory result) = token.call(abi.encodePacked(IERC20Permit.permit.selector, data[1:]));
            if (!success) {
                assembly {
                    revert(add(result, 32), returndatasize())
                }
            }
            return IERC20(token).safeTransferFrom(from, to, amount);
        } else if (src == Source.Permit2AllowanceTransfer) {
            bytes memory permit2Data = data[1:];
            if (permit2Data.length > 0) {
                (bool success, bytes memory result) = permit2.call(abi.encodePacked(IUniswapPermit2.permit.selector, permit2Data));
                if (!success) {
                    assembly {
                        revert(add(result, 32), returndatasize())
                    }
                }
            }
            return IUniswapPermit2(permit2).transferFrom(from, to, uint160(amount), token);
        } else if (src == Source.Permit2SignatureTransfer) {
            bytes memory permit2Data = data[1:];
            if (permit2Data.length == 0) revert Permit2DataEmpty();
            (uint256 nonce, uint256 deadline, bytes memory permitSig) = abi.decode(permit2Data, (uint256, uint256, bytes));
            IUniswapPermit2.PermitTransferFrom memory permit = IUniswapPermit2.PermitTransferFrom({
                permitted: IUniswapPermit2.TokenPermissions({ token: token, amount: amount }),
                nonce: nonce,
                deadline: deadline
            });
            IUniswapPermit2.SignatureTransferDetails memory detail = IUniswapPermit2.SignatureTransferDetails({ to: to, requestedAmount: amount });
            return IUniswapPermit2(permit2).permitTransferFrom(permit, detail, from, permitSig);
        }

        // won't be reached
        revert();
    }
}

File 3 of 20 : EIP712.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

abstract contract EIP712 {
    // EIP-191 Header
    string public constant EIP191_HEADER = "\x19\x01";

    // EIP-712 Domain
    string public constant EIP712_NAME = "Tokenlon";
    string public constant EIP712_VERSION = "v6";
    bytes32 public constant EIP712_TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
    bytes32 private constant EIP712_HASHED_NAME = keccak256(bytes(EIP712_NAME));
    bytes32 private constant EIP712_HASHED_VERSION = keccak256(bytes(EIP712_VERSION));

    uint256 public immutable originalChainId;
    bytes32 public immutable originalEIP712DomainSeparator;

    constructor() {
        originalChainId = block.chainid;
        originalEIP712DomainSeparator = _buildDomainSeparator();
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(EIP712_TYPE_HASH, EIP712_HASHED_NAME, EIP712_HASHED_VERSION, block.chainid, address(this)));
    }

    function _getDomainSeparator() private view returns (bytes32) {
        if (block.chainid == originalChainId) {
            return originalEIP712DomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function getEIP712Hash(bytes32 structHash) internal view returns (bytes32) {
        return keccak256(abi.encodePacked(EIP191_HEADER, _getDomainSeparator(), structHash));
    }

    function EIP712_DOMAIN_SEPARATOR() external view returns (bytes32) {
        return _getDomainSeparator();
    }
}

File 4 of 20 : IGenericSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

import { GenericSwapData } from "../libraries/GenericSwapData.sol";

interface IGenericSwap {
    error AlreadyFilled();
    error InvalidMsgValue();
    error InsufficientOutput();
    error InvalidSignature();
    error ExpiredOrder();
    error ZeroAddress();

    event Swap(
        bytes32 indexed swapHash,
        address indexed maker,
        address indexed taker,
        address recipient,
        address inputToken,
        uint256 inputAmount,
        address outputToken,
        uint256 outputAmount,
        uint256 salt
    );

    function executeSwap(GenericSwapData calldata swapData, bytes calldata takerTokenPermit) external payable returns (uint256 returnAmount);

    function executeSwapWithSig(
        GenericSwapData calldata swapData,
        bytes calldata takerTokenPermit,
        address taker,
        bytes calldata takerSig
    ) external payable returns (uint256 returnAmount);
}

File 5 of 20 : IStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/// @title IStrategy Interface
/// @author imToken Labs
interface IStrategy {
    function executeStrategy(address inputToken, address outputToken, uint256 inputAmount, bytes calldata data) external payable;
}

File 6 of 20 : GenericSwapData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

string constant GS_DATA_TYPESTRING = string(
    "GenericSwapData(address maker,address takerToken,uint256 takerTokenAmount,address makerToken,uint256 makerTokenAmount,uint256 minMakerTokenAmount,uint256 expiry,uint256 salt,address recipient,bytes strategyData)"
);

bytes32 constant GS_DATA_TYPEHASH = keccak256(bytes(GS_DATA_TYPESTRING));

struct GenericSwapData {
    address payable maker;
    address takerToken;
    uint256 takerTokenAmount;
    address makerToken;
    uint256 makerTokenAmount;
    uint256 minMakerTokenAmount;
    uint256 expiry;
    uint256 salt;
    address payable recipient;
    bytes strategyData;
}

// solhint-disable-next-line func-visibility
// free functions cannot have function visibility
function getGSDataHash(GenericSwapData memory gsData) pure returns (bytes32) {
    return
        keccak256(
            abi.encode(
                GS_DATA_TYPEHASH,
                gsData.maker,
                gsData.takerToken,
                gsData.takerTokenAmount,
                gsData.makerToken,
                gsData.makerTokenAmount,
                gsData.minMakerTokenAmount,
                gsData.expiry,
                gsData.salt,
                gsData.recipient,
                keccak256(gsData.strategyData)
            )
        );
}

File 7 of 20 : Asset.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import { Constant } from "./Constant.sol";

library Asset {
    using SafeERC20 for IERC20;

    error InsufficientBalance();

    function isETH(address addr) internal pure returns (bool) {
        return (addr == Constant.ETH_ADDRESS || addr == Constant.ZERO_ADDRESS);
    }

    function getBalance(address asset, address owner) internal view returns (uint256) {
        if (isETH(asset)) {
            return owner.balance;
        } else {
            return IERC20(asset).balanceOf(owner);
        }
    }

    function transferTo(address asset, address payable to, uint256 amount) internal {
        if (to == address(this) || amount == 0) {
            return;
        }
        if (isETH(asset)) {
            // @dev forward all available gas and may cause reentrancy
            if (address(this).balance < amount) revert InsufficientBalance();
            (bool success, bytes memory result) = to.call{ value: amount }("");
            if (!success) {
                assembly {
                    revert(add(result, 32), mload(result))
                }
            }
        } else {
            IERC20(asset).safeTransfer(to, amount);
        }
    }
}

File 8 of 20 : SignatureValidator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { ECDSA } from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";

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

library SignatureValidator {
    using Address for address;

    // bytes4(keccak256("isValidSignature(bytes32,bytes)"))
    bytes4 internal constant ERC1271_MAGICVALUE = 0x1626ba7e;

    /**
     * @dev Verifies that a hash has been signed by the given signer.
     * @param _signerAddress  Address that should have signed the given hash.
     * @param _hash           Hash of the EIP-712 encoded data
     * @param _signature      Proof that the hash has been signed by signer.
     * @return True if the address recovered from the provided signature matches the input signer address.
     */
    function validateSignature(address _signerAddress, bytes32 _hash, bytes memory _signature) internal view returns (bool) {
        if (_signerAddress.isContract()) {
            return ERC1271_MAGICVALUE == IERC1271Wallet(_signerAddress).isValidSignature(_hash, _signature);
        } else {
            return _signerAddress == ECDSA.recover(_hash, _signature);
        }
    }
}

File 9 of 20 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

File 10 of 20 : IERC20.sol
// 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);
}

File 11 of 20 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    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));
    }
}

File 12 of 20 : IUniswapPermit2.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IUniswapPermit2 {
    /// @notice Thrown when an allowance on a token has expired.
    /// @param deadline The timestamp at which the allowed amount is no longer valid
    error AllowanceExpired(uint256 deadline);

    /// @notice Thrown when an allowance on a token has been depleted.
    /// @param amount The maximum amount allowed
    error InsufficientAllowance(uint256 amount);

    /// @notice Thrown when the requested amount for a transfer is larger than the permissioned amount
    /// @param maxAmount The maximum amount a spender can request to transfer
    error InvalidAmount(uint256 maxAmount);

    /// @notice Thrown when validating that the inputted nonce has not been used
    error InvalidNonce();

    /// @notice Thrown when the recovered signer does not equal the claimedSigner
    error InvalidSigner();

    /// @notice Thrown when validating an inputted signature that is stale
    /// @param signatureDeadline The timestamp at which a signature is no longer valid
    error SignatureExpired(uint256 signatureDeadline);

    /*
     * Allowance Transfer
     */

    /// @notice The permit data for a token
    struct PermitDetails {
        // ERC20 token address
        address token;
        // the maximum amount allowed to spend
        uint160 amount;
        // timestamp at which a spender's token allowances become invalid
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice The permit message signed for a single token allownce
    struct PermitSingle {
        // the permit data for a single token alownce
        PermitDetails details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice Returns the domain separator for the current chain.
    /// @dev Uses cached version if chainid and address are unchanged from construction.
    function DOMAIN_SEPARATOR() external view returns (bytes32);

    /// @notice A mapping from owner address to token address to spender address to PackedAllowance struct, which contains details and conditions of the approval.
    /// @notice The mapping is indexed in the above order see: allowance[ownerAddress][tokenAddress][spenderAddress]
    /// @dev The packed slot holds the allowed amount, expiration at which the allowed amount is no longer valid, and current nonce thats updated on any signature based approvals.
    function allowance(address user, address token, address spender) external view returns (uint160 amount, uint48 expiration, uint48 nonce);

    /// @notice Permit a spender to a given amount of the owners token via the owner's EIP-712 signature
    /// @dev May fail if the owner's nonce was invalidated in-flight by invalidateNonce
    /// @param owner The owner of the tokens being approved
    /// @param permitSingle Data signed over by the owner specifying the terms of approval
    /// @param signature The owner's signature over the permit data
    function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;

    /// @notice Transfer approved tokens from one address to another
    /// @param from The address to transfer from
    /// @param to The address of the recipient
    /// @param amount The amount of the token to transfer
    /// @param token The token address to transfer
    /// @dev Requires the from address to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(address from, address to, uint160 amount, address token) external;

    /// @notice Approves the spender to use up to amount of the specified token up until the expiration
    /// @param token The token to approve
    /// @param spender The spender address to approve
    /// @param amount The approved amount of the token
    /// @param expiration The timestamp at which the approval is no longer valid
    /// @dev The packed allowance also holds a nonce, which will stay unchanged in approve
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    function approve(address token, address spender, uint160 amount, uint48 expiration) external;

    /*
     * Signature Transfer
     */

    /// @notice The token and amount details for a transfer signed in the permit transfer signature
    struct TokenPermissions {
        // ERC20 token address
        address token;
        // the maximum amount that can be spent
        uint256 amount;
    }

    /// @notice The signed permit message for a single token transfer
    struct PermitTransferFrom {
        TokenPermissions permitted;
        // a unique value for every token owner's signature to prevent signature replays
        uint256 nonce;
        // deadline on the permit signature
        uint256 deadline;
    }

    /// @notice Specifies the recipient address and amount for batched transfers.
    /// @dev Recipients and amounts correspond to the index of the signed token permissions array.
    /// @dev Reverts if the requested amount is greater than the permitted signed amount.
    struct SignatureTransferDetails {
        // recipient address
        address to;
        // spender requested amount
        uint256 requestedAmount;
    }

    /// @notice Transfers a token using a signed permit message
    /// @dev Reverts if the requested amount is greater than the permitted signed amount
    /// @param permit The permit data signed over by the owner
    /// @param owner The owner of the tokens to transfer
    /// @param transferDetails The spender's requested transfer details for the permitted token
    /// @param signature The signature to verify
    function permitTransferFrom(
        PermitTransferFrom memory permit,
        SignatureTransferDetails calldata transferDetails,
        address owner,
        bytes calldata signature
    ) external;
}

File 13 of 20 : IAllowanceTarget.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

/// @title IAllowanceTarget Interface
/// @author imToken Labs
interface IAllowanceTarget {
    error NotAuthorized();

    /// @dev Spend tokens on user's behalf. Only an authority can call this.
    /// @param  from The user to spend token from.
    /// @param  token The address of the token.
    /// @param  to The recipient of the trasnfer.
    /// @param  amount Amount to spend.
    function spendFromUserTo(address from, address token, address to, uint256 amount) external;
}

File 14 of 20 : Constant.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Constant {
    uint16 internal constant BPS_MAX = 10000;
    address internal constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    address internal constant ZERO_ADDRESS = address(0);
}

File 15 of 20 : ECDSA.sol
// 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));
    }
}

File 16 of 20 : Address.sol
// 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);
        }
    }
}

File 17 of 20 : IERC1271Wallet.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IERC1271Wallet {
    function isValidSignature(bytes32 _hash, bytes calldata _signature) external view returns (bytes4 magicValue);
}

File 18 of 20 : Strings.sol
// 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));
    }
}

File 19 of 20 : Math.sol
// 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);
        }
    }
}

File 20 of 20 : SignedMath.sol
// 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);
        }
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "forge-std/=lib/forge-std/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_uniswapPermit2","type":"address"},{"internalType":"address","name":"_allowanceTarget","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyFilled","type":"error"},{"inputs":[],"name":"ExpiredOrder","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientOutput","type":"error"},{"inputs":[],"name":"InvalidMsgValue","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"Permit2DataEmpty","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"swapHash","type":"bytes32"},{"indexed":true,"internalType":"address","name":"maker","type":"address"},{"indexed":true,"internalType":"address","name":"taker","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"inputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"inputAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"outputToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"outputAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"salt","type":"uint256"}],"name":"Swap","type":"event"},{"inputs":[],"name":"EIP191_HEADER","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_TYPE_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EIP712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowanceTarget","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"maker","type":"address"},{"internalType":"address","name":"takerToken","type":"address"},{"internalType":"uint256","name":"takerTokenAmount","type":"uint256"},{"internalType":"address","name":"makerToken","type":"address"},{"internalType":"uint256","name":"makerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minMakerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes","name":"strategyData","type":"bytes"}],"internalType":"struct GenericSwapData","name":"swapData","type":"tuple"},{"internalType":"bytes","name":"takerTokenPermit","type":"bytes"}],"name":"executeSwap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"maker","type":"address"},{"internalType":"address","name":"takerToken","type":"address"},{"internalType":"uint256","name":"takerTokenAmount","type":"uint256"},{"internalType":"address","name":"makerToken","type":"address"},{"internalType":"uint256","name":"makerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"minMakerTokenAmount","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"},{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes","name":"strategyData","type":"bytes"}],"internalType":"struct GenericSwapData","name":"swapData","type":"tuple"},{"internalType":"bytes","name":"takerTokenPermit","type":"bytes"},{"internalType":"address","name":"taker","type":"address"},{"internalType":"bytes","name":"takerSig","type":"bytes"}],"name":"executeSwapWithSig","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"originalChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"originalEIP712DomainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101006040523480156200001257600080fd5b506040516200218138038062002181833981016040819052620000359162000149565b6001600160a01b03808316608052811660a0524660c0526200012060408051808201825260088152672a37b5b2b73637b760c11b6020918201528151808301835260028152613b1b60f11b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f4428669f887e7f6a6e361e218ee42308201bdbacbf601211fc38b8b2ec696181818401527fe38c993d0cb6abdb6be519a6875b139ddd45568fc076f7b5fa6362a5581f4a1460608201524660808201523060a0808301919091528351808303909101815260c0909101909252815191012090565b60e05250620001819050565b80516001600160a01b03811681146200014457600080fd5b919050565b600080604083850312156200015d57600080fd5b62000168836200012c565b915062000178602084016200012c565b90509250929050565b60805160a05160c05160e051611f9d620001e460003960008181610184015261095a01526000818160de01526109320152600081816102400152610b2101526000818161012501528181610d1401528181610e160152610f940152611f9d6000f3fe6080604052600436106100c05760003560e01c80635cf591a111610074578063dab400f31161004e578063dab400f314610262578063e0c05c2414610277578063eccec5a8146102a557600080fd5b80635cf591a1146101e757806374a640ff146101fa578063910cab111461022e57600080fd5b806336ac25a2116100a557806336ac25a21461015f57806337be5439146101725780633b2fb7a8146101a657600080fd5b80630d788c36146100cc57806312261ee71461011357600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101477f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161010a565b61010061016d366004611822565b6102d3565b34801561017e57600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b257600080fd5b506101da604051806040016040528060088152602001672a37b5b2b73637b760c11b81525081565b60405161010a91906118db565b6101006101f5366004611913565b610306565b34801561020657600080fd5b506101007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b34801561023a57600080fd5b506101477f000000000000000000000000000000000000000000000000000000000000000081565b34801561026e57600080fd5b50610100610423565b34801561028357600080fd5b506101da60405180604001604052806002815260200161190160f01b81525081565b3480156102b157600080fd5b506101da604051806040016040528060028152602001613b1b60f11b81525081565b60006102e184338585610432565b90506102ff6102f76102f286611aab565b61068b565b853384610774565b9392505050565b6000806103156102f289611aab565b9050600061032282610836565b60008381526020819052604090205490915060ff161561036e576040517f41a26a6300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526020818152604091829020805460ff191660011790558151601f87018290048202810182019092528582526103c7918891849190899089908190840183828082843760009201919091525061086e92505050565b6103fd576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61040989878a8a610432565b9250610417828a8886610774565b50509695505050505050565b600061042d61092e565b905090565b6000428560c001351015610472576040517f45fa2d0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061048661012087016101008801611b6d565b6001600160a01b0316036104c6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006104d86040870160208801611b6d565b905060006104ec6080880160608901611b6d565b9050610500826001600160a01b0316610a4d565b1561052e578660400135341461052957604051631841b4e160e01b815260040160405180910390fd5b61056b565b341561054d57604051631841b4e160e01b815260040160405180910390fd5b61056b828761055f60208b018b611b6d565b8a604001358989610a87565b6105786020880188611b6d565b6001600160a01b0316638199411334848460408c013561059c6101208e018e611b8a565b6040518763ffffffff1660e01b81526004016105bc959493929190611bd1565b6000604051808303818588803b1580156105d557600080fd5b505af11580156105e9573d6000803e3d6000fd5b505050505061060a30826001600160a01b031661102690919063ffffffff16565b9250600183111561061d57600019909201915b8660a0013583101561065b576040517fbb2875c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61068161067061012089016101008a01611b6d565b6001600160a01b03831690856110ca565b5050949350505050565b600060405180610100016040528060d38152602001611e9560d3913980519060200120826000015183602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b6101200151805190602001206040516020016107579b9a999897969594939291909a8b526001600160a01b03998a1660208c015297891660408b015260608a0196909652938716608089015260a088019290925260c087015260e08601526101008501529091166101208301526101408201526101600190565b604051602081830303815290604052805190602001209050919050565b6001600160a01b03821661078b6020850185611b6d565b6001600160a01b0316857f3f73a7d0eb2c1181c69f25ffceac1adbcd2cfaedc2bb30de4e75878b7a4b46786107c861012088016101008901611b6d565b6107d86040890160208a01611b6d565b60408901356107ed60808b0160608c01611b6d565b604080516001600160a01b039586168152938516602085015283019190915290911660608201526080810186905260e088013560a082015260c00160405180910390a450505050565b600060405180604001604052806002815260200161190160f01b81525061085b61092e565b8360405160200161075793929190611c25565b60006001600160a01b0384163b1561090957604051630b135d3f60e11b81526001600160a01b03851690631626ba7e906108ae9086908690600401611c4c565b602060405180830381865afa1580156108cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ef9190611c65565b6001600160e01b031916630b135d3f60e11b1490506102ff565b61091383836111b6565b6001600160a01b0316846001600160a01b03161490506102ff565b60007f0000000000000000000000000000000000000000000000000000000000000000460361097c57507f000000000000000000000000000000000000000000000000000000000000000090565b5060408051808201825260088152672a37b5b2b73637b760c11b6020918201528151808301835260028152613b1b60f11b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f4428669f887e7f6a6e361e218ee42308201bdbacbf601211fc38b8b2ec696181818401527fe38c993d0cb6abdb6be519a6875b139ddd45568fc076f7b5fa6362a5581f4a1460608201524660808201523060a0808301919091528351808303909101815260c0909101909252815191012090565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610a8157506001600160a01b038216155b92915050565b600082826000818110610a9c57610a9c611c8f565b919091013560f81c90506004811115610ab757610ab7611ca5565b90506000816004811115610acd57610acd611ca5565b03610b83576040517f1567599f0000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015288811660248301528681166044830152606482018690527f00000000000000000000000000000000000000000000000000000000000000001690631567599f90608401600060405180830381600087803b158015610b6557600080fd5b505af1158015610b79573d6000803e3d6000fd5b505050505061101e565b6001816004811115610b9757610b97611ca5565b03610bb757610bb16001600160a01b0388168787876111da565b5061101e565b6002816004811115610bcb57610bcb611ca5565b03610ca7576000806001600160a01b0389167fd505accf00000000000000000000000000000000000000000000000000000000610c0b866001818a611cbb565b604051602001610c1d93929190611ce5565b60408051601f1981840301815290829052610c3791611d09565b6000604051808303816000865af19150503d8060008114610c74576040519150601f19603f3d011682016040523d82523d6000602084013e610c79565b606091505b509150915081610c8a573d60208201fd5b610c9f6001600160a01b038a168989896111da565b50505061101e565b6003816004811115610cbb57610cbb611ca5565b03610e79576000610ccf8360018187611cbb565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505082519293505090159050610dc6576000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632b67b57060e01b84604051602001610d56929190611d25565b60408051601f1981840301815290829052610d7091611d09565b6000604051808303816000865af19150503d8060008114610dad576040519150601f19603f3d011682016040523d82523d6000602084013e610db2565b606091505b509150915081610dc3573d60208201fd5b50505b6040517f36c785160000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528781166024830152868116604483015289811660648301527f000000000000000000000000000000000000000000000000000000000000000016906336c7851690608401600060405180830381600087803b158015610e5a57600080fd5b505af1158015610e6e573d6000803e3d6000fd5b50505050505061101e565b6004816004811115610e8d57610e8d611ca5565b036100c7576000610ea18360018187611cbb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508451949550939093039250610f15915050576040517fb826d62c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600083806020019051810190610f2e9190611d55565b9250925092506000604051806060016040528060405180604001604052808f6001600160a01b031681526020018c8152508152602001858152602001848152509050600060405180604001604052808c6001600160a01b031681526020018b81525090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166330f28b7a83838f876040518563ffffffff1660e01b8152600401610fe49493929190611de1565b600060405180830381600087803b158015610ffe57600080fd5b505af1158015611012573d6000803e3d6000fd5b50505050505050505050505b505050505050565b600061103183610a4d565b1561104757506001600160a01b03811631610a81565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ff9190611e59565b6001600160a01b0382163014806110df575080155b156110e957505050565b6110f283610a4d565b1561119d5780471015611131576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080836001600160a01b03168360405160006040518083038185875af1925050503d806000811461117f576040519150601f19603f3d011682016040523d82523d6000602084013e611184565b606091505b50915091508161119657805160208201fd5b5050505050565b6111b16001600160a01b0384168383611279565b505050565b60008060006111c585856112c2565b915091506111d281611307565b509392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526112739085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611474565b50505050565b6040516001600160a01b0383166024820152604481018290526111b19084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611227565b60008082516041036112f85760208301516040840151606085015160001a6112ec8782858561155c565b94509450505050611300565b506000905060025b9250929050565b600081600481111561131b5761131b611ca5565b036113235750565b600181600481111561133757611337611ca5565b036113895760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064015b60405180910390fd5b600281600481111561139d5761139d611ca5565b036113ea5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611380565b60038160048111156113fe576113fe611ca5565b036114715760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401611380565b50565b60006114c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116209092919063ffffffff16565b90508051600014806114ea5750808060200190518101906114ea9190611e72565b6111b15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611380565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156115935750600090506003611617565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156115e7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661161057600060019250925050611617565b9150600090505b94509492505050565b606061162f8484600085611637565b949350505050565b6060824710156116af5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401611380565b600080866001600160a01b031685876040516116cb9190611d09565b60006040518083038185875af1925050503d8060008114611708576040519150601f19603f3d011682016040523d82523d6000602084013e61170d565b606091505b509150915061171e87838387611729565b979650505050505050565b60608315611798578251600003611791576001600160a01b0385163b6117915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611380565b508161162f565b61162f83838151156117ad5781518083602001fd5b8060405162461bcd60e51b815260040161138091906118db565b600061014082840312156117da57600080fd5b50919050565b60008083601f8401126117f257600080fd5b50813567ffffffffffffffff81111561180a57600080fd5b60208301915083602082850101111561130057600080fd5b60008060006040848603121561183757600080fd5b833567ffffffffffffffff8082111561184f57600080fd5b61185b878388016117c7565b9450602086013591508082111561187157600080fd5b5061187e868287016117e0565b9497909650939450505050565b60005b838110156118a657818101518382015260200161188e565b50506000910152565b600081518084526118c781602086016020860161188b565b601f01601f19169290920160200192915050565b6020815260006102ff60208301846118af565b6001600160a01b038116811461147157600080fd5b803561190e816118ee565b919050565b6000806000806000806080878903121561192c57600080fd5b863567ffffffffffffffff8082111561194457600080fd5b6119508a838b016117c7565b9750602089013591508082111561196657600080fd5b6119728a838b016117e0565b909750955060408901359150611987826118ee565b9093506060880135908082111561199d57600080fd5b506119aa89828a016117e0565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b604051610140810167ffffffffffffffff811182821017156119f6576119f66119bc565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611a2557611a256119bc565b604052919050565b600067ffffffffffffffff821115611a4757611a476119bc565b50601f01601f191660200190565b600082601f830112611a6657600080fd5b8135611a79611a7482611a2d565b6119fc565b818152846020838601011115611a8e57600080fd5b816020850160208301376000918101602001919091529392505050565b60006101408236031215611abe57600080fd5b611ac66119d2565b611acf83611903565b8152611add60208401611903565b602082015260408301356040820152611af860608401611903565b60608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e0820152610100611b33818501611903565b908201526101208381013567ffffffffffffffff811115611b5357600080fd5b611b5f36828701611a55565b918301919091525092915050565b600060208284031215611b7f57600080fd5b81356102ff816118ee565b6000808335601e19843603018112611ba157600080fd5b83018035915067ffffffffffffffff821115611bbc57600080fd5b60200191503681900382131561130057600080fd5b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b60008451611c3781846020890161188b565b91909101928352506020820152604001919050565b82815260406020820152600061162f60408301846118af565b600060208284031215611c7757600080fd5b81516001600160e01b0319811681146102ff57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60008085851115611ccb57600080fd5b83861115611cd857600080fd5b5050820193919092039150565b6001600160e01b031984168152818360048301376000910160040190815292915050565b60008251611d1b81846020870161188b565b9190910192915050565b6001600160e01b03198316815260008251611d4781600485016020870161188b565b919091016004019392505050565b600080600060608486031215611d6a57600080fd5b8351925060208401519150604084015167ffffffffffffffff811115611d8f57600080fd5b8401601f81018613611da057600080fd5b8051611dae611a7482611a2d565b818152876020838501011115611dc357600080fd5b611dd482602083016020860161188b565b8093505050509250925092565b6000610100611e0483885180516001600160a01b03168252602090810151910152565b6020870151604084015260408701516060840152611e38608084018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08401528060e084015261171e818401856118af565b600060208284031215611e6b57600080fd5b5051919050565b600060208284031215611e8457600080fd5b815180151581146102ff57600080fdfe47656e6572696353776170446174612861646472657373206d616b65722c616464726573732074616b6572546f6b656e2c75696e743235362074616b6572546f6b656e416d6f756e742c61646472657373206d616b6572546f6b656e2c75696e74323536206d616b6572546f6b656e416d6f756e742c75696e74323536206d696e4d616b6572546f6b656e416d6f756e742c75696e74323536206578706972792c75696e743235362073616c742c6164647265737320726563697069656e742c62797465732073747261746567794461746129a26469706673582212201ff7b37ee28bba20ff653e9c4189095a8ea07ae4c71b975cf58dda231a57257464736f6c63430008110033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3000000000000000000000000effeb489a3c18a96437f08cbc65d1381b5d8d1ca

Deployed Bytecode

0x6080604052600436106100c05760003560e01c80635cf591a111610074578063dab400f31161004e578063dab400f314610262578063e0c05c2414610277578063eccec5a8146102a557600080fd5b80635cf591a1146101e757806374a640ff146101fa578063910cab111461022e57600080fd5b806336ac25a2116100a557806336ac25a21461015f57806337be5439146101725780633b2fb7a8146101a657600080fd5b80630d788c36146100cc57806312261ee71461011357600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506101007f000000000000000000000000000000000000000000000000000000000000000181565b6040519081526020015b60405180910390f35b34801561011f57600080fd5b506101477f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba381565b6040516001600160a01b03909116815260200161010a565b61010061016d366004611822565b6102d3565b34801561017e57600080fd5b506101007f82f81aea0abd1ff1d088977f5eb3f6e6e9da3079517c0d5e799469532d187aa581565b3480156101b257600080fd5b506101da604051806040016040528060088152602001672a37b5b2b73637b760c11b81525081565b60405161010a91906118db565b6101006101f5366004611913565b610306565b34801561020657600080fd5b506101007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b34801561023a57600080fd5b506101477f000000000000000000000000effeb489a3c18a96437f08cbc65d1381b5d8d1ca81565b34801561026e57600080fd5b50610100610423565b34801561028357600080fd5b506101da60405180604001604052806002815260200161190160f01b81525081565b3480156102b157600080fd5b506101da604051806040016040528060028152602001613b1b60f11b81525081565b60006102e184338585610432565b90506102ff6102f76102f286611aab565b61068b565b853384610774565b9392505050565b6000806103156102f289611aab565b9050600061032282610836565b60008381526020819052604090205490915060ff161561036e576040517f41a26a6300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526020818152604091829020805460ff191660011790558151601f87018290048202810182019092528582526103c7918891849190899089908190840183828082843760009201919091525061086e92505050565b6103fd576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61040989878a8a610432565b9250610417828a8886610774565b50509695505050505050565b600061042d61092e565b905090565b6000428560c001351015610472576040517f45fa2d0600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061048661012087016101008801611b6d565b6001600160a01b0316036104c6576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006104d86040870160208801611b6d565b905060006104ec6080880160608901611b6d565b9050610500826001600160a01b0316610a4d565b1561052e578660400135341461052957604051631841b4e160e01b815260040160405180910390fd5b61056b565b341561054d57604051631841b4e160e01b815260040160405180910390fd5b61056b828761055f60208b018b611b6d565b8a604001358989610a87565b6105786020880188611b6d565b6001600160a01b0316638199411334848460408c013561059c6101208e018e611b8a565b6040518763ffffffff1660e01b81526004016105bc959493929190611bd1565b6000604051808303818588803b1580156105d557600080fd5b505af11580156105e9573d6000803e3d6000fd5b505050505061060a30826001600160a01b031661102690919063ffffffff16565b9250600183111561061d57600019909201915b8660a0013583101561065b576040517fbb2875c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61068161067061012089016101008a01611b6d565b6001600160a01b03831690856110ca565b5050949350505050565b600060405180610100016040528060d38152602001611e9560d3913980519060200120826000015183602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b6101200151805190602001206040516020016107579b9a999897969594939291909a8b526001600160a01b03998a1660208c015297891660408b015260608a0196909652938716608089015260a088019290925260c087015260e08601526101008501529091166101208301526101408201526101600190565b604051602081830303815290604052805190602001209050919050565b6001600160a01b03821661078b6020850185611b6d565b6001600160a01b0316857f3f73a7d0eb2c1181c69f25ffceac1adbcd2cfaedc2bb30de4e75878b7a4b46786107c861012088016101008901611b6d565b6107d86040890160208a01611b6d565b60408901356107ed60808b0160608c01611b6d565b604080516001600160a01b039586168152938516602085015283019190915290911660608201526080810186905260e088013560a082015260c00160405180910390a450505050565b600060405180604001604052806002815260200161190160f01b81525061085b61092e565b8360405160200161075793929190611c25565b60006001600160a01b0384163b1561090957604051630b135d3f60e11b81526001600160a01b03851690631626ba7e906108ae9086908690600401611c4c565b602060405180830381865afa1580156108cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ef9190611c65565b6001600160e01b031916630b135d3f60e11b1490506102ff565b61091383836111b6565b6001600160a01b0316846001600160a01b03161490506102ff565b60007f0000000000000000000000000000000000000000000000000000000000000001460361097c57507f82f81aea0abd1ff1d088977f5eb3f6e6e9da3079517c0d5e799469532d187aa590565b5060408051808201825260088152672a37b5b2b73637b760c11b6020918201528151808301835260028152613b1b60f11b9082015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818301527f4428669f887e7f6a6e361e218ee42308201bdbacbf601211fc38b8b2ec696181818401527fe38c993d0cb6abdb6be519a6875b139ddd45568fc076f7b5fa6362a5581f4a1460608201524660808201523060a0808301919091528351808303909101815260c0909101909252815191012090565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1480610a8157506001600160a01b038216155b92915050565b600082826000818110610a9c57610a9c611c8f565b919091013560f81c90506004811115610ab757610ab7611ca5565b90506000816004811115610acd57610acd611ca5565b03610b83576040517f1567599f0000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015288811660248301528681166044830152606482018690527f000000000000000000000000effeb489a3c18a96437f08cbc65d1381b5d8d1ca1690631567599f90608401600060405180830381600087803b158015610b6557600080fd5b505af1158015610b79573d6000803e3d6000fd5b505050505061101e565b6001816004811115610b9757610b97611ca5565b03610bb757610bb16001600160a01b0388168787876111da565b5061101e565b6002816004811115610bcb57610bcb611ca5565b03610ca7576000806001600160a01b0389167fd505accf00000000000000000000000000000000000000000000000000000000610c0b866001818a611cbb565b604051602001610c1d93929190611ce5565b60408051601f1981840301815290829052610c3791611d09565b6000604051808303816000865af19150503d8060008114610c74576040519150601f19603f3d011682016040523d82523d6000602084013e610c79565b606091505b509150915081610c8a573d60208201fd5b610c9f6001600160a01b038a168989896111da565b50505061101e565b6003816004811115610cbb57610cbb611ca5565b03610e79576000610ccf8360018187611cbb565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505082519293505090159050610dc6576000807f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b0316632b67b57060e01b84604051602001610d56929190611d25565b60408051601f1981840301815290829052610d7091611d09565b6000604051808303816000865af19150503d8060008114610dad576040519150601f19603f3d011682016040523d82523d6000602084013e610db2565b606091505b509150915081610dc3573d60208201fd5b50505b6040517f36c785160000000000000000000000000000000000000000000000000000000081526001600160a01b0388811660048301528781166024830152868116604483015289811660648301527f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba316906336c7851690608401600060405180830381600087803b158015610e5a57600080fd5b505af1158015610e6e573d6000803e3d6000fd5b50505050505061101e565b6004816004811115610e8d57610e8d611ca5565b036100c7576000610ea18360018187611cbb565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052508451949550939093039250610f15915050576040517fb826d62c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600083806020019051810190610f2e9190611d55565b9250925092506000604051806060016040528060405180604001604052808f6001600160a01b031681526020018c8152508152602001858152602001848152509050600060405180604001604052808c6001600160a01b031681526020018b81525090507f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba36001600160a01b03166330f28b7a83838f876040518563ffffffff1660e01b8152600401610fe49493929190611de1565b600060405180830381600087803b158015610ffe57600080fd5b505af1158015611012573d6000803e3d6000fd5b50505050505050505050505b505050505050565b600061103183610a4d565b1561104757506001600160a01b03811631610a81565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa1580156110a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ff9190611e59565b6001600160a01b0382163014806110df575080155b156110e957505050565b6110f283610a4d565b1561119d5780471015611131576040517ff4d678b800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080836001600160a01b03168360405160006040518083038185875af1925050503d806000811461117f576040519150601f19603f3d011682016040523d82523d6000602084013e611184565b606091505b50915091508161119657805160208201fd5b5050505050565b6111b16001600160a01b0384168383611279565b505050565b60008060006111c585856112c2565b915091506111d281611307565b509392505050565b6040516001600160a01b03808516602483015283166044820152606481018290526112739085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152611474565b50505050565b6040516001600160a01b0383166024820152604481018290526111b19084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611227565b60008082516041036112f85760208301516040840151606085015160001a6112ec8782858561155c565b94509450505050611300565b506000905060025b9250929050565b600081600481111561131b5761131b611ca5565b036113235750565b600181600481111561133757611337611ca5565b036113895760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064015b60405180910390fd5b600281600481111561139d5761139d611ca5565b036113ea5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401611380565b60038160048111156113fe576113fe611ca5565b036114715760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f75650000000000000000000000000000000000000000000000000000000000006064820152608401611380565b50565b60006114c9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116209092919063ffffffff16565b90508051600014806114ea5750808060200190518101906114ea9190611e72565b6111b15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401611380565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156115935750600090506003611617565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156115e7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661161057600060019250925050611617565b9150600090505b94509492505050565b606061162f8484600085611637565b949350505050565b6060824710156116af5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401611380565b600080866001600160a01b031685876040516116cb9190611d09565b60006040518083038185875af1925050503d8060008114611708576040519150601f19603f3d011682016040523d82523d6000602084013e61170d565b606091505b509150915061171e87838387611729565b979650505050505050565b60608315611798578251600003611791576001600160a01b0385163b6117915760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401611380565b508161162f565b61162f83838151156117ad5781518083602001fd5b8060405162461bcd60e51b815260040161138091906118db565b600061014082840312156117da57600080fd5b50919050565b60008083601f8401126117f257600080fd5b50813567ffffffffffffffff81111561180a57600080fd5b60208301915083602082850101111561130057600080fd5b60008060006040848603121561183757600080fd5b833567ffffffffffffffff8082111561184f57600080fd5b61185b878388016117c7565b9450602086013591508082111561187157600080fd5b5061187e868287016117e0565b9497909650939450505050565b60005b838110156118a657818101518382015260200161188e565b50506000910152565b600081518084526118c781602086016020860161188b565b601f01601f19169290920160200192915050565b6020815260006102ff60208301846118af565b6001600160a01b038116811461147157600080fd5b803561190e816118ee565b919050565b6000806000806000806080878903121561192c57600080fd5b863567ffffffffffffffff8082111561194457600080fd5b6119508a838b016117c7565b9750602089013591508082111561196657600080fd5b6119728a838b016117e0565b909750955060408901359150611987826118ee565b9093506060880135908082111561199d57600080fd5b506119aa89828a016117e0565b979a9699509497509295939492505050565b634e487b7160e01b600052604160045260246000fd5b604051610140810167ffffffffffffffff811182821017156119f6576119f66119bc565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611a2557611a256119bc565b604052919050565b600067ffffffffffffffff821115611a4757611a476119bc565b50601f01601f191660200190565b600082601f830112611a6657600080fd5b8135611a79611a7482611a2d565b6119fc565b818152846020838601011115611a8e57600080fd5b816020850160208301376000918101602001919091529392505050565b60006101408236031215611abe57600080fd5b611ac66119d2565b611acf83611903565b8152611add60208401611903565b602082015260408301356040820152611af860608401611903565b60608201526080830135608082015260a083013560a082015260c083013560c082015260e083013560e0820152610100611b33818501611903565b908201526101208381013567ffffffffffffffff811115611b5357600080fd5b611b5f36828701611a55565b918301919091525092915050565b600060208284031215611b7f57600080fd5b81356102ff816118ee565b6000808335601e19843603018112611ba157600080fd5b83018035915067ffffffffffffffff821115611bbc57600080fd5b60200191503681900382131561130057600080fd5b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b60008451611c3781846020890161188b565b91909101928352506020820152604001919050565b82815260406020820152600061162f60408301846118af565b600060208284031215611c7757600080fd5b81516001600160e01b0319811681146102ff57600080fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b60008085851115611ccb57600080fd5b83861115611cd857600080fd5b5050820193919092039150565b6001600160e01b031984168152818360048301376000910160040190815292915050565b60008251611d1b81846020870161188b565b9190910192915050565b6001600160e01b03198316815260008251611d4781600485016020870161188b565b919091016004019392505050565b600080600060608486031215611d6a57600080fd5b8351925060208401519150604084015167ffffffffffffffff811115611d8f57600080fd5b8401601f81018613611da057600080fd5b8051611dae611a7482611a2d565b818152876020838501011115611dc357600080fd5b611dd482602083016020860161188b565b8093505050509250925092565b6000610100611e0483885180516001600160a01b03168252602090810151910152565b6020870151604084015260408701516060840152611e38608084018780516001600160a01b03168252602090810151910152565b6001600160a01b03851660c08401528060e084015261171e818401856118af565b600060208284031215611e6b57600080fd5b5051919050565b600060208284031215611e8457600080fd5b815180151581146102ff57600080fdfe47656e6572696353776170446174612861646472657373206d616b65722c616464726573732074616b6572546f6b656e2c75696e743235362074616b6572546f6b656e416d6f756e742c61646472657373206d616b6572546f6b656e2c75696e74323536206d616b6572546f6b656e416d6f756e742c75696e74323536206d696e4d616b6572546f6b656e416d6f756e742c75696e74323536206578706972792c75696e743235362073616c742c6164647265737320726563697069656e742c62797465732073747261746567794461746129a26469706673582212201ff7b37ee28bba20ff653e9c4189095a8ea07ae4c71b975cf58dda231a57257464736f6c63430008110033

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

000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3000000000000000000000000effeb489a3c18a96437f08cbc65d1381b5d8d1ca

-----Decoded View---------------
Arg [0] : _uniswapPermit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3
Arg [1] : _allowanceTarget (address): 0xEfFeB489a3C18A96437F08Cbc65d1381b5d8d1CA

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


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.