POL Price: $0.218105 (-0.86%)
Gas: 30 GWei
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Buy Token467499072023-08-25 20:31:58606 days ago1692995518IN
0x74a1FAa4...A34bb5EB2
2.5 POL0.0167922394.89065818
Buy Token467499032023-08-25 20:31:48606 days ago1692995508IN
0x74a1FAa4...A34bb5EB2
2.5 POL0.0141870692.01865911
Buy Token467498962023-08-25 20:31:34606 days ago1692995494IN
0x74a1FAa4...A34bb5EB2
2.5 POL0.0160380390.62879259
Buy Token467495462023-08-25 20:18:38606 days ago1692994718IN
0x74a1FAa4...A34bb5EB2
2 POL0.0166008698.04319291
Buy Token463889022023-08-16 20:10:08615 days ago1692216608IN
0x74a1FAa4...A34bb5EB2
4 POL0.0126433374.67037439
Buy Token463888972023-08-16 20:09:58615 days ago1692216598IN
0x74a1FAa4...A34bb5EB2
2 POL0.0106119462.6731899
Buy Token463888592023-08-16 20:08:36615 days ago1692216516IN
0x74a1FAa4...A34bb5EB2
2 POL0.0134944279.69684392
Buy Token463888452023-08-16 20:08:06615 days ago1692216486IN
0x74a1FAa4...A34bb5EB2
2 POL0.0126784174.8775353
Buy Token462804232023-08-14 3:14:10618 days ago1691982850IN
0x74a1FAa4...A34bb5EB2
2 POL0.01738921102.69906837
Buy Token454011702023-07-22 23:49:08640 days ago1690069748IN
0x74a1FAa4...A34bb5EB2
4 POL0.02164678122.32310865
Delist Token451985982023-07-17 19:23:30645 days ago1689621810IN
0x74a1FAa4...A34bb5EB2
0 POL0.00702842122
Buy Token451136442023-07-15 15:52:05647 days ago1689436325IN
0x74a1FAa4...A34bb5EB2
0.6 POL0.03016734166
Buy Token451132822023-07-15 15:39:17647 days ago1689435557IN
0x74a1FAa4...A34bb5EB2
0.6 POL0.02139226127
Buy Token450910832023-07-15 2:16:46648 days ago1689387406IN
0x74a1FAa4...A34bb5EB2
59 POL0.02321747136.06910011
Delist Token446233592023-07-03 6:21:32660 days ago1688365292IN
0x74a1FAa4...A34bb5EB2
0 POL0.01146638199
Buy Token443396222023-06-26 0:01:19667 days ago1687737679IN
0x74a1FAa4...A34bb5EB2
2 POL0.02699231163
Buy Token443396132023-06-26 0:00:59667 days ago1687737659IN
0x74a1FAa4...A34bb5EB2
1 POL0.02583313156
Buy Token443396042023-06-26 0:00:41667 days ago1687737641IN
0x74a1FAa4...A34bb5EB2
1 POL0.02562499165
Buy Token443395892023-06-26 0:00:09667 days ago1687737609IN
0x74a1FAa4...A34bb5EB2
1 POL0.02899721163
Buy Token443061492023-06-25 3:23:33668 days ago1687663413IN
0x74a1FAa4...A34bb5EB2
2 POL0.03482555195.76249003
Delist Token439258022023-06-15 4:09:03678 days ago1686802143IN
0x74a1FAa4...A34bb5EB2
0 POL0.01452024252
Buy Token435376442023-06-05 0:09:51688 days ago1685923791IN
0x74a1FAa4...A34bb5EB2
2.5 POL0.030544184
Buy Token432832682023-05-29 9:31:56694 days ago1685352716IN
0x74a1FAa4...A34bb5EB2
2.5 POL0.03565057202
Delist Token432238372023-05-27 21:16:06696 days ago1685222166IN
0x74a1FAa4...A34bb5EB2
0 POL0.00770956133.80010871
Buy Token431571882023-05-26 4:37:30698 days ago1685075850IN
0x74a1FAa4...A34bb5EB2
3 POL0.02698113165
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
467499072023-08-25 20:31:58606 days ago1692995518
0x74a1FAa4...A34bb5EB2
0.18181818 POL
467499072023-08-25 20:31:58606 days ago1692995518
0x74a1FAa4...A34bb5EB2
0.04545454 POL
467499072023-08-25 20:31:58606 days ago1692995518
0x74a1FAa4...A34bb5EB2
2.27272727 POL
467499032023-08-25 20:31:48606 days ago1692995508
0x74a1FAa4...A34bb5EB2
0.18181818 POL
467499032023-08-25 20:31:48606 days ago1692995508
0x74a1FAa4...A34bb5EB2
0.04545454 POL
467499032023-08-25 20:31:48606 days ago1692995508
0x74a1FAa4...A34bb5EB2
2.27272727 POL
467498962023-08-25 20:31:34606 days ago1692995494
0x74a1FAa4...A34bb5EB2
0.18181818 POL
467498962023-08-25 20:31:34606 days ago1692995494
0x74a1FAa4...A34bb5EB2
0.04545454 POL
467498962023-08-25 20:31:34606 days ago1692995494
0x74a1FAa4...A34bb5EB2
2.27272727 POL
467495462023-08-25 20:18:38606 days ago1692994718
0x74a1FAa4...A34bb5EB2
0.03846153 POL
467495462023-08-25 20:18:38606 days ago1692994718
0x74a1FAa4...A34bb5EB2
0.03846153 POL
467495462023-08-25 20:18:38606 days ago1692994718
0x74a1FAa4...A34bb5EB2
1.92307692 POL
463889022023-08-16 20:10:08615 days ago1692216608
0x74a1FAa4...A34bb5EB2
0.07692307 POL
463889022023-08-16 20:10:08615 days ago1692216608
0x74a1FAa4...A34bb5EB2
0.07692307 POL
463889022023-08-16 20:10:08615 days ago1692216608
0x74a1FAa4...A34bb5EB2
3.84615384 POL
463888972023-08-16 20:09:58615 days ago1692216598
0x74a1FAa4...A34bb5EB2
0.03846153 POL
463888972023-08-16 20:09:58615 days ago1692216598
0x74a1FAa4...A34bb5EB2
0.03846153 POL
463888972023-08-16 20:09:58615 days ago1692216598
0x74a1FAa4...A34bb5EB2
1.92307692 POL
463888592023-08-16 20:08:36615 days ago1692216516
0x74a1FAa4...A34bb5EB2
0.03846153 POL
463888592023-08-16 20:08:36615 days ago1692216516
0x74a1FAa4...A34bb5EB2
0.03846153 POL
463888592023-08-16 20:08:36615 days ago1692216516
0x74a1FAa4...A34bb5EB2
1.92307692 POL
463888452023-08-16 20:08:06615 days ago1692216486
0x74a1FAa4...A34bb5EB2
0.03846153 POL
463888452023-08-16 20:08:06615 days ago1692216486
0x74a1FAa4...A34bb5EB2
0.03846153 POL
463888452023-08-16 20:08:06615 days ago1692216486
0x74a1FAa4...A34bb5EB2
1.92307692 POL
462804232023-08-14 3:14:10618 days ago1691982850
0x74a1FAa4...A34bb5EB2
0.03846153 POL
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NFTKEYMarketplaceV2

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 999999 runs

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

pragma solidity =0.8.9;
pragma abicoder v2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.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/INFTKEYMarketplaceV2.sol";
import "./NFTKEYMarketplaceRoyalty.sol";

/**
 * @title NFTKEY Marketplace contract V2
 * Note: Payment tokens usually is the chain native coin's wrapped token, e.g. WETH, WBNB
 */
