ETH Price: $3,782.49 (+0.00%)
Gas: 4 Gwei

Contract

0x65b382653f7C31bC0Af67f188122035461ec9C76
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Transaction Hash
Method
Block
From
To
Value
0x8f4919828ebe7a7cc3a8212f0486e9f55b029939c14c57da4565740083813e00Execute(pending)2024-06-01 11:04:156 mins ago1717239855IN
PancakeSwap: Universal Router
0.001 ETH(Pending)(Pending)
0x0946aa4be75e2f745852e6ed5a9679333ff3f8c94791f524c06d05992464b32eExecute(pending)2024-06-01 11:03:177 mins ago1717239797IN
PancakeSwap: Universal Router
0.0001 ETH(Pending)(Pending)
0xcbd0b391edc4b149fbdea1ac909d92d6dbad7f9f9038ab33e9ada0624afaf314Execute(pending)2024-06-01 10:47:3923 mins ago1717238859IN
PancakeSwap: Universal Router
0.004 ETH(Pending)(Pending)
0x85fe0b198409287addefb39251c014ff5c2d05cbfb4ec196b4d99b38131a035aExecute(pending)2024-06-01 10:31:1439 mins ago1717237874IN
PancakeSwap: Universal Router
0.0357087747 ETH(Pending)(Pending)
0xcc22757a8dea0ce429b8d10043f211fcfdb78e8f5017ac3637bcb945554e6cb2Execute(pending)2024-06-01 10:28:1442 mins ago1717237694IN
PancakeSwap: Universal Router
0.0019244748 ETH(Pending)(Pending)
0xa4150371fa4595d97bbca9e475781f0dd92d885de3a7e7c05e8b1c84073090feExecute(pending)2024-06-01 10:27:1743 mins ago1717237637IN
PancakeSwap: Universal Router
0.002 ETH(Pending)(Pending)
0xf0889d8174b1b8dd70c54d99e58f017dc8036a595dee3ac9b9497a818f66760bExecute(pending)2024-06-01 9:57:391 hr ago1717235859IN
PancakeSwap: Universal Router
0.000005567 ETH(Pending)(Pending)
0xb32ae52e4a126ef982ec9f33d5e05b0f23d847e1a630c4dd53daf1b7346ab5daExecute(pending)2024-06-01 6:40:324 hrs ago1717224032IN
PancakeSwap: Universal Router
0 ETH(Pending)(Pending)
0x3f2c8b13cc1a26dcf46ec58cc46c0ceea36ca9bc1539eac849d9a2a342ebc3e8Execute(pending)2024-05-29 15:52:062 days ago1716997926IN
PancakeSwap: Universal Router
0.0016151126 ETH(Pending)(Pending)
0x4f249f3e0064aa365c09a1665536a789da63177241c3fdf4c3b1ade92ea9541bExecute(pending)2024-05-29 15:02:152 days ago1716994935IN
PancakeSwap: Universal Router
0.00145 ETH(Pending)(Pending)
0xdeabd043e4e7ca6aebc649f397f2f261f409cd7204285aa6f00000e6231db5afExecute(pending)2024-05-29 14:41:362 days ago1716993696IN
PancakeSwap: Universal Router
0.000555561 ETH(Pending)(Pending)
0xcc27ae19c5e512434cb16b20f1a3f595e4982bef1affd9839a293259df0af01cExecute(pending)2024-05-29 14:11:192 days ago1716991879IN
PancakeSwap: Universal Router
0.0003 ETH(Pending)(Pending)
0xad16b33fd38f7fcec961789b4ef55750e4c14e845d1cf8ea7dbc2cc965464d88Execute(pending)2024-05-29 14:11:172 days ago1716991877IN
PancakeSwap: Universal Router
0 ETH(Pending)(Pending)
0xc2e8eff6805d3c45438027b780ee6e1a0876f972b4620f6a8c11ac0e92fce8f8Execute(pending)2024-05-29 14:11:142 days ago1716991874IN
PancakeSwap: Universal Router
0.0001 ETH(Pending)(Pending)
0xec1640b10175d94b85a97311b08e927a5d72555aefd1b7dc3d08ca0c9a7362f7Execute(pending)2024-05-28 20:14:373 days ago1716927277IN
PancakeSwap: Universal Router
0.0026127005 ETH(Pending)(Pending)
0x0aba71803757a579bfc49a7771969d06da2234a673cb47da48082bc600617c61Execute(pending)2024-05-28 4:02:164 days ago1716868936IN
PancakeSwap: Universal Router
0.008306553 ETH(Pending)(Pending)
0x7c98fb5ec30f43d99e103933b4cda4a229d72d6f3050e9ad99523ea5571640cfExecute(pending)2024-05-26 1:28:166 days ago1716686896IN
PancakeSwap: Universal Router
0.004 ETH(Pending)(Pending)
Execute199965632024-06-01 11:06:594 mins ago1717240019IN
PancakeSwap: Universal Router
0.16 ETH0.0016414310.36727735
Execute199965182024-06-01 10:57:5913 mins ago1717239479IN
PancakeSwap: Universal Router
0.00231058 ETH0.000820344.66534033
Execute199965112024-06-01 10:56:3514 mins ago1717239395IN
PancakeSwap: Universal Router
0.00584246 ETH0.0013917.62054483
Execute199965022024-06-01 10:54:4716 mins ago1717239287IN
PancakeSwap: Universal Router
0 ETH0.000851474.19857366
Execute199964932024-06-01 10:52:5918 mins ago1717239179IN
PancakeSwap: Universal Router
0 ETH0.00111475.49685958
Execute199964922024-06-01 10:52:4718 mins ago1717239167IN
PancakeSwap: Universal Router
0 ETH0.001101595.4325194
Execute199964142024-06-01 10:36:5934 mins ago1717238219IN
PancakeSwap: Universal Router
0 ETH0.001228786.05973406
Execute199964112024-06-01 10:36:2334 mins ago1717238183IN
PancakeSwap: Universal Router
0 ETH0.001220746.02115753
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
199965632024-06-01 11:06:594 mins ago1717240019
PancakeSwap: Universal Router
0.16 ETH
199965182024-06-01 10:57:5913 mins ago1717239479
PancakeSwap: Universal Router
0.00231058 ETH
199965112024-06-01 10:56:3514 mins ago1717239395
PancakeSwap: Universal Router
0.00584246 ETH
199965022024-06-01 10:54:4716 mins ago1717239287
PancakeSwap: Universal Router
0.11618199 ETH
199965022024-06-01 10:54:4716 mins ago1717239287
PancakeSwap: Universal Router
0.11618199 ETH
199964932024-06-01 10:52:5918 mins ago1717239179
PancakeSwap: Universal Router
0.12463165 ETH
199964932024-06-01 10:52:5918 mins ago1717239179
PancakeSwap: Universal Router
0.12463165 ETH
199964922024-06-01 10:52:4718 mins ago1717239167
PancakeSwap: Universal Router
0.11960219 ETH
199964922024-06-01 10:52:4718 mins ago1717239167
PancakeSwap: Universal Router
0.11960219 ETH
199964142024-06-01 10:36:5934 mins ago1717238219
PancakeSwap: Universal Router
0.10409942 ETH
199964142024-06-01 10:36:5934 mins ago1717238219
PancakeSwap: Universal Router
0.10409942 ETH
199964112024-06-01 10:36:2334 mins ago1717238183
PancakeSwap: Universal Router
0.10400995 ETH
199964112024-06-01 10:36:2334 mins ago1717238183
PancakeSwap: Universal Router
0.10400995 ETH
199963542024-06-01 10:24:5946 mins ago1717237499
PancakeSwap: Universal Router
0.00263216 ETH
199963512024-06-01 10:24:2346 mins ago1717237463
PancakeSwap: Universal Router
0.06 ETH
199962902024-06-01 10:11:591 hrs ago1717236719
PancakeSwap: Universal Router
0.00527579 ETH
199962902024-06-01 10:11:591 hrs ago1717236719
PancakeSwap: Universal Router
0.00527579 ETH
199962842024-06-01 10:10:351 hr ago1717236635
PancakeSwap: Universal Router
0.01890279 ETH
199962842024-06-01 10:10:351 hr ago1717236635
PancakeSwap: Universal Router
0.01890279 ETH
199962602024-06-01 10:05:471 hr ago1717236347
PancakeSwap: Universal Router
0.01723277 ETH
199961832024-06-01 9:50:231 hr ago1717235423
PancakeSwap: Universal Router
0.00376594 ETH
199961832024-06-01 9:50:231 hr ago1717235423
PancakeSwap: Universal Router
0.00376594 ETH
199960862024-06-01 9:30:471 hr ago1717234247
PancakeSwap: Universal Router
0.015 ETH
199960812024-06-01 9:29:471 hr ago1717234187
PancakeSwap: Universal Router
0.00876341 ETH
199960322024-06-01 9:19:591 hr ago1717233599
PancakeSwap: Universal Router
5.83562303 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
UniversalRouter

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 10 runs

Other Settings:
default evmVersion
File 1 of 45 : UniversalRouter.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

// Command implementations
import {Dispatcher} from './base/Dispatcher.sol';
import {RewardsCollector} from './base/RewardsCollector.sol';
import {RouterParameters, RouterImmutables} from './base/RouterImmutables.sol';
import {Commands} from './libraries/Commands.sol';
import {Constants} from './libraries/Constants.sol';
import {IUniversalRouter} from './interfaces/IUniversalRouter.sol';
import {StableSwapRouter} from './modules/pancakeswap/StableSwapRouter.sol';
import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol';

contract UniversalRouter is RouterImmutables, IUniversalRouter, Dispatcher, RewardsCollector, Pausable {
    modifier checkDeadline(uint256 deadline) {
        if (block.timestamp > deadline) revert TransactionDeadlinePassed();
        _;
    }

    constructor(RouterParameters memory params) RouterImmutables(params) StableSwapRouter(params.stableFactory, params.stableInfo) {}

    /// @inheritdoc IUniversalRouter
    function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline)
        external
        payable
        checkDeadline(deadline)
    {
        execute(commands, inputs);
    }

    /// @inheritdoc Dispatcher
    function execute(bytes calldata commands, bytes[] calldata inputs) 
        public 
        payable 
        override 
        isNotLocked 
        whenNotPaused 
    {
        bool success;
        bytes memory output;
        uint256 numCommands = commands.length;
        if (inputs.length != numCommands) revert LengthMismatch();

        // loop through all given commands, execute them and pass along outputs as defined
        for (uint256 commandIndex = 0; commandIndex < numCommands;) {
            bytes1 command = commands[commandIndex];

            bytes calldata input = inputs[commandIndex];

            (success, output) = dispatch(command, input);

            if (!success && successRequired(command)) {
                revert ExecutionFailed({commandIndex: commandIndex, message: output});
            }

            unchecked {
                commandIndex++;
            }
        }

        uint256 balance = address(this).balance;
        if ((balance > 0) && (msg.sender != address(this))) sweep(Constants.ETH, msg.sender, balance);
    }

    function successRequired(bytes1 command) internal pure returns (bool) {
        return command & Commands.FLAG_ALLOW_REVERT == 0;
    }

    /**
     * @dev called by the owner to pause, triggers stopped state
     */
    function pause() external onlyOwner whenNotPaused {
        _pause();
    }

    /**
     * @dev called by the owner to unpause, returns to normal state
     */
    function unpause() external onlyOwner whenPaused {
        _unpause();
    }

    /// @notice To receive ETH from WETH and NFT protocols
    receive() external payable {}
}

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

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

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

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

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

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

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

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

File 3 of 45 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

File 4 of 45 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
     * @dev Handles the receipt of a single ERC1155 token type. This function is
     * called at the end of a `safeTransferFrom` after the balance has been updated.
     *
     * NOTE: To accept the transfer, this must return
     * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
     * (i.e. 0xf23a6e61, or its own function selector).
     *
     * @param operator The address which initiated the transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param id The ID of the token being transferred
     * @param value The amount of tokens being transferred
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
     */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
     * @dev Handles the receipt of a multiple ERC1155 token types. This function
     * is called at the end of a `safeBatchTransferFrom` after the balances have
     * been updated.
     *
     * NOTE: To accept the transfer(s), this must return
     * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
     * (i.e. 0xbc197c81, or its own function selector).
     *
     * @param operator The address which initiated the batch transfer (i.e. msg.sender)
     * @param from The address which previously owned the token
     * @param ids An array containing ids of each token being transferred (order and length must match values array)
     * @param values An array containing amounts of each token being transferred (order and length must match ids array)
     * @param data Additional data with no specified format
     * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
     */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 5 of 45 : 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 6 of 45 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

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

pragma solidity ^0.8.0;

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

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

File 8 of 45 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 9 of 45 : IPancakeV3SwapCallback.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Callback for IPancakeV3PoolActions#swap
/// @notice Any contract that calls IPancakeV3PoolActions#swap must implement this interface
interface IPancakeV3SwapCallback {
    /// @notice Called to `msg.sender` after executing a swap via IPancakeV3Pool#swap.
    /// @dev In the implementation you must pay the pool tokens owed for the swap.
    /// The caller of this method must be checked to be a PancakeV3Pool deployed by the canonical PancakeV3Factory.
    /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped.
    /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token0 to the pool.
    /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by
    /// the end of the swap. If positive, the callback must send that amount of token1 to the pool.
    /// @param data Any data passed through by the caller via the IPancakeV3PoolActions#swap call
    function pancakeV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata data
    ) external;
}

File 10 of 45 : IPancakeV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IPancakeV3PoolImmutables.sol';
import './pool/IPancakeV3PoolState.sol';
import './pool/IPancakeV3PoolDerivedState.sol';
import './pool/IPancakeV3PoolActions.sol';
import './pool/IPancakeV3PoolOwnerActions.sol';
import './pool/IPancakeV3PoolEvents.sol';

/// @title The interface for a PancakeSwap V3 Pool
/// @notice A PancakeSwap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IPancakeV3Pool is
    IPancakeV3PoolImmutables,
    IPancakeV3PoolState,
    IPancakeV3PoolDerivedState,
    IPancakeV3PoolActions,
    IPancakeV3PoolOwnerActions,
    IPancakeV3PoolEvents
{

}

File 11 of 45 : IPancakeV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IPancakeV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IPancakeV3MintCallback#pancakeV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IPancakeV3SwapCallback#pancakeV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IPancakeV3FlashCallback#pancakeV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 12 of 45 : IPancakeV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IPancakeV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 13 of 45 : IPancakeV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IPancakeV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    /// @param protocolFeesToken0 The protocol fee of token0 in the swap
    /// @param protocolFeesToken1 The protocol fee of token1 in the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick,
        uint128 protocolFeesToken0,
        uint128 protocolFeesToken1
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @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 amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(
        uint32 feeProtocol0Old,
        uint32 feeProtocol1Old,
        uint32 feeProtocol0New,
        uint32 feeProtocol1New
    );

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 14 of 45 : IPancakeV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IPancakeV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IPancakeV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 15 of 45 : IPancakeV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IPancakeV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint32 feeProtocol0, uint32 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Set the LM pool to enable liquidity mining
    function setLmPool(address lmPool) external;
}

File 16 of 45 : IPancakeV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IPancakeV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint32 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 17 of 45 : SafeCast.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Safe casting methods
/// @notice Contains methods for safely casting between types
library SafeCast {
    /// @notice Cast a uint256 to a uint160, revert on overflow
    /// @param y The uint256 to be downcasted
    /// @return z The downcasted integer, now type uint160
    function toUint160(uint256 y) internal pure returns (uint160 z) {
        require((z = uint160(y)) == y);
    }

    /// @notice Cast a int256 to a int128, revert on overflow or underflow
    /// @param y The int256 to be downcasted
    /// @return z The downcasted integer, now type int128
    function toInt128(int256 y) internal pure returns (int128 z) {
        require((z = int128(y)) == y);
    }

    /// @notice Cast a uint256 to a int256, revert on overflow
    /// @param y The uint256 to be casted
    /// @return z The casted integer, now type int256
    function toInt256(uint256 y) internal pure returns (int256 z) {
        require(y < 2**255);
        z = int256(y);
    }
}

File 18 of 45 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 19 of 45 : Callbacks.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {IERC721Receiver} from '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import {IERC1155Receiver} from '@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol';
import {IERC165} from '@openzeppelin/contracts/utils/introspection/IERC165.sol';

/// @title ERC Callback Support
/// @notice Implements various functions introduced by a variety of ERCs for security reasons.
/// All are called by external contracts to ensure that this contract safely supports the ERC in question.
contract Callbacks is IERC721Receiver, IERC1155Receiver {
    function onERC721Received(address, address, uint256, bytes calldata) external pure returns (bytes4) {
        return this.onERC721Received.selector;
    }

    function onERC1155Received(address, address, uint256, uint256, bytes calldata) external pure returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(address, address, uint256[] calldata, uint256[] calldata, bytes calldata)
        external
        pure
        returns (bytes4)
    {
        return this.onERC1155BatchReceived.selector;
    }

    function supportsInterface(bytes4 interfaceId) external pure returns (bool) {
        return interfaceId == type(IERC1155Receiver).interfaceId || interfaceId == type(IERC721Receiver).interfaceId
            || interfaceId == type(IERC165).interfaceId;
    }
}

File 20 of 45 : Dispatcher.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {V2SwapRouter} from '../modules/pancakeswap/V2SwapRouter.sol';
import {V3SwapRouter} from '../modules/pancakeswap/V3SwapRouter.sol';
import {StableSwapRouter} from '../modules/pancakeswap/StableSwapRouter.sol';
import {Payments} from '../modules/Payments.sol';
import {RouterImmutables} from '../base/RouterImmutables.sol';
import {Callbacks} from '../base/Callbacks.sol';
import {BytesLib} from '../libraries/BytesLib.sol';
import {Commands} from '../libraries/Commands.sol';
import {LockAndMsgSender} from './LockAndMsgSender.sol';
import {ERC721} from 'solmate/src/tokens/ERC721.sol';
import {ERC1155} from 'solmate/src/tokens/ERC1155.sol';
import {ERC20} from 'solmate/src/tokens/ERC20.sol';
import {IAllowanceTransfer} from '../permit2/src/interfaces/IAllowanceTransfer.sol';
import {IPancakeNFTMarket} from '../interfaces/IPancakeNFTMarket.sol';

