Contract 0x02f55d53dce23b4aa962cc68b0f685f26143bdb2 21

 
Txn Hash Method
Block
From
To
Value
0xca70e15b9f20bc7ed7bcdb188ac8d27f0fb7a832689d6c3629f0780c32ce4791Multicall132302132024-04-16 6:42:5357 secs ago0x739e83085db75828db40ec6c426d2342a89f5625 IN  Izumi Finance: swap0 ETH0.0000040671210.020045377
0xd5a370492f91653a929b317d6dd1388b5790a61193c45acf849157a374d5661cMulticall132301852024-04-16 6:41:571 min ago0xccf5f90fca4bed151df5f374712b77d573d558aa IN  Izumi Finance: swap0 ETH0.0000039050360.020182101
0xd557b56fe80014cfc123300f5a0f7eced13f03f0aa044c7f836bf018c83b1466Multicall132301802024-04-16 6:41:472 mins ago0x6b47cd0c2a6749d1f2fe597e67c7c9f90eefb08f IN  Izumi Finance: swap0 ETH0.0000040680170.020012774
0x73c9bd96914c6d5d5dacaef7f5aa711a371399e94b32a2d757c9d26694eab686Multicall132301602024-04-16 6:41:072 mins ago0xf4c46b1c36756a47f50444957b07231335fd1c78 IN  Izumi Finance: swap0.0004 ETH0.0000049497740.020122702
0x1eb0d32eadabeb52e524e9ef6c839e48206c4cac843973c4afb89288c3b8824eMulticall132301502024-04-16 6:40:473 mins ago0xf20b033de16545010fbdbdd5402cbd456a1b25c5 IN  Izumi Finance: swap0 ETH0.0000040874230.020188242
0x8a091b081d47e79dca1def0e9fd05092043623d4e24a64f71e59831495bb563eMulticall132301342024-04-16 6:40:153 mins ago0xbea2aa8748de12ac1e2541792ae6a76f81b61ce1 IN  Izumi Finance: swap0.11 ETH0.000004766980.0223
0xa0455b3bc281aa8c3b1598d8f03c6ccfd1034a0a5d41b5ad41f8c67e7ca58fe8Multicall132301062024-04-16 6:39:194 mins ago0x02752e4a8eae0f7ccd4ad19f77ef65380167ba22 IN  Izumi Finance: swap0 ETH0.0000041711570.020644318
0x43c6d371db6b7f0b08eeb279d8e11735f2d93193bd6cfa9e3e610e322fcc835cMulticall132300712024-04-16 6:38:095 mins ago0x9d67d250554f71b1e0bc4e3dd5ae8dc93284f0aa IN  Izumi Finance: swap0 ETH0.0000042277960.020895842
0xfd49079e5b0e56b31872c25ee03823758c1ea754970853cade6ab233f0530afdMulticall132300352024-04-16 6:36:576 mins ago0xfce771335391c5a7294cc444e05eaffc699701cf IN  Izumi Finance: swap0 ETH0.000004205870.02103673
0x8ddfc5bf8f8d8d2fe2ec83606a27842d2776734d3ce8e4daf0fc8b0db4c195a8Multicall132300292024-04-16 6:36:457 mins ago0x67d50b4053ee7d45fc130f5a8c7b63d8d16bf4db IN  Izumi Finance: swap0 ETH0.0000061263590.021119704
0x1cfaffbdf196c9897265d9a7bca6bac5db9ba0ea3c302dfe62bf826beb15b1f9Multicall132300222024-04-16 6:36:317 mins ago0x342df98fbefec8e501f66a30fc1b060b6992ba48 IN  Izumi Finance: swap0.0001 ETH0.0000040648420.021171848
0x356b3c384fbb6e6f6853ba71af55e467ff1d8b98f6f30b3274c8bc3193dc3c39Multicall132299982024-04-16 6:35:438 mins ago0xbb73b0fd70b9c57b14adbb3ed9fbf726b947236c IN  Izumi Finance: swap0.00001 ETH0.0000043216330.021039769
0x449a90080381ae3f59d18b052b23d0a17beae34847919678241a131a9ca6f27eMulticall132299962024-04-16 6:35:398 mins ago0xf264ab71f3039aee7bbe02ad2977c4a7b9da368e IN  Izumi Finance: swap0 ETH0.0000042836240.021152884
0x7a81277ce73a025f9632c9eff4d2ebc812418da296f049e17a9295555d68de9eMulticall132299512024-04-16 6:34:099 mins ago0x1d148c686d0d3d27b0b622d9ef27338a23c5c884 IN  Izumi Finance: swap0 ETH0.0000043123720.021279001
0x66d38f16bb6b97503299af24fe8aabfbef3d4fe317031604396cc17c46d62ce7Multicall132299222024-04-16 6:33:1110 mins ago0x13f679a663a95e7ac9ab4a8f2542c0fb56dd56a3 IN  Izumi Finance: swap0 ETH0.0000043584750.021510884
0x057e284481125fb81bfc84724f8c200a13231a1ddcf2dd4b632e916970e94b37Multicall132298982024-04-16 6:32:2311 mins ago0x54cb698e71c37872fdbce374302e406dcd504d58 IN  Izumi Finance: swap0 ETH0.000004341260.021368352
0x229b3fa2c15bd015bde44398c43bbf34f04caf6e6dd32356bce35c24d3d6ed4cMulticall132298852024-04-16 6:31:5711 mins ago0xbce3bd6965b68ae0ae288df0b3a0df5d89236dfb IN  Izumi Finance: swap0 ETH0.0000043234750.021383996
0x67dca8a8c62e779eb4f27f360aad3e4a6c6bd8bd8452a6e93ea06aaacf01ca79Multicall132298822024-04-16 6:31:5111 mins ago0x45c1977e7e6758a77c44fd2f7db34425612a002b IN  Izumi Finance: swap0 ETH0.0000048001440.021328998
0x9120db5934044564aa47ffaebaf428d9bbae713d71c896dd4ddfff40fd01821dSwap Amount132298552024-04-16 6:30:5712 mins ago0x45c1977e7e6758a77c44fd2f7db34425612a002b IN  Izumi Finance: swap0 ETH0.0000042651780.021533844
0xef283fb09c209b9cd08566fb9942be1488a2c1f32498c4b570a6a3d81752ed88Multicall132298482024-04-16 6:30:4313 mins ago0x7d9288e81a2f4e92448d9df775a7f8c8f4f3dc9d IN  Izumi Finance: swap0 ETH0.0000042991580.02152428
0xaa08f15d447a2030a0bcb7e58decf6103ba680f1a0ecbf1c1d036797d4aba69fMulticall132298112024-04-16 6:29:2914 mins ago0x37b858818304cea01b1ee6f017f137e343cd3476 IN  Izumi Finance: swap0 ETH0.0000044128830.021750239
0xbd4d0606a20295af45662db9801e95b70400a47676aed9e85ad8021657048d67Multicall132298042024-04-16 6:29:1514 mins ago0x5629e37d0fb4cb68c42c2e125d2227aab0e1b244 IN  Izumi Finance: swap0.00015 ETH0.0000049219910.021886837
0x1926e6c065e6fd54e5c6b8a0c20bcef1201b522b77045695647952b54511bb5dMulticall132297862024-04-16 6:28:3915 mins ago0x841b162fde2c5516682823061fbe84221ba63d06 IN  Izumi Finance: swap0.0127 ETH0.0000047929430.0243
0x8a1ae71f51de6c2cc71a7467fbf72ab5eaf15ab24e5c84d6c5b010c4b967135dMulticall132297822024-04-16 6:28:3115 mins ago0x133822b32ed93933621ef20cad9fc5795bfc9daa IN  Izumi Finance: swap0.00001 ETH0.0000045322280.022007734
0x8f410a9188a445f9fd0d5730dc5237d95b5bc9186f624dab9d630c7cfc819a7eMulticall132297762024-04-16 6:28:1915 mins ago0xbe6913a7f613bfaf9b677d2069f0bc40c761dcc0 IN  Izumi Finance: swap0 ETH0.0000044656340.022029634
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xca70e15b9f20bc7ed7bcdb188ac8d27f0fb7a832689d6c3629f0780c32ce4791132302132024-04-16 6:42:5357 secs ago Izumi Finance: swap0x739e83085db75828db40ec6c426d2342a89f56250.012995263537372288 ETH
0xca70e15b9f20bc7ed7bcdb188ac8d27f0fb7a832689d6c3629f0780c32ce4791132302132024-04-16 6:42:5357 secs ago Wrapped Ether Izumi Finance: swap0.012995263537372288 ETH
0xd5a370492f91653a929b317d6dd1388b5790a61193c45acf849157a374d5661c132301852024-04-16 6:41:571 min ago Izumi Finance: swap0xccf5f90fca4bed151df5f374712b77d573d558aa0.013471838943313067 ETH
0xd5a370492f91653a929b317d6dd1388b5790a61193c45acf849157a374d5661c132301852024-04-16 6:41:571 min ago Wrapped Ether Izumi Finance: swap0.013471838943313067 ETH
0xd557b56fe80014cfc123300f5a0f7eced13f03f0aa044c7f836bf018c83b1466132301802024-04-16 6:41:472 mins ago Izumi Finance: swap0x6b47cd0c2a6749d1f2fe597e67c7c9f90eefb08f0.013330374112095948 ETH
0xd557b56fe80014cfc123300f5a0f7eced13f03f0aa044c7f836bf018c83b1466132301802024-04-16 6:41:472 mins ago Wrapped Ether Izumi Finance: swap0.013330374112095948 ETH
0x73c9bd96914c6d5d5dacaef7f5aa711a371399e94b32a2d757c9d26694eab686132301602024-04-16 6:41:072 mins ago Izumi Finance: swap0xf4c46b1c36756a47f50444957b07231335fd1c780.000000000000014043 ETH
0x73c9bd96914c6d5d5dacaef7f5aa711a371399e94b32a2d757c9d26694eab686132301602024-04-16 6:41:072 mins ago Izumi Finance: swapWrapped Ether0.000399999999985957 ETH
0x1eb0d32eadabeb52e524e9ef6c839e48206c4cac843973c4afb89288c3b8824e132301502024-04-16 6:40:473 mins ago Izumi Finance: swap0xf20b033de16545010fbdbdd5402cbd456a1b25c50.013449885247705302 ETH
0x1eb0d32eadabeb52e524e9ef6c839e48206c4cac843973c4afb89288c3b8824e132301502024-04-16 6:40:473 mins ago Wrapped Ether Izumi Finance: swap0.013449885247705302 ETH
0x8a091b081d47e79dca1def0e9fd05092043623d4e24a64f71e59831495bb563e132301342024-04-16 6:40:153 mins ago Izumi Finance: swap0xbea2aa8748de12ac1e2541792ae6a76f81b61ce10.000000000000007917 ETH
0x8a091b081d47e79dca1def0e9fd05092043623d4e24a64f71e59831495bb563e132301342024-04-16 6:40:153 mins ago Izumi Finance: swapWrapped Ether0.109999999999992083 ETH
0xa0455b3bc281aa8c3b1598d8f03c6ccfd1034a0a5d41b5ad41f8c67e7ca58fe8132301062024-04-16 6:39:194 mins ago Izumi Finance: swap0x02752e4a8eae0f7ccd4ad19f77ef65380167ba220.012667753393054773 ETH
0xa0455b3bc281aa8c3b1598d8f03c6ccfd1034a0a5d41b5ad41f8c67e7ca58fe8132301062024-04-16 6:39:194 mins ago Wrapped Ether Izumi Finance: swap0.012667753393054773 ETH
0x43c6d371db6b7f0b08eeb279d8e11735f2d93193bd6cfa9e3e610e322fcc835c132300712024-04-16 6:38:095 mins ago Izumi Finance: swap0x9d67d250554f71b1e0bc4e3dd5ae8dc93284f0aa0.014933683293838821 ETH
0x43c6d371db6b7f0b08eeb279d8e11735f2d93193bd6cfa9e3e610e322fcc835c132300712024-04-16 6:38:095 mins ago Wrapped Ether Izumi Finance: swap0.014933683293838821 ETH
0xfd49079e5b0e56b31872c25ee03823758c1ea754970853cade6ab233f0530afd132300352024-04-16 6:36:576 mins ago Izumi Finance: swap0xfce771335391c5a7294cc444e05eaffc699701cf0.014684971449134404 ETH
0xfd49079e5b0e56b31872c25ee03823758c1ea754970853cade6ab233f0530afd132300352024-04-16 6:36:576 mins ago Wrapped Ether Izumi Finance: swap0.014684971449134404 ETH
0x8ddfc5bf8f8d8d2fe2ec83606a27842d2776734d3ce8e4daf0fc8b0db4c195a8132300292024-04-16 6:36:457 mins ago Izumi Finance: swap0x67d50b4053ee7d45fc130f5a8c7b63d8d16bf4db0.0000172616913506 ETH
0x8ddfc5bf8f8d8d2fe2ec83606a27842d2776734d3ce8e4daf0fc8b0db4c195a8132300292024-04-16 6:36:457 mins ago Wrapped Ether Izumi Finance: swap0.0000172616913506 ETH
0x1cfaffbdf196c9897265d9a7bca6bac5db9ba0ea3c302dfe62bf826beb15b1f9132300222024-04-16 6:36:317 mins ago Izumi Finance: swap0x342df98fbefec8e501f66a30fc1b060b6992ba480.000000000000009905 ETH
0x1cfaffbdf196c9897265d9a7bca6bac5db9ba0ea3c302dfe62bf826beb15b1f9132300222024-04-16 6:36:317 mins ago Izumi Finance: swapWrapped Ether0.000099999999990095 ETH
0x356b3c384fbb6e6f6853ba71af55e467ff1d8b98f6f30b3274c8bc3193dc3c39132299982024-04-16 6:35:438 mins ago Izumi Finance: swap0xbb73b0fd70b9c57b14adbb3ed9fbf726b947236c0.000000000000017118 ETH
0x356b3c384fbb6e6f6853ba71af55e467ff1d8b98f6f30b3274c8bc3193dc3c39132299982024-04-16 6:35:438 mins ago Izumi Finance: swapWrapped Ether0.000009999999982882 ETH
0x449a90080381ae3f59d18b052b23d0a17beae34847919678241a131a9ca6f27e132299962024-04-16 6:35:398 mins ago Izumi Finance: swap0xf264ab71f3039aee7bbe02ad2977c4a7b9da368e0.014422021479978851 ETH
[ Download CSV Export 
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
Swap

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 8 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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 2 of 8 : base.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "../core/interfaces/IiZiSwapFactory.sol";

/// @title Interface for WETH9
interface IWETH9 is IERC20 {
    /// @notice Deposit ether to get wrapped ether
    function deposit() external payable;

    /// @notice Withdraw wrapped ether to get ether
    function withdraw(uint256) external;
}

abstract contract Base {
    /// @notice address of iZiSwapFactory
    address public immutable factory;

    /// @notice address of weth9 token
    address public immutable WETH9;

    modifier checkDeadline(uint256 deadline) {
        require(block.timestamp <= deadline, 'Out of time');
        _;
    }

    receive() external payable {}

    /// @notice Constructor of base.
    /// @param _factory address of iZiSwapFactory
    /// @param _WETH9 address of weth9 token
    constructor(address _factory, address _WETH9) {
        factory = _factory;
        WETH9 = _WETH9;
    }

    /// @notice Make multiple function calls in this contract in a single transaction
    ///     and return the data for each function call, revert if any function call fails
    /// @param data The encoded function data for each function call
    /// @return results result of each function call
    function multicall(bytes[] calldata data) external payable returns (bytes[] memory results) {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(data[i]);

            if (!success) {
                if (result.length < 68) revert();
                assembly {
                    result := add(result, 0x04)
                }
                revert(abi.decode(result, (string)));
            }

            results[i] = result;
        }
    }

    /// @notice Transfer tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) =
            token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
    }

    /// @notice Transfer tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
    }

    /// @notice Approve the stipulated contract to spend the given allowance in the given token
    /// @dev Errors with 'SA' if transfer fails
    /// @param token The contract address of the token to be approved
    /// @param to The target of the approval
    /// @param value The amount of the given token the target will be allowed to spend
    function safeApprove(
        address token,
        address to,
        uint256 value
    ) internal {
        (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
    }

    /// @notice Transfer ETH to the recipient address
    /// @dev Fails with `STE`
    /// @param to The destination of the transfer
    /// @param value The value to be transferred
    function safeTransferETH(address to, uint256 value) internal {
        (bool success, ) = to.call{value: value}(new bytes(0));
        require(success, 'STE');
    }

    /// @notice Withdraw all weth9 token of this contract and send the withdrawed eth to recipient
    ///    usually used in multicall when mint/swap/update limitorder with eth
    ///    normally this contract has no any erc20 token or eth after or before a transaction
    ///    we donot need to worry that some one can steal eth from this contract
    /// @param minAmount The minimum amount of WETH9 to withdraw
    /// @param recipient The address to receive all withdrawed eth from this contract
    function unwrapWETH9(uint256 minAmount, address recipient) external payable {
        uint256 all = IWETH9(WETH9).balanceOf(address(this));
        require(all >= minAmount, 'WETH9 Not Enough');

        if (all > 0) {
            IWETH9(WETH9).withdraw(all);
            safeTransferETH(recipient, all);
        }
    }

    /// @notice Send all balance of specified token in this contract to recipient
    ///    usually used in multicall when mint/swap/update limitorder with eth
    ///    normally this contract has no any erc20 token or eth after or before a transaction
    ///    we donot need to worry that some one can steal some token from this contract
    /// @param token address of the token
    /// @param minAmount balance should >= minAmount
    /// @param recipient the address to receive specified token from this contract
    function sweepToken(
        address token,
        uint256 minAmount,
        address recipient
    ) external payable {
        uint256 all = IERC20(token).balanceOf(address(this));
        require(all >= minAmount, 'WETH9 Not Enough');

        if (all > 0) {
            safeTransfer(token, recipient, all);
        }
    }

    /// @notice Send all balance of eth in this contract to msg.sender
    ///    usually used in multicall when mint/swap/update limitorder with eth
    ///    normally this contract has no any erc20 token or eth after or before a transaction
    ///    we donot need to worry that some one can steal some token from this contract
    function refundETH() external payable {
        if (address(this).balance > 0) safeTransferETH(msg.sender, address(this).balance);
    }

    /// @param token The token to pay
    /// @param payer The entity that must pay
    /// @param recipient The entity that will receive payment
    /// @param value The amount to pay
    function pay(
        address token,
        address payer,
        address recipient,
        uint256 value
    ) internal {
        if (token == WETH9 && address(this).balance >= value) {
            // pay with WETH9
            IWETH9(WETH9).deposit{value: value}(); // wrap only what is needed to pay
            IWETH9(WETH9).transfer(recipient, value);
        } else if (payer == address(this)) {
            // pay with tokens already in the contract (for the exact input multihop case)
            safeTransfer(token, recipient, value);
        } else {
            // pull payment
            safeTransferFrom(token, payer, recipient, value);
        }
    }

    /// @notice Query pool address from factory by (tokenX, tokenY, fee).
    /// @param tokenX tokenX of swap pool
    /// @param tokenY tokenY of swap pool
    /// @param fee fee amount of swap pool
    function pool(address tokenX, address tokenY, uint24 fee) public view returns(address) {
        return IiZiSwapFactory(factory).pool(tokenX, tokenY, fee);
    }
    function verify(address tokenX, address tokenY, uint24 fee) internal view {
        require (msg.sender == pool(tokenX, tokenY, fee), "sp");
    }
}

