Contract 0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x5caebdfbb3cd39cc0ae46cab566556f4d296571fd6b99ff2b7fe3d682b8f5111Create Offer283914962023-04-06 12:01:3156 days 7 hrs ago0x7a4f37457af752b432d3cd99a950a23157ca1eac IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0x5ec9c03e7ab1c2ff20f562cc2ee1222c3e44fbfc0ef0e4ceab8b93c07c026947Create Offer282626932023-04-03 11:48:0159 days 7 hrs ago0x9a411e810cc44b7df4e3a50c436404c01c2e0866 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.005455268 26
0x410f64caeeaef5cc07e24c31aadce74a118f84397f07988aefe840931aa881c4Create Offer279053902023-03-25 22:40:5967 days 20 hrs ago0x389ef0f330bd149486d44c2171dfa5be2ba3f48d IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0x83e2420337cca948106f6b24ae53acbc1fc89949d401ad0c39f653fdaf02579dAccept Offer278345632023-03-24 5:36:2369 days 13 hrs ago0x5b187c84b31c243202959ab4b54f8396e5dbaf32 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00708339 30
0x59d33ddcbe66a5545ddfb37a338b697f8e2f9bc4e5486dbb648f15f7827a851bCreate Offer278107322023-03-23 15:36:4370 days 3 hrs ago0x8553e24b9eb99c21ea96a3e167cf4b8c75fb345c IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0xd1d0029a1913585f917e3a1755888adb02e278224479f9cc68df9aedcdaa603eCreate Offer277173462023-03-21 7:33:4772 days 11 hrs ago0x727a10ae1afc91754d357b4748f6d793c9795026 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0x41aec7241368ff040ca999238bfefccfee4ecd3d1a7fdbccc76d29680c65b731Create Offer277007102023-03-20 22:12:0672 days 21 hrs ago0x8553e24b9eb99c21ea96a3e167cf4b8c75fb345c IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0xd79fb1c39bdbaa0fadb6faa9c96a768d35b27b9ff6eb9f1638578d244b18fc16Cancel Offer276900832023-03-20 16:16:1573 days 3 hrs ago0x9a411e810cc44b7df4e3a50c436404c01c2e0866 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.002218617 27
0x69c0c5947a141867889b1eab64dd4b2815f7ea2d4195a77a09528f5ac51be68bAccept Offer276858992023-03-20 13:55:4773 days 5 hrs ago0x2fb340bbde32ce2696e066b0089a99fe461d7368 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00587244 30
0xc04afebbe59893c487c6c3588a4e1083ed8e897dd5a8f938eaa827f0aaf336e5Accept Offer276858822023-03-20 13:55:1373 days 5 hrs ago0x2fb340bbde32ce2696e066b0089a99fe461d7368 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00587244 30
0x581b3f5bcdbb0a5105d5e75ffbb28fc9af2aca8093d8cff32031d446096ac084Accept Offer276858672023-03-20 13:54:4373 days 5 hrs ago0x2fb340bbde32ce2696e066b0089a99fe461d7368 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00638544 30
0x597f63d5401d938a205901fde8254cc83a43149954d972d0895511b794274339Create Offer276606172023-03-19 23:46:1273 days 19 hrs ago0x8553e24b9eb99c21ea96a3e167cf4b8c75fb345c IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0x19bd4ad90201ebf5efff667de35c69830942dea5f8648efb4fd37f96dc9b3b14Create Offer276140122023-03-18 21:40:1574 days 21 hrs ago0xeb26a91cc4e93a2f8be8ae0ac982824e18f6818b IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00629454 30
0x35163f2da0d198474075d2512c4f05af1833ba300d854a4e7ce6dfaaa933fab2Accept Offer274508502023-03-15 1:40:3478 days 17 hrs ago0xdee3366e3e650ba12f2802b6c21a6cfbc2113391 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00716958 30
0xb2d81f5713bad5e8a2eac23e2b18d5d0acca6b020e6a31039aa18ccc53833d28Create Offer272689472023-03-10 19:56:1782 days 23 hrs ago0x8553e24b9eb99c21ea96a3e167cf4b8c75fb345c IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.0062949 30
0xaf4dde58675c0357b99698d381c5ce57d14f5428f9b37d084904fdd740ccb1d2Cancel Offer272648462023-03-10 17:38:3883 days 1 hr ago0xa2180a0a4a4245c48cfa2bac8b67f327fa5055fd IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00206649 30
0xb8dbf81175fad861cae78fd040e3136f4b350e3ae5d6ba0272fca06618b41308Create Offer270681462023-03-06 0:11:5787 days 19 hrs ago0x66a31e1d6ce7af0bd22036ecfd87f4e359e0afa8 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00680754 30
0xe94b17949e78de418d4f2481a5696684d9ed1684f489aac9ed025521d280f860Create Offer269937942023-03-04 4:07:5889 days 15 hrs ago0xa2180a0a4a4245c48cfa2bac8b67f327fa5055fd IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.0062630673 29.85
0x9265a73fed7cd3d3e4064369abe6f68a6b21581cea131a5852de1d6432cfa34cCancel Offer269936882023-03-04 4:03:4089 days 15 hrs ago0xa2180a0a4a4245c48cfa2bac8b67f327fa5055fd IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00185416504 26.9176
0x899c24dfb1af65efd19df9fd5d29526e317b5f3ac73a0ef7228a6dcff7263edcCreate Offer269543972023-03-03 5:28:2390 days 13 hrs ago0xa2180a0a4a4245c48cfa2bac8b67f327fa5055fd IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.005455268 26
0x86e3b4c85d90e35444ccb66651ad2e9289c1f0c114feac88713a22209c351861Accept Offer267195312023-02-25 14:20:3196 days 4 hrs ago0x4e1c696c99810a7301690799e7d8e60982de3362 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00701862 30
0x2f9ed522557c84290a1c2e2ad8ee40e6926a2fb84a7a3cc3305d21bdff277c2fCancel Offer262740022023-02-15 4:03:09106 days 15 hrs ago0xc4d1356818314af3dce6d6471c774c8e712dd950 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00206649 30
0xee5c3a51bf5d8d2fe2c5973421edaaf65a1d60a1a6c5137a1f8380f9514da3d1Cancel Offer262739972023-02-15 4:03:00106 days 15 hrs ago0xc4d1356818314af3dce6d6471c774c8e712dd950 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00206649 30
0x9897842ec2ce9b7ddbdcda6b413e183efa62704058245f7a19a0e7899895c4c8Cancel Offer262739952023-02-15 4:02:56106 days 15 hrs ago0xc4d1356818314af3dce6d6471c774c8e712dd950 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00206649 30
0x7ea760ae1b440f92341910636bcd6b569f58ec5fce0ea45e62eface8a2abe3acCancel Offer262739932023-02-15 4:02:52106 days 15 hrs ago0xc4d1356818314af3dce6d6471c774c8e712dd950 IN  0x4b8831c5f0ed3b9e2a4e4b9e9e3efc95e0faa1ac0 AVAX0.00238113 30
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NFTKEYGlobalOffer

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
File 1 of 13 : NFTKEYGlobalOffer.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "./interface/INFTKEYGlobalOffer.sol";
import "./interface/INFTKEYMarketplaceRoyalty.sol";