contract NFTKEYMarketplaceV2 is
    INFTKEYMarketplaceV2,
    Ownable,
    NFTKEYMarketplaceRoyalty,
    ReentrancyGuard
{
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableSet for EnumerableSet.AddressSet;
    using SafeERC20 for IERC20;

    constructor(address _paymentTokenAddress) {
        _paymentToken = IERC20(_paymentTokenAddress);
    }

    IERC20 private immutable _paymentToken;

    bool private _isTradingEnabled = true;
    uint8 private _serviceFeeFraction = 20;
    uint256 private _actionTimeOutRangeMin = 1800; // 30 mins
    uint256 private _actionTimeOutRangeMax = 31536000; // One year - This can extend by owner is contract is working smoothly

    mapping(address => ERC721Market) private _erc721Market;

    /**
     * @dev only if listing and bid 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 list or bid 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 {INFTKEYMarketplaceV2-listToken}.
     * The timestamp set needs to be in the allowed range
     * Listing must be valid
     */
    function listToken(
        address erc721Address,
        uint256 tokenId,
        uint256 value,
        uint256 expireTimestamp
    )
        external
        override
        onlyTradingOpen
        onlyAllowedExpireTimestamp(expireTimestamp)
    {
        Listing memory listing = Listing({
            tokenId: tokenId,
            value: value,
            seller: msg.sender,
            expireTimestamp: expireTimestamp
        });

        require(
            _isListingValid(erc721Address, listing),
            "Listing is not valid"
        );

        _erc721Market[erc721Address].listings[tokenId] = listing;
        _erc721Market[erc721Address].tokenIdWithListing.add(tokenId);

        emit TokenListed(erc721Address, tokenId, listing);
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-delistToken}.
     * msg.sender must be the seller of the listing record
     */
    function delistToken(address erc721Address, uint256 tokenId)
        external
        override
    {
        require(
            _erc721Market[erc721Address].listings[tokenId].seller == msg.sender,
            "Only token seller can delist token"
        );

        emit TokenDelisted(
            erc721Address,
            tokenId,
            _erc721Market[erc721Address].listings[tokenId]
        );

        _delistToken(erc721Address, tokenId);
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-buyToken}.
     * Must have a valid listing
     * msg.sender must not the owner of token
     * msg.value must be at least sell price plus fees
     */
    function buyToken(address erc721Address, uint256 tokenId)
        external
        payable
        override
        nonReentrant
    {
        Listing memory listing = _erc721Market[erc721Address].listings[tokenId];
        require(
            _isListingValid(erc721Address, listing),
            "Token is not for sale"
        );
        require(
            !_isTokenOwner(erc721Address, tokenId, msg.sender),
            "Token owner can't buy their own token"
        );
        require(
            msg.value >= listing.value,
            "The value send is below sale price"
        );

        (uint256 _serviceFee, uint256 _royaltyFee) = _calculateFees(
            erc721Address,
            listing.value
        );

        Address.sendValue(
            payable(listing.seller),
            msg.value - _serviceFee - _royaltyFee
        );
        Address.sendValue(payable(owner()), _serviceFee);

        address _royaltyRecipient = royalty(erc721Address).recipient;
        if (_royaltyRecipient != address(0) && _royaltyFee > 0) {
            Address.sendValue(payable(_royaltyRecipient), _royaltyFee);
        }

        // Send token to buyer
        emit TokenBought({
            erc721Address: erc721Address,
            tokenId: tokenId,
            buyer: msg.sender,
            listing: listing,
            serviceFee: _serviceFee,
            royaltyFee: _royaltyFee
        });

        IERC721(erc721Address).safeTransferFrom(
            listing.seller,
            msg.sender,
            tokenId
        );

        // Remove token listing
        _delistToken(erc721Address, tokenId);
        _removeBidOfBidder(erc721Address, tokenId, msg.sender);
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-enterBidForToken}.
     * People can only enter bid if bid is valid
     */
    function enterBidForToken(
        address erc721Address,
        uint256 tokenId,
        uint256 value,
        uint256 expireTimestamp
    )
        external
        override
        onlyTradingOpen
        onlyAllowedExpireTimestamp(expireTimestamp)
    {
        Bid memory bid = Bid(tokenId, value, msg.sender, expireTimestamp);

        require(_isBidValid(erc721Address, bid), "Bid is not valid");

        _erc721Market[erc721Address].tokenIdWithBid.add(tokenId);
        _erc721Market[erc721Address].bids[tokenId].bidders.add(msg.sender);
        _erc721Market[erc721Address].bids[tokenId].bids[msg.sender] = bid;

        emit TokenBidEntered(erc721Address, tokenId, bid);
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-withdrawBidForToken}.
     * There must be a bid exists
     * remove this bid record
     */
    function withdrawBidForToken(address erc721Address, uint256 tokenId)
        external
        override
    {
        Bid memory bid = _erc721Market[erc721Address].bids[tokenId].bids[
            msg.sender
        ];
        require(
            bid.bidder == msg.sender,
            "This address doesn't have bid on this token"
        );

        emit TokenBidWithdrawn(erc721Address, tokenId, bid);
        _removeBidOfBidder(erc721Address, tokenId, msg.sender);
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-acceptBidForToken}.
     * Must be owner of this token
     * Must have approved this contract to transfer token
     * Must have a valid existing bid that matches
     */
    function acceptBidForToken(
        address erc721Address,
        uint256 tokenId,
        address bidder,
        uint256 value
    ) external override 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"
        );

        Bid memory existingBid = getBidderTokenBid(
            erc721Address,
            tokenId,
            bidder
        );
        require(
            existingBid.tokenId == tokenId &&
                existingBid.value == value &&
                existingBid.bidder == bidder,
            "This token doesn't have a matching bid"
        );

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

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

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

        emit TokenBidAccepted({
            erc721Address: erc721Address,
            tokenId: tokenId,
            seller: msg.sender,
            bid: existingBid,
            serviceFee: _serviceFee,
            royaltyFee: _royaltyFee
        });

        // Remove token listing
        _delistToken(erc721Address, tokenId);
        _removeBidOfBidder(erc721Address, tokenId, existingBid.bidder);
    }

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

    /**
     * @dev See {INFTKEYMarketplaceV2-getTokenListing}.
     */
    function getTokenListing(address erc721Address, uint256 tokenId)
        public
        view
        override
        returns (Listing memory validListing)
    {
        Listing memory listing = _erc721Market[erc721Address].listings[tokenId];
        if (_isListingValid(erc721Address, listing)) {
            validListing = listing;
        }
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-numTokenListings}.
     */
    function numTokenListings(address erc721Address)
        public
        view
        override
        returns (uint256)
    {
        return _erc721Market[erc721Address].tokenIdWithListing.length();
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-getTokenListings}.
     */
    function getTokenListings(
        address erc721Address,
        uint256 from,
        uint256 size
    ) public view override returns (Listing[] memory listings) {
        uint256 listingsCount = numTokenListings(erc721Address);

        if (from < listingsCount && size > 0) {
            uint256 querySize = size;
            if ((from + size) > listingsCount) {
                querySize = listingsCount - from;
            }
            listings = new Listing[](querySize);
            for (uint256 i = 0; i < querySize; i++) {
                uint256 tokenId = _erc721Market[erc721Address]
                    .tokenIdWithListing
                    .at(i + from);
                Listing memory listing = _erc721Market[erc721Address].listings[
                    tokenId
                ];
                if (_isListingValid(erc721Address, listing)) {
                    listings[i] = listing;
                }
            }
        }
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-getBidderTokenBid}.
     */
    function getBidderTokenBid(
        address erc721Address,
        uint256 tokenId,
        address bidder
    ) public view override returns (Bid memory validBid) {
        Bid memory bid = _erc721Market[erc721Address].bids[tokenId].bids[
            bidder
        ];
        if (_isBidValid(erc721Address, bid)) {
            validBid = bid;
        }
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-getTokenBids}.
     */
    function getTokenBids(address erc721Address, uint256 tokenId)
        external
        view
        override
        returns (Bid[] memory bids)
    {
        uint256 bidderCount = _erc721Market[erc721Address]
            .bids[tokenId]
            .bidders
            .length();

        bids = new Bid[](bidderCount);
        for (uint256 i; i < bidderCount; i++) {
            address bidder = _erc721Market[erc721Address]
                .bids[tokenId]
                .bidders
                .at(i);
            Bid memory bid = _erc721Market[erc721Address].bids[tokenId].bids[
                bidder
            ];
            if (_isBidValid(erc721Address, bid)) {
                bids[i] = bid;
            }
        }
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-getTokenHighestBid}.
     */
    function getTokenHighestBid(address erc721Address, uint256 tokenId)
        public
        view
        override
        returns (Bid memory highestBid)
    {
        highestBid = Bid(tokenId, 0, address(0), 0);
        uint256 bidderCount = _erc721Market[erc721Address]
            .bids[tokenId]
            .bidders
            .length();
        for (uint256 i; i < bidderCount; i++) {
            address bidder = _erc721Market[erc721Address]
                .bids[tokenId]
                .bidders
                .at(i);
            Bid memory bid = _erc721Market[erc721Address].bids[tokenId].bids[
                bidder
            ];
            if (
                _isBidValid(erc721Address, bid) && bid.value > highestBid.value
            ) {
                highestBid = bid;
            }
        }
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-numTokenWithBids}.
     */
    function numTokenWithBids(address erc721Address)
        public
        view
        override
        returns (uint256)
    {
        return _erc721Market[erc721Address].tokenIdWithBid.length();
    }

    /**
     * @dev See {INFTKEYMarketplaceV2-getTokenHighestBids}.
     */
    function getTokenHighestBids(
        address erc721Address,
        uint256 from,
        uint256 size
    ) public view override returns (Bid[] memory highestBids) {
        uint256 tokenCount = numTokenWithBids(erc721Address);

        if (from < tokenCount && size > 0) {
            uint256 querySize = size;
            if ((from + size) > tokenCount) {
                querySize = tokenCount - from;
            }
            highestBids = new Bid[](querySize);
            for (uint256 i = 0; i < querySize; i++) {
                highestBids[i] = getTokenHighestBid({
                    erc721Address: erc721Address,
                    tokenId: _erc721Market[erc721Address].tokenIdWithBid.at(
                        i + from
                    )
                });
            }
        }
    }

    function getBidderBids(
        address erc721Address,
        address bidder,
        uint256 from,
        uint256 size
    ) external view override returns (Bid[] memory bidderBids) {
        uint256 tokenCount = numTokenWithBids(erc721Address);

        if (from < tokenCount && size > 0) {
            uint256 querySize = size;
            if ((from + size) > tokenCount) {
                querySize = tokenCount - from;
            }
            bidderBids = new Bid[](querySize);
            for (uint256 i = 0; i < querySize; i++) {
                bidderBids[i] = getBidderTokenBid({
                    erc721Address: erc721Address,
                    tokenId: _erc721Market[erc721Address].tokenIdWithBid.at(
                        i + from
                    ),
                    bidder: bidder
                });
            }
        }
    }

    /**
     * @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 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 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 a listing is valid or not
     * The seller must be the owner
     * The seller must have give this contract allowance
     * The sell price must be more than 0
     * The listing mustn't be expired
     */
    function _isListingValid(address erc721Address, Listing memory listing)
        private
        view
        returns (bool isValid)
    {
        if (
            _isTokenOwner(erc721Address, listing.tokenId, listing.seller) &&
            (_isTokenApproved(erc721Address, listing.tokenId) ||
                _isAllTokenApproved(erc721Address, listing.seller)) &&
            listing.value > 0 &&
            listing.expireTimestamp > block.timestamp
        ) {
            isValid = true;
        }
    }

    /**
     * @dev Check if an bid is valid or not
     * Bidder must not be the owner
     * Bidder must have enough balance same or more than bid price
     * Bidder must give the contract allowance same or more than bid price
     * Bid price must > 0
     * Bid mustn't been expired
     */
    function _isBidValid(address erc721Address, Bid memory bid)
        private
        view
        returns (bool isValid)
    {
        if (
            !_isTokenOwner(erc721Address, bid.tokenId, bid.bidder) &&
            _paymentToken.allowance(bid.bidder, address(this)) >= bid.value &&
            _paymentToken.balanceOf(bid.bidder) >= bid.value &&
            bid.value > 0 &&
            bid.expireTimestamp > block.timestamp
        ) {
            isValid = true;
        }
    }

    /**
     * @dev delist a token - remove token id record and remove listing from mapping
     * @param tokenId erc721 token Id
     */
    function _delistToken(address erc721Address, uint256 tokenId) private {
        if (_erc721Market[erc721Address].tokenIdWithListing.contains(tokenId)) {
            delete _erc721Market[erc721Address].listings[tokenId];
            _erc721Market[erc721Address].tokenIdWithListing.remove(tokenId);
        }
    }

    /**
     * @dev remove a bid of a bidder
     * @param tokenId erc721 token Id
     * @param bidder bidder address
     */
    function _removeBidOfBidder(
        address erc721Address,
        uint256 tokenId,
        address bidder
    ) private {
        if (
            _erc721Market[erc721Address].bids[tokenId].bidders.contains(bidder)
        ) {
            // Step 1: delete the bid and the address
            delete _erc721Market[erc721Address].bids[tokenId].bids[bidder];
            _erc721Market[erc721Address].bids[tokenId].bidders.remove(bidder);

            // Step 2: if no bid left
            if (
                _erc721Market[erc721Address].bids[tokenId].bidders.length() == 0
            ) {
                _erc721Market[erc721Address].tokenIdWithBid.remove(tokenId);
            }
        }
    }

    /**
     * @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 = royalty(erc721Address).feeFraction;
        uint256 _baseFractions = 1000 +
            _serviceFeeFraction +
            _royaltyFeeFraction;

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

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

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

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

    /**
     * @dev See {INFTKEYMarketplaceV2-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 {INFTKEYMarketplaceV2-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 : INFTKEYMarketplaceV2.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity =0.8.9;
pragma abicoder v2;

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

interface INFTKEYMarketplaceV2 {
    struct Listing {
        uint256 tokenId;
        uint256 value;
        address seller;
        uint256 expireTimestamp;
    }

    struct Bid {
        uint256 tokenId;
        uint256 value;
        address bidder;
        uint256 expireTimestamp;
    }

    struct TokenBids {
        EnumerableSet.AddressSet bidders;
        mapping(address => Bid) bids;
    }

    struct ERC721Market {
        EnumerableSet.UintSet tokenIdWithListing;
        mapping(uint256 => Listing) listings;
        EnumerableSet.UintSet tokenIdWithBid;
        mapping(uint256 => TokenBids) bids;
    }

    event TokenListed(
        address indexed erc721Address,
        uint256 indexed tokenId,
        Listing listing
    );
    event TokenDelisted(
        address indexed erc721Address,
        uint256 indexed tokenId,
        Listing listing
    );
    event TokenBidEntered(
        address indexed erc721Address,
        uint256 indexed tokenId,
        Bid bid
    );
    event TokenBidWithdrawn(
        address indexed erc721Address,
        uint256 indexed tokenId,
        Bid bid
    );
    event TokenBought(
        address indexed erc721Address,
        uint256 indexed tokenId,
        address indexed buyer,
        Listing listing,
        uint256 serviceFee,
        uint256 royaltyFee
    );
    event TokenBidAccepted(
        address indexed erc721Address,
        uint256 indexed tokenId,
        address indexed seller,
        Bid bid,
        uint256 serviceFee,
        uint256 royaltyFee
    );

    /**
     * @dev List token for sale
     * @param tokenId erc721 token Id
     * @param value min price to sell the token
     * @param expireTimestamp when would this listing expire
     */
    function listToken(
        address erc721Address,
        uint256 tokenId,
        uint256 value,
        uint256 expireTimestamp
    ) external;

    /**
     * @dev Delist token for sale
     * @param tokenId erc721 token Id
     */
    function delistToken(address erc721Address, uint256 tokenId) external;

    /**
     * @dev Buy token
     * @param tokenId erc721 token Id
     */
    function buyToken(address erc721Address, uint256 tokenId) external payable;

    /**
     * @dev Enter bid for token
     * @param tokenId erc721 token Id
     * @param value price in payment token
     * @param expireTimestamp when would this bid expire
     */
    function enterBidForToken(
        address erc721Address,
        uint256 tokenId,
        uint256 value,
        uint256 expireTimestamp
    ) external;

    /**
     * @dev Withdraw bid for token
     * @param tokenId erc721 token Id
     */
    function withdrawBidForToken(address erc721Address, uint256 tokenId)
        external;

    /**
     * @dev Accept a bid of token from a bidder
     * @param tokenId erc721 token Id
     * @param bidder bidder address
     * @param value value of a bid to avoid frontrun attack
     */
    function acceptBidForToken(
        address erc721Address,
        uint256 tokenId,
        address bidder,
        uint256 value
    ) external;

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

    /**
     * @dev get current listing of a token
     * @param tokenId erc721 token Id
     * @return current valid listing or empty listing struct
     */
    function getTokenListing(address erc721Address, uint256 tokenId)
        external
        view
        returns (Listing memory);

    /**
     * @dev get count of listings
     */
    function numTokenListings(address erc721Address)
        external
        view
        returns (uint256);

    /**
     * @dev get current valid listings by size
     * @param from index to start
     * @param size size to query
     * @return current valid listings
     * This to help batch query when list gets big
     */
    function getTokenListings(
        address erc721Address,
        uint256 from,
        uint256 size
    ) external view returns (Listing[] memory);

    /**
     * @dev get bidder's bid on a token
     * @param tokenId erc721 token Id
     * @param bidder address of a bidder
     * @return Valid bid or empty bid
     */
    function getBidderTokenBid(
        address erc721Address,
        uint256 tokenId,
        address bidder
    ) external view returns (Bid memory);

    /**
     * @dev get all valid bids of a token
     * @param tokenId erc721 token Id
     * @return Valid bids of a token
     */
    function getTokenBids(address erc721Address, uint256 tokenId)
        external
        view
        returns (Bid[] memory);

    /**
     * @dev get count of tokens with bid(s)
     */
    function numTokenWithBids(address erc721Address)
        external
        view
        returns (uint256);

    /**
     * @dev get highest bid of a token
     * @param tokenId erc721 token Id
     * @return Valid highest bid or empty bid
     */
    function getTokenHighestBid(address erc721Address, uint256 tokenId)
        external
        view
        returns (Bid memory);

    /**
     * @dev get current highest bids
     * @param from index to start
     * @param size size to query
     * @return current highest bids
     * This to help batch query when list gets big
     */
    function getTokenHighestBids(
        address erc721Address,
        uint256 from,
        uint256 size
    ) external view returns (Bid[] memory);

    /**
     * @dev get all bids of a bidder address
     * @return All valid bids of a bidder
     */
    function getBidderBids(
        address erc721Address,
        address bidder,
        uint256 from,
        uint256 size
    ) external view returns (Bid[] memory);

    /**
     * @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 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 3 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 4 of 13 : NFTKEYMarketplaceRoyalty.sol
// SPDX-License-Identifier: AGPL-3.0-or-later

pragma solidity =0.8.9;
pragma abicoder v2;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interface/INFTKEYMarketplaceRoyalty.sol";

contract NFTKEYMarketplaceRoyalty is INFTKEYMarketplaceRoyalty, Ownable {
    uint256 public defaultRoyaltyFraction = 20; // By the factor of 1000, 2%
    uint256 public royaltyUpperLimit = 80; // By the factor of 1000, 8%

    mapping(address => ERC721CollectionRoyalty) private _collectionRoyalty;

    function _erc721Owner(address erc721Address)
        private
        view
        returns (address)
    {
        try Ownable(erc721Address).owner() returns (address _contractOwner) {
            return _contractOwner;
        } catch {
            return address(0);
        }
    }

    function royalty(address erc721Address)
        public
        view
        override
        returns (ERC721CollectionRoyalty memory)
    {
        if (_collectionRoyalty[erc721Address].setBy != address(0)) {
            return _collectionRoyalty[erc721Address];
        }

        address erc721Owner = _erc721Owner(erc721Address);
        if (erc721Owner != address(0)) {
            return
                ERC721CollectionRoyalty({
                    recipient: erc721Owner,
                    feeFraction: defaultRoyaltyFraction,
                    setBy: address(0)
                });
        }

        return
            ERC721CollectionRoyalty({
                recipient: address(0),
                feeFraction: 0,
                setBy: address(0)
            });
    }

    function setRoyalty(
        address erc721Address,
        address newRecipient,
        uint256 feeFraction
    ) external override {
        require(
            feeFraction <= royaltyUpperLimit,
            "Please set the royalty percentange below allowed range"
        );

        require(
            msg.sender == royalty(erc721Address).recipient,
            "Only ERC721 royalty recipient is allowed to set Royalty"
        );

        _collectionRoyalty[erc721Address] = ERC721CollectionRoyalty({
            recipient: newRecipient,
            feeFraction: feeFraction,
            setBy: msg.sender
        });

        emit SetRoyalty({
            erc721Address: erc721Address,
            recipient: newRecipient,
            feeFraction: feeFraction
        });
    }

    function setRoyaltyForCollection(
        address erc721Address,
        address newRecipient,
        uint256 feeFraction
    ) external onlyOwner {
        require(
            feeFraction <= royaltyUpperLimit,
            "Please set the royalty percentange below allowed range"
        );

        require(
            royalty(erc721Address).setBy == address(0),
            "Collection royalty recipient already set"
        );

        _collectionRoyalty[erc721Address] = ERC721CollectionRoyalty({
            recipient: newRecipient,
            feeFraction: feeFraction,
            setBy: msg.sender
        });

        emit SetRoyalty({
            erc721Address: erc721Address,
            recipient: newRecipient,
            feeFraction: feeFraction
        });
    }

    function updateRoyaltyUpperLimit(uint256 _newUpperLimit)
        external
        onlyOwner
    {
        royaltyUpperLimit = _newUpperLimit;
    }
}

File 5 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 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 Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_paymentTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeFraction","type":"uint256"}],"name":"SetRoyalty","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"seller","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYMarketplaceV2.Bid","name":"bid","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"serviceFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"royaltyFee","type":"uint256"}],"name":"TokenBidAccepted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYMarketplaceV2.Bid","name":"bid","type":"tuple"}],"name":"TokenBidEntered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYMarketplaceV2.Bid","name":"bid","type":"tuple"}],"name":"TokenBidWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYMarketplaceV2.Listing","name":"listing","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"serviceFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"royaltyFee","type":"uint256"}],"name":"TokenBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYMarketplaceV2.Listing","name":"listing","type":"tuple"}],"name":"TokenDelisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"indexed":false,"internalType":"struct INFTKEYMarketplaceV2.Listing","name":"listing","type":"tuple"}],"name":"TokenListed","type":"event"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"acceptBidForToken","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":"tokenId","type":"uint256"}],"name":"buyToken","outputs":[],"stateMutability":"payable","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":[],"name":"defaultRoyaltyFraction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"delistToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"name":"enterBidForToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"from","type":"uint256"},{"internalType":"uint256","name":"size","type":"uint256"}],"name":"getBidderBids","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Bid[]","name":"bidderBids","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"}],"name":"getBidderTokenBid","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Bid","name":"validBid","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenBids","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Bid[]","name":"bids","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenHighestBid","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Bid","name":"highestBid","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":"getTokenHighestBids","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"bidder","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Bid[]","name":"highestBids","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenListing","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Listing","name":"validListing","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":"getTokenListings","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"internalType":"struct INFTKEYMarketplaceV2.Listing[]","name":"listings","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isTradingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"expireTimestamp","type":"uint256"}],"name":"listToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"}],"name":"numTokenListings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"}],"name":"numTokenWithBids","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":[{"internalType":"address","name":"erc721Address","type":"address"}],"name":"royalty","outputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"feeFraction","type":"uint256"},{"internalType":"address","name":"setBy","type":"address"}],"internalType":"struct INFTKEYMarketplaceRoyalty.ERC721CollectionRoyalty","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyUpperLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"serviceFee","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"address","name":"newRecipient","type":"address"},{"internalType":"uint256","name":"feeFraction","type":"uint256"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"address","name":"newRecipient","type":"address"},{"internalType":"uint256","name":"feeFraction","type":"uint256"}],"name":"setRoyaltyForCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newUpperLimit","type":"uint256"}],"name":"updateRoyaltyUpperLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"erc721Address","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"withdrawBidForToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a0604052601460015560506002556005805461ffff19166114011790556107086006556301e133806007553480156200003857600080fd5b5060405162004449380380620044498339810160408190526200005b91620000cd565b62000066336200007d565b60016004556001600160a01b0316608052620000ff565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000e057600080fd5b81516001600160a01b0381168114620000f857600080fd5b9392505050565b60805161430b6200013e600039600081816102f60152818161270c01528181612772015281816127e401528181612f7f0152613054015261430b6000f3fe6080604052600436106101fe5760003560e01c8063861b69d61161011d578063cdea490d116100b0578063ee8ef34d1161007f578063f8ad6f6211610064578063f8ad6f6214610642578063f8e7b93614610662578063feb884061461068257600080fd5b8063ee8ef34d1461060c578063f2fde38b1461062257600080fd5b8063cdea490d1461058c578063cf6ac953146105ac578063eb3e87b9146105cc578063eb635ab8146105ec57600080fd5b806396f97164116100ec57806396f971641461050c578063a3c0b5f01461052c578063b43d901d1461054c578063b6be53ba1461056c57600080fd5b8063861b69d61461043a5780638abdf5aa146104975780638da5cb5b146104c157806390bc4e37146104ec57600080fd5b80634313e9bd1161019557806366c1e8bf1161016457806366c1e8bf146103dc57806368f8fc10146103fc5780636d0042b81461040f578063715018a61461042557600080fd5b80634313e9bd1461035a57806345105cb11461037a578063453dfc50146103a757806355c338aa146103bc57600080fd5b80632426fc24116101d15780632426fc241461029a5780632c20d1b4146102ba5780633013ce29146102e757806333549d3d1461033b57600080fd5b80630609d09514610203578063064a59d01461022557806319d334cb1461024d5780631f77a8201461026d575b600080fd5b34801561020f57600080fd5b5061022361021e366004613cb7565b6106a2565b005b34801561023157600080fd5b5060055460ff1660405190151581526020015b60405180910390f35b34801561025957600080fd5b50610223610268366004613ce3565b610807565b34801561027957600080fd5b5061028d610288366004613cb7565b610a99565b6040516102449190613d24565b3480156102a657600080fd5b506102236102b5366004613d65565b610c39565b3480156102c657600080fd5b506102da6102d5366004613d7e565b610cbf565b6040516102449190613db3565b3480156102f357600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610244565b34801561034757600080fd5b506006545b604051908152602001610244565b34801561036657600080fd5b50610223610375366004613e38565b610e14565b34801561038657600080fd5b5061039a610395366004613d7e565b611190565b6040516102449190613e73565b3480156103b357600080fd5b5060075461034c565b3480156103c857600080fd5b506102236103d7366004613ce3565b611351565b3480156103e857600080fd5b506102da6103f7366004613cb7565b611491565b61022361040a366004613cb7565b611662565b34801561041b57600080fd5b5061034c60015481565b34801561043157600080fd5b50610223611aab565b34801561044657600080fd5b5061045a610455366004613eec565b611b38565b60408051825173ffffffffffffffffffffffffffffffffffffffff9081168252602080850151908301529282015190921690820152606001610244565b3480156104a357600080fd5b50600554610100900460ff1660405160ff9091168152602001610244565b3480156104cd57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610316565b3480156104f857600080fd5b5061028d610507366004613f09565b611c5d565b34801561051857600080fd5b5061028d610527366004613cb7565b611d28565b34801561053857600080fd5b50610223610547366004613d65565b611de9565b34801561055857600080fd5b50610223610567366004613e38565b611e6f565b34801561057857600080fd5b50610223610587366004613f59565b61217e565b34801561059857600080fd5b506102236105a7366004613d65565b612230565b3480156105b857600080fd5b506102da6105c7366004613f76565b6122b6565b3480156105d857600080fd5b506102236105e7366004613fbc565b612412565b3480156105f857600080fd5b5061034c610607366004613eec565b612946565b34801561061857600080fd5b5061034c60025481565b34801561062e57600080fd5b5061022361063d366004613eec565b61297d565b34801561064e57600080fd5b5061022361065d366004614004565b612aad565b34801561066e57600080fd5b5061034c61067d366004613eec565b612bfb565b34801561068e57600080fd5b5061022361069d366004613cb7565b612c29565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600860209081526040808320858452600501825280832033808552600291820184529382902082516080810184528154815260018201549481019490945290810154909416908201819052600390930154606082015291146107a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54686973206164647265737320646f65736e2774206861766520626964206f6e60448201527f207468697320746f6b656e00000000000000000000000000000000000000000060648201526084015b60405180910390fd5b818373ffffffffffffffffffffffffffffffffffffffff167fef9d84bc41d1a54361c4bf46f5e11b7c90a3fcb4e604b1b24e0e35d0fa371604836040516107ef9190613d24565b60405180910390a3610802838333612da7565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610888576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60025481111561091a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b600061092584611b38565b6040015173ffffffffffffffffffffffffffffffffffffffff16146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f436f6c6c656374696f6e20726f79616c747920726563697069656e7420616c7260448201527f6561647920736574000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff8085168083526020808401868152338587019081528985166000818152600390945292879020955186549086167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161787559151600187015551600290950180549590941694169390931790915591517fb6b61d78ac5372b51940cf3b322ea21839c456cade69acdf1b9fb9a6f79d6ff790610a8c9085815260200190565b60405180910390a3505050565b610ada60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b5060408051608081018252828152600060208083018290528284018290526060830182905273ffffffffffffffffffffffffffffffffffffffff86168252600881528382208583526005019052918220909190610b3690612ef0565b905060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff851660009081526008602090815260408083208784526005019091528120610b809083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a84526005018252808320848616845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150610c008782612f0d565b8015610c13575084602001518160200151115b15610c1c578094505b50508080610c2990614056565b915050610b3b565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600655565b60606000610ccc85612946565b90508084108015610cdd5750600083115b15610e0c578281610cee828761408f565b1115610d0157610cfe85836140a7565b90505b8067ffffffffffffffff811115610d1a57610d1a6140be565b604051908082528060200260200182016040528015610d8c57816020015b610d7960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b815260200190600190039081610d385790505b50925060005b81811015610e0957610dd987610288610dab898561408f565b73ffffffffffffffffffffffffffffffffffffffff8b16600090815260086020526040902060030190612efa565b848281518110610deb57610deb6140ed565b60200260200101819052508080610e0190614056565b915050610d92565b50505b509392505050565b60055460ff16610e80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190610e8f42836140a7565b1015610f1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754610f2942836140a7565b1115610fb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160808101825285815260208101859052339181019190915260608101839052610fe48682612f0d565b61104a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f426964206973206e6f742076616c696400000000000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260086020526040902061107c9060030186613100565b5073ffffffffffffffffffffffffffffffffffffffff8616600090815260086020908152604080832088845260050190915290206110ba903361310c565b5073ffffffffffffffffffffffffffffffffffffffff86811660008181526008602090815260408083208a845260050182528083203384526002908101835292819020865181559186015160018301558581015192820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169390951692909217909355606084015160039093019290925590518691907fc547e24584f4dd2da70009d5141bf4344b59a0ce26cd8f7c5d5a28151a11f21990611180908590613d24565b60405180910390a3505050505050565b6060600061119d85612bfb565b905080841080156111ae5750600083115b15610e0c5782816111bf828761408f565b11156111d2576111cf85836140a7565b90505b8067ffffffffffffffff8111156111eb576111eb6140be565b60405190808252806020026020018201604052801561125d57816020015b61124a60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b8152602001906001900390816112095790505b50925060005b81811015610e095760006112a561127a888461408f565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260086020526040902090612efa565b73ffffffffffffffffffffffffffffffffffffffff808a16600090815260086020908152604080832085845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150611318898261312e565b1561133c5780868481518110611330576113306140ed565b60200260200101819052505b5050808061134990614056565b915050611263565b6002548111156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b6113ec83611b38565b5173ffffffffffffffffffffffffffffffffffffffff1633146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4f6e6c792045524337323120726f79616c747920726563697069656e7420697360448201527f20616c6c6f77656420746f2073657420526f79616c7479000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602090815260408083208484526005019091528120606091906114d190612ef0565b90508067ffffffffffffffff8111156114ec576114ec6140be565b60405190808252806020026020018201604052801561155e57816020015b61154b60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161150a5790505b50915060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff8516600090815260086020908152604080832087845260050190915281206115a99083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a845260050182528083208486168452600290810183529281902081516080810183528154815260018201549381019390935292830154909316928101929092526003015460608201529091506116298782612f0d565b1561164d5780858481518110611641576116416140ed565b60200260200101819052505b5050808061165a90614056565b915050611564565b600260045414156116cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b6002600481905573ffffffffffffffffffffffffffffffffffffffff8084166000908152600860209081526040808320868452850182529182902082516080810184528154815260018201549281019290925293840154909216908201526003909101546060820152611742838261312e565b6117a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e206973206e6f7420666f722073616c650000000000000000000000604482015260640161079f565b6117b383833361316c565b15611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f546f6b656e206f776e65722063616e277420627579207468656972206f776e2060448201527f746f6b656e000000000000000000000000000000000000000000000000000000606482015260840161079f565b80602001513410156118d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f5468652076616c75652073656e642069732062656c6f772073616c652070726960448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b6000806118e585846020015161326d565b9150915061190d83604001518284346118fe91906140a7565b61190891906140a7565b6132f2565b61193561192f60005473ffffffffffffffffffffffffffffffffffffffff1690565b836132f2565b600061194086611b38565b51905073ffffffffffffffffffffffffffffffffffffffff8116158015906119685750600082115b156119775761197781836132f2565b6040805185518152602080870151908201528582015173ffffffffffffffffffffffffffffffffffffffff90811682840152606080880151908301526080820186905260a08201859052915133928892908a16917f50a3cf2b1df7bd2994e752563ce6f85769fb50da66bbb9a9912d2d6066a6b4da9181900360c00190a460408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015233602482015260448101879052908716906342842e0e90606401600060405180830381600087803b158015611a7157600080fd5b505af1158015611a85573d6000803e3d6000fd5b50505050611a93868661344c565b611a9e868633612da7565b5050600160045550505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b611b366000613500565b565b604080516060810182526000808252602082018190529181019190915273ffffffffffffffffffffffffffffffffffffffff8281166000908152600360205260409020600201541615611bd8575073ffffffffffffffffffffffffffffffffffffffff9081166000908152600360209081526040918290208251606081018452815485168152600182015492810192909252600201549092169082015290565b6000611be383613575565b905073ffffffffffffffffffffffffffffffffffffffff811615611c39576040805160608101825273ffffffffffffffffffffffffffffffffffffffff9092168252600154602083015260009082015292915050565b50506040805160608101825260008082526020820181905291810191909152919050565b611c9e60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526008602090815260408083208784526005018252808320868516845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611d1b8582612f0d565b15610e0c57949350505050565b611d6960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260086020908152604080832086845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611dd9848261312e565b15611de2578091505b5092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600755565b60055460ff16611edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190611eea42836140a7565b1015611f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754611f8442836140a7565b1115612012576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b604080516080810182528581526020810185905233918101919091526060810183905261203f868261312e565b6120a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4c697374696e67206973206e6f742076616c6964000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff86811660008181526008602081815260408084208b855260028082018452828620895181558985015160018201559289015190830180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919098161790965560608701516003909101559290915290526121369086613100565b50848673ffffffffffffffffffffffffffffffffffffffff167ffc8bd63d1c4480fdf7501f95b3dd0ba53542a02abbab92c0f579468341741abd836040516111809190613d24565b60005473ffffffffffffffffffffffffffffffffffffffff1633146121ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146122b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600255565b606060006122c386612946565b905080841080156122d45750600083115b156124095782816122e5828761408f565b11156122f8576122f585836140a7565b90505b8067ffffffffffffffff811115612311576123116140be565b60405190808252806020026020018201604052801561238357816020015b61237060405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161232f5790505b50925060005b81811015612406576123d6886123d06123a2898561408f565b73ffffffffffffffffffffffffffffffffffffffff8c16600090815260086020526040902060030190612efa565b89611c5d565b8482815181106123e8576123e86140ed565b602002602001018190525080806123fe90614056565b915050612389565b50505b50949350505050565b6002600454141561247f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b600260045561248f84843361316c565b61251b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20616363657074206269642060448201527f6f6620746f6b656e000000000000000000000000000000000000000000000000606482015260840161079f565b6125258484613617565b80612535575061253584336136ff565b6125c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f54686520746f6b656e206973206e6f7420617070726f76656420746f2074726160448201527f6e736665722062792074686520636f6e74726163740000000000000000000000606482015260840161079f565b60006125ce858585611c5d565b8051909150841480156125e45750818160200151145b801561261f57508273ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16145b6126ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5468697320746f6b656e20646f65736e277420686176652061206d617463686960448201527f6e67206269640000000000000000000000000000000000000000000000000000606482015260840161079f565b60006126b686611b38565b6000015190506000806126cd88856020015161326d565b91509150612734846040015133838588602001516126eb91906140a7565b6126f591906140a7565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169291906137b1565b61279a846040015161275b60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169190856137b1565b73ffffffffffffffffffffffffffffffffffffffff8316158015906127bf5750600081115b1561280c57604084015161280c9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169085846137b1565b60408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101899052908916906342842e0e90606401600060405180830381600087803b15801561288857600080fd5b505af115801561289c573d6000803e3d6000fd5b50506040805187518152602080890151908201528782015173ffffffffffffffffffffffffffffffffffffffff908116828401526060808a0151908301526080820187905260a0820186905291513394508b9350918c16917fcc8a6de82515ca1ae870ff05651038b858e8bcd1b5143c342987b6dc3c3434539181900360c00190a4612928888861344c565b61293788888660400151612da7565b50506001600455505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790600301612ef0565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146129fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8116612aa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161079f565b612aaa81613500565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314612b2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60198160ff161115612bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f417474656d707420746f207365742070657263656e746167652068696768657260448201527f207468616e20322e35252e000000000000000000000000000000000000000000606482015260840161079f565b6005805460ff909216610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790612ef0565b73ffffffffffffffffffffffffffffffffffffffff828116600090815260086020908152604080832085845260029081019092529091200154163314612cf1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4f6e6c7920746f6b656e2073656c6c65722063616e2064656c69737420746f6b60448201527f656e000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260408083208584526002019091529081902090518392917f835a0a426c94e53ab00dd6cf617ba68d1fa6c9162ef7a036b80be930c9a32c5391612d9191908154815260018201546020820152600282015473ffffffffffffffffffffffffffffffffffffffff166040820152600390910154606082015260800190565b60405180910390a3612da3828261344c565b5050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612de49082613846565b156108025773ffffffffffffffffffffffffffffffffffffffff80841660009081526008602090815260408083208684526005018083528184209486168452600280860184529184208481556001810185905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018390559185905252612e779082613875565b5073ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612eb490612ef0565b6108025773ffffffffffffffffffffffffffffffffffffffff83166000908152600860205260409020612eea9060030183613897565b50505050565b6000612977825490565b6000612f0683836138a3565b9392505050565b6000612f22838360000151846040015161316c565b158015612ffe5750602082015160408084015190517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201523060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063dd62ed3e9060440160206040518083038186803b158015612fc357600080fd5b505afa158015612fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ffb919061411c565b10155b80156130d35750602082015160408084015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527f0000000000000000000000000000000000000000000000000000000000000000909116906370a082319060240160206040518083038186803b15801561309857600080fd5b505afa1580156130ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d0919061411c565b10155b80156130e3575060008260200151115b80156130f25750428260600151115b156129775750600192915050565b6000612f0683836138cd565b6000612f068373ffffffffffffffffffffffffffffffffffffffff84166138cd565b6000613143838360000151846040015161316c565b80156130d35750613158838360000151613617565b806130d357506130d38383604001516136ff565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101839052600090849073ffffffffffffffffffffffffffffffffffffffff821690636352211e9060240160206040518083038186803b1580156131d757600080fd5b505afa925050508015613225575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261322291810190614135565b60015b613233576000915050612f06565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b600080600061327b85611b38565b60200151600554909150600090829061329e90610100900460ff166103e8614152565b61ffff166132ac919061408f565b60055490915081906132c690610100900460ff1687614178565b6132d091906141b5565b9350806132dd8387614178565b6132e791906141b5565b925050509250929050565b8047101561335c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161079f565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146133b6576040519150601f19603f3d011682016040523d82523d6000602084013e6133bb565b606091505b5050905080610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260086020526040902061347b908261391c565b15612da35773ffffffffffffffffffffffffffffffffffffffff82166000818152600860208181526040808420868552600280820184529185208581556001810186905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018490559390925290526108029082613897565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156135bd57600080fd5b505afa92505050801561360b575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261360891810190614135565b60015b61297757506000919050565b6040517f081812fc00000000000000000000000000000000000000000000000000000000815260048101829052600090839073ffffffffffffffffffffffffffffffffffffffff82169063081812fc9060240160206040518083038186803b15801561368257600080fd5b505afa9250505080156136d0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526136cd91810190614135565b60015b6136de576000915050612977565b73ffffffffffffffffffffffffffffffffffffffff16301491506129779050565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152306024830152600091849182169063e985e9c59060440160206040518083038186803b15801561377157600080fd5b505afa158015613785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a991906141f0565b949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612eea908590613934565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515612f06565b6000612f068373ffffffffffffffffffffffffffffffffffffffff8416613a40565b6000612f068383613a40565b60008260000182815481106138ba576138ba6140ed565b9060005260206000200154905092915050565b600081815260018301602052604081205461391457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612977565b506000612977565b60008181526001830160205260408120541515612f06565b6000613996826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b339092919063ffffffff16565b80519091501561080257808060200190518101906139b491906141f0565b610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161079f565b60008181526001830160205260408120548015613b29576000613a646001836140a7565b8554909150600090613a78906001906140a7565b9050818114613add576000866000018281548110613a9857613a986140ed565b9060005260206000200154905080876000018481548110613abb57613abb6140ed565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613aee57613aee61420d565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050612977565b6000915050612977565b60606137a984846000858573ffffffffffffffffffffffffffffffffffffffff85163b613bbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161079f565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613be59190614268565b60006040518083038185875af1925050503d8060008114613c22576040519150601f19603f3d011682016040523d82523d6000602084013e613c27565b606091505b5091509150613c37828286613c42565b979650505050505050565b60608315613c51575081612f06565b825115613c615782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079f9190614284565b73ffffffffffffffffffffffffffffffffffffffff81168114612aaa57600080fd5b60008060408385031215613cca57600080fd5b8235613cd581613c95565b946020939093013593505050565b600080600060608486031215613cf857600080fd5b8335613d0381613c95565b92506020840135613d1381613c95565b929592945050506040919091013590565b815181526020808301519082015260408083015173ffffffffffffffffffffffffffffffffffffffff16908201526060808301519082015260808101612977565b600060208284031215613d7757600080fd5b5035919050565b600080600060608486031215613d9357600080fd5b8335613d9e81613c95565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b81811015613e2c57613e19838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613dcf565b50909695505050505050565b60008060008060808587031215613e4e57600080fd5b8435613e5981613c95565b966020860135965060408601359560600135945092505050565b6020808252825182820181905260009190848201906040850190845b81811015613e2c57613ed9838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613e8f565b600060208284031215613efe57600080fd5b8135612f0681613c95565b600080600060608486031215613f1e57600080fd5b8335613f2981613c95565b9250602084013591506040840135613f4081613c95565b809150509250925092565b8015158114612aaa57600080fd5b600060208284031215613f6b57600080fd5b8135612f0681613f4b565b60008060008060808587031215613f8c57600080fd5b8435613f9781613c95565b93506020850135613fa781613c95565b93969395505050506040820135916060013590565b60008060008060808587031215613fd257600080fd5b8435613fdd81613c95565b9350602085013592506040850135613ff481613c95565b9396929550929360600135925050565b60006020828403121561401657600080fd5b813560ff81168114612f0657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561408857614088614027565b5060010190565b600082198211156140a2576140a2614027565b500190565b6000828210156140b9576140b9614027565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561412e57600080fd5b5051919050565b60006020828403121561414757600080fd5b8151612f0681613c95565b600061ffff80831681851680830382111561416f5761416f614027565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141b0576141b0614027565b500290565b6000826141eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561420257600080fd5b8151612f0681613f4b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b8381101561425757818101518382015260200161423f565b83811115612eea5750506000910152565b6000825161427a81846020870161423c565b9190910192915050565b60208152600082518060208401526142a381604085016020870161423c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220f359eeb7bc1c1713103e4158bc635c086ebc1bb5d11d988eeb36a0d8637db97c64736f6c634300080900330000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270

Deployed Bytecode

0x6080604052600436106101fe5760003560e01c8063861b69d61161011d578063cdea490d116100b0578063ee8ef34d1161007f578063f8ad6f6211610064578063f8ad6f6214610642578063f8e7b93614610662578063feb884061461068257600080fd5b8063ee8ef34d1461060c578063f2fde38b1461062257600080fd5b8063cdea490d1461058c578063cf6ac953146105ac578063eb3e87b9146105cc578063eb635ab8146105ec57600080fd5b806396f97164116100ec57806396f971641461050c578063a3c0b5f01461052c578063b43d901d1461054c578063b6be53ba1461056c57600080fd5b8063861b69d61461043a5780638abdf5aa146104975780638da5cb5b146104c157806390bc4e37146104ec57600080fd5b80634313e9bd1161019557806366c1e8bf1161016457806366c1e8bf146103dc57806368f8fc10146103fc5780636d0042b81461040f578063715018a61461042557600080fd5b80634313e9bd1461035a57806345105cb11461037a578063453dfc50146103a757806355c338aa146103bc57600080fd5b80632426fc24116101d15780632426fc241461029a5780632c20d1b4146102ba5780633013ce29146102e757806333549d3d1461033b57600080fd5b80630609d09514610203578063064a59d01461022557806319d334cb1461024d5780631f77a8201461026d575b600080fd5b34801561020f57600080fd5b5061022361021e366004613cb7565b6106a2565b005b34801561023157600080fd5b5060055460ff1660405190151581526020015b60405180910390f35b34801561025957600080fd5b50610223610268366004613ce3565b610807565b34801561027957600080fd5b5061028d610288366004613cb7565b610a99565b6040516102449190613d24565b3480156102a657600080fd5b506102236102b5366004613d65565b610c39565b3480156102c657600080fd5b506102da6102d5366004613d7e565b610cbf565b6040516102449190613db3565b3480156102f357600080fd5b507f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12705b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610244565b34801561034757600080fd5b506006545b604051908152602001610244565b34801561036657600080fd5b50610223610375366004613e38565b610e14565b34801561038657600080fd5b5061039a610395366004613d7e565b611190565b6040516102449190613e73565b3480156103b357600080fd5b5060075461034c565b3480156103c857600080fd5b506102236103d7366004613ce3565b611351565b3480156103e857600080fd5b506102da6103f7366004613cb7565b611491565b61022361040a366004613cb7565b611662565b34801561041b57600080fd5b5061034c60015481565b34801561043157600080fd5b50610223611aab565b34801561044657600080fd5b5061045a610455366004613eec565b611b38565b60408051825173ffffffffffffffffffffffffffffffffffffffff9081168252602080850151908301529282015190921690820152606001610244565b3480156104a357600080fd5b50600554610100900460ff1660405160ff9091168152602001610244565b3480156104cd57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610316565b3480156104f857600080fd5b5061028d610507366004613f09565b611c5d565b34801561051857600080fd5b5061028d610527366004613cb7565b611d28565b34801561053857600080fd5b50610223610547366004613d65565b611de9565b34801561055857600080fd5b50610223610567366004613e38565b611e6f565b34801561057857600080fd5b50610223610587366004613f59565b61217e565b34801561059857600080fd5b506102236105a7366004613d65565b612230565b3480156105b857600080fd5b506102da6105c7366004613f76565b6122b6565b3480156105d857600080fd5b506102236105e7366004613fbc565b612412565b3480156105f857600080fd5b5061034c610607366004613eec565b612946565b34801561061857600080fd5b5061034c60025481565b34801561062e57600080fd5b5061022361063d366004613eec565b61297d565b34801561064e57600080fd5b5061022361065d366004614004565b612aad565b34801561066e57600080fd5b5061034c61067d366004613eec565b612bfb565b34801561068e57600080fd5b5061022361069d366004613cb7565b612c29565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600860209081526040808320858452600501825280832033808552600291820184529382902082516080810184528154815260018201549481019490945290810154909416908201819052600390930154606082015291146107a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54686973206164647265737320646f65736e2774206861766520626964206f6e60448201527f207468697320746f6b656e00000000000000000000000000000000000000000060648201526084015b60405180910390fd5b818373ffffffffffffffffffffffffffffffffffffffff167fef9d84bc41d1a54361c4bf46f5e11b7c90a3fcb4e604b1b24e0e35d0fa371604836040516107ef9190613d24565b60405180910390a3610802838333612da7565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610888576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60025481111561091a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b600061092584611b38565b6040015173ffffffffffffffffffffffffffffffffffffffff16146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f436f6c6c656374696f6e20726f79616c747920726563697069656e7420616c7260448201527f6561647920736574000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff8085168083526020808401868152338587019081528985166000818152600390945292879020955186549086167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161787559151600187015551600290950180549590941694169390931790915591517fb6b61d78ac5372b51940cf3b322ea21839c456cade69acdf1b9fb9a6f79d6ff790610a8c9085815260200190565b60405180910390a3505050565b610ada60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b5060408051608081018252828152600060208083018290528284018290526060830182905273ffffffffffffffffffffffffffffffffffffffff86168252600881528382208583526005019052918220909190610b3690612ef0565b905060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff851660009081526008602090815260408083208784526005019091528120610b809083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a84526005018252808320848616845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150610c008782612f0d565b8015610c13575084602001518160200151115b15610c1c578094505b50508080610c2990614056565b915050610b3b565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600655565b60606000610ccc85612946565b90508084108015610cdd5750600083115b15610e0c578281610cee828761408f565b1115610d0157610cfe85836140a7565b90505b8067ffffffffffffffff811115610d1a57610d1a6140be565b604051908082528060200260200182016040528015610d8c57816020015b610d7960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b815260200190600190039081610d385790505b50925060005b81811015610e0957610dd987610288610dab898561408f565b73ffffffffffffffffffffffffffffffffffffffff8b16600090815260086020526040902060030190612efa565b848281518110610deb57610deb6140ed565b60200260200101819052508080610e0190614056565b915050610d92565b50505b509392505050565b60055460ff16610e80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190610e8f42836140a7565b1015610f1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754610f2942836140a7565b1115610fb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160808101825285815260208101859052339181019190915260608101839052610fe48682612f0d565b61104a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f426964206973206e6f742076616c696400000000000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260086020526040902061107c9060030186613100565b5073ffffffffffffffffffffffffffffffffffffffff8616600090815260086020908152604080832088845260050190915290206110ba903361310c565b5073ffffffffffffffffffffffffffffffffffffffff86811660008181526008602090815260408083208a845260050182528083203384526002908101835292819020865181559186015160018301558581015192820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169390951692909217909355606084015160039093019290925590518691907fc547e24584f4dd2da70009d5141bf4344b59a0ce26cd8f7c5d5a28151a11f21990611180908590613d24565b60405180910390a3505050505050565b6060600061119d85612bfb565b905080841080156111ae5750600083115b15610e0c5782816111bf828761408f565b11156111d2576111cf85836140a7565b90505b8067ffffffffffffffff8111156111eb576111eb6140be565b60405190808252806020026020018201604052801561125d57816020015b61124a60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b8152602001906001900390816112095790505b50925060005b81811015610e095760006112a561127a888461408f565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260086020526040902090612efa565b73ffffffffffffffffffffffffffffffffffffffff808a16600090815260086020908152604080832085845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150611318898261312e565b1561133c5780868481518110611330576113306140ed565b60200260200101819052505b5050808061134990614056565b915050611263565b6002548111156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b6113ec83611b38565b5173ffffffffffffffffffffffffffffffffffffffff1633146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4f6e6c792045524337323120726f79616c747920726563697069656e7420697360448201527f20616c6c6f77656420746f2073657420526f79616c7479000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602090815260408083208484526005019091528120606091906114d190612ef0565b90508067ffffffffffffffff8111156114ec576114ec6140be565b60405190808252806020026020018201604052801561155e57816020015b61154b60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161150a5790505b50915060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff8516600090815260086020908152604080832087845260050190915281206115a99083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a845260050182528083208486168452600290810183529281902081516080810183528154815260018201549381019390935292830154909316928101929092526003015460608201529091506116298782612f0d565b1561164d5780858481518110611641576116416140ed565b60200260200101819052505b5050808061165a90614056565b915050611564565b600260045414156116cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b6002600481905573ffffffffffffffffffffffffffffffffffffffff8084166000908152600860209081526040808320868452850182529182902082516080810184528154815260018201549281019290925293840154909216908201526003909101546060820152611742838261312e565b6117a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e206973206e6f7420666f722073616c650000000000000000000000604482015260640161079f565b6117b383833361316c565b15611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f546f6b656e206f776e65722063616e277420627579207468656972206f776e2060448201527f746f6b656e000000000000000000000000000000000000000000000000000000606482015260840161079f565b80602001513410156118d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f5468652076616c75652073656e642069732062656c6f772073616c652070726960448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b6000806118e585846020015161326d565b9150915061190d83604001518284346118fe91906140a7565b61190891906140a7565b6132f2565b61193561192f60005473ffffffffffffffffffffffffffffffffffffffff1690565b836132f2565b600061194086611b38565b51905073ffffffffffffffffffffffffffffffffffffffff8116158015906119685750600082115b156119775761197781836132f2565b6040805185518152602080870151908201528582015173ffffffffffffffffffffffffffffffffffffffff90811682840152606080880151908301526080820186905260a08201859052915133928892908a16917f50a3cf2b1df7bd2994e752563ce6f85769fb50da66bbb9a9912d2d6066a6b4da9181900360c00190a460408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015233602482015260448101879052908716906342842e0e90606401600060405180830381600087803b158015611a7157600080fd5b505af1158015611a85573d6000803e3d6000fd5b50505050611a93868661344c565b611a9e868633612da7565b5050600160045550505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b611b366000613500565b565b604080516060810182526000808252602082018190529181019190915273ffffffffffffffffffffffffffffffffffffffff8281166000908152600360205260409020600201541615611bd8575073ffffffffffffffffffffffffffffffffffffffff9081166000908152600360209081526040918290208251606081018452815485168152600182015492810192909252600201549092169082015290565b6000611be383613575565b905073ffffffffffffffffffffffffffffffffffffffff811615611c39576040805160608101825273ffffffffffffffffffffffffffffffffffffffff9092168252600154602083015260009082015292915050565b50506040805160608101825260008082526020820181905291810191909152919050565b611c9e60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526008602090815260408083208784526005018252808320868516845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611d1b8582612f0d565b15610e0c57949350505050565b611d6960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260086020908152604080832086845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611dd9848261312e565b15611de2578091505b5092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600755565b60055460ff16611edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190611eea42836140a7565b1015611f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754611f8442836140a7565b1115612012576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b604080516080810182528581526020810185905233918101919091526060810183905261203f868261312e565b6120a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4c697374696e67206973206e6f742076616c6964000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff86811660008181526008602081815260408084208b855260028082018452828620895181558985015160018201559289015190830180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919098161790965560608701516003909101559290915290526121369086613100565b50848673ffffffffffffffffffffffffffffffffffffffff167ffc8bd63d1c4480fdf7501f95b3dd0ba53542a02abbab92c0f579468341741abd836040516111809190613d24565b60005473ffffffffffffffffffffffffffffffffffffffff1633146121ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146122b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600255565b606060006122c386612946565b905080841080156122d45750600083115b156124095782816122e5828761408f565b11156122f8576122f585836140a7565b90505b8067ffffffffffffffff811115612311576123116140be565b60405190808252806020026020018201604052801561238357816020015b61237060405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161232f5790505b50925060005b81811015612406576123d6886123d06123a2898561408f565b73ffffffffffffffffffffffffffffffffffffffff8c16600090815260086020526040902060030190612efa565b89611c5d565b8482815181106123e8576123e86140ed565b602002602001018190525080806123fe90614056565b915050612389565b50505b50949350505050565b6002600454141561247f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b600260045561248f84843361316c565b61251b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20616363657074206269642060448201527f6f6620746f6b656e000000000000000000000000000000000000000000000000606482015260840161079f565b6125258484613617565b80612535575061253584336136ff565b6125c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f54686520746f6b656e206973206e6f7420617070726f76656420746f2074726160448201527f6e736665722062792074686520636f6e74726163740000000000000000000000606482015260840161079f565b60006125ce858585611c5d565b8051909150841480156125e45750818160200151145b801561261f57508273ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16145b6126ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5468697320746f6b656e20646f65736e277420686176652061206d617463686960448201527f6e67206269640000000000000000000000000000000000000000000000000000606482015260840161079f565b60006126b686611b38565b6000015190506000806126cd88856020015161326d565b91509150612734846040015133838588602001516126eb91906140a7565b6126f591906140a7565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270169291906137b1565b61279a846040015161275b60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270169190856137b1565b73ffffffffffffffffffffffffffffffffffffffff8316158015906127bf5750600081115b1561280c57604084015161280c9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270169085846137b1565b60408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101899052908916906342842e0e90606401600060405180830381600087803b15801561288857600080fd5b505af115801561289c573d6000803e3d6000fd5b50506040805187518152602080890151908201528782015173ffffffffffffffffffffffffffffffffffffffff908116828401526060808a0151908301526080820187905260a0820186905291513394508b9350918c16917fcc8a6de82515ca1ae870ff05651038b858e8bcd1b5143c342987b6dc3c3434539181900360c00190a4612928888861344c565b61293788888660400151612da7565b50506001600455505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790600301612ef0565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146129fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8116612aa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161079f565b612aaa81613500565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314612b2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60198160ff161115612bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f417474656d707420746f207365742070657263656e746167652068696768657260448201527f207468616e20322e35252e000000000000000000000000000000000000000000606482015260840161079f565b6005805460ff909216610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790612ef0565b73ffffffffffffffffffffffffffffffffffffffff828116600090815260086020908152604080832085845260029081019092529091200154163314612cf1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4f6e6c7920746f6b656e2073656c6c65722063616e2064656c69737420746f6b60448201527f656e000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260408083208584526002019091529081902090518392917f835a0a426c94e53ab00dd6cf617ba68d1fa6c9162ef7a036b80be930c9a32c5391612d9191908154815260018201546020820152600282015473ffffffffffffffffffffffffffffffffffffffff166040820152600390910154606082015260800190565b60405180910390a3612da3828261344c565b5050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612de49082613846565b156108025773ffffffffffffffffffffffffffffffffffffffff80841660009081526008602090815260408083208684526005018083528184209486168452600280860184529184208481556001810185905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018390559185905252612e779082613875565b5073ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612eb490612ef0565b6108025773ffffffffffffffffffffffffffffffffffffffff83166000908152600860205260409020612eea9060030183613897565b50505050565b6000612977825490565b6000612f0683836138a3565b9392505050565b6000612f22838360000151846040015161316c565b158015612ffe5750602082015160408084015190517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201523060248201527f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf12709091169063dd62ed3e9060440160206040518083038186803b158015612fc357600080fd5b505afa158015612fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ffb919061411c565b10155b80156130d35750602082015160408084015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527f0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270909116906370a082319060240160206040518083038186803b15801561309857600080fd5b505afa1580156130ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d0919061411c565b10155b80156130e3575060008260200151115b80156130f25750428260600151115b156129775750600192915050565b6000612f0683836138cd565b6000612f068373ffffffffffffffffffffffffffffffffffffffff84166138cd565b6000613143838360000151846040015161316c565b80156130d35750613158838360000151613617565b806130d357506130d38383604001516136ff565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101839052600090849073ffffffffffffffffffffffffffffffffffffffff821690636352211e9060240160206040518083038186803b1580156131d757600080fd5b505afa925050508015613225575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261322291810190614135565b60015b613233576000915050612f06565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b600080600061327b85611b38565b60200151600554909150600090829061329e90610100900460ff166103e8614152565b61ffff166132ac919061408f565b60055490915081906132c690610100900460ff1687614178565b6132d091906141b5565b9350806132dd8387614178565b6132e791906141b5565b925050509250929050565b8047101561335c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161079f565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146133b6576040519150601f19603f3d011682016040523d82523d6000602084013e6133bb565b606091505b5050905080610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260086020526040902061347b908261391c565b15612da35773ffffffffffffffffffffffffffffffffffffffff82166000818152600860208181526040808420868552600280820184529185208581556001810186905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018490559390925290526108029082613897565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156135bd57600080fd5b505afa92505050801561360b575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261360891810190614135565b60015b61297757506000919050565b6040517f081812fc00000000000000000000000000000000000000000000000000000000815260048101829052600090839073ffffffffffffffffffffffffffffffffffffffff82169063081812fc9060240160206040518083038186803b15801561368257600080fd5b505afa9250505080156136d0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526136cd91810190614135565b60015b6136de576000915050612977565b73ffffffffffffffffffffffffffffffffffffffff16301491506129779050565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152306024830152600091849182169063e985e9c59060440160206040518083038186803b15801561377157600080fd5b505afa158015613785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a991906141f0565b949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612eea908590613934565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515612f06565b6000612f068373ffffffffffffffffffffffffffffffffffffffff8416613a40565b6000612f068383613a40565b60008260000182815481106138ba576138ba6140ed565b9060005260206000200154905092915050565b600081815260018301602052604081205461391457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612977565b506000612977565b60008181526001830160205260408120541515612f06565b6000613996826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b339092919063ffffffff16565b80519091501561080257808060200190518101906139b491906141f0565b610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161079f565b60008181526001830160205260408120548015613b29576000613a646001836140a7565b8554909150600090613a78906001906140a7565b9050818114613add576000866000018281548110613a9857613a986140ed565b9060005260206000200154905080876000018481548110613abb57613abb6140ed565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613aee57613aee61420d565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050612977565b6000915050612977565b60606137a984846000858573ffffffffffffffffffffffffffffffffffffffff85163b613bbc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161079f565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613be59190614268565b60006040518083038185875af1925050503d8060008114613c22576040519150601f19603f3d011682016040523d82523d6000602084013e613c27565b606091505b5091509150613c37828286613c42565b979650505050505050565b60608315613c51575081612f06565b825115613c615782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079f9190614284565b73ffffffffffffffffffffffffffffffffffffffff81168114612aaa57600080fd5b60008060408385031215613cca57600080fd5b8235613cd581613c95565b946020939093013593505050565b600080600060608486031215613cf857600080fd5b8335613d0381613c95565b92506020840135613d1381613c95565b929592945050506040919091013590565b815181526020808301519082015260408083015173ffffffffffffffffffffffffffffffffffffffff16908201526060808301519082015260808101612977565b600060208284031215613d7757600080fd5b5035919050565b600080600060608486031215613d9357600080fd5b8335613d9e81613c95565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b81811015613e2c57613e19838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613dcf565b50909695505050505050565b60008060008060808587031215613e4e57600080fd5b8435613e5981613c95565b966020860135965060408601359560600135945092505050565b6020808252825182820181905260009190848201906040850190845b81811015613e2c57613ed9838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613e8f565b600060208284031215613efe57600080fd5b8135612f0681613c95565b600080600060608486031215613f1e57600080fd5b8335613f2981613c95565b9250602084013591506040840135613f4081613c95565b809150509250925092565b8015158114612aaa57600080fd5b600060208284031215613f6b57600080fd5b8135612f0681613f4b565b60008060008060808587031215613f8c57600080fd5b8435613f9781613c95565b93506020850135613fa781613c95565b93969395505050506040820135916060013590565b60008060008060808587031215613fd257600080fd5b8435613fdd81613c95565b9350602085013592506040850135613ff481613c95565b9396929550929360600135925050565b60006020828403121561401657600080fd5b813560ff81168114612f0657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561408857614088614027565b5060010190565b600082198211156140a2576140a2614027565b500190565b6000828210156140b9576140b9614027565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561412e57600080fd5b5051919050565b60006020828403121561414757600080fd5b8151612f0681613c95565b600061ffff80831681851680830382111561416f5761416f614027565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156141b0576141b0614027565b500290565b6000826141eb577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60006020828403121561420257600080fd5b8151612f0681613f4b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b8381101561425757818101518382015260200161423f565b83811115612eea5750506000910152565b6000825161427a81846020870161423c565b9190910192915050565b60208152600082518060208401526142a381604085016020870161423c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220f359eeb7bc1c1713103e4158bc635c086ebc1bb5d11d988eeb36a0d8637db97c64736f6c63430008090033

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

0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270

-----Decoded View---------------
Arg [0] : _paymentTokenAddress (address): 0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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