File 3 of 8 : IiZiSwapCallback.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;

interface IiZiSwapMintCallback {

    /// @notice Called to msg.sender in iZiSwapPool#mint call
    /// @param x Amount of tokenX need to pay from miner
    /// @param y Amount of tokenY need to pay from miner
    /// @param data Any data passed through by the msg.sender via the iZiSwapPool#mint call
    function mintDepositCallback(
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external;

}

interface IiZiSwapCallback {

    /// @notice Called to msg.sender in iZiSwapPool#swapY2X(DesireX) call
    /// @param x Amount of tokenX trader will acquire
    /// @param y Amount of tokenY trader will pay
    /// @param data Any dadta passed though by the msg.sender via the iZiSwapPool#swapY2X(DesireX) call
    function swapY2XCallback(
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external;

    /// @notice Called to msg.sender in iZiSwapPool#swapX2Y(DesireY) call
    /// @param x Amount of tokenX trader will pay
    /// @param y Amount of tokenY trader will require
    /// @param data Any dadta passed though by the msg.sender via the iZiSwapPool#swapX2Y(DesireY) call
    function swapX2YCallback(
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external;

}

interface IiZiSwapAddLimOrderCallback {

    /// @notice Called to msg.sender in iZiSwapPool#addLimOrderWithX(Y) call
    /// @param x Amount of tokenX seller will pay
    /// @param y Amount of tokenY seller will pay
    /// @param data Any dadta passed though by the msg.sender via the iZiSwapPool#addLimOrderWithX(Y) call
    function payCallback(
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external;

}

File 4 of 8 : IiZiSwapFactory.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;

interface IiZiSwapFactory {

    /// @notice emit when successfuly create a new pool (calling iZiSwapFactory#newPool)
    /// @param tokenX address of erc-20 tokenX
    /// @param tokenY address of erc-20 tokenY
    /// @param fee fee amount of swap (3000 means 0.3%)
    /// @param pointDelta minimum number of distance between initialized or limitorder points
    /// @param pool address of swap pool
    event NewPool(
        address indexed tokenX,
        address indexed tokenY,
        uint24 indexed fee,
        uint24 pointDelta,
        address pool
    );

    /// @notice module to support swap from tokenX to tokenY
    /// @return swapX2YModule address
    function swapX2YModule() external returns (address);

    /// @notice module to support swap from tokenY to tokenX
    /// @return swapY2XModule address
    function swapY2XModule() external returns (address);

    /// @notice module to support mint/burn/collect function of pool
    /// @return liquidityModule address
    function liquidityModule() external returns (address);

    /// @notice address of module for user to manage limit orders
    /// @return limitOrderModule address
    function limitOrderModule() external returns (address);

    /// @notice address of module for flash loan
    /// @return flashModule address
    function flashModule() external returns (address);

    /// @notice default fee rate from miner's fee gain
    /// @return defaultFeeChargePercent default fee rate * 100
    function defaultFeeChargePercent() external returns (uint24);

    /// @notice Enables a fee amount with the given pointDelta
    /// @dev Fee amounts may never be removed once enabled
    /// @param fee fee amount (3000 means 0.3%)
    /// @param pointDelta The spacing between points to be enforced for all pools created with the given fee amount
    function enableFeeAmount(uint24 fee, uint24 pointDelta) external;

    /// @notice Create a new pool which not exists.
    /// @param tokenX address of tokenX
    /// @param tokenY address of tokenY
    /// @param fee fee amount
    /// @param currentPoint initial point (log 1.0001 of price)
    /// @return address of newly created pool
    function newPool(
        address tokenX,
        address tokenY,
        uint24 fee,
        int24 currentPoint
    ) external returns (address);

    /// @notice Charge receiver of all pools.
    /// @return address of charge receiver
    function chargeReceiver() external view returns(address);

    /// @notice Get pool of (tokenX, tokenY, fee), address(0) for not exists.
    /// @param tokenX address of tokenX
    /// @param tokenY address of tokenY
    /// @param fee fee amount
    /// @return address of pool
    function pool(
        address tokenX,
        address tokenY,
        uint24 fee
    ) external view returns(address);

    /// @notice Get point delta of a given fee amount.
    /// @param fee fee amount
    /// @return pointDelta the point delta
    function fee2pointDelta(uint24 fee) external view returns (int24 pointDelta);

    /// @notice Change charge receiver, only owner of factory can call.
    /// @param _chargeReceiver address of new receiver
    function modifyChargeReceiver(address _chargeReceiver) external;

    /// @notice Change defaultFeeChargePercent
    /// @param _defaultFeeChargePercent new charge percent
    function modifyDefaultFeeChargePercent(uint24 _defaultFeeChargePercent) external;

    function deployPoolParams() external view returns(
        address tokenX,
        address tokenY,
        uint24 fee,
        int24 currentPoint,
        int24 pointDelta,
        uint24 feeChargePercent
    );
    
}

File 5 of 8 : IiZiSwapPool.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;

interface IiZiSwapPool {

    /// @notice Emitted when miner successfully add liquidity (mint).
    /// @param sender the address that minted the liquidity
    /// @param owner the owner who will benefit from this liquidity
    /// @param leftPoint left endpoint of the liquidity
    /// @param rightPoint right endpoint of the liquidity
    /// @param liquidity the amount of liquidity minted to the range [leftPoint, rightPoint)
    /// @param amountX amount of tokenX deposit
    /// @param amountY amount of tokenY deposit
    event Mint(
        address sender, 
        address indexed owner, 
        int24 indexed leftPoint, 
        int24 indexed rightPoint, 
        uint128 liquidity, 
        uint256 amountX, 
        uint256 amountY
    );

    /// @notice Emitted when miner successfully decrease liquidity (withdraw).
    /// @param owner owner address of liquidity
    /// @param leftPoint left endpoint of liquidity
    /// @param rightPoint right endpoint of liquidity
    /// @param liquidity amount of liquidity decreased
    /// @param amountX amount of tokenX withdrawed
    /// @param amountY amount of tokenY withdrawed
    event Burn(
        address indexed owner, 
        int24 indexed leftPoint,
        int24 indexed rightPoint,
        uint128 liquidity,
        uint256 amountX,
        uint256 amountY
    );

    /// @notice Emitted when fees and withdrawed liquidity are collected 
    /// @param owner The owner of the Liquidity
    /// @param recipient recipient of those token
    /// @param leftPoint The left point of the liquidity
    /// @param rightPoint The right point of the liquidity
    /// @param amountX The amount of tokenX (fees and withdrawed tokenX from liquidity)
    /// @param amountY The amount of tokenY (fees and withdrawed tokenY from liquidity)
    event CollectLiquidity(
        address indexed owner,
        address recipient,
        int24 indexed leftPoint,
        int24 indexed rightPoint,
        uint256 amountX,
        uint256 amountY
    );

    /// @notice Emitted when a trader successfully exchange.
    /// @param tokenX tokenX of pool
    /// @param tokenY tokenY of pool
    /// @param fee fee amount of pool
    /// @param sellXEarnY true for selling tokenX, false for buying tokenX
    /// @param amountX amount of tokenX in this exchange
    /// @param amountY amount of tokenY in this exchange
    event Swap(
        address indexed tokenX,
        address indexed tokenY,
        uint24 indexed fee,
        bool sellXEarnY,
        uint256 amountX,
        uint256 amountY
    );

    /// @notice Emitted by the pool for any flashes of tokenX/tokenY.
    /// @param sender the address that initiated the swap call, and that received the callback
    /// @param recipient the address that received the tokens from flash
    /// @param amountX the amount of tokenX that was flashed
    /// @param amountY the amount of tokenY that was flashed
    /// @param paidX the amount of tokenX paid for the flash, which can exceed the amountX plus the fee
    /// @param paidY the amount of tokenY paid for the flash, which can exceed the amountY plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amountX,
        uint256 amountY,
        uint256 paidX,
        uint256 paidY
    );

    /// @notice Emitted when a seller successfully add a limit order.
    /// @param owner owner of limit order
    /// @param addAmount amount of token to sell the seller added
    /// @param acquireAmount amount of earn-token acquired, if there exists some opposite order before 
    /// @param point point of limit order
    /// @param claimSold claimed sold sell-token, if this owner has order with same direction on this point before
    /// @param claimEarn claimed earned earn-token, if this owner has order with same direction on this point before
    /// @param sellXEarnY direction of limit order, etc. sell tokenX or sell tokenY
    event AddLimitOrder(
        address indexed owner,
        uint128 addAmount,
        uint128 acquireAmount,
        int24 indexed point,
        uint128 claimSold,
        uint128 claimEarn,
        bool sellXEarnY
    );

    /// @notice Emitted when a seller successfully decrease a limit order.
    /// @param owner owner of limit order
    /// @param decreaseAmount amount of token to sell the seller decreased
    /// @param point point of limit order
    /// @param claimSold claimed sold sell-token
    /// @param claimEarn claimed earned earn-token
    /// @param sellXEarnY direction of limit order, etc. sell tokenX or sell tokenY
    event DecLimitOrder(
        address indexed owner,
        uint128 decreaseAmount,
        int24 indexed point,
        uint128 claimSold,
        uint128 claimEarn,
        bool sellXEarnY
    );

    /// @notice Emitted when collect from a limit order
    /// @param owner The owner of the Liquidity
    /// @param recipient recipient of those token
    /// @param point The point of the limit order
    /// @param collectDec The amount of decreased sell token collected
    /// @param collectEarn The amount of earn token collected
    /// @param sellXEarnY direction of limit order, etc. sell tokenX or sell tokenY
    event CollectLimitOrder(
        address indexed owner,
        address recipient,
        int24 indexed point,
        uint128 collectDec,
        uint128 collectEarn,
        bool sellXEarnY
    );

    /// @notice Returns the information about a liquidity by the liquidity's key.
    /// @param key the liquidity's key is a hash of a preimage composed by the miner(owner), pointLeft and pointRight
    /// @return liquidity the amount of liquidity,
    /// @return lastFeeScaleX_128 fee growth of tokenX inside the range as of the last mint/burn/collect,
    /// @return lastFeeScaleY_128 fee growth of tokenY inside the range as of the last mint/burn/collect,
    /// @return tokenOwedX the computed amount of tokenX miner can collect as of the last mint/burn/collect,
    /// @return tokenOwedY the computed amount of tokenY miner can collect as of the last mint/burn/collect
    function liquidity(bytes32 key)
        external
        view
        returns (
            uint128 liquidity,
            uint256 lastFeeScaleX_128,
            uint256 lastFeeScaleY_128,
            uint256 tokenOwedX,
            uint256 tokenOwedY
        );
    
    /// @notice Returns the information about a user's limit order (sell tokenY and earn tokenX).
    /// @param key the limit order's key is a hash of a preimage composed by the seller, point
    /// @return lastAccEarn total amount of tokenX earned by all users at this point as of the last add/dec/collect
    /// @return sellingRemain amount of tokenY not selled in this limit order
    /// @return sellingDec amount of tokenY decreased by seller from this limit order
    /// @return earn amount of unlegacy earned tokenX in this limit order not assigned
    /// @return legacyEarn amount of legacy earned tokenX in this limit order not assgined
    /// @return earnAssign assigned amount of tokenX earned (both legacy and unlegacy) in this limit order
    function userEarnX(bytes32 key)
        external
        view
        returns (
            uint256 lastAccEarn,
            uint128 sellingRemain,
            uint128 sellingDec,
            uint128 earn,
            uint128 legacyEarn,
            uint128 earnAssign
        );
    
    /// @notice Returns the information about a user's limit order (sell tokenX and earn tokenY).
    /// @param key the limit order's key is a hash of a preimage composed by the seller, point
    /// @return lastAccEarn total amount of tokenY earned by all users at this point as of the last add/dec/collect
    /// @return sellingRemain amount of tokenX not selled in this limit order
    /// @return sellingDec amount of tokenX decreased by seller from this limit order
    /// @return earn amount of unlegacy earned tokenY in this limit order not assigned
    /// @return legacyEarn amount of legacy earned tokenY in this limit order not assgined
    /// @return earnAssign assigned amount of tokenY earned (both legacy and unlegacy) in this limit order
    function userEarnY(bytes32 key)
        external
        view
        returns (
            uint256 lastAccEarn,
            uint128 sellingRemain,
            uint128 sellingDec,
            uint128 earn,
            uint128 legacyEarn,
            uint128 earnAssign
        );
    
    /// @notice Mark a given amount of tokenY in a limitorder(sellx and earn y) as assigned.
    /// @param point point (log Price) of seller's limit order,be sure to be times of pointDelta
    /// @param assignY max amount of tokenY to mark assigned
    /// @param fromLegacy true for assigning earned token from legacyEarnY
    /// @return actualAssignY actual amount of tokenY marked
    function assignLimOrderEarnY(
        int24 point,
        uint128 assignY,
        bool fromLegacy
    ) external returns(uint128 actualAssignY);
    
    /// @notice Mark a given amount of tokenX in a limitorder(selly and earn x) as assigned.
    /// @param point point (log Price) of seller's limit order,be sure to be times of pointDelta
    /// @param assignX max amount of tokenX to mark assigned
    /// @param fromLegacy true for assigning earned token from legacyEarnX
    /// @return actualAssignX actual amount of tokenX marked
    function assignLimOrderEarnX(
        int24 point,
        uint128 assignX,
        bool fromLegacy
    ) external returns(uint128 actualAssignX);

    /// @notice Decrease limitorder of selling X.
    /// @param point point of seller's limit order, be sure to be times of pointDelta
    /// @param deltaX max amount of tokenX seller wants to decrease
    /// @return actualDeltaX actual amount of tokenX decreased
    /// @return legacyAccEarn legacyAccEarnY of pointOrder at point when calling this interface
    function decLimOrderWithX(
        int24 point,
        uint128 deltaX
    ) external returns (uint128 actualDeltaX, uint256 legacyAccEarn);
    
    /// @notice Decrease limitorder of selling Y.
    /// @param point point of seller's limit order, be sure to be times of pointDelta
    /// @param deltaY max amount of tokenY seller wants to decrease
    /// @return actualDeltaY actual amount of tokenY decreased
    /// @return legacyAccEarn legacyAccEarnX of pointOrder at point when calling this interface
    function decLimOrderWithY(
        int24 point,
        uint128 deltaY
    ) external returns (uint128 actualDeltaY, uint256 legacyAccEarn);
    
    /// @notice Add a limit order (selling x) in the pool.
    /// @param recipient owner of the limit order
    /// @param point point of the order, be sure to be times of pointDelta
    /// @param amountX amount of tokenX to sell
    /// @param data any data that should be passed through to the callback
    /// @return orderX actual added amount of tokenX
    /// @return acquireY amount of tokenY acquired if there is a limit order to sell y before adding
    function addLimOrderWithX(
        address recipient,
        int24 point,
        uint128 amountX,
        bytes calldata data
    ) external returns (uint128 orderX, uint128 acquireY);

    /// @notice Add a limit order (selling y) in the pool.
    /// @param recipient owner of the limit order
    /// @param point point of the order, be sure to be times of pointDelta
    /// @param amountY amount of tokenY to sell
    /// @param data any data that should be passed through to the callback
    /// @return orderY actual added amount of tokenY
    /// @return acquireX amount of tokenX acquired if there exists a limit order to sell x before adding
    function addLimOrderWithY(
        address recipient,
        int24 point,
        uint128 amountY,
        bytes calldata data
    ) external returns (uint128 orderY, uint128 acquireX);

    /// @notice Collect earned or decreased token from limit order.
    /// @param recipient address to benefit
    /// @param point point of limit order, be sure to be times of pointDelta
    /// @param collectDec max amount of decreased selling token to collect
    /// @param collectEarn max amount of earned token to collect
    /// @param isEarnY direction of this limit order, true for sell y, false for sell x
    /// @return actualCollectDec actual amount of decresed selling token collected
    /// @return actualCollectEarn actual amount of earned token collected
    function collectLimOrder(
        address recipient, int24 point, uint128 collectDec, uint128 collectEarn, bool isEarnY
    ) external returns(uint128 actualCollectDec, uint128 actualCollectEarn);

    /// @notice Add liquidity to the pool.
    /// @param recipient newly created liquidity will belong to this address
    /// @param leftPt left endpoint of the liquidity, be sure to be times of pointDelta
    /// @param rightPt right endpoint of the liquidity, be sure to be times of pointDelta
    /// @param liquidDelta amount of liquidity to add
    /// @param data any data that should be passed through to the callback
    /// @return amountX The amount of tokenX that was paid for the liquidity. Matches the value in the callback
    /// @return amountY The amount of tokenY that was paid for the liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 leftPt,
        int24 rightPt,
        uint128 liquidDelta,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice Decrease a given amount of liquidity from msg.sender's liquidities.
    /// @param leftPt left endpoint of the liquidity
    /// @param rightPt right endpoint of the liquidity
    /// @param liquidDelta amount of liquidity to burn
    /// @return amountX The amount of tokenX should be refund after burn
    /// @return amountY The amount of tokenY should be refund after burn
    function burn(
        int24 leftPt,
        int24 rightPt,
        uint128 liquidDelta
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice Collect tokens (fee or refunded after burn) from a liquidity.
    /// @param recipient the address which should receive the collected tokens
    /// @param leftPt left endpoint of the liquidity
    /// @param rightPt right endpoint of the liquidity
    /// @param amountXLim max amount of tokenX the owner wants to collect
    /// @param amountYLim max amount of tokenY the owner wants to collect
    /// @return actualAmountX the amount tokenX collected
    /// @return actualAmountY the amount tokenY collected
    function collect(
        address recipient,
        int24 leftPt,
        int24 rightPt,
        uint256 amountXLim,
        uint256 amountYLim
    ) external returns (uint256 actualAmountX, uint256 actualAmountY);

    /// @notice Swap tokenY for tokenX, given max amount of tokenY user willing to pay.
    /// @param recipient the address to receive tokenX
    /// @param amount the max amount of tokenY user willing to pay
    /// @param highPt the highest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX payed
    /// @return amountY amount of tokenY acquired
    function swapY2X(
        address recipient,
        uint128 amount,
        int24 highPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);
    
    /// @notice Swap tokenY for tokenX, given amount of tokenX user desires.
    /// @param recipient the address to receive tokenX
    /// @param desireX the amount of tokenX user desires
    /// @param highPt the highest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX payed
    /// @return amountY amount of tokenY acquired
    function swapY2XDesireX(
        address recipient,
        uint128 desireX,
        int24 highPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);
    
    /// @notice Swap tokenX for tokenY, given max amount of tokenX user willing to pay.
    /// @param recipient the address to receive tokenY
    /// @param amount the max amount of tokenX user willing to pay
    /// @param lowPt the lowest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX acquired
    /// @return amountY amount of tokenY payed
    function swapX2Y(
        address recipient,
        uint128 amount,
        int24 lowPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);
    
    /// @notice Swap tokenX for tokenY, given amount of tokenY user desires.
    /// @param recipient the address to receive tokenY
    /// @param desireY the amount of tokenY user desires
    /// @param lowPt the lowest point(price) of x/y during swap
    /// @param data any data to be passed through to the callback
    /// @return amountX amount of tokenX acquired
    /// @return amountY amount of tokenY payed
    function swapX2YDesireY(
        address recipient,
        uint128 desireY,
        int24 lowPt,
        bytes calldata data
    ) external returns (uint256 amountX, uint256 amountY);

    /// @notice Returns sqrt(1.0001), in 96 bit fixpoint number.
    function sqrtRate_96() external view returns(uint160);
    
    /// @notice State values of pool.
    /// @return sqrtPrice_96 a 96 fixpoing number describe the sqrt value of current price(tokenX/tokenY)
    /// @return currentPoint the current point of the pool, 1.0001 ^ currentPoint = price
    /// @return observationCurrentIndex the index of the last oracle observation that was written,
    /// @return observationQueueLen the current maximum number of observations stored in the pool,
    /// @return observationNextQueueLen the next maximum number of observations, to be updated when the observation.
    /// @return locked whether the pool is locked (only used for checking reentrance)
    /// @return liquidity liquidity on the currentPoint (currX * sqrtPrice + currY / sqrtPrice)
    /// @return liquidityX liquidity of tokenX
    function state()
        external view
        returns(
            uint160 sqrtPrice_96,
            int24 currentPoint,
            uint16 observationCurrentIndex,
            uint16 observationQueueLen,
            uint16 observationNextQueueLen,
            bool locked,
            uint128 liquidity,
            uint128 liquidityX
        );
    
    /// @notice LimitOrder info on a given point.
    /// @param point the given point 
    /// @return sellingX total amount of tokenX selling on the point
    /// @return earnY total amount of unclaimed earned tokenY for unlegacy sellingX
    /// @return accEarnY total amount of earned tokenY(via selling tokenX) by all users at this point as of the last swap
    /// @return legacyAccEarnY latest recorded 'accEarnY' value when sellingX is clear (legacy)
    /// @return legacyEarnY total amount of unclaimed earned tokenY for legacy (cleared during swap) sellingX
    /// @return sellingY total amount of tokenYselling on the point
    /// @return earnX total amount of unclaimed earned tokenX for unlegacy sellingY
    /// @return legacyEarnX total amount of unclaimed earned tokenX for legacy (cleared during swap) sellingY
    /// @return accEarnX total amount of earned tokenX(via selling tokenY) by all users at this point as of the last swap
    /// @return legacyAccEarnX latest recorded 'accEarnX' value when sellingY is clear (legacy)
    function limitOrderData(int24 point)
        external view
        returns(
            uint128 sellingX,
            uint128 earnY,
            uint256 accEarnY,
            uint256 legacyAccEarnY,
            uint128 legacyEarnY,
            uint128 sellingY,
            uint128 earnX,
            uint128 legacyEarnX,
            uint256 accEarnX,
            uint256 legacyAccEarnX
        );
    
    /// @notice Query infomation about a point whether has limit order or is an liquidity's endpoint.
    /// @param point point to query
    /// @return val endpoint for val&1>0 and has limit order for val&2 > 0
    function orderOrEndpoint(int24 point) external returns(int24 val);

    /// @notice Returns observation data about a specific index.
    /// @param index the index of observation array
    /// @return timestamp the timestamp of the observation,
    /// @return accPoint the point multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// @return init whether the observation has been initialized and the above values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 timestamp,
            int56 accPoint,
            bool init
        );

    /// @notice Point status in the pool.
    /// @param point the point
    /// @return liquidSum the total amount of liquidity that uses the point either as left endpoint or right endpoint
    /// @return liquidDelta how much liquidity changes when the pool price crosses the point from left to right
    /// @return accFeeXOut_128 the fee growth on the other side of the point from the current point in tokenX
    /// @return accFeeYOut_128 the fee growth on the other side of the point from the current point in tokenY
    /// @return isEndpt whether the point is an endpoint of a some miner's liquidity, true if liquidSum > 0
    function points(int24 point)
        external
        view
        returns (
            uint128 liquidSum,
            int128 liquidDelta,
            uint256 accFeeXOut_128,
            uint256 accFeeYOut_128,
            bool isEndpt
        );

    /// @notice Returns 256 packed point (statusVal>0) boolean values. See PointBitmap for more information.
    function pointBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the integral value of point(time) and integral value of 1/liquidity(time)
    ///     at some target timestamps (block.timestamp - secondsAgo[i])
    /// @dev Reverts if target timestamp is early than oldest observation in the queue
    /// @dev If you call this method with secondsAgos = [3600, 0]. the average point of this pool during recent hour is 
    /// (accPoints[1] - accPoints[0]) / 3600
    /// @param secondsAgos describe the target timestamp , targetTimestimp[i] = block.timestamp - secondsAgo[i]
    /// @return accPoints integral value of point(time) from 0 to each target timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory accPoints);
    
    /// @notice Expand max-length of observation queue.
    /// @param newNextQueueLen new value of observationNextQueueLen, which should be greater than current observationNextQueueLen
    function expandObservationQueue(uint16 newNextQueueLen) external;

    /// @notice Borrow tokenX and/or tokenY and pay it back within a block.
    /// @dev The caller needs to implement a IiZiSwapPool#flashCallback callback function
    /// @param recipient the address which will receive the tokenY and/or tokenX
    /// @param amountX the amount of tokenX to borrow
    /// @param amountY the amount of tokenY to borrow
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amountX,
        uint256 amountY,
        bytes calldata data
    ) external;

    /// @notice Returns a snapshot infomation of Liquidity in [leftPoint, rightPoint).
    /// @param leftPoint left endpoint of range, should be times of pointDelta
    /// @param rightPoint right endpoint of range, should be times of pointDelta
    /// @return deltaLiquidities an array of delta liquidity for points in the range
    ///    note 1. delta liquidity here is amount of liquidity changed when cross a point from left to right
    ///    note 2. deltaLiquidities only contains points which are times of pointDelta
    ///    note 3. this function may cost a ENORMOUS amount of gas, be careful to call
    function liquiditySnapshot(int24 leftPoint, int24 rightPoint) external view returns(int128[] memory deltaLiquidities);

    struct LimitOrderStruct {
        uint128 sellingX;
        uint128 earnY;
        uint256 accEarnY;
        uint128 sellingY;
        uint128 earnX;
        uint256 accEarnX;
    }

    /// @notice Returns a snapshot infomation of Limit Order in [leftPoint, rightPoint).
    /// @param leftPoint left endpoint of range, should be times of pointDelta
    /// @param rightPoint right endpoint of range, should be times of pointDelta
    /// @return limitOrders an array of Limit Orders for points in the range
    ///    note 1. this function may cost a HUGE amount of gas, be careful to call
    function limitOrderSnapshot(int24 leftPoint, int24 rightPoint) external view returns(LimitOrderStruct[] memory limitOrders); 

    /// @notice Amount of charged fee on tokenX.
    function totalFeeXCharged() external view returns(uint256);

    /// @notice Amount of charged fee on tokenY.
    function totalFeeYCharged() external view returns(uint256);

    /// @notice Percent to charge from miner's fee.
    function feeChargePercent() external view returns(uint24);

    /// @notice Collect charged fee, only factory's chargeReceiver can call.
    function collectFeeCharged() external;

    /// @notice modify 'feeChargePercent', only owner has authority.
    /// @param newFeeChargePercent new value of feeChargePercent, a nature number range in [0, 100], 
    function modifyFeeChargePercent(uint24 newFeeChargePercent) external;
    
}

File 6 of 8 : BytesLib.sol
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * @title Solidity Bytes Arrays Utils
 * @author Gonçalo Sá <[email protected]>
 *
 * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
 *      The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
 */
pragma solidity ^0.8.4;

library BytesLib {

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

        bytes memory tempBytes;

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

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

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

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

                    mstore(tempBytes, _length)

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

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

        return tempBytes;
    }

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

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