/**
 * @title NFTKEY Global offer contract V1
 * Note: Payment tokens usually is the chain native coin's wrapped token, e.g. WETH, WBNB
 */
contract NFTKEYGlobalOffer is INFTKEYGlobalOffer, Ownable, ReentrancyGuard {
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableSet for EnumerableSet.AddressSet;
    using SafeERC20 for IERC20;

    constructor(address _marketplaceAddress, address _paymentTokenAddress) {
        _marketplace = INFTKEYMarketplaceRoyalty(_marketplaceAddress);
        _paymentToken = IERC20(_paymentTokenAddress);
    }

    IERC20 private immutable _paymentToken;
    INFTKEYMarketplaceRoyalty private immutable _marketplace;

    bool private _isTradingEnabled = true;
    uint8 private _serviceFeeFraction = 20;
    uint256 private _actionTimeOutRangeMin = 600; // 10 mins
    uint256 private _actionTimeOutRangeMax = 31536000; // One year

    uint256 private _currentOfferId = 0;

    mapping(address => CollectionOffers) private _erc721Offers;

    /**
     * @dev only if offer is enabled
     * This is to help contract migration in case of upgrading contract
     */
    modifier onlyTradingOpen() {
        require(_isTradingEnabled, "Listing and bid are not enabled");
        _;
    }

    /**
     * @dev only if the entered timestamp is within the allowed range
     * This helps to not offer for too short or too long period of time
     */
    modifier onlyAllowedExpireTimestamp(uint256 expireTimestamp) {
        require(
            expireTimestamp - block.timestamp >= _actionTimeOutRangeMin,
            "Please enter a longer period of time"
        );
        require(
            expireTimestamp - block.timestamp <= _actionTimeOutRangeMax,
            "Please enter a shorter period of time"
        );
        _;
    }

    /**
     * @dev See {INFTKEYGlobalOffer-createOffer}.
     */
    function createOffer(
        address erc721Address,
        uint256 value,
        uint256 amount,
        uint256 expireTimestamp
    )
        external
        override
        onlyTradingOpen
        onlyAllowedExpireTimestamp(expireTimestamp)
    {
        uint256 offerId = _currentOfferId;

        Offer memory offer = Offer({
            offerId: offerId,
            value: value,
            from: msg.sender,
            amount: amount,
            fulfilledAmount: 0,
            expireTimestamp: expireTimestamp
        });

        require(value > 0, "Offer value cannot be 0");
        require(amount > 0, "Offer amount cannot be 0");

        OfferStatus memory offerStatus = _getOfferStatus(offer);

        require(
            offerStatus.availableAmount == amount,
            "Not enough balance or allowance to make this offer"
        );

        _erc721Offers[erc721Address].offerIds.add(offerId);
        _erc721Offers[erc721Address].offers[offerId] = offer;

        _currentOfferId++;

        emit OfferCreated(erc721Address, msg.sender, offer);
    }

    /**
     * @dev See {INFTKEYGlobalOffer-cancelOffer}.
     */
    function cancelOffer(address erc721Address, uint256 offerId)
        external
        override
    {
        Offer memory offer = _erc721Offers[erc721Address].offers[offerId];

        require(
            offer.from == msg.sender,
            "This address is not the creator of this offer"
        );

        _removeOffer(erc721Address, offerId);

        emit OfferCancelled(erc721Address, msg.sender, offer);
    }

    /**
     * @dev See {INFTKEYGlobalOffer-acceptOffer}.
     */
    function acceptOffer(
        address erc721Address,
        uint256 offerId,
        uint256 tokenId
    ) external override onlyTradingOpen nonReentrant {
        require(
            _isTokenOwner(erc721Address, tokenId, msg.sender),
            "Only token owner can accept bid of token"
        );
        require(
            _isTokenApproved(erc721Address, tokenId) ||
                _isAllTokenApproved(erc721Address, msg.sender),
            "The token is not approved to transfer by the contract"
        );

        Offer memory offer = _erc721Offers[erc721Address].offers[offerId];
        OfferStatus memory offerStatus = _getOfferStatus(offer);

        require(
            offerStatus.availableAmount > 0,
            "There's no available offer to accept"
        );

        address _royaltyRecipient = _marketplace
            .royalty(erc721Address)
            .recipient;
        (uint256 _serviceFee, uint256 _royaltyFee) = _calculateFees(
            erc721Address,
            offer.value
        );

        _paymentToken.safeTransferFrom({
            from: offer.from,
            to: msg.sender,
            value: offer.value - _serviceFee - _royaltyFee
        });
        _paymentToken.safeTransferFrom({
            from: offer.from,
            to: owner(),
            value: _serviceFee
        });
        if (_royaltyRecipient != address(0) && _royaltyFee > 0) {
            _paymentToken.safeTransferFrom({
                from: offer.from,
                to: _royaltyRecipient,
                value: _royaltyFee
            });
        }

        IERC721(erc721Address).safeTransferFrom({
            from: msg.sender,
            to: offer.from,
            tokenId: tokenId
        });

        offer.fulfilledAmount = offer.fulfilledAmount + 1;

        emit OfferAccepted({
            erc721Address: erc721Address,
            from: msg.sender,
            to: offer.from,
            tokenId: tokenId,
            offer: offer,
            serviceFee: _serviceFee,
            royaltyFee: _royaltyFee
        });

        if (offer.fulfilledAmount == offer.amount) {
            _removeOffer(erc721Address, offerId);
        } else {
            _erc721Offers[erc721Address].offers[offerId] = offer;
        }
    }

    /**
     * @dev See {INFTKEYGlobalOffer-numOffers}.
     */
    function numOffers(address erc721Address)
        public
        view
        override
        returns (uint256)
    {
        return _erc721Offers[erc721Address].offerIds.length();
    }

    /**
     * @dev See {INFTKEYGlobalOffer-getOffer}.
     */
    function getOffer(address erc721Address, uint256 offerId)
        external
        view
        override
        returns (OfferStatus memory)
    {
        return _getOfferStatus(_erc721Offers[erc721Address].offers[offerId]);
    }

    /**
     * @dev See {INFTKEYGlobalOffer-getOffers}.
     */
    function getOffers(
        address erc721Address,
        uint256 from,
        uint256 size
    ) external view override returns (OfferStatus[] memory offers) {
        uint256 offersCount = numOffers(erc721Address);

        if (from < offersCount && size > 0) {
            uint256 querySize = size;
            if ((from + size) > offersCount) {
                querySize = offersCount - from;
            }
            offers = new OfferStatus[](querySize);
            for (uint256 i = 0; i < querySize; i++) {
                uint256 offerId = _erc721Offers[erc721Address].offerIds.at(
                    i + from
                );

                OfferStatus memory offer = _getOfferStatus(
                    _erc721Offers[erc721Address].offers[offerId]
                );

                offers[i] = offer;
            }
        }
    }

    /**
     * @dev Get offer current status
     */
    function _getOfferStatus(Offer memory offer)
        private
        view
        returns (OfferStatus memory offerStatus)
    {
        uint256 paymentTokenAllowance = _paymentToken.allowance(
            offer.from,
            address(this)
        );
        uint256 paymentTokenBalance = _paymentToken.balanceOf(offer.from);

        uint256 availableAmount = Math.min(
            Math.min(paymentTokenAllowance, paymentTokenBalance) / offer.value,
            offer.amount - offer.fulfilledAmount
        );

        if (offer.expireTimestamp < block.timestamp) {
            availableAmount = 0;
        }

        offerStatus = OfferStatus({
            offerId: offer.offerId,
            value: offer.value,
            from: offer.from,
            amount: offer.amount,
            fulfilledAmount: offer.fulfilledAmount,
            availableAmount: availableAmount,
            expireTimestamp: offer.expireTimestamp
        });
    }

    /**
     * @dev remove a offer of a bidder
     * @param offerId global offer id
     */
    function _removeOffer(address erc721Address, uint256 offerId) private {
        delete _erc721Offers[erc721Address].offers[offerId];
        _erc721Offers[erc721Address].offerIds.remove(offerId);
    }

    /**
     * @dev check if the account is the owner of this erc721 token
     */
    function _isTokenOwner(
        address erc721Address,
        uint256 tokenId,
        address account
    ) private view returns (bool) {
        IERC721 _erc721 = IERC721(erc721Address);
        try _erc721.ownerOf(tokenId) returns (address tokenOwner) {
            return tokenOwner == account;
        } catch {
            return false;
        }
    }

    /**
     * @dev check if this contract has approved to all of this owner's erc721 tokens
     */
    function _isAllTokenApproved(address erc721Address, address owner)
        private
        view
        returns (bool)
    {
        IERC721 _erc721 = IERC721(erc721Address);
        return _erc721.isApprovedForAll(owner, address(this));
    }

    /**
     * @dev check if this contract has approved to transfer this erc721 token
     */
    function _isTokenApproved(address erc721Address, uint256 tokenId)
        private
        view
        returns (bool)
    {
        IERC721 _erc721 = IERC721(erc721Address);
        try _erc721.getApproved(tokenId) returns (address tokenOperator) {
            return tokenOperator == address(this);
        } catch {
            return false;
        }
    }

    /**
     * @dev Calculate service fee, royalty fee and left value
     * @param value bidder address
     */
    function _calculateFees(address erc721Address, uint256 value)
        private
        view
        returns (uint256 _serviceFee, uint256 _royaltyFee)
    {
        uint256 _royaltyFeeFraction = _marketplace
            .royalty(erc721Address)
            .feeFraction;
        uint256 _baseFractions = 1000 +
            _serviceFeeFraction +
            _royaltyFeeFraction;

        _serviceFee = (value * _serviceFeeFraction) / _baseFractions;
        _royaltyFee = (value * _royaltyFeeFraction) / _baseFractions;
    }

    /**
     * @dev See {INFTKEYGlobalOffer-isTradingEnabled}.
     */
    function isTradingEnabled() external view override returns (bool) {
        return _isTradingEnabled;
    }

    /**
     * @dev Enable to disable Bids and Listing
     */
    function changeMarketplaceStatus(bool enabled) external onlyOwner {
        _isTradingEnabled = enabled;
    }

    /**
     * @dev See {INFTKEYGlobalOffer-actionTimeOutRangeMin}.
     */
    function actionTimeOutRangeMin() external view override returns (uint256) {
        return _actionTimeOutRangeMin;
    }

    /**
     * @dev See {INFTKEYGlobalOffer-actionTimeOutRangeMax}.
     */
    function actionTimeOutRangeMax() external view override returns (uint256) {
        return _actionTimeOutRangeMax;
    }

    /**
     * @dev See {INFTKEYGlobalOffer-marketplace}.
     */
    function marketplace() external view override returns (address) {
        return address(_marketplace);
    }

    /**
     * @dev See {INFTKEYGlobalOffer-paymentToken}.
     */
    function paymentToken() external view override returns (address) {
        return address(_paymentToken);
    }

    /**
     * @dev Change minimum listing and bid time range
     */
    function changeMinActionTimeLimit(uint256 timeInSec) external onlyOwner {
        _actionTimeOutRangeMin = timeInSec;
    }

    /**
     * @dev Change maximum listing and bid time range
     */
    function changeMaxActionTimeLimit(uint256 timeInSec) external onlyOwner {
        _actionTimeOutRangeMax = timeInSec;
    }

    /**
     * @dev See {INFTKEYGlobalOffer-serviceFee}.
     */
    function serviceFee() external view override returns (uint8) {
        return _serviceFeeFraction;
    }

    /**
     * @dev Change withdrawal fee percentage.
     * @param serviceFeeFraction_ Fraction of withdrawal fee based on 1000
     */
    function changeSeriveFee(uint8 serviceFeeFraction_) external onlyOwner {
        require(
            serviceFeeFraction_ <= 25,
            "Attempt to set percentage higher than 2.5%."
        );

        _serviceFeeFraction = serviceFeeFraction_;
    }
}

