false
true
0

Contract Address Details

0xcf9D70A22aC8d4B98B29F611fDfcfB3ced4Fc5D1

Contract Name
HexToysMultipleFixed
Creator
0xc204cc–a82380 at 0x707c29–3b866c
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
25901235
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
HexToysMultipleFixed




Optimization enabled
true
Compiler version
v0.8.17+commit.8df45f5f




Optimization runs
200
EVM Version
default




Verified at
2023-06-28T16:05:42.318181Z

contracts/marketplace/HexToysMultipleFixed.sol

// Multiple Fixed Price Marketplace contract
// SPDX-License-Identifier: MIT 
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface IMultipleNFT {
	function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
	function balanceOf(address account, uint256 id) external view returns (uint256);	
}

contract HexToysMultipleFixed is OwnableUpgradeable, ERC1155HolderUpgradeable {
    using SafeMath for uint256;
	using EnumerableSet for EnumerableSet.AddressSet;

	uint256 constant public PERCENTS_DIVIDER = 1000;
	uint256 public swapFee; 
	address public feeAddress; 	

    /* Pairs to swap NFT _id => price */
	struct Pair {
		uint256 pairId;
		address collection;
		uint256 tokenId;		
		address owner;
		address tokenAdr;
		uint256 balance;
		uint256 price;		
		bool bValid;
	}
    
	mapping(uint256 => Pair) public pairs;
	uint256 public currentPairId;

	/** Events */
    event MultiItemListed(Pair item);
	event MultiItemDelisted(address collection, uint256 tokenId, uint256 pairId);
    event MultiItemSwapped(address buyer, uint256 id, uint256 amount, Pair item);	

	function initialize(
        address _feeAddress
    ) public initializer {
        __Ownable_init();
        require(_feeAddress != address(0), "Invalid commonOwner");
        feeAddress = _feeAddress;
		swapFee = 21; // 21%	
		currentPairId = 0;
    }	

	function setFeePercent(uint256 _swapFee) external onlyOwner {		
		require(_swapFee < 100 , "invalid percent");
        swapFee = _swapFee;
    }
	function setFeeAddress(address _address) external onlyOwner {
		require(_address != address(0x0), "invalid address");
        feeAddress = _address;
    }

    function multipleList(address _collection, uint256 _tokenId, address _tokenAdr, uint256 _amount, uint256 _price) public {
		require(_price > 0, "invalid price");
		require(_amount > 0, "invalid amount");
		IMultipleNFT nft = IMultipleNFT(_collection);
        uint256 nft_token_balance = nft.balanceOf(msg.sender, _tokenId);
		require(nft_token_balance >= _amount, "invalid amount : amount have to be smaller than NFT balance");
		
		nft.safeTransferFrom(msg.sender, address(this), _tokenId, _amount, "List");

		currentPairId = currentPairId.add(2);
		pairs[currentPairId].pairId = currentPairId;
		pairs[currentPairId].collection = _collection;
		pairs[currentPairId].tokenId = _tokenId;		
		pairs[currentPairId].owner = msg.sender;
		pairs[currentPairId].tokenAdr = _tokenAdr;
		pairs[currentPairId].balance = _amount;
		pairs[currentPairId].price = _price;		
		pairs[currentPairId].bValid = true;

        emit MultiItemListed(pairs[currentPairId]);
    }

	function multipleDelist(uint256 _id) external {
		require(pairs[_id].bValid, "invalid Pair id");
		require(pairs[_id].owner == msg.sender || msg.sender == owner(), "only owner can delist");

		IMultipleNFT(pairs[_id].collection).safeTransferFrom(address(this), pairs[_id].owner, pairs[_id].tokenId, pairs[_id].balance, "delist Marketplace");
		pairs[_id].balance = 0;
		pairs[_id].bValid = false;

		emit MultiItemDelisted(pairs[_id].collection, pairs[_id].tokenId, _id);
	}

    function multipleBuy(uint256 _id, uint256 _amount) external payable {
        require(pairs[_id].bValid, "invalid Pair id");
		require(pairs[_id].balance >= _amount, "insufficient NFT balance");

		Pair memory item = pairs[_id];
		uint256 tokenAmount = item.price.mul(_amount);
		uint256 feeAmount = tokenAmount.mul(swapFee).div(PERCENTS_DIVIDER);		
		uint256 ownerAmount = tokenAmount.sub(feeAmount);

		if (pairs[_id].tokenAdr == address(0x0)) {
            require(msg.value >= tokenAmount, "too small amount");

			if(swapFee > 0) {
				(bool result, ) = payable(feeAddress).call{value: feeAmount}("");
        		require(result, "Failed to fee to feeAddress");
			}
			(bool result1, ) = payable(item.owner).call{value: ownerAmount}("");
        	require(result1, "Failed to send coin to nft owner");					
        } else {
            IERC20 governanceToken = IERC20(pairs[_id].tokenAdr);	

			require(governanceToken.transferFrom(msg.sender, address(this), tokenAmount), "insufficient token balance");		
			// transfer governance token to admin
			if(swapFee > 0) {
				require(governanceToken.transfer(feeAddress, feeAmount));		
			}
			
			// transfer governance token to owner		
			require(governanceToken.transfer(item.owner, ownerAmount));			
        }
		
		// transfer NFT token to buyer
		IMultipleNFT(pairs[_id].collection).safeTransferFrom(address(this), msg.sender, item.tokenId, _amount, "buy from Marketplace");

		pairs[_id].balance = pairs[_id].balance.sub(_amount);
		if (pairs[_id].balance == 0) {
			pairs[_id].bValid = false;
		}		
        emit MultiItemSwapped(msg.sender, _id, _amount, pairs[_id]);
    }

}
        

