Contract 0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739 6

Txn Hash Method
Block
From
To
Value [Txn Fee]
0xcd69b24158784be8a4fc9bc4d7d3497ab3ac3b9526e016475b98ab6c1ee9ac89List Token229464772022-11-28 10:49:341 day 1 hr ago0x60c6ceb1a9dbd81d3353efb0f322ac8e8d73f2b4 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00193245 30
0x1897ed7c19f881bc0c4425a2381a5221a3a4f2e574ea03b34938c936ce61196eList Token229464702022-11-28 10:49:181 day 1 hr ago0x228baf69cdd1290d98d9590e772cbd7f1f75ff66 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00162804445 26.41
0xcaf8cf73fed90a91e7160c31753c20028575ac591d96f75f5a6c2b6391261e98Delist Token229451462022-11-28 10:03:301 day 2 hrs ago0xbe010cc1baadaead144d39b3500076451f8fd3e0 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00216072 30
0x574042563faf5863c6818394c53c4148cd12bb65338c3ae23fe3e457826840e2List Token229416212022-11-28 8:00:501 day 4 hrs ago0x7b0b92d106197797095693c25f4c8918cbfc09cf IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.0017629530
0x6f7b5289f60d0fc94aff2bf1438b85b83a820656724b5fabd230fefdd04e3b76List Token229416052022-11-28 8:00:141 day 4 hrs ago0x7b0b92d106197797095693c25f4c8918cbfc09cf IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.0018469530
0xcab5be825a8d742d35ef5e93bf97a5c75d0179f9db8f0fc26a701727bb842d14List Token229415162022-11-28 7:57:081 day 4 hrs ago0x7b0b92d106197797095693c25f4c8918cbfc09cf IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.0054881430
0x16e54cf8a3d704c0e5aba8737037b39bcdb7439566282cb45e2e28d65ae58baeList Token229271942022-11-27 23:44:581 day 12 hrs ago0xf754bfb09978c3e47512209a7c90fc517b51a8cb IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.0054903 30
0xf158b8413c2132e16e21e13d391300648319d9e394dd2754906782f2c2194817List Token229271432022-11-27 23:43:171 day 12 hrs ago0xf754bfb09978c3e47512209a7c90fc517b51a8cb IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00192999 30
0xa2032092f071fd21e14909835276dcc7b0b8ef366249157bf6fae835f047dee3Buy Token229056042022-11-27 11:28:582 days 48 mins ago0x727a10ae1afc91754d357b4748f6d793c9795026 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07391.25 AVAX0.00619851 30
0x6d3237a231be70d0fc732134ca2bf90cbe17ffcbd0e6cb44284bc30a116de69fBuy Token229027172022-11-27 9:51:352 days 2 hrs ago0x91756a9345165ae9229fd5032aa9de4593a8c017 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07391 AVAX0.00599772 30
0xa5bcac9b99fbfa199c737127042800cca5bc9ca31a9f212f892db4e1a41abdebList Token229025622022-11-27 9:46:122 days 2 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00548814 30
0xc8550a5d51ac6250d366e0a94e802f369523ee1b2e312d5b38bb453f555bca9cList Token229024962022-11-27 9:43:582 days 2 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00548814 30
0x24c11188a353938a74a9a63bcd3c3a644b415dcf82c51206d9a8141c5f9efe10List Token229023082022-11-27 9:37:312 days 2 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00548778 30
0xcd0b5f7a2e921fceec95aa3994a101e526528404ba8eca2e63138e02704c3503Buy Token229017632022-11-27 9:18:542 days 2 hrs ago0x921cf66d66492eb994369cabcec4e1906eda6906 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07391.2 AVAX0.00568344 30
0x525dfdef11e3e653616e14560ed7525d7991d1e3d43499babddf43535b41472fBuy Token229017562022-11-27 9:18:402 days 2 hrs ago0x921cf66d66492eb994369cabcec4e1906eda6906 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07391 AVAX0.00537462 30
0x80d5d2a7f2d9261141952eca71ab2b334ae618ffddf5584575d4b94e2ef6dcb8Buy Token229017462022-11-27 9:18:202 days 2 hrs ago0x921cf66d66492eb994369cabcec4e1906eda6906 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390.7 AVAX0.00651108 30
0x3c6e25b72c918d5050f258798d5dca48e0a3408631b6d432cdeef639372fd4feList Token229016922022-11-27 9:16:322 days 3 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.0018471 30
0xf9ddd3af9d1c7b9bf0aa317cba9629d18d72481ec4c4ea714b22c205b57ae973List Token229015982022-11-27 9:13:192 days 3 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00549063 30
0x4d6fd80e7a2067658a18f92067c293f0808eec8f91d2fa2354586baf79ce956aList Token229014282022-11-27 9:07:252 days 3 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00184695 30
0x8315492f1ec4a9eddc9ebc6272818c77045f9267e02c95fc296c2425dedcdbdaList Token229014042022-11-27 9:06:372 days 3 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00548814 30
0xb0d6472f64c2180e3e0863d4694ee7d0a89fb1c16c124e7e931292301c12e8dcList Token229013792022-11-27 9:05:442 days 3 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00548814 30
0x1e17485f80665a3d293264ad0416903a34709cb2c282f6e125bfd0b9139d95fdList Token229005992022-11-27 8:39:012 days 3 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00184695 30
0xd875dfb4b453fe95ad867f1ea88d794b87a65e18872f444e7809ba25308a31cbList Token228997192022-11-27 8:09:222 days 4 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00184944 30
0xa5b16d1f6a7e7912e5b0861f9af80e4cf024a0b627eabddd194e9c6910e015ffList Token228996552022-11-27 8:07:112 days 4 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00198528 30
0xa2589a3029c12832621d22e9c23b34a49fae90d340c32b294fdef2a34ba225fbList Token228983062022-11-27 7:20:572 days 4 hrs ago0x0961754a17b0f97a16244fa19e7df80d139525ad IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 AVAX0.00184659 30
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xa2032092f071fd21e14909835276dcc7b0b8ef366249157bf6fae835f047dee3229056042022-11-27 11:28:582 days 48 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb22fc8e22cac0b95b381dea7ea86705a7d622df00.080275229357798165 AVAX
0xa2032092f071fd21e14909835276dcc7b0b8ef366249157bf6fae835f047dee3229056042022-11-27 11:28:582 days 48 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.022935779816513761 AVAX
0xa2032092f071fd21e14909835276dcc7b0b8ef366249157bf6fae835f047dee3229056042022-11-27 11:28:582 days 48 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x588d988d2c01b5ac3e00044f5ca4afd97e6ca9c31.146788990825688074 AVAX
0x6d3237a231be70d0fc732134ca2bf90cbe17ffcbd0e6cb44284bc30a116de69f229027172022-11-27 9:51:352 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb6359df5000d83cb88c04a40084288f5adebf3230.046728971962616822 AVAX
0x6d3237a231be70d0fc732134ca2bf90cbe17ffcbd0e6cb44284bc30a116de69f229027172022-11-27 9:51:352 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.018691588785046728 AVAX
0x6d3237a231be70d0fc732134ca2bf90cbe17ffcbd0e6cb44284bc30a116de69f229027172022-11-27 9:51:352 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x0961754a17b0f97a16244fa19e7df80d139525ad0.93457943925233645 AVAX
0xcd0b5f7a2e921fceec95aa3994a101e526528404ba8eca2e63138e02704c3503229017632022-11-27 9:18:542 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb6359df5000d83cb88c04a40084288f5adebf3230.056074766355140186 AVAX
0xcd0b5f7a2e921fceec95aa3994a101e526528404ba8eca2e63138e02704c3503229017632022-11-27 9:18:542 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.022429906542056074 AVAX
0xcd0b5f7a2e921fceec95aa3994a101e526528404ba8eca2e63138e02704c3503229017632022-11-27 9:18:542 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x0961754a17b0f97a16244fa19e7df80d139525ad1.12149532710280374 AVAX
0x525dfdef11e3e653616e14560ed7525d7991d1e3d43499babddf43535b41472f229017562022-11-27 9:18:402 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb6359df5000d83cb88c04a40084288f5adebf3230.046728971962616822 AVAX
0x525dfdef11e3e653616e14560ed7525d7991d1e3d43499babddf43535b41472f229017562022-11-27 9:18:402 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.018691588785046728 AVAX
0x525dfdef11e3e653616e14560ed7525d7991d1e3d43499babddf43535b41472f229017562022-11-27 9:18:402 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x0961754a17b0f97a16244fa19e7df80d139525ad0.93457943925233645 AVAX
0x80d5d2a7f2d9261141952eca71ab2b334ae618ffddf5584575d4b94e2ef6dcb8229017462022-11-27 9:18:202 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb6359df5000d83cb88c04a40084288f5adebf3230.032710280373831775 AVAX
0x80d5d2a7f2d9261141952eca71ab2b334ae618ffddf5584575d4b94e2ef6dcb8229017462022-11-27 9:18:202 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.01308411214953271 AVAX
0x80d5d2a7f2d9261141952eca71ab2b334ae618ffddf5584575d4b94e2ef6dcb8229017462022-11-27 9:18:202 days 2 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x0961754a17b0f97a16244fa19e7df80d139525ad0.654205607476635515 AVAX
0x6cca4a295c4c45e7e0a03891c54889dc4ba939a43c3476b6bc464450b67b6cf9228855682022-11-27 0:04:392 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.013725490196078431 AVAX
0x6cca4a295c4c45e7e0a03891c54889dc4ba939a43c3476b6bc464450b67b6cf9228855682022-11-27 0:04:392 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x0961754a17b0f97a16244fa19e7df80d139525ad0.686274509803921569 AVAX
0x369e795c91a8d9ba2a4d0928bdea974c3dad0e57164ceca15b63b3bcad41eda6228852162022-11-26 23:52:352 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x03550e0207bf73beb7f834d2ae2490df128603170.038461538461538461 AVAX
0x369e795c91a8d9ba2a4d0928bdea974c3dad0e57164ceca15b63b3bcad41eda6228852162022-11-26 23:52:352 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.038461538461538461 AVAX
0x369e795c91a8d9ba2a4d0928bdea974c3dad0e57164ceca15b63b3bcad41eda6228852162022-11-26 23:52:352 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb9b9eadbdab25754a36dc176c34e6519e9b7ff3f1.923076923076923078 AVAX
0xc142cf50426a243d99c47ae197c95c6a81aadd322f5db2bcf901723bf096c8f3228847792022-11-26 23:37:222 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x6f8940df422765f278664c836e4e6931800fadab0.017454545454545454 AVAX
0xc142cf50426a243d99c47ae197c95c6a81aadd322f5db2bcf901723bf096c8f3228847792022-11-26 23:37:222 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.004363636363636363 AVAX
0xc142cf50426a243d99c47ae197c95c6a81aadd322f5db2bcf901723bf096c8f3228847792022-11-26 23:37:222 days 12 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x0d8224618d5640555cdc4728fb5de0ff218dff300.218181818181818183 AVAX
0x4b0d09a2b7dbfb4ec269c7a63aeb3c2d0cc520fdb4641e095b03cbee71a8229a228739272022-11-26 17:24:582 days 18 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xb22fc8e22cac0b95b381dea7ea86705a7d622df00.077064220183486238 AVAX
0x4b0d09a2b7dbfb4ec269c7a63aeb3c2d0cc520fdb4641e095b03cbee71a8229a228739272022-11-26 17:24:582 days 18 hrs ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.022018348623853211 AVAX
[ Download CSV Export 
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

Contract Source Code (Solidity Standard Json-Input format)

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

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

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

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

pragma solidity ^0.8.0;

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

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

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

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

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

File 9 of 13 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 11 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

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

Contract ABI

[{"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"}]

60a0604052601460015560506002556005805461ffff19166114011790556107086006556301e133806007553480156200003857600080fd5b5060405162004433380380620044338339810160408190526200005b91620000cd565b62000066336200007d565b60016004556001600160a01b0316608052620000ff565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000e057600080fd5b81516001600160a01b0381168114620000f857600080fd5b9392505050565b6080516142f56200013e600039600081816102f60152818161270c01528181612772015281816127e401528181612f7f015261305401526142f56000f3fe6080604052600436106101fe5760003560e01c8063861b69d61161011d578063cdea490d116100b0578063ee8ef34d1161007f578063f8ad6f6211610064578063f8ad6f6214610642578063f8e7b93614610662578063feb884061461068257600080fd5b8063ee8ef34d1461060c578063f2fde38b1461062257600080fd5b8063cdea490d1461058c578063cf6ac953146105ac578063eb3e87b9146105cc578063eb635ab8146105ec57600080fd5b806396f97164116100ec57806396f971641461050c578063a3c0b5f01461052c578063b43d901d1461054c578063b6be53ba1461056c57600080fd5b8063861b69d61461043a5780638abdf5aa146104975780638da5cb5b146104c157806390bc4e37146104ec57600080fd5b80634313e9bd1161019557806366c1e8bf1161016457806366c1e8bf146103dc57806368f8fc10146103fc5780636d0042b81461040f578063715018a61461042557600080fd5b80634313e9bd1461035a57806345105cb11461037a578063453dfc50146103a757806355c338aa146103bc57600080fd5b80632426fc24116101d15780632426fc241461029a5780632c20d1b4146102ba5780633013ce29146102e757806333549d3d1461033b57600080fd5b80630609d09514610203578063064a59d01461022557806319d334cb1461024d5780631f77a8201461026d575b600080fd5b34801561020f57600080fd5b5061022361021e366004613ca1565b6106a2565b005b34801561023157600080fd5b5060055460ff1660405190151581526020015b60405180910390f35b34801561025957600080fd5b50610223610268366004613ccd565b610807565b34801561027957600080fd5b5061028d610288366004613ca1565b610a99565b6040516102449190613d0e565b3480156102a657600080fd5b506102236102b5366004613d4f565b610c39565b3480156102c657600080fd5b506102da6102d5366004613d68565b610cbf565b6040516102449190613d9d565b3480156102f357600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610244565b34801561034757600080fd5b506006545b604051908152602001610244565b34801561036657600080fd5b50610223610375366004613e22565b610e14565b34801561038657600080fd5b5061039a610395366004613d68565b611190565b6040516102449190613e5d565b3480156103b357600080fd5b5060075461034c565b3480156103c857600080fd5b506102236103d7366004613ccd565b611351565b3480156103e857600080fd5b506102da6103f7366004613ca1565b611491565b61022361040a366004613ca1565b611662565b34801561041b57600080fd5b5061034c60015481565b34801561043157600080fd5b50610223611aab565b34801561044657600080fd5b5061045a610455366004613ed6565b611b38565b60408051825173ffffffffffffffffffffffffffffffffffffffff9081168252602080850151908301529282015190921690820152606001610244565b3480156104a357600080fd5b50600554610100900460ff1660405160ff9091168152602001610244565b3480156104cd57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610316565b3480156104f857600080fd5b5061028d610507366004613ef3565b611c5d565b34801561051857600080fd5b5061028d610527366004613ca1565b611d28565b34801561053857600080fd5b50610223610547366004613d4f565b611de9565b34801561055857600080fd5b50610223610567366004613e22565b611e6f565b34801561057857600080fd5b50610223610587366004613f43565b61217e565b34801561059857600080fd5b506102236105a7366004613d4f565b612230565b3480156105b857600080fd5b506102da6105c7366004613f60565b6122b6565b3480156105d857600080fd5b506102236105e7366004613fa6565b612412565b3480156105f857600080fd5b5061034c610607366004613ed6565b612946565b34801561061857600080fd5b5061034c60025481565b34801561062e57600080fd5b5061022361063d366004613ed6565b61297d565b34801561064e57600080fd5b5061022361065d366004613fee565b612aad565b34801561066e57600080fd5b5061034c61067d366004613ed6565b612bfb565b34801561068e57600080fd5b5061022361069d366004613ca1565b612c29565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600860209081526040808320858452600501825280832033808552600291820184529382902082516080810184528154815260018201549481019490945290810154909416908201819052600390930154606082015291146107a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54686973206164647265737320646f65736e2774206861766520626964206f6e60448201527f207468697320746f6b656e00000000000000000000000000000000000000000060648201526084015b60405180910390fd5b818373ffffffffffffffffffffffffffffffffffffffff167fef9d84bc41d1a54361c4bf46f5e11b7c90a3fcb4e604b1b24e0e35d0fa371604836040516107ef9190613d0e565b60405180910390a3610802838333612da7565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610888576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60025481111561091a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b600061092584611b38565b6040015173ffffffffffffffffffffffffffffffffffffffff16146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f436f6c6c656374696f6e20726f79616c747920726563697069656e7420616c7260448201527f6561647920736574000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff8085168083526020808401868152338587019081528985166000818152600390945292879020955186549086167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161787559151600187015551600290950180549590941694169390931790915591517fb6b61d78ac5372b51940cf3b322ea21839c456cade69acdf1b9fb9a6f79d6ff790610a8c9085815260200190565b60405180910390a3505050565b610ada60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b5060408051608081018252828152600060208083018290528284018290526060830182905273ffffffffffffffffffffffffffffffffffffffff86168252600881528382208583526005019052918220909190610b3690612ef0565b905060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff851660009081526008602090815260408083208784526005019091528120610b809083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a84526005018252808320848616845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150610c008782612f0d565b8015610c13575084602001518160200151115b15610c1c578094505b50508080610c2990614040565b915050610b3b565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600655565b60606000610ccc85612946565b90508084108015610cdd5750600083115b15610e0c578281610cee8287614079565b1115610d0157610cfe8583614091565b90505b8067ffffffffffffffff811115610d1a57610d1a6140a8565b604051908082528060200260200182016040528015610d8c57816020015b610d7960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b815260200190600190039081610d385790505b50925060005b81811015610e0957610dd987610288610dab8985614079565b73ffffffffffffffffffffffffffffffffffffffff8b16600090815260086020526040902060030190612efa565b848281518110610deb57610deb6140d7565b60200260200101819052508080610e0190614040565b915050610d92565b50505b509392505050565b60055460ff16610e80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190610e8f4283614091565b1015610f1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754610f294283614091565b1115610fb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160808101825285815260208101859052339181019190915260608101839052610fe48682612f0d565b61104a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f426964206973206e6f742076616c696400000000000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260086020526040902061107c9060030186613100565b5073ffffffffffffffffffffffffffffffffffffffff8616600090815260086020908152604080832088845260050190915290206110ba903361310c565b5073ffffffffffffffffffffffffffffffffffffffff86811660008181526008602090815260408083208a845260050182528083203384526002908101835292819020865181559186015160018301558581015192820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169390951692909217909355606084015160039093019290925590518691907fc547e24584f4dd2da70009d5141bf4344b59a0ce26cd8f7c5d5a28151a11f21990611180908590613d0e565b60405180910390a3505050505050565b6060600061119d85612bfb565b905080841080156111ae5750600083115b15610e0c5782816111bf8287614079565b11156111d2576111cf8583614091565b90505b8067ffffffffffffffff8111156111eb576111eb6140a8565b60405190808252806020026020018201604052801561125d57816020015b61124a60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b8152602001906001900390816112095790505b50925060005b81811015610e095760006112a561127a8884614079565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260086020526040902090612efa565b73ffffffffffffffffffffffffffffffffffffffff808a16600090815260086020908152604080832085845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150611318898261312e565b1561133c5780868481518110611330576113306140d7565b60200260200101819052505b5050808061134990614040565b915050611263565b6002548111156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b6113ec83611b38565b5173ffffffffffffffffffffffffffffffffffffffff1633146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4f6e6c792045524337323120726f79616c747920726563697069656e7420697360448201527f20616c6c6f77656420746f2073657420526f79616c7479000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602090815260408083208484526005019091528120606091906114d190612ef0565b90508067ffffffffffffffff8111156114ec576114ec6140a8565b60405190808252806020026020018201604052801561155e57816020015b61154b60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161150a5790505b50915060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff8516600090815260086020908152604080832087845260050190915281206115a99083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a845260050182528083208486168452600290810183529281902081516080810183528154815260018201549381019390935292830154909316928101929092526003015460608201529091506116298782612f0d565b1561164d5780858481518110611641576116416140d7565b60200260200101819052505b5050808061165a90614040565b915050611564565b600260045414156116cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b6002600481905573ffffffffffffffffffffffffffffffffffffffff8084166000908152600860209081526040808320868452850182529182902082516080810184528154815260018201549281019290925293840154909216908201526003909101546060820152611742838261312e565b6117a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e206973206e6f7420666f722073616c650000000000000000000000604482015260640161079f565b6117b383833361316c565b15611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f546f6b656e206f776e65722063616e277420627579207468656972206f776e2060448201527f746f6b656e000000000000000000000000000000000000000000000000000000606482015260840161079f565b80602001513410156118d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f5468652076616c75652073656e642069732062656c6f772073616c652070726960448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b6000806118e585846020015161326d565b9150915061190d83604001518284346118fe9190614091565b6119089190614091565b6132f2565b61193561192f60005473ffffffffffffffffffffffffffffffffffffffff1690565b836132f2565b600061194086611b38565b51905073ffffffffffffffffffffffffffffffffffffffff8116158015906119685750600082115b156119775761197781836132f2565b6040805185518152602080870151908201528582015173ffffffffffffffffffffffffffffffffffffffff90811682840152606080880151908301526080820186905260a08201859052915133928892908a16917f50a3cf2b1df7bd2994e752563ce6f85769fb50da66bbb9a9912d2d6066a6b4da9181900360c00190a460408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015233602482015260448101879052908716906342842e0e90606401600060405180830381600087803b158015611a7157600080fd5b505af1158015611a85573d6000803e3d6000fd5b50505050611a93868661344c565b611a9e868633612da7565b5050600160045550505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b611b366000613500565b565b604080516060810182526000808252602082018190529181019190915273ffffffffffffffffffffffffffffffffffffffff8281166000908152600360205260409020600201541615611bd8575073ffffffffffffffffffffffffffffffffffffffff9081166000908152600360209081526040918290208251606081018452815485168152600182015492810192909252600201549092169082015290565b6000611be383613575565b905073ffffffffffffffffffffffffffffffffffffffff811615611c39576040805160608101825273ffffffffffffffffffffffffffffffffffffffff9092168252600154602083015260009082015292915050565b50506040805160608101825260008082526020820181905291810191909152919050565b611c9e60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526008602090815260408083208784526005018252808320868516845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611d1b8582612f0d565b15610e0c57949350505050565b611d6960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260086020908152604080832086845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611dd9848261312e565b15611de2578091505b5092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600755565b60055460ff16611edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190611eea4283614091565b1015611f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754611f844283614091565b1115612012576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b604080516080810182528581526020810185905233918101919091526060810183905261203f868261312e565b6120a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4c697374696e67206973206e6f742076616c6964000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff86811660008181526008602081815260408084208b855260028082018452828620895181558985015160018201559289015190830180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919098161790965560608701516003909101559290915290526121369086613100565b50848673ffffffffffffffffffffffffffffffffffffffff167ffc8bd63d1c4480fdf7501f95b3dd0ba53542a02abbab92c0f579468341741abd836040516111809190613d0e565b60005473ffffffffffffffffffffffffffffffffffffffff1633146121ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146122b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600255565b606060006122c386612946565b905080841080156122d45750600083115b156124095782816122e58287614079565b11156122f8576122f58583614091565b90505b8067ffffffffffffffff811115612311576123116140a8565b60405190808252806020026020018201604052801561238357816020015b61237060405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161232f5790505b50925060005b81811015612406576123d6886123d06123a28985614079565b73ffffffffffffffffffffffffffffffffffffffff8c16600090815260086020526040902060030190612efa565b89611c5d565b8482815181106123e8576123e86140d7565b602002602001018190525080806123fe90614040565b915050612389565b50505b50949350505050565b6002600454141561247f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b600260045561248f84843361316c565b61251b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20616363657074206269642060448201527f6f6620746f6b656e000000000000000000000000000000000000000000000000606482015260840161079f565b6125258484613617565b80612535575061253584336136ff565b6125c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f54686520746f6b656e206973206e6f7420617070726f76656420746f2074726160448201527f6e736665722062792074686520636f6e74726163740000000000000000000000606482015260840161079f565b60006125ce858585611c5d565b8051909150841480156125e45750818160200151145b801561261f57508273ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16145b6126ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5468697320746f6b656e20646f65736e277420686176652061206d617463686960448201527f6e67206269640000000000000000000000000000000000000000000000000000606482015260840161079f565b60006126b686611b38565b6000015190506000806126cd88856020015161326d565b91509150612734846040015133838588602001516126eb9190614091565b6126f59190614091565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169291906137b1565b61279a846040015161275b60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169190856137b1565b73ffffffffffffffffffffffffffffffffffffffff8316158015906127bf5750600081115b1561280c57604084015161280c9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169085846137b1565b60408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101899052908916906342842e0e90606401600060405180830381600087803b15801561288857600080fd5b505af115801561289c573d6000803e3d6000fd5b50506040805187518152602080890151908201528782015173ffffffffffffffffffffffffffffffffffffffff908116828401526060808a0151908301526080820187905260a0820186905291513394508b9350918c16917fcc8a6de82515ca1ae870ff05651038b858e8bcd1b5143c342987b6dc3c3434539181900360c00190a4612928888861344c565b61293788888660400151612da7565b50506001600455505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790600301612ef0565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146129fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8116612aa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161079f565b612aaa81613500565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314612b2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60198160ff161115612bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f417474656d707420746f207365742070657263656e746167652068696768657260448201527f207468616e20322e35252e000000000000000000000000000000000000000000606482015260840161079f565b6005805460ff909216610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790612ef0565b73ffffffffffffffffffffffffffffffffffffffff828116600090815260086020908152604080832085845260029081019092529091200154163314612cf1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4f6e6c7920746f6b656e2073656c6c65722063616e2064656c69737420746f6b60448201527f656e000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260408083208584526002019091529081902090518392917f835a0a426c94e53ab00dd6cf617ba68d1fa6c9162ef7a036b80be930c9a32c5391612d9191908154815260018201546020820152600282015473ffffffffffffffffffffffffffffffffffffffff166040820152600390910154606082015260800190565b60405180910390a3612da3828261344c565b5050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612de49082613846565b156108025773ffffffffffffffffffffffffffffffffffffffff80841660009081526008602090815260408083208684526005018083528184209486168452600280860184529184208481556001810185905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018390559185905252612e779082613875565b5073ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612eb490612ef0565b6108025773ffffffffffffffffffffffffffffffffffffffff83166000908152600860205260409020612eea9060030183613897565b50505050565b6000612977825490565b6000612f0683836138a3565b9392505050565b6000612f22838360000151846040015161316c565b158015612ffe5750602082015160408084015190517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201523060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063dd62ed3e9060440160206040518083038186803b158015612fc357600080fd5b505afa158015612fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ffb9190614106565b10155b80156130d35750602082015160408084015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527f0000000000000000000000000000000000000000000000000000000000000000909116906370a082319060240160206040518083038186803b15801561309857600080fd5b505afa1580156130ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d09190614106565b10155b80156130e3575060008260200151115b80156130f25750428260600151115b156129775750600192915050565b6000612f0683836138cd565b6000612f068373ffffffffffffffffffffffffffffffffffffffff84166138cd565b6000613143838360000151846040015161316c565b80156130d35750613158838360000151613617565b806130d357506130d38383604001516136ff565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101839052600090849073ffffffffffffffffffffffffffffffffffffffff821690636352211e9060240160206040518083038186803b1580156131d757600080fd5b505afa925050508015613225575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526132229181019061411f565b60015b613233576000915050612f06565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b600080600061327b85611b38565b60200151600554909150600090829061329e90610100900460ff166103e861413c565b61ffff166132ac9190614079565b60055490915081906132c690610100900460ff1687614162565b6132d0919061419f565b9350806132dd8387614162565b6132e7919061419f565b925050509250929050565b8047101561335c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161079f565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146133b6576040519150601f19603f3d011682016040523d82523d6000602084013e6133bb565b606091505b5050905080610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260086020526040902061347b908261391c565b15612da35773ffffffffffffffffffffffffffffffffffffffff82166000818152600860208181526040808420868552600280820184529185208581556001810186905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018490559390925290526108029082613897565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156135bd57600080fd5b505afa92505050801561360b575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526136089181019061411f565b60015b61297757506000919050565b6040517f081812fc00000000000000000000000000000000000000000000000000000000815260048101829052600090839073ffffffffffffffffffffffffffffffffffffffff82169063081812fc9060240160206040518083038186803b15801561368257600080fd5b505afa9250505080156136d0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526136cd9181019061411f565b60015b6136de576000915050612977565b73ffffffffffffffffffffffffffffffffffffffff16301491506129779050565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152306024830152600091849182169063e985e9c59060440160206040518083038186803b15801561377157600080fd5b505afa158015613785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a991906141da565b949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612eea908590613934565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515612f06565b6000612f068373ffffffffffffffffffffffffffffffffffffffff8416613a40565b6000612f068383613a40565b60008260000182815481106138ba576138ba6140d7565b9060005260206000200154905092915050565b600081815260018301602052604081205461391457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612977565b506000612977565b60008181526001830160205260408120541515612f06565b6000613996826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b339092919063ffffffff16565b80519091501561080257808060200190518101906139b491906141da565b610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161079f565b60008181526001830160205260408120548015613b29576000613a64600183614091565b8554909150600090613a7890600190614091565b9050818114613add576000866000018281548110613a9857613a986140d7565b9060005260206000200154905080876000018481548110613abb57613abb6140d7565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613aee57613aee6141f7565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050612977565b6000915050612977565b60606137a9848460008585843b613ba6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161079f565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613bcf9190614252565b60006040518083038185875af1925050503d8060008114613c0c576040519150601f19603f3d011682016040523d82523d6000602084013e613c11565b606091505b5091509150613c21828286613c2c565b979650505050505050565b60608315613c3b575081612f06565b825115613c4b5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079f919061426e565b73ffffffffffffffffffffffffffffffffffffffff81168114612aaa57600080fd5b60008060408385031215613cb457600080fd5b8235613cbf81613c7f565b946020939093013593505050565b600080600060608486031215613ce257600080fd5b8335613ced81613c7f565b92506020840135613cfd81613c7f565b929592945050506040919091013590565b815181526020808301519082015260408083015173ffffffffffffffffffffffffffffffffffffffff16908201526060808301519082015260808101612977565b600060208284031215613d6157600080fd5b5035919050565b600080600060608486031215613d7d57600080fd5b8335613d8881613c7f565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b81811015613e1657613e03838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613db9565b50909695505050505050565b60008060008060808587031215613e3857600080fd5b8435613e4381613c7f565b966020860135965060408601359560600135945092505050565b6020808252825182820181905260009190848201906040850190845b81811015613e1657613ec3838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613e79565b600060208284031215613ee857600080fd5b8135612f0681613c7f565b600080600060608486031215613f0857600080fd5b8335613f1381613c7f565b9250602084013591506040840135613f2a81613c7f565b809150509250925092565b8015158114612aaa57600080fd5b600060208284031215613f5557600080fd5b8135612f0681613f35565b60008060008060808587031215613f7657600080fd5b8435613f8181613c7f565b93506020850135613f9181613c7f565b93969395505050506040820135916060013590565b60008060008060808587031215613fbc57600080fd5b8435613fc781613c7f565b9350602085013592506040850135613fde81613c7f565b9396929550929360600135925050565b60006020828403121561400057600080fd5b813560ff81168114612f0657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561407257614072614011565b5060010190565b6000821982111561408c5761408c614011565b500190565b6000828210156140a3576140a3614011565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561411857600080fd5b5051919050565b60006020828403121561413157600080fd5b8151612f0681613c7f565b600061ffff80831681851680830382111561415957614159614011565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561419a5761419a614011565b500290565b6000826141d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156141ec57600080fd5b8151612f0681613f35565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015614241578181015183820152602001614229565b83811115612eea5750506000910152565b60008251614264818460208701614226565b9190910192915050565b602081526000825180602084015261428d816040850160208701614226565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220630620d8c6854c447666b4d5d0b54b67c9f542fdad4fcb8bcea08316f323b73d64736f6c63430008090033000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7

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

000000000000000000000000b31f66aa3c1e785363f0875a1b74e27b85fd66c7

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

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


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