File 2 of 13 : INFTKEYMarketplaceRoyalty.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity =0.8.9;
pragma abicoder v2;

interface INFTKEYMarketplaceRoyalty {
    struct ERC721CollectionRoyalty {
        address recipient;
        uint256 feeFraction;
        address setBy;
    }

    // Who can set: ERC721 owner and NFTKEY owner
    event SetRoyalty(
        address indexed erc721Address,
        address indexed recipient,
        uint256 feeFraction
    );

    /**
     * @dev Royalty fee
     * @param erc721Address to read royalty
     * @return royalty information
     */
    function royalty(address erc721Address)
        external
        view
        returns (ERC721CollectionRoyalty memory);

    /**
     * @dev Royalty fee
     * @param erc721Address to read royalty
     */
    function setRoyalty(
        address erc721Address,
        address recipient,
        uint256 feeFraction
    ) external;
}

File 3 of 13 : INFTKEYGlobalOffer.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity ^0.8.0;
pragma abicoder v2;

import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

interface INFTKEYGlobalOffer {
    struct Offer {
        uint256 offerId;
        uint256 value;
        address from;
        uint256 amount;
        uint256 fulfilledAmount;
        uint256 expireTimestamp;
    }

    struct OfferStatus {
        uint256 offerId;
        uint256 value;
        address from;
        uint256 amount;
        uint256 fulfilledAmount;
        uint256 availableAmount;
        uint256 expireTimestamp;
    }