@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

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

pragma solidity ^0.8.2;

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

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

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

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

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

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

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

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}
          

@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155ReceiverUpgradeable.sol

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

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155ReceiverUpgradeable is IERC165Upgradeable {
    /**
     * @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);
}
          

@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155HolderUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)

pragma solidity ^0.8.0;

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

/**
 * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
 *
 * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
 * stuck.
 *
 * @dev _Available since v3.1._
 */
contract ERC1155HolderUpgradeable is Initializable, ERC1155ReceiverUpgradeable {
    function __ERC1155Holder_init() internal onlyInitializing {
    }

    function __ERC1155Holder_init_unchained() internal onlyInitializing {
    }
    function onERC1155Received(
        address,
        address,
        uint256,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155Received.selector;
    }

    function onERC1155BatchReceived(
        address,
        address,
        uint256[] memory,
        uint256[] memory,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC1155BatchReceived.selector;
    }

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

@openzeppelin/contracts-upgradeable/token/ERC1155/utils/ERC1155ReceiverUpgradeable.sol

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

pragma solidity ^0.8.0;

import "../IERC1155ReceiverUpgradeable.sol";
import "../../../utils/introspection/ERC165Upgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev _Available since v3.1._
 */
abstract contract ERC1155ReceiverUpgradeable is Initializable, ERC165Upgradeable, IERC1155ReceiverUpgradeable {
    function __ERC1155Receiver_init() internal onlyInitializing {
    }

    function __ERC1155Receiver_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return interfaceId == type(IERC1155ReceiverUpgradeable).interfaceId || super.supportsInterface(interfaceId);
    }

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

@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol

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

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

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

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

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

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

@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol

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

pragma solidity ^0.8.0;

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

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

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

@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.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 IERC165Upgradeable {
    /**
     * @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);
}
          

@openzeppelin/contracts/token/ERC20/IERC20.sol

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

@openzeppelin/contracts/utils/math/SafeMath.sol

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

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

@openzeppelin/contracts/utils/structs/EnumerableSet.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

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

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

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

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

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        bytes32[] memory store = _values(set._inner);
        bytes32[] memory result;

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

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

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

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

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

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

        return result;
    }
}
          

Compiler Settings

{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
              

Contract ABI

[{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"PERCENTS_DIVIDER","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"currentPairId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_feeAddress","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"multipleBuy","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"},{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"multipleDelist","inputs":[{"type":"uint256","name":"_id","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"multipleList","inputs":[{"type":"address","name":"_collection","internalType":"address"},{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"address","name":"_tokenAdr","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"},{"type":"uint256","name":"_price","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC1155BatchReceived","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"uint256[]","name":"","internalType":"uint256[]"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC1155Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"pairId","internalType":"uint256"},{"type":"address","name":"collection","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"tokenAdr","internalType":"address"},{"type":"uint256","name":"balance","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"bValid","internalType":"bool"}],"name":"pairs","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeAddress","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeePercent","inputs":[{"type":"uint256","name":"_swapFee","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"swapFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","indexed":false}],"anonymous":false},{"type":"event","name":"MultiItemDelisted","inputs":[{"type":"address","name":"collection","indexed":false},{"type":"uint256","name":"tokenId","indexed":false},{"type":"uint256","name":"pairId","indexed":false}],"anonymous":false},{"type":"event","name":"MultiItemListed","inputs":[{"type":"tuple","name":"item","indexed":false,"components":[{"type":"uint256"},{"type":"address"},{"type":"uint256"},{"type":"address"},{"type":"address"},{"type":"uint256"},{"type":"uint256"},{"type":"bool"}]}],"anonymous":false},{"type":"event","name":"MultiItemSwapped","inputs":[{"type":"address","name":"buyer","indexed":false},{"type":"uint256","name":"id","indexed":false},{"type":"uint256","name":"amount","indexed":false},{"type":"tuple","name":"item","indexed":false,"components":[{"type":"uint256"},{"type":"address"},{"type":"uint256"},{"type":"address"},{"type":"address"},{"type":"uint256"},{"type":"uint256"},{"type":"bool"}]}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5061189a806100206000396000f3fe6080604052600436106100fe5760003560e01c80638705fcd411610095578063c4d66de811610064578063c4d66de81461034a578063d50d39371461036a578063f10ffd3c1461038a578063f23a6e611461039d578063f2fde38b146103c957600080fd5b80638705fcd4146102175780638da5cb5b14610237578063b91ac78814610255578063bc197c811461031157600080fd5b806354cf2aeb116100d157806354cf2aeb146101aa578063715018a6146101c0578063766c53e2146101d75780637ce3489b146101f757600080fd5b806301c234a81461010357806301ffc9a71461012c578063372749941461015c5780634127535814610172575b600080fd5b34801561010f57600080fd5b506101196103e881565b6040519081526020015b60405180910390f35b34801561013857600080fd5b5061014c61014736600461139f565b6103e9565b6040519015158152602001610123565b34801561016857600080fd5b5061011960fe5481565b34801561017e57600080fd5b5060fc54610192906001600160a01b031681565b6040516001600160a01b039091168152602001610123565b3480156101b657600080fd5b5061011960fb5481565b3480156101cc57600080fd5b506101d5610420565b005b3480156101e357600080fd5b506101d56101f23660046113e5565b610434565b34801561020357600080fd5b506101d5610212366004611433565b610723565b34801561022357600080fd5b506101d561023236600461144c565b610772565b34801561024357600080fd5b506033546001600160a01b0316610192565b34801561026157600080fd5b506102c5610270366004611433565b60fd602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015495966001600160a01b03958616969495938416949290931692909160ff1688565b604080519889526001600160a01b0397881660208a015288019590955292851660608701529316608085015260a084019290925260c0830191909152151560e082015261010001610123565b34801561031d57600080fd5b5061033161032c36600461159e565b6107e4565b6040516001600160e01b03199091168152602001610123565b34801561035657600080fd5b506101d561036536600461144c565b6107f6565b34801561037657600080fd5b506101d5610385366004611433565b610979565b6101d5610398366004611648565b610b77565b3480156103a957600080fd5b506103316103b836600461166a565b63f23a6e6160e01b95945050505050565b3480156103d557600080fd5b506101d56103e436600461144c565b6111e4565b60006001600160e01b03198216630271189760e51b148061041a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61042861125d565b61043260006112b7565b565b600081116104795760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b60448201526064015b60405180910390fd5b600082116104ba5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b6044820152606401610470565b604051627eeac760e11b81523360048201526024810185905285906000906001600160a01b0383169062fdd58e90604401602060405180830381865afa158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c91906116cf565b9050838110156105a45760405162461bcd60e51b815260206004820152603b60248201527f696e76616c696420616d6f756e74203a20616d6f756e74206861766520746f2060448201527f626520736d616c6c6572207468616e204e46542062616c616e636500000000006064820152608401610470565b604051637921219560e11b815233600480830191909152306024830152604482018890526064820186905260a0608483015260a482015263131a5cdd60e21b60c48201526001600160a01b0383169063f242432a9060e401600060405180830381600087803b15801561061657600080fd5b505af115801561062a573d6000803e3d6000fd5b505060fe5461063d925090506002611309565b60fe818155600082815260fd6020526040808220938455600193840180546001600160a01b03808e166001600160a01b031992831617909255845484528284206002018c9055845484528284206003018054821633179055845484528284206004018054928c1692909116919091179055825482528082206005018890558254825280822060060187905582548252808220600701805460ff19169094179093559054815281902090517fd851998c6733b2ed64c0c0c423ed68c8e30475ca208771065ed97ff24581821e9161071291611747565b60405180910390a150505050505050565b61072b61125d565b6064811061076d5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081c195c98d95b9d608a1b6044820152606401610470565b60fb55565b61077a61125d565b6001600160a01b0381166107c25760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401610470565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b63bc197c8160e01b5b95945050505050565b600054610100900460ff16158080156108165750600054600160ff909116105b806108305750303b158015610830575060005460ff166001145b6108935760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610470565b6000805460ff1916600117905580156108b6576000805461ff0019166101001790555b6108be61131c565b6001600160a01b03821661090a5760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b7b6b6b7b727bbb732b960691b6044820152606401610470565b60fc80546001600160a01b0319166001600160a01b038416179055601560fb55600060fe558015610975576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b600081815260fd602052604090206007015460ff166109cc5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a590814185a5c881a59608a1b6044820152606401610470565b600081815260fd60205260409020600301546001600160a01b03163314806109fe57506033546001600160a01b031633145b610a425760405162461bcd60e51b81526020600482015260156024820152741bdb9b1e481bdddb995c8818d85b8819195b1a5cdd605a1b6044820152606401610470565b600081815260fd60205260408082206001810154600382015460028301546005909301548451637921219560e11b81523060048201526001600160a01b0392831660248201526044810194909452606484015260a06084840152601260a48401527164656c697374204d61726b6574706c61636560701b60c4840152925192169263f242432a9260e48084019382900301818387803b158015610ae457600080fd5b505af1158015610af8573d6000803e3d6000fd5b505050600082815260fd60209081526040808320600581019390935560078301805460ff19169055600183015460029093015481516001600160a01b0390941684529183019190915281018390527fcfe19ae18c516d467b1b0f8cea3450488b42a366be4d0e41e04c6de41cefe67c915060600160405180910390a150565b600082815260fd602052604090206007015460ff16610bca5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a590814185a5c881a59608a1b6044820152606401610470565b600082815260fd6020526040902060050154811115610c2b5760405162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e74204e46542062616c616e636500000000000000006044820152606401610470565b600082815260fd602090815260408083208151610100810183528154815260018201546001600160a01b039081169482019490945260028201549281019290925260038101548316606083015260048101549092166080820152600582015460a0820152600682015460c0820181905260079092015460ff16151560e08201529190610cb7908461134b565b90506000610cdc6103e8610cd660fb548561134b90919063ffffffff16565b90611357565b90506000610cea8383611363565b600087815260fd60205260409020600401549091506001600160a01b0316610ea95782341015610d4f5760405162461bcd60e51b815260206004820152601060248201526f1d1bdbc81cdb585b1b08185b5bdd5b9d60821b6044820152606401610470565b60fb5415610dfc5760fc546040516000916001600160a01b03169084908381818185875af1925050503d8060008114610da4576040519150601f19603f3d011682016040523d82523d6000602084013e610da9565b606091505b5050905080610dfa5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2066656520746f206665654164647265737300000000006044820152606401610470565b505b600084606001516001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e4d576040519150601f19603f3d011682016040523d82523d6000602084013e610e52565b606091505b5050905080610ea35760405162461bcd60e51b815260206004820181905260248201527f4661696c656420746f2073656e6420636f696e20746f206e6674206f776e65726044820152606401610470565b50611092565b600086815260fd60205260409081902060049081015491516323b872dd60e01b81523391810191909152306024820152604481018590526001600160a01b039091169081906323b872dd906064016020604051808303816000875af1158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190611756565b610f865760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606401610470565b60fb541561100e5760fc5460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018590529082169063a9059cbb906044016020604051808303816000875af1158015610fe1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110059190611756565b61100e57600080fd5b606085015160405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529082169063a9059cbb906044016020604051808303816000875af1158015611063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110879190611756565b61109057600080fd5b505b600086815260fd60205260409081902060010154858201519151637921219560e11b815230600482015233602482015260448101929092526064820187905260a06084830152601460a4830152736275792066726f6d204d61726b6574706c61636560601b60c48301526001600160a01b03169063f242432a9060e401600060405180830381600087803b15801561112957600080fd5b505af115801561113d573d6000803e3d6000fd5b505050600087815260fd602052604090206005015461115d915086611363565b600087815260fd602052604081206005018290550361119057600086815260fd60205260409020600701805460ff191690555b600086815260fd60205260409081902090517f304fd74c8d079fe7db9fe8888ad4f4e8708bb1c97dcfc7ba4c91ed2c8293170f916111d49133918a918a9190611778565b60405180910390a1505050505050565b6111ec61125d565b6001600160a01b0381166112515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610470565b61125a816112b7565b50565b6033546001600160a01b031633146104325760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610470565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061131582846117ba565b9392505050565b600054610100900460ff166113435760405162461bcd60e51b8152600401610470906117cd565b61043261136f565b60006113158284611818565b6000611315828461182f565b60006113158284611851565b600054610100900460ff166113965760405162461bcd60e51b8152600401610470906117cd565b610432336112b7565b6000602082840312156113b157600080fd5b81356001600160e01b03198116811461131557600080fd5b80356001600160a01b03811681146113e057600080fd5b919050565b600080600080600060a086880312156113fd57600080fd5b611406866113c9565b94506020860135935061141b604087016113c9565b94979396509394606081013594506080013592915050565b60006020828403121561144557600080fd5b5035919050565b60006020828403121561145e57600080fd5b611315826113c9565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114a6576114a6611467565b604052919050565b600082601f8301126114bf57600080fd5b8135602067ffffffffffffffff8211156114db576114db611467565b8160051b6114ea82820161147d565b928352848101820192828101908785111561150457600080fd5b83870192505b848310156115235782358252918301919083019061150a565b979650505050505050565b600082601f83011261153f57600080fd5b813567ffffffffffffffff81111561155957611559611467565b61156c601f8201601f191660200161147d565b81815284602083860101111561158157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156115b657600080fd5b6115bf866113c9565b94506115cd602087016113c9565b9350604086013567ffffffffffffffff808211156115ea57600080fd5b6115f689838a016114ae565b9450606088013591508082111561160c57600080fd5b61161889838a016114ae565b9350608088013591508082111561162e57600080fd5b5061163b8882890161152e565b9150509295509295909350565b6000806040838503121561165b57600080fd5b50508035926020909101359150565b600080600080600060a0868803121561168257600080fd5b61168b866113c9565b9450611699602087016113c9565b93506040860135925060608601359150608086013567ffffffffffffffff8111156116c357600080fd5b61163b8882890161152e565b6000602082840312156116e157600080fd5b5051919050565b8054825260018101546001600160a01b039081166020840152600282015460408401526003820154811660608401526004820154166080830152600581015460a0830152600681015460c08301526007015460ff16151560e090910152565b610100810161041a82846116e8565b60006020828403121561176857600080fd5b8151801515811461131557600080fd5b6001600160a01b0385168152602081018490526040810183905261016081016107ed60608301846116e8565b634e487b7160e01b600052601160045260246000fd5b8082018082111561041a5761041a6117a4565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b808202811582820484141761041a5761041a6117a4565b60008261184c57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561041a5761041a6117a456fea26469706673582212209418ccd203f929dbceda8de2420c860bfdace5b4345223da824062f28755f73a64736f6c63430008110033

Deployed ByteCode

0x6080604052600436106100fe5760003560e01c80638705fcd411610095578063c4d66de811610064578063c4d66de81461034a578063d50d39371461036a578063f10ffd3c1461038a578063f23a6e611461039d578063f2fde38b146103c957600080fd5b80638705fcd4146102175780638da5cb5b14610237578063b91ac78814610255578063bc197c811461031157600080fd5b806354cf2aeb116100d157806354cf2aeb146101aa578063715018a6146101c0578063766c53e2146101d75780637ce3489b146101f757600080fd5b806301c234a81461010357806301ffc9a71461012c578063372749941461015c5780634127535814610172575b600080fd5b34801561010f57600080fd5b506101196103e881565b6040519081526020015b60405180910390f35b34801561013857600080fd5b5061014c61014736600461139f565b6103e9565b6040519015158152602001610123565b34801561016857600080fd5b5061011960fe5481565b34801561017e57600080fd5b5060fc54610192906001600160a01b031681565b6040516001600160a01b039091168152602001610123565b3480156101b657600080fd5b5061011960fb5481565b3480156101cc57600080fd5b506101d5610420565b005b3480156101e357600080fd5b506101d56101f23660046113e5565b610434565b34801561020357600080fd5b506101d5610212366004611433565b610723565b34801561022357600080fd5b506101d561023236600461144c565b610772565b34801561024357600080fd5b506033546001600160a01b0316610192565b34801561026157600080fd5b506102c5610270366004611433565b60fd602052600090815260409020805460018201546002830154600384015460048501546005860154600687015460079097015495966001600160a01b03958616969495938416949290931692909160ff1688565b604080519889526001600160a01b0397881660208a015288019590955292851660608701529316608085015260a084019290925260c0830191909152151560e082015261010001610123565b34801561031d57600080fd5b5061033161032c36600461159e565b6107e4565b6040516001600160e01b03199091168152602001610123565b34801561035657600080fd5b506101d561036536600461144c565b6107f6565b34801561037657600080fd5b506101d5610385366004611433565b610979565b6101d5610398366004611648565b610b77565b3480156103a957600080fd5b506103316103b836600461166a565b63f23a6e6160e01b95945050505050565b3480156103d557600080fd5b506101d56103e436600461144c565b6111e4565b60006001600160e01b03198216630271189760e51b148061041a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b61042861125d565b61043260006112b7565b565b600081116104795760405162461bcd60e51b815260206004820152600d60248201526c696e76616c696420707269636560981b60448201526064015b60405180910390fd5b600082116104ba5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a5908185b5bdd5b9d60921b6044820152606401610470565b604051627eeac760e11b81523360048201526024810185905285906000906001600160a01b0383169062fdd58e90604401602060405180830381865afa158015610508573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061052c91906116cf565b9050838110156105a45760405162461bcd60e51b815260206004820152603b60248201527f696e76616c696420616d6f756e74203a20616d6f756e74206861766520746f2060448201527f626520736d616c6c6572207468616e204e46542062616c616e636500000000006064820152608401610470565b604051637921219560e11b815233600480830191909152306024830152604482018890526064820186905260a0608483015260a482015263131a5cdd60e21b60c48201526001600160a01b0383169063f242432a9060e401600060405180830381600087803b15801561061657600080fd5b505af115801561062a573d6000803e3d6000fd5b505060fe5461063d925090506002611309565b60fe818155600082815260fd6020526040808220938455600193840180546001600160a01b03808e166001600160a01b031992831617909255845484528284206002018c9055845484528284206003018054821633179055845484528284206004018054928c1692909116919091179055825482528082206005018890558254825280822060060187905582548252808220600701805460ff19169094179093559054815281902090517fd851998c6733b2ed64c0c0c423ed68c8e30475ca208771065ed97ff24581821e9161071291611747565b60405180910390a150505050505050565b61072b61125d565b6064811061076d5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a59081c195c98d95b9d608a1b6044820152606401610470565b60fb55565b61077a61125d565b6001600160a01b0381166107c25760405162461bcd60e51b815260206004820152600f60248201526e696e76616c6964206164647265737360881b6044820152606401610470565b60fc80546001600160a01b0319166001600160a01b0392909216919091179055565b63bc197c8160e01b5b95945050505050565b600054610100900460ff16158080156108165750600054600160ff909116105b806108305750303b158015610830575060005460ff166001145b6108935760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610470565b6000805460ff1916600117905580156108b6576000805461ff0019166101001790555b6108be61131c565b6001600160a01b03821661090a5760405162461bcd60e51b815260206004820152601360248201527224b73b30b634b21031b7b6b6b7b727bbb732b960691b6044820152606401610470565b60fc80546001600160a01b0319166001600160a01b038416179055601560fb55600060fe558015610975576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050565b600081815260fd602052604090206007015460ff166109cc5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a590814185a5c881a59608a1b6044820152606401610470565b600081815260fd60205260409020600301546001600160a01b03163314806109fe57506033546001600160a01b031633145b610a425760405162461bcd60e51b81526020600482015260156024820152741bdb9b1e481bdddb995c8818d85b8819195b1a5cdd605a1b6044820152606401610470565b600081815260fd60205260408082206001810154600382015460028301546005909301548451637921219560e11b81523060048201526001600160a01b0392831660248201526044810194909452606484015260a06084840152601260a48401527164656c697374204d61726b6574706c61636560701b60c4840152925192169263f242432a9260e48084019382900301818387803b158015610ae457600080fd5b505af1158015610af8573d6000803e3d6000fd5b505050600082815260fd60209081526040808320600581019390935560078301805460ff19169055600183015460029093015481516001600160a01b0390941684529183019190915281018390527fcfe19ae18c516d467b1b0f8cea3450488b42a366be4d0e41e04c6de41cefe67c915060600160405180910390a150565b600082815260fd602052604090206007015460ff16610bca5760405162461bcd60e51b815260206004820152600f60248201526e1a5b9d985b1a590814185a5c881a59608a1b6044820152606401610470565b600082815260fd6020526040902060050154811115610c2b5760405162461bcd60e51b815260206004820152601860248201527f696e73756666696369656e74204e46542062616c616e636500000000000000006044820152606401610470565b600082815260fd602090815260408083208151610100810183528154815260018201546001600160a01b039081169482019490945260028201549281019290925260038101548316606083015260048101549092166080820152600582015460a0820152600682015460c0820181905260079092015460ff16151560e08201529190610cb7908461134b565b90506000610cdc6103e8610cd660fb548561134b90919063ffffffff16565b90611357565b90506000610cea8383611363565b600087815260fd60205260409020600401549091506001600160a01b0316610ea95782341015610d4f5760405162461bcd60e51b815260206004820152601060248201526f1d1bdbc81cdb585b1b08185b5bdd5b9d60821b6044820152606401610470565b60fb5415610dfc5760fc546040516000916001600160a01b03169084908381818185875af1925050503d8060008114610da4576040519150601f19603f3d011682016040523d82523d6000602084013e610da9565b606091505b5050905080610dfa5760405162461bcd60e51b815260206004820152601b60248201527f4661696c656420746f2066656520746f206665654164647265737300000000006044820152606401610470565b505b600084606001516001600160a01b03168260405160006040518083038185875af1925050503d8060008114610e4d576040519150601f19603f3d011682016040523d82523d6000602084013e610e52565b606091505b5050905080610ea35760405162461bcd60e51b815260206004820181905260248201527f4661696c656420746f2073656e6420636f696e20746f206e6674206f776e65726044820152606401610470565b50611092565b600086815260fd60205260409081902060049081015491516323b872dd60e01b81523391810191909152306024820152604481018590526001600160a01b039091169081906323b872dd906064016020604051808303816000875af1158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190611756565b610f865760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e63650000000000006044820152606401610470565b60fb541561100e5760fc5460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018590529082169063a9059cbb906044016020604051808303816000875af1158015610fe1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110059190611756565b61100e57600080fd5b606085015160405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529082169063a9059cbb906044016020604051808303816000875af1158015611063573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110879190611756565b61109057600080fd5b505b600086815260fd60205260409081902060010154858201519151637921219560e11b815230600482015233602482015260448101929092526064820187905260a06084830152601460a4830152736275792066726f6d204d61726b6574706c61636560601b60c48301526001600160a01b03169063f242432a9060e401600060405180830381600087803b15801561112957600080fd5b505af115801561113d573d6000803e3d6000fd5b505050600087815260fd602052604090206005015461115d915086611363565b600087815260fd602052604081206005018290550361119057600086815260fd60205260409020600701805460ff191690555b600086815260fd60205260409081902090517f304fd74c8d079fe7db9fe8888ad4f4e8708bb1c97dcfc7ba4c91ed2c8293170f916111d49133918a918a9190611778565b60405180910390a1505050505050565b6111ec61125d565b6001600160a01b0381166112515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610470565b61125a816112b7565b50565b6033546001600160a01b031633146104325760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610470565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600061131582846117ba565b9392505050565b600054610100900460ff166113435760405162461bcd60e51b8152600401610470906117cd565b61043261136f565b60006113158284611818565b6000611315828461182f565b60006113158284611851565b600054610100900460ff166113965760405162461bcd60e51b8152600401610470906117cd565b610432336112b7565b6000602082840312156113b157600080fd5b81356001600160e01b03198116811461131557600080fd5b80356001600160a01b03811681146113e057600080fd5b919050565b600080600080600060a086880312156113fd57600080fd5b611406866113c9565b94506020860135935061141b604087016113c9565b94979396509394606081013594506080013592915050565b60006020828403121561144557600080fd5b5035919050565b60006020828403121561145e57600080fd5b611315826113c9565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156114a6576114a6611467565b604052919050565b600082601f8301126114bf57600080fd5b8135602067ffffffffffffffff8211156114db576114db611467565b8160051b6114ea82820161147d565b928352848101820192828101908785111561150457600080fd5b83870192505b848310156115235782358252918301919083019061150a565b979650505050505050565b600082601f83011261153f57600080fd5b813567ffffffffffffffff81111561155957611559611467565b61156c601f8201601f191660200161147d565b81815284602083860101111561158157600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156115b657600080fd5b6115bf866113c9565b94506115cd602087016113c9565b9350604086013567ffffffffffffffff808211156115ea57600080fd5b6115f689838a016114ae565b9450606088013591508082111561160c57600080fd5b61161889838a016114ae565b9350608088013591508082111561162e57600080fd5b5061163b8882890161152e565b9150509295509295909350565b6000806040838503121561165b57600080fd5b50508035926020909101359150565b600080600080600060a0868803121561168257600080fd5b61168b866113c9565b9450611699602087016113c9565b93506040860135925060608601359150608086013567ffffffffffffffff8111156116c357600080fd5b61163b8882890161152e565b6000602082840312156116e157600080fd5b5051919050565b8054825260018101546001600160a01b039081166020840152600282015460408401526003820154811660608401526004820154166080830152600581015460a0830152600681015460c08301526007015460ff16151560e090910152565b610100810161041a82846116e8565b60006020828403121561176857600080fd5b8151801515811461131557600080fd5b6001600160a01b0385168152602081018490526040810183905261016081016107ed60608301846116e8565b634e487b7160e01b600052601160045260246000fd5b8082018082111561041a5761041a6117a4565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b808202811582820484141761041a5761041a6117a4565b60008261184c57634e487b7160e01b600052601260045260246000fd5b500490565b8181038181111561041a5761041a6117a456fea26469706673582212209418ccd203f929dbceda8de2420c860bfdace5b4345223da824062f28755f73a64736f6c63430008110033