/// @title Decodes and Executes Commands
/// @notice Called by the UniversalRouter contract to efficiently decode and execute a singular command
abstract contract Dispatcher is Payments, V2SwapRouter, V3SwapRouter, StableSwapRouter, Callbacks, LockAndMsgSender {
    using BytesLib for bytes;

    error InvalidCommandType(uint256 commandType);
    error BuyPunkFailed();
    error BuyPancakeNFTFailed();
    error InvalidOwnerERC721();
    error InvalidOwnerERC1155();
    error BalanceTooLow();

    /// @notice Decodes and executes the given command with the given inputs
    /// @param commandType The command type to execute
    /// @param inputs The inputs to execute the command with
    /// @dev 2 masks are used to enable use of a nested-if statement in execution for efficiency reasons
    /// @return success True on success of the command, false on failure
    /// @return output The outputs or error messages, if any, from the command
    function dispatch(bytes1 commandType, bytes calldata inputs) internal returns (bool success, bytes memory output) {
        uint256 command = uint8(commandType & Commands.COMMAND_TYPE_MASK);

        success = true;

        if (command < Commands.FOURTH_IF_BOUNDARY) {
            if (command < Commands.SECOND_IF_BOUNDARY) {
                // 0x00 <= command < 0x08
                if (command < Commands.FIRST_IF_BOUNDARY) {
                    if (command == Commands.V3_SWAP_EXACT_IN) {
                        // equivalent: abi.decode(inputs, (address, uint256, uint256, bytes, bool))
                        address recipient;
                        uint256 amountIn;
                        uint256 amountOutMin;
                        bool payerIsUser;
                        assembly {
                            recipient := calldataload(inputs.offset)
                            amountIn := calldataload(add(inputs.offset, 0x20))
                            amountOutMin := calldataload(add(inputs.offset, 0x40))
                            // 0x60 offset is the path, decoded below
                            payerIsUser := calldataload(add(inputs.offset, 0x80))
                        }
                        bytes calldata path = inputs.toBytes(3);
                        address payer = payerIsUser ? lockedBy : address(this);
                        v3SwapExactInput(map(recipient), amountIn, amountOutMin, path, payer);
                    } else if (command == Commands.V3_SWAP_EXACT_OUT) {
                        // equivalent: abi.decode(inputs, (address, uint256, uint256, bytes, bool))
                        address recipient;
                        uint256 amountOut;
                        uint256 amountInMax;
                        bool payerIsUser;
                        assembly {
                            recipient := calldataload(inputs.offset)
                            amountOut := calldataload(add(inputs.offset, 0x20))
                            amountInMax := calldataload(add(inputs.offset, 0x40))
                            // 0x60 offset is the path, decoded below
                            payerIsUser := calldataload(add(inputs.offset, 0x80))
                        }
                        bytes calldata path = inputs.toBytes(3);
                        address payer = payerIsUser ? lockedBy : address(this);
                        v3SwapExactOutput(map(recipient), amountOut, amountInMax, path, payer);
                    } else if (command == Commands.PERMIT2_TRANSFER_FROM) {
                        // equivalent: abi.decode(inputs, (address, address, uint160))
                        address token;
                        address recipient;
                        uint160 amount;
                        assembly {
                            token := calldataload(inputs.offset)
                            recipient := calldataload(add(inputs.offset, 0x20))
                            amount := calldataload(add(inputs.offset, 0x40))
                        }
                        permit2TransferFrom(token, lockedBy, map(recipient), amount);
                    } else if (command == Commands.PERMIT2_PERMIT_BATCH) {
                        (IAllowanceTransfer.PermitBatch memory permitBatch,) =
                            abi.decode(inputs, (IAllowanceTransfer.PermitBatch, bytes));
                        bytes calldata data = inputs.toBytes(1);
                        PERMIT2.permit(lockedBy, permitBatch, data);
                    } else if (command == Commands.SWEEP) {
                        // equivalent:  abi.decode(inputs, (address, address, uint256))
                        address token;
                        address recipient;
                        uint160 amountMin;
                        assembly {
                            token := calldataload(inputs.offset)
                            recipient := calldataload(add(inputs.offset, 0x20))
                            amountMin := calldataload(add(inputs.offset, 0x40))
                        }
                        Payments.sweep(token, map(recipient), amountMin);
                    } else if (command == Commands.TRANSFER) {
                        // equivalent:  abi.decode(inputs, (address, address, uint256))
                        address token;
                        address recipient;
                        uint256 value;
                        assembly {
                            token := calldataload(inputs.offset)
                            recipient := calldataload(add(inputs.offset, 0x20))
                            value := calldataload(add(inputs.offset, 0x40))
                        }
                        Payments.pay(token, map(recipient), value);
                    } else if (command == Commands.PAY_PORTION) {
                        // equivalent:  abi.decode(inputs, (address, address, uint256))
                        address token;
                        address recipient;
                        uint256 bips;
                        assembly {
                            token := calldataload(inputs.offset)
                            recipient := calldataload(add(inputs.offset, 0x20))
                            bips := calldataload(add(inputs.offset, 0x40))
                        }
                        Payments.payPortion(token, map(recipient), bips);
                    } else {
                        // placeholder area for command 0x07
                        revert InvalidCommandType(command);
                    }
                    // 0x08 <= command < 0x10
                } else {
                    if (command == Commands.V2_SWAP_EXACT_IN) {
                        // equivalent: abi.decode(inputs, (address, uint256, uint256, bytes, bool))
                        address recipient;
                        uint256 amountIn;
                        uint256 amountOutMin;
                        bool payerIsUser;
                        assembly {
                            recipient := calldataload(inputs.offset)
                            amountIn := calldataload(add(inputs.offset, 0x20))
                            amountOutMin := calldataload(add(inputs.offset, 0x40))
                            // 0x60 offset is the path, decoded below
                            payerIsUser := calldataload(add(inputs.offset, 0x80))
                        }
                        address[] calldata path = inputs.toAddressArray(3);
                        address payer = payerIsUser ? lockedBy : address(this);
                        v2SwapExactInput(map(recipient), amountIn, amountOutMin, path, payer);
                    } else if (command == Commands.V2_SWAP_EXACT_OUT) {
                        // equivalent: abi.decode(inputs, (address, uint256, uint256, bytes, bool))
                        address recipient;
                        uint256 amountOut;
                        uint256 amountInMax;
                        bool payerIsUser;
                        assembly {
                            recipient := calldataload(inputs.offset)
                            amountOut := calldataload(add(inputs.offset, 0x20))
                            amountInMax := calldataload(add(inputs.offset, 0x40))
                            // 0x60 offset is the path, decoded below
                            payerIsUser := calldataload(add(inputs.offset, 0x80))
                        }
                        address[] calldata path = inputs.toAddressArray(3);
                        address payer = payerIsUser ? lockedBy : address(this);
                        v2SwapExactOutput(map(recipient), amountOut, amountInMax, path, payer);
                    } else if (command == Commands.PERMIT2_PERMIT) {
                        // equivalent: abi.decode(inputs, (IAllowanceTransfer.PermitSingle, bytes))
                        IAllowanceTransfer.PermitSingle calldata permitSingle;
                        assembly {
                            permitSingle := inputs.offset
                        }
                        bytes calldata data = inputs.toBytes(6); // PermitSingle takes first 6 slots (0..5)
                        PERMIT2.permit(lockedBy, permitSingle, data);
                    } else if (command == Commands.WRAP_ETH) {
                        // equivalent: abi.decode(inputs, (address, uint256))
                        address recipient;
                        uint256 amountMin;
                        assembly {
                            recipient := calldataload(inputs.offset)
                            amountMin := calldataload(add(inputs.offset, 0x20))
                        }
                        Payments.wrapETH(map(recipient), amountMin);
                    } else if (command == Commands.UNWRAP_WETH) {
                        // equivalent: abi.decode(inputs, (address, uint256))
                        address recipient;
                        uint256 amountMin;
                        assembly {
                            recipient := calldataload(inputs.offset)
                            amountMin := calldataload(add(inputs.offset, 0x20))
                        }
                        Payments.unwrapWETH9(map(recipient), amountMin);
                    } else if (command == Commands.PERMIT2_TRANSFER_FROM_BATCH) {
                        (IAllowanceTransfer.AllowanceTransferDetails[] memory batchDetails) =
                            abi.decode(inputs, (IAllowanceTransfer.AllowanceTransferDetails[]));
                        permit2TransferFrom(batchDetails, lockedBy);
                    } else if (command == Commands.BALANCE_CHECK_ERC20) {
                        // equivalent: abi.decode(inputs, (address, address, uint256))
                        address owner;
                        address token;
                        uint256 minBalance;
                        assembly {
                            owner := calldataload(inputs.offset)
                            token := calldataload(add(inputs.offset, 0x20))
                            minBalance := calldataload(add(inputs.offset, 0x40))
                        }
                        success = (ERC20(token).balanceOf(owner) >= minBalance);
                        if (!success) output = abi.encodePacked(BalanceTooLow.selector);
                    } else {
                        // placeholder area for command 0x0f
                        revert InvalidCommandType(command);
                    }
                }
                // 0x10 <= command < 0x20
            } else {
                // 0x10 <= command < 0x18
                if (command < Commands.THIRD_IF_BOUNDARY) {
                    if (command == Commands.OWNER_CHECK_721) {
                        // equivalent: abi.decode(inputs, (address, address, uint256))
                        address owner;
                        address token;
                        uint256 id;
                        assembly {
                            owner := calldataload(inputs.offset)
                            token := calldataload(add(inputs.offset, 0x20))
                            id := calldataload(add(inputs.offset, 0x40))
                        }
                        success = (ERC721(token).ownerOf(id) == owner);
                        if (!success) output = abi.encodePacked(InvalidOwnerERC721.selector);
                    } else if (command == Commands.OWNER_CHECK_1155) {
                        // equivalent: abi.decode(inputs, (address, address, uint256, uint256))
                        address owner;
                        address token;
                        uint256 id;
                        uint256 minBalance;
                        assembly {
                            owner := calldataload(inputs.offset)
                            token := calldataload(add(inputs.offset, 0x20))
                            id := calldataload(add(inputs.offset, 0x40))
                            minBalance := calldataload(add(inputs.offset, 0x60))
                        }
                        success = (ERC1155(token).balanceOf(owner, id) >= minBalance);
                        if (!success) output = abi.encodePacked(InvalidOwnerERC1155.selector);
                    } else if (command == Commands.SWEEP_ERC721) {
                        // equivalent: abi.decode(inputs, (address, address, uint256))
                        address token;
                        address recipient;
                        uint256 id;
                        assembly {
                            token := calldataload(inputs.offset)
                            recipient := calldataload(add(inputs.offset, 0x20))
                            id := calldataload(add(inputs.offset, 0x40))
                        }
                        Payments.sweepERC721(token, map(recipient), id);
                    } else if (command == Commands.SWEEP_ERC1155) {
                        // equivalent: abi.decode(inputs, (address, address, uint256, uint256))
                        address token;
                        address recipient;
                        uint256 id;
                        uint256 amount;
                        assembly {
                            token := calldataload(inputs.offset)
                            recipient := calldataload(add(inputs.offset, 0x20))
                            id := calldataload(add(inputs.offset, 0x40))
                            amount := calldataload(add(inputs.offset, 0x60))
                        }
                        Payments.sweepERC1155(token, map(recipient), id, amount);
                    } else {
                        // placeholder area for command for 0x14-0x17
                        revert InvalidCommandType(command);
                    }
                    // 0x18 <= command < 0x20
                } else {
                    if (command == Commands.SEAPORT_V1_5) {
                        /// @dev Seaport 1.4 and 1.5 allow for orders to be created by contracts.
                        ///     These orders pass control to the contract offerers during fufillment,
                        ///         allowing them to perform any number of destructive actions as a holder of the NFT.
                        ///     Integrators should be aware that in some scenarios: e.g. purchasing an NFT that allows the holder
                        ///         to claim another NFT, the contract offerer can "steal" the claim during order fufillment.
                        ///     For some such purchases, an OWNER_CHECK command can be prepended to ensure that all tokens have the desired owner at the end of the transaction.
                        ///     This is also outlined in the Seaport documentation: https://github.com/ProjectOpenSea/seaport/blob/main/docs/SeaportDocumentation.md
                        (uint256 value, bytes calldata data) = getValueAndData(inputs);
                        (success, output) = SEAPORT_V1_5.call{value: value}(data);
                    } else if (command == Commands.SEAPORT_V1_4) {
                        /// @dev Seaport 1.4 and 1.5 allow for orders to be created by contracts.
                        ///     These orders pass control to the contract offerers during fufillment,
                        ///         allowing them to perform any number of destructive actions as a holder of the NFT.
                        ///     Integrators should be aware that in some scenarios: e.g. purchasing an NFT that allows the holder
                        ///         to claim another NFT, the contract offerer can "steal" the claim during order fufillment.
                        ///     For some such purchases, an OWNER_CHECK command can be prepended to ensure that all tokens have the desired owner at the end of the transaction.
                        ///     This is also outlined in the Seaport documentation: https://github.com/ProjectOpenSea/seaport/blob/main/docs/SeaportDocumentation.md
                        (uint256 value, bytes calldata data) = getValueAndData(inputs);
                        (success, output) = SEAPORT_V1_4.call{value: value}(data);
                    } else if (command == Commands.LOOKS_RARE_V2) {
                        // equivalent: abi.decode(inputs, (uint256, bytes))
                        uint256 value;
                        assembly {
                            value := calldataload(inputs.offset)
                        }
                        bytes calldata data = inputs.toBytes(1);
                        (success, output) = LOOKS_RARE_V2.call{value: value}(data);
                    } else if (command == Commands.X2Y2_721) {
                        (success, output) = callAndTransfer721(inputs, X2Y2);
                    } else if (command == Commands.X2Y2_1155) {
                        (success, output) = callAndTransfer1155(inputs, X2Y2);
                    } else {
                        // placeholder for command 0x1d-0x1f
                        revert InvalidCommandType(command);
                    }
                }
            }
            // 0x20 <= command
        } else {
            if (command == Commands.EXECUTE_SUB_PLAN) {
                bytes calldata _commands = inputs.toBytes(0);
                bytes[] calldata _inputs = inputs.toBytesArray(1);
                (success, output) =
                    (address(this)).call(abi.encodeWithSelector(Dispatcher.execute.selector, _commands, _inputs));                
            } else if (command == Commands.APPROVE_ERC20) {
                ERC20 token;
                RouterImmutables.Spenders spender;
                assembly {
                    token := calldataload(inputs.offset)
                    spender := calldataload(add(inputs.offset, 0x20))
                }
                Payments.approveERC20(token, spender);
            } else if (command == Commands.STABLE_SWAP_EXACT_IN) {
                // equivalent: abi.decode(inputs, (address, uint256, uint256, bytes, bytes, bool))
                address recipient;
                uint256 amountIn;
                uint256 amountOutMin;
                bool payerIsUser;
                assembly {
                    recipient := calldataload(inputs.offset)
                    amountIn := calldataload(add(inputs.offset, 0x20))
                    amountOutMin := calldataload(add(inputs.offset, 0x40))
                    // 0x60 offset is the path and 0x80 is the flag, decoded below
                    payerIsUser := calldataload(add(inputs.offset, 0xa0))
                }
                address[] calldata path = inputs.toAddressArray(3);
                uint256[] calldata flag = inputs.toUintArray(4);
                address payer = payerIsUser ? lockedBy : address(this);
                stableSwapExactInput(map(recipient), amountIn, amountOutMin, path, flag, payer);
            } else if (command == Commands.STABLE_SWAP_EXACT_OUT) {
                // equivalent: abi.decode(inputs, (address, uint256, uint256, bytes, bytes, bool))
                address recipient;
                uint256 amountOut;
                uint256 amountInMax;
                bool payerIsUser;
                assembly {
                    recipient := calldataload(inputs.offset)
                    amountOut := calldataload(add(inputs.offset, 0x20))
                    amountInMax := calldataload(add(inputs.offset, 0x40))
                    // 0x60 offset is the path and 0x80 is the flag, decoded below
                    payerIsUser := calldataload(add(inputs.offset, 0xa0))
                }
                address[] calldata path = inputs.toAddressArray(3);
                uint256[] calldata flag = inputs.toUintArray(4);
                address payer = payerIsUser ? lockedBy : address(this);
                stableSwapExactOutput(map(recipient), amountOut, amountInMax, path, flag, payer);
            } else if (command == Commands.PANCAKE_NFT_BNB) {
                // equivalent: abi.decode(inputs, (address, uint256, uint256))
                address collection;
                uint256 tokenId;
                uint256 value;
                assembly {
                    collection := calldataload(inputs.offset)
                    tokenId := calldataload(add(inputs.offset, 0x20))
                    value := calldataload(add(inputs.offset, 0x40))
                }
                (success, output) = PANCAKESWAP_NFT_MARKET.call{value: value}(
                    abi.encodeWithSelector(IPancakeNFTMarket.buyTokenUsingBNB.selector, collection, tokenId)
                );
                if (!success) output = abi.encodePacked(BuyPancakeNFTFailed.selector);
            } else if (command == Commands.PANCAKE_NFT_WBNB) {
                // equivalent: abi.decode(inputs, (address, uint256, uint256))
                address collection;
                uint256 tokenId;
                uint256 price;
                assembly {
                    collection := calldataload(inputs.offset)
                    tokenId := calldataload(add(inputs.offset, 0x20))
                    price := calldataload(add(inputs.offset, 0x40))
                }
                IPancakeNFTMarket(PANCAKESWAP_NFT_MARKET).buyTokenUsingWBNB(collection, tokenId, price);
            } else {
                // placeholder area for commands 0x26-0x3f
                revert InvalidCommandType(command);
            }
        }
    }

    /// @notice Executes encoded commands along with provided inputs.
    /// @param commands A set of concatenated commands, each 1 byte in length
    /// @param inputs An array of byte strings containing abi encoded inputs for each command
    function execute(bytes calldata commands, bytes[] calldata inputs) external payable virtual;

    /// @notice Performs a call to purchase an ERC721, then transfers the ERC721 to a specified recipient
    /// @param inputs The inputs for the protocol and ERC721 transfer, encoded
    /// @param protocol The protocol to pass the calldata to
    /// @return success True on success of the command, false on failure
    /// @return output The outputs or error messages, if any, from the command
    function callAndTransfer721(bytes calldata inputs, address protocol)
        internal
        returns (bool success, bytes memory output)
    {
        // equivalent: abi.decode(inputs, (uint256, bytes, address, address, uint256))
        (uint256 value, bytes calldata data) = getValueAndData(inputs);
        address recipient;
        address token;
        uint256 id;
        assembly {
            // 0x00 and 0x20 offsets are value and data, above
            recipient := calldataload(add(inputs.offset, 0x40))
            token := calldataload(add(inputs.offset, 0x60))
            id := calldataload(add(inputs.offset, 0x80))
        }
        (success, output) = protocol.call{value: value}(data);
        if (success) ERC721(token).safeTransferFrom(address(this), map(recipient), id);
    }

    /// @notice Performs a call to purchase an ERC1155, then transfers the ERC1155 to a specified recipient
    /// @param inputs The inputs for the protocol and ERC1155 transfer, encoded
    /// @param protocol The protocol to pass the calldata to
    /// @return success True on success of the command, false on failure
    /// @return output The outputs or error messages, if any, from the command
    function callAndTransfer1155(bytes calldata inputs, address protocol)
        internal
        returns (bool success, bytes memory output)
    {
        // equivalent: abi.decode(inputs, (uint256, bytes, address, address, uint256, uint256))
        (uint256 value, bytes calldata data) = getValueAndData(inputs);
        address recipient;
        address token;
        uint256 id;
        uint256 amount;
        assembly {
            // 0x00 and 0x20 offsets are value and data, above
            recipient := calldataload(add(inputs.offset, 0x40))
            token := calldataload(add(inputs.offset, 0x60))
            id := calldataload(add(inputs.offset, 0x80))
            amount := calldataload(add(inputs.offset, 0xa0))
        }
        (success, output) = protocol.call{value: value}(data);
        if (success) ERC1155(token).safeTransferFrom(address(this), map(recipient), id, amount, new bytes(0));
    }

    /// @notice Helper function to extract `value` and `data` parameters from input bytes string
    /// @dev The helper assumes that `value` is the first parameter, and `data` is the second
    /// @param inputs The bytes string beginning with value and data parameters
    /// @return value The 256 bit integer value
    /// @return data The data bytes string
    function getValueAndData(bytes calldata inputs) internal pure returns (uint256 value, bytes calldata data) {
        assembly {
            value := calldataload(inputs.offset)
        }
        data = inputs.toBytes(1);
    }
}

File 21 of 45 : LockAndMsgSender.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {Constants} from '../libraries/Constants.sol';

contract LockAndMsgSender {
    error ContractLocked();

    address internal constant NOT_LOCKED_FLAG = address(1);
    address internal lockedBy = NOT_LOCKED_FLAG;

    modifier isNotLocked() {
        if (msg.sender != address(this)) {
            if (lockedBy != NOT_LOCKED_FLAG) revert ContractLocked();
            lockedBy = msg.sender;
            _;
            lockedBy = NOT_LOCKED_FLAG;
        } else {
            _;
        }
    }

    /// @notice Calculates the recipient address for a command
    /// @param recipient The recipient or recipient-flag for the command
    /// @return output The resultant recipient for the command
    function map(address recipient) internal view returns (address) {
        if (recipient == Constants.MSG_SENDER) {
            return lockedBy;
        } else if (recipient == Constants.ADDRESS_THIS) {
            return address(this);
        } else {
            return recipient;
        }
    }
}

File 22 of 45 : RewardsCollector.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.15;

import {ERC20} from 'solmate/src/tokens/ERC20.sol';
import {SafeTransferLib} from 'solmate/src/utils/SafeTransferLib.sol';
import {RouterImmutables} from './RouterImmutables.sol';
import {IRewardsCollector} from '../interfaces/IRewardsCollector.sol';

abstract contract RewardsCollector is IRewardsCollector, RouterImmutables {
    using SafeTransferLib for ERC20;

    event RewardsSent(uint256 amount);

    error UnableToClaim();

    /// @inheritdoc IRewardsCollector
    function collectRewards(bytes calldata looksRareClaim) external {
        (bool success,) = LOOKS_RARE_REWARDS_DISTRIBUTOR.call(looksRareClaim);
        if (!success) revert UnableToClaim();

        uint256 balance = LOOKS_RARE_TOKEN.balanceOf(address(this));
        LOOKS_RARE_TOKEN.safeTransfer(ROUTER_REWARDS_DISTRIBUTOR, balance);
        emit RewardsSent(balance);
    }
}

File 23 of 45 : RouterImmutables.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {IAllowanceTransfer} from '../permit2/src/interfaces/IAllowanceTransfer.sol';
import {ERC20} from 'solmate/src/tokens/ERC20.sol';
import {IWETH9} from '../interfaces/IWETH9.sol';

struct RouterParameters {
    address permit2;
    address weth9;
    address seaportV1_5;
    address seaportV1_4;
    address openseaConduit;
    address x2y2;
    address looksRareV2;
    address routerRewardsDistributor;
    address looksRareRewardsDistributor;
    address looksRareToken;
    address v2Factory;
    address v3Factory;
    address v3Deployer;
    bytes32 v2InitCodeHash;
    bytes32 v3InitCodeHash;
    address stableFactory;
    address stableInfo;
    address pancakeNFTMarket;
}

/// @title Router Immutable Storage contract
/// @notice Used along with the `RouterParameters` struct for ease of cross-chain deployment
contract RouterImmutables {
    /// @dev WETH9 address
    IWETH9 internal immutable WETH9;

    /// @dev Permit2 address
    IAllowanceTransfer internal immutable PERMIT2;

    /// @dev Seaport 1.5 address
    address internal immutable SEAPORT_V1_5;

    /// @dev Seaport 1.4 address
    address internal immutable SEAPORT_V1_4;

    /// @dev The address of OpenSea's conduit used in both Seaport 1.4 and Seaport 1.5
    address internal immutable OPENSEA_CONDUIT;

    /// @dev The address of X2Y2
    address internal immutable X2Y2;

    /// @dev The address of LooksRareV2
    address internal immutable LOOKS_RARE_V2;

    /// @dev The address of LooksRare token
    ERC20 internal immutable LOOKS_RARE_TOKEN;

    /// @dev The address of LooksRare rewards distributor
    address internal immutable LOOKS_RARE_REWARDS_DISTRIBUTOR;

    /// @dev The address of router rewards distributor
    address internal immutable ROUTER_REWARDS_DISTRIBUTOR;

    /// @dev The address of PancakeSwapV2Factory
    address internal immutable PANCAKESWAP_V2_FACTORY;

    /// @dev The PancakeSwapV2Pair initcodehash
    bytes32 internal immutable PANCAKESWAP_V2_PAIR_INIT_CODE_HASH;

    /// @dev The address of PancakeSwapV3Factory
    address internal immutable PANCAKESWAP_V3_FACTORY;

    /// @dev The PancakeSwapV3Pool initcodehash
    bytes32 internal immutable PANCAKESWAP_V3_POOL_INIT_CODE_HASH;

    /// @dev The address of PancakeSwap V3 Deployer
    address internal immutable PANCAKESWAP_V3_DEPLOYER;

    /// @dev The address of PancakeSwap NFT Market
    address internal immutable PANCAKESWAP_NFT_MARKET;

    enum Spenders {
        OSConduit
    }

    constructor(RouterParameters memory params) {
        PERMIT2 = IAllowanceTransfer(params.permit2);
        WETH9 = IWETH9(params.weth9);
        SEAPORT_V1_5 = params.seaportV1_5;
        SEAPORT_V1_4 = params.seaportV1_4;
        OPENSEA_CONDUIT = params.openseaConduit;
        X2Y2 = params.x2y2;
        LOOKS_RARE_V2 = params.looksRareV2;
        LOOKS_RARE_TOKEN = ERC20(params.looksRareToken);
        LOOKS_RARE_REWARDS_DISTRIBUTOR = params.looksRareRewardsDistributor;
        ROUTER_REWARDS_DISTRIBUTOR = params.routerRewardsDistributor;
        PANCAKESWAP_V2_FACTORY = params.v2Factory;
        PANCAKESWAP_V2_PAIR_INIT_CODE_HASH = params.v2InitCodeHash;
        PANCAKESWAP_V3_FACTORY = params.v3Factory;
        PANCAKESWAP_V3_POOL_INIT_CODE_HASH = params.v3InitCodeHash;
        PANCAKESWAP_V3_DEPLOYER = params.v3Deployer;
        PANCAKESWAP_NFT_MARKET = params.pancakeNFTMarket;
    }
}

