Address Details
contract

0x894ed3e8D229267709614e857322864D7e9e8574

Contract Name
VirtuousBuynow
Creator
0x6d3f1b–09369f at 0xc2e6d1–ac2031
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
14265720
This contract has been verified via Sourcify. View contract in Sourcify repository
Contract name:
VirtuousBuynow




Optimization enabled
true
Compiler version
v0.8.4+commit.c7e474f2




Optimization runs
200
EVM Version
istanbul




Verified at
2023-01-22T22:03:19.219205Z

project:/contracts/VirtuousBuynow.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./VirtuousTokenServices.sol";
import "./IVirtuousContractFactory.sol";

contract VirtuousBuynow is Initializable, VirtuousTokenServices, ReentrancyGuardUpgradeable {
    
    using SafeMathUpgradeable for uint256;
    // static
    uint256 public price;
    uint256 public startTime;
    address private salesPerson;
    uint256 private salesPersonRoyaltyFeePercent;

    // static
    address[] private buyers; 
    mapping(uint256 => bool) public tokenSold;       

    // events
    event LogBuyToken(address buyer, uint256 tokenId, uint256 amount);    
    event Received(address sender, uint256 amount);
    event RoyaltyTransfer(uint256 merchantFee, uint256 marketplaceRoyalty, uint256 salesPersonRoyalty);

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }  

    function initialize(IERC20Upgradeable _erc20Token, address _beneficiary, uint256 _price, uint256 _startTime, uint256 _virtuousTokensIssued, uint256 _redeemQty, address _salesPerson, uint256 _marketplaceRoyaltyFeePercent, uint256 _salesPersonRoyaltyFeePercent, uint256 _maintenanceFee, maintenanceFeeDueType _feeDueType) initializer public {
        __ReentrancyGuard_init();
        __VirtuousTokenServices_init(_erc20Token, _beneficiary, _marketplaceRoyaltyFeePercent, _virtuousTokensIssued, _redeemQty, _maintenanceFee, _feeDueType);
        /// @celo:stable-token         
        require(_beneficiary != address(0x0), 'Beneficiary address is not correct!');
        salesPerson = _salesPerson;
        price = _price;
        startTime = _startTime;
        salesPersonRoyaltyFeePercent = _salesPersonRoyaltyFeePercent;
    }  

    function min(uint a, uint b)
        private
        pure
        returns (uint)
    {
        if (a < b) return a;
        return b;
    }    

    function getDealStatus() public
        view returns (string memory )
    {
        if( block.timestamp < startTime ) return 'not-started';
        return 'running';
    }

    function getMarketPlaceRoyaltyFeePercent() external 
        onlyContractFactoryOwner      
        view returns (uint256)
    {
        return marketplaceRoyaltyFeePercent;
    }

    
    function getSalesPersonRoyaltyFeePercent() external 
        onlyContractFactoryOwner      
        view returns (uint256)
    {
        return salesPersonRoyaltyFeePercent;
    }

    function tokenList() external virtual
        onlyContractFactoryOwner
        view returns (uint256[] memory) 
    {
        return _tokenList();
    }

    function buyerList() external 
        onlyContractFactoryOwner
        onlyAfterStart
        view returns (address[] memory) 
    {
        return buyers;
    }

    function redeemNFD(uint256 _tokenId) external virtual
        onlyContractFactoryOwner
    {
        _redeemNFD(_tokenId);
    } 

    function buyToken(uint256 _tokenId, address _virtuousToken) external
        nonReentrant
        onlyAfterStart
        onlyNotBeneficiary
        isTokenAllowed(_tokenId)
    {   
        address _buyer = msg.sender;
        require(!tokenSold[_tokenId], 'Token already sold');
        require(erc20Token.balanceOf(_buyer) >= price, 'Insufficiant ERC20 token balance!');  
        tokenSold[_tokenId] = true;
        //ERC20 token transfer from buyer to current contract address
        bool sent = IVirtuousContractFactory(contractFactory).erc20TransferFrom(_buyer, address(this), price);
        require(sent, "Fund transfer failed!");
        IERC721Upgradeable virtuousToken = IERC721Upgradeable(_virtuousToken);
        require(virtuousToken.ownerOf(_tokenId) == address(this), "This contract is not owner of this NFD token!");
        virtuousToken.safeTransferFrom(address(this), _buyer, _tokenId);
        buyers.push(_buyer);
        royaltyTransfer();
        emit LogBuyToken( _buyer, _tokenId, price);
    }

    function royaltyTransfer() internal
    {   
        uint256 royalty = price.div(100).mul(marketplaceRoyaltyFeePercent);
        uint256 merchantFund = price.sub(royalty);
        address marketPlaceRoyaltyReceiver = IVirtuousContractFactory(contractFactory).getMarketPlaceRoyaltyReceiverWallet();
      
        uint256 marketplaceRoyalty;
        uint256 salesPersonRoyalty;
        //transfer to benefiaciary wallet
        erc20Token.transfer(beneficiary, merchantFund); 
        if( salesPerson != address(0x0) ){
            salesPersonRoyalty = royalty.div(100).mul(salesPersonRoyaltyFeePercent);
            marketplaceRoyalty = royalty.sub(salesPersonRoyalty);
            //Transfer sale royalty to sales person wallet address
            erc20Token.transfer(salesPerson, salesPersonRoyalty);
        }else{ marketplaceRoyalty = royalty; } 

        //Transfer marketplace royalty to royalty receiver wallet address
        erc20Token.transfer(marketPlaceRoyaltyReceiver, marketplaceRoyalty);      
        emit RoyaltyTransfer(merchantFund, marketplaceRoyalty, salesPersonRoyalty);
    }

    function contractFactoryOwner() internal view returns(address){
        return IVirtuousContractFactory(contractFactory).getContractFactoryOwner();
    }

    receive() external payable 
    {
        emit Received(msg.sender, msg.value);
    }

    fallback() external payable {
        emit Received(msg.sender, msg.value);
    }

    modifier onlyNotBeneficiary {
        if (msg.sender == beneficiary) revert('Beneficiary can not perform the action!');
        _;
    }

    modifier onlyContractFactoryOwner {        
        require(contractFactoryOwner() == msg.sender, "You are not owner");
        _;
    }

    modifier onlyAfterStart {
        if (block.timestamp < startTime) revert('Sell yet not start!');
        _;
    }
}
        

