Contract 0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739 6

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x7b476a3f73f7bd620a0bbca552235e707aeb59bc79ceb23cc6a4c1164be6461fList Token485365222022-10-06 7:43:5432 mins ago0x6cde214de4a7d84df4542e1ae0b7d4b2251b910e IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00126884
0x79914c7a592312c0ab80f85861e4c2d27de4e23a40e77b37ee729fd5f68113d8List Token485364992022-10-06 7:43:3232 mins ago0x6cde214de4a7d84df4542e1ae0b7d4b2251b910e IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00126884
0xf5ca37737cda23fe78c8ab707bfddfb7c9913237741d88e8f042bb2887e9eda2List Token485364802022-10-06 7:43:1233 mins ago0x6cde214de4a7d84df4542e1ae0b7d4b2251b910e IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00126884
0xaf7364c6bf8fb79ad8fafe66a3ffd6187998478d3b717937d00b86d69efcdc63List Token485357452022-10-06 7:29:4246 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369702
0x661f3092400d5db51d3da5d93f66f54bad969e25a7fdecab34bb64333cc2878eList Token485357262022-10-06 7:29:2446 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369702
0x7255a726c6312dc670f4134df185bdcee172d1a2e64c2e1724f4b2554bb1b0baList Token485357042022-10-06 7:29:0347 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369702
0xdc0009ee3fd5321e1038709f0811b974b32178d21a378060904b2027359ed6c6List Token485356882022-10-06 7:28:3247 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369726
0xbbfa0c1d4081ffdcb59eaa3fc5b3e52b85d0ff267acf479493a15b45b3040d4dList Token485356572022-10-06 7:27:5948 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369702
0x0c135682d5794c3b9f4e2f0e49a0e81839cad4e30ff64fa933dfce14331614c5List Token485356402022-10-06 7:27:4248 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00124552
0xd4e8c82a4e8716be810a8b9c0fd770e0c81d9d89bb2d3456328f986c3a10d1afList Token485356242022-10-06 7:27:2448 mins ago0x7d36dcda42632654b4d84d0120d94f92cc317e6c IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00124528
0x2f605ebeee7c387e4a96849e5f4e77ff30442b47083a80dc8f249b74152cfb68List Token485356032022-10-06 7:27:0349 mins ago0xeab8e50f305c3b97aa5eb818e09a59124c357b91 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00124682
0x81502082146daef3985a1161821f2d904f64ad91da80238acf9606169ef40176List Token485355142022-10-06 7:25:2850 mins ago0xeab8e50f305c3b97aa5eb818e09a59124c357b91 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369856
0xf6b1df1153f96c797cf3e19d1ef17e96d3c8e063212a396a46e7ee6d64e409c4List Token485348702022-10-06 7:13:561 hr 2 mins ago0xeab8e50f305c3b97aa5eb818e09a59124c357b91 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00132608
0x5c25829e1526ab27b1a1b91e38f9e8b64076b0317fcbaf2c79868de3d37711c2Buy Token485342332022-10-06 7:03:021 hr 13 mins ago0x3a335085e6d79a0a3bee0fddbd3b932e61d0d8a0 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d073945 FTM0.00343368
0x15366c65f3431cf3df30e61cad7255eaaf33fcbd161f40fff78e70eef6809611Buy Token485341332022-10-06 7:01:121 hr 15 mins ago0xdee3366e3e650ba12f2802b6c21a6cfbc2113391 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d073918 FTM0.00362512
0x5062d987235270da7a33a4914a81be3529f98d093f0af5b71ddbb6fb5de2da6bList Token485340082022-10-06 6:58:431 hr 17 mins ago0x079333a91672f05a5cf2ab38b915fe7e1172596b IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369614
0x1035fd32d2a13af417c9a75a2c9280827cc21e35fb5d6af80f182c7ab458fca2Delist Token485328512022-10-06 6:38:381 hr 37 mins ago0xf9676212112fe8d3521cf5f855d371a4ce7de650 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00116392
0xae0e3b3598fc3e53a56136f68d6ce371b8ca924973a3000dc6d32f4d19dbad45Delist Token485328042022-10-06 6:37:521 hr 38 mins ago0xf9676212112fe8d3521cf5f855d371a4ce7de650 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00116372
0x9a6c8148ff70fa4e61df31c2fcaf1a3c6d6387f971ee7d2ed4644c4e5c0aaa20Buy Token485312432022-10-06 6:09:182 hrs 6 mins ago0x2755d8cb6afce6431d788e31545b311339bb8d3e IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739100 FTM0.00356698
0xd330b4fa4babb827022fca3d1b4e3aca60b8a06cb03e7339563cbc5dc9b138aaList Token485310892022-10-06 6:06:492 hrs 9 mins ago0xffdbaa152405cc604c02c6f7a2d1e5ab838d1899 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00124444
0x519ba26db449ade61edf407cb369940f488812ed41e1416b55b17618f164257dEnter Bid For To...485310292022-10-06 6:05:462 hrs 10 mins ago0xffdbaa152405cc604c02c6f7a2d1e5ab838d1899 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00378342
0x0c7234b29b349713d1ac622f740cee5a7d9c36102152ef65e6a30fa0b6504c30List Token485304982022-10-06 5:56:272 hrs 19 mins ago0x6cde214de4a7d84df4542e1ae0b7d4b2251b910e IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00126884
0x790674b86e64865e0c944884dad557a3be64d83de40d82d90f74917aabb1fd2aList Token485304452022-10-06 5:55:192 hrs 20 mins ago0x9ec9803e29b3169bce9d53cef6eb56cfa74f78de IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369682
0xc7e57abc4bde07757b83e7c2d770d328edd7219fc4f298057c6891c4513bb385List Token485304242022-10-06 5:54:462 hrs 21 mins ago0x9ec9803e29b3169bce9d53cef6eb56cfa74f78de IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369682
0xe1f878ebed186a679191a56a4bbba75b0ffc5b36a0825353207187a2ccc55c27List Token485303912022-10-06 5:54:112 hrs 22 mins ago0x0198db21cc1ca21bc8cb01d72c19ceaf3afbfdc2 IN  0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390 FTM0.00369616
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x5c25829e1526ab27b1a1b91e38f9e8b64076b0317fcbaf2c79868de3d37711c2485342332022-10-06 7:03:021 hr 13 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xadb14d89ee2061c48b2bf27717e1fa3b817a777f1.492890995260663507 FTM
0x5c25829e1526ab27b1a1b91e38f9e8b64076b0317fcbaf2c79868de3d37711c2485342332022-10-06 7:03:021 hr 13 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.853080568720379146 FTM
0x5c25829e1526ab27b1a1b91e38f9e8b64076b0317fcbaf2c79868de3d37711c2485342332022-10-06 7:03:021 hr 13 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xa73c784ed2c4bc31c83aea4aeaa02fd1f65f1ee942.654028436018957347 FTM
0x15366c65f3431cf3df30e61cad7255eaaf33fcbd161f40fff78e70eef6809611485341332022-10-06 7:01:121 hr 15 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x6be36207a798ad72f32238a220a79b0b9f0338881.232876712328767123 FTM
0x15366c65f3431cf3df30e61cad7255eaaf33fcbd161f40fff78e70eef6809611485341332022-10-06 7:01:121 hr 15 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.328767123287671232 FTM
0x15366c65f3431cf3df30e61cad7255eaaf33fcbd161f40fff78e70eef6809611485341332022-10-06 7:01:121 hr 15 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xc4d1356818314af3dce6d6471c774c8e712dd95016.438356164383561645 FTM
0x9a6c8148ff70fa4e61df31c2fcaf1a3c6d6387f971ee7d2ed4644c4e5c0aaa20485312432022-10-06 6:09:182 hrs 6 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x7abcd5a3f77553a87f6a98b3d49bd559ae8b83295.555555555555555555 FTM
0x9a6c8148ff70fa4e61df31c2fcaf1a3c6d6387f971ee7d2ed4644c4e5c0aaa20485312432022-10-06 6:09:182 hrs 6 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f91.851851851851851851 FTM
0x9a6c8148ff70fa4e61df31c2fcaf1a3c6d6387f971ee7d2ed4644c4e5c0aaa20485312432022-10-06 6:09:182 hrs 6 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xa6e950aa70ebaaf99686a5d95afe8aca8b5e353b92.592592592592592594 FTM
0x4666b1f1d56dadd45ca4afd1db207a3e9f6536e5a422355e66e64113fd64ebe2485272772022-10-06 4:58:003 hrs 18 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x4749532f389487297cda9308b5b8449e50d4769b0.186915887850467289 FTM
0x4666b1f1d56dadd45ca4afd1db207a3e9f6536e5a422355e66e64113fd64ebe2485272772022-10-06 4:58:003 hrs 18 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.074766355140186915 FTM
0x4666b1f1d56dadd45ca4afd1db207a3e9f6536e5a422355e66e64113fd64ebe2485272772022-10-06 4:58:003 hrs 18 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x30a26c2837e9ad41ea5955949f00402dbf86f1243.738317757009345796 FTM
0x7b26bbea20dfaf30a1b37e343a843cf3bc5395725d16008174b9e4b141eb332d485271132022-10-06 4:55:063 hrs 21 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xe9597fb1d15376cd25323a33c0c46dd08048e5581.123853211009174311 FTM
0x7b26bbea20dfaf30a1b37e343a843cf3bc5395725d16008174b9e4b141eb332d485271132022-10-06 4:55:063 hrs 21 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.32110091743119266 FTM
0x7b26bbea20dfaf30a1b37e343a843cf3bc5395725d16008174b9e4b141eb332d485271132022-10-06 4:55:063 hrs 21 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xe9db81a85fdc1f28239bdca8d3054ad39f44a8d516.055045871559633029 FTM
0x6f3aad4b01c8306087c240fb0bdc400e9100b0bd282aa1c4d865c6423a5a0a8f485271062022-10-06 4:54:513 hrs 21 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xe9597fb1d15376cd25323a33c0c46dd08048e5580.963302752293577981 FTM
0x6f3aad4b01c8306087c240fb0bdc400e9100b0bd282aa1c4d865c6423a5a0a8f485271062022-10-06 4:54:513 hrs 21 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.275229357798165137 FTM
0x6f3aad4b01c8306087c240fb0bdc400e9100b0bd282aa1c4d865c6423a5a0a8f485271062022-10-06 4:54:513 hrs 21 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390xe9db81a85fdc1f28239bdca8d3054ad39f44a8d513.761467889908256882 FTM
0x7bb6860664405f5cc1c9ba60887386e8f3a5320e0fae2f1b08341363be5480a6485252982022-10-06 4:21:023 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739 0x56ab21f58e06da7218f29104c9e134b4eacba6400.618181818181818181 FTM
0x7bb6860664405f5cc1c9ba60887386e8f3a5320e0fae2f1b08341363be5480a6485252982022-10-06 4:21:023 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.154545454545454545 FTM
0x7bb6860664405f5cc1c9ba60887386e8f3a5320e0fae2f1b08341363be5480a6485252982022-10-06 4:21:023 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x4cc21fda704c7761742899d01f197c7b1e4233ac7.727272727272727274 FTM
0xc1a50ce2c24ed78c58b98eaa695c1d0ad479df99f39afd3196e697cc1b95e4e1485252882022-10-06 4:20:373 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739 0x56ab21f58e06da7218f29104c9e134b4eacba6400.618181818181818181 FTM
0xc1a50ce2c24ed78c58b98eaa695c1d0ad479df99f39afd3196e697cc1b95e4e1485252882022-10-06 4:20:373 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1d28577186e6c3fa278b844b578d420d97b9b1f90.154545454545454545 FTM
0xc1a50ce2c24ed78c58b98eaa695c1d0ad479df99f39afd3196e697cc1b95e4e1485252882022-10-06 4:20:373 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d07390x1f6dcad39880a1ab112b1e3b23d22eb6ebc162b47.727272727272727274 FTM
0x2f29a0f6922ed2a7bc502a01ce7ef74e201fc3550a6ccb8a45a1d4251063b286485252792022-10-06 4:20:213 hrs 55 mins ago 0x1a7d6ed890b6c284271ad27e7abe8fb5211d0739 0x56ab21f58e06da7218f29104c9e134b4eacba6400.504727272727272727 FTM
[ 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 Security Audit

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

60a0604052601460015560506002556005805461ffff19166114011790556107086006556301e133806007553480156200003857600080fd5b5060405162004433380380620044338339810160408190526200005b91620000cd565b62000066336200007d565b60016004556001600160a01b0316608052620000ff565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000e057600080fd5b81516001600160a01b0381168114620000f857600080fd5b9392505050565b6080516142f56200013e600039600081816102f60152818161270c01528181612772015281816127e401528181612f7f015261305401526142f56000f3fe6080604052600436106101fe5760003560e01c8063861b69d61161011d578063cdea490d116100b0578063ee8ef34d1161007f578063f8ad6f6211610064578063f8ad6f6214610642578063f8e7b93614610662578063feb884061461068257600080fd5b8063ee8ef34d1461060c578063f2fde38b1461062257600080fd5b8063cdea490d1461058c578063cf6ac953146105ac578063eb3e87b9146105cc578063eb635ab8146105ec57600080fd5b806396f97164116100ec57806396f971641461050c578063a3c0b5f01461052c578063b43d901d1461054c578063b6be53ba1461056c57600080fd5b8063861b69d61461043a5780638abdf5aa146104975780638da5cb5b146104c157806390bc4e37146104ec57600080fd5b80634313e9bd1161019557806366c1e8bf1161016457806366c1e8bf146103dc57806368f8fc10146103fc5780636d0042b81461040f578063715018a61461042557600080fd5b80634313e9bd1461035a57806345105cb11461037a578063453dfc50146103a757806355c338aa146103bc57600080fd5b80632426fc24116101d15780632426fc241461029a5780632c20d1b4146102ba5780633013ce29146102e757806333549d3d1461033b57600080fd5b80630609d09514610203578063064a59d01461022557806319d334cb1461024d5780631f77a8201461026d575b600080fd5b34801561020f57600080fd5b5061022361021e366004613ca1565b6106a2565b005b34801561023157600080fd5b5060055460ff1660405190151581526020015b60405180910390f35b34801561025957600080fd5b50610223610268366004613ccd565b610807565b34801561027957600080fd5b5061028d610288366004613ca1565b610a99565b6040516102449190613d0e565b3480156102a657600080fd5b506102236102b5366004613d4f565b610c39565b3480156102c657600080fd5b506102da6102d5366004613d68565b610cbf565b6040516102449190613d9d565b3480156102f357600080fd5b507f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610244565b34801561034757600080fd5b506006545b604051908152602001610244565b34801561036657600080fd5b50610223610375366004613e22565b610e14565b34801561038657600080fd5b5061039a610395366004613d68565b611190565b6040516102449190613e5d565b3480156103b357600080fd5b5060075461034c565b3480156103c857600080fd5b506102236103d7366004613ccd565b611351565b3480156103e857600080fd5b506102da6103f7366004613ca1565b611491565b61022361040a366004613ca1565b611662565b34801561041b57600080fd5b5061034c60015481565b34801561043157600080fd5b50610223611aab565b34801561044657600080fd5b5061045a610455366004613ed6565b611b38565b60408051825173ffffffffffffffffffffffffffffffffffffffff9081168252602080850151908301529282015190921690820152606001610244565b3480156104a357600080fd5b50600554610100900460ff1660405160ff9091168152602001610244565b3480156104cd57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff16610316565b3480156104f857600080fd5b5061028d610507366004613ef3565b611c5d565b34801561051857600080fd5b5061028d610527366004613ca1565b611d28565b34801561053857600080fd5b50610223610547366004613d4f565b611de9565b34801561055857600080fd5b50610223610567366004613e22565b611e6f565b34801561057857600080fd5b50610223610587366004613f43565b61217e565b34801561059857600080fd5b506102236105a7366004613d4f565b612230565b3480156105b857600080fd5b506102da6105c7366004613f60565b6122b6565b3480156105d857600080fd5b506102236105e7366004613fa6565b612412565b3480156105f857600080fd5b5061034c610607366004613ed6565b612946565b34801561061857600080fd5b5061034c60025481565b34801561062e57600080fd5b5061022361063d366004613ed6565b61297d565b34801561064e57600080fd5b5061022361065d366004613fee565b612aad565b34801561066e57600080fd5b5061034c61067d366004613ed6565b612bfb565b34801561068e57600080fd5b5061022361069d366004613ca1565b612c29565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600860209081526040808320858452600501825280832033808552600291820184529382902082516080810184528154815260018201549481019490945290810154909416908201819052600390930154606082015291146107a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54686973206164647265737320646f65736e2774206861766520626964206f6e60448201527f207468697320746f6b656e00000000000000000000000000000000000000000060648201526084015b60405180910390fd5b818373ffffffffffffffffffffffffffffffffffffffff167fef9d84bc41d1a54361c4bf46f5e11b7c90a3fcb4e604b1b24e0e35d0fa371604836040516107ef9190613d0e565b60405180910390a3610802838333612da7565b505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610888576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60025481111561091a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b600061092584611b38565b6040015173ffffffffffffffffffffffffffffffffffffffff16146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f436f6c6c656374696f6e20726f79616c747920726563697069656e7420616c7260448201527f6561647920736574000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff8085168083526020808401868152338587019081528985166000818152600390945292879020955186549086167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161787559151600187015551600290950180549590941694169390931790915591517fb6b61d78ac5372b51940cf3b322ea21839c456cade69acdf1b9fb9a6f79d6ff790610a8c9085815260200190565b60405180910390a3505050565b610ada60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b5060408051608081018252828152600060208083018290528284018290526060830182905273ffffffffffffffffffffffffffffffffffffffff86168252600881528382208583526005019052918220909190610b3690612ef0565b905060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff851660009081526008602090815260408083208784526005019091528120610b809083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a84526005018252808320848616845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150610c008782612f0d565b8015610c13575084602001518160200151115b15610c1c578094505b50508080610c2990614040565b915050610b3b565b505092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600655565b60606000610ccc85612946565b90508084108015610cdd5750600083115b15610e0c578281610cee8287614079565b1115610d0157610cfe8583614091565b90505b8067ffffffffffffffff811115610d1a57610d1a6140a8565b604051908082528060200260200182016040528015610d8c57816020015b610d7960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b815260200190600190039081610d385790505b50925060005b81811015610e0957610dd987610288610dab8985614079565b73ffffffffffffffffffffffffffffffffffffffff8b16600090815260086020526040902060030190612efa565b848281518110610deb57610deb6140d7565b60200260200101819052508080610e0190614040565b915050610d92565b50505b509392505050565b60055460ff16610e80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190610e8f4283614091565b1015610f1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754610f294283614091565b1115610fb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b6040805160808101825285815260208101859052339181019190915260608101839052610fe48682612f0d565b61104a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f426964206973206e6f742076616c696400000000000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260086020526040902061107c9060030186613100565b5073ffffffffffffffffffffffffffffffffffffffff8616600090815260086020908152604080832088845260050190915290206110ba903361310c565b5073ffffffffffffffffffffffffffffffffffffffff86811660008181526008602090815260408083208a845260050182528083203384526002908101835292819020865181559186015160018301558581015192820180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169390951692909217909355606084015160039093019290925590518691907fc547e24584f4dd2da70009d5141bf4344b59a0ce26cd8f7c5d5a28151a11f21990611180908590613d0e565b60405180910390a3505050505050565b6060600061119d85612bfb565b905080841080156111ae5750600083115b15610e0c5782816111bf8287614079565b11156111d2576111cf8583614091565b90505b8067ffffffffffffffff8111156111eb576111eb6140a8565b60405190808252806020026020018201604052801561125d57816020015b61124a60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b8152602001906001900390816112095790505b50925060005b81811015610e095760006112a561127a8884614079565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260086020526040902090612efa565b73ffffffffffffffffffffffffffffffffffffffff808a16600090815260086020908152604080832085845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152909150611318898261312e565b1561133c5780868481518110611330576113306140d7565b60200260200101819052505b5050808061134990614040565b915050611263565b6002548111156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f506c65617365207365742074686520726f79616c74792070657263656e74616e60448201527f67652062656c6f7720616c6c6f7765642072616e676500000000000000000000606482015260840161079f565b6113ec83611b38565b5173ffffffffffffffffffffffffffffffffffffffff1633146109cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f4f6e6c792045524337323120726f79616c747920726563697069656e7420697360448201527f20616c6c6f77656420746f2073657420526f79616c7479000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660009081526008602090815260408083208484526005019091528120606091906114d190612ef0565b90508067ffffffffffffffff8111156114ec576114ec6140a8565b60405190808252806020026020018201604052801561155e57816020015b61154b60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161150a5790505b50915060005b81811015610c315773ffffffffffffffffffffffffffffffffffffffff8516600090815260086020908152604080832087845260050190915281206115a99083612efa565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526008602090815260408083208a845260050182528083208486168452600290810183529281902081516080810183528154815260018201549381019390935292830154909316928101929092526003015460608201529091506116298782612f0d565b1561164d5780858481518110611641576116416140d7565b60200260200101819052505b5050808061165a90614040565b915050611564565b600260045414156116cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b6002600481905573ffffffffffffffffffffffffffffffffffffffff8084166000908152600860209081526040808320868452850182529182902082516080810184528154815260018201549281019290925293840154909216908201526003909101546060820152611742838261312e565b6117a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e206973206e6f7420666f722073616c650000000000000000000000604482015260640161079f565b6117b383833361316c565b15611840576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f546f6b656e206f776e65722063616e277420627579207468656972206f776e2060448201527f746f6b656e000000000000000000000000000000000000000000000000000000606482015260840161079f565b80602001513410156118d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f5468652076616c75652073656e642069732062656c6f772073616c652070726960448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b6000806118e585846020015161326d565b9150915061190d83604001518284346118fe9190614091565b6119089190614091565b6132f2565b61193561192f60005473ffffffffffffffffffffffffffffffffffffffff1690565b836132f2565b600061194086611b38565b51905073ffffffffffffffffffffffffffffffffffffffff8116158015906119685750600082115b156119775761197781836132f2565b6040805185518152602080870151908201528582015173ffffffffffffffffffffffffffffffffffffffff90811682840152606080880151908301526080820186905260a08201859052915133928892908a16917f50a3cf2b1df7bd2994e752563ce6f85769fb50da66bbb9a9912d2d6066a6b4da9181900360c00190a460408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015233602482015260448101879052908716906342842e0e90606401600060405180830381600087803b158015611a7157600080fd5b505af1158015611a85573d6000803e3d6000fd5b50505050611a93868661344c565b611a9e868633612da7565b5050600160045550505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b2c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b611b366000613500565b565b604080516060810182526000808252602082018190529181019190915273ffffffffffffffffffffffffffffffffffffffff8281166000908152600360205260409020600201541615611bd8575073ffffffffffffffffffffffffffffffffffffffff9081166000908152600360209081526040918290208251606081018452815485168152600182015492810192909252600201549092169082015290565b6000611be383613575565b905073ffffffffffffffffffffffffffffffffffffffff811615611c39576040805160608101825273ffffffffffffffffffffffffffffffffffffffff9092168252600154602083015260009082015292915050565b50506040805160608101825260008082526020820181905291810191909152919050565b611c9e60405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526008602090815260408083208784526005018252808320868516845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611d1b8582612f0d565b15610e0c57949350505050565b611d6960405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b73ffffffffffffffffffffffffffffffffffffffff808416600090815260086020908152604080832086845260029081018352928190208151608081018352815481526001820154938101939093529283015490931692810192909252600301546060820152611dd9848261312e565b15611de2578091505b5092915050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611e6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600755565b60055460ff16611edb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4c697374696e6720616e642062696420617265206e6f7420656e61626c656400604482015260640161079f565b6006548190611eea4283614091565b1015611f77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f506c6561736520656e7465722061206c6f6e67657220706572696f64206f662060448201527f74696d6500000000000000000000000000000000000000000000000000000000606482015260840161079f565b600754611f844283614091565b1115612012576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f506c6561736520656e74657220612073686f7274657220706572696f64206f6660448201527f2074696d65000000000000000000000000000000000000000000000000000000606482015260840161079f565b604080516080810182528581526020810185905233918101919091526060810183905261203f868261312e565b6120a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4c697374696e67206973206e6f742076616c6964000000000000000000000000604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff86811660008181526008602081815260408084208b855260028082018452828620895181558985015160018201559289015190830180547fffffffffffffffffffffffff000000000000000000000000000000000000000016919098161790965560608701516003909101559290915290526121369086613100565b50848673ffffffffffffffffffffffffffffffffffffffff167ffc8bd63d1c4480fdf7501f95b3dd0ba53542a02abbab92c0f579468341741abd836040516111809190613d0e565b60005473ffffffffffffffffffffffffffffffffffffffff1633146121ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600580547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146122b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b600255565b606060006122c386612946565b905080841080156122d45750600083115b156124095782816122e58287614079565b11156122f8576122f58583614091565b90505b8067ffffffffffffffff811115612311576123116140a8565b60405190808252806020026020018201604052801561238357816020015b61237060405180608001604052806000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081525090565b81526020019060019003908161232f5790505b50925060005b81811015612406576123d6886123d06123a28985614079565b73ffffffffffffffffffffffffffffffffffffffff8c16600090815260086020526040902060030190612efa565b89611c5d565b8482815181106123e8576123e86140d7565b602002602001018190525080806123fe90614040565b915050612389565b50505b50949350505050565b6002600454141561247f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161079f565b600260045561248f84843361316c565b61251b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20616363657074206269642060448201527f6f6620746f6b656e000000000000000000000000000000000000000000000000606482015260840161079f565b6125258484613617565b80612535575061253584336136ff565b6125c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603560248201527f54686520746f6b656e206973206e6f7420617070726f76656420746f2074726160448201527f6e736665722062792074686520636f6e74726163740000000000000000000000606482015260840161079f565b60006125ce858585611c5d565b8051909150841480156125e45750818160200151145b801561261f57508273ffffffffffffffffffffffffffffffffffffffff16816040015173ffffffffffffffffffffffffffffffffffffffff16145b6126ab576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f5468697320746f6b656e20646f65736e277420686176652061206d617463686960448201527f6e67206269640000000000000000000000000000000000000000000000000000606482015260840161079f565b60006126b686611b38565b6000015190506000806126cd88856020015161326d565b91509150612734846040015133838588602001516126eb9190614091565b6126f59190614091565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169291906137b1565b61279a846040015161275b60005473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169190856137b1565b73ffffffffffffffffffffffffffffffffffffffff8316158015906127bf5750600081115b1561280c57604084015161280c9073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169085846137b1565b60408481015190517f42842e0e00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff918216602482015260448101899052908916906342842e0e90606401600060405180830381600087803b15801561288857600080fd5b505af115801561289c573d6000803e3d6000fd5b50506040805187518152602080890151908201528782015173ffffffffffffffffffffffffffffffffffffffff908116828401526060808a0151908301526080820187905260a0820186905291513394508b9350918c16917fcc8a6de82515ca1ae870ff05651038b858e8bcd1b5143c342987b6dc3c3434539181900360c00190a4612928888861344c565b61293788888660400151612da7565b50506001600455505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790600301612ef0565b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146129fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b73ffffffffffffffffffffffffffffffffffffffff8116612aa1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161079f565b612aaa81613500565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314612b2e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161079f565b60198160ff161115612bc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f417474656d707420746f207365742070657263656e746167652068696768657260448201527f207468616e20322e35252e000000000000000000000000000000000000000000606482015260840161079f565b6005805460ff909216610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260086020526040812061297790612ef0565b73ffffffffffffffffffffffffffffffffffffffff828116600090815260086020908152604080832085845260029081019092529091200154163314612cf1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f4f6e6c7920746f6b656e2073656c6c65722063616e2064656c69737420746f6b60448201527f656e000000000000000000000000000000000000000000000000000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff821660008181526008602090815260408083208584526002019091529081902090518392917f835a0a426c94e53ab00dd6cf617ba68d1fa6c9162ef7a036b80be930c9a32c5391612d9191908154815260018201546020820152600282015473ffffffffffffffffffffffffffffffffffffffff166040820152600390910154606082015260800190565b60405180910390a3612da3828261344c565b5050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612de49082613846565b156108025773ffffffffffffffffffffffffffffffffffffffff80841660009081526008602090815260408083208684526005018083528184209486168452600280860184529184208481556001810185905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018390559185905252612e779082613875565b5073ffffffffffffffffffffffffffffffffffffffff831660009081526008602090815260408083208584526005019091529020612eb490612ef0565b6108025773ffffffffffffffffffffffffffffffffffffffff83166000908152600860205260409020612eea9060030183613897565b50505050565b6000612977825490565b6000612f0683836138a3565b9392505050565b6000612f22838360000151846040015161316c565b158015612ffe5750602082015160408084015190517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201523060248201527f00000000000000000000000000000000000000000000000000000000000000009091169063dd62ed3e9060440160206040518083038186803b158015612fc357600080fd5b505afa158015612fd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ffb9190614106565b10155b80156130d35750602082015160408084015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527f0000000000000000000000000000000000000000000000000000000000000000909116906370a082319060240160206040518083038186803b15801561309857600080fd5b505afa1580156130ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130d09190614106565b10155b80156130e3575060008260200151115b80156130f25750428260600151115b156129775750600192915050565b6000612f0683836138cd565b6000612f068373ffffffffffffffffffffffffffffffffffffffff84166138cd565b6000613143838360000151846040015161316c565b80156130d35750613158838360000151613617565b806130d357506130d38383604001516136ff565b6040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101839052600090849073ffffffffffffffffffffffffffffffffffffffff821690636352211e9060240160206040518083038186803b1580156131d757600080fd5b505afa925050508015613225575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526132229181019061411f565b60015b613233576000915050612f06565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050509392505050565b600080600061327b85611b38565b60200151600554909150600090829061329e90610100900460ff166103e861413c565b61ffff166132ac9190614079565b60055490915081906132c690610100900460ff1687614162565b6132d0919061419f565b9350806132dd8387614162565b6132e7919061419f565b925050509250929050565b8047101561335c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161079f565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146133b6576040519150601f19603f3d011682016040523d82523d6000602084013e6133bb565b606091505b5050905080610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161079f565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260086020526040902061347b908261391c565b15612da35773ffffffffffffffffffffffffffffffffffffffff82166000818152600860208181526040808420868552600280820184529185208581556001810186905591820180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905560039091018490559390925290526108029082613897565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008173ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156135bd57600080fd5b505afa92505050801561360b575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526136089181019061411f565b60015b61297757506000919050565b6040517f081812fc00000000000000000000000000000000000000000000000000000000815260048101829052600090839073ffffffffffffffffffffffffffffffffffffffff82169063081812fc9060240160206040518083038186803b15801561368257600080fd5b505afa9250505080156136d0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526136cd9181019061411f565b60015b6136de576000915050612977565b73ffffffffffffffffffffffffffffffffffffffff16301491506129779050565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152306024830152600091849182169063e985e9c59060440160206040518083038186803b15801561377157600080fd5b505afa158015613785573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a991906141da565b949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000179052612eea908590613934565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515612f06565b6000612f068373ffffffffffffffffffffffffffffffffffffffff8416613a40565b6000612f068383613a40565b60008260000182815481106138ba576138ba6140d7565b9060005260206000200154905092915050565b600081815260018301602052604081205461391457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612977565b506000612977565b60008181526001830160205260408120541515612f06565b6000613996826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b339092919063ffffffff16565b80519091501561080257808060200190518101906139b491906141da565b610802576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161079f565b60008181526001830160205260408120548015613b29576000613a64600183614091565b8554909150600090613a7890600190614091565b9050818114613add576000866000018281548110613a9857613a986140d7565b9060005260206000200154905080876000018481548110613abb57613abb6140d7565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613aee57613aee6141f7565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050612977565b6000915050612977565b60606137a9848460008585843b613ba6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161079f565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613bcf9190614252565b60006040518083038185875af1925050503d8060008114613c0c576040519150601f19603f3d011682016040523d82523d6000602084013e613c11565b606091505b5091509150613c21828286613c2c565b979650505050505050565b60608315613c3b575081612f06565b825115613c4b5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079f919061426e565b73ffffffffffffffffffffffffffffffffffffffff81168114612aaa57600080fd5b60008060408385031215613cb457600080fd5b8235613cbf81613c7f565b946020939093013593505050565b600080600060608486031215613ce257600080fd5b8335613ced81613c7f565b92506020840135613cfd81613c7f565b929592945050506040919091013590565b815181526020808301519082015260408083015173ffffffffffffffffffffffffffffffffffffffff16908201526060808301519082015260808101612977565b600060208284031215613d6157600080fd5b5035919050565b600080600060608486031215613d7d57600080fd5b8335613d8881613c7f565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b81811015613e1657613e03838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613db9565b50909695505050505050565b60008060008060808587031215613e3857600080fd5b8435613e4381613c7f565b966020860135965060408601359560600135945092505050565b6020808252825182820181905260009190848201906040850190845b81811015613e1657613ec3838551805182526020810151602083015273ffffffffffffffffffffffffffffffffffffffff6040820151166040830152606081015160608301525050565b9284019260809290920191600101613e79565b600060208284031215613ee857600080fd5b8135612f0681613c7f565b600080600060608486031215613f0857600080fd5b8335613f1381613c7f565b9250602084013591506040840135613f2a81613c7f565b809150509250925092565b8015158114612aaa57600080fd5b600060208284031215613f5557600080fd5b8135612f0681613f35565b60008060008060808587031215613f7657600080fd5b8435613f8181613c7f565b93506020850135613f9181613c7f565b93969395505050506040820135916060013590565b60008060008060808587031215613fbc57600080fd5b8435613fc781613c7f565b9350602085013592506040850135613fde81613c7f565b9396929550929360600135925050565b60006020828403121561400057600080fd5b813560ff81168114612f0657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561407257614072614011565b5060010190565b6000821982111561408c5761408c614011565b500190565b6000828210156140a3576140a3614011565b500390565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561411857600080fd5b5051919050565b60006020828403121561413157600080fd5b8151612f0681613c7f565b600061ffff80831681851680830382111561415957614159614011565b01949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561419a5761419a614011565b500290565b6000826141d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b6000602082840312156141ec57600080fd5b8151612f0681613f35565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015614241578181015183820152602001614229565b83811115612eea5750506000910152565b60008251614264818460208701614226565b9190910192915050565b602081526000825180602084015261428d816040850160208701614226565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220630620d8c6854c447666b4d5d0b54b67c9f542fdad4fcb8bcea08316f323b73d64736f6c6343000809003300000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83

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

00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83

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

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000021be370d5312f44cb42ce377bc9b8a0cef1a4c83


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.