File 24 of 45 : IPancakeNFTMarket.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

/// @title Interface for PancakeSwap NFT Market
interface IPancakeNFTMarket {
    /**
     * @notice Buy token with BNB by matching the price of an existing ask order
     * @param _collection: contract address of the NFT
     * @param _tokenId: tokenId of the NFT purchased
     */
    function buyTokenUsingBNB(
        address _collection, 
        uint256 _tokenId
    ) external payable;

    /**
     * @notice Buy token with WBNB by matching the price of an existing ask order
     * @param _collection: contract address of the NFT
     * @param _tokenId: tokenId of the NFT purchased
     * @param _price: price (must be equal to the askPrice set by the seller)
     */
    function buyTokenUsingWBNB(
        address _collection,
        uint256 _tokenId,
        uint256 _price
    ) external;
}

File 25 of 45 : IRewardsCollector.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.15;

import {ERC20} from 'solmate/src/tokens/ERC20.sol';

/// @title LooksRare Rewards Collector
/// @notice Implements a permissionless call to fetch LooksRare rewards earned by Universal Router users
/// and transfers them to an external rewards distributor contract
interface IRewardsCollector {
    /// @notice Fetches users' LooksRare rewards and sends them to the distributor contract
    /// @param looksRareClaim The data required by LooksRare to claim reward tokens
    function collectRewards(bytes calldata looksRareClaim) external;
}

File 26 of 45 : IStableSwap.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStableSwap {
    // solium-disable-next-line mixedcase
    function get_dy(
        uint256 i,
        uint256 j,
        uint256 dx
    ) external view returns (uint256 dy);

    // solium-disable-next-line mixedcase
    function exchange(
        uint256 i,
        uint256 j,
        uint256 dx,
        uint256 minDy
    ) external payable;

    // solium-disable-next-line mixedcase
    function coins(uint256 i) external view returns (address);

    // solium-disable-next-line mixedcase
    function balances(uint256 i) external view returns (uint256);

    // solium-disable-next-line mixedcase
    function A() external view returns (uint256);

    // solium-disable-next-line mixedcase
    function fee() external view returns (uint256);
}

File 27 of 45 : IStableSwapFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStableSwapFactory {
    struct StableSwapPairInfo {
        address swapContract;
        address token0;
        address token1;
        address LPContract;
    }

    struct StableSwapThreePoolPairInfo {
        address swapContract;
        address token0;
        address token1;
        address token2;
        address LPContract;
    }

    // solium-disable-next-line mixedcase
    function pairLength() external view returns (uint256);

    function getPairInfo(address _tokenA, address _tokenB) 
        external 
        view 
        returns (StableSwapPairInfo memory info);

    function getThreePoolPairInfo(address _tokenA, address _tokenB)
        external
        view
        returns (StableSwapThreePoolPairInfo memory info);
        
}

File 28 of 45 : IStableSwapInfo.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IStableSwapInfo {
    function get_dx(
        address _swap,
        uint256 i,
        uint256 j,
        uint256 dy,
        uint256 max_dx
    ) external view returns (uint256);
}

File 29 of 45 : IUniversalRouter.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {IERC721Receiver} from '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import {IERC1155Receiver} from '@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol';
import {IRewardsCollector} from './IRewardsCollector.sol';

interface IUniversalRouter is IRewardsCollector, IERC721Receiver, IERC1155Receiver {
    /// @notice Thrown when a required command has failed
    error ExecutionFailed(uint256 commandIndex, bytes message);

    /// @notice Thrown when attempting to send ETH directly to the contract
    error ETHNotAccepted();

    /// @notice Thrown when executing commands with an expired deadline
    error TransactionDeadlinePassed();

    /// @notice Thrown when attempting to execute commands and an incorrect number of inputs are provided
    error LengthMismatch();

    /// @notice Executes encoded commands along with provided inputs. Reverts if deadline has expired.
    /// @param commands A set of concatenated commands, each 1 byte in length
    /// @param inputs An array of byte strings containing abi encoded inputs for each command
    /// @param deadline The deadline by which the transaction must be executed
    function execute(bytes calldata commands, bytes[] calldata inputs, uint256 deadline) external payable;
}

File 30 of 45 : IWETH9.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.4;

import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.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;
}

File 31 of 45 : BytesLib.sol
// SPDX-License-Identifier: GPL-3.0-or-later

/// @title Library for Bytes Manipulation
pragma solidity ^0.8.0;

import {Constants} from './Constants.sol';

library BytesLib {
    error SliceOutOfBounds();

    /// @notice Returns the address starting at byte 0
    /// @dev length and overflow checks must be carried out before calling
    /// @param _bytes The input bytes string to slice
    /// @return _address The address starting at byte 0
    function toAddress(bytes calldata _bytes) internal pure returns (address _address) {
        if (_bytes.length < Constants.ADDR_SIZE) revert SliceOutOfBounds();
        assembly {
            _address := shr(96, calldataload(_bytes.offset))
        }
    }

    /// @notice Returns the pool details starting at byte 0
    /// @dev length and overflow checks must be carried out before calling
    /// @param _bytes The input bytes string to slice
    /// @return token0 The address at byte 0
    /// @return fee The uint24 starting at byte 20
    /// @return token1 The address at byte 23
    function toPool(bytes calldata _bytes) internal pure returns (address token0, uint24 fee, address token1) {
        if (_bytes.length < Constants.V3_POP_OFFSET) revert SliceOutOfBounds();
        assembly {
            let firstWord := calldataload(_bytes.offset)
            token0 := shr(96, firstWord)
            fee := and(shr(72, firstWord), 0xffffff)
            token1 := shr(96, calldataload(add(_bytes.offset, 23)))
        }
    }

    /// @notice Decode the `_arg`-th element in `_bytes` as a dynamic array
    /// @dev The decoding of `length` and `offset` is universal,
    /// whereas the type declaration of `res` instructs the compiler how to read it.
    /// @param _bytes The input bytes string to slice
    /// @param _arg The index of the argument to extract
    /// @return length Length of the array
    /// @return offset Pointer to the data part of the array
    function toLengthOffset(bytes calldata _bytes, uint256 _arg)
        internal
        pure
        returns (uint256 length, uint256 offset)
    {
        uint256 relativeOffset;
        assembly {
            // The offset of the `_arg`-th element is `32 * arg`, which stores the offset of the length pointer.
            // shl(5, x) is equivalent to mul(32, x)
            let lengthPtr := add(_bytes.offset, calldataload(add(_bytes.offset, shl(5, _arg))))
            length := calldataload(lengthPtr)
            offset := add(lengthPtr, 0x20)
            relativeOffset := sub(offset, _bytes.offset)
        }
        if (_bytes.length < length + relativeOffset) revert SliceOutOfBounds();
    }

    /// @notice Decode the `_arg`-th element in `_bytes` as `bytes`
    /// @param _bytes The input bytes string to extract a bytes string from
    /// @param _arg The index of the argument to extract
    function toBytes(bytes calldata _bytes, uint256 _arg) internal pure returns (bytes calldata res) {
        (uint256 length, uint256 offset) = toLengthOffset(_bytes, _arg);
        assembly {
            res.length := length
            res.offset := offset
        }
    }

    /// @notice Decode the `_arg`-th element in `_bytes` as `address[]`
    /// @param _bytes The input bytes string to extract an address array from
    /// @param _arg The index of the argument to extract
    function toAddressArray(bytes calldata _bytes, uint256 _arg) internal pure returns (address[] calldata res) {
        (uint256 length, uint256 offset) = toLengthOffset(_bytes, _arg);
        assembly {
            res.length := length
            res.offset := offset
        }
    }

    /// @notice Decode the `_arg`-th element in `_bytes` as `bytes[]`
    /// @param _bytes The input bytes string to extract a bytes array from
    /// @param _arg The index of the argument to extract
    function toBytesArray(bytes calldata _bytes, uint256 _arg) internal pure returns (bytes[] calldata res) {
        (uint256 length, uint256 offset) = toLengthOffset(_bytes, _arg);
        assembly {
            res.length := length
            res.offset := offset
        }
    }

    /// @notice Decode the `_arg`-th element in `_bytes` as `uint[]`
    /// @param _bytes The input bytes string to extract an uint array from
    /// @param _arg The index of the argument to extract
    function toUintArray(bytes calldata _bytes, uint256 _arg) internal pure returns (uint[] calldata res) {
        (uint256 length, uint256 offset) = toLengthOffset(_bytes, _arg);
        assembly {
            res.length := length
            res.offset := offset
        }
    }
}

File 32 of 45 : Commands.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

/// @title Commands
/// @notice Command Flags used to decode commands
library Commands {
    // Masks to extract certain bits of commands
    bytes1 internal constant FLAG_ALLOW_REVERT = 0x80;
    bytes1 internal constant COMMAND_TYPE_MASK = 0x3f;

    // Command Types. Maximum supported command at this moment is 0x3f.

    // Command Types where value<0x08, executed in the first nested-if block
    uint256 constant V3_SWAP_EXACT_IN = 0x00;
    uint256 constant V3_SWAP_EXACT_OUT = 0x01;
    uint256 constant PERMIT2_TRANSFER_FROM = 0x02;
    uint256 constant PERMIT2_PERMIT_BATCH = 0x03;
    uint256 constant SWEEP = 0x04;
    uint256 constant TRANSFER = 0x05;
    uint256 constant PAY_PORTION = 0x06;
    // COMMAND_PLACEHOLDER = 0x07;

    // The commands are executed in nested if blocks to minimise gas consumption
    // The following constant defines one of the boundaries where the if blocks split commands
    uint256 constant FIRST_IF_BOUNDARY = 0x08;

    // Command Types where 0x08<=value<0x10, executed in the second nested-if block
    uint256 constant V2_SWAP_EXACT_IN = 0x08;
    uint256 constant V2_SWAP_EXACT_OUT = 0x09;
    uint256 constant PERMIT2_PERMIT = 0x0a;
    uint256 constant WRAP_ETH = 0x0b;
    uint256 constant UNWRAP_WETH = 0x0c;
    uint256 constant PERMIT2_TRANSFER_FROM_BATCH = 0x0d;
    uint256 constant BALANCE_CHECK_ERC20 = 0x0e;
    // COMMAND_PLACEHOLDER = 0x0f;

    // The commands are executed in nested if blocks to minimise gas consumption
    // The following constant defines one of the boundaries where the if blocks split commands
    uint256 constant SECOND_IF_BOUNDARY = 0x10;

    // Command Types where 0x10<=value<0x18, executed in the third nested-if block
    uint256 constant OWNER_CHECK_721 = 0x10;
    uint256 constant OWNER_CHECK_1155 = 0x11;
    uint256 constant SWEEP_ERC721 = 0x12;
    uint256 constant SWEEP_ERC1155 = 0x13;
    // COMMAND_PLACEHOLDER for 0x14-0x17 (all unused)

    // The commands are executed in nested if blocks to minimise gas consumption
    // The following constant defines one of the boundaries where the if blocks split commands
    uint256 constant THIRD_IF_BOUNDARY = 0x18;

    // Command Types where 0x18<=value<=0x1f, executed in the final nested-if block
    uint256 constant SEAPORT_V1_5 = 0x18;
    uint256 constant SEAPORT_V1_4 = 0x19;
    uint256 constant LOOKS_RARE_V2 = 0x1a;
    uint256 constant X2Y2_721 = 0x1b;
    uint256 constant X2Y2_1155 = 0x1c;
    // COMMAND_PLACEHOLDER for 0x1d-0x1f (all unused)

    // The commands are executed in nested if blocks to minimise gas consumption
    // The following constant defines one of the boundaries where the if blocks split commands
    uint256 constant FOURTH_IF_BOUNDARY = 0x20;

    // Command Types where 0x20<=value
    uint256 constant EXECUTE_SUB_PLAN = 0x20;
    uint256 constant APPROVE_ERC20 = 0x21;
    uint256 constant STABLE_SWAP_EXACT_IN = 0x22;
    uint256 constant STABLE_SWAP_EXACT_OUT = 0x23;
    uint256 constant PANCAKE_NFT_BNB = 0x24;
    uint256 constant PANCAKE_NFT_WBNB = 0x25;        
    // COMMAND_PLACEHOLDER for 0x26-0x3f (all unused)
}

File 33 of 45 : Constants.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {IWETH9} from '../interfaces/IWETH9.sol';

/// @title Constant state
/// @notice Constant state used by the Universal Router
library Constants {
    /// @dev Used for identifying cases when this contract's balance of a token is to be used as an input
    /// This value is equivalent to 1<<255, i.e. a singular 1 in the most significant bit.
    uint256 internal constant CONTRACT_BALANCE = 0x8000000000000000000000000000000000000000000000000000000000000000;

    /// @dev Used for identifying cases when a v2 pair has already received input tokens
    uint256 internal constant ALREADY_PAID = 0;

    /// @dev Used as a flag for identifying the transfer of ETH instead of a token
    address internal constant ETH = address(0);

    /// @dev Used as a flag for identifying that msg.sender should be used, saves gas by sending more 0 bytes
    address internal constant MSG_SENDER = address(1);

    /// @dev Used as a flag for identifying address(this) should be used, saves gas by sending more 0 bytes
    address internal constant ADDRESS_THIS = address(2);

    /// @dev The length of the bytes encoded address
    uint256 internal constant ADDR_SIZE = 20;

    /// @dev The length of the bytes encoded fee
    uint256 internal constant V3_FEE_SIZE = 3;

    /// @dev The offset of a single token address (20) and pool fee (3)
    uint256 internal constant NEXT_V3_POOL_OFFSET = ADDR_SIZE + V3_FEE_SIZE;

    /// @dev The offset of an encoded pool key
    /// Token (20) + Fee (3) + Token (20) = 43
    uint256 internal constant V3_POP_OFFSET = NEXT_V3_POOL_OFFSET + ADDR_SIZE;

    /// @dev The minimum length of an encoding that contains 2 or more pools
    uint256 internal constant MULTIPLE_V3_POOLS_MIN_LENGTH = V3_POP_OFFSET + NEXT_V3_POOL_OFFSET;
}

File 34 of 45 : UniversalRouterHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.0;

import {IUniswapV2Pair} from '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import {IPancakeV3Pool} from '@pancakeswap/v3-core/contracts/interfaces/IPancakeV3Pool.sol';
import {IStableSwapFactory} from '../interfaces/IStableSwapFactory.sol';
import {IStableSwapInfo} from '../interfaces/IStableSwapInfo.sol';
import {BytesLib} from './BytesLib.sol';
import {Constants} from './Constants.sol';

library UniversalRouterHelper {
    using BytesLib for bytes;

    error InvalidPoolAddress();
    error InvalidPoolLength();
    error InvalidReserves();
    error InvalidPath();

    /************************************************** Stable **************************************************/

    // get the pool info in stable swap
    function getStableInfo(
        address stableSwapFactory,
        address input,
        address output,
        uint256 flag
    ) internal view returns (uint256 i, uint256 j, address swapContract) {
        if (flag == 2) {
            IStableSwapFactory.StableSwapPairInfo memory info = IStableSwapFactory(stableSwapFactory).getPairInfo(input, output);
            i = input == info.token0 ? 0 : 1;
            j = (i == 0) ? 1 : 0;
            swapContract = info.swapContract;
        } else if (flag == 3) {
            IStableSwapFactory.StableSwapThreePoolPairInfo memory info = IStableSwapFactory(stableSwapFactory).getThreePoolPairInfo(input, output);

            if (input == info.token0) i = 0;
            else if (input == info.token1) i = 1;
            else if (input == info.token2) i = 2;

            if (output == info.token0) j = 0;
            else if (output == info.token1) j = 1;
            else if (output == info.token2) j = 2;

            swapContract = info.swapContract;
        }

        if (swapContract == address(0)) revert InvalidPoolAddress();
    }

    function getStableAmountsIn(
        address stableSwapFactory,
        address stableSwapInfo,
        address[] calldata path,
        uint256[] calldata flag,
        uint256 amountOut
    ) internal view returns (uint256[] memory amounts) {
        uint256 length = path.length;
        if (length < 2) revert InvalidPoolLength();

        amounts = new uint256[](length);
        amounts[length - 1] = amountOut;

        for (uint256 i = length - 1; i > 0; i--) {
            uint256 last = i - 1;
            (uint256 k, uint256 j, address swapContract) = getStableInfo(stableSwapFactory, path[last], path[i], flag[last]);
            amounts[last] = IStableSwapInfo(stableSwapInfo).get_dx(swapContract, k, j, amounts[i], type(uint256).max);
        }
    }



    /************************************************** V2 **************************************************/
    /// @notice Sorts two tokens to return token0 and token1
    /// @param tokenA The first token to sort
    /// @param tokenB The other token to sort
    /// @return token0 The smaller token by address value
    /// @return token1 The larger token by address value
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
    }


    /// @notice Calculates the v2 address for a pair assuming the input tokens are pre-sorted
    /// @param factory The address of the v2 factory
    /// @param initCodeHash The hash of the pair initcode
    /// @param token0 The pair's token0
    /// @param token1 The pair's token1
    /// @return pair The resultant v2 pair address
    function pairForPreSorted(address factory, bytes32 initCodeHash, address token0, address token1)
        private
        pure
        returns (address pair)
    {
        pair = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(hex'ff', factory, keccak256(abi.encodePacked(token0, token1)), initCodeHash)
                    )
                )
            )
        );


    }


    /// @notice Calculates the v2 address for a pair without making any external calls
    /// @param factory The address of the v2 factory
    /// @param initCodeHash The hash of the pair initcode
    /// @param tokenA One of the tokens in the pair
    /// @param tokenB The other token in the pair
    /// @return pair The resultant v2 pair address
    function pairFor(address factory, bytes32 initCodeHash, address tokenA, address tokenB)
        internal
        pure
        returns (address pair)
    {
        (address token0, address token1) = sortTokens(tokenA, tokenB);
        pair = pairForPreSorted(factory, initCodeHash, token0, token1);
    }


    /// @notice Calculates the v2 address for a pair and the pair's token0
    /// @param factory The address of the v2 factory
    /// @param initCodeHash The hash of the pair initcode
    /// @param tokenA One of the tokens in the pair
    /// @param tokenB The other token in the pair
    /// @return pair The resultant v2 pair address
    /// @return token0 The token considered token0 in this pair
    function pairAndToken0For(address factory, bytes32 initCodeHash, address tokenA, address tokenB)
        internal
        pure
        returns (address pair, address token0)
    {
        address token1;
        (token0, token1) = sortTokens(tokenA, tokenB);
        pair = pairForPreSorted(factory, initCodeHash, token0, token1);
    }



    /// @notice Calculates the v2 address for a pair and fetches the reserves for each token
    /// @param factory The address of the v2 factory
    /// @param initCodeHash The hash of the pair initcode
    /// @param tokenA One of the tokens in the pair
    /// @param tokenB The other token in the pair
    /// @return pair The resultant v2 pair address
    /// @return reserveA The reserves for tokenA
    /// @return reserveB The reserves for tokenB
    function pairAndReservesFor(address factory, bytes32 initCodeHash, address tokenA, address tokenB)
        private
        view
        returns (address pair, uint256 reserveA, uint256 reserveB)
    {
        address token0;
        (pair, token0) = pairAndToken0For(factory, initCodeHash, tokenA, tokenB);
        (uint256 reserve0, uint256 reserve1,) = IUniswapV2Pair(pair).getReserves();
        (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }



    /// @notice Given an input asset amount returns the maximum output amount of the other asset
    /// @param amountIn The token input amount
    /// @param reserveIn The reserves available of the input token
    /// @param reserveOut The reserves available of the output token
    /// @return amountOut The output amount of the output token
    function getAmountOut(uint256 amountIn, uint256 reserveIn, uint256 reserveOut)
        internal
        pure
        returns (uint256 amountOut)
    {
        if (reserveIn == 0 || reserveOut == 0) revert InvalidReserves();
        uint256 amountInWithFee = amountIn * 9975;
        uint256 numerator = amountInWithFee * reserveOut;
        uint256 denominator = reserveIn * 10000 + amountInWithFee;
        amountOut = numerator / denominator;
    }

    /// @notice Returns the input amount needed for a desired output amount in a single-hop trade
    /// @param amountOut The desired output amount
    /// @param reserveIn The reserves available of the input token
    /// @param reserveOut The reserves available of the output token
    /// @return amountIn The input amount of the input token
    function getAmountIn(uint256 amountOut, uint256 reserveIn, uint256 reserveOut)
        internal
        pure
        returns (uint256 amountIn)
    {
        if (reserveIn == 0 || reserveOut == 0) revert InvalidReserves();
        uint256 numerator = reserveIn * amountOut * 10000;
        uint256 denominator = (reserveOut - amountOut) * 9975;
        amountIn = (numerator / denominator) + 1;
    }


    /// @notice Returns the input amount needed for a desired output amount in a multi-hop trade
    /// @param factory The address of the v2 factory
    /// @param initCodeHash The hash of the pair initcode
    /// @param amountOut The desired output amount
    /// @param path The path of the multi-hop trade
    /// @return amount The input amount of the input token
    /// @return pair The first pair in the trade
    function getAmountInMultihop(address factory, bytes32 initCodeHash, uint256 amountOut, address[] calldata path)
        internal
        view
        returns (uint256 amount, address pair)
    {
        if (path.length < 2) revert InvalidPath();
        amount = amountOut;
        for (uint256 i = path.length - 1; i > 0; i--) {
            uint256 reserveIn;
            uint256 reserveOut;

            (pair, reserveIn, reserveOut) = pairAndReservesFor(factory, initCodeHash, path[i - 1], path[i]);
            amount = getAmountIn(amount, reserveIn, reserveOut);
        }
    }








    /************************************************** V3 **************************************************/
    /// @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 calldata path) internal pure returns (bool) {
        return path.length >= Constants.MULTIPLE_V3_POOLS_MIN_LENGTH;
    }

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

    /// @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 calldata path) internal pure returns (bytes calldata) {
        return path[:Constants.V3_POP_OFFSET];
    }

    function decodeFirstToken(bytes calldata path) internal pure returns (address tokenA) {
        tokenA = path.toAddress();
    }

    /// @notice Skips a token + fee element
    /// @param path The swap path
    function skipToken(bytes calldata path) internal pure returns (bytes calldata) {
        return path[Constants.NEXT_V3_POOL_OFFSET:];
    }

    function computePoolAddress(
        address deployer, 
        bytes32 initCodeHash, 
        address tokenA, 
        address tokenB, 
        uint24 fee
    ) internal pure returns (address pool) {
        if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
        pool = address(
            uint160(
                uint256(
                    keccak256(
                        abi.encodePacked(
                            hex'ff',
                            deployer,
                            keccak256(abi.encode(tokenA, tokenB, fee)),
                            initCodeHash
                        )
                    )
                )
            )
        );
    }
}