/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20Upgradeable {
    /**
     * @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);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

/_openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
          

/_openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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`.
     *
     * 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;

    /**
     * @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 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

/_openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721ReceiverUpgradeable.sol";
import "../../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721HolderUpgradeable is Initializable, IERC721ReceiverUpgradeable {
    function __ERC721Holder_init() internal onlyInitializing {
    }

    function __ERC721Holder_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address,
        address,
        uint256,
        bytes memory
    ) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}
          

/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev 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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
          

/_openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @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);
}
          

/_openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMathUpgradeable {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}
          

/project_/contracts/IVirtuousContractFactory.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface IVirtuousContractFactory {
    function erc20TransferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function getMarketPlaceRoyaltyReceiverWallet() external view returns (address);
    function getContractFactoryOwner() external view returns (address);
}
          

/project_/contracts/VirtuousTokenServices.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/utils/ERC721HolderUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./IVirtuousContractFactory.sol";

abstract contract VirtuousTokenServices is Initializable, ERC721HolderUpgradeable {

    using SafeMathUpgradeable for uint256;      
    IERC20Upgradeable internal erc20Token;
    address internal contractFactory;  
    address internal beneficiary;
    uint256 internal marketplaceRoyaltyFeePercent;    
    uint256 internal virtuousTokensIssued;
    uint256[] private allowedVirtuousTokens;
    uint256 private redeemQty;
    mapping(uint256 => uint256) public redeemed;  
    uint256 public maintenanceFee;
    mapping(uint256 => uint256) private maintenanceFeeExpiredOn;
    enum maintenanceFeeDueType{ monthly, quarterly, annual }
    maintenanceFeeDueType private maintenanceDueType;

    event MaintenanceFeePaid(uint256 tokenId, address from, uint validityTill);
    event VirtuousTokenRedeemed(uint tokenId, uint256 redeemedTotal);     

    function __VirtuousTokenServices_init(IERC20Upgradeable _erc20Token, address _beneficiary, uint256 _marketplaceRoyaltyFeePercent, uint256 _virtuousTokensIssued, uint256 _redeemQty, uint256 _maintenanceFee, maintenanceFeeDueType _feeDueType ) 
        internal 
        onlyInitializing 
    {   
        erc20Token = _erc20Token;
        beneficiary = _beneficiary;
        marketplaceRoyaltyFeePercent = _marketplaceRoyaltyFeePercent;
        contractFactory = msg.sender;
        virtuousTokensIssued = _virtuousTokensIssued;
        redeemQty = _redeemQty; 
        maintenanceFee = _maintenanceFee;
        maintenanceDueType = _feeDueType;
    }

    function getVirtuousTokensIssued() internal view returns(uint256)
    {
        return virtuousTokensIssued;
    }

    function getVirtuousTokensAllowed() internal view returns(uint256[] memory)
    {
        return allowedVirtuousTokens;
    }

    function getTokenReddemCount(uint256 _tokenId) 
        public
        view returns (uint256)
    {
        return redeemed[_tokenId];
    }

    function _tokenList() 
        internal
        view returns (uint256[] memory) 
    {
        return getVirtuousTokensAllowed();
    }

    function onERC721Received(
        address,
        address,
        uint256 _tokenId,   
        bytes memory
    ) public virtual override returns (bytes4) 
    {
        require(getVirtuousTokensIssued() > getVirtuousTokensAllowed().length, 'Token allowance has reached the maximum!');
        allowedVirtuousTokens.push(_tokenId);
        return this.onERC721Received.selector;
    }

    function _redeemNFD(uint256 _tokenId) 
        internal 
        isTokenAllowed(_tokenId)
        isMaintenanceFeeApplicable(_tokenId)
    {   
        if(redeemQty > 0 && redeemQty > redeemed[_tokenId])
        { 
            revert("User have reached the maximum allowance!"); 
        }
        redeemed[_tokenId] = redeemed[_tokenId].add(1);
        emit VirtuousTokenRedeemed( _tokenId,  redeemed[_tokenId]);        
    }

    function payMaintenanceFee(uint256 tokenId) public isTokenAllowed(tokenId){
       
        uint256 marketplaceFee = maintenanceFee.div(100).mul(marketplaceRoyaltyFeePercent);
        uint256 merchantFee = maintenanceFee.sub(marketplaceFee);
        address marketPlaceRoyaltyReceiver = IVirtuousContractFactory(contractFactory).getMarketPlaceRoyaltyReceiverWallet();

        //transfer to benefiaciary wallet
        bool sentToBeneficiary = IVirtuousContractFactory(contractFactory).erc20TransferFrom(msg.sender, beneficiary, merchantFee);
        require(sentToBeneficiary, "Fund transfer to beneficiary failed!");
        //Transfer marketplace fee to royalty receiver wallet address
        bool sentToMarketPlace = IVirtuousContractFactory(contractFactory).erc20TransferFrom(msg.sender, marketPlaceRoyaltyReceiver, marketplaceFee);
        require(sentToMarketPlace, "Fund transfer to marketplace failed!");    
        
        uint today = block.timestamp;
        uint validityTill;
  
        if(maintenanceDueType == maintenanceFeeDueType.monthly){
            validityTill = today + 30 days;
        }else if(maintenanceDueType == maintenanceFeeDueType.quarterly){
            validityTill = today + 90 days;
        }else if(maintenanceDueType == maintenanceFeeDueType.annual){
            validityTill = today + 365 days;
        }
        maintenanceFeeExpiredOn[tokenId] = validityTill;
        emit MaintenanceFeePaid(tokenId, msg.sender, validityTill); 
    }

    modifier isMaintenanceFeeApplicable(uint256 tokenId){
        uint256 expireOn = maintenanceFeeExpiredOn[tokenId];
        if(maintenanceFee > 0) require(block.timestamp <= expireOn, 'Maintenance validity expired please pay maintenance fee!');
        _;        
    }

    modifier isTokenAllowed(uint256 _tokenId)
    {
        bool tokenAllowed;
        for( uint256 i = 0; i < getVirtuousTokensAllowed().length; i++ ) 
        {
            if(allowedVirtuousTokens[i] == _tokenId) {
                tokenAllowed = true;
                break;
            }
        }
        require(tokenAllowed, 'This Token is not allowed for this NFD!');
        _;
    }
}
          

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"LogBuyToken","inputs":[{"type":"address","name":"buyer","internalType":"address","indexed":false},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"MaintenanceFeePaid","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":false},{"type":"address","name":"from","internalType":"address","indexed":false},{"type":"uint256","name":"validityTill","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Received","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":false},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoyaltyTransfer","inputs":[{"type":"uint256","name":"merchantFee","internalType":"uint256","indexed":false},{"type":"uint256","name":"marketplaceRoyalty","internalType":"uint256","indexed":false},{"type":"uint256","name":"salesPersonRoyalty","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"VirtuousTokenRedeemed","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":false},{"type":"uint256","name":"redeemedTotal","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"fallback","stateMutability":"payable"},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyToken","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"address","name":"_virtuousToken","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"buyerList","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"getDealStatus","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getMarketPlaceRoyaltyFeePercent","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getSalesPersonRoyaltyFeePercent","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTokenReddemCount","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_erc20Token","internalType":"contract IERC20Upgradeable"},{"type":"address","name":"_beneficiary","internalType":"address"},{"type":"uint256","name":"_price","internalType":"uint256"},{"type":"uint256","name":"_startTime","internalType":"uint256"},{"type":"uint256","name":"_virtuousTokensIssued","internalType":"uint256"},{"type":"uint256","name":"_redeemQty","internalType":"uint256"},{"type":"address","name":"_salesPerson","internalType":"address"},{"type":"uint256","name":"_marketplaceRoyaltyFeePercent","internalType":"uint256"},{"type":"uint256","name":"_salesPersonRoyaltyFeePercent","internalType":"uint256"},{"type":"uint256","name":"_maintenanceFee","internalType":"uint256"},{"type":"uint8","name":"_feeDueType","internalType":"enum VirtuousTokenServices.maintenanceFeeDueType"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"maintenanceFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"_tokenId","internalType":"uint256"},{"type":"bytes","name":"","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"payMaintenanceFee","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"price","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"redeemNFD","inputs":[{"type":"uint256","name":"_tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"redeemed","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"startTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"tokenList","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"tokenSold","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b5061001961001e565b6100de565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811610156100dc576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611dd4806100ed6000396000f3fe6080604052600436106100f75760003560e01c80637088f0c11161008a5780639e2c58ca116100595780639e2c58ca14610325578063a035b1fe14610347578063eda1a7cd1461035d578063f28c40401461037d57610137565b80637088f0c1146102a057806378e97925146102c25780637ed0f1c1146102d85780639134709e1461030557610137565b80633711ef04116100c65780633711ef04146102095780634d2e01981461021e5780635653de641461024057806369de83471461028057610137565b806301a2ee3f1461016c578063026670c51461019757806304660449146101ba578063150b7a02146101d057610137565b3661013757604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587491015b60405180910390a1005b604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910161012d565b34801561017857600080fd5b506101816103aa565b60405161018e9190611bc4565b60405180910390f35b3480156101a357600080fd5b506101ac6103fe565b60405190815260200161018e565b3480156101c657600080fd5b506101ac603b5481565b3480156101dc57600080fd5b506101f06101eb36600461191c565b61043f565b6040516001600160e01b0319909116815260200161018e565b34801561021557600080fd5b506101ac6104ee565b34801561022a57600080fd5b5061023e610239366004611abc565b610526565b005b34801561024c57600080fd5b5061027061025b366004611abc565b60756020526000908152604090205460ff1681565b604051901515815260200161018e565b34801561028c57600080fd5b5061023e61029b366004611abc565b610958565b3480156102ac57600080fd5b506102b5610993565b60405161018e9190611b3f565b3480156102ce57600080fd5b506101ac60715481565b3480156102e457600080fd5b506101ac6102f3366004611abc565b603a6020526000908152604090205481565b34801561031157600080fd5b5061023e610320366004611aec565b610a6c565b34801561033157600080fd5b5061033a611006565b60405161018e9190611b8c565b34801561035357600080fd5b506101ac60705481565b34801561036957600080fd5b5061023e610378366004611a15565b611044565b34801561038957600080fd5b506101ac610398366004611abc565b6000908152603a602052604090205490565b60606071544210156103dc575060408051808201909152600b81526a1b9bdd0b5cdd185c9d195960aa1b602082015290565b5060408051808201909152600781526672756e6e696e6760c81b602082015290565b6000336104096111fb565b6001600160a01b0316146104385760405162461bcd60e51b815260040161042f90611ca9565b60405180910390fd5b5060365490565b6000610449611278565b51603754116104ab5760405162461bcd60e51b815260206004820152602860248201527f546f6b656e20616c6c6f77616e636520686173207265616368656420746865206044820152676d6178696d756d2160c01b606482015260840161042f565b5050603880546001810182556000919091527f38395c5dceade9603479b177b68959049485df8aa97b39f3533039af5f456199015550630a85bd0160e11b919050565b6000336104f96111fb565b6001600160a01b03161461051f5760405162461bcd60e51b815260040161042f90611ca9565b5060735490565b806000805b610533611278565b5181101561058957826038828154811061055d57634e487b7160e01b600052603260045260246000fd5b906000526020600020015414156105775760019150610589565b8061058181611d42565b91505061052b565b50806105a75760405162461bcd60e51b815260040161042f90611c17565b60006105cb6036546105c56064603b546112cf90919063ffffffff16565b906112e2565b905060006105e482603b546112ee90919063ffffffff16565b90506000603460009054906101000a90046001600160a01b03166001600160a01b03166340f06db76040518163ffffffff1660e01b815260040160206040518083038186803b15801561063657600080fd5b505afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e9190611900565b60345460355460405163d96ca0b960e01b81529293506000926001600160a01b039283169263d96ca0b9926106ad923392909116908890600401611b1b565b602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff91906119f5565b90508061075a5760405162461bcd60e51b8152602060048201526024808201527f46756e64207472616e7366657220746f2062656e6566696369617279206661696044820152636c65642160e01b606482015260840161042f565b60345460405163d96ca0b960e01b81526000916001600160a01b03169063d96ca0b99061078f90339087908a90600401611b1b565b602060405180830381600087803b1580156107a957600080fd5b505af11580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e191906119f5565b90508061083c5760405162461bcd60e51b8152602060048201526024808201527f46756e64207472616e7366657220746f206d61726b6574706c616365206661696044820152636c65642160e01b606482015260840161042f565b42600080603d5460ff16600281111561086557634e487b7160e01b600052602160045260246000fd5b141561087f576108788262278d00611cd4565b90506108f7565b6001603d5460ff1660028111156108a657634e487b7160e01b600052602160045260246000fd5b14156108b957610878826276a700611cd4565b6002603d5460ff1660028111156108e057634e487b7160e01b600052602160045260246000fd5b14156108f7576108f4826301e13380611cd4565b90505b60008a8152603c602090815260409182902083905581518c815233918101919091529081018290527f592920b5aeb6e87ef6b387867afe0714aeb9c2fe2d7033ea40c2b88b5e3863089060600160405180910390a150505050505050505050565b336109616111fb565b6001600160a01b0316146109875760405162461bcd60e51b815260040161042f90611ca9565b610990816112fa565b50565b60603361099e6111fb565b6001600160a01b0316146109c45760405162461bcd60e51b815260040161042f90611ca9565b607154421015610a0c5760405162461bcd60e51b815260206004820152601360248201527253656c6c20796574206e6f742073746172742160681b604482015260640161042f565b6074805480602002602001604051908101604052809291908181526020018280548015610a6257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a44575b5050505050905090565b6002603e541415610abf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161042f565b6002603e55607154421015610b0c5760405162461bcd60e51b815260206004820152601360248201527253656c6c20796574206e6f742073746172742160681b604482015260640161042f565b6035546001600160a01b0316331415610b775760405162461bcd60e51b815260206004820152602760248201527f42656e65666963696172792063616e206e6f7420706572666f726d2074686520604482015266616374696f6e2160c81b606482015260840161042f565b816000805b610b84611278565b51811015610bda578260388281548110610bae57634e487b7160e01b600052603260045260246000fd5b90600052602060002001541415610bc85760019150610bda565b80610bd281611d42565b915050610b7c565b5080610bf85760405162461bcd60e51b815260040161042f90611c17565b600084815260756020526040902054339060ff1615610c4e5760405162461bcd60e51b8152602060048201526012602482015271151bdad95b88185b1c9958591e481cdbdb1960721b604482015260640161042f565b6070546033546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a082319060240160206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190611ad4565b1015610d265760405162461bcd60e51b815260206004820152602160248201527f496e73756666696369616e7420455243323020746f6b656e2062616c616e63656044820152602160f81b606482015260840161042f565b600085815260756020526040808220805460ff19166001179055603454607054915163d96ca0b960e01b81526001600160a01b039091169163d96ca0b991610d75918691309190600401611b1b565b602060405180830381600087803b158015610d8f57600080fd5b505af1158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc791906119f5565b905080610e0e5760405162461bcd60e51b815260206004820152601560248201527446756e64207472616e73666572206661696c65642160581b604482015260640161042f565b6040516331a9108f60e11b815260048101879052859030906001600160a01b03831690636352211e9060240160206040518083038186803b158015610e5257600080fd5b505afa158015610e66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8a9190611900565b6001600160a01b031614610ef65760405162461bcd60e51b815260206004820152602d60248201527f5468697320636f6e7472616374206973206e6f74206f776e6572206f6620746860448201526c6973204e464420746f6b656e2160981b606482015260840161042f565b604051632142170760e11b81526001600160a01b038216906342842e0e90610f2690309087908c90600401611b1b565b600060405180830381600087803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b5050607480546001810182556000919091527f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef8130180546001600160a01b0319166001600160a01b03871617905550610fac90506114fe565b607054604080516001600160a01b0386168152602081018a905280820192909252517f3bb720dcc9b5b2218b19a41ca92774fd6a9308760642254fcdb9c7ccc7a42e7e9181900360600190a150506001603e555050505050565b6060336110116111fb565b6001600160a01b0316146110375760405162461bcd60e51b815260040161042f90611ca9565b61103f6117da565b905090565b600054610100900460ff16158080156110645750600054600160ff909116105b8061107e5750303b15801561107e575060005460ff166001145b6110e15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161042f565b6000805460ff191660011790558015611104576000805461ff0019166101001790555b61110c6117e4565b61111b8c8c878b8b8888611815565b6001600160a01b038b1661117d5760405162461bcd60e51b815260206004820152602360248201527f42656e65666963696172792061646472657373206973206e6f7420636f72726560448201526263742160e81b606482015260840161042f565b607280546001600160a01b0319166001600160a01b03881617905560708a90556071899055607384905580156111ed576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b6034546040805163544e486d60e11b815290516000926001600160a01b03169163a89c90da916004808301926020929190829003018186803b15801561124057600080fd5b505afa158015611254573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f9190611900565b60606038805480602002602001604051908101604052809291908181526020018280548015610a6257602002820191906000526020600020905b8154815260200190600101908083116112b2575050505050905090565b60006112db8284611cec565b9392505050565b60006112db8284611d0c565b60006112db8284611d2b565b806000805b611307611278565b5181101561135d57826038828154811061133157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154141561134b576001915061135d565b8061135581611d42565b9150506112ff565b508061137b5760405162461bcd60e51b815260040161042f90611c17565b6000838152603c6020526040902054603b548491901561140b578042111561140b5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63652076616c6964697479206578706972656420706c6560448201527f61736520706179206d61696e74656e616e636520666565210000000000000000606482015260840161042f565b600060395411801561142c57506000858152603a6020526040902054603954115b1561148a5760405162461bcd60e51b815260206004820152602860248201527f557365722068617665207265616368656420746865206d6178696d756d20616c6044820152676c6f77616e63652160c01b606482015260840161042f565b6000858152603a60205260409020546114a49060016118c6565b6000868152603a602052604090819020829055517f564d4309aa774c1f02ae91e99cd84f81af757524feafb7bcd96612a07e6c5233916114ef91889190918252602082015260400190565b60405180910390a15050505050565b600061151c6036546105c560646070546112cf90919063ffffffff16565b90506000611535826070546112ee90919063ffffffff16565b90506000603460009054906101000a90046001600160a01b03166001600160a01b03166340f06db76040518163ffffffff1660e01b815260040160206040518083038186803b15801561158757600080fd5b505afa15801561159b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bf9190611900565b60335460355460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018690529293506000928392919091169063a9059cbb90604401602060405180830381600087803b15801561161957600080fd5b505af115801561162d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165191906119f5565b506072546001600160a01b03161561171157607354611675906105c58760646112cf565b905061168185826112ee565b60335460725460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101859052929450169063a9059cbb90604401602060405180830381600087803b1580156116d357600080fd5b505af11580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b91906119f5565b50611715565b8491505b60335460405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529091169063a9059cbb90604401602060405180830381600087803b15801561176357600080fd5b505af1158015611777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179b91906119f5565b5060408051858152602081018490529081018290527f2e06c346444936cfe9705d0e0962c3a603dfe2803d6249d6ed828f849f5dc6ce906060016114ef565b606061103f611278565b600054610100900460ff1661180b5760405162461bcd60e51b815260040161042f90611c5e565b6118136118d2565b565b600054610100900460ff1661183c5760405162461bcd60e51b815260040161042f90611c5e565b603380546001600160a01b03808a166001600160a01b03199283161790925560358054928916928216929092179091556036869055603480549091163317905560378490556039839055603b829055603d805482919060ff191660018360028111156118b857634e487b7160e01b600052602160045260246000fd5b021790555050505050505050565b60006112db8284611cd4565b600054610100900460ff166118f95760405162461bcd60e51b815260040161042f90611c5e565b6001603e55565b600060208284031215611911578081fd5b81516112db81611d89565b60008060008060808587031215611931578283fd5b843561193c81611d89565b9350602085013561194c81611d89565b925060408501359150606085013567ffffffffffffffff8082111561196f578283fd5b818701915087601f830112611982578283fd5b81358181111561199457611994611d73565b604051601f8201601f19908116603f011681019083821181831017156119bc576119bc611d73565b816040528281528a60208487010111156119d4578586fd5b82602086016020830137918201602001949094529598949750929550505050565b600060208284031215611a06578081fd5b815180151581146112db578182fd5b60008060008060008060008060008060006101608c8e031215611a36578687fd5b8b35611a4181611d89565b9a5060208c0135611a5181611d89565b995060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135611a7d81611d89565b945060e08c013593506101008c013592506101208c013591506101408c013560038110611aa8578182fd5b809150509295989b509295989b9093969950565b600060208284031215611acd578081fd5b5035919050565b600060208284031215611ae5578081fd5b5051919050565b60008060408385031215611afe578182fd5b823591506020830135611b1081611d89565b809150509250929050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015611b805783516001600160a01b031683529284019291840191600101611b5b565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611b8057835183529284019291840191600101611ba8565b6000602080835283518082850152825b81811015611bf057858101830151858201604001528201611bd4565b81811115611c015783604083870101525b50601f01601f1916929092016040019392505050565b60208082526027908201527f5468697320546f6b656e206973206e6f7420616c6c6f77656420666f722074686040820152666973204e46442160c81b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601190820152702cb7ba9030b932903737ba1037bbb732b960791b604082015260600190565b60008219821115611ce757611ce7611d5d565b500190565b600082611d0757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2657611d26611d5d565b500290565b600082821015611d3d57611d3d611d5d565b500390565b6000600019821415611d5657611d56611d5d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461099057600080fdfea2646970667358221220151a9975a694710c0d959f75883bd398f10b11433da0f9273c8d7b4eaf2f97d064736f6c63430008040033

Deployed ByteCode

0x6080604052600436106100f75760003560e01c80637088f0c11161008a5780639e2c58ca116100595780639e2c58ca14610325578063a035b1fe14610347578063eda1a7cd1461035d578063f28c40401461037d57610137565b80637088f0c1146102a057806378e97925146102c25780637ed0f1c1146102d85780639134709e1461030557610137565b80633711ef04116100c65780633711ef04146102095780634d2e01981461021e5780635653de641461024057806369de83471461028057610137565b806301a2ee3f1461016c578063026670c51461019757806304660449146101ba578063150b7a02146101d057610137565b3661013757604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f8852587491015b60405180910390a1005b604080513381523460208201527f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f88525874910161012d565b34801561017857600080fd5b506101816103aa565b60405161018e9190611bc4565b60405180910390f35b3480156101a357600080fd5b506101ac6103fe565b60405190815260200161018e565b3480156101c657600080fd5b506101ac603b5481565b3480156101dc57600080fd5b506101f06101eb36600461191c565b61043f565b6040516001600160e01b0319909116815260200161018e565b34801561021557600080fd5b506101ac6104ee565b34801561022a57600080fd5b5061023e610239366004611abc565b610526565b005b34801561024c57600080fd5b5061027061025b366004611abc565b60756020526000908152604090205460ff1681565b604051901515815260200161018e565b34801561028c57600080fd5b5061023e61029b366004611abc565b610958565b3480156102ac57600080fd5b506102b5610993565b60405161018e9190611b3f565b3480156102ce57600080fd5b506101ac60715481565b3480156102e457600080fd5b506101ac6102f3366004611abc565b603a6020526000908152604090205481565b34801561031157600080fd5b5061023e610320366004611aec565b610a6c565b34801561033157600080fd5b5061033a611006565b60405161018e9190611b8c565b34801561035357600080fd5b506101ac60705481565b34801561036957600080fd5b5061023e610378366004611a15565b611044565b34801561038957600080fd5b506101ac610398366004611abc565b6000908152603a602052604090205490565b60606071544210156103dc575060408051808201909152600b81526a1b9bdd0b5cdd185c9d195960aa1b602082015290565b5060408051808201909152600781526672756e6e696e6760c81b602082015290565b6000336104096111fb565b6001600160a01b0316146104385760405162461bcd60e51b815260040161042f90611ca9565b60405180910390fd5b5060365490565b6000610449611278565b51603754116104ab5760405162461bcd60e51b815260206004820152602860248201527f546f6b656e20616c6c6f77616e636520686173207265616368656420746865206044820152676d6178696d756d2160c01b606482015260840161042f565b5050603880546001810182556000919091527f38395c5dceade9603479b177b68959049485df8aa97b39f3533039af5f456199015550630a85bd0160e11b919050565b6000336104f96111fb565b6001600160a01b03161461051f5760405162461bcd60e51b815260040161042f90611ca9565b5060735490565b806000805b610533611278565b5181101561058957826038828154811061055d57634e487b7160e01b600052603260045260246000fd5b906000526020600020015414156105775760019150610589565b8061058181611d42565b91505061052b565b50806105a75760405162461bcd60e51b815260040161042f90611c17565b60006105cb6036546105c56064603b546112cf90919063ffffffff16565b906112e2565b905060006105e482603b546112ee90919063ffffffff16565b90506000603460009054906101000a90046001600160a01b03166001600160a01b03166340f06db76040518163ffffffff1660e01b815260040160206040518083038186803b15801561063657600080fd5b505afa15801561064a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066e9190611900565b60345460355460405163d96ca0b960e01b81529293506000926001600160a01b039283169263d96ca0b9926106ad923392909116908890600401611b1b565b602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff91906119f5565b90508061075a5760405162461bcd60e51b8152602060048201526024808201527f46756e64207472616e7366657220746f2062656e6566696369617279206661696044820152636c65642160e01b606482015260840161042f565b60345460405163d96ca0b960e01b81526000916001600160a01b03169063d96ca0b99061078f90339087908a90600401611b1b565b602060405180830381600087803b1580156107a957600080fd5b505af11580156107bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e191906119f5565b90508061083c5760405162461bcd60e51b8152602060048201526024808201527f46756e64207472616e7366657220746f206d61726b6574706c616365206661696044820152636c65642160e01b606482015260840161042f565b42600080603d5460ff16600281111561086557634e487b7160e01b600052602160045260246000fd5b141561087f576108788262278d00611cd4565b90506108f7565b6001603d5460ff1660028111156108a657634e487b7160e01b600052602160045260246000fd5b14156108b957610878826276a700611cd4565b6002603d5460ff1660028111156108e057634e487b7160e01b600052602160045260246000fd5b14156108f7576108f4826301e13380611cd4565b90505b60008a8152603c602090815260409182902083905581518c815233918101919091529081018290527f592920b5aeb6e87ef6b387867afe0714aeb9c2fe2d7033ea40c2b88b5e3863089060600160405180910390a150505050505050505050565b336109616111fb565b6001600160a01b0316146109875760405162461bcd60e51b815260040161042f90611ca9565b610990816112fa565b50565b60603361099e6111fb565b6001600160a01b0316146109c45760405162461bcd60e51b815260040161042f90611ca9565b607154421015610a0c5760405162461bcd60e51b815260206004820152601360248201527253656c6c20796574206e6f742073746172742160681b604482015260640161042f565b6074805480602002602001604051908101604052809291908181526020018280548015610a6257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a44575b5050505050905090565b6002603e541415610abf5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161042f565b6002603e55607154421015610b0c5760405162461bcd60e51b815260206004820152601360248201527253656c6c20796574206e6f742073746172742160681b604482015260640161042f565b6035546001600160a01b0316331415610b775760405162461bcd60e51b815260206004820152602760248201527f42656e65666963696172792063616e206e6f7420706572666f726d2074686520604482015266616374696f6e2160c81b606482015260840161042f565b816000805b610b84611278565b51811015610bda578260388281548110610bae57634e487b7160e01b600052603260045260246000fd5b90600052602060002001541415610bc85760019150610bda565b80610bd281611d42565b915050610b7c565b5080610bf85760405162461bcd60e51b815260040161042f90611c17565b600084815260756020526040902054339060ff1615610c4e5760405162461bcd60e51b8152602060048201526012602482015271151bdad95b88185b1c9958591e481cdbdb1960721b604482015260640161042f565b6070546033546040516370a0823160e01b81526001600160a01b038481166004830152909116906370a082319060240160206040518083038186803b158015610c9657600080fd5b505afa158015610caa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cce9190611ad4565b1015610d265760405162461bcd60e51b815260206004820152602160248201527f496e73756666696369616e7420455243323020746f6b656e2062616c616e63656044820152602160f81b606482015260840161042f565b600085815260756020526040808220805460ff19166001179055603454607054915163d96ca0b960e01b81526001600160a01b039091169163d96ca0b991610d75918691309190600401611b1b565b602060405180830381600087803b158015610d8f57600080fd5b505af1158015610da3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc791906119f5565b905080610e0e5760405162461bcd60e51b815260206004820152601560248201527446756e64207472616e73666572206661696c65642160581b604482015260640161042f565b6040516331a9108f60e11b815260048101879052859030906001600160a01b03831690636352211e9060240160206040518083038186803b158015610e5257600080fd5b505afa158015610e66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8a9190611900565b6001600160a01b031614610ef65760405162461bcd60e51b815260206004820152602d60248201527f5468697320636f6e7472616374206973206e6f74206f776e6572206f6620746860448201526c6973204e464420746f6b656e2160981b606482015260840161042f565b604051632142170760e11b81526001600160a01b038216906342842e0e90610f2690309087908c90600401611b1b565b600060405180830381600087803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b5050607480546001810182556000919091527f19a0b39aa25ac793b5f6e9a0534364cc0b3fd1ea9b651e79c7f50a59d48ef8130180546001600160a01b0319166001600160a01b03871617905550610fac90506114fe565b607054604080516001600160a01b0386168152602081018a905280820192909252517f3bb720dcc9b5b2218b19a41ca92774fd6a9308760642254fcdb9c7ccc7a42e7e9181900360600190a150506001603e555050505050565b6060336110116111fb565b6001600160a01b0316146110375760405162461bcd60e51b815260040161042f90611ca9565b61103f6117da565b905090565b600054610100900460ff16158080156110645750600054600160ff909116105b8061107e5750303b15801561107e575060005460ff166001145b6110e15760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161042f565b6000805460ff191660011790558015611104576000805461ff0019166101001790555b61110c6117e4565b61111b8c8c878b8b8888611815565b6001600160a01b038b1661117d5760405162461bcd60e51b815260206004820152602360248201527f42656e65666963696172792061646472657373206973206e6f7420636f72726560448201526263742160e81b606482015260840161042f565b607280546001600160a01b0319166001600160a01b03881617905560708a90556071899055607384905580156111ed576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b6034546040805163544e486d60e11b815290516000926001600160a01b03169163a89c90da916004808301926020929190829003018186803b15801561124057600080fd5b505afa158015611254573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103f9190611900565b60606038805480602002602001604051908101604052809291908181526020018280548015610a6257602002820191906000526020600020905b8154815260200190600101908083116112b2575050505050905090565b60006112db8284611cec565b9392505050565b60006112db8284611d0c565b60006112db8284611d2b565b806000805b611307611278565b5181101561135d57826038828154811061133157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154141561134b576001915061135d565b8061135581611d42565b9150506112ff565b508061137b5760405162461bcd60e51b815260040161042f90611c17565b6000838152603c6020526040902054603b548491901561140b578042111561140b5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63652076616c6964697479206578706972656420706c6560448201527f61736520706179206d61696e74656e616e636520666565210000000000000000606482015260840161042f565b600060395411801561142c57506000858152603a6020526040902054603954115b1561148a5760405162461bcd60e51b815260206004820152602860248201527f557365722068617665207265616368656420746865206d6178696d756d20616c6044820152676c6f77616e63652160c01b606482015260840161042f565b6000858152603a60205260409020546114a49060016118c6565b6000868152603a602052604090819020829055517f564d4309aa774c1f02ae91e99cd84f81af757524feafb7bcd96612a07e6c5233916114ef91889190918252602082015260400190565b60405180910390a15050505050565b600061151c6036546105c560646070546112cf90919063ffffffff16565b90506000611535826070546112ee90919063ffffffff16565b90506000603460009054906101000a90046001600160a01b03166001600160a01b03166340f06db76040518163ffffffff1660e01b815260040160206040518083038186803b15801561158757600080fd5b505afa15801561159b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115bf9190611900565b60335460355460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018690529293506000928392919091169063a9059cbb90604401602060405180830381600087803b15801561161957600080fd5b505af115801561162d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165191906119f5565b506072546001600160a01b03161561171157607354611675906105c58760646112cf565b905061168185826112ee565b60335460725460405163a9059cbb60e01b81526001600160a01b03918216600482015260248101859052929450169063a9059cbb90604401602060405180830381600087803b1580156116d357600080fd5b505af11580156116e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170b91906119f5565b50611715565b8491505b60335460405163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529091169063a9059cbb90604401602060405180830381600087803b15801561176357600080fd5b505af1158015611777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061179b91906119f5565b5060408051858152602081018490529081018290527f2e06c346444936cfe9705d0e0962c3a603dfe2803d6249d6ed828f849f5dc6ce906060016114ef565b606061103f611278565b600054610100900460ff1661180b5760405162461bcd60e51b815260040161042f90611c5e565b6118136118d2565b565b600054610100900460ff1661183c5760405162461bcd60e51b815260040161042f90611c5e565b603380546001600160a01b03808a166001600160a01b03199283161790925560358054928916928216929092179091556036869055603480549091163317905560378490556039839055603b829055603d805482919060ff191660018360028111156118b857634e487b7160e01b600052602160045260246000fd5b021790555050505050505050565b60006112db8284611cd4565b600054610100900460ff166118f95760405162461bcd60e51b815260040161042f90611c5e565b6001603e55565b600060208284031215611911578081fd5b81516112db81611d89565b60008060008060808587031215611931578283fd5b843561193c81611d89565b9350602085013561194c81611d89565b925060408501359150606085013567ffffffffffffffff8082111561196f578283fd5b818701915087601f830112611982578283fd5b81358181111561199457611994611d73565b604051601f8201601f19908116603f011681019083821181831017156119bc576119bc611d73565b816040528281528a60208487010111156119d4578586fd5b82602086016020830137918201602001949094529598949750929550505050565b600060208284031215611a06578081fd5b815180151581146112db578182fd5b60008060008060008060008060008060006101608c8e031215611a36578687fd5b8b35611a4181611d89565b9a5060208c0135611a5181611d89565b995060408c0135985060608c0135975060808c0135965060a08c0135955060c08c0135611a7d81611d89565b945060e08c013593506101008c013592506101208c013591506101408c013560038110611aa8578182fd5b809150509295989b509295989b9093969950565b600060208284031215611acd578081fd5b5035919050565b600060208284031215611ae5578081fd5b5051919050565b60008060408385031215611afe578182fd5b823591506020830135611b1081611d89565b809150509250929050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6020808252825182820181905260009190848201906040850190845b81811015611b805783516001600160a01b031683529284019291840191600101611b5b565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611b8057835183529284019291840191600101611ba8565b6000602080835283518082850152825b81811015611bf057858101830151858201604001528201611bd4565b81811115611c015783604083870101525b50601f01601f1916929092016040019392505050565b60208082526027908201527f5468697320546f6b656e206973206e6f7420616c6c6f77656420666f722074686040820152666973204e46442160c81b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601190820152702cb7ba9030b932903737ba1037bbb732b960791b604082015260600190565b60008219821115611ce757611ce7611d5d565b500190565b600082611d0757634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d2657611d26611d5d565b500290565b600082821015611d3d57611d3d611d5d565b500390565b6000600019821415611d5657611d56611d5d565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461099057600080fdfea2646970667358221220151a9975a694710c0d959f75883bd398f10b11433da0f9273c8d7b4eaf2f97d064736f6c63430008040033