        return tempAddress;
    }

    function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) {
        require(_start + 3 >= _start, 'toUint24_overflow');
        require(_bytes.length >= _start + 3, 'toUint24_outOfBounds');
        uint24 tempUint;

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

        return tempUint;
    }
    
}

File 7 of 8 : Path.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.4;

import "./BytesLib.sol";

/// @title Functions for manipulating path data for multihop swaps
library Path {

    using BytesLib for bytes;

    /// @dev The length of the bytes encoded address
    uint256 private constant ADDR_SIZE = 20;
    /// @dev The length of the bytes encoded fee
    uint256 private constant FEE_SIZE = 3;

    /// @dev The offset of a single token address and pool fee
    uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE;
    /// @dev The offset of an encoded pool key
    uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE;
    /// @dev The minimum length of an encoding that contains 2 or more pools
    uint256 private constant MULTIPLE_POOLS_MIN_LENGTH = POP_OFFSET + NEXT_OFFSET;

    /// @notice Returns true iff the path contains two or more pools
    /// @param path The encoded swap path
    /// @return True if path contains two or more pools, otherwise false
    function hasMultiplePools(bytes memory path) internal pure returns (bool) {
        return path.length >= MULTIPLE_POOLS_MIN_LENGTH;
    }

    /// @notice Returns the number of pools in the path
    /// @param path The encoded swap path
    /// @return The number of pools in the path
    function numPools(bytes memory path) internal pure returns (uint256) {
        // Ignore the first token address. From then on every fee and token offset indicates a pool.
        return ((path.length - ADDR_SIZE) / NEXT_OFFSET);
    }

    /// @notice Decodes the first pool in path
    /// @param path The bytes encoded swap path
    /// @return tokenA The first token of the given pool
    /// @return tokenB The second token of the given pool
    /// @return fee The fee level of the pool
    function decodeFirstPool(bytes memory path)
        internal
        pure
        returns (
            address tokenA,
            address tokenB,
            uint24 fee
        )
    {
        tokenA = path.toAddress(0);
        fee = path.toUint24(ADDR_SIZE);
        tokenB = path.toAddress(NEXT_OFFSET);
    }

    /// @notice Gets the segment corresponding to the first pool in the path
    /// @param path The bytes encoded swap path
    /// @return The segment containing all data necessary to target the first pool in the path
    function getFirstPool(bytes memory path) internal pure returns (bytes memory) {
        return path.slice(0, POP_OFFSET);
    }

    /// @notice Skips a token + fee element from the buffer and returns the remainder
    /// @param path The swap path
    /// @return The remaining token + fee elements in the path
    function skipToken(bytes memory path) internal pure returns (bytes memory) {
        return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET);
    }
    
}