    struct CollectionOffers {
        EnumerableSet.UintSet offerIds;
        mapping(uint256 => Offer) offers;
    }

    event OfferCreated(
        address indexed erc721Address,
        address indexed from,
        Offer offer
    );
    event OfferCancelled(
        address indexed erc721Address,
        address indexed from,
        Offer offer
    );
    event OfferAccepted(
        address indexed erc721Address,
        address indexed from,
        address indexed to,
        uint256 tokenId,
        Offer offer,
        uint256 serviceFee,
        uint256 royaltyFee
    );

    /**
     * @dev Create offer
     * @param value price in payment token
     * @param amount amount of tokens to get
     * @param expireTimestamp when would this offer expire
     */
    function createOffer(
        address erc721Address,
        uint256 value,
        uint256 amount,
        uint256 expireTimestamp
    ) external;

    /**
     * @dev Cancel offer
     * @param offerId global offer id to cancel
     */
    function cancelOffer(address erc721Address, uint256 offerId) external;

    /**
     * @dev Accept a offer from a from
     * @param offerId global offer id
     * @param tokenId token ID to accept offer
     */
    function acceptOffer(
        address erc721Address,
        uint256 offerId,
        uint256 tokenId
    ) external;

    /**
     * @dev get count of offer(s)
     */
    function numOffers(address erc721Address) external view returns (uint256);

