Contract 0x2e3b85f85628301a0bce300dee3a6b04195a15ee 2

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x11d56c03b12564ac0eac3dd172d198a4b389255c636043489860f48e200afae4Create Listing93940562022-04-06 13:03:4451 days 21 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000394829248 ETH
0x62923a4eda131b116683a31574450f9fe649ae4190bf31382791ef7086ce622fCreate Listing93940522022-04-06 13:03:4451 days 21 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000394829978 ETH
0x57d84a5eb758f0fc985c829f20d5a1090a4916e741fafae7e54a823e70c73743Create Listing89202662022-03-30 17:27:4158 days 17 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.00025149692 ETH
0xf7e93cb4f7ea6603f8b4b27d33ac385f3f5dc669c982f0c618a1eb7a45916c7eCreate Listing89202612022-03-30 17:27:4158 days 17 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000250856807 ETH
0xea725d8134e5d29ad82f4222110578c38030bf732e76b0bd6c6f33e5d6ff7014Create Listing87335912022-03-28 3:05:4861 days 7 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000185970149 ETH
0xa3b86d5b277827c6f5eaabadda3c934813a70f5b43c2f5e35ca8bbca8aef843cCreate Listing87335852022-03-28 3:05:4861 days 7 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000185970492 ETH
0xc27f2f2c01a43f9db1a44ac3d970d6c30d863c471019c6a82b537fcf29cdb395Create Listing87096952022-03-27 19:02:5561 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000177349438 ETH
0x73b2c409541e40f895d117d12860384c2bc0cb07526001cf537f9e8b22472571Create Listing87096892022-03-27 19:02:5561 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000177802638 ETH
0x4fae72502de72804115a8a76996e41e681520276c7ef97d0e4afc06d6e40c76eCreate Listing85835562022-03-25 15:12:2663 days 19 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.00022393337 ETH
0x50dea9b1d7dcd1b2b239e641e516997902decb0b118a86056bd39c800017d767Create Listing85835432022-03-25 15:12:2663 days 19 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000224505612 ETH
0xb18f43ad78c7e890acc12215bab5744fe1aa1a6b40635d3392493d389332ff11Create Listing85016592022-03-24 15:03:3064 days 19 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000197997574 ETH
0x082674d24bce3fe536dd3ec9e8d0c115ff32fa45615304d8cddce9cf004f56f6Create Listing85016512022-03-24 15:02:4064 days 19 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.00019799794 ETH
0x39574d2f245a5df7f3bd4a41ad48b6bbdc49e937589dd3da4f98425c97d224beCreate Listing84258012022-03-23 18:36:4865 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000187968088 ETH
0x414ab6f06198cf69e2662f9d0e5731663339a92920e1f813fbb3d636e9c91966Create Listing84257932022-03-23 18:36:4865 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.0001884472 ETH
0xe16acd169a95ad60ece2f80c84d85c7fece04ddde12173f674e61866ee69f866Renounce Ownersh...82850872022-03-22 1:19:5567 days 9 hrs ago0xb13acf48136773de53aac51faf52b81b7a98582a IN  Treasure DAO: Marketplace0 ETH0.000135140434 ETH
0x9382cadc134fcd0eaa8b95a8d6e95fce1f5e08bc415945393191e45e213bba25Create Listing82702592022-03-21 18:20:3167 days 16 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000162343285 ETH
0x9a93b407fdb762458e86f0c635bfc6b3c6d9c27e7b4ef1b83ed3bc4faf205c8eCreate Listing82702552022-03-21 18:20:3167 days 16 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000162343584 ETH
0x086969f06dffad16ae6d4b8a40467df5cc09e141d045c155109692a4b76f9a82Create Listing82573492022-03-21 13:38:0267 days 20 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000154506468 ETH
0xb1603043fcb964ca3320dc00fe1270db81a67115b213ae6b7e4592aecf2a995eCreate Listing82573432022-03-21 13:38:0267 days 20 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000154506754 ETH
0xea87408e54d512d219774aafffdcc20c43ebe0c651d8d6c37888eaaf6a56f0c7Create Listing81201042022-03-18 19:15:1770 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000312907969 ETH
0xde2364fd4ee7c2f89b1eb388f257f5596f6079fb711253cc542f0a28bed95dacCreate Listing81200972022-03-18 19:14:2770 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000312908548 ETH
0x5775f46dba4cfe4828426f87c593574332e6fa3d889eec5177c402ff95fea976Create Listing81197962022-03-18 19:06:5970 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000312907969 ETH
0x5a282f4fec28b37a8db958ef06d69a12c835ba19077f4b10ccd30b1c1a01eb93Create Listing81197902022-03-18 19:06:5970 days 15 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000313707578 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed4193Create Listing81056862022-03-18 13:32:5870 days 21 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000399514988 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd0Create Listing81056822022-03-18 13:32:5870 days 21 hrs ago0xd390a643268845bc5796267644de35d3fe449dcd IN  Treasure DAO: Marketplace0 ETH0.000398729267 ETH
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xeda1dbdc1d6f6a64170ad8ae28aba41491071178b66e97015b1edad5c355178187526572022-03-28 9:48:2961 days 47 mins ago 0x812cda2181ed7c45a35a691e0c85e231d218e273 Treasure DAO: Marketplace0 ETH
0xb3609d5bd17e386b3d7ef576ae829e0119aa29a33d03233db98b938a8c58678386205852022-03-26 4:23:2563 days 6 hrs ago 0x812cda2181ed7c45a35a691e0c85e231d218e273 Treasure DAO: Marketplace0 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xc56b6f27f27e1dd5fed1dfa5a24a716f366c7a53dcbde603d3dd2a07e0ed419381056862022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0xdebb686b7ac9942d5c945dc7b02a06be4fcf04a8dc422db2ecd4fb555232acd081056822022-03-18 13:32:5870 days 21 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0x8b2528ec0d65ad43b826d69f5620c8354849c30b5a7d23b3b2fbbf4c0fb3c48c78615722022-03-14 0:00:4675 days 10 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0x8b2528ec0d65ad43b826d69f5620c8354849c30b5a7d23b3b2fbbf4c0fb3c48c78615722022-03-14 0:00:4675 days 10 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0x8b2528ec0d65ad43b826d69f5620c8354849c30b5a7d23b3b2fbbf4c0fb3c48c78615722022-03-14 0:00:4675 days 10 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
0x8b2528ec0d65ad43b826d69f5620c8354849c30b5a7d23b3b2fbbf4c0fb3c48c78615722022-03-14 0:00:4675 days 10 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0x8b2528ec0d65ad43b826d69f5620c8354849c30b5a7d23b3b2fbbf4c0fb3c48c78615722022-03-14 0:00:4675 days 10 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0x8b2528ec0d65ad43b826d69f5620c8354849c30b5a7d23b3b2fbbf4c0fb3c48c78615722022-03-14 0:00:4675 days 10 hrs ago Treasure DAO: Marketplace 0xf3d00a2559d84de7ac093443bcaada5f4ee4165c0 ETH
0x6a4df4cd69163c29cd7abbd50dc7cba846211590d2d009aa57e0ce63af5e270478370452022-03-13 10:48:1375 days 23 hrs ago Treasure DAO: Marketplace 0x6718cd7f42ffb826d820bfb996ca22982fb69aa10 ETH
[ Download CSV Export 
Loading

Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0x134569A78306A0F239deaF8890d0f6DDd457Bd06

Contract Name:
TreasureMarketplace

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 12 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 2 of 12 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 3 of 12 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 4 of 12 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 5 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

    /**
     * @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);
}

File 6 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

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

File 7 of 12 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 8 of 12 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason 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 {
            // 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

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 12 : Context.sol
// SPDX-License-Identifier: MIT

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 10 of 12 : IERC165.sol
// SPDX-License-Identifier: MIT

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 11 of 12 : TreasureMarketplace.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/interfaces/IERC165.sol';
import '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import './TreasureNFTOracle.sol';

contract TreasureMarketplace is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    bytes4 private constant INTERFACE_ID_ERC721 = 0x80ac58cd;
    bytes4 private constant INTERFACE_ID_ERC1155 = 0xd9b67a26;
    uint256 public constant BASIS_POINTS = 10000;

    address public oracle;
    address public paymentToken;

    uint256 public fee;
    address public feeReceipient;

    struct Listing {
        uint256 quantity;
        uint256 pricePerItem;
        uint256 expirationTime;
    }

    //  _nftAddress => _tokenId => _owner
    mapping(address => mapping(uint256 => mapping(address => Listing))) public listings;
    mapping(address => bool) public nftWhitelist;

    event UpdateFee(uint256 fee);
    event UpdateFeeRecipient(address feeRecipient);
    event UpdateOracle(address oracle);
    event UpdatePaymentToken(address paymentToken);

    event NftWhitelistAdd(address nft);
    event NftWhitelistRemove(address nft);

    event ItemListed(
        address seller,
        address nftAddress,
        uint256 tokenId,
        uint256 quantity,
        uint256 pricePerItem,
        uint256 expirationTime
    );

    event ItemUpdated(
        address seller,
        address nftAddress,
        uint256 tokenId,
        uint256 quantity,
        uint256 pricePerItem,
        uint256 expirationTime
    );

    event ItemSold(
        address seller,
        address buyer,
        address nftAddress,
        uint256 tokenId,
        uint256 quantity,
        uint256 pricePerItem
    );

    event ItemCanceled(address seller, address nftAddress, uint256 tokenId);

    modifier isListed(
        address _nftAddress,
        uint256 _tokenId,
        address _owner
    ) {
        Listing memory listing = listings[_nftAddress][_tokenId][_owner];
        require(listing.quantity > 0, "not listed item");
        _;
    }

    modifier notListed(
        address _nftAddress,
        uint256 _tokenId,
        address _owner
    ) {
        Listing memory listing = listings[_nftAddress][_tokenId][_owner];
        require(listing.quantity == 0, "already listed");
        _;
    }

    modifier validListing(
        address _nftAddress,
        uint256 _tokenId,
        address _owner
    ) {
        Listing memory listedItem = listings[_nftAddress][_tokenId][_owner];
        if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC721)) {
            IERC721 nft = IERC721(_nftAddress);
            require(nft.ownerOf(_tokenId) == _owner, "not owning item");
        } else if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC1155)) {
            IERC1155 nft = IERC1155(_nftAddress);
            require(nft.balanceOf(_owner, _tokenId) >= listedItem.quantity, "not owning item");
        } else {
            revert("invalid nft address");
        }
        require(listedItem.expirationTime >= block.timestamp, "listing expired");
        _;
    }

    modifier onlyWhitelisted(address nft) {
        require(nftWhitelist[nft], "nft not whitelisted");
        _;
    }

    constructor(uint256 _fee, address _feeRecipient, address _oracle, address _paymentToken) {
        setFee(_fee);
        setFeeRecipient(_feeRecipient);
        setOracle(_oracle);
        setPaymentToken(_paymentToken);
    }

    function createListing(
        address _nftAddress,
        uint256 _tokenId,
        uint256 _quantity,
        uint256 _pricePerItem,
        uint256 _expirationTime
    ) external notListed(_nftAddress, _tokenId, _msgSender()) onlyWhitelisted(_nftAddress) {
        if (_expirationTime == 0) _expirationTime = type(uint256).max;
        require(_expirationTime > block.timestamp, "invalid expiration time");
        require(_quantity > 0, "nothing to list");

        if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC721)) {
            IERC721 nft = IERC721(_nftAddress);
            require(nft.ownerOf(_tokenId) == _msgSender(), "not owning item");
            require(nft.isApprovedForAll(_msgSender(), address(this)), "item not approved");
        } else if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC1155)) {
            IERC1155 nft = IERC1155(_nftAddress);
            require(nft.balanceOf(_msgSender(), _tokenId) >= _quantity, "must hold enough nfts");
            require(nft.isApprovedForAll(_msgSender(), address(this)), "item not approved");
        } else {
            revert("invalid nft address");
        }

        listings[_nftAddress][_tokenId][_msgSender()] = Listing(
            _quantity,
            _pricePerItem,
            _expirationTime
        );

        emit ItemListed(
            _msgSender(),
            _nftAddress,
            _tokenId,
            _quantity,
            _pricePerItem,
            _expirationTime
        );
    }

    function updateListing(
        address _nftAddress,
        uint256 _tokenId,
        uint256 _newQuantity,
        uint256 _newPricePerItem,
        uint256 _newExpirationTime
    ) external nonReentrant isListed(_nftAddress, _tokenId, _msgSender()) {
        require(_newExpirationTime > block.timestamp, "invalid expiration time");

        Listing storage listedItem = listings[_nftAddress][_tokenId][_msgSender()];
        if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC721)) {
            IERC721 nft = IERC721(_nftAddress);
            require(nft.ownerOf(_tokenId) == _msgSender(), "not owning item");
        } else if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC1155)) {
            IERC1155 nft = IERC1155(_nftAddress);
            require(nft.balanceOf(_msgSender(), _tokenId) >= _newQuantity, "must hold enough nfts");
        } else {
            revert("invalid nft address");
        }

        listedItem.quantity = _newQuantity;
        listedItem.pricePerItem = _newPricePerItem;
        listedItem.expirationTime = _newExpirationTime;

        emit ItemUpdated(
            _msgSender(),
            _nftAddress,
            _tokenId,
            _newQuantity,
            _newPricePerItem,
            _newExpirationTime
        );
    }

    function cancelListing(address _nftAddress, uint256 _tokenId)
        external
        nonReentrant
        isListed(_nftAddress, _tokenId, _msgSender())
    {
        _cancelListing(_nftAddress, _tokenId, _msgSender());
    }

    function _cancelListing(
        address _nftAddress,
        uint256 _tokenId,
        address _owner
    ) internal {
        Listing memory listedItem = listings[_nftAddress][_tokenId][_owner];
        if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC721)) {
            IERC721 nft = IERC721(_nftAddress);
            require(nft.ownerOf(_tokenId) == _owner, "not owning item");
        } else if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC1155)) {
            IERC1155 nft = IERC1155(_nftAddress);
            require(nft.balanceOf(_msgSender(), _tokenId) >= listedItem.quantity, "not owning item");
        } else {
            revert("invalid nft address");
        }

        delete (listings[_nftAddress][_tokenId][_owner]);
        emit ItemCanceled(_owner, _nftAddress, _tokenId);
    }

    function buyItem(
        address _nftAddress,
        uint256 _tokenId,
        address _owner,
        uint256 _quantity
    )
        external
        nonReentrant
        isListed(_nftAddress, _tokenId, _owner)
        validListing(_nftAddress, _tokenId, _owner)
    {
        require(_msgSender() != _owner, "Cannot buy your own item");

        Listing memory listedItem = listings[_nftAddress][_tokenId][_owner];
        require(listedItem.quantity >= _quantity, "not enough quantity");

        // Transfer NFT to buyer
        if (IERC165(_nftAddress).supportsInterface(INTERFACE_ID_ERC721)) {
            IERC721(_nftAddress).safeTransferFrom(_owner, _msgSender(), _tokenId);
        } else {
            IERC1155(_nftAddress).safeTransferFrom(_owner, _msgSender(), _tokenId, _quantity, bytes(""));
        }

        if (listedItem.quantity == _quantity) {
            delete (listings[_nftAddress][_tokenId][_owner]);
        } else {
            listings[_nftAddress][_tokenId][_owner].quantity -= _quantity;
        }

        emit ItemSold(
            _owner,
            _msgSender(),
            _nftAddress,
            _tokenId,
            _quantity,
            listedItem.pricePerItem
        );

        TreasureNFTOracle(oracle).reportSale(_nftAddress, _tokenId, paymentToken, listedItem.pricePerItem);
        _buyItem(listedItem.pricePerItem, _quantity, _owner);
    }

    function _buyItem(
        uint256 _pricePerItem,
        uint256 _quantity,
        address _owner
    ) internal {
        uint256 totalPrice = _pricePerItem * _quantity;
        uint256 feeAmount = totalPrice * fee / BASIS_POINTS;
        IERC20(paymentToken).safeTransferFrom(_msgSender(), feeReceipient, feeAmount);
        IERC20(paymentToken).safeTransferFrom(_msgSender(), _owner, totalPrice - feeAmount);
    }

    // admin

    function setFee(uint256 _fee) public onlyOwner {
        require(_fee < BASIS_POINTS, "max fee");
        fee = _fee;
        emit UpdateFee(_fee);
    }

    function setFeeRecipient(address _feeRecipient) public onlyOwner {
        feeReceipient = _feeRecipient;
        emit UpdateFeeRecipient(_feeRecipient);
    }

    function setOracle(address _oracle) public onlyOwner {
        oracle = _oracle;
        emit UpdateOracle(_oracle);
    }

    function setPaymentToken(address _paymentToken) public onlyOwner {
        paymentToken = _paymentToken;
        emit UpdatePaymentToken(_paymentToken);
    }

    function setOracleOwner(address _newOwner) public onlyOwner {
        TreasureNFTOracle(oracle).transferOwnership(_newOwner);
    }

    function addToWhitelist(address _nft) external onlyOwner {
        require(!nftWhitelist[_nft], "nft already whitelisted");
        nftWhitelist[_nft] = true;
        emit NftWhitelistAdd(_nft);
    }

    function removeFromWhitelist(address _nft) external onlyOwner onlyWhitelisted(_nft) {
        nftWhitelist[_nft] = false;
        emit NftWhitelistRemove(_nft);
    }
}

File 12 of 12 : TreasureNFTOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;

import '@openzeppelin/contracts/access/Ownable.sol';

contract TreasureNFTOracle is Ownable {

    struct Price {
        uint256 price;
        address denomination;
    }

    /// _nftAddress => _tokenId => Price
    mapping(address => mapping(uint256 => Price)) public getPrice;

    event PriceUpdate(address indexed nftAddress, uint256 indexed tokenId, address paymentToken, uint256 pricePerItem);

    function reportSale(address _nftAddress, uint256 _tokenId, address _paymentToken, uint256 _pricePerItem) external onlyOwner {
        getPrice[_nftAddress][_tokenId] = Price(_pricePerItem, _paymentToken);
        emit PriceUpdate(_nftAddress, _tokenId, _paymentToken, _pricePerItem);
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract ABI

[{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"},{"internalType":"address","name":"_feeRecipient","type":"address"},{"internalType":"address","name":"_oracle","type":"address"},{"internalType":"address","name":"_paymentToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ItemCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerItem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expirationTime","type":"uint256"}],"name":"ItemListed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerItem","type":"uint256"}],"name":"ItemSold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"nftAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"pricePerItem","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expirationTime","type":"uint256"}],"name":"ItemUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nft","type":"address"}],"name":"NftWhitelistAdd","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nft","type":"address"}],"name":"NftWhitelistRemove","type":"event"},{"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":"uint256","name":"fee","type":"uint256"}],"name":"UpdateFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeRecipient","type":"address"}],"name":"UpdateFeeRecipient","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oracle","type":"address"}],"name":"UpdateOracle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"}],"name":"UpdatePaymentToken","type":"event"},{"inputs":[],"name":"BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"addToWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"buyItem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"cancelListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_quantity","type":"uint256"},{"internalType":"uint256","name":"_pricePerItem","type":"uint256"},{"internalType":"uint256","name":"_expirationTime","type":"uint256"}],"name":"createListing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"listings","outputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"pricePerItem","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nftWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracle","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paymentToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_nft","type":"address"}],"name":"removeFromWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeRecipient","type":"address"}],"name":"setFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oracle","type":"address"}],"name":"setOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"setOracleOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_paymentToken","type":"address"}],"name":"setPaymentToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_newQuantity","type":"uint256"},{"internalType":"uint256","name":"_newPricePerItem","type":"uint256"},{"internalType":"uint256","name":"_newExpirationTime","type":"uint256"}],"name":"updateListing","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620029f7380380620029f783398101604081905262000034916200037c565b6200003f3362000079565b600180556200004e84620000c9565b620000598362000191565b62000064826200022b565b6200006f81620002c5565b50505050620003d0565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314620001185760405162461bcd60e51b81526020600482018190526024820152600080516020620029d783398151915260448201526064015b60405180910390fd5b6127108110620001555760405162461bcd60e51b81526020600482015260076024820152666d61782066656560c81b60448201526064016200010f565b60048190556040518181527f38e229a7f3f9c329892d08eb37c4e91ccac6d12c798d394990ca4f56028ec266906020015b60405180910390a150565b6000546001600160a01b03163314620001dc5760405162461bcd60e51b81526020600482018190526024820152600080516020620029d783398151915260448201526064016200010f565b600580546001600160a01b0319166001600160a01b0383169081179091556040519081527f6632de8ab33c46549f7bb29f647ea0d751157b25fe6a14b1bcc7527cdfbeb79c9060200162000186565b6000546001600160a01b03163314620002765760405162461bcd60e51b81526020600482018190526024820152600080516020620029d783398151915260448201526064016200010f565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f09ad0a3595604db9b7aef0dbd4918cea3642b96bc65ad7c9fb501a1529becd799060200162000186565b6000546001600160a01b03163314620003105760405162461bcd60e51b81526020600482018190526024820152600080516020620029d783398151915260448201526064016200010f565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527fc2125241dd55c14b337aea21dcef108a9fd20a816ae6d4d18560572afce99c4e9060200162000186565b80516001600160a01b03811681146200037757600080fd5b919050565b600080600080608085870312156200039357600080fd5b84519350620003a5602086016200035f565b9250620003b5604086016200035f565b9150620003c5606086016200035f565b905092959194509250565b6125f780620003e06000396000f3fe608060405234801561001057600080fd5b50600436106101375760003560e01c80638ab1d681116100b8578063ddca3f431161007c578063ddca3f43146102d3578063de250604146102ea578063e1f1c4a7146102fd578063e43252d714610306578063e74b981b14610319578063f2fde38b1461032c57600080fd5b80638ab1d681146102765780638b2b883e146102895780638da5cb5b1461029c5780639057f289146102ad578063b2ddee06146102c057600080fd5b80636bd3a64b116100ff5780636bd3a64b146101da5780636fad040914610235578063715018a6146102485780637adbf973146102505780637dc0d1d01461026357600080fd5b80633013ce291461013c5780633740ebb31461016c57806346b31b6e1461017f57806369fe0e2d146101b25780636a326ab1146101c7575b600080fd5b60035461014f906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b60055461014f906001600160a01b031681565b6101a261018d366004612222565b60076020526000908152604090205460ff1681565b6040519015158152602001610163565b6101c56101c0366004612378565b61033f565b005b6101c56101d5366004612222565b6103e9565b61021a6101e8366004612288565b600660209081526000938452604080852082529284528284209052825290208054600182015460029092015490919083565b60408051938452602084019290925290820152606001610163565b6101c5610243366004612312565b610461565b6101c56108b6565b6101c561025e366004612222565b6108ec565b60025461014f906001600160a01b031681565b6101c5610284366004612222565b610964565b6101c5610297366004612222565b610a46565b6000546001600160a01b031661014f565b6101c56102bb366004612312565b610ad2565b6101c56102ce36600461225c565b611098565b6102dc60045481565b604051908152602001610163565b6101c56102f83660046122ca565b61114c565b6102dc61271081565b6101c5610314366004612222565b61198b565b6101c5610327366004612222565b611a72565b6101c561033a366004612222565b611aea565b6000546001600160a01b031633146103725760405162461bcd60e51b81526004016103699061247d565b60405180910390fd5b61271081106103ad5760405162461bcd60e51b81526020600482015260076024820152666d61782066656560c81b6044820152606401610369565b60048190556040518181527f38e229a7f3f9c329892d08eb37c4e91ccac6d12c798d394990ca4f56028ec266906020015b60405180910390a150565b6000546001600160a01b031633146104135760405162461bcd60e51b81526004016103699061247d565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527fc2125241dd55c14b337aea21dcef108a9fd20a816ae6d4d18560572afce99c4e906020016103de565b600260015414156104845760405162461bcd60e51b8152600401610369906124b2565b60026001558484336001600160a01b038084166000908152600660209081526040808320868452825280832093851683529281529082902082516060810184528154808252600183015493820193909352600290910154928101929092526104fe5760405162461bcd60e51b8152600401610369906124e9565b4285116105475760405162461bcd60e51b8152602060048201526017602482015276696e76616c69642065787069726174696f6e2074696d6560481b6044820152606401610369565b6001600160a01b03891660008181526006602090815260408083208c845282528083203384529091529081902090516301ffc9a760e01b81529091906301ffc9a79061059e906380ac58cd60e01b9060040161242c565b60206040518083038186803b1580156105b657600080fd5b505afa1580156105ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ee9190612356565b1561069d5789336040516331a9108f60e11b8152600481018c90526001600160a01b0391821691831690636352211e9060240160206040518083038186803b15801561063957600080fd5b505afa15801561064d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610671919061223f565b6001600160a01b0316146106975760405162461bcd60e51b815260040161036990612454565b50610838565b6040516301ffc9a760e01b81526001600160a01b038b16906301ffc9a7906106d090636cdb3d1360e11b9060040161242c565b60206040518083038186803b1580156106e857600080fd5b505afa1580156106fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107209190612356565b156107fa5789886001600160a01b03821662fdd58e336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018e905260440160206040518083038186803b15801561077c57600080fd5b505afa158015610790573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b49190612391565b10156106975760405162461bcd60e51b81526020600482015260156024820152746d75737420686f6c6420656e6f756768206e66747360581b6044820152606401610369565b60405162461bcd60e51b8152602060048201526013602482015272696e76616c6964206e6674206164647265737360681b6044820152606401610369565b8781556001810187905560028101869055604080513381526001600160a01b038c1660208201528082018b9052606081018a90526080810189905260a0810188905290517f25a89891a024b83ce77c6fc45ddada8564a9534184cd91a6db6c1f542e55abd89181900360c00190a15050600180555050505050505050565b6000546001600160a01b031633146108e05760405162461bcd60e51b81526004016103699061247d565b6108ea6000611b85565b565b6000546001600160a01b031633146109165760405162461bcd60e51b81526004016103699061247d565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f09ad0a3595604db9b7aef0dbd4918cea3642b96bc65ad7c9fb501a1529becd79906020016103de565b6000546001600160a01b0316331461098e5760405162461bcd60e51b81526004016103699061247d565b6001600160a01b038116600090815260076020526040902054819060ff166109ee5760405162461bcd60e51b81526020600482015260136024820152721b999d081b9bdd081dda1a5d195b1a5cdd1959606a1b6044820152606401610369565b6001600160a01b038216600081815260076020908152604091829020805460ff1916905590519182527f81515fd036f806bdcf104ec83b77208e94ed56358867362be3b8ec60fefbdfdb910160405180910390a15050565b6000546001600160a01b03163314610a705760405162461bcd60e51b81526004016103699061247d565b60025460405163f2fde38b60e01b81526001600160a01b0383811660048301529091169063f2fde38b90602401600060405180830381600087803b158015610ab757600080fd5b505af1158015610acb573d6000803e3d6000fd5b5050505050565b8484336001600160a01b0380841660009081526006602090815260408083208684528252808320938516835292815290829020825160608101845281548082526001830154938201939093526002909101549281019290925215610b695760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b1a5cdd195960921b6044820152606401610369565b6001600160a01b038916600090815260076020526040902054899060ff16610bc95760405162461bcd60e51b81526020600482015260136024820152721b999d081b9bdd081dda1a5d195b1a5cdd1959606a1b6044820152606401610369565b85610bd45760001995505b428611610c1d5760405162461bcd60e51b8152602060048201526017602482015276696e76616c69642065787069726174696f6e2074696d6560481b6044820152606401610369565b60008811610c5f5760405162461bcd60e51b815260206004820152600f60248201526e1b9bdd1a1a5b99c81d1bc81b1a5cdd608a1b6044820152606401610369565b6040516301ffc9a760e01b81526001600160a01b038b16906301ffc9a790610c92906380ac58cd60e01b9060040161242c565b60206040518083038186803b158015610caa57600080fd5b505afa158015610cbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce29190612356565b15610e5e5789336040516331a9108f60e11b8152600481018c90526001600160a01b0391821691831690636352211e9060240160206040518083038186803b158015610d2d57600080fd5b505afa158015610d41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d65919061223f565b6001600160a01b031614610d8b5760405162461bcd60e51b815260040161036990612454565b6001600160a01b03811663e985e9c5336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015230602482015260440160206040518083038186803b158015610de057600080fd5b505afa158015610df4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e189190612356565b610e585760405162461bcd60e51b81526020600482015260116024820152701a5d195b481b9bdd08185c1c1c9bdd9959607a1b6044820152606401610369565b50610fbb565b6040516301ffc9a760e01b81526001600160a01b038b16906301ffc9a790610e9190636cdb3d1360e11b9060040161242c565b60206040518083038186803b158015610ea957600080fd5b505afa158015610ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee19190612356565b156107fa5789886001600160a01b03821662fdd58e336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018e905260440160206040518083038186803b158015610f3d57600080fd5b505afa158015610f51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f759190612391565b1015610d8b5760405162461bcd60e51b81526020600482015260156024820152746d75737420686f6c6420656e6f756768206e66747360581b6044820152606401610369565b6040805160608101825289815260208082018a90528183018990526001600160a01b038d166000908152600682528381208d82529091529182209091336001600160a01b0316815260208082019290925260409081016000208351815591830151600183015591909101516002909101557f66bd0bc88d76947965bc00f670f5c5b25aebab9fef6cb916d8c63a253ec392b733604080516001600160a01b039283168152918d16602083015281018b9052606081018a90526080810189905260a0810188905260c00160405180910390a150505050505050505050565b600260015414156110bb5760405162461bcd60e51b8152600401610369906124b2565b60026001558181336001600160a01b038084166000908152600660209081526040808320868452825280832093851683529281529082902082516060810184528154808252600183015493820193909352600290910154928101929092526111355760405162461bcd60e51b8152600401610369906124e9565b611140868633611bd5565b50506001805550505050565b6002600154141561116f5760405162461bcd60e51b8152600401610369906124b2565b600260018181556001600160a01b03808716600090815260066020908152604080832089845282528083209388168352928152908290208251606081018452815480825294820154928101929092529093015490830152859185918591906111e95760405162461bcd60e51b8152600401610369906124e9565b6001600160a01b0380891660008181526006602090815260408083208c84528252808320948b16835293815290839020835160608101855281548152600182015492810192909252600201548184015291516301ffc9a760e01b81528a928a928a926301ffc9a790611266906380ac58cd60e01b9060040161242c565b60206040518083038186803b15801561127e57600080fd5b505afa158015611292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b69190612356565b15611366576040516331a9108f60e11b81526004810184905284906001600160a01b038481169190831690636352211e9060240160206040518083038186803b15801561130257600080fd5b505afa158015611316573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133a919061223f565b6001600160a01b0316146113605760405162461bcd60e51b815260040161036990612454565b50611490565b6040516301ffc9a760e01b81526001600160a01b038516906301ffc9a79061139990636cdb3d1360e11b9060040161242c565b60206040518083038186803b1580156113b157600080fd5b505afa1580156113c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e99190612356565b156107fa578051604051627eeac760e11b81526001600160a01b038481166004830152602482018690528692919083169062fdd58e9060440160206040518083038186803b15801561143a57600080fd5b505afa15801561144e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114729190612391565b10156113605760405162461bcd60e51b815260040161036990612454565b42816040015110156114d65760405162461bcd60e51b815260206004820152600f60248201526e1b1a5cdd1a5b99c8195e1c1a5c9959608a1b6044820152606401610369565b336001600160a01b038b16141561152f5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f742062757920796f7572206f776e206974656d00000000000000006044820152606401610369565b6001600160a01b03808d1660009081526006602090815260408083208f84528252808320938e1683529281529082902082516060810184528154808252600183015493820193909352600290910154928101929092528a11156115ca5760405162461bcd60e51b81526020600482015260136024820152726e6f7420656e6f756768207175616e7469747960681b6044820152606401610369565b6040516301ffc9a760e01b81526001600160a01b038e16906301ffc9a7906115fd906380ac58cd60e01b9060040161242c565b60206040518083038186803b15801561161557600080fd5b505afa158015611629573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164d9190612356565b156116cf576001600160a01b038d166342842e0e8c336040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018f9052606401600060405180830381600087803b1580156116b257600080fd5b505af11580156116c6573d6000803e3d6000fd5b50505050611745565b6001600160a01b038d1663f242432a8c338f8e604051806020016040528060008152506040518663ffffffff1660e01b81526004016117129594939291906123f2565b600060405180830381600087803b15801561172c57600080fd5b505af1158015611740573d6000803e3d6000fd5b505050505b80518a14156117c757600660008e6001600160a01b03166001600160a01b0316815260200190815260200160002060008d815260200190815260200160002060008c6001600160a01b03166001600160a01b03168152602001908152602001600020600080820160009055600182016000905560028201600090555050611839565b89600660008f6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060008d6001600160a01b03166001600160a01b0316815260200190815260200160002060000160008282546118339190612553565b90915550505b7f57d8d9cd489eb6f4aa398aa92b49d164d28fde9e7000b5c186bf1b3647a9ebb78b338f8f8e86602001516040516118aa969594939291906001600160a01b03968716815294861660208601529290941660408401526060830152608082019290925260a081019190915260c00190565b60405180910390a1600260009054906101000a90046001600160a01b03166001600160a01b031663cdf229e78e8e600360009054906101000a90046001600160a01b031685602001516040518563ffffffff1660e01b815260040161193794939291906001600160a01b039485168152602081019390935292166040820152606081019190915260800190565b600060405180830381600087803b15801561195157600080fd5b505af1158015611965573d6000803e3d6000fd5b5050505061197881602001518b8d611f07565b5050600180555050505050505050505050565b6000546001600160a01b031633146119b55760405162461bcd60e51b81526004016103699061247d565b6001600160a01b03811660009081526007602052604090205460ff1615611a1e5760405162461bcd60e51b815260206004820152601760248201527f6e667420616c72656164792077686974656c69737465640000000000000000006044820152606401610369565b6001600160a01b038116600081815260076020908152604091829020805460ff1916600117905590519182527fbbf68754f1a85580419362a87907cda8f7104cfefc4cb205118366e2a2dec72891016103de565b6000546001600160a01b03163314611a9c5760405162461bcd60e51b81526004016103699061247d565b600580546001600160a01b0319166001600160a01b0383169081179091556040519081527f6632de8ab33c46549f7bb29f647ea0d751157b25fe6a14b1bcc7527cdfbeb79c906020016103de565b6000546001600160a01b03163314611b145760405162461bcd60e51b81526004016103699061247d565b6001600160a01b038116611b795760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610369565b611b8281611b85565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0380841660008181526006602090815260408083208784528252808320948616835293815290839020835160608101855281548152600182015492810192909252600201548184015291516301ffc9a760e01b81526301ffc9a790611c4c906380ac58cd60e01b9060040161242c565b60206040518083038186803b158015611c6457600080fd5b505afa158015611c78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c9c9190612356565b15611d4c576040516331a9108f60e11b81526004810184905284906001600160a01b038481169190831690636352211e9060240160206040518083038186803b158015611ce857600080fd5b505afa158015611cfc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d20919061223f565b6001600160a01b031614611d465760405162461bcd60e51b815260040161036990612454565b50611e83565b6040516301ffc9a760e01b81526001600160a01b038516906301ffc9a790611d7f90636cdb3d1360e11b9060040161242c565b60206040518083038186803b158015611d9757600080fd5b505afa158015611dab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dcf9190612356565b156107fa57805184906001600160a01b03821662fdd58e336040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024810188905260440160206040518083038186803b158015611e2d57600080fd5b505afa158015611e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e659190612391565b1015611d465760405162461bcd60e51b815260040161036990612454565b6001600160a01b03848116600081815260066020908152604080832088845282528083209487168084529482528083208381556001810184905560020192909255815193845283019190915281018490527f9ba1a3cb55ce8d63d072a886f94d2a744f50cddf82128e897d0661f5ec6231589060600160405180910390a150505050565b6000611f138385612534565b9050600061271060045483611f289190612534565b611f329190612512565b9050611f52336005546003546001600160a01b0390811692911684611f71565b610acb3384611f618486612553565b6003546001600160a01b03169291905b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611fcb908590611fd1565b50505050565b6000612026826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120a89092919063ffffffff16565b8051909150156120a357808060200190518101906120449190612356565b6120a35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610369565b505050565b60606120b784846000856120c1565b90505b9392505050565b6060824710156121225760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610369565b843b6121705760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610369565b600080866001600160a01b0316858760405161218c91906123d6565b60006040518083038185875af1925050503d80600081146121c9576040519150601f19603f3d011682016040523d82523d6000602084013e6121ce565b606091505b50915091506121de8282866121e9565b979650505050505050565b606083156121f85750816120ba565b8251156122085782518084602001fd5b8160405162461bcd60e51b81526004016103699190612441565b60006020828403121561223457600080fd5b81356120ba816125ac565b60006020828403121561225157600080fd5b81516120ba816125ac565b6000806040838503121561226f57600080fd5b823561227a816125ac565b946020939093013593505050565b60008060006060848603121561229d57600080fd5b83356122a8816125ac565b92506020840135915060408401356122bf816125ac565b809150509250925092565b600080600080608085870312156122e057600080fd5b84356122eb816125ac565b9350602085013592506040850135612302816125ac565b9396929550929360600135925050565b600080600080600060a0868803121561232a57600080fd5b8535612335816125ac565b97602087013597506040870135966060810135965060800135945092505050565b60006020828403121561236857600080fd5b815180151581146120ba57600080fd5b60006020828403121561238a57600080fd5b5035919050565b6000602082840312156123a357600080fd5b5051919050565b600081518084526123c281602086016020860161256a565b601f01601f19169290920160200192915050565b600082516123e881846020870161256a565b9190910192915050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a0608082018190526000906121de908301846123aa565b6001600160e01b031991909116815260200190565b6020815260006120ba60208301846123aa565b6020808252600f908201526e6e6f74206f776e696e67206974656d60881b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600f908201526e6e6f74206c6973746564206974656d60881b604082015260600190565b60008261252f57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561254e5761254e612596565b500290565b60008282101561256557612565612596565b500390565b60005b8381101561258557818101518382015260200161256d565b83811115611fcb5750506000910152565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611b8257600080fdfea2646970667358221220d39e4c1aca951f23a08de23969e963b6a257e3de334b62c63d9970f8f191427064736f6c634300080700334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657200000000000000000000000000000000000000000000000000000000000001f4000000000000000000000000db6ab450178babcf0e467c1f3b436050d907e23300000000000000000000000048d0a85e5a79f043c1721dd4e13f2418287c8d45000000000000000000000000539bde0d7dbd336b79148aa742883198bbf60342

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.