File 35 of 45 : StableSwapRouter.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {RouterImmutables} from '../../base/RouterImmutables.sol';
import {Payments} from '../Payments.sol';
import {Permit2Payments} from '../Permit2Payments.sol';
import {Constants} from '../../libraries/Constants.sol';
import {UniversalRouterHelper} from '../../libraries/UniversalRouterHelper.sol';
import {ERC20} from 'solmate/src/tokens/ERC20.sol';
import {SafeTransferLib} from 'solmate/src/utils/SafeTransferLib.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {IStableSwap} from '../../interfaces/IStableSwap.sol';


/// @title Router for PancakeSwap Stable Trades
abstract contract StableSwapRouter is RouterImmutables, Permit2Payments, Ownable {
    using SafeTransferLib for ERC20;
    using UniversalRouterHelper for address;

    error StableTooLittleReceived();
    error StableTooMuchRequested();
    error StableInvalidPath();

    address public stableSwapFactory;
    address public stableSwapInfo;

    event SetStableSwap(address indexed factory, address indexed info);

    constructor(
        address _stableSwapFactory,
        address _stableSwapInfo
    ) {
        stableSwapFactory = _stableSwapFactory;
        stableSwapInfo = _stableSwapInfo;
    }

    /**
     * @notice Set Pancake Stable Swap Factory and Info
     * @dev Only callable by contract owner
     */
    function setStableSwap(
        address _factory,
        address _info
    ) external onlyOwner {
        require(_factory != address(0) && _info != address(0));

        stableSwapFactory = _factory;
        stableSwapInfo = _info;

        emit SetStableSwap(stableSwapFactory, stableSwapInfo);
    }

    function _stableSwap(
        address[] calldata path,
        uint256[] calldata flag
    ) private {
        unchecked {
            if (path.length - 1 != flag.length) revert StableInvalidPath();

            for (uint256 i; i < flag.length; i++) {
                (address input, address output) = (path[i], path[i + 1]);
                (uint256 k, uint256 j, address swapContract) = stableSwapFactory.getStableInfo(input, output, flag[i]); 
                uint256 amountIn = ERC20(input).balanceOf(address(this));
                ERC20(input).safeApprove(swapContract, amountIn);
                IStableSwap(swapContract).exchange(k, j, amountIn, 0);
            }
        }
    }

    /// @notice Performs a PancakeSwap stable exact input swap
    /// @param recipient The recipient of the output tokens
    /// @param amountIn The amount of input tokens for the trade
    /// @param amountOutMinimum The minimum desired amount of output tokens
    /// @param path The path of the trade as an array of token addresses
    /// @param flag token amount in a stable swap pool. 2 for 2pool, 3 for 3pool
    /// @param payer The address that will be paying the input
    function stableSwapExactInput(
        address recipient,
        uint256 amountIn,
        uint256 amountOutMinimum,
        address[] calldata path,
        uint256[] calldata flag,
        address payer
    ) internal {
        if (
            amountIn != Constants.ALREADY_PAID && amountIn != Constants.CONTRACT_BALANCE
        ) {
            payOrPermit2Transfer(path[0], payer, address(this), amountIn);
        }

        ERC20 tokenOut = ERC20(path[path.length - 1]);

        _stableSwap(path, flag); 

        uint256 amountOut = tokenOut.balanceOf(address(this));
        if (amountOut < amountOutMinimum) revert StableTooLittleReceived();

        if (recipient != address(this)) pay(address(tokenOut), recipient, amountOut);
    }

    /// @notice Performs a PancakeSwap stable exact output swap
    /// @param recipient The recipient of the output tokens
    /// @param amountOut The amount of output tokens to receive for the trade
    /// @param amountInMaximum The maximum desired amount of input tokens
    /// @param path The path of the trade as an array of token addresses
    /// @param flag token amount in a stable swap pool. 2 for 2pool, 3 for 3pool
    /// @param payer The address that will be paying the input
    function stableSwapExactOutput(
        address recipient,
        uint256 amountOut,
        uint256 amountInMaximum,
        address[] calldata path,
        uint256[] calldata flag,
        address payer
    ) internal {
        uint256 amountIn = stableSwapFactory.getStableAmountsIn(stableSwapInfo, path, flag, amountOut)[0];

        if (amountIn > amountInMaximum) revert StableTooMuchRequested();

        payOrPermit2Transfer(path[0], payer, address(this), amountIn);

        _stableSwap(path, flag); 

        if (recipient != address(this)) pay(path[path.length - 1], recipient, amountOut);
    }
}

File 36 of 45 : V2SwapRouter.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {IUniswapV2Pair} from '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import {RouterImmutables} from '../../base/RouterImmutables.sol';
import {Payments} from '../Payments.sol';
import {Permit2Payments} from '../Permit2Payments.sol';
import {Constants} from '../../libraries/Constants.sol';
import {UniversalRouterHelper} from '../../libraries/UniversalRouterHelper.sol';
import {ERC20} from 'solmate/src/tokens/ERC20.sol';

/// @title Router for PancakeSwap v2 Trades
abstract contract V2SwapRouter is RouterImmutables, Permit2Payments {
    error V2TooLittleReceived();
    error V2TooMuchRequested();
    error V2InvalidPath();

    function _v2Swap(address[] calldata path, address recipient, address pair) private {
        unchecked {
            if (path.length < 2) revert V2InvalidPath();

            // cached to save on duplicate operations
            (address token0,) = UniversalRouterHelper.sortTokens(path[0], path[1]);
            uint256 finalPairIndex = path.length - 1;
            uint256 penultimatePairIndex = finalPairIndex - 1;
            for (uint256 i; i < finalPairIndex; i++) {
                (address input, address output) = (path[i], path[i + 1]);
                (uint256 reserve0, uint256 reserve1,) = IUniswapV2Pair(pair).getReserves();
                (uint256 reserveInput, uint256 reserveOutput) =
                    input == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
                uint256 amountInput = ERC20(input).balanceOf(pair) - reserveInput;
                uint256 amountOutput = UniversalRouterHelper.getAmountOut(amountInput, reserveInput, reserveOutput);
                (uint256 amount0Out, uint256 amount1Out) =
                    input == token0 ? (uint256(0), amountOutput) : (amountOutput, uint256(0));
                address nextPair;
                (nextPair, token0) = i < penultimatePairIndex
                    ? UniversalRouterHelper.pairAndToken0For(
                        PANCAKESWAP_V2_FACTORY, PANCAKESWAP_V2_PAIR_INIT_CODE_HASH, output, path[i + 2]
                    )
                    : (recipient, address(0));
                IUniswapV2Pair(pair).swap(amount0Out, amount1Out, nextPair, new bytes(0));
                pair = nextPair;
            }
        }
    }

    /// @notice Performs a PancakeSwap v2 exact input swap
    /// @param recipient The recipient of the output tokens
    /// @param amountIn The amount of input tokens for the trade
    /// @param amountOutMinimum The minimum desired amount of output tokens
    /// @param path The path of the trade as an array of token addresses
    /// @param payer The address that will be paying the input
    function v2SwapExactInput(
        address recipient,
        uint256 amountIn,
        uint256 amountOutMinimum,
        address[] calldata path,
        address payer
    ) internal {
        address firstPair =
            UniversalRouterHelper.pairFor(PANCAKESWAP_V2_FACTORY, PANCAKESWAP_V2_PAIR_INIT_CODE_HASH, path[0], path[1]);
        if (
            amountIn != Constants.ALREADY_PAID // amountIn of 0 to signal that the pair already has the tokens
        ) {
            payOrPermit2Transfer(path[0], payer, firstPair, amountIn);
        }

        ERC20 tokenOut = ERC20(path[path.length - 1]);
        uint256 balanceBefore = tokenOut.balanceOf(recipient);

        _v2Swap(path, recipient, firstPair);

        uint256 amountOut = tokenOut.balanceOf(recipient) - balanceBefore;
        if (amountOut < amountOutMinimum) revert V2TooLittleReceived();
    }

    /// @notice Performs a PancakeSwap v2 exact output swap
    /// @param recipient The recipient of the output tokens
    /// @param amountOut The amount of output tokens to receive for the trade
    /// @param amountInMaximum The maximum desired amount of input tokens
    /// @param path The path of the trade as an array of token addresses
    /// @param payer The address that will be paying the input
    function v2SwapExactOutput(
        address recipient,
        uint256 amountOut,
        uint256 amountInMaximum,
        address[] calldata path,
        address payer
    ) internal {
        (uint256 amountIn, address firstPair) =
            UniversalRouterHelper.getAmountInMultihop(PANCAKESWAP_V2_FACTORY, PANCAKESWAP_V2_PAIR_INIT_CODE_HASH, amountOut, path);
        if (amountIn > amountInMaximum) revert V2TooMuchRequested();

        payOrPermit2Transfer(path[0], payer, firstPair, amountIn);
        _v2Swap(path, recipient, firstPair);
    }
}

File 37 of 45 : V3SwapRouter.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {SafeCast} from '@pancakeswap/v3-core/contracts/libraries/SafeCast.sol';
import {IPancakeV3Pool} from '@pancakeswap/v3-core/contracts/interfaces/IPancakeV3Pool.sol';
import {IPancakeV3SwapCallback} from '@pancakeswap/v3-core/contracts/interfaces/callback/IPancakeV3SwapCallback.sol';
import {BytesLib} from '../../libraries/BytesLib.sol';
import {Constants} from '../../libraries/Constants.sol';
import {UniversalRouterHelper} from '../../libraries/UniversalRouterHelper.sol';
import {RouterImmutables} from '../../base/RouterImmutables.sol';
import {Permit2Payments} from '../Permit2Payments.sol';
import {ERC20} from 'solmate/src/tokens/ERC20.sol';

/// @title Router for PancakeSwap v3 Trades
abstract contract V3SwapRouter is RouterImmutables, Permit2Payments, IPancakeV3SwapCallback {
    using UniversalRouterHelper for bytes;
    using BytesLib for bytes;
    using SafeCast for uint256;

    error V3InvalidSwap();
    error V3TooLittleReceived();
    error V3TooMuchRequested();
    error V3InvalidAmountOut();
    error V3InvalidCaller();

    /// @dev Used as the placeholder value for maxAmountIn, because the computed amount in for an exact output swap
    /// can never actually be this value
    uint256 private constant DEFAULT_MAX_AMOUNT_IN = type(uint256).max;

    /// @dev Transient storage variable used for checking slippage
    uint256 private maxAmountInCached = DEFAULT_MAX_AMOUNT_IN;

    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;

    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

    function pancakeV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes calldata data) external {
        if (amount0Delta <= 0 && amount1Delta <= 0) revert V3InvalidSwap(); // swaps entirely within 0-liquidity regions are not supported
        (, address payer) = abi.decode(data, (bytes, address));
        bytes calldata path = data.toBytes(0);

        // because exact output swaps are executed in reverse order, in this case tokenOut is actually tokenIn
        (address tokenIn, uint24 fee, address tokenOut) = path.decodeFirstPool();

        if (UniversalRouterHelper.computePoolAddress(PANCAKESWAP_V3_DEPLOYER, PANCAKESWAP_V3_POOL_INIT_CODE_HASH, tokenIn, tokenOut, fee) != msg.sender) revert V3InvalidCaller();

        (bool isExactInput, uint256 amountToPay) =
            amount0Delta > 0 ? (tokenIn < tokenOut, uint256(amount0Delta)) : (tokenOut < tokenIn, uint256(amount1Delta));

        if (isExactInput) {
            // Pay the pool (msg.sender)
            payOrPermit2Transfer(tokenIn, payer, msg.sender, amountToPay);
        } else {
            // either initiate the next swap or pay
            if (path.hasMultiplePools()) {
                // this is an intermediate step so the payer is actually this contract
                path = path.skipToken();
                _swap(-amountToPay.toInt256(), msg.sender, path, payer, false);
            } else {
                if (amountToPay > maxAmountInCached) revert V3TooMuchRequested();
                // note that because exact output swaps are executed in reverse order, tokenOut is actually tokenIn
                payOrPermit2Transfer(tokenOut, payer, msg.sender, amountToPay);
            }
        }
    }

    /// @notice Performs a PancakeSwap v3 exact input swap
    /// @param recipient The recipient of the output tokens
    /// @param amountIn The amount of input tokens for the trade
    /// @param amountOutMinimum The minimum desired amount of output tokens
    /// @param path The path of the trade as a bytes string
    /// @param payer The address that will be paying the input
    function v3SwapExactInput(
        address recipient,
        uint256 amountIn,
        uint256 amountOutMinimum,
        bytes calldata path,
        address payer
    ) internal {
        // use amountIn == Constants.CONTRACT_BALANCE as a flag to swap the entire balance of the contract
        if (amountIn == Constants.CONTRACT_BALANCE) {
            address tokenIn = path.decodeFirstToken();
            amountIn = ERC20(tokenIn).balanceOf(address(this));
        }

        uint256 amountOut;
        while (true) {
            bool hasMultiplePools = path.hasMultiplePools();

            // the outputs of prior swaps become the inputs to subsequent ones
            (int256 amount0Delta, int256 amount1Delta, bool zeroForOne) = _swap(
                amountIn.toInt256(),
                hasMultiplePools ? address(this) : recipient, // for intermediate swaps, this contract custodies
                path.getFirstPool(), // only the first pool is needed
                payer, // for intermediate swaps, this contract custodies
                true
            );

            amountIn = uint256(-(zeroForOne ? amount1Delta : amount0Delta));

            // decide whether to continue or terminate
            if (hasMultiplePools) {
                payer = address(this);
                path = path.skipToken();
            } else {
                amountOut = amountIn;
                break;
            }
        }

        if (amountOut < amountOutMinimum) revert V3TooLittleReceived();
    }

    /// @notice Performs a PancakeSwap v3 exact output swap
    /// @param recipient The recipient of the output tokens
    /// @param amountOut The amount of output tokens to receive for the trade
    /// @param amountInMaximum The maximum desired amount of input tokens
    /// @param path The path of the trade as a bytes string
    /// @param payer The address that will be paying the input
    function v3SwapExactOutput(
        address recipient,
        uint256 amountOut,
        uint256 amountInMaximum,
        bytes calldata path,
        address payer
    ) internal {
        maxAmountInCached = amountInMaximum;
        (int256 amount0Delta, int256 amount1Delta, bool zeroForOne) =
            _swap(-amountOut.toInt256(), recipient, path, payer, false);

        uint256 amountOutReceived = zeroForOne ? uint256(-amount1Delta) : uint256(-amount0Delta);

        if (amountOutReceived != amountOut) revert V3InvalidAmountOut();

        maxAmountInCached = DEFAULT_MAX_AMOUNT_IN;
    }

    /// @dev Performs a single swap for both exactIn and exactOut
    /// For exactIn, `amount` is `amountIn`. For exactOut, `amount` is `-amountOut`
    function _swap(int256 amount, address recipient, bytes calldata path, address payer, bool isExactIn)
        private
        returns (int256 amount0Delta, int256 amount1Delta, bool zeroForOne)
    {
        (address tokenIn, uint24 fee, address tokenOut) = path.decodeFirstPool();

        zeroForOne = isExactIn ? tokenIn < tokenOut : tokenOut < tokenIn;

        (amount0Delta, amount1Delta) = IPancakeV3Pool(UniversalRouterHelper.computePoolAddress(PANCAKESWAP_V3_DEPLOYER, PANCAKESWAP_V3_POOL_INIT_CODE_HASH, tokenIn, tokenOut, fee)).swap(
            recipient,
            zeroForOne,
            amount,
            (zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1),
            abi.encode(path, payer)
        );
    }
}

File 38 of 45 : Payments.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.17;

import {Constants} from '../libraries/Constants.sol';
import {RouterImmutables} from '../base/RouterImmutables.sol';
import {SafeTransferLib} from 'solmate/src/utils/SafeTransferLib.sol';
import {ERC20} from 'solmate/src/tokens/ERC20.sol';
import {ERC721} from 'solmate/src/tokens/ERC721.sol';
import {ERC1155} from 'solmate/src/tokens/ERC1155.sol';

/// @title Payments contract
/// @notice Performs various operations around the payment of ETH and tokens
abstract contract Payments is RouterImmutables {
    using SafeTransferLib for ERC20;
    using SafeTransferLib for address;

    error InsufficientToken();
    error InsufficientETH();
    error InvalidBips();
    error InvalidSpender();

    uint256 internal constant FEE_BIPS_BASE = 10_000;

    /// @notice Pays an amount of ETH or ERC20 to a recipient
    /// @param token The token to pay (can be ETH using Constants.ETH)
    /// @param recipient The address that will receive the payment
    /// @param value The amount to pay
    function pay(address token, address recipient, uint256 value) internal {
        if (token == Constants.ETH) {
            recipient.safeTransferETH(value);
        } else {
            if (value == Constants.CONTRACT_BALANCE) {
                value = ERC20(token).balanceOf(address(this));
            }

            ERC20(token).safeTransfer(recipient, value);
        }
    }

    /// @notice Approves a protocol to spend ERC20s in the router
    /// @param token The token to approve
    /// @param spender Which protocol to approve
    function approveERC20(ERC20 token, Spenders spender) internal {
        // check spender is one of our approved spenders
        address spenderAddress;
        /// @dev use 0 = Opensea Conduit for both Seaport v1.4 and v1.5
        if (spender == Spenders.OSConduit) spenderAddress = OPENSEA_CONDUIT;
        else revert InvalidSpender();

        // set approval
        token.safeApprove(spenderAddress, type(uint256).max);
    }

    /// @notice Pays a proportion of the contract's ETH or ERC20 to a recipient
    /// @param token The token to pay (can be ETH using Constants.ETH)
    /// @param recipient The address that will receive payment
    /// @param bips Portion in bips of whole balance of the contract
    function payPortion(address token, address recipient, uint256 bips) internal {
        if (bips == 0 || bips > FEE_BIPS_BASE) revert InvalidBips();
        if (token == Constants.ETH) {
            uint256 balance = address(this).balance;
            uint256 amount = (balance * bips) / FEE_BIPS_BASE;
            recipient.safeTransferETH(amount);
        } else {
            uint256 balance = ERC20(token).balanceOf(address(this));
            uint256 amount = (balance * bips) / FEE_BIPS_BASE;
            ERC20(token).safeTransfer(recipient, amount);
        }
    }

    /// @notice Sweeps all of the contract's ERC20 or ETH to an address
    /// @param token The token to sweep (can be ETH using Constants.ETH)
    /// @param recipient The address that will receive payment
    /// @param amountMinimum The minimum desired amount
    function sweep(address token, address recipient, uint256 amountMinimum) internal {
        uint256 balance;
        if (token == Constants.ETH) {
            balance = address(this).balance;
            if (balance < amountMinimum) revert InsufficientETH();
            if (balance > 0) recipient.safeTransferETH(balance);
        } else {
            balance = ERC20(token).balanceOf(address(this));
            if (balance < amountMinimum) revert InsufficientToken();
            if (balance > 0) ERC20(token).safeTransfer(recipient, balance);
        }
    }

    /// @notice Sweeps an ERC721 to a recipient from the contract
    /// @param token The ERC721 token to sweep
    /// @param recipient The address that will receive payment
    /// @param id The ID of the ERC721 to sweep
    function sweepERC721(address token, address recipient, uint256 id) internal {
        ERC721(token).safeTransferFrom(address(this), recipient, id);
    }

    /// @notice Sweeps all of the contract's ERC1155 to an address
    /// @param token The ERC1155 token to sweep
    /// @param recipient The address that will receive payment
    /// @param id The ID of the ERC1155 to sweep
    /// @param amountMinimum The minimum desired amount
    function sweepERC1155(address token, address recipient, uint256 id, uint256 amountMinimum) internal {
        uint256 balance = ERC1155(token).balanceOf(address(this), id);
        if (balance < amountMinimum) revert InsufficientToken();
        ERC1155(token).safeTransferFrom(address(this), recipient, id, balance, bytes(''));
    }

    /// @notice Wraps an amount of ETH into WETH
    /// @param recipient The recipient of the WETH
    /// @param amount The amount to wrap (can be CONTRACT_BALANCE)
    function wrapETH(address recipient, uint256 amount) internal {
        if (amount == Constants.CONTRACT_BALANCE) {
            amount = address(this).balance;
        } else if (amount > address(this).balance) {
            revert InsufficientETH();
        }
        if (amount > 0) {
            WETH9.deposit{value: amount}();
            if (recipient != address(this)) {
                WETH9.transfer(recipient, amount);
            }
        }
    }

    /// @notice Unwraps all of the contract's WETH into ETH
    /// @param recipient The recipient of the ETH
    /// @param amountMinimum The minimum amount of ETH desired
    function unwrapWETH9(address recipient, uint256 amountMinimum) internal {
        uint256 value = WETH9.balanceOf(address(this));
        if (value < amountMinimum) {
            revert InsufficientETH();
        }
        if (value > 0) {
            WETH9.withdraw(value);
            if (recipient != address(this)) {
                recipient.safeTransferETH(value);
            }
        }
    }
}