    /**
     * @dev get all valid offers of a collection
     * @param offerId global offer id
     * @return Offer status
     */
    function getOffer(address erc721Address, uint256 offerId)
        external
        view
        returns (OfferStatus memory);

    /**
     * @dev get all valid offers of a collection
     * @param from index to start
     * @param size size to query
     * @return Offers of a collection
     */
    function getOffers(
        address erc721Address,
        uint256 from,
        uint256 size
    ) external view returns (OfferStatus[] memory);

    /**
     * @dev Show if listing and bid are enabled
     */
    function isTradingEnabled() external view returns (bool);

    /**
     * @dev Surface minimum listing and bid time range
     */
    function actionTimeOutRangeMin() external view returns (uint256);

    /**
     * @dev Surface maximum listing and bid time range
     */
    function actionTimeOutRangeMax() external view returns (uint256);

    /**
     * @dev Marketplace address
     */
    function marketplace() external view returns (address);

    /**
     * @dev Payment token address
     */
    function paymentToken() external view returns (address);

    /**
     * @dev Service fee
     * @return fee fraction based on 1000
     */
    function serviceFee() external view returns (uint8);
}

File 4 of 13 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

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.
 *
 * ```
 * 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.
 */
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) {
        return _values(set._inner);
    }

    // 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;

        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 on 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;

        assembly {
            result := store
        }

        return result;
    }
}

File 5 of 13 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a >= b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a / b + (a % b == 0 ? 0 : 1);
    }
}

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

File 8 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [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://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 13 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

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 10 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

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 11 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

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 `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);

    /**
     * @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 12 of 13 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

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 making 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 13 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_marketplaceAddress","type":"address"},{"internalType":"address","name":"_paymentTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fulfilledAmount","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYGlobalOffer.Offer","name":"offer","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"serviceFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"royaltyFee","type":"uint256"}],"name":"OfferAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fulfilledAmount","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYGlobalOffer.Offer","name":"offer","type":"tuple"}],"name":"OfferCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fulfilledAmount","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYGlobalOffer.Offer","name":"offer","type":"tuple"}],"name":"OfferCreated","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"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"acceptOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"actionTimeOutRangeMax","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"actionTimeOutRangeMin","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"cancelOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"changeMarketplaceStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"timeInSec","type":"uint256"}],"name":"changeMaxActionTimeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"timeInSec","type":"uint256"}],"name":"changeMinActionTimeLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"serviceFeeFraction_","type":"uint8"}],"name":"changeSeriveFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"name":"createOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"offerId","type":"uint256"}],"name":"getOffer","outputs":[{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fulfilledAmount","type":"uint256"},{"internalType":"uint256","name":"availableAmount","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYGlobalOffer.OfferStatus","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"getOffers","outputs":[{"components":[{"internalType":"uint256","name":"offerId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"fulfilledAmount","type":"uint256"},{"internalType":"uint256","name":"availableAmount","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYGlobalOffer.OfferStatus[]","name":"offers","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isTradingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketplace","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"}],"name":"numOffers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"serviceFee","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60c06040526002805461ffff19166114011790556102586003556301e1338060045560006005553480156200003357600080fd5b5060405162002c8d38038062002c8d8339810160408190526200005691620000ea565b62000061336200007d565b600180556001600160a01b0391821660a0521660805262000122565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620000e557600080fd5b919050565b60008060408385031215620000fe57600080fd5b6200010983620000cd565b91506200011960208401620000cd565b90509250929050565b60805160a051612b14620001796000396000818161029c015281816108e20152611e750152600081816101bc015281816109b401528181610a1a01528181610a8c01528181611c2d0152611cf70152612b146000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80638201570d116100cd578063ac71045e11610081578063d898aaf211610066578063d898aaf2146102f3578063f2fde38b14610306578063f8ad6f621461031957600080fd5b8063ac71045e146102c0578063b6be53ba146102e057600080fd5b80638da5cb5b116100b25780638da5cb5b14610269578063a3c0b5f014610287578063abc8c7af1461029a57600080fd5b80638201570d1461022c5780638abdf5aa1461024c57600080fd5b80633013ce29116101245780633c6fc817116101095780633c6fc81714610209578063453dfc501461021c578063715018a61461022457600080fd5b80633013ce29146101ba57806333549d3d1461020157600080fd5b8063058a56ac14610156578063064a59d01461016b57806320782530146101865780632426fc24146101a7575b600080fd5b6101696101643660046124ae565b61032c565b005b60025460ff1660405190151581526020015b60405180910390f35b6101996101943660046124da565b6104af565b60405190815260200161017d565b6101696101b53660046124f7565b6104e3565b7f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161017d565b600354610199565b610169610217366004612510565b610569565b600454610199565b610169610cad565b61023f61023a366004612510565b610d3a565b60405161017d9190612545565b600254610100900460ff1660405160ff909116815260200161017d565b60005473ffffffffffffffffffffffffffffffffffffffff166101dc565b6101696102953660046124f7565b610f28565b7f00000000000000000000000000000000000000000000000000000000000000006101dc565b6102d36102ce3660046124ae565b610fae565b60405161017d91906125e8565b6101696102ee366004612659565b61108e565b610169610301366004612676565b611140565b6101696103143660046124da565b6115ce565b6101696103273660046126b1565b6116fe565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526006602090815260408083208584526002908101835292819020815160c0810183528154815260018201549381019390935292830154909316928101839052600382015460608201526004820154608082015260059091015460a082015290331461043b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f546869732061646472657373206973206e6f74207468652063726561746f722060448201527f6f662074686973206f666665720000000000000000000000000000000000000060648201526084015b60405180910390fd5b610445838361184c565b3373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fe00e58a69f6cab132de5a17039e571ee1d3176f4e69f579637e2b1b20623d942836040516104a291906126d4565b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526006602052604081206104dd906118df565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610564576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b600355565b60025460ff166105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c6564006044820152606401610432565b60026001541415610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610432565b60026001556106528382336118e9565b6106de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20616363657074206269642060448201527f6f6620746f6b656e0000000000000000000000000000000000000000000000006064820152608401610432565b6106e883826119ea565b806106f857506106f88333611ad2565b610784576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f54686520746f6b656e206973206e6f7420617070726f76656420746f2074726160448201527f6e736665722062792074686520636f6e747261637400000000000000000000006064820152608401610432565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260066020908152604080832086845260029081018352818420825160c081018452815481526001820154948101949094529081015490941690820152600383015460608201526004830154608082015260059092015460a083015261080582611b84565b905060008160a001511161089a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f54686572652773206e6f20617661696c61626c65206f6666657220746f20616360448201527f63657074000000000000000000000000000000000000000000000000000000006064820152608401610432565b6040517f861b69d600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063861b69d69060240160606040518083038186803b15801561092657600080fd5b505afa15801561093a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095e919061275c565b600001519050600080610975888660200151611e29565b915091506109dc85604001513383858960200151610993919061281b565b61099d919061281b565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016929190611f68565b610a428560400151610a0360005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016919085611f68565b73ffffffffffffffffffffffffffffffffffffffff831615801590610a675750600081115b15610ab4576040850151610ab49073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016908584611f68565b60408581015190517f42842e0e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101889052908916906342842e0e90606401600060405180830381600087803b158015610b3057600080fd5b505af1158015610b44573d6000803e3d6000fd5b5050506080860151610b5891506001612832565b856080018181525050846040015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fdb03fed7c7655248f143b63d07d1ba4624aeb96bab413bc67a7844debe120fe589898787604051610bdf949392919061284a565b60405180910390a4846060015185608001511415610c0657610c01888861184c565b610c9f565b73ffffffffffffffffffffffffffffffffffffffff88811660009081526006602090815260408083208b845260029081018352928190208951815591890151600183015588015191810180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169290931691909117909155606086015160038201556080860151600482015560a08601516005909101555b505060018055505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b610d386000612003565b565b60606000610d47856104af565b90508084108015610d585750600083115b15610f20578281610d698287612832565b1115610d7c57610d79858361281b565b90505b8067ffffffffffffffff811115610d9557610d9561272d565b604051908082528060200260200182016040528015610e1c57816020015b610e096040518060e001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081525090565b815260200190600190039081610db35790505b50925060005b81811015610f1d576000610e64610e398884612832565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260066020526040902090612078565b73ffffffffffffffffffffffffffffffffffffffff808a16600090815260066020908152604080832085845260029081018352818420825160c081018452815481526001820154948101949094529081015490941690820152600383015460608201526004830154608082015260059092015460a0830152919250610ee890611b84565b905080868481518110610efd57610efd6128bd565b602002602001018190525050508080610f15906128ec565b915050610e22565b50505b509392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610fa9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b600455565b6110046040518060e001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526006602090815260408083208684526002908101835292819020815160c08101835281548152600182015493810193909352928301549093169281019290925260038101546060830152600481015460808301526005015460a082015261108790611b84565b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60025460ff166111ac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c6564006044820152606401610432565b60035481906111bb428361281b565b1015611248576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d65000000000000000000000000000000000000000000000000000000006064820152608401610432565b600454611255428361281b565b11156112e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d650000000000000000000000000000000000000000000000000000006064820152608401610432565b6005546040805160c081018252828152602081018790523391810191909152606081018590526000608082015260a081018490528561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4f666665722076616c75652063616e6e6f7420626520300000000000000000006044820152606401610432565b600085116113e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4f6666657220616d6f756e742063616e6e6f74206265203000000000000000006044820152606401610432565b60006113f382611b84565b9050858160a0015114611488576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f4e6f7420656e6f7567682062616c616e6365206f7220616c6c6f77616e63652060448201527f746f206d616b652074686973206f6666657200000000000000000000000000006064820152608401610432565b73ffffffffffffffffffffffffffffffffffffffff881660009081526006602052604090206114b79084612084565b5073ffffffffffffffffffffffffffffffffffffffff888116600090815260066020908152604080832087845260029081018352818420875181559287015160018401559086015190820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169190941617909255606084015160038301556080840151600483015560a08401516005928301558154919061155a836128ec565b91905055503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fcbe7938a1c441e0b57b1956aa6906c6691fc185915fbc90f282518686475b8f1846040516115bc91906126d4565b60405180910390a35050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461164f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b73ffffffffffffffffffffffffffffffffffffffff81166116f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610432565b6116fb81612003565b50565b60005473ffffffffffffffffffffffffffffffffffffffff16331461177f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610432565b60198160ff161115611813576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f417474656d707420746f207365742070657263656e746167652068696768657260448201527f207468616e20322e35252e0000000000000000000000000000000000000000006064820152608401610432565b6002805460ff909216610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff82166000818152600660208181526040808420868552600280820184529185208581556001810186905591820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055600382018590556004820185905560059091018490559390925290526118da9082612090565b505050565b60006104dd825490565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101839052600090849073ffffffffffffffffffffffffffffffffffffffff821690636352211e9060240160206040518083038186803b15801561195457600080fd5b505afa9250505080156119a2575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261199f91810190612925565b60015b6119b0576000915050611087565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b6040517f081812fc00000000000000000000000000000000000000000000000000000000815260048101829052600090839073ffffffffffffffffffffffffffffffffffffffff82169063081812fc9060240160206040518083038186803b158015611a5557600080fd5b505afa925050508015611aa3575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252611aa091810190612925565b60015b611ab15760009150506104dd565b73ffffffffffffffffffffffffffffffffffffffff16301491506104dd9050565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152306024830152600091849182169063e985e9c59060440160206040518083038186803b158015611b4457600080fd5b505afa158015611b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b7c9190612942565b949350505050565b611bda6040518060e001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081525090565b60408281015190517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201523060248201526000917f0000000000000000000000000000000000000000000000000000000000000000169063dd62ed3e9060440160206040518083038186803b158015611c6f57600080fd5b505afa158015611c83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca7919061295f565b60408481015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201529192506000917f0000000000000000000000000000000000000000000000000000000000000000909116906370a082319060240160206040518083038186803b158015611d3b57600080fd5b505afa158015611d4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d73919061295f565b90506000611dac8560200151611d89858561209c565b611d939190612978565b86608001518760600151611da7919061281b565b61209c565b9050428560a001511015611dbe575060005b6040518060e001604052808660000151815260200186602001518152602001866040015173ffffffffffffffffffffffffffffffffffffffff16815260200186606001518152602001866080015181526020018281526020018660a001518152509350505050919050565b6040517f861b69d600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8381166004830152600091829182917f00000000000000000000000000000000000000000000000000000000000000009091169063861b69d69060240160606040518083038186803b158015611eb957600080fd5b505afa158015611ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ef1919061275c565b602001516002549091506000908290611f1490610100900460ff166103e86129b3565b61ffff16611f229190612832565b6002549091508190611f3c90610100900460ff16876129d9565b611f469190612978565b935080611f5383876129d9565b611f5d9190612978565b925050509250929050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052611ffd9085906120b2565b50505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061108783836121be565b600061108783836121e8565b60006110878383612237565b60008183106120ab5781611087565b5090919050565b6000612114826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661232a9092919063ffffffff16565b8051909150156118da57808060200190518101906121329190612942565b6118da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610432565b60008260000182815481106121d5576121d56128bd565b9060005260206000200154905092915050565b600081815260018301602052604081205461222f575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556104dd565b5060006104dd565b6000818152600183016020526040812054801561232057600061225b60018361281b565b855490915060009061226f9060019061281b565b90508181146122d457600086600001828154811061228f5761228f6128bd565b90600052602060002001549050808760000184815481106122b2576122b26128bd565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806122e5576122e5612a16565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506104dd565b60009150506104dd565b6060611b7c84846000858573ffffffffffffffffffffffffffffffffffffffff85163b6123b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610432565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516123dc9190612a71565b60006040518083038185875af1925050503d8060008114612419576040519150601f19603f3d011682016040523d82523d6000602084013e61241e565b606091505b509150915061242e828286612439565b979650505050505050565b60608315612448575081611087565b8251156124585782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104329190612a8d565b73ffffffffffffffffffffffffffffffffffffffff811681146116fb57600080fd5b600080604083850312156124c157600080fd5b82356124cc8161248c565b946020939093013593505050565b6000602082840312156124ec57600080fd5b81356110878161248c565b60006020828403121561250957600080fd5b5035919050565b60008060006060848603121561252557600080fd5b83356125308161248c565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b818110156125dc576125c9838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c08301525050565b9284019260e09290920191600101612561565b50909695505050505050565b60e081016104dd8284805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c08301525050565b80151581146116fb57600080fd5b60006020828403121561266b57600080fd5b81356110878161264b565b6000806000806080858703121561268c57600080fd5b84356126978161248c565b966020860135965060408601359560600135945092505050565b6000602082840312156126c357600080fd5b813560ff8116811461108757600080fd5b60c081016104dd8284805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301526080810151608083015260a081015160a08301525050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006060828403121561276e57600080fd5b6040516060810181811067ffffffffffffffff821117156127b8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405282516127c68161248c565b81526020838101519082015260408301516127e08161248c565b60408201529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008282101561282d5761282d6127ec565b500390565b60008219821115612845576128456127ec565b500190565b84815261012081016128aa6020830186805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301526080810151608083015260a081015160a08301525050565b60e0820193909352610100015292915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561291e5761291e6127ec565b5060010190565b60006020828403121561293757600080fd5b81516110878161248c565b60006020828403121561295457600080fd5b81516110878161264b565b60006020828403121561297157600080fd5b5051919050565b6000826129ae577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600061ffff8083168185168083038211156129d0576129d06127ec565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612a1157612a116127ec565b500290565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015612a60578181015183820152602001612a48565b83811115611ffd5750506000910152565b60008251612a83818460208701612a45565b9190910192915050565b6020815260008251806020840152612aac816040850160208701612a45565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220cc616587494f449a4e4a4b5b7b4c45302b214350397ab59f5b4aa698933f268864736f6c634300080900330000000000000000000000001a7d6ed890b6c284271ad27e7abe8fb5211d0739000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7

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

0000000000000000000000001a7d6ed890b6c284271ad27e7abe8fb5211d0739000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7

-----Decoded View---------------
Arg [0] : _marketplaceAddress (address): 0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739
Arg [1] : _paymentTokenAddress (address): 0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001a7d6ed890b6c284271ad27e7abe8fb5211d0739
Arg [1] : 000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7


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