File 8 of 8 : Swap.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;

import "./core/interfaces/IiZiSwapCallback.sol";
import "./core/interfaces/IiZiSwapFactory.sol";
import "./core/interfaces/IiZiSwapPool.sol";

import "./libraries/Path.sol";

import "./base/base.sol";

contract Swap is Base, IiZiSwapCallback {

    uint256 private constant DEFAULT_PAYED_CACHED = type(uint256).max;
    uint256 private payedCached = DEFAULT_PAYED_CACHED;

    using Path for bytes;

    struct SwapCallbackData {
        bytes path;
        address payer;
    }

    /// @notice constructor to create this contract
    /// @param _factory address of iZiSwapFactory
    /// @param _weth address of weth token
    constructor(address _factory, address _weth) Base(_factory, _weth) {}

    /// @notice Callback for swapY2X and swapY2XDesireX, in order to pay tokenY from trader.
    /// @param x amount of tokenX trader acquired
    /// @param y amount of tokenY need to pay from trader
    /// @param data encoded SwapCallbackData
    function swapY2XCallback(
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external override {
        SwapCallbackData memory dt = abi.decode(data, (SwapCallbackData));

        (address token0, address token1, uint24 fee) = dt.path.decodeFirstPool();
        verify(token0, token1, fee);
        if (token0 < token1) {
            // token1 is y, amount of token1 is calculated
            // called from swapY2XDesireX(...)
            if (dt.path.hasMultiplePools()) {
                dt.path = dt.path.skipToken();
                swapDesireInternal(y, msg.sender, dt);
            } else {
                pay(token1, dt.payer, msg.sender, y);
                payedCached = y;
            }
        } else {
            // token0 is y, amount of token0 is input param
            // called from swapY2X(...)
            pay(token0, dt.payer, msg.sender, y);
        }
    }

    /// @notice Callback for swapX2Y and swapX2YDesireY, in order to pay tokenX from trader.
    /// @param x amount of tokenX need to pay from trader
    /// @param y amount of tokenY trader acquired
    /// @param data encoded SwapCallbackData
    function swapX2YCallback(
        uint256 x,
        uint256 y,
        bytes calldata data
    ) external override {
        SwapCallbackData memory dt = abi.decode(data, (SwapCallbackData));
        (address token0, address token1, uint24 fee) = dt.path.decodeFirstPool();
        verify(token0, token1, fee);
        if (token0 < token1) {
            // token0 is x, amount of token0 is input param
            // called from swapX2Y(...)
            pay(token0, dt.payer, msg.sender, x);
        } else {
            // token1 is x, amount of token1 is calculated param
            // called from swapX2YDesireY(...)
            if (dt.path.hasMultiplePools()) {
                dt.path = dt.path.skipToken();
                swapDesireInternal(x, msg.sender, dt);
            } else {
                pay(token1, dt.payer, msg.sender, x);
                payedCached = x;
            }
        }
    }

    function swapDesireInternal(
        uint256 desire,
        address recipient,
        SwapCallbackData memory data
    ) private returns (uint256 acquire) {
        // allow swapping to the router address with address 0
        if (recipient == address(0)) recipient = address(this);

        (address tokenOut, address tokenIn, uint24 fee) = data.path.decodeFirstPool();

        address poolAddr = pool(tokenOut, tokenIn, fee);
        if (tokenOut < tokenIn) {
            // tokenOut is tokenX, tokenIn is tokenY
            // we should call y2XDesireX

            (acquire, ) = IiZiSwapPool(poolAddr).swapY2XDesireX(
                recipient, uint128(desire), 800001,
                abi.encode(data)
            );
        } else {
            // tokenOut is tokenY
            // tokenIn is tokenX
            (, acquire) = IiZiSwapPool(poolAddr).swapX2YDesireY(
                recipient, uint128(desire), -800001,
                abi.encode(data)
            );
        }
    }

    function swapAmountInternal(
        uint128 amount,
        address recipient,
        SwapCallbackData memory data
    ) private returns (uint256 cost, uint256 acquire) {
        // allow swapping to the router address with address 0
        if (recipient == address(0)) recipient = address(this);

        address payer = msg.sender; // msg.sender pays for the first hop

        bool firstHop = true;

        while (true) {
            bool hasMultiplePools = data.path.hasMultiplePools();
            (address tokenIn, address tokenOut, uint24 fee) = data.path.decodeFirstPool();
            address poolAddr = pool(tokenOut, tokenIn, fee);
            if (tokenIn < tokenOut) {
                // swapX2Y
                uint256 costX;
                (costX, acquire) = IiZiSwapPool(poolAddr).swapX2Y(
                    hasMultiplePools? address(this): recipient, amount, -799999,
                    abi.encode(SwapCallbackData({path: abi.encodePacked(tokenIn, fee, tokenOut), payer: payer}))
                );
                if (firstHop) {
                    cost = costX;
                }
            } else {
                // swapY2X
                uint256 costY;
                (acquire, costY) = IiZiSwapPool(poolAddr).swapY2X(
                    hasMultiplePools? address(this): recipient, amount, 799999,
                    abi.encode(SwapCallbackData({path: abi.encodePacked(tokenIn, fee, tokenOut), payer: payer}))
                );
                if (firstHop) {
                    cost = costY;
                }
            }
            firstHop = false;

            // decide whether to continue or terminate
            if (hasMultiplePools) {
                payer = address(this); // at this point, the caller has paid
                data.path = data.path.skipToken();
                amount = uint128(acquire);
            } else {
                break;
            }
        }
    }

    struct SwapDesireParams {
        bytes path;
        address recipient;
        uint128 desire;
        uint256 maxPayed;

        uint256 deadline;
    }


    /// @notice Swap given amount of target token, usually used in multi-hop case.
    function swapDesire(SwapDesireParams calldata params)
        external
        payable
        checkDeadline(params.deadline)
        returns (uint256 cost, uint256 acquire)
    {
        
        acquire = swapDesireInternal(
            params.desire,
            params.recipient,
            SwapCallbackData({path: params.path, payer: msg.sender})
        );
        cost = payedCached;
        require(cost <= params.maxPayed, 'Too much payed in swapDesire');
        require(acquire >= params.desire, 'Too much requested in swapDesire');
        payedCached = DEFAULT_PAYED_CACHED;
    }

    struct SwapAmountParams {
        bytes path;
        address recipient;
        // uint256 deadline;
        uint128 amount;
        uint256 minAcquired;

        uint256 deadline;
    }

    /// @notice Swap given amount of input token, usually used in multi-hop case.
    function swapAmount(SwapAmountParams calldata params)
        external
        payable
        checkDeadline(params.deadline)
        returns (uint256 cost, uint256 acquire) 
    {
        (cost, acquire) = swapAmountInternal(
            params.amount, 
            params.recipient, 
            SwapCallbackData({path: params.path, payer: msg.sender})
        );
        require(acquire >= params.minAcquired, 'Too much requested in swapAmount');
    }

    /// parameters when calling Swap.swap..., grouped together to avoid stake too deep
    struct SwapParams {
        // tokenX of swap pool
        address tokenX;
        // tokenY of swap pool
        address tokenY;
        // fee amount of swap pool
        uint24 fee;
        // highPt for y2x, lowPt for x2y
        // here y2X is calling swapY2X or swapY2XDesireX
        // in swapY2XDesireX, if boundaryPt is 800001, means user wants to get enough X
        // in swapX2YDesireY, if boundaryPt is -800001, means user wants to get enough Y
        int24 boundaryPt; 
        // who will receive acquired token
        address recipient;
        // desired amount for desired mode, paid amount for non-desired mode
        // here, desire mode is calling swapX2YDesireY or swapY2XDesireX
        uint128 amount;
        // max amount of payed token from trader, used in desire mode
        uint256 maxPayed;
        // min amount of received token trader wanted, used in undesire mode
        uint256 minAcquired;

        uint256 deadline;
    }

    // amount of exchanged tokens
    struct ExchangeAmount {
        // amount of tokenX paid or acquired
        uint256 amountX;
        // amount of tokenY acquired or paid
        uint256 amountY;
    }

    /// @notice Swap tokenY for tokenX, given max amount of tokenY user willing to pay
    /// @param swapParams params(for example: max amount in above line), see SwapParams for more
    function swapY2X(
        SwapParams calldata swapParams
    ) external payable checkDeadline(swapParams.deadline) {
        require(swapParams.tokenX < swapParams.tokenY, "x<y");
        address poolAddr = pool(swapParams.tokenX, swapParams.tokenY, swapParams.fee);
        address payer = msg.sender;
        address recipient = (swapParams.recipient == address(0)) ? address(this): swapParams.recipient;
        (uint256 amountX, ) = IiZiSwapPool(poolAddr).swapY2X(
            recipient, swapParams.amount, swapParams.boundaryPt,
            abi.encode(SwapCallbackData({path: abi.encodePacked(swapParams.tokenY, swapParams.fee, swapParams.tokenX), payer: payer}))
        );
        require(amountX >= swapParams.minAcquired, "XMIN");
    }

    /// @notice Swap tokenY for tokenX, given user's desired amount of tokenX.
    /// @param swapParams params(for example: desired amount in above line), see SwapParams for more
    function swapY2XDesireX(
        SwapParams calldata swapParams
    ) external payable checkDeadline(swapParams.deadline) {
        require(swapParams.tokenX < swapParams.tokenY, "x<y");
        address poolAddr = pool(swapParams.tokenX, swapParams.tokenY, swapParams.fee);
        address payer = msg.sender;
        address recipient = (swapParams.recipient == address(0)) ? address(this): swapParams.recipient;
        ExchangeAmount memory amount;
        (amount.amountX, amount.amountY) = IiZiSwapPool(poolAddr).swapY2XDesireX(
            recipient, swapParams.amount, swapParams.boundaryPt,
            abi.encode(SwapCallbackData({path: abi.encodePacked(swapParams.tokenX, swapParams.fee, swapParams.tokenY), payer: payer}))
        );
        if (swapParams.boundaryPt == 800001) {
            require(amount.amountX >= swapParams.amount, 'Too much requested in swapY2XDesireX');
        }
        require(amount.amountY <= swapParams.maxPayed, "YMAX");
    }

    /// @notice Swap tokenX for tokenY, given max amount of tokenX user willing to pay.
    /// @param swapParams params(for example: max amount in above line), see SwapParams for more
    function swapX2Y(
        SwapParams calldata swapParams
    ) external payable checkDeadline(swapParams.deadline) {
        require(swapParams.tokenX < swapParams.tokenY, "x<y");
        address poolAddr = pool(swapParams.tokenX, swapParams.tokenY, swapParams.fee);
        address payer = msg.sender;
        address recipient = (swapParams.recipient == address(0)) ? address(this): swapParams.recipient;
        (, uint256 amountY) = IiZiSwapPool(poolAddr).swapX2Y(
            recipient, swapParams.amount, swapParams.boundaryPt,
            abi.encode(SwapCallbackData({path: abi.encodePacked(swapParams.tokenX, swapParams.fee, swapParams.tokenY), payer: payer}))
        );
        require(amountY >= swapParams.minAcquired, "YMIN");
    }

    /// @notice Swap tokenX for tokenY, given amount of tokenY user desires.
    /// @param swapParams params(for example: desired amount in above line), see SwapParams for more
    function swapX2YDesireY(
        SwapParams calldata swapParams
    ) external payable checkDeadline(swapParams.deadline) {
        require(swapParams.tokenX < swapParams.tokenY, "x<y");
        address poolAddr = pool(swapParams.tokenX, swapParams.tokenY, swapParams.fee);
        address payer = msg.sender;
        address recipient = (swapParams.recipient == address(0)) ? address(this): swapParams.recipient;
        ExchangeAmount memory amount;
        (amount.amountX, amount.amountY) = IiZiSwapPool(poolAddr).swapX2YDesireY(
            recipient, swapParams.amount, swapParams.boundaryPt,
            abi.encode(SwapCallbackData({path: abi.encodePacked(swapParams.tokenY, swapParams.fee, swapParams.tokenX), payer: payer}))
        );
        require(amount.amountX <= swapParams.maxPayed, "XMAX");
        if (swapParams.boundaryPt == -800001) {
            require(amount.amountY >= swapParams.amount, 'Too much requested in swapX2YDesireY');
        }
    }
    
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenX","type":"address"},{"internalType":"address","name":"tokenY","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"}],"name":"pool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refundETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Swap.SwapAmountParams","name":"params","type":"tuple"}],"name":"swapAmount","outputs":[{"internalType":"uint256","name":"cost","type":"uint256"},{"internalType":"uint256","name":"acquire","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"desire","type":"uint128"},{"internalType":"uint256","name":"maxPayed","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Swap.SwapDesireParams","name":"params","type":"tuple"}],"name":"swapDesire","outputs":[{"internalType":"uint256","name":"cost","type":"uint256"},{"internalType":"uint256","name":"acquire","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenX","type":"address"},{"internalType":"address","name":"tokenY","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"boundaryPt","type":"int24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"maxPayed","type":"uint256"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Swap.SwapParams","name":"swapParams","type":"tuple"}],"name":"swapX2Y","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapX2YCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenX","type":"address"},{"internalType":"address","name":"tokenY","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"boundaryPt","type":"int24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"maxPayed","type":"uint256"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Swap.SwapParams","name":"swapParams","type":"tuple"}],"name":"swapX2YDesireY","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenX","type":"address"},{"internalType":"address","name":"tokenY","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"boundaryPt","type":"int24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"maxPayed","type":"uint256"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Swap.SwapParams","name":"swapParams","type":"tuple"}],"name":"swapY2X","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"},{"internalType":"uint256","name":"y","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swapY2XCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"tokenX","type":"address"},{"internalType":"address","name":"tokenY","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"boundaryPt","type":"int24"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint256","name":"maxPayed","type":"uint256"},{"internalType":"uint256","name":"minAcquired","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct Swap.SwapParams","name":"swapParams","type":"tuple"}],"name":"swapY2XDesireX","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"minAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"unwrapWETH9","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60c06040526000196000553480156200001757600080fd5b5060405162002a6938038062002a698339810160408190526200003a9162000076565b6001600160601b0319606092831b8116608052911b1660a052620000ad565b80516001600160a01b03811681146200007157600080fd5b919050565b6000806040838503121562000089578182fd5b620000948362000059565b9150620000a46020840162000059565b90509250929050565b60805160601c60a05160601c612966620001036000396000818161017a0152818161097f01528181610a42015281816118090152818161184f01526118e4015260008181610221015261105801526129666000f3fe6080604052600436106100cc5760003560e01c806375ceafe61161007a57806375ceafe6146101a9578063826377f6146101bc578063ac9650d8146101cf578063becbcc6a146101ef578063c45a01551461020f578063d3e1c28414610243578063df2ab5bb14610263578063f3da61a91461027657600080fd5b8063115ff67e146100d857806312210e8a14610105578063187806841461010f578063247ec02c1461012f57806346edd9c81461014257806349404b7c146101555780634aa4a4fc1461016857600080fd5b366100d357005b600080fd5b6100eb6100e636600461235e565b610289565b604080519283526020830191909152015b60405180910390f35b61010d61040f565b005b34801561011b57600080fd5b5061010d61012a3660046124ff565b610421565b61010d61013d366004612442565b6104d1565b61010d610150366004612442565b610732565b61010d6101633660046124ad565b610965565b34801561017457600080fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b6040516100fc919061260c565b6100eb6101b736600461235e565b610ab5565b61010d6101ca366004612442565b610bb7565b6101e26101dd366004612237565b610ea2565b6040516100fc9190612667565b3480156101fb57600080fd5b5061019c61020a3660046121b0565b611023565b34801561021b57600080fd5b5061019c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561024f57600080fd5b5061010d61025e3660046124ff565b6110dc565b61010d6102713660046121f6565b61117b565b61010d610284366004612442565b611233565b6000808260800135804211156102ba5760405162461bcd60e51b81526004016102b19061274a565b60405180910390fd5b61033e6102cd6060860160408701612454565b6001600160801b03166102e66040870160208801612171565b60408051808201909152806102fb89806127ac565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611521565b9150600054925083606001358311156103995760405162461bcd60e51b815260206004820152601c60248201527f546f6f206d75636820706179656420696e20737761704465736972650000000060448201526064016102b1565b6103a96060850160408601612454565b6001600160801b03168210156104015760405162461bcd60e51b815260206004820181905260248201527f546f6f206d7563682072657175657374656420696e207377617044657369726560448201526064016102b1565b506000196000559092909150565b471561041f5761041f33476116d8565b565b600061042f82840184612390565b90506000806000610443846000015161177b565b9250925092506104548383836117b7565b816001600160a01b0316836001600160a01b031610156104835761047e838560200151338b611807565b6104c7565b835161048e90611997565b156104b157835161049e906119d1565b84526104ab883386611521565b506104c7565b6104c1828560200151338b611807565b60008890555b5050505050505050565b806101000135804211156104f75760405162461bcd60e51b81526004016102b19061274a565b6105076040830160208401612171565b6001600160a01b031661051d6020840184612171565b6001600160a01b0316106105435760405162461bcd60e51b81526004016102b1906126db565b60006105756105556020850185612171565b6105656040860160208701612171565b61020a606087016040880161247b565b90503360008061058b60a0870160808801612171565b6001600160a01b0316146105ae576105a960a0860160808701612171565b6105b0565b305b905060006001600160a01b038416632c481252836105d460c08a0160a08b01612454565b6105e460808b0160608c016122c6565b60405180604001604052808c60200160208101906106029190612171565b8d6040016020810190610615919061247b565b8e60000160208101906106289190612171565b60405160200161063a939291906125a5565b6040516020818303038152906040528152602001896001600160a01b031681525060405160200161066b919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016106999493929190612620565b6040805180830381600087803b1580156106b257600080fd5b505af11580156106c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ea91906124dc565b5090508560e0013581101561072a5760405162461bcd60e51b81526004016102b1906020808252600490820152632c26a4a760e11b604082015260600190565b505050505050565b806101000135804211156107585760405162461bcd60e51b81526004016102b19061274a565b6107686040830160208401612171565b6001600160a01b031661077e6020840184612171565b6001600160a01b0316106107a45760405162461bcd60e51b81526004016102b1906126db565b60006107b66105556020850185612171565b9050336000806107cc60a0870160808801612171565b6001600160a01b0316146107ef576107ea60a0860160808701612171565b6107f1565b305b905060006001600160a01b03841663857f812f8361081560c08a0160a08b01612454565b61082560808b0160608c016122c6565b604080518082019091528061083d60208e018e612171565b8d6040016020810190610850919061247b565b8e60200160208101906108639190612171565b604051602001610875939291906125a5565b6040516020818303038152906040528152602001896001600160a01b03168152506040516020016108a6919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016108d49493929190612620565b6040805180830381600087803b1580156108ed57600080fd5b505af1158015610901573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092591906124dc565b9150508560e0013581101561072a5760405162461bcd60e51b81526004016102b1906020808252600490820152632ca6a4a760e11b604082015260600190565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906109b490309060040161260c565b60206040518083038186803b1580156109cc57600080fd5b505afa1580156109e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a049190612495565b905082811015610a265760405162461bcd60e51b81526004016102b190612720565b8015610ab057604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610a8e57600080fd5b505af1158015610aa2573d6000803e3d6000fd5b50505050610ab082826116d8565b505050565b600080826080013580421115610add5760405162461bcd60e51b81526004016102b19061274a565b610b58610af06060860160408701612454565b610b006040870160208801612171565b6040805180820190915280610b1589806127ac565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611a08565b90935091506060840135821015610bb15760405162461bcd60e51b815260206004820181905260248201527f546f6f206d7563682072657175657374656420696e2073776170416d6f756e7460448201526064016102b1565b50915091565b80610100013580421115610bdd5760405162461bcd60e51b81526004016102b19061274a565b610bed6040830160208401612171565b6001600160a01b0316610c036020840184612171565b6001600160a01b031610610c295760405162461bcd60e51b81526004016102b1906126db565b6000610c3b6105556020850185612171565b905033600080610c5160a0870160808801612171565b6001600160a01b031614610c7457610c6f60a0860160808701612171565b610c76565b305b9050610c95604051806040016040528060008152602001600081525090565b6001600160a01b03841663f094685a83610cb560c08a0160a08b01612454565b610cc560808b0160608c016122c6565b6040805180820190915280610cdd60208e018e612171565b8d6040016020810190610cf0919061247b565b8e6020016020810190610d039190612171565b604051602001610d15939291906125a5565b6040516020818303038152906040528152602001896001600160a01b0316815250604051602001610d46919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401610d749493929190612620565b6040805180830381600087803b158015610d8d57600080fd5b505af1158015610da1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc591906124dc565b60208301528152610ddc60808701606088016122c6565b60020b620c35011415610e6157610df960c0870160a08801612454565b6001600160801b031681600001511015610e615760405162461bcd60e51b8152602060048201526024808201527f546f6f206d7563682072657175657374656420696e20737761705932584465736044820152630d2e4cab60e31b60648201526084016102b1565b8560c001358160200151111561072a5760405162461bcd60e51b81526004016102b1906020808252600490820152630b29a82b60e31b604082015260600190565b6060816001600160401b03811115610eca57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610efd57816020015b6060815260200190600190039081610ee85790505b50905060005b8281101561101c5760008030868685818110610f2f57634e487b7160e01b600052603260045260246000fd5b9050602002810190610f4191906127ac565b604051610f4f9291906125e0565b600060405180830381855af49150503d8060008114610f8a576040519150601f19603f3d011682016040523d82523d6000602084013e610f8f565b606091505b509150915081610fdb57604481511015610fa857600080fd5b60048101905080806020019051810190610fc291906122e7565b60405162461bcd60e51b81526004016102b191906126c8565b80848481518110610ffc57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050508080611014906128d1565b915050610f03565b5092915050565b604051635f65e63560e11b81526001600160a01b038481166004830152838116602483015262ffffff831660448301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063becbcc6a9060640160206040518083038186803b15801561109c57600080fd5b505afa1580156110b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d49190612194565b949350505050565b60006110ea82840184612390565b905060008060006110fe846000015161177b565b92509250925061110f8383836117b7565b816001600160a01b0316836001600160a01b0316101561116b57835161113490611997565b15611151578351611144906119d1565b84526104ab873386611521565b611161828560200151338a611807565b60008790556104c7565b6104c7838560200151338a611807565b6040516370a0823160e01b81526000906001600160a01b038516906370a08231906111aa90309060040161260c565b60206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fa9190612495565b90508281101561121c5760405162461bcd60e51b81526004016102b190612720565b801561122d5761122d848383611cc1565b50505050565b806101000135804211156112595760405162461bcd60e51b81526004016102b19061274a565b6112696040830160208401612171565b6001600160a01b031661127f6020840184612171565b6001600160a01b0316106112a55760405162461bcd60e51b81526004016102b1906126db565b60006112b76105556020850185612171565b9050336000806112cd60a0870160808801612171565b6001600160a01b0316146112f0576112eb60a0860160808701612171565b6112f2565b305b9050611311604051806040016040528060008152602001600081525090565b6001600160a01b0384166359dd14368361133160c08a0160a08b01612454565b61134160808b0160608c016122c6565b60405180604001604052808c602001602081019061135f9190612171565b8d6040016020810190611372919061247b565b8e60000160208101906113859190612171565b604051602001611397939291906125a5565b6040516020818303038152906040528152602001896001600160a01b03168152506040516020016113c8919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016113f69493929190612620565b6040805180830381600087803b15801561140f57600080fd5b505af1158015611423573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144791906124dc565b602083015280825260c0870135101561148b5760405162461bcd60e51b81526004016102b1906020808252600490820152630b09a82b60e31b604082015260600190565b61149b60808701606088016122c6565b60020b620c350019141561072a576114b960c0870160a08801612454565b6001600160801b03168160200151101561072a5760405162461bcd60e51b8152602060048201526024808201527f546f6f206d7563682072657175657374656420696e20737761705832594465736044820152636972655960e01b60648201526084016102b1565b60006001600160a01b038316611535573092505b6000806000611547856000015161177b565b925092509250600061155a848484611023565b9050826001600160a01b0316846001600160a01b0316101561162357806001600160a01b031663f094685a888a620c35018a60405160200161159c919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016115ca9493929190612620565b6040805180830381600087803b1580156115e357600080fd5b505af11580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b91906124dc565b5094506116cd565b806001600160a01b03166359dd1436888a620c3500198a60405160200161164a919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016116789493929190612620565b6040805180830381600087803b15801561169157600080fd5b505af11580156116a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c991906124dc565b9550505b505050509392505050565b604080516000808252602082019092526001600160a01b03841690839060405161170291906125f0565b60006040518083038185875af1925050503d806000811461173f576040519150601f19603f3d011682016040523d82523d6000602084013e611744565b606091505b5050905080610ab05760405162461bcd60e51b815260206004820152600360248201526253544560e81b60448201526064016102b1565b600080806117898482611dc1565b9250611796846014611e75565b90506117ae6117a760036014612876565b8590611dc1565b91509193909250565b6117c2838383611023565b6001600160a01b0316336001600160a01b031614610ab05760405162461bcd60e51b8152602060048201526002602482015261073760f41b60448201526064016102b1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b03161480156118485750804710155b1561196a577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156118a857600080fd5b505af11580156118bc573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690527f000000000000000000000000000000000000000000000000000000000000000016935063a9059cbb92506044019050602060405180830381600087803b15801561192c57600080fd5b505af1158015611940573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196491906122a6565b5061122d565b6001600160a01b03831630141561198b57611986848383611cc1565b61122d565b61122d84848484611f20565b60006119a560036014612876565b60146119b2600382612876565b6119bc9190612876565b6119c69190612876565b825110159050919050565b6060611a026119e260036014612876565b6119ee60036014612876565b84516119fa919061288e565b849190612022565b92915050565b6000806001600160a01b038416611a1d573093505b3360015b6000611a308660000151611997565b90506000806000611a44896000015161177b565b9250925092506000611a57838584611023565b9050826001600160a01b0316846001600160a01b03161015611b7b576000816001600160a01b031663857f812f87611a8f578d611a91565b305b8f620c34fe1960405180604001604052808b8a8c604051602001611ab7939291906125a5565b60405160208183030381529060405281526020018e6001600160a01b0316815250604051602001611ae8919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401611b169493929190612620565b6040805180830381600087803b158015611b2f57600080fd5b505af1158015611b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6791906124dc565b995090508615611b75578099505b50611c7f565b6000816001600160a01b0316632c48125287611b97578d611b99565b305b8f620c34ff60405180604001604052808b8a8c604051602001611bbe939291906125a5565b60405160208183030381529060405281526020018e6001600160a01b0316815250604051602001611bef919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401611c1d9493929190612620565b6040805180830381600087803b158015611c3657600080fd5b505af1158015611c4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6e91906124dc565b90995090508615611c7d578099505b505b600095508415611ca3578951309750611c97906119d1565b8a52969a508a96611cad565b5050505050611cb7565b5050505050611a21565b5050935093915050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611d1d91906125f0565b6000604051808303816000865af19150503d8060008114611d5a576040519150601f19603f3d011682016040523d82523d6000602084013e611d5f565b606091505b5091509150818015611d89575080511580611d89575080806020019051810190611d8991906122a6565b611dba5760405162461bcd60e51b815260206004820152600260248201526114d560f21b60448201526064016102b1565b5050505050565b600081611dcf816014612876565b1015611e125760405162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b60448201526064016102b1565b611e1d826014612876565b83511015611e655760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016102b1565b500160200151600160601b900490565b600081611e83816003612876565b1015611ec55760405162461bcd60e51b8152602060048201526011602482015270746f55696e7432345f6f766572666c6f7760781b60448201526064016102b1565b611ed0826003612876565b83511015611f175760405162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b60448201526064016102b1565b50016003015190565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691611f8491906125f0565b6000604051808303816000865af19150503d8060008114611fc1576040519150601f19603f3d011682016040523d82523d6000602084013e611fc6565b606091505b5091509150818015611ff0575080511580611ff0575080806020019051810190611ff091906122a6565b61072a5760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b60448201526064016102b1565b60608161203081601f612876565b101561204e5760405162461bcd60e51b81526004016102b1906126f8565b826120598382612876565b10156120775760405162461bcd60e51b81526004016102b1906126f8565b6120818284612876565b845110156120c55760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102b1565b6060821580156120e4576040519150600082526020820160405261212e565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561211d578051835260209283019201612105565b5050858452601f01601f1916604052505b50949350505050565b803561214281612918565b919050565b600060a08284031215612158578081fd5b50919050565b803562ffffff8116811461214257600080fd5b600060208284031215612182578081fd5b813561218d81612918565b9392505050565b6000602082840312156121a5578081fd5b815161218d81612918565b6000806000606084860312156121c4578182fd5b83356121cf81612918565b925060208401356121df81612918565b91506121ed6040850161215e565b90509250925092565b60008060006060848603121561220a578283fd5b833561221581612918565b925060208401359150604084013561222c81612918565b809150509250925092565b60008060208385031215612249578182fd5b82356001600160401b038082111561225f578384fd5b818501915085601f830112612272578384fd5b813581811115612280578485fd5b8660208260051b8501011115612294578485fd5b60209290920196919550909350505050565b6000602082840312156122b7578081fd5b8151801515811461218d578182fd5b6000602082840312156122d7578081fd5b81358060020b811461218d578182fd5b6000602082840312156122f8578081fd5b81516001600160401b0381111561230d578182fd5b8201601f8101841361231d578182fd5b805161233061232b8261284f565b61281f565b818152856020838501011115612344578384fd5b6123558260208301602086016128a5565b95945050505050565b60006020828403121561236f578081fd5b81356001600160401b03811115612384578182fd5b6110d484828501612147565b600060208083850312156123a2578182fd5b82356001600160401b03808211156123b8578384fd5b90840190604082870312156123cb578384fd5b6123d36127f7565b8235828111156123e1578586fd5b83019150601f820187136123f3578485fd5b813561240161232b8261284f565b8181528886838601011115612414578687fd5b818685018783013790810185018690528152612431838501612137565b848201528094505050505092915050565b60006101208284031215612158578081fd5b600060208284031215612465578081fd5b81356001600160801b038116811461218d578182fd5b60006020828403121561248c578081fd5b61218d8261215e565b6000602082840312156124a6578081fd5b5051919050565b600080604083850312156124bf578182fd5b8235915060208301356124d181612918565b809150509250929050565b600080604083850312156124ee578182fd5b505080516020909101519092909150565b60008060008060608587031215612514578182fd5b843593506020850135925060408501356001600160401b0380821115612538578384fd5b818701915087601f83011261254b578384fd5b813581811115612559578485fd5b88602082850101111561256a578485fd5b95989497505060200194505050565b600081518084526125918160208601602086016128a5565b601f01601f19169290920160200192915050565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b8183823760009101908152919050565b600082516126028184602087016128a5565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03851681526001600160801b0384166020820152600283900b604082015260806060820181905260009061265d90830184612579565b9695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b828110156126bb57603f198886030184526126a9858351612579565b9450928501929085019060010161268d565b5092979650505050505050565b60208152600061218d6020830184612579565b602080825260039082015262783c7960e81b604082015260600190565b6020808252600e908201526d736c6963655f6f766572666c6f7760901b604082015260600190565b60208082526010908201526f0ae8aa89072409cdee8408adcdeeaced60831b604082015260600190565b6020808252600b908201526a4f7574206f662074696d6560a81b604082015260600190565b60208152600082516040602084015261278b6060840182612579565b602094909401516001600160a01b0316604093909301929092525090919050565b6000808335601e198436030181126127c2578283fd5b8301803591506001600160401b038211156127db578283fd5b6020019150368190038213156127f057600080fd5b9250929050565b604080519081016001600160401b038111828210171561281957612819612902565b60405290565b604051601f8201601f191681016001600160401b038111828210171561284757612847612902565b604052919050565b60006001600160401b0382111561286857612868612902565b50601f01601f191660200190565b60008219821115612889576128896128ec565b500190565b6000828210156128a0576128a06128ec565b500390565b60005b838110156128c05781810151838201526020016128a8565b8381111561122d5750506000910152565b60006000198214156128e5576128e56128ec565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461292d57600080fd5b5056fea264697066735822122078ee27f2e530732175884dc64f31c6041da99ef6cd21f953da98cf7ec9d451eb64736f6c634300080400330000000000000000000000008c7d3063579bdb0b90997e18a770eae32e1ebb080000000000000000000000004200000000000000000000000000000000000006

Deployed Bytecode

0x6080604052600436106100cc5760003560e01c806375ceafe61161007a57806375ceafe6146101a9578063826377f6146101bc578063ac9650d8146101cf578063becbcc6a146101ef578063c45a01551461020f578063d3e1c28414610243578063df2ab5bb14610263578063f3da61a91461027657600080fd5b8063115ff67e146100d857806312210e8a14610105578063187806841461010f578063247ec02c1461012f57806346edd9c81461014257806349404b7c146101555780634aa4a4fc1461016857600080fd5b366100d357005b600080fd5b6100eb6100e636600461235e565b610289565b604080519283526020830191909152015b60405180910390f35b61010d61040f565b005b34801561011b57600080fd5b5061010d61012a3660046124ff565b610421565b61010d61013d366004612442565b6104d1565b61010d610150366004612442565b610732565b61010d6101633660046124ad565b610965565b34801561017457600080fd5b5061019c7f000000000000000000000000420000000000000000000000000000000000000681565b6040516100fc919061260c565b6100eb6101b736600461235e565b610ab5565b61010d6101ca366004612442565b610bb7565b6101e26101dd366004612237565b610ea2565b6040516100fc9190612667565b3480156101fb57600080fd5b5061019c61020a3660046121b0565b611023565b34801561021b57600080fd5b5061019c7f0000000000000000000000008c7d3063579bdb0b90997e18a770eae32e1ebb0881565b34801561024f57600080fd5b5061010d61025e3660046124ff565b6110dc565b61010d6102713660046121f6565b61117b565b61010d610284366004612442565b611233565b6000808260800135804211156102ba5760405162461bcd60e51b81526004016102b19061274a565b60405180910390fd5b61033e6102cd6060860160408701612454565b6001600160801b03166102e66040870160208801612171565b60408051808201909152806102fb89806127ac565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611521565b9150600054925083606001358311156103995760405162461bcd60e51b815260206004820152601c60248201527f546f6f206d75636820706179656420696e20737761704465736972650000000060448201526064016102b1565b6103a96060850160408601612454565b6001600160801b03168210156104015760405162461bcd60e51b815260206004820181905260248201527f546f6f206d7563682072657175657374656420696e207377617044657369726560448201526064016102b1565b506000196000559092909150565b471561041f5761041f33476116d8565b565b600061042f82840184612390565b90506000806000610443846000015161177b565b9250925092506104548383836117b7565b816001600160a01b0316836001600160a01b031610156104835761047e838560200151338b611807565b6104c7565b835161048e90611997565b156104b157835161049e906119d1565b84526104ab883386611521565b506104c7565b6104c1828560200151338b611807565b60008890555b5050505050505050565b806101000135804211156104f75760405162461bcd60e51b81526004016102b19061274a565b6105076040830160208401612171565b6001600160a01b031661051d6020840184612171565b6001600160a01b0316106105435760405162461bcd60e51b81526004016102b1906126db565b60006105756105556020850185612171565b6105656040860160208701612171565b61020a606087016040880161247b565b90503360008061058b60a0870160808801612171565b6001600160a01b0316146105ae576105a960a0860160808701612171565b6105b0565b305b905060006001600160a01b038416632c481252836105d460c08a0160a08b01612454565b6105e460808b0160608c016122c6565b60405180604001604052808c60200160208101906106029190612171565b8d6040016020810190610615919061247b565b8e60000160208101906106289190612171565b60405160200161063a939291906125a5565b6040516020818303038152906040528152602001896001600160a01b031681525060405160200161066b919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016106999493929190612620565b6040805180830381600087803b1580156106b257600080fd5b505af11580156106c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ea91906124dc565b5090508560e0013581101561072a5760405162461bcd60e51b81526004016102b1906020808252600490820152632c26a4a760e11b604082015260600190565b505050505050565b806101000135804211156107585760405162461bcd60e51b81526004016102b19061274a565b6107686040830160208401612171565b6001600160a01b031661077e6020840184612171565b6001600160a01b0316106107a45760405162461bcd60e51b81526004016102b1906126db565b60006107b66105556020850185612171565b9050336000806107cc60a0870160808801612171565b6001600160a01b0316146107ef576107ea60a0860160808701612171565b6107f1565b305b905060006001600160a01b03841663857f812f8361081560c08a0160a08b01612454565b61082560808b0160608c016122c6565b604080518082019091528061083d60208e018e612171565b8d6040016020810190610850919061247b565b8e60200160208101906108639190612171565b604051602001610875939291906125a5565b6040516020818303038152906040528152602001896001600160a01b03168152506040516020016108a6919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016108d49493929190612620565b6040805180830381600087803b1580156108ed57600080fd5b505af1158015610901573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092591906124dc565b9150508560e0013581101561072a5760405162461bcd60e51b81526004016102b1906020808252600490820152632ca6a4a760e11b604082015260600190565b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000420000000000000000000000000000000000000616906370a08231906109b490309060040161260c565b60206040518083038186803b1580156109cc57600080fd5b505afa1580156109e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a049190612495565b905082811015610a265760405162461bcd60e51b81526004016102b190612720565b8015610ab057604051632e1a7d4d60e01b8152600481018290527f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610a8e57600080fd5b505af1158015610aa2573d6000803e3d6000fd5b50505050610ab082826116d8565b505050565b600080826080013580421115610add5760405162461bcd60e51b81526004016102b19061274a565b610b58610af06060860160408701612454565b610b006040870160208801612171565b6040805180820190915280610b1589806127ac565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611a08565b90935091506060840135821015610bb15760405162461bcd60e51b815260206004820181905260248201527f546f6f206d7563682072657175657374656420696e2073776170416d6f756e7460448201526064016102b1565b50915091565b80610100013580421115610bdd5760405162461bcd60e51b81526004016102b19061274a565b610bed6040830160208401612171565b6001600160a01b0316610c036020840184612171565b6001600160a01b031610610c295760405162461bcd60e51b81526004016102b1906126db565b6000610c3b6105556020850185612171565b905033600080610c5160a0870160808801612171565b6001600160a01b031614610c7457610c6f60a0860160808701612171565b610c76565b305b9050610c95604051806040016040528060008152602001600081525090565b6001600160a01b03841663f094685a83610cb560c08a0160a08b01612454565b610cc560808b0160608c016122c6565b6040805180820190915280610cdd60208e018e612171565b8d6040016020810190610cf0919061247b565b8e6020016020810190610d039190612171565b604051602001610d15939291906125a5565b6040516020818303038152906040528152602001896001600160a01b0316815250604051602001610d46919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401610d749493929190612620565b6040805180830381600087803b158015610d8d57600080fd5b505af1158015610da1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc591906124dc565b60208301528152610ddc60808701606088016122c6565b60020b620c35011415610e6157610df960c0870160a08801612454565b6001600160801b031681600001511015610e615760405162461bcd60e51b8152602060048201526024808201527f546f6f206d7563682072657175657374656420696e20737761705932584465736044820152630d2e4cab60e31b60648201526084016102b1565b8560c001358160200151111561072a5760405162461bcd60e51b81526004016102b1906020808252600490820152630b29a82b60e31b604082015260600190565b6060816001600160401b03811115610eca57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610efd57816020015b6060815260200190600190039081610ee85790505b50905060005b8281101561101c5760008030868685818110610f2f57634e487b7160e01b600052603260045260246000fd5b9050602002810190610f4191906127ac565b604051610f4f9291906125e0565b600060405180830381855af49150503d8060008114610f8a576040519150601f19603f3d011682016040523d82523d6000602084013e610f8f565b606091505b509150915081610fdb57604481511015610fa857600080fd5b60048101905080806020019051810190610fc291906122e7565b60405162461bcd60e51b81526004016102b191906126c8565b80848481518110610ffc57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050508080611014906128d1565b915050610f03565b5092915050565b604051635f65e63560e11b81526001600160a01b038481166004830152838116602483015262ffffff831660448301526000917f0000000000000000000000008c7d3063579bdb0b90997e18a770eae32e1ebb089091169063becbcc6a9060640160206040518083038186803b15801561109c57600080fd5b505afa1580156110b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d49190612194565b949350505050565b60006110ea82840184612390565b905060008060006110fe846000015161177b565b92509250925061110f8383836117b7565b816001600160a01b0316836001600160a01b0316101561116b57835161113490611997565b15611151578351611144906119d1565b84526104ab873386611521565b611161828560200151338a611807565b60008790556104c7565b6104c7838560200151338a611807565b6040516370a0823160e01b81526000906001600160a01b038516906370a08231906111aa90309060040161260c565b60206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111fa9190612495565b90508281101561121c5760405162461bcd60e51b81526004016102b190612720565b801561122d5761122d848383611cc1565b50505050565b806101000135804211156112595760405162461bcd60e51b81526004016102b19061274a565b6112696040830160208401612171565b6001600160a01b031661127f6020840184612171565b6001600160a01b0316106112a55760405162461bcd60e51b81526004016102b1906126db565b60006112b76105556020850185612171565b9050336000806112cd60a0870160808801612171565b6001600160a01b0316146112f0576112eb60a0860160808701612171565b6112f2565b305b9050611311604051806040016040528060008152602001600081525090565b6001600160a01b0384166359dd14368361133160c08a0160a08b01612454565b61134160808b0160608c016122c6565b60405180604001604052808c602001602081019061135f9190612171565b8d6040016020810190611372919061247b565b8e60000160208101906113859190612171565b604051602001611397939291906125a5565b6040516020818303038152906040528152602001896001600160a01b03168152506040516020016113c8919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016113f69493929190612620565b6040805180830381600087803b15801561140f57600080fd5b505af1158015611423573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144791906124dc565b602083015280825260c0870135101561148b5760405162461bcd60e51b81526004016102b1906020808252600490820152630b09a82b60e31b604082015260600190565b61149b60808701606088016122c6565b60020b620c350019141561072a576114b960c0870160a08801612454565b6001600160801b03168160200151101561072a5760405162461bcd60e51b8152602060048201526024808201527f546f6f206d7563682072657175657374656420696e20737761705832594465736044820152636972655960e01b60648201526084016102b1565b60006001600160a01b038316611535573092505b6000806000611547856000015161177b565b925092509250600061155a848484611023565b9050826001600160a01b0316846001600160a01b0316101561162357806001600160a01b031663f094685a888a620c35018a60405160200161159c919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016115ca9493929190612620565b6040805180830381600087803b1580156115e357600080fd5b505af11580156115f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161b91906124dc565b5094506116cd565b806001600160a01b03166359dd1436888a620c3500198a60405160200161164a919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b81526004016116789493929190612620565b6040805180830381600087803b15801561169157600080fd5b505af11580156116a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116c991906124dc565b9550505b505050509392505050565b604080516000808252602082019092526001600160a01b03841690839060405161170291906125f0565b60006040518083038185875af1925050503d806000811461173f576040519150601f19603f3d011682016040523d82523d6000602084013e611744565b606091505b5050905080610ab05760405162461bcd60e51b815260206004820152600360248201526253544560e81b60448201526064016102b1565b600080806117898482611dc1565b9250611796846014611e75565b90506117ae6117a760036014612876565b8590611dc1565b91509193909250565b6117c2838383611023565b6001600160a01b0316336001600160a01b031614610ab05760405162461bcd60e51b8152602060048201526002602482015261073760f41b60448201526064016102b1565b7f00000000000000000000000042000000000000000000000000000000000000066001600160a01b0316846001600160a01b03161480156118485750804710155b1561196a577f00000000000000000000000042000000000000000000000000000000000000066001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156118a857600080fd5b505af11580156118bc573d6000803e3d6000fd5b505060405163a9059cbb60e01b81526001600160a01b038681166004830152602482018690527f000000000000000000000000420000000000000000000000000000000000000616935063a9059cbb92506044019050602060405180830381600087803b15801561192c57600080fd5b505af1158015611940573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196491906122a6565b5061122d565b6001600160a01b03831630141561198b57611986848383611cc1565b61122d565b61122d84848484611f20565b60006119a560036014612876565b60146119b2600382612876565b6119bc9190612876565b6119c69190612876565b825110159050919050565b6060611a026119e260036014612876565b6119ee60036014612876565b84516119fa919061288e565b849190612022565b92915050565b6000806001600160a01b038416611a1d573093505b3360015b6000611a308660000151611997565b90506000806000611a44896000015161177b565b9250925092506000611a57838584611023565b9050826001600160a01b0316846001600160a01b03161015611b7b576000816001600160a01b031663857f812f87611a8f578d611a91565b305b8f620c34fe1960405180604001604052808b8a8c604051602001611ab7939291906125a5565b60405160208183030381529060405281526020018e6001600160a01b0316815250604051602001611ae8919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401611b169493929190612620565b6040805180830381600087803b158015611b2f57600080fd5b505af1158015611b43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6791906124dc565b995090508615611b75578099505b50611c7f565b6000816001600160a01b0316632c48125287611b97578d611b99565b305b8f620c34ff60405180604001604052808b8a8c604051602001611bbe939291906125a5565b60405160208183030381529060405281526020018e6001600160a01b0316815250604051602001611bef919061276f565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401611c1d9493929190612620565b6040805180830381600087803b158015611c3657600080fd5b505af1158015611c4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c6e91906124dc565b90995090508615611c7d578099505b505b600095508415611ca3578951309750611c97906119d1565b8a52969a508a96611cad565b5050505050611cb7565b5050505050611a21565b5050935093915050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611d1d91906125f0565b6000604051808303816000865af19150503d8060008114611d5a576040519150601f19603f3d011682016040523d82523d6000602084013e611d5f565b606091505b5091509150818015611d89575080511580611d89575080806020019051810190611d8991906122a6565b611dba5760405162461bcd60e51b815260206004820152600260248201526114d560f21b60448201526064016102b1565b5050505050565b600081611dcf816014612876565b1015611e125760405162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b60448201526064016102b1565b611e1d826014612876565b83511015611e655760405162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b60448201526064016102b1565b500160200151600160601b900490565b600081611e83816003612876565b1015611ec55760405162461bcd60e51b8152602060048201526011602482015270746f55696e7432345f6f766572666c6f7760781b60448201526064016102b1565b611ed0826003612876565b83511015611f175760405162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b60448201526064016102b1565b50016003015190565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092839290881691611f8491906125f0565b6000604051808303816000865af19150503d8060008114611fc1576040519150601f19603f3d011682016040523d82523d6000602084013e611fc6565b606091505b5091509150818015611ff0575080511580611ff0575080806020019051810190611ff091906122a6565b61072a5760405162461bcd60e51b815260206004820152600360248201526229aa2360e91b60448201526064016102b1565b60608161203081601f612876565b101561204e5760405162461bcd60e51b81526004016102b1906126f8565b826120598382612876565b10156120775760405162461bcd60e51b81526004016102b1906126f8565b6120818284612876565b845110156120c55760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b60448201526064016102b1565b6060821580156120e4576040519150600082526020820160405261212e565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561211d578051835260209283019201612105565b5050858452601f01601f1916604052505b50949350505050565b803561214281612918565b919050565b600060a08284031215612158578081fd5b50919050565b803562ffffff8116811461214257600080fd5b600060208284031215612182578081fd5b813561218d81612918565b9392505050565b6000602082840312156121a5578081fd5b815161218d81612918565b6000806000606084860312156121c4578182fd5b83356121cf81612918565b925060208401356121df81612918565b91506121ed6040850161215e565b90509250925092565b60008060006060848603121561220a578283fd5b833561221581612918565b925060208401359150604084013561222c81612918565b809150509250925092565b60008060208385031215612249578182fd5b82356001600160401b038082111561225f578384fd5b818501915085601f830112612272578384fd5b813581811115612280578485fd5b8660208260051b8501011115612294578485fd5b60209290920196919550909350505050565b6000602082840312156122b7578081fd5b8151801515811461218d578182fd5b6000602082840312156122d7578081fd5b81358060020b811461218d578182fd5b6000602082840312156122f8578081fd5b81516001600160401b0381111561230d578182fd5b8201601f8101841361231d578182fd5b805161233061232b8261284f565b61281f565b818152856020838501011115612344578384fd5b6123558260208301602086016128a5565b95945050505050565b60006020828403121561236f578081fd5b81356001600160401b03811115612384578182fd5b6110d484828501612147565b600060208083850312156123a2578182fd5b82356001600160401b03808211156123b8578384fd5b90840190604082870312156123cb578384fd5b6123d36127f7565b8235828111156123e1578586fd5b83019150601f820187136123f3578485fd5b813561240161232b8261284f565b8181528886838601011115612414578687fd5b818685018783013790810185018690528152612431838501612137565b848201528094505050505092915050565b60006101208284031215612158578081fd5b600060208284031215612465578081fd5b81356001600160801b038116811461218d578182fd5b60006020828403121561248c578081fd5b61218d8261215e565b6000602082840312156124a6578081fd5b5051919050565b600080604083850312156124bf578182fd5b8235915060208301356124d181612918565b809150509250929050565b600080604083850312156124ee578182fd5b505080516020909101519092909150565b60008060008060608587031215612514578182fd5b843593506020850135925060408501356001600160401b0380821115612538578384fd5b818701915087601f83011261254b578384fd5b813581811115612559578485fd5b88602082850101111561256a578485fd5b95989497505060200194505050565b600081518084526125918160208601602086016128a5565b601f01601f19169290920160200192915050565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b8183823760009101908152919050565b600082516126028184602087016128a5565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b03851681526001600160801b0384166020820152600283900b604082015260806060820181905260009061265d90830184612579565b9695505050505050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b828110156126bb57603f198886030184526126a9858351612579565b9450928501929085019060010161268d565b5092979650505050505050565b60208152600061218d6020830184612579565b602080825260039082015262783c7960e81b604082015260600190565b6020808252600e908201526d736c6963655f6f766572666c6f7760901b604082015260600190565b60208082526010908201526f0ae8aa89072409cdee8408adcdeeaced60831b604082015260600190565b6020808252600b908201526a4f7574206f662074696d6560a81b604082015260600190565b60208152600082516040602084015261278b6060840182612579565b602094909401516001600160a01b0316604093909301929092525090919050565b6000808335601e198436030181126127c2578283fd5b8301803591506001600160401b038211156127db578283fd5b6020019150368190038213156127f057600080fd5b9250929050565b604080519081016001600160401b038111828210171561281957612819612902565b60405290565b604051601f8201601f191681016001600160401b038111828210171561284757612847612902565b604052919050565b60006001600160401b0382111561286857612868612902565b50601f01601f191660200190565b60008219821115612889576128896128ec565b500190565b6000828210156128a0576128a06128ec565b500390565b60005b838110156128c05781810151838201526020016128a8565b8381111561122d5750506000910152565b60006000198214156128e5576128e56128ec565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461292d57600080fd5b5056fea264697066735822122078ee27f2e530732175884dc64f31c6041da99ef6cd21f953da98cf7ec9d451eb64736f6c63430008040033

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

0000000000000000000000008c7d3063579bdb0b90997e18a770eae32e1ebb080000000000000000000000004200000000000000000000000000000000000006

-----Decoded View---------------
Arg [0] : _factory (address): 0x8c7d3063579BdB0b90997e18A770eaE32E1eBb08
Arg [1] : _weth (address): 0x4200000000000000000000000000000000000006

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000008c7d3063579bdb0b90997e18a770eae32e1ebb08
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.