File 39 of 45 : Permit2Payments.sol
pragma solidity ^0.8.17;

import {IAllowanceTransfer} from '../permit2/src/interfaces/IAllowanceTransfer.sol';
import {SafeCast160} from '../permit2/src/libraries/SafeCast160.sol';
import {Payments} from './Payments.sol';
import {Constants} from '../libraries/Constants.sol';
import {RouterImmutables} from '../base/RouterImmutables.sol';

/// @title Payments through Permit2
/// @notice Performs interactions with Permit2 to transfer tokens
abstract contract Permit2Payments is Payments {
    using SafeCast160 for uint256;

    error FromAddressIsNotOwner();

    /// @notice Performs a transferFrom on Permit2
    /// @param token The token to transfer
    /// @param from The address to transfer from
    /// @param to The recipient of the transfer
    /// @param amount The amount to transfer
    function permit2TransferFrom(address token, address from, address to, uint160 amount) internal {
        PERMIT2.transferFrom(from, to, amount, token);
    }

    /// @notice Performs a batch transferFrom on Permit2
    /// @param batchDetails An array detailing each of the transfers that should occur
    function permit2TransferFrom(IAllowanceTransfer.AllowanceTransferDetails[] memory batchDetails, address owner)
        internal
    {
        uint256 batchLength = batchDetails.length;
        for (uint256 i = 0; i < batchLength; ++i) {
            if (batchDetails[i].from != owner) revert FromAddressIsNotOwner();
        }
        PERMIT2.transferFrom(batchDetails);
    }

    /// @notice Either performs a regular payment or transferFrom on Permit2, depending on the payer address
    /// @param token The token to transfer
    /// @param payer The address to pay for the transfer
    /// @param recipient The recipient of the transfer
    /// @param amount The amount to transfer
    function payOrPermit2Transfer(address token, address payer, address recipient, uint256 amount) internal {
        if (payer == address(this)) pay(token, recipient, amount);
        else permit2TransferFrom(token, payer, recipient, amount.toUint160());
    }
}

File 40 of 45 : IAllowanceTransfer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

/// @title AllowanceTransfer
/// @notice Handles ERC20 token permissions through signature based allowance setting and ERC20 token transfers by checking allowed amounts
/// @dev Requires user's token approval on the Permit2 contract
interface IAllowanceTransfer {
    /// @notice Thrown when an allowance on a token has expired.
    /// @param deadline The timestamp at which the allowed amount is no longer valid
    error AllowanceExpired(uint256 deadline);

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

    /// @notice Thrown when too many nonces are invalidated.
    error ExcessiveInvalidation();

    /// @notice Emits an event when the owner successfully invalidates an ordered nonce.
    event NonceInvalidation(
        address indexed owner, address indexed token, address indexed spender, uint48 newNonce, uint48 oldNonce
    );

    /// @notice Emits an event when the owner successfully sets permissions on a token for the spender.
    event Approval(
        address indexed owner, address indexed token, address indexed spender, uint160 amount, uint48 expiration
    );

    /// @notice Emits an event when the owner successfully sets permissions using a permit signature on a token for the spender.
    event Permit(
        address indexed owner,
        address indexed token,
        address indexed spender,
        uint160 amount,
        uint48 expiration,
        uint48 nonce
    );

    /// @notice Emits an event when the owner sets the allowance back to 0 with the lockdown function.
    event Lockdown(address indexed owner, address token, address spender);

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

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

    /// @notice The permit message signed for multiple token allowances
    struct PermitBatch {
        // the permit data for multiple token allowances
        PermitDetails[] details;
        // address permissioned on the allowed tokens
        address spender;
        // deadline on the permit signature
        uint256 sigDeadline;
    }

    /// @notice The saved permissions
    /// @dev This info is saved per owner, per token, per spender and all signed over in the permit message
    /// @dev Setting amount to type(uint160).max sets an unlimited approval
    struct PackedAllowance {
        // amount allowed
        uint160 amount;
        // permission expiry
        uint48 expiration;
        // an incrementing value indexed per owner,token,and spender for each signature
        uint48 nonce;
    }

    /// @notice A token spender pair.
    struct TokenSpenderPair {
        // the token the spender is approved
        address token;
        // the spender address
        address spender;
    }

    /// @notice Details for a token transfer.
    struct AllowanceTransferDetails {
        // the owner of the token
        address from;
        // the recipient of the token
        address to;
        // the amount of the token
        uint160 amount;
        // the token to be transferred
        address token;
    }

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

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

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

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

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

    /// @notice Transfer approved tokens in a batch
    /// @param transferDetails Array of owners, recipients, amounts, and tokens for the transfers
    /// @dev Requires the from addresses to have approved at least the desired amount
    /// of tokens to msg.sender.
    function transferFrom(AllowanceTransferDetails[] calldata transferDetails) external;

    /// @notice Enables performing a "lockdown" of the sender's Permit2 identity
    /// by batch revoking approvals
    /// @param approvals Array of approvals to revoke.
    function lockdown(TokenSpenderPair[] calldata approvals) external;

    /// @notice Invalidate nonces for a given (token, spender) pair
    /// @param token The token to invalidate nonces for
    /// @param spender The spender to invalidate nonces for
    /// @param newNonce The new nonce to set. Invalidates all nonces less than it.
    /// @dev Can't invalidate more than 2**16 nonces per transaction.
    function invalidateNonces(address token, address spender, uint48 newNonce) external;
}

File 41 of 45 : SafeCast160.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

library SafeCast160 {
    /// @notice Thrown when a valude greater than type(uint160).max is cast to uint160
    error UnsafeCast();

    /// @notice Safely casts uint256 to uint160
    /// @param value The uint256 to be cast
    function toUint160(uint256 value) internal pure returns (uint160) {
        if (value > type(uint160).max) revert UnsafeCast();
        return uint160(value);
    }
}

File 43 of 45 : ERC1155.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Minimalist and gas efficient standard ERC1155 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)
abstract contract ERC1155 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event TransferSingle(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256 id,
        uint256 amount
    );

    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] amounts
    );

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    event URI(string value, uint256 indexed id);

    /*//////////////////////////////////////////////////////////////
                             ERC1155 STORAGE
    //////////////////////////////////////////////////////////////*/

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

    mapping(address => mapping(address => bool)) public isApprovedForAll;

    /*//////////////////////////////////////////////////////////////
                             METADATA LOGIC
    //////////////////////////////////////////////////////////////*/

    function uri(uint256 id) public view virtual returns (string memory);

    /*//////////////////////////////////////////////////////////////
                              ERC1155 LOGIC
    //////////////////////////////////////////////////////////////*/

    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) public virtual {
        require(msg.sender == from || isApprovedForAll[from][msg.sender], "NOT_AUTHORIZED");

        balanceOf[from][id] -= amount;
        balanceOf[to][id] += amount;

        emit TransferSingle(msg.sender, from, to, id, amount);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155Received(msg.sender, from, id, amount, data) ==
                    ERC1155TokenReceiver.onERC1155Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) public virtual {
        require(ids.length == amounts.length, "LENGTH_MISMATCH");

        require(msg.sender == from || isApprovedForAll[from][msg.sender], "NOT_AUTHORIZED");

        // Storing these outside the loop saves ~15 gas per iteration.
        uint256 id;
        uint256 amount;

        for (uint256 i = 0; i < ids.length; ) {
            id = ids[i];
            amount = amounts[i];

            balanceOf[from][id] -= amount;
            balanceOf[to][id] += amount;

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                ++i;
            }
        }

        emit TransferBatch(msg.sender, from, to, ids, amounts);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155BatchReceived(msg.sender, from, ids, amounts, data) ==
                    ERC1155TokenReceiver.onERC1155BatchReceived.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function balanceOfBatch(address[] calldata owners, uint256[] calldata ids)
        public
        view
        virtual
        returns (uint256[] memory balances)
    {
        require(owners.length == ids.length, "LENGTH_MISMATCH");

        balances = new uint256[](owners.length);

        // Unchecked because the only math done is incrementing
        // the array index counter which cannot possibly overflow.
        unchecked {
            for (uint256 i = 0; i < owners.length; ++i) {
                balances[i] = balanceOf[owners[i]][ids[i]];
            }
        }
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0xd9b67a26 || // ERC165 Interface ID for ERC1155
            interfaceId == 0x0e89341c; // ERC165 Interface ID for ERC1155MetadataURI
    }

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

    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        balanceOf[to][id] += amount;

        emit TransferSingle(msg.sender, address(0), to, id, amount);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155Received(msg.sender, address(0), id, amount, data) ==
                    ERC1155TokenReceiver.onERC1155Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _batchMint(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        uint256 idsLength = ids.length; // Saves MLOADs.

        require(idsLength == amounts.length, "LENGTH_MISMATCH");

        for (uint256 i = 0; i < idsLength; ) {
            balanceOf[to][ids[i]] += amounts[i];

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                ++i;
            }
        }

        emit TransferBatch(msg.sender, address(0), to, ids, amounts);

        require(
            to.code.length == 0
                ? to != address(0)
                : ERC1155TokenReceiver(to).onERC1155BatchReceived(msg.sender, address(0), ids, amounts, data) ==
                    ERC1155TokenReceiver.onERC1155BatchReceived.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _batchBurn(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        uint256 idsLength = ids.length; // Saves MLOADs.

        require(idsLength == amounts.length, "LENGTH_MISMATCH");

        for (uint256 i = 0; i < idsLength; ) {
            balanceOf[from][ids[i]] -= amounts[i];

            // An array can't have a total length
            // larger than the max uint256 value.
            unchecked {
                ++i;
            }
        }

        emit TransferBatch(msg.sender, from, address(0), ids, amounts);
    }

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

        emit TransferSingle(msg.sender, from, address(0), id, amount);
    }
}

/// @notice A generic interface for a contract which properly accepts ERC1155 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC1155.sol)
abstract contract ERC1155TokenReceiver {
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC1155TokenReceiver.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] calldata,
        uint256[] calldata,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC1155TokenReceiver.onERC1155BatchReceived.selector;
    }
}

File 44 of 45 : ERC20.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

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

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

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

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

    string public name;

    string public symbol;

    uint8 public immutable decimals;

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

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

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

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

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

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

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

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

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

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

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

        return true;
    }

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

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

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

        return true;
    }

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

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

        balanceOf[from] -= amount;

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

        emit Transfer(from, to, amount);

        return true;
    }

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

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

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

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

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

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

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

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

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

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

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

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

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

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

File 45 of 45 : ERC721.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

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

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

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

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

    string public name;

    string public symbol;

    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*//////////////////////////////////////////////////////////////
                      ERC721 BALANCE/OWNER STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address) internal _ownerOf;

    mapping(address => uint256) internal _balanceOf;

    function ownerOf(uint256 id) public view virtual returns (address owner) {
        require((owner = _ownerOf[id]) != address(0), "NOT_MINTED");
    }

    function balanceOf(address owner) public view virtual returns (uint256) {
        require(owner != address(0), "ZERO_ADDRESS");

        return _balanceOf[owner];
    }

    /*//////////////////////////////////////////////////////////////
                         ERC721 APPROVAL STORAGE
    //////////////////////////////////////////////////////////////*/

    mapping(uint256 => address) public getApproved;

    mapping(address => mapping(address => bool)) public isApprovedForAll;

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

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    /*//////////////////////////////////////////////////////////////
                              ERC721 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 id) public virtual {
        address owner = _ownerOf[id];

        require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED");

        getApproved[id] = spender;

        emit Approval(owner, spender, id);
    }

    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function transferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        require(from == _ownerOf[id], "WRONG_FROM");

        require(to != address(0), "INVALID_RECIPIENT");

        require(
            msg.sender == from || isApprovedForAll[from][msg.sender] || msg.sender == getApproved[id],
            "NOT_AUTHORIZED"
        );

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        unchecked {
            _balanceOf[from]--;

            _balanceOf[to]++;
        }

        _ownerOf[id] = to;

        delete getApproved[id];

        emit Transfer(from, to, id);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        bytes calldata data
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    /*//////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
            interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
    }

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

    function _mint(address to, uint256 id) internal virtual {
        require(to != address(0), "INVALID_RECIPIENT");

        require(_ownerOf[id] == address(0), "ALREADY_MINTED");

        // Counter overflow is incredibly unrealistic.
        unchecked {
            _balanceOf[to]++;
        }

        _ownerOf[id] = to;

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

    function _burn(uint256 id) internal virtual {
        address owner = _ownerOf[id];

        require(owner != address(0), "NOT_MINTED");

        // Ownership check above ensures no underflow.
        unchecked {
            _balanceOf[owner]--;
        }

        delete _ownerOf[id];

        delete getApproved[id];

        emit Transfer(owner, address(0), id);
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL SAFE MINT LOGIC
    //////////////////////////////////////////////////////////////*/

    function _safeMint(address to, uint256 id) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _safeMint(
        address to,
        uint256 id,
        bytes memory data
    ) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }
}

/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol)
abstract contract ERC721TokenReceiver {
    function onERC721Received(
        address,
        address,
        uint256,
        bytes calldata
    ) external virtual returns (bytes4) {
        return ERC721TokenReceiver.onERC721Received.selector;
    }
}

File 46 of 45 : SafeTransferLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

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

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

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

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

        require(success, "ETH_TRANSFER_FAILED");
    }

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

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

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

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

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

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

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

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

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

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"components":[{"internalType":"address","name":"permit2","type":"address"},{"internalType":"address","name":"weth9","type":"address"},{"internalType":"address","name":"seaportV1_5","type":"address"},{"internalType":"address","name":"seaportV1_4","type":"address"},{"internalType":"address","name":"openseaConduit","type":"address"},{"internalType":"address","name":"x2y2","type":"address"},{"internalType":"address","name":"looksRareV2","type":"address"},{"internalType":"address","name":"routerRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareRewardsDistributor","type":"address"},{"internalType":"address","name":"looksRareToken","type":"address"},{"internalType":"address","name":"v2Factory","type":"address"},{"internalType":"address","name":"v3Factory","type":"address"},{"internalType":"address","name":"v3Deployer","type":"address"},{"internalType":"bytes32","name":"v2InitCodeHash","type":"bytes32"},{"internalType":"bytes32","name":"v3InitCodeHash","type":"bytes32"},{"internalType":"address","name":"stableFactory","type":"address"},{"internalType":"address","name":"stableInfo","type":"address"},{"internalType":"address","name":"pancakeNFTMarket","type":"address"}],"internalType":"struct RouterParameters","name":"params","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BalanceTooLow","type":"error"},{"inputs":[],"name":"BuyPancakeNFTFailed","type":"error"},{"inputs":[],"name":"BuyPunkFailed","type":"error"},{"inputs":[],"name":"ContractLocked","type":"error"},{"inputs":[],"name":"ETHNotAccepted","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandIndex","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"ExecutionFailed","type":"error"},{"inputs":[],"name":"FromAddressIsNotOwner","type":"error"},{"inputs":[],"name":"InsufficientETH","type":"error"},{"inputs":[],"name":"InsufficientToken","type":"error"},{"inputs":[],"name":"InvalidBips","type":"error"},{"inputs":[{"internalType":"uint256","name":"commandType","type":"uint256"}],"name":"InvalidCommandType","type":"error"},{"inputs":[],"name":"InvalidOwnerERC1155","type":"error"},{"inputs":[],"name":"InvalidOwnerERC721","type":"error"},{"inputs":[],"name":"InvalidPath","type":"error"},{"inputs":[],"name":"InvalidPoolAddress","type":"error"},{"inputs":[],"name":"InvalidPoolLength","type":"error"},{"inputs":[],"name":"InvalidReserves","type":"error"},{"inputs":[],"name":"InvalidSpender","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"SliceOutOfBounds","type":"error"},{"inputs":[],"name":"StableInvalidPath","type":"error"},{"inputs":[],"name":"StableTooLittleReceived","type":"error"},{"inputs":[],"name":"StableTooMuchRequested","type":"error"},{"inputs":[],"name":"TransactionDeadlinePassed","type":"error"},{"inputs":[],"name":"UnableToClaim","type":"error"},{"inputs":[],"name":"UnsafeCast","type":"error"},{"inputs":[],"name":"V2InvalidPath","type":"error"},{"inputs":[],"name":"V2TooLittleReceived","type":"error"},{"inputs":[],"name":"V2TooMuchRequested","type":"error"},{"inputs":[],"name":"V3InvalidAmountOut","type":"error"},{"inputs":[],"name":"V3InvalidCaller","type":"error"},{"inputs":[],"name":"V3InvalidSwap","type":"error"},{"inputs":[],"name":"V3TooLittleReceived","type":"error"},{"inputs":[],"name":"V3TooMuchRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardsSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"factory","type":"address"},{"indexed":true,"internalType":"address","name":"info","type":"address"}],"name":"SetStableSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"bytes","name":"looksRareClaim","type":"bytes"}],"name":"collectRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes","name":"commands","type":"bytes"},{"internalType":"bytes[]","name":"inputs","type":"bytes[]"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"pancakeV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_info","type":"address"}],"name":"setStableSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stableSwapFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stableSwapInfo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

34620003ff576001600160401b036200454638819003610280601f8201601f191681019084821190821017620003e9576102409282916040526102803912620003ff5760405190610240820190811182821017620003e9576040526200006761028062000404565b808252620000776102a062000404565b6020830152620000896102c062000404565b60408301526200009b6102e062000404565b6060830152620000ad61030062000404565b6080830152620000bf61032062000404565b60a0830152620000d161034062000404565b60c0830152620000e361036062000404565b60e0830152620000f561038062000404565b610100830152620001086103a062000404565b6101208301526200011b6103c062000404565b6101408301526200012e6103e062000404565b6101608301526200014161040062000404565b610180830152610420516101a0830152610440516101c08301526200016861046062000404565b6101e08301819052916200017e61048062000404565b610200820181905291620001946104a062000404565b6102208381019182526001600160a01b0392831660a0908152602085015184166080908152604080870151861660c09081526060880151871660e09081529288015187166101009081529388015187166101209081529088015187166101409081529088015187166101609081529388015187166101809081529288015187166101a09081529088015187166101c0908152908801516101e052928701518616610200529186015190925293015182166102405251811661026052600019600090815560018054336001600160a01b03198216811790925593519593909216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a3600280546001600160a01b039283166001600160a01b03199182161790915560038054939092169216919091179055600480546001600160a81b031916600117905561412c90816200041a8239608051818181611c9e0152611dc4015260a0518181816111e50152818161128d01528181611b5d01528181611f860152613369015260c05181612515015260e05181612570015261010051816128f101526101205181818161261b01526126ff015261014051816125c501526101605181610410015261018051816103cb01526101a0518161047801526101c05181818161169c015281816119630152613c5701526101e05181818161167b015281816119420152613c360152610200518150506102205181818161084b01528181610ccf0152613ee201526102405181818161086c01528181610cf00152613f03015261026051818181612dd90152612e7b0152f35b634e487b7160e01b600052604160045260246000fd5b600080fd5b51906001600160a01b0382168203620003ff5756fe60c06040818152600480361015610021575b505050361561001f57600080fd5b005b600092833560e01c90816301ffc9a7146109cc57508063150b7a021461097657806323a69e751461078c57806324856bc31461070857806324dec034146106745780633593564c146105a85780633f4ba83a1461054757806357c799611461051e5780635c975abb146104f8578063709a1cc214610385578063715018a61461033a5780638456cb59146102d35780638da5cb5b146102aa578063b85aa7af14610281578063bc197c81146101f4578063f23a6e611461019b5763f2fde38b036100115734610197576020366003190112610197576100fe610a38565b90610107610ada565b6001600160a01b03918216928315610145575050600180546001600160a01b031981168417909155166000805160206140d78339815191528380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b5091346101f15760a03660031901126101f1576101b6610a38565b506101bf610a53565b50608435906001600160401b0382116101f157506020926101e291369101610a7d565b50505163f23a6e6160e01b8152f35b80fd5b5091346101f15760a03660031901126101f15761020f610a38565b50610218610a53565b506001600160401b039060443582811161027d576102399036908601610aaa565b505060643582811161027d576102529036908601610aaa565b50506084359182116101f1575060209261026e91369101610a7d565b50505163bc197c8160e01b8152f35b5080fd5b50503461027d578160031936011261027d5760035490516001600160a01b039091168152602090f35b50503461027d578160031936011261027d5760015490516001600160a01b039091168152602090f35b50346101975782600319360112610197577f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25891602091610311610ada565b610319612f5d565b610321612f5d565b805460ff60a01b1916600160a01b17905551338152a180f35b83346101f157806003193601126101f157610353610ada565b600180546001600160a01b0319811690915581906001600160a01b03166000805160206140d78339815191528280a380f35b503461019757602090816003193601126104f4578381356001600160401b03811161027d576103b8829136908501610a7d565b90818751928392833781018381520390827f00000000000000000000000000000000000000000000000000000000000000005af16103f46130ad565b50156104e65782516370a0823160e01b815230918101919091527f00000000000000000000000000000000000000000000000000000000000000009282826024816001600160a01b0388165afa9182156104dc5785926104a5575b5061049d827f1e8f03f716bc104bf7d728131967a0c771e85ab54d09c1e2d6ed9e0bc4e2a16c957f000000000000000000000000000000000000000000000000000000000000000090614065565b51908152a180f35b9391508284813d83116104d5575b6104bd8183613054565b810103126104d1579251909261049d61044f565b8480fd5b503d6104b3565b81513d87823e3d90fd5b8251637d52991960e01b8152fd5b8380fd5b5091346101f157806003193601126101f1575060ff6020925460a01c1690519015158152f35b50503461027d578160031936011261027d5760025490516001600160a01b039091168152602090f35b50346101975782600319360112610197577f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa91602091610585610ada565b61058d612fa4565b610595612fa4565b805460ff60a01b1916905551338152a180f35b50906060366003190112610197576001600160401b0382358181116104d1576105d49036908501610a7d565b91602435908111610670576105ec9036908601610aaa565b92909160443542116106605733301461064e578554946000196001600160a01b0387160161063f57506001600160a01b031994851633178655600194936106369390929091610b32565b82541617905580f35b516337affdbf60e11b81528690fd5b909192935061065d9450610b32565b80f35b8451632dfb7c8b60e11b81528690fd5b8580fd5b50503461027d573660031901126101f15761068d610a38565b610695610a53565b9061069e610ada565b6001600160a01b0390811690811515806106fd575b156104f45760018060a01b0319928284600254161760025516809260035416176003557f26e41379222b54b0470031bc11852ad23058ffb8983f7cc0e18257d6f7afca9d8380a380f35b5080831615156106b3565b509080600319360112610197576001600160401b0382358181116104d1576107339036908501610a7d565b916024359081116106705761074b9036908601610aaa565b92909133301461064e578554946000196001600160a01b0387160161063f57506001600160a01b031994851633178655600194936106369390929091610b32565b5090346101975760603660031901126101975760243591803591906001600160401b0390604435828111610972576107c79036908301610a7d565b91909287861390811580610968575b610958578385018686820312610954578535918211610954576107fa91860161313c565b506001600160a01b036020850135818116959194908690036109545761081f91613214565b959097602b89106109445786359260178460601c98019561089062ffffff883560601c9660481c16868b7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000613e0d565b33911603610934571561092a57508186105b156108b7575050505061065d93503391613427565b939594509192909190604287106108fd57505050836017116104d157600160ff1b8210156104d1576108f79360161901916108f23391613dfc565b613e9a565b50505080f35b91969550929391508454841161091b575061065d9394503391613427565b516339cedf2960e11b81528590fd5b96508582106108a2565b82516332b13d9160e01b81528590fd5b8151633b99b53d60e01b81528490fd5b8980fd5b855163316cf0eb60e01b81528390fd5b50888813156107d6565b8680fd5b5091346101f15760803660031901126101f157610991610a38565b5061099a610a53565b50606435906001600160401b0382116101f157506020926109bd91369101610a7d565b505051630a85bd0160e11b8152f35b92505034610197576020366003190112610197573563ffffffff60e01b81168091036101975760209250630271189760e51b8114908115610a27575b8115610a16575b5015158152f35b6301ffc9a760e01b14905038610a0f565b630a85bd0160e11b81149150610a08565b600435906001600160a01b0382168203610a4e57565b600080fd5b602435906001600160a01b0382168203610a4e57565b35906001600160a01b0382168203610a4e57565b9181601f84011215610a4e578235916001600160401b038311610a4e5760208381860195010111610a4e57565b9181601f84011215610a4e578235916001600160401b038311610a4e576020808501948460051b010111610a4e57565b6001546001600160a01b03163303610aee57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9291909260a052608052610b44612f5d565b818103612f085760005b828110610ba1575050504780151580610b97575b610b695750565b47908110610b855780610b795750565b610b83903361401a565b565b604051631a84bc4160e21b8152600490fd5b5030331415610b62565b818194929394101561183a5760059181831b6080510135601e199182608051360301821215610a4e57608051820135956001600160401b038711610a4e576020836080510101968036038813610a4e57606096603f90818860a051013560f81c16600197602082106000146127a957506010808210156121cb57506008808210156115ee575080610fa857505050610c399088613235565b92909860a085608051010135600014610f9e576004546001600160a01b031698610c64905b356131db565b608051909a9990860160400135858b600160ff1b8314610f17575b50959a95505b600160ff1b811015610a4e5760428610610f1157305b86602b11610a4e578b90601782013560601c9262ffffff8335958660601c96610d1460018060a01b0393849260481c16888a7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000613e0d565b169286881015610ef557826401000276a4925b602b60405198604060208b01528160608b015260808a0137600060ab89015216604087015260a086526001600160401b0360c0870190811190871117610edf5760c086016040818152630251596160e31b825295841660c488015287891060e4880152610104870191909152911661012485015260a06101448501529060bf1984610db6610164820182612f1d565b030190600060c08601915af1918215610ed3576000918293610e8e575b50610de4931015610e875750613dfc565b9860428510610e0657309085601711610a4e5760170194601619019499610c85565b5060805191995097919694930160600135119050610e75575b1580610e62575b610e335750600101610b4e565b60408051632c4029e960e01b8152600481019390935260248301528190610e5e906044830190612f1d565b0390fd5b5060a051820135600160ff1b1615610e26565b604051631ce9aa4b60e11b8152600490fd5b9050613dfc565b9250906040833d604011610ecb575b81610ead60409360c08401613054565b810103126101f1575060c082015160e0909201519190610de4610dd3565b3d9150610e9d565b6040513d6000823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b8273fffd8963efd1fc6a506488495d951d5263988d2592610d27565b8b610c9b565b601491925010610f8c576020602491604051928380926370a0823160e01b82523060048301523560601c5afa908115610ed357600091610f5a575b503880610c7f565b906020823d602011610f84575b81610f7460209383613054565b810103126101f157505138610f52565b3d9150610f67565b604051633b99b53d60e01b8152600490fd5b610c643099610c5e565b6001819c9b969c9a989794959a1460001461107057505050604092610fd584836080510101359382613235565b608051840160a0013515611064576004546001600160a01b031692606090610ffd90356131db565b6080519095010135600055600160ff1b851015610a4e57611021936108f286613dfc565b90919015611055575061103390613dfc565b0361104557506000196000555b610e1f565b51636a70124760e11b8152600490fd5b61105f9150613dfc565b611033565b6060610ffd3094610c5e565b9194929391600281036110b257505060045460805161104095509093016060810135936001600160a01b031691506110ab90604001356131db565b913561335d565b9193916003810361139757505060805181018084019390604090850312610a4e5782356001600160401b038111610a4e5782608051010192606084860312610a4e5760405194606086016001600160401b03811187821017610edf5760405260208501356001600160401b038111610a4e57850160208201809882011215610a4e5760208101359061114382613112565b926111516040519485613054565b8284526040602085019360071b830101918a8311610a4e57604001925b8284106113325750505050855261118760408501610a69565b956020860196875260606040870195013585526040846080510101359060018060401b038211610a4e5760206111c6926111cc9660805101010161313c565b5061326f565b60048054909592939192906001600160a01b03908116907f0000000000000000000000000000000000000000000000000000000000000000163b15610a4e57959394929190604051968795632a2d80d160e01b87528601526060602486015260c48501935193606060648701528451809152602060e487019501906000905b8082106112d757505090516001600160a01b03166084860152505160a48401528282036003190160448401526000938392611288929091906130dd565b0381837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af18015610ed3576112c8575b50610e1f565b6112d190612ff0565b386112c2565b825180516001600160a01b039081168952602082810151909116818a015260408083015165ffffffffffff908116918b019190915260609283015116918901919091528a98506080909701969092019160019091019061124b565b608060208584030112610a4e57602060809160405161135081613003565b61135987610a69565b8152611366838801610a69565b8382015261137660408801613129565b604082015261138760608801613129565b606082015281520193019261116e565b600495509193508482036114ae5750509091604060606113bd82866080510101356131db565b60805190950101356001600160a01b039081169335168061140d575047928310611400575050806113f0575b5050610e1f565b6113f99161401a565b38806113e9565b51631a84bc4160e21b8152fd5b9391908051936370a0823160e01b85523083860152602085602481895afa9485156114a35760009561146f575b50841061146257505081611451575b505050610e1f565b61145a92614065565b388080611449565b51630ceb95c760e31b8152fd5b90946020823d60201161149b575b8161148a60209383613054565b810103126101f1575051933861143a565b3d915061147d565b82513d6000823e3d90fd5b81036114db575061104092506114d46040606084608051010135936080510101356131db565b903561328c565b909190600681036115d7575060805101606081013590604090611500908201356131db565b92821580156115cc575b6115bc57356001600160a01b031693846115395750506110409250611532612710914761332a565b049061401a565b8151906370a0823160e01b82523090820152602081602481885afa9182156115b2575060009161157e575b506115776110409493926127109261332a565b0491614065565b906020823d6020116115aa575b8161159860209383613054565b810103126101f1575051611577611564565b3d915061158b565b513d6000823e3d90fd5b8151636f5500f360e11b81528590fd5b50612710831161150a565b8360249160405191636bb50f4f60e11b8352820152fd5b90809392509b9a959b9997969394991460001461185a57505060409161161c83836080510101359185613235565b92909460a082608051010135600014611850576004546001600160a01b03169061164690356131db565b90861561183a5761165685613406565b876001101561183a576116786116c09161167260208901613406565b90613991565b907f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006139e2565b938481611820575b50505060001986019386851161180a576001600160a01b039485906116f7906116f2908a856133f6565b613406565b16948651946370a0823160e01b91828752841693600499858b89015260249460208987818d5afa9889156117ff576000996117ca575b50916020969594939161173f93613aa9565b8751968793849283528a8301525afa9283156117bf5760009361178a575b50906060611771926080510101359261341a565b1061177d575050610e1f565b51631093d5f360e31b8152fd5b90926020823d6020116117b7575b816117a560209383613054565b810103126101f157505191606061175d565b3d9150611798565b84513d6000823e3d90fd5b90986020823d6020116117f7575b816117e560209383613054565b810103126101f157505197602061172d565b3d91506117d8565b8b513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b6118329261182d88613406565b613427565b3880846116c8565b634e487b7160e01b600052603260045260246000fd5b6116463091610c5e565b6009829593949214600014611b1857508161187792939450613235565b9060a084608051010135600014611b0e576004546001600160a01b03169261189f90356131db565b9160009360028310611afc576040808760805101013596600019850185811161180a57805b6119055750608051016060013587116118f55750821561183a5761104095856118f09261182d85613406565b613aa9565b516345585e0b60e11b8152600490fd5b976000198901975088881161180a576119256116f26119879988886133f6565b9061193d6119376116f28c8a8a6133f6565b83613991565b819a917f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006139e2565b8451630240bc6b60e21b815260049391929160608286816001600160a01b0388165afa9b8c15611af157600092839d611aba575b506001600160a01b03918216911603611aa7576001600160701b039081169a16915b9980158015611a9f575b611a8f57816119f59161332a565b9161271092838102938185041490151715611a7a5790611a149161341a565b906126f791828102928184041490151715611a655790611a339161333d565b9060018201809211611a505750611a4a9098613984565b806118c4565b601190634e487b7160e01b6000525260246000fd5b601183634e487b7160e01b6000525260246000fd5b601184634e487b7160e01b6000525260246000fd5b8551633dce448b60e11b81528490fd5b5082156119e7565b6001600160701b039a8b169a16916119dd565b909c50611adf91925060603d8111611aea575b611ad78183613054565b810190613a73565b509190919b386119bb565b503d611acd565b87513d6000823e3d90fd5b6040516320db826760e01b8152600490fd5b61189f3093610c5e565b9193600a8103611c565750608051830160e08101358101936020808601359450909291611b49919086030184613207565b11610f8c57600480546001600160a01b03947f000000000000000000000000000000000000000000000000000000000000000086169491861693853b15610a4e57604096808851998a9788976302b67b5760e41b8952880152611bab90610a69565b1660248601528088836080510101611bc290610a69565b16604486015265ffffffffffff808360805101606001611be190613129565b1660648701528260805101608001611bf890613129565b166084860152816080510160a001611c0f90610a69565b1660a48501526080510160c0013560c484015261010060e4840152611c3b9161010484019187016130dd565b03815a6000948591f19081156115b257506112c85750610e1f565b600b8103611da357505050611c756040809260805101013592356131db565b9180600160ff1b8103611d8b575050475b80611c9357505050610e1f565b6001600160a01b03907f00000000000000000000000000000000000000000000000000000000000000008216803b15610a4e578351630d0e30db60e41b815260049390600081868187875af18015611d8057611d71575b503090861603611cfc575b5050611449565b611d1f94600060209486519788958694859363a9059cbb60e01b85528401613077565b03925af19081156115b25750611d39575b80808080611cf5565b6020813d602011611d69575b81611d5260209383613054565b81010312610a4e575180151503610a4e5738611d30565b3d9150611d45565b611d7a90612ff0565b38611cea565b86513d6000823e3d90fd5b471015611c86578151631a84bc4160e21b8152600490fd5b600c8103611eda5750505090611db990356131db565b9060018060a01b03807f00000000000000000000000000000000000000000000000000000000000000001660408051936370a0823160e01b8552600430818701526024916020878481885afa9687156117bf57600097611ea6575b50608051018301358610611e985785611e34575b50505050505050610e1f565b833b15610a4e5760009186918385519687948593632e1a7d4d60e01b85528401525af19081156115b25750611e89575b503090831603611e79575b8080808080611e28565b611e829161401a565b3880611e6f565b611e9290612ff0565b38611e64565b8251631a84bc4160e21b8152fd5b90966020823d602011611ed2575b81611ec160209383613054565b810103126101f15750519583611e14565b3d9150611eb4565b600d81036120f1575082608051010191602083019360208260805101850312610a4e57356001600160401b038111610a4e57849160805101019182011215610a4e57602081013590611f2b82613112565b93604093611f3b85519687613054565b838652602086019285849560071b820101928311610a4e578501925b82841061208f575050600480548651919493506001600160a01b039250821660005b82811061204557505050807f00000000000000000000000000000000000000000000000000000000000000001692833b15610a4e578451630d58b1db60e01b81526020918101919091529451602486018190528592604484019290916000915b81831061200157505050509181600081819503925af19081156115b257506112c85750610e1f565b91938395506080602091846060600195975182815116845282868201511686850152828d820151168d85015201511660608201520195019301909187949392611fd9565b8184612051838b6133e2565b5151160361207f57600019811461206a57600101611f79565b601186634e487b7160e01b6000525260246000fd5b865163e700287760e01b81528690fd5b608060208584030112610a4e57602060809187516120ac81613003565b6120b587610a69565b81526120c2838801610a69565b838201526120d1898801610a69565b898201526120e160608801610a69565b6060820152815201930192611f57565b9294505050600e81036121b357506040918251906370a0823160e01b825260208260248160018060a01b03806004983516888301528886608051010135165afa9182156117bf5760009261217e575b5060805101606001351180159290612159575050610e1f565b516351940b3960e11b602082015290815290915061217681613039565b9038806113e9565b90916020823d6020116121ab575b8161219960209383613054565b810103126101f1575051906060612140565b3d915061218c565b60249060405190636bb50f4f60e11b82526004820152fd5b925092905060189a99949a989693988084106000146124e057505081036122b357505090604091828051916331a9108f60e11b83526020836024816004976060816080510101358983015260018060a01b03968791608051010135165afa9283156122a85760009361226b575b508190351691161491821561224e575050610e1f565b51637dbe7e8960e01b602082015290815290915061217681613039565b90926020823d6020116122a0575b8161228660209383613054565b810103126101f1575061229982916130fe565b9290612238565b3d9150612279565b85513d6000823e3d90fd5b60118103612377575050604091825190627eeac760e11b8252602082806122e96004966060866080510101359035888401613077565b038160018060a01b038886608051010135165afa9182156117bf57600092612342575b5060809081510101351191821592612325575050610e1f565b5163483a692960e01b602082015290815290915061217681613039565b90916020823d60201161236f575b8161235d60209383613054565b810103126101f157505190608061230c565b3d9150612350565b909290601281036123ed575060409061239682826080510101356131db565b92356001600160a01b031692833b15610a4e576123d793606060008094865197889586948593632142170760e11b8552608051010135903060048501613183565b03925af19081156115b257506112c85750610e1f565b601381036121b35750608051604091908101606081013590612411908401356131db565b8351627eeac760e11b81529460049390356001600160a01b031691906020878061243e87308a8401613077565b0381865afa968715611d80576000976124ab575b506080908151010135861061249b57845161246c8161301e565b60008152823b15610a4e576000946123d786928851998a9788968795637921219560e11b8752309087016131a5565b8451630ceb95c760e31b81528490fd5b90966020823d6020116124d8575b816124c660209383613054565b810103126101f1575051956080612452565b3d91506124b9565b929350939495505081146000146125445750600092509061250283928261326f565b81604051928392833781018481520391357f00000000000000000000000000000000000000000000000000000000000000005af161253e6130ad565b90610e1f565b601981036125995750600092509061255d83928261326f565b81604051928392833781018481520391357f00000000000000000000000000000000000000000000000000000000000000005af161253e6130ad565b601a81036125ee575060009250906125b283928261326f565b81604051928392833781018481520391357f00000000000000000000000000000000000000000000000000000000000000005af161253e6130ad565b601b81036126d25750600061260481928461326f565b9390604094818651928392833781018481520391357f00000000000000000000000000000000000000000000000000000000000000005af19182916126476130ad565b92612655575b505090610e1f565b608080518301908101356001600160a01b0316929061267790606001356131db565b833b15610a4e576126ac9360a060008094865197889586948593632142170760e11b8552608051010135903060048501613183565b03925af19081156115b257506126c3575b8061264d565b6126cc90612ff0565b386126bd565b601c81036121b3575060006126e881928461326f565b9390604094818651928392833781018481520391357f00000000000000000000000000000000000000000000000000000000000000005af191829161272b6130ad565b9261273857505090610e1f565b608080518301908101356001600160a01b03169061275990606001356131db565b908251906127668261301e565b60008252803b15610a4e576126ac9460008094865197889586948593637921219560e11b855260a060c083608051010135926080510101359030600487016131a5565b9499939792506020819c9b9792969c146000146128b75750505050906127da6127d28585613214565b95909461326f565b91909261280460409687519660208801986324856bc360e01b8a52602489015260648801916130dd565b93602319868603016044870152808552602081818701941b86010194846000935b83851061285a5750505050505050918161284c60009493859403601f198101835282613054565b519082305af161253e6130ad565b90919293949596601f1984820301875287358284360301811215610a4e578301602081019190356001600160401b038111610a4e578036038313610a4e576128a860209283926001956130dd565b99019701950193929190612825565b9195935093506021959195918282146000146129ac57505060408093608051010135906000906001831015612999575050612988576000907f00000000000000000000000000000000000000000000000000000000000000009260208382519363095ea7b360e01b8552600496878601526024948219868201526044968792355af13d15601f3d11600160005114161716156129565750505050610e1f565b91600e6d1054141493d59157d1905253115160921b92602060649695519562461bcd60e51b8752860152840152820152fd5b8151635461585f60e01b8152600490fd5b634e487b7160e01b825260045260249150fd5b909392915060228403612b1c576129dd93506040928381608051010135926129d48382613235565b96909382613252565b9160c084608051010135600014612b12576004546001600160a01b031690612a0590356131db565b9580151580612b04575b612ae2575b505060001984019184831161180a576001600160a01b0394612a48938690612a41906116f290848d6133f6565b169861346c565b8351936370a0823160e01b855260049130838701526020866024818a5afa9586156114a357600096612aad575b5060805101606001358510612aa05750503090821603612a9757505050610e1f565b61145a9261328c565b5163335f65f960e21b8152fd5b90956020823d602011612ada575b81612ac860209383613054565b810103126101f1575051946060612a75565b3d9150612abb565b851561183a57612afd91612af58a613406565b903091613427565b3880612a14565b50600160ff1b811415612a0f565b612a053091610c5e565b919260238103612d7f5750612b3d612b348383613235565b91909383613252565b929060c086608051010135600014612d75576004546001600160a01b031691612b6690356131db565b600280546003549296926001600160a01b03908116929116908810612d6357612b8e88613112565b91612b9c6040519384613054565b888352601f19612bab8a613112565b013660208501378860001981011161180a576080518a0160400135612bd46000198b01856133e2565b526000198901805b612c755750505080511561183a5760200151926060886080510101358411612c6357861561183a57612c1c93612c1591612af587613406565b858461346c565b306001600160a01b03831603612c36575b50505050610e1f565b6116f2612c55916040612c5a96608051010135946000198101916133f6565b61328c565b38808080612c2d565b604051635f8f4a6d60e11b8152600490fd5b600019810181811161180a57612cb489612ca16116f2858f612c9b6116f28883886133f6565b946133f6565b612cac848b8b6133f6565b35918761365d565b929190612cc185896133e2565b51604051633292f1c560e21b81526001600160a01b039095166004860152602485019290925260448401526064830152600019608483015260208260a481875afa918215610ed357600092612d2d575b5090612d21612d279392876133e2565b52613984565b80612bdc565b90916020823d602011612d5b575b81612d4860209383613054565b810103126101f157505190612d21612d11565b3d9150612d3b565b60405163288b2b3360e21b8152600490fd5b612b663092610c5e565b60249594919250858103612e5f57505060009182916040948551612dcf81612dc16020820195631f73fd2760e31b87528a8860805101013590358c8401613077565b03601f198101835282613054565b51926080510101357f00000000000000000000000000000000000000000000000000000000000000005af190612e036130ad565b928215612e11575050610e1f565b81516304c25c1360e51b60208201526004808252939450928383019291906001600160401b03841185851017612e4c575050529038806113e9565b604190634e487b7160e01b600052526000fd5b60258196949392959614600014612ef157506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116803b15610a4e5760009283606492896040978851998a97889663768a074360e11b88523516600487015289826080510101359086015260805101013560448401525af19081156115b257506112c85750610e1f565b839060405190636bb50f4f60e11b82526004820152fd5b6040516001621398b960e31b03198152600490fd5b919082519283825260005b848110612f49575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201612f28565b60ff60045460a01c16612f6c57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b60ff60045460a01c1615612fb457565b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b6001600160401b038111610edf57604052565b608081019081106001600160401b03821117610edf57604052565b602081019081106001600160401b03821117610edf57604052565b604081019081106001600160401b03821117610edf57604052565b601f909101601f19168101906001600160401b03821190821017610edf57604052565b6001600160a01b039091168152602081019190915260400190565b6001600160401b038111610edf57601f01601f191660200190565b3d156130d8573d906130be82613092565b916130cc6040519384613054565b82523d6000602084013e565b606090565b908060209392818452848401376000828201840152601f01601f1916010190565b51906001600160a01b0382168203610a4e57565b6001600160401b038111610edf5760051b60200190565b359065ffffffffffff82168203610a4e57565b81601f82011215610a4e5780359061315382613092565b926131616040519485613054565b82845260208383010111610a4e57816000926020809301838601378301015290565b6001600160a01b03918216815291166020820152604081019190915260600190565b91926131d895949160a094600180871b038092168552166020840152604083015260608201528160808201520190612f1d565b90565b6001600160a01b0390808216600181036131f85750506004541690565b9091506002036131d857503090565b9190820180921161180a57565b91823583019161322e602084359581860195030185613207565b11610f8c57565b91606083013583019161322e602084359581860195030185613207565b91608083013583019161322e602084359581860195030185613207565b91602083013583019161322e602084359581860195030185613207565b909291906001600160a01b0316806132a95750610b83919261401a565b600160ff1b82146132c0575b92610b839293614065565b6040516370a0823160e01b815230600482015293909150602084602481855afa938415610ed3576000946132f7575b5092906132b5565b6020813d8211613322575b8161330f60209383613054565b810103126104d157519350610b836132ef565b3d9150613302565b8181029291811591840414171561180a57565b8115613347570490565b634e487b7160e01b600052601260045260246000fd5b91926001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811693909290843b15610a4e5760009484869281608496816040519b8c9a8b99631b63c28b60e11b8b521660048a01521660248801521660448601521660648401525af18015610ed3576133d95750565b610b8390612ff0565b805182101561183a5760209160051b010190565b919081101561183a5760051b0190565b356001600160a01b0381168103610a4e5790565b9190820391821161180a57565b9291906001600160a01b038082163003613446575050610b839261328c565b808495941161345a57610b8394169261335d565b60405163c4bd89a960e01b8152600490fd5b92808203600019016136315760005b818110613489575050505050565b6134976116f28285886133f6565b8460016134aa6116f2828601888b6133f6565b6134cf60018060a01b03938492866134c8898b8760025416956133f6565b359261365d565b939192909516946040948551946370a0823160e01b8652600493308588015260209060249982898c81845afa98891561362657908a8c9a999897969594939260009a6135dc575b5083918a9b60009a9b8b93519163095ea7b360e01b8352888c84015282015260449a8b925af1600051909114601f3d11163d151716156135ab575016803b15610a4e57600095608494879389519a8b988997630b68372160e31b89528801528601528401528160648401525af19081156115b25750906001929161359c575b500161347b565b6135a590612ff0565b38613595565b846d1054141493d59157d1905253115160921b87600e8d6064958e519562461bcd60e51b8752860152840152820152fd5b80939597999b50848097999b939592503d831161361f575b6135fe8183613054565b810103126101f15750518a9890979096909590949093909290918a83613516565b503d6135f4565b8a513d6000823e3d90fd5b60405163f8637a3960e01b8152600490fd5b6001600160a01b0391821681529116602082015260400190565b90939192936000936000948586600289146000146137c25750505061369d9495506080604091825180978192632007bd0f60e11b83528660048401613643565b038160018060a01b038097165afa9485156137b8578695613718575b5050818060208601511691161460001461370f5760ff845b169384613707575060ff60015b16925116905b6001600160a01b038216156136f557565b60405163da6a56c360e01b8152600490fd5b60ff906136de565b60ff60016136d1565b909194506080813d82116137b0575b8161373460809383613054565b8101031261067057815191608083016001600160401b0381118482101761379c57815261378f91606091613767826130fe565b8552613775602083016130fe565b60208601526137858183016130fe565b90850152016130fe565b60608201529238806136b9565b634e487b7160e01b88526041600452602488fd5b3d9150613727565b81513d88823e3d90fd5b95949293909691976003146137db575b505050506136e4565b9092969591939450604080519663923093cb60e01b885260a088806138048c8760048401613643565b0381600180851b03809a165afa97881561397a5785986138c7575b50908591828060208b01511694168481146000146138875750508185995b169283036138575750505050925b511690388080806137d2565b870151929350909116810361387057505060019261384b565b8260608693960151160361384b576002935061384b565b909192838a01511681146000146138a557505084908160019961383d565b8660608a9b939b015116146138be575b9085809261383d565b600298506138b5565b90975060a0813d8211613972575b816138e260a09383613054565b810103126104d15781519060a082016001600160401b0381118382101761395e576080849392613951928a9652613918816130fe565b8452613926602082016130fe565b60208501526139368582016130fe565b85850152613946606082016130fe565b6060850152016130fe565b608082015297909161381f565b634e487b7160e01b87526041600452602487fd5b3d91506138d5565b82513d87823e3d90fd5b801561180a576000190190565b6001600160a01b0382811690821610156139a85791565b9091565b6001600160f81b0319815260609190911b6001600160601b03191660018201526015810191909152603581019190915260550190565b6040516001600160601b0319606094851b81166020830190815295851b16603482015260288152928301939092908185106001600160401b03861117610edf57613a4f92613a3d9186604052835190206080840195866139ac565b03607f1981018452605f190183613054565b905190206001600160a01b031690565b51906001600160701b0382168203610a4e57565b90816060910312610a4e57613a8781613a5f565b916040613a9660208401613a5f565b92015163ffffffff81168103610a4e5790565b9260028210613dea57811561183a57613ac184613406565b916001948186101561183a5791613adf602094611672868601613406565b50926000935b60001984018510613afa575050505050505050565b613b086116f28686856133f6565b92613b196116f28a880187866133f6565b60408051630240bc6b60e21b8152956001600160a01b0393841694919260049290916060808a86818b5afa998a15611d8057908d9594939291600091829c613dc4575b50509087169187168214996001600160701b0390811691168a15613dbe575b8651958680946370a0823160e01b82528b8883015260249889915afa928315611af1578e600094613d8d575b505080830391811593848015613d85575b613d7557826126f78086029586041491141715613d6157613bd9908361332a565b92612710808302928304141715613d4d57613bfe9291613bf891613207565b9061333d565b9715613d4557600097905b898b6001198201811015613d3957916116726116f2613c31936002613c7b9c9601908d6133f6565b8198917f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006139e2565b965b855190996001600160401b0393919290918e840185811185821017613d2557885260008452813b15610a4e5760008a93613ce482968b519c8d978896879563022c0d9f60e01b87528d8701528d860152166044840152608060648401526084830190612f1d565b03925af180156117bf57908d969594939291613d09575b505050505094019391613ae5565b909192938095965011612e4c5750505287903880808080613cfb565b87604188634e487b7160e01b600052526000fd5b5050508b956000613c7d565b600090613c09565b85601186634e487b7160e01b600052526000fd5b86601187634e487b7160e01b600052526000fd5b8851633dce448b60e11b81528790fd5b508115613bb8565b8181959293953d8311613db7575b613da58183613054565b810103126101f157505191388e613ba7565b503d613d9b565b90613b7b565b899c508992509081613de192903d10611aea57611ad78183613054565b509b9091613b5c565b604051632b94ab4360e21b8152600490fd5b600160ff1b811461180a5760000390565b6001600160a01b039490939085821684871611613e92575b62ffffff90866040519381602086019716875216604084015216606082015260608152608081019281841060018060401b03851117610edf57613e8b92613e7991856040528351902060a0840196876139ac565b03609f1981018352607f190182613054565b5190201690565b909290613e25565b939193602b8410610f8c578462ffffff6000613f5394613fa3613f679935988960601c9a8b9a613f27601789013560601c9d8e109c60018060a01b039e8f998a9460481c16917f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000613e0d565b16968b8614613fff576401000276a49a5b60409d8e9b8c938451968795602087015260608601916130dd565b91168b83015203601f198101835282613054565b848851998a9889978896630251596160e31b88521660048701528c6024870152604486015216606484015260a0608484015260a4830190612f1d565b03925af1908115613ff4576000938492613fbe575b50509192565b9080949250813d8311613fed575b613fd68183613054565b810103126101f15750602082519201513880613fb8565b503d613fcc565b83513d6000823e3d90fd5b73fffd8963efd1fc6a506488495d951d5263988d259a613f38565b600080809381935af11561402a57565b60405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606490fd5b600091826044926020956040519363a9059cbb60e01b8552600485015260248401525af13d15601f3d116001600051141617161561409f57565b60405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606490fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220f311f649cfb8c27a86706243073c20d528a63e9eea9af4549193c62af1c4576d64736f6c6343000811003300000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000001097053fd2ea711dad45caccc45eff7548fcb3620000000000000000000000000bfbcf9fa4f9c56b0f40a671ad40e0805a09186500000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c957224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e20000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0

Deployed Bytecode

0x60c06040818152600480361015610021575b505050361561001f57600080fd5b005b600092833560e01c90816301ffc9a7146109cc57508063150b7a021461097657806323a69e751461078c57806324856bc31461070857806324dec034146106745780633593564c146105a85780633f4ba83a1461054757806357c799611461051e5780635c975abb146104f8578063709a1cc214610385578063715018a61461033a5780638456cb59146102d35780638da5cb5b146102aa578063b85aa7af14610281578063bc197c81146101f4578063f23a6e611461019b5763f2fde38b036100115734610197576020366003190112610197576100fe610a38565b90610107610ada565b6001600160a01b03918216928315610145575050600180546001600160a01b031981168417909155166000805160206140d78339815191528380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b5091346101f15760a03660031901126101f1576101b6610a38565b506101bf610a53565b50608435906001600160401b0382116101f157506020926101e291369101610a7d565b50505163f23a6e6160e01b8152f35b80fd5b5091346101f15760a03660031901126101f15761020f610a38565b50610218610a53565b506001600160401b039060443582811161027d576102399036908601610aaa565b505060643582811161027d576102529036908601610aaa565b50506084359182116101f1575060209261026e91369101610a7d565b50505163bc197c8160e01b8152f35b5080fd5b50503461027d578160031936011261027d5760035490516001600160a01b039091168152602090f35b50503461027d578160031936011261027d5760015490516001600160a01b039091168152602090f35b50346101975782600319360112610197577f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25891602091610311610ada565b610319612f5d565b610321612f5d565b805460ff60a01b1916600160a01b17905551338152a180f35b83346101f157806003193601126101f157610353610ada565b600180546001600160a01b0319811690915581906001600160a01b03166000805160206140d78339815191528280a380f35b503461019757602090816003193601126104f4578381356001600160401b03811161027d576103b8829136908501610a7d565b90818751928392833781018381520390827f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af16103f46130ad565b50156104e65782516370a0823160e01b815230918101919091527f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b09282826024816001600160a01b0388165afa9182156104dc5785926104a5575b5061049d827f1e8f03f716bc104bf7d728131967a0c771e85ab54d09c1e2d6ed9e0bc4e2a16c957f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b090614065565b51908152a180f35b9391508284813d83116104d5575b6104bd8183613054565b810103126104d1579251909261049d61044f565b8480fd5b503d6104b3565b81513d87823e3d90fd5b8251637d52991960e01b8152fd5b8380fd5b5091346101f157806003193601126101f1575060ff6020925460a01c1690519015158152f35b50503461027d578160031936011261027d5760025490516001600160a01b039091168152602090f35b50346101975782600319360112610197577f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa91602091610585610ada565b61058d612fa4565b610595612fa4565b805460ff60a01b1916905551338152a180f35b50906060366003190112610197576001600160401b0382358181116104d1576105d49036908501610a7d565b91602435908111610670576105ec9036908601610aaa565b92909160443542116106605733301461064e578554946000196001600160a01b0387160161063f57506001600160a01b031994851633178655600194936106369390929091610b32565b82541617905580f35b516337affdbf60e11b81528690fd5b909192935061065d9450610b32565b80f35b8451632dfb7c8b60e11b81528690fd5b8580fd5b50503461027d573660031901126101f15761068d610a38565b610695610a53565b9061069e610ada565b6001600160a01b0390811690811515806106fd575b156104f45760018060a01b0319928284600254161760025516809260035416176003557f26e41379222b54b0470031bc11852ad23058ffb8983f7cc0e18257d6f7afca9d8380a380f35b5080831615156106b3565b509080600319360112610197576001600160401b0382358181116104d1576107339036908501610a7d565b916024359081116106705761074b9036908601610aaa565b92909133301461064e578554946000196001600160a01b0387160161063f57506001600160a01b031994851633178655600194936106369390929091610b32565b5090346101975760603660031901126101975760243591803591906001600160401b0390604435828111610972576107c79036908301610a7d565b91909287861390811580610968575b610958578385018686820312610954578535918211610954576107fa91860161313c565b506001600160a01b036020850135818116959194908690036109545761081f91613214565b959097602b89106109445786359260178460601c98019561089062ffffff883560601c9660481c16868b7f6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e27f00000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9613e0d565b33911603610934571561092a57508186105b156108b7575050505061065d93503391613427565b939594509192909190604287106108fd57505050836017116104d157600160ff1b8210156104d1576108f79360161901916108f23391613dfc565b613e9a565b50505080f35b91969550929391508454841161091b575061065d9394503391613427565b516339cedf2960e11b81528590fd5b96508582106108a2565b82516332b13d9160e01b81528590fd5b8151633b99b53d60e01b81528490fd5b8980fd5b855163316cf0eb60e01b81528390fd5b50888813156107d6565b8680fd5b5091346101f15760803660031901126101f157610991610a38565b5061099a610a53565b50606435906001600160401b0382116101f157506020926109bd91369101610a7d565b505051630a85bd0160e11b8152f35b92505034610197576020366003190112610197573563ffffffff60e01b81168091036101975760209250630271189760e51b8114908115610a27575b8115610a16575b5015158152f35b6301ffc9a760e01b14905038610a0f565b630a85bd0160e11b81149150610a08565b600435906001600160a01b0382168203610a4e57565b600080fd5b602435906001600160a01b0382168203610a4e57565b35906001600160a01b0382168203610a4e57565b9181601f84011215610a4e578235916001600160401b038311610a4e5760208381860195010111610a4e57565b9181601f84011215610a4e578235916001600160401b038311610a4e576020808501948460051b010111610a4e57565b6001546001600160a01b03163303610aee57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b9291909260a052608052610b44612f5d565b818103612f085760005b828110610ba1575050504780151580610b97575b610b695750565b47908110610b855780610b795750565b610b83903361401a565b565b604051631a84bc4160e21b8152600490fd5b5030331415610b62565b818194929394101561183a5760059181831b6080510135601e199182608051360301821215610a4e57608051820135956001600160401b038711610a4e576020836080510101968036038813610a4e57606096603f90818860a051013560f81c16600197602082106000146127a957506010808210156121cb57506008808210156115ee575080610fa857505050610c399088613235565b92909860a085608051010135600014610f9e576004546001600160a01b031698610c64905b356131db565b608051909a9990860160400135858b600160ff1b8314610f17575b50959a95505b600160ff1b811015610a4e5760428610610f1157305b86602b11610a4e578b90601782013560601c9262ffffff8335958660601c96610d1460018060a01b0393849260481c16888a7f6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e27f00000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9613e0d565b169286881015610ef557826401000276a4925b602b60405198604060208b01528160608b015260808a0137600060ab89015216604087015260a086526001600160401b0360c0870190811190871117610edf5760c086016040818152630251596160e31b825295841660c488015287891060e4880152610104870191909152911661012485015260a06101448501529060bf1984610db6610164820182612f1d565b030190600060c08601915af1918215610ed3576000918293610e8e575b50610de4931015610e875750613dfc565b9860428510610e0657309085601711610a4e5760170194601619019499610c85565b5060805191995097919694930160600135119050610e75575b1580610e62575b610e335750600101610b4e565b60408051632c4029e960e01b8152600481019390935260248301528190610e5e906044830190612f1d565b0390fd5b5060a051820135600160ff1b1615610e26565b604051631ce9aa4b60e11b8152600490fd5b9050613dfc565b9250906040833d604011610ecb575b81610ead60409360c08401613054565b810103126101f1575060c082015160e0909201519190610de4610dd3565b3d9150610e9d565b6040513d6000823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b8273fffd8963efd1fc6a506488495d951d5263988d2592610d27565b8b610c9b565b601491925010610f8c576020602491604051928380926370a0823160e01b82523060048301523560601c5afa908115610ed357600091610f5a575b503880610c7f565b906020823d602011610f84575b81610f7460209383613054565b810103126101f157505138610f52565b3d9150610f67565b604051633b99b53d60e01b8152600490fd5b610c643099610c5e565b6001819c9b969c9a989794959a1460001461107057505050604092610fd584836080510101359382613235565b608051840160a0013515611064576004546001600160a01b031692606090610ffd90356131db565b6080519095010135600055600160ff1b851015610a4e57611021936108f286613dfc565b90919015611055575061103390613dfc565b0361104557506000196000555b610e1f565b51636a70124760e11b8152600490fd5b61105f9150613dfc565b611033565b6060610ffd3094610c5e565b9194929391600281036110b257505060045460805161104095509093016060810135936001600160a01b031691506110ab90604001356131db565b913561335d565b9193916003810361139757505060805181018084019390604090850312610a4e5782356001600160401b038111610a4e5782608051010192606084860312610a4e5760405194606086016001600160401b03811187821017610edf5760405260208501356001600160401b038111610a4e57850160208201809882011215610a4e5760208101359061114382613112565b926111516040519485613054565b8284526040602085019360071b830101918a8311610a4e57604001925b8284106113325750505050855261118760408501610a69565b956020860196875260606040870195013585526040846080510101359060018060401b038211610a4e5760206111c6926111cc9660805101010161313c565b5061326f565b60048054909592939192906001600160a01b03908116907f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768163b15610a4e57959394929190604051968795632a2d80d160e01b87528601526060602486015260c48501935193606060648701528451809152602060e487019501906000905b8082106112d757505090516001600160a01b03166084860152505160a48401528282036003190160448401526000938392611288929091906130dd565b0381837f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c7686001600160a01b03165af18015610ed3576112c8575b50610e1f565b6112d190612ff0565b386112c2565b825180516001600160a01b039081168952602082810151909116818a015260408083015165ffffffffffff908116918b019190915260609283015116918901919091528a98506080909701969092019160019091019061124b565b608060208584030112610a4e57602060809160405161135081613003565b61135987610a69565b8152611366838801610a69565b8382015261137660408801613129565b604082015261138760608801613129565b606082015281520193019261116e565b600495509193508482036114ae5750509091604060606113bd82866080510101356131db565b60805190950101356001600160a01b039081169335168061140d575047928310611400575050806113f0575b5050610e1f565b6113f99161401a565b38806113e9565b51631a84bc4160e21b8152fd5b9391908051936370a0823160e01b85523083860152602085602481895afa9485156114a35760009561146f575b50841061146257505081611451575b505050610e1f565b61145a92614065565b388080611449565b51630ceb95c760e31b8152fd5b90946020823d60201161149b575b8161148a60209383613054565b810103126101f1575051933861143a565b3d915061147d565b82513d6000823e3d90fd5b81036114db575061104092506114d46040606084608051010135936080510101356131db565b903561328c565b909190600681036115d7575060805101606081013590604090611500908201356131db565b92821580156115cc575b6115bc57356001600160a01b031693846115395750506110409250611532612710914761332a565b049061401a565b8151906370a0823160e01b82523090820152602081602481885afa9182156115b2575060009161157e575b506115776110409493926127109261332a565b0491614065565b906020823d6020116115aa575b8161159860209383613054565b810103126101f1575051611577611564565b3d915061158b565b513d6000823e3d90fd5b8151636f5500f360e11b81528590fd5b50612710831161150a565b8360249160405191636bb50f4f60e11b8352820152fd5b90809392509b9a959b9997969394991460001461185a57505060409161161c83836080510101359185613235565b92909460a082608051010135600014611850576004546001600160a01b03169061164690356131db565b90861561183a5761165685613406565b876001101561183a576116786116c09161167260208901613406565b90613991565b907f57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d7f0000000000000000000000001097053fd2ea711dad45caccc45eff7548fcb3626139e2565b938481611820575b50505060001986019386851161180a576001600160a01b039485906116f7906116f2908a856133f6565b613406565b16948651946370a0823160e01b91828752841693600499858b89015260249460208987818d5afa9889156117ff576000996117ca575b50916020969594939161173f93613aa9565b8751968793849283528a8301525afa9283156117bf5760009361178a575b50906060611771926080510101359261341a565b1061177d575050610e1f565b51631093d5f360e31b8152fd5b90926020823d6020116117b7575b816117a560209383613054565b810103126101f157505191606061175d565b3d9150611798565b84513d6000823e3d90fd5b90986020823d6020116117f7575b816117e560209383613054565b810103126101f157505197602061172d565b3d91506117d8565b8b513d6000823e3d90fd5b634e487b7160e01b600052601160045260246000fd5b6118329261182d88613406565b613427565b3880846116c8565b634e487b7160e01b600052603260045260246000fd5b6116463091610c5e565b6009829593949214600014611b1857508161187792939450613235565b9060a084608051010135600014611b0e576004546001600160a01b03169261189f90356131db565b9160009360028310611afc576040808760805101013596600019850185811161180a57805b6119055750608051016060013587116118f55750821561183a5761104095856118f09261182d85613406565b613aa9565b516345585e0b60e11b8152600490fd5b976000198901975088881161180a576119256116f26119879988886133f6565b9061193d6119376116f28c8a8a6133f6565b83613991565b819a917f57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d7f0000000000000000000000001097053fd2ea711dad45caccc45eff7548fcb3626139e2565b8451630240bc6b60e21b815260049391929160608286816001600160a01b0388165afa9b8c15611af157600092839d611aba575b506001600160a01b03918216911603611aa7576001600160701b039081169a16915b9980158015611a9f575b611a8f57816119f59161332a565b9161271092838102938185041490151715611a7a5790611a149161341a565b906126f791828102928184041490151715611a655790611a339161333d565b9060018201809211611a505750611a4a9098613984565b806118c4565b601190634e487b7160e01b6000525260246000fd5b601183634e487b7160e01b6000525260246000fd5b601184634e487b7160e01b6000525260246000fd5b8551633dce448b60e11b81528490fd5b5082156119e7565b6001600160701b039a8b169a16916119dd565b909c50611adf91925060603d8111611aea575b611ad78183613054565b810190613a73565b509190919b386119bb565b503d611acd565b87513d6000823e3d90fd5b6040516320db826760e01b8152600490fd5b61189f3093610c5e565b9193600a8103611c565750608051830160e08101358101936020808601359450909291611b49919086030184613207565b11610f8c57600480546001600160a01b03947f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c76886169491861693853b15610a4e57604096808851998a9788976302b67b5760e41b8952880152611bab90610a69565b1660248601528088836080510101611bc290610a69565b16604486015265ffffffffffff808360805101606001611be190613129565b1660648701528260805101608001611bf890613129565b166084860152816080510160a001611c0f90610a69565b1660a48501526080510160c0013560c484015261010060e4840152611c3b9161010484019187016130dd565b03815a6000948591f19081156115b257506112c85750610e1f565b600b8103611da357505050611c756040809260805101013592356131db565b9180600160ff1b8103611d8b575050475b80611c9357505050610e1f565b6001600160a01b03907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28216803b15610a4e578351630d0e30db60e41b815260049390600081868187875af18015611d8057611d71575b503090861603611cfc575b5050611449565b611d1f94600060209486519788958694859363a9059cbb60e01b85528401613077565b03925af19081156115b25750611d39575b80808080611cf5565b6020813d602011611d69575b81611d5260209383613054565b81010312610a4e575180151503610a4e5738611d30565b3d9150611d45565b611d7a90612ff0565b38611cea565b86513d6000823e3d90fd5b471015611c86578151631a84bc4160e21b8152600490fd5b600c8103611eda5750505090611db990356131db565b9060018060a01b03807f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21660408051936370a0823160e01b8552600430818701526024916020878481885afa9687156117bf57600097611ea6575b50608051018301358610611e985785611e34575b50505050505050610e1f565b833b15610a4e5760009186918385519687948593632e1a7d4d60e01b85528401525af19081156115b25750611e89575b503090831603611e79575b8080808080611e28565b611e829161401a565b3880611e6f565b611e9290612ff0565b38611e64565b8251631a84bc4160e21b8152fd5b90966020823d602011611ed2575b81611ec160209383613054565b810103126101f15750519583611e14565b3d9150611eb4565b600d81036120f1575082608051010191602083019360208260805101850312610a4e57356001600160401b038111610a4e57849160805101019182011215610a4e57602081013590611f2b82613112565b93604093611f3b85519687613054565b838652602086019285849560071b820101928311610a4e578501925b82841061208f575050600480548651919493506001600160a01b039250821660005b82811061204557505050807f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c7681692833b15610a4e578451630d58b1db60e01b81526020918101919091529451602486018190528592604484019290916000915b81831061200157505050509181600081819503925af19081156115b257506112c85750610e1f565b91938395506080602091846060600195975182815116845282868201511686850152828d820151168d85015201511660608201520195019301909187949392611fd9565b8184612051838b6133e2565b5151160361207f57600019811461206a57600101611f79565b601186634e487b7160e01b6000525260246000fd5b865163e700287760e01b81528690fd5b608060208584030112610a4e57602060809187516120ac81613003565b6120b587610a69565b81526120c2838801610a69565b838201526120d1898801610a69565b898201526120e160608801610a69565b6060820152815201930192611f57565b9294505050600e81036121b357506040918251906370a0823160e01b825260208260248160018060a01b03806004983516888301528886608051010135165afa9182156117bf5760009261217e575b5060805101606001351180159290612159575050610e1f565b516351940b3960e11b602082015290815290915061217681613039565b9038806113e9565b90916020823d6020116121ab575b8161219960209383613054565b810103126101f1575051906060612140565b3d915061218c565b60249060405190636bb50f4f60e11b82526004820152fd5b925092905060189a99949a989693988084106000146124e057505081036122b357505090604091828051916331a9108f60e11b83526020836024816004976060816080510101358983015260018060a01b03968791608051010135165afa9283156122a85760009361226b575b508190351691161491821561224e575050610e1f565b51637dbe7e8960e01b602082015290815290915061217681613039565b90926020823d6020116122a0575b8161228660209383613054565b810103126101f1575061229982916130fe565b9290612238565b3d9150612279565b85513d6000823e3d90fd5b60118103612377575050604091825190627eeac760e11b8252602082806122e96004966060866080510101359035888401613077565b038160018060a01b038886608051010135165afa9182156117bf57600092612342575b5060809081510101351191821592612325575050610e1f565b5163483a692960e01b602082015290815290915061217681613039565b90916020823d60201161236f575b8161235d60209383613054565b810103126101f157505190608061230c565b3d9150612350565b909290601281036123ed575060409061239682826080510101356131db565b92356001600160a01b031692833b15610a4e576123d793606060008094865197889586948593632142170760e11b8552608051010135903060048501613183565b03925af19081156115b257506112c85750610e1f565b601381036121b35750608051604091908101606081013590612411908401356131db565b8351627eeac760e11b81529460049390356001600160a01b031691906020878061243e87308a8401613077565b0381865afa968715611d80576000976124ab575b506080908151010135861061249b57845161246c8161301e565b60008152823b15610a4e576000946123d786928851998a9788968795637921219560e11b8752309087016131a5565b8451630ceb95c760e31b81528490fd5b90966020823d6020116124d8575b816124c660209383613054565b810103126101f1575051956080612452565b3d91506124b9565b929350939495505081146000146125445750600092509061250283928261326f565b81604051928392833781018481520391357f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af161253e6130ad565b90610e1f565b601981036125995750600092509061255d83928261326f565b81604051928392833781018481520391357f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af161253e6130ad565b601a81036125ee575060009250906125b283928261326f565b81604051928392833781018481520391357f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af161253e6130ad565b601b81036126d25750600061260481928461326f565b9390604094818651928392833781018481520391357f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af19182916126476130ad565b92612655575b505090610e1f565b608080518301908101356001600160a01b0316929061267790606001356131db565b833b15610a4e576126ac9360a060008094865197889586948593632142170760e11b8552608051010135903060048501613183565b03925af19081156115b257506126c3575b8061264d565b6126cc90612ff0565b386126bd565b601c81036121b3575060006126e881928461326f565b9390604094818651928392833781018481520391357f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af191829161272b6130ad565b9261273857505090610e1f565b608080518301908101356001600160a01b03169061275990606001356131db565b908251906127668261301e565b60008252803b15610a4e576126ac9460008094865197889586948593637921219560e11b855260a060c083608051010135926080510101359030600487016131a5565b9499939792506020819c9b9792969c146000146128b75750505050906127da6127d28585613214565b95909461326f565b91909261280460409687519660208801986324856bc360e01b8a52602489015260648801916130dd565b93602319868603016044870152808552602081818701941b86010194846000935b83851061285a5750505050505050918161284c60009493859403601f198101835282613054565b519082305af161253e6130ad565b90919293949596601f1984820301875287358284360301811215610a4e578301602081019190356001600160401b038111610a4e578036038313610a4e576128a860209283926001956130dd565b99019701950193929190612825565b9195935093506021959195918282146000146129ac57505060408093608051010135906000906001831015612999575050612988576000907f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b09260208382519363095ea7b360e01b8552600496878601526024948219868201526044968792355af13d15601f3d11600160005114161716156129565750505050610e1f565b91600e6d1054141493d59157d1905253115160921b92602060649695519562461bcd60e51b8752860152840152820152fd5b8151635461585f60e01b8152600490fd5b634e487b7160e01b825260045260249150fd5b909392915060228403612b1c576129dd93506040928381608051010135926129d48382613235565b96909382613252565b9160c084608051010135600014612b12576004546001600160a01b031690612a0590356131db565b9580151580612b04575b612ae2575b505060001984019184831161180a576001600160a01b0394612a48938690612a41906116f290848d6133f6565b169861346c565b8351936370a0823160e01b855260049130838701526020866024818a5afa9586156114a357600096612aad575b5060805101606001358510612aa05750503090821603612a9757505050610e1f565b61145a9261328c565b5163335f65f960e21b8152fd5b90956020823d602011612ada575b81612ac860209383613054565b810103126101f1575051946060612a75565b3d9150612abb565b851561183a57612afd91612af58a613406565b903091613427565b3880612a14565b50600160ff1b811415612a0f565b612a053091610c5e565b919260238103612d7f5750612b3d612b348383613235565b91909383613252565b929060c086608051010135600014612d75576004546001600160a01b031691612b6690356131db565b600280546003549296926001600160a01b03908116929116908810612d6357612b8e88613112565b91612b9c6040519384613054565b888352601f19612bab8a613112565b013660208501378860001981011161180a576080518a0160400135612bd46000198b01856133e2565b526000198901805b612c755750505080511561183a5760200151926060886080510101358411612c6357861561183a57612c1c93612c1591612af587613406565b858461346c565b306001600160a01b03831603612c36575b50505050610e1f565b6116f2612c55916040612c5a96608051010135946000198101916133f6565b61328c565b38808080612c2d565b604051635f8f4a6d60e11b8152600490fd5b600019810181811161180a57612cb489612ca16116f2858f612c9b6116f28883886133f6565b946133f6565b612cac848b8b6133f6565b35918761365d565b929190612cc185896133e2565b51604051633292f1c560e21b81526001600160a01b039095166004860152602485019290925260448401526064830152600019608483015260208260a481875afa918215610ed357600092612d2d575b5090612d21612d279392876133e2565b52613984565b80612bdc565b90916020823d602011612d5b575b81612d4860209383613054565b810103126101f157505190612d21612d11565b3d9150612d3b565b60405163288b2b3360e21b8152600490fd5b612b663092610c5e565b60249594919250858103612e5f57505060009182916040948551612dcf81612dc16020820195631f73fd2760e31b87528a8860805101013590358c8401613077565b03601f198101835282613054565b51926080510101357f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b05af190612e036130ad565b928215612e11575050610e1f565b81516304c25c1360e51b60208201526004808252939450928383019291906001600160401b03841185851017612e4c575050529038806113e9565b604190634e487b7160e01b600052526000fd5b60258196949392959614600014612ef157506001600160a01b037f0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b08116803b15610a4e5760009283606492896040978851998a97889663768a074360e11b88523516600487015289826080510101359086015260805101013560448401525af19081156115b257506112c85750610e1f565b839060405190636bb50f4f60e11b82526004820152fd5b6040516001621398b960e31b03198152600490fd5b919082519283825260005b848110612f49575050826000602080949584010152601f8019910116010190565b602081830181015184830182015201612f28565b60ff60045460a01c16612f6c57565b60405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606490fd5b60ff60045460a01c1615612fb457565b60405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606490fd5b6001600160401b038111610edf57604052565b608081019081106001600160401b03821117610edf57604052565b602081019081106001600160401b03821117610edf57604052565b604081019081106001600160401b03821117610edf57604052565b601f909101601f19168101906001600160401b03821190821017610edf57604052565b6001600160a01b039091168152602081019190915260400190565b6001600160401b038111610edf57601f01601f191660200190565b3d156130d8573d906130be82613092565b916130cc6040519384613054565b82523d6000602084013e565b606090565b908060209392818452848401376000828201840152601f01601f1916010190565b51906001600160a01b0382168203610a4e57565b6001600160401b038111610edf5760051b60200190565b359065ffffffffffff82168203610a4e57565b81601f82011215610a4e5780359061315382613092565b926131616040519485613054565b82845260208383010111610a4e57816000926020809301838601378301015290565b6001600160a01b03918216815291166020820152604081019190915260600190565b91926131d895949160a094600180871b038092168552166020840152604083015260608201528160808201520190612f1d565b90565b6001600160a01b0390808216600181036131f85750506004541690565b9091506002036131d857503090565b9190820180921161180a57565b91823583019161322e602084359581860195030185613207565b11610f8c57565b91606083013583019161322e602084359581860195030185613207565b91608083013583019161322e602084359581860195030185613207565b91602083013583019161322e602084359581860195030185613207565b909291906001600160a01b0316806132a95750610b83919261401a565b600160ff1b82146132c0575b92610b839293614065565b6040516370a0823160e01b815230600482015293909150602084602481855afa938415610ed3576000946132f7575b5092906132b5565b6020813d8211613322575b8161330f60209383613054565b810103126104d157519350610b836132ef565b3d9150613302565b8181029291811591840414171561180a57565b8115613347570490565b634e487b7160e01b600052601260045260246000fd5b91926001600160a01b037f00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768811693909290843b15610a4e5760009484869281608496816040519b8c9a8b99631b63c28b60e11b8b521660048a01521660248801521660448601521660648401525af18015610ed3576133d95750565b610b8390612ff0565b805182101561183a5760209160051b010190565b919081101561183a5760051b0190565b356001600160a01b0381168103610a4e5790565b9190820391821161180a57565b9291906001600160a01b038082163003613446575050610b839261328c565b808495941161345a57610b8394169261335d565b60405163c4bd89a960e01b8152600490fd5b92808203600019016136315760005b818110613489575050505050565b6134976116f28285886133f6565b8460016134aa6116f2828601888b6133f6565b6134cf60018060a01b03938492866134c8898b8760025416956133f6565b359261365d565b939192909516946040948551946370a0823160e01b8652600493308588015260209060249982898c81845afa98891561362657908a8c9a999897969594939260009a6135dc575b5083918a9b60009a9b8b93519163095ea7b360e01b8352888c84015282015260449a8b925af1600051909114601f3d11163d151716156135ab575016803b15610a4e57600095608494879389519a8b988997630b68372160e31b89528801528601528401528160648401525af19081156115b25750906001929161359c575b500161347b565b6135a590612ff0565b38613595565b846d1054141493d59157d1905253115160921b87600e8d6064958e519562461bcd60e51b8752860152840152820152fd5b80939597999b50848097999b939592503d831161361f575b6135fe8183613054565b810103126101f15750518a9890979096909590949093909290918a83613516565b503d6135f4565b8a513d6000823e3d90fd5b60405163f8637a3960e01b8152600490fd5b6001600160a01b0391821681529116602082015260400190565b90939192936000936000948586600289146000146137c25750505061369d9495506080604091825180978192632007bd0f60e11b83528660048401613643565b038160018060a01b038097165afa9485156137b8578695613718575b5050818060208601511691161460001461370f5760ff845b169384613707575060ff60015b16925116905b6001600160a01b038216156136f557565b60405163da6a56c360e01b8152600490fd5b60ff906136de565b60ff60016136d1565b909194506080813d82116137b0575b8161373460809383613054565b8101031261067057815191608083016001600160401b0381118482101761379c57815261378f91606091613767826130fe565b8552613775602083016130fe565b60208601526137858183016130fe565b90850152016130fe565b60608201529238806136b9565b634e487b7160e01b88526041600452602488fd5b3d9150613727565b81513d88823e3d90fd5b95949293909691976003146137db575b505050506136e4565b9092969591939450604080519663923093cb60e01b885260a088806138048c8760048401613643565b0381600180851b03809a165afa97881561397a5785986138c7575b50908591828060208b01511694168481146000146138875750508185995b169283036138575750505050925b511690388080806137d2565b870151929350909116810361387057505060019261384b565b8260608693960151160361384b576002935061384b565b909192838a01511681146000146138a557505084908160019961383d565b8660608a9b939b015116146138be575b9085809261383d565b600298506138b5565b90975060a0813d8211613972575b816138e260a09383613054565b810103126104d15781519060a082016001600160401b0381118382101761395e576080849392613951928a9652613918816130fe565b8452613926602082016130fe565b60208501526139368582016130fe565b85850152613946606082016130fe565b6060850152016130fe565b608082015297909161381f565b634e487b7160e01b87526041600452602487fd5b3d91506138d5565b82513d87823e3d90fd5b801561180a576000190190565b6001600160a01b0382811690821610156139a85791565b9091565b6001600160f81b0319815260609190911b6001600160601b03191660018201526015810191909152603581019190915260550190565b6040516001600160601b0319606094851b81166020830190815295851b16603482015260288152928301939092908185106001600160401b03861117610edf57613a4f92613a3d9186604052835190206080840195866139ac565b03607f1981018452605f190183613054565b905190206001600160a01b031690565b51906001600160701b0382168203610a4e57565b90816060910312610a4e57613a8781613a5f565b916040613a9660208401613a5f565b92015163ffffffff81168103610a4e5790565b9260028210613dea57811561183a57613ac184613406565b916001948186101561183a5791613adf602094611672868601613406565b50926000935b60001984018510613afa575050505050505050565b613b086116f28686856133f6565b92613b196116f28a880187866133f6565b60408051630240bc6b60e21b8152956001600160a01b0393841694919260049290916060808a86818b5afa998a15611d8057908d9594939291600091829c613dc4575b50509087169187168214996001600160701b0390811691168a15613dbe575b8651958680946370a0823160e01b82528b8883015260249889915afa928315611af1578e600094613d8d575b505080830391811593848015613d85575b613d7557826126f78086029586041491141715613d6157613bd9908361332a565b92612710808302928304141715613d4d57613bfe9291613bf891613207565b9061333d565b9715613d4557600097905b898b6001198201811015613d3957916116726116f2613c31936002613c7b9c9601908d6133f6565b8198917f57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d7f0000000000000000000000001097053fd2ea711dad45caccc45eff7548fcb3626139e2565b965b855190996001600160401b0393919290918e840185811185821017613d2557885260008452813b15610a4e5760008a93613ce482968b519c8d978896879563022c0d9f60e01b87528d8701528d860152166044840152608060648401526084830190612f1d565b03925af180156117bf57908d969594939291613d09575b505050505094019391613ae5565b909192938095965011612e4c5750505287903880808080613cfb565b87604188634e487b7160e01b600052526000fd5b5050508b956000613c7d565b600090613c09565b85601186634e487b7160e01b600052526000fd5b86601187634e487b7160e01b600052526000fd5b8851633dce448b60e11b81528790fd5b508115613bb8565b8181959293953d8311613db7575b613da58183613054565b810103126101f157505191388e613ba7565b503d613d9b565b90613b7b565b899c508992509081613de192903d10611aea57611ad78183613054565b509b9091613b5c565b604051632b94ab4360e21b8152600490fd5b600160ff1b811461180a5760000390565b6001600160a01b039490939085821684871611613e92575b62ffffff90866040519381602086019716875216604084015216606082015260608152608081019281841060018060401b03851117610edf57613e8b92613e7991856040528351902060a0840196876139ac565b03609f1981018352607f190182613054565b5190201690565b909290613e25565b939193602b8410610f8c578462ffffff6000613f5394613fa3613f679935988960601c9a8b9a613f27601789013560601c9d8e109c60018060a01b039e8f998a9460481c16917f6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e27f00000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9613e0d565b16968b8614613fff576401000276a49a5b60409d8e9b8c938451968795602087015260608601916130dd565b91168b83015203601f198101835282613054565b848851998a9889978896630251596160e31b88521660048701528c6024870152604486015216606484015260a0608484015260a4830190612f1d565b03925af1908115613ff4576000938492613fbe575b50509192565b9080949250813d8311613fed575b613fd68183613054565b810103126101f15750602082519201513880613fb8565b503d613fcc565b83513d6000823e3d90fd5b73fffd8963efd1fc6a506488495d951d5263988d259a613f38565b600080809381935af11561402a57565b60405162461bcd60e51b815260206004820152601360248201527211551217d514905394d1915497d19052531151606a1b6044820152606490fd5b600091826044926020956040519363a9059cbb60e01b8552600485015260248401525af13d15601f3d116001600051141617161561409f57565b60405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606490fdfe8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0a2646970667358221220f311f649cfb8c27a86706243073c20d528a63e9eea9af4549193c62af1c4576d64736f6c63430008110033

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

00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000001097053fd2ea711dad45caccc45eff7548fcb3620000000000000000000000000bfbcf9fa4f9c56b0f40a671ad40e0805a09186500000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c957224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e20000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b00000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0

-----Decoded View---------------
Arg [0] : params (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]

-----Encoded View---------------
18 Constructor Arguments found :
Arg [0] : 00000000000000000000000031c2f6fcff4f8759b3bd5bf0e1084a055615c768
Arg [1] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [2] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [3] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [4] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [5] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [6] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [7] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [8] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [9] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [10] : 0000000000000000000000001097053fd2ea711dad45caccc45eff7548fcb362
Arg [11] : 0000000000000000000000000bfbcf9fa4f9c56b0f40a671ad40e0805a091865
Arg [12] : 00000000000000000000000041ff9aa7e16b8b1a8a8dc4f0efacd93d02d071c9
Arg [13] : 57224589c67f3f30a6b0d7a1b54cf3153ab84563bc609ef41dfb34f8b2974d2d
Arg [14] : 6ce8eb472fa82df5469c6ab6d485f17c3ad13c8cd7af59b3d4a8026c5ce0f7e2
Arg [15] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [16] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0
Arg [17] : 0000000000000000000000005c19add791a23c55be09fab1db73bfd5fa80c2b0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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