ETH Price: $3,156.16 (+1.08%)
Gas: 9 Gwei

Token

Planet-1 (PLT1)
 

Overview

Max Total Supply

21 PLT1

Holders

3

Total Transfers

-

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

DNFT issues an independent and unique series of ERC721 NFT assets. Each DNFT product is recorded in the blockchain and is issued in limited quantities. The shape of each DNFT product is unique with different colors and prices. The higher the level, the greater the mining value of the product.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
DNFTProduct

Compiler Version
v0.7.4+commit.3f05b770

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, None license
File 1 of 29 : DNFTLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;

library Lib {

    struct ProductCount {
        uint256 buyCount;
        uint256 miningCount;
        uint256 withdrawSum;
        uint256 withdrawCount;
        uint256 redeemedCount;
    }

    struct ProductMintItem {
        address minter;
        uint256 beginTime;
        uint256 withdrawTime;
        uint256 endTime;
        uint256 totalValue;
    }

    struct ProductTokenDetail {
        uint256 id;
        bool mining;
        uint256 totalTime;
        uint256 totalValue;
        uint256 propA;
        uint256 propB;
        uint256 propC;
        ProductMintItem currMining;
    }

    function random(uint256 min, uint256 max) internal view returns (uint256) {
        uint256 gl = gasleft();
        uint256 seed = uint256(keccak256(abi.encodePacked(
                block.timestamp + block.difficulty +
                ((uint256(keccak256(abi.encodePacked(block.coinbase)))) / (block.timestamp)) +
                block.gaslimit + gl +
                ((uint256(keccak256(abi.encodePacked(msg.sender)))) / (block.timestamp)) +
                block.number
            )));
        return min + (seed - ((seed / (max - min)) * (max - min)));
    }

}

File 2 of 29 : DNFTMain.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/utils/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./DNFTLibrary.sol";
import "./interfaces/IDNFTProduct.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

contract DNFTMain is Pausable, Ownable {

    struct Player {
        address addr;
        address parent;
        address[] children;
        uint256 buyCount;
        uint256 rewardCount;
        uint256 withdrawTotalValue;
    }
    using SafeERC20 for IERC20;
    using SafeMath for uint256;
    using SafeMath for uint32;

    address public mainCreator;
    address payable public withdrawTo;
    IERC20 public dnftToken;

    mapping(string => address) private _products;
    mapping(string => Lib.ProductCount) private _productsCount;
    string[] private _productNames;
    string public rewardProductName;

    mapping(address => Player) private _players;

    mapping(address => address) public _playerParents;

    mapping(address => address[]) public _playerChildren;

    uint256 public playerCount;

    event AddPlayer(address indexed player);
    event ProductBuy(address indexed player, string product, uint256 tokenId);
    event ProductReward(address indexed to, address indexed from, string fromProduct, string toProduct, uint256 cost, uint256 fromTokenId, uint256 toTokenId);
    event ProductMintBegin(address indexed player, string product, uint256 indexed tokenId);
    event ProductMintWithdraw(address indexed player, string product, uint256 indexed tokenId, uint256 value, uint256 timeNum);
    event ProductMintRedeem(address indexed player, string product, uint256 indexed tokenId, uint256 value, uint256 timeNum);


    constructor(address _dnftAddr, address payable _withdrawTo) {
        mainCreator = msg.sender;
        withdrawTo = _withdrawTo;
        dnftToken = IERC20(_dnftAddr);
    }

    function _getPlayer(address addr) private returns (Player storage){
        if (_players[addr].addr == address(0)) {
            Player memory player;
            player.addr = addr;
            _players[addr] = player;
            playerCount++;
            emit AddPlayer(addr);
        }
        return _players[addr];
    }

    function _getProduct(string memory name) private view returns (IDNFTProduct){
        require(_products[name] != address(0), "Product not exists.");
        return IDNFTProduct(_products[name]);
    }


    function getPlayer(address addr) external view returns (Player memory){
        return _players[addr];
    }

    function getProductAddress(string calldata name) external view returns (address){
        require(_products[name] != address(0), "Product not exists.");
        return _products[name];
    }

    function getProductCount(string calldata name) external view returns (Lib.ProductCount memory){
        require(_products[name] != address(0), "Product not exists.");
        return _productsCount[name];
    }

    function getProductNames() external view returns (string[] memory){
        return _productNames;
    }

    function setWithdrawTo(address payable addr) external {
        require(msg.sender == withdrawTo, "Must be withdraw account.");
        withdrawTo = addr;
    }

    function withdrawToken(address token, uint256 value) external {
        require(msg.sender == withdrawTo, "Must be withdraw account.");
        if (token == address(0))
            withdrawTo.transfer(value);
        else
            IERC20(token).safeTransfer(withdrawTo, value);
    }

    function withdrawProductToken(string calldata name, address token, uint256 value) external {
        require(msg.sender == withdrawTo, "Must be withdraw account.");
        IDNFTProduct p = _getProduct(name);
        p.withdrawToken(withdrawTo, token, value);
    }

    function setRewardProductName(string calldata name) onlyOwner external {
        require(_products[name] != address(0), "Product not exists.");
        rewardProductName = name;
    }

    function addProduct(address paddr, uint256 dnftValue) onlyOwner external {
        IDNFTProduct p = IDNFTProduct(paddr);
        string memory name = p.name();
        require(_products[name] == address(0), "Product already exists.");
        require(p.mainAddr() == address(this), "Product main addr not this.");
        _products[name] = paddr;
        _productNames.push(name);
        dnftToken.safeTransfer(paddr, dnftValue);
    }

    function buyProduct(string calldata name, address playerParent) external payable {
        require(playerParent != msg.sender, "Pay parent wrong.");
        IDNFTProduct p = _getProduct(name);
        if (bytes(rewardProductName).length != 0)
            require(address(p) != _products[rewardProductName], "This product cannot be purchased.");
        address costTokenAddr = p.costTokenAddr();
        uint256 cost = p.cost();
        if (costTokenAddr == address(0))
            require(msg.value == cost, "Pay value wrong.");
        else {
            require(msg.value == 0, "Pay value must be zero.");
            IERC20(costTokenAddr).safeTransferFrom(msg.sender, address(this), cost);
        }
        Player storage player = _getPlayer(msg.sender);
        if (playerParent != address(0)) {
            Player storage parentPlayer = _getPlayer(playerParent);
            player.parent = playerParent;
            parentPlayer.children.push(player.addr);
        }
        _productsCount[name].buyCount++;
        player.buyCount++;
        uint256 tokenId = p.buy(msg.sender);
        emit ProductBuy(msg.sender, name, tokenId);
        if (player.buyCount == 1 && player.parent != address(0) && bytes(rewardProductName).length != 0) {
            IDNFTProduct rp = IDNFTProduct(_products[rewardProductName]);
            if (_productsCount[rewardProductName].buyCount < rp.maxTokenSize()) {
                _getPlayer(player.parent).rewardCount++;
                _productsCount[rewardProductName].buyCount++;
                uint256 toTokenId = rp.buy(player.parent);
                emit ProductReward(player.parent, msg.sender, name, rewardProductName, msg.value, tokenId, toTokenId);
            }
        }
    }

    function mintBegin(string calldata name, uint256 tokenId) external {
        IDNFTProduct p = _getProduct(name);
        p.mintBegin(msg.sender, tokenId);
        _productsCount[name].miningCount++;
        emit ProductMintBegin(msg.sender, name, tokenId);
    }

    function mintWithdraw(string calldata name, uint256 tokenId) external {
        IDNFTProduct p = _getProduct(name);
        Player storage player = _getPlayer(msg.sender);
        (uint256 withdrawNum,uint256 timeNum) = p.mintWithdraw(msg.sender, tokenId);
        player.withdrawTotalValue += withdrawNum;
        _productsCount[name].withdrawCount++;
        _productsCount[name].withdrawSum += withdrawNum;
        emit ProductMintWithdraw(msg.sender, name, tokenId, withdrawNum, timeNum);
    }

    function redeemProduct(string calldata name, uint256 tokenId) external {
        IDNFTProduct p = _getProduct(name);
        Player storage player = _getPlayer(msg.sender);
        (uint256 withdrawNum,uint256 timeNum) = p.redeem(msg.sender, tokenId);
        player.withdrawTotalValue += withdrawNum;
        _productsCount[name].miningCount--;
        _productsCount[name].withdrawSum += withdrawNum;
        _productsCount[name].redeemedCount++;
        emit ProductMintRedeem(msg.sender, name, tokenId, withdrawNum, timeNum);
    }

}

File 3 of 29 : Counters.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../math/SafeMath.sol";

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented or decremented by one. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 * Since it is not possible to overflow a 256 bit integer with increments of one, `increment` can skip the {SafeMath}
 * overflow check, thereby saving gas. This does assume however correct usage, in that the underlying `_value` is never
 * directly accessed.
 */
library Counters {
    using SafeMath for uint256;

    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        // The {SafeMath} overflow check can be skipped here, see the comment at the top
        counter._value += 1;
    }

    function decrement(Counter storage counter) internal {
        counter._value = counter._value.sub(1);
    }
}

File 4 of 29 : SafeMath.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @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) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    /**
     * @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 sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

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

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts 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) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts 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 mod(a, b, "SafeMath: modulo by zero");
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * Reverts with custom message 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, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 5 of 29 : Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../GSN/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor () {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!_paused, "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(_paused, "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 6 of 29 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

File 7 of 29 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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.0.0, only sets of type `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;

            // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            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] = toDeleteIndex + 1; // All indexes are 1-based

            // 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) {
        require(set._values.length > index, "EnumerableSet: index out of bounds");
        return set._values[index];
    }

    // 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(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(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(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(uint256(_at(set._inner, index)));
    }


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

File 8 of 29 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 9 of 29 : IDNFTProduct.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../DNFTLibrary.sol";

interface IDNFTProduct is IERC721 {

    function name() external view returns (string memory);

    function owner() external view returns (address);

    function mainAddr() external view returns (address);

    function pid() external view returns (uint16);

    function maxMintTime() external view returns (uint256);

    function maxTokenSize() external view returns (uint256);

    function costTokenAddr() external view returns (address);

    function cost() external view returns (uint256);

    function totalReturnRate() external view returns (uint32);

    function getDNFTPrice() external view returns (uint256);

    function mintTimeInterval() external view returns (uint256);

    function mintPerTimeValue() external view returns (uint256);

    function tokensOfOwner(address ownerAddr) external view returns (Lib.ProductTokenDetail[] memory);

    function tokenDetailOf(uint256 tid) external view returns (Lib.ProductTokenDetail memory);

    function tokenMintHistoryOf(uint256 tid) external view returns (Lib.ProductMintItem[] memory);

    function withdrawToken(address to, address token, uint256 value) external;

    function buy(address to) external returns (uint256);

    function mintBegin(address from, uint256 tokenId) external;

    function mintWithdraw(address from, uint256 tokenId) external returns (uint256, uint256);

    function redeem(address from, uint256 tokenId) external returns (uint256, uint256);

}

File 10 of 29 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../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 11 of 29 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 12 of 29 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../GSN/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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

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

pragma solidity ^0.7.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 14 of 29 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly { codehash := extcodehash(account) }
        return (codehash != accountHash && codehash != 0x0);
    }

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

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
        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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 15 of 29 : DNFTProduct.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;
pragma experimental ABIEncoderV2;

import "./DNFTLibrary.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IUniswapV2Router01.sol";
import "./interfaces/IUniswapV2Router02.sol";
import "./interfaces/IERC20Token.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

contract DNFTProduct is ERC721, Ownable {

    using SafeMath for uint256;
    using SafeMath for uint32;
    using SafeERC20 for IERC20;

    using Counters for Counters.Counter;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;

    mapping(uint256 => Lib.ProductTokenDetail) private _tokenDetails;
    mapping(uint256 => Lib.ProductMintItem[]) private _tokenMintHistories;
    mapping(address => EnumerableSet.UintSet) private _tokenMints;

    address public dnftTokenAddr;
    address public uniswapAddr;
    address public mainAddr;

    uint256 public mintPerTimeValue;

    uint16 public pid;
    uint256 public maxMintTime;
    uint256 public maxTokenSize;
    address public costTokenAddr;
    uint256 public cost;
    uint32 public totalReturnRate;
    uint256 public mintTimeInterval;
    uint8 public costTokenDecimals;

    Counters.Counter private _tokenIds;
    bool private _init;

    modifier onlyMain() {
        require(mainAddr == msg.sender, "caller is not the main");
        _;
    }
    constructor (
        string memory _name,
        string memory _symbol,
        string memory baseURI
    )  ERC721(_name, _symbol) {
        _setBaseURI(string(abi.encodePacked(baseURI, _name, "/")));
    }

    function initProduct(
        address _mainAddr,
        address _dnftTokenAddr,
        address _uniswapAddr,
        uint16 _id,
        address _costTokenAddr,
        uint256 _cost,
        uint32 _totalReturnRate,
        uint256 _maxMintTime,
        uint256 _maxTokenSize
    ) external onlyOwner {
        require(!_init, "repeat init");
        require(_maxTokenSize < 1E6, "product total supply must be < 1E6");
        mainAddr = _mainAddr;
        pid = _id;
        costTokenAddr = _costTokenAddr;
        cost = _cost;
        maxTokenSize = _maxTokenSize;
        maxMintTime = _maxMintTime;
        totalReturnRate = _totalReturnRate;
        dnftTokenAddr = _dnftTokenAddr;
        uniswapAddr = _uniswapAddr;
        if (_costTokenAddr != address(0)) {
            costTokenDecimals = IERC20Token(_costTokenAddr).decimals();
        } else {
            costTokenDecimals = 18;
        }
        mintTimeInterval = 1 minutes;
        mintPerTimeValue = totalReturnRate.mul(cost).div(100).div(maxMintTime.div(mintTimeInterval));
    }


    function _onlyMinter(address from, uint256 tokenId) private view {
        require(_isApprovedOrOwner(address(this), tokenId), "ERC721: transfer caller is not owner nor approved");
        require(_tokenDetails[tokenId].mining == true, "Token no mining.");
        require(_tokenDetails[tokenId].currMining.minter == from, "Token mine is not owner.");
    }

    function _getUniswapPrice(IUniswapV2Router02 r02, uint256 _tv1, address token1, address token2) private view returns (uint256){
        uint256 tv1 = _tv1;
        IUniswapV2Factory f = IUniswapV2Factory(r02.factory());
        address pairAddr = f.getPair(token1, token2);
        require(pairAddr != address(0), "DNFT uniswap pair not exists.");
        IERC20Token t1 = IERC20Token(token1);
        IERC20Token t2 = IERC20Token(token2);
        uint256 tb1 = t1.balanceOf(pairAddr);
        uint256 tb2 = t2.balanceOf(pairAddr);
        require(tb1 > 0 && tb2 > 0, "Pair token balance < 0");
        uint256 td1 = 10 ** t1.decimals();
        return td1.mul(tv1).div(tb1).mul(tb2).div(td1);
    }

    function _getDNFTPrice() private view returns (uint256){
        if (costTokenAddr == address(dnftTokenAddr))
            return 1E8;
        if (uniswapAddr == address(0)) {
            return 1000 * 1E8;
        }
        IUniswapV2Router02 r02 = IUniswapV2Router02(uniswapAddr);
        address wethAddr = r02.WETH();
        uint256 oneEthDnftPrice = _getUniswapPrice(r02, 1E18, wethAddr, address(dnftTokenAddr));
        if (costTokenAddr == address(0)) {
            return oneEthDnftPrice;
        } else {
            uint256 oneEthTokenPrice = _getUniswapPrice(r02, 1E18, wethAddr, costTokenAddr);
            if (costTokenDecimals == 8)
                return (oneEthDnftPrice * 1E8 / oneEthTokenPrice);
            if (costTokenDecimals < 8)
                return (oneEthDnftPrice * 1E8 / oneEthTokenPrice / (10 ** (8 - uint256(costTokenDecimals))));
            return (oneEthDnftPrice * 1E8 / oneEthTokenPrice) * (10 ** (uint256(costTokenDecimals) - 8));
        }
    }

    function _canWithdrawValue(uint256 tokenId) private view returns (uint256 timeNum, uint256 dnftNum){
        uint256 price = _getDNFTPrice();
        Lib.ProductTokenDetail storage detail = _tokenDetails[tokenId];
        uint256 freeTimeNum = (maxMintTime.sub(detail.totalTime)).div(mintTimeInterval);
        if (freeTimeNum <= 0) {
            return (0, 0);
        }
        timeNum = block.timestamp.sub(detail.currMining.withdrawTime).div(mintTimeInterval);
        if (timeNum > freeTimeNum) {
            timeNum = freeTimeNum;
        }
        if (timeNum <= 0) {
            return (0, 0);
        }
        uint256 decimal = 18;
        if (costTokenAddr != address(0))
            decimal = uint256(costTokenDecimals);
        dnftNum = mintPerTimeValue.mul(price).mul(timeNum).div(10 ** decimal);
        if (dnftNum <= 0) {
            return (0, 0);
        }
    }

    function _mintWithdraw(address player, uint256 tokenId) private returns (uint256, uint256){
        (uint256 timeNum, uint256 dnftNum) = _canWithdrawValue(tokenId);
        if (dnftNum <= 0)
            return (dnftNum, timeNum);
        Lib.ProductTokenDetail storage detail = _tokenDetails[tokenId];
        detail.totalValue = detail.totalValue.add(dnftNum);
        detail.currMining.totalValue = detail.currMining.totalValue.add(dnftNum);
        uint256 useTime = timeNum.mul(mintTimeInterval);
        detail.currMining.withdrawTime = detail.currMining.withdrawTime.add(useTime);
        detail.totalTime = detail.totalTime.add(useTime);
        IERC20Token(dnftTokenAddr).transfer(player, dnftNum);
        return (dnftNum, timeNum);
    }


    function getDNFTPrice() external view returns (uint256){
        return _getDNFTPrice();
    }

    function tokensOfOwner(address owner) external view returns (Lib.ProductTokenDetail[] memory){
        EnumerableSet.UintSet storage mintTokens = _tokenMints[owner];
        uint holdLength = balanceOf(owner);
        uint tokenLengthSize = mintTokens.length() + holdLength;
        if (tokenLengthSize == 0) {
            Lib.ProductTokenDetail[] memory zt = new Lib.ProductTokenDetail[](0);
            return zt;
        }
        Lib.ProductTokenDetail[] memory tokens = new Lib.ProductTokenDetail[](tokenLengthSize);
        uint i = 0;
        while (i < mintTokens.length()) {
            tokens[i] = _tokenDetails[mintTokens.at(i)];
            i++;
        }
        uint j = 0;
        while (j < holdLength) {
            tokens[i] = _tokenDetails[tokenOfOwnerByIndex(owner, j)];
            i++;
            j++;
        }
        return tokens;
    }

    function tokenDetailOf(uint256 tid) external view returns (Lib.ProductTokenDetail memory){
        return _tokenDetails[tid];
    }

    function tokenMintHistoryOf(uint256 tid) external view returns (Lib.ProductMintItem[] memory){
        return _tokenMintHistories[tid];
    }


    function withdrawToken(address payable to, address token, uint256 value) onlyMain external {
        if (token == address(0))
            to.transfer(value);
        else
            IERC20(token).safeTransfer(to, value);
    }

    // buy product
    function buy(address to) external onlyMain returns (uint256) {
        require(_tokenIds.current() < maxTokenSize, "product not enough");
        _tokenIds.increment();
        uint256 tid = pid * 1E6 + _tokenIds.current();
        Lib.ProductTokenDetail memory detail;
        detail.id = tid;
        detail.propA = Lib.random(0, 10000);
        detail.propB = Lib.random(0, 10000);
        detail.propC = Lib.random(0, 10000);
        _tokenDetails[tid] = detail;
        _safeMint(to, tid);
        _setTokenURI(tid, Strings.toString(tid));
        return tid;
    }


    function mintBegin(address from, uint256 tokenId) external onlyMain {
        require(_isApprovedOrOwner(from, tokenId), "ERC721: transfer caller is not owner nor approved");
        Lib.ProductTokenDetail storage detail = _tokenDetails[tokenId];
        require(detail.mining == false, "Token already mining.");
        require(detail.totalTime < maxMintTime, "Token already dead.");
        detail.mining = true;
        detail.currMining.minter = from;
        detail.currMining.beginTime = block.timestamp;
        detail.currMining.endTime = 0;
        detail.currMining.withdrawTime = detail.currMining.beginTime;
        _tokenMints[from].add(tokenId);
        _transfer(from, address(this), tokenId);
    }


    function canWithdrawValue(uint256 tokenId) external view returns (uint256 timeNum, uint256 dnftNum){
        return _canWithdrawValue(tokenId);
    }

    function mintWithdraw(address from, uint256 tokenId) external onlyMain returns (uint256, uint256) {
        _onlyMinter(from, tokenId);
        return _mintWithdraw(from, tokenId);
    }

    function redeem(address from, uint256 tokenId) external onlyMain returns (uint256, uint256){
        _onlyMinter(from, tokenId);
        (uint256 withdrawNum,uint256 timeNum) = _mintWithdraw(from, tokenId);

        Lib.ProductTokenDetail storage detail = _tokenDetails[tokenId];
        detail.mining = false;
        detail.currMining.endTime = block.timestamp;
        _tokenMintHistories[tokenId].push(detail.currMining);

        _tokenMints[from].remove(tokenId);
        Lib.ProductMintItem memory currItem;
        detail.currMining = currItem;

        _safeTransfer(address(this), from, tokenId, "");
        return (withdrawNum, timeNum);
    }

}

File 16 of 29 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../GSN/Context.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Enumerable.sol";
import "./IERC721Receiver.sol";
import "../../introspection/ERC165.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";
import "../../utils/EnumerableSet.sol";
import "../../utils/EnumerableMap.sol";
import "../../utils/Strings.sol";

/**
 * @title ERC721 Non-Fungible Token Standard basic implementation
 * @dev see https://eips.ethereum.org/EIPS/eip-721
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
    using SafeMath for uint256;
    using Address for address;
    using EnumerableSet for EnumerableSet.UintSet;
    using EnumerableMap for EnumerableMap.UintToAddressMap;
    using Strings for uint256;

    // Equals to `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`
    // which can be also obtained as `IERC721Receiver(0).onERC721Received.selector`
    bytes4 private constant _ERC721_RECEIVED = 0x150b7a02;

    // Mapping from holder address to their (enumerable) set of owned tokens
    mapping (address => EnumerableSet.UintSet) private _holderTokens;

    // Enumerable mapping from token ids to their owners
    EnumerableMap.UintToAddressMap private _tokenOwners;

    // Mapping from token ID to approved address
    mapping (uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping (address => mapping (address => bool)) private _operatorApprovals;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Optional mapping for token URIs
    mapping (uint256 => string) private _tokenURIs;

    // Base URI
    string private _baseURI;

    /*
     *     bytes4(keccak256('balanceOf(address)')) == 0x70a08231
     *     bytes4(keccak256('ownerOf(uint256)')) == 0x6352211e
     *     bytes4(keccak256('approve(address,uint256)')) == 0x095ea7b3
     *     bytes4(keccak256('getApproved(uint256)')) == 0x081812fc
     *     bytes4(keccak256('setApprovalForAll(address,bool)')) == 0xa22cb465
     *     bytes4(keccak256('isApprovedForAll(address,address)')) == 0xe985e9c5
     *     bytes4(keccak256('transferFrom(address,address,uint256)')) == 0x23b872dd
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256)')) == 0x42842e0e
     *     bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)')) == 0xb88d4fde
     *
     *     => 0x70a08231 ^ 0x6352211e ^ 0x095ea7b3 ^ 0x081812fc ^
     *        0xa22cb465 ^ 0xe985e9c5 ^ 0x23b872dd ^ 0x42842e0e ^ 0xb88d4fde == 0x80ac58cd
     */
    bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;

    /*
     *     bytes4(keccak256('name()')) == 0x06fdde03
     *     bytes4(keccak256('symbol()')) == 0x95d89b41
     *     bytes4(keccak256('tokenURI(uint256)')) == 0xc87b56dd
     *
     *     => 0x06fdde03 ^ 0x95d89b41 ^ 0xc87b56dd == 0x5b5e139f
     */
    bytes4 private constant _INTERFACE_ID_ERC721_METADATA = 0x5b5e139f;

    /*
     *     bytes4(keccak256('totalSupply()')) == 0x18160ddd
     *     bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) == 0x2f745c59
     *     bytes4(keccak256('tokenByIndex(uint256)')) == 0x4f6ccce7
     *
     *     => 0x18160ddd ^ 0x2f745c59 ^ 0x4f6ccce7 == 0x780e9d63
     */
    bytes4 private constant _INTERFACE_ID_ERC721_ENUMERABLE = 0x780e9d63;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;

        // register the supported interfaces to conform to ERC721 via ERC165
        _registerInterface(_INTERFACE_ID_ERC721);
        _registerInterface(_INTERFACE_ID_ERC721_METADATA);
        _registerInterface(_INTERFACE_ID_ERC721_ENUMERABLE);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");

        return _holderTokens[owner].length();
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return _tokenOwners.get(tokenId, "ERC721: owner query for nonexistent token");
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory _tokenURI = _tokenURIs[tokenId];

        // If there is no base URI, return the token URI.
        if (bytes(_baseURI).length == 0) {
            return _tokenURI;
        }
        // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked).
        if (bytes(_tokenURI).length > 0) {
            return string(abi.encodePacked(_baseURI, _tokenURI));
        }
        // If there is a baseURI but no tokenURI, concatenate the tokenID to the baseURI.
        return string(abi.encodePacked(_baseURI, tokenId.toString()));
    }

    /**
    * @dev Returns the base URI set via {_setBaseURI}. This will be
    * automatically added as a prefix in {tokenURI} to each token's URI, or
    * to the token ID if no specific URI is set for that token ID.
    */
    function baseURI() public view returns (string memory) {
        return _baseURI;
    }

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) {
        return _holderTokens[owner].at(index);
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        // _tokenOwners are indexed by tokenIds, so .length() returns the number of tokenIds
        return _tokenOwners.length();
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view override returns (uint256) {
        (uint256 tokenId, ) = _tokenOwners.at(index);
        return tokenId;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory _data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @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.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory _data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return _tokenOwners.contains(tokenId);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     d*
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory _data) internal virtual {
        _mint(to, tokenId);
        require(_checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        // Clear metadata (if any)
        if (bytes(_tokenURIs[tokenId]).length != 0) {
            delete _tokenURIs[tokenId];
        }

        _holderTokens[owner].remove(tokenId);

        _tokenOwners.remove(tokenId);

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _holderTokens[from].remove(tokenId);
        _holderTokens[to].add(tokenId);

        _tokenOwners.set(tokenId, to);

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
        require(_exists(tokenId), "ERC721Metadata: URI set of nonexistent token");
        _tokenURIs[tokenId] = _tokenURI;
    }

    /**
     * @dev Internal function to set the base URI for all token IDs. It is
     * automatically added as a prefix to the value returned in {tokenURI},
     * or to the token ID if {tokenURI} is empty.
     */
    function _setBaseURI(string memory baseURI_) internal virtual {
        _baseURI = baseURI_;
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory _data)
        private returns (bool)
    {
        if (!to.isContract()) {
            return true;
        }
        bytes memory returndata = to.functionCall(abi.encodeWithSelector(
            IERC721Receiver(to).onERC721Received.selector,
            _msgSender(),
            from,
            tokenId,
            _data
        ), "ERC721: transfer to non ERC721Receiver implementer");
        bytes4 retval = abi.decode(returndata, (bytes4));
        return (retval == _ERC721_RECEIVED);
    }

    function _approve(address to, uint256 tokenId) private {
        _tokenApprovals[tokenId] = to;
        emit Approval(ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual { }
}

File 17 of 29 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {

    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 18 of 29 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 19 of 29 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @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 `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
    external returns (bytes4);
}

File 20 of 29 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts may inherit from this and call {_registerInterface} to declare
 * their support of an interface.
 */
abstract contract ERC165 is IERC165 {
    /*
     * bytes4(keccak256('supportsInterface(bytes4)')) == 0x01ffc9a7
     */
    bytes4 private constant _INTERFACE_ID_ERC165 = 0x01ffc9a7;

    /**
     * @dev Mapping of interface ids to whether or not it's supported.
     */
    mapping(bytes4 => bool) private _supportedInterfaces;

    constructor () {
        // Derived contracts need only register support for their own interfaces,
        // we register support for ERC165 itself here
        _registerInterface(_INTERFACE_ID_ERC165);
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     *
     * Time complexity O(1), guaranteed to always use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) public view override returns (bool) {
        return _supportedInterfaces[interfaceId];
    }

    /**
     * @dev Registers the contract as an implementer of the interface defined by
     * `interfaceId`. Support of the actual ERC165 interface is automatic and
     * registering its interface id is not required.
     *
     * See {IERC165-supportsInterface}.
     *
     * Requirements:
     *
     * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`).
     */
    function _registerInterface(bytes4 interfaceId) internal virtual {
        require(interfaceId != 0xffffffff, "ERC165: invalid interface id");
        _supportedInterfaces[interfaceId] = true;
    }
}

File 21 of 29 : EnumerableMap.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * As of v3.0.0, only maps of type `uint256 -> address` (`UintToAddressMap`) are
 * supported.
 */
library EnumerableMap {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct MapEntry {
        bytes32 _key;
        bytes32 _value;
    }

    struct Map {
        // Storage of map keys and values
        MapEntry[] _entries;

        // Position of the entry defined by a key in the `entries` array, plus 1
        // because index 0 means a key is not in the map.
        mapping (bytes32 => uint256) _indexes;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function _set(Map storage map, bytes32 key, bytes32 value) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex == 0) { // Equivalent to !contains(map, key)
            map._entries.push(MapEntry({ _key: key, _value: value }));
            // The entry is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            map._indexes[key] = map._entries.length;
            return true;
        } else {
            map._entries[keyIndex - 1]._value = value;
            return false;
        }
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function _remove(Map storage map, bytes32 key) private returns (bool) {
        // We read and store the key's index to prevent multiple reads from the same storage slot
        uint256 keyIndex = map._indexes[key];

        if (keyIndex != 0) { // Equivalent to contains(map, key)
            // To delete a key-value pair from the _entries array in O(1), we swap the entry to delete with the last one
            // in the array, and then remove the last entry (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = keyIndex - 1;
            uint256 lastIndex = map._entries.length - 1;

            // When the entry to delete is the last one, the swap operation is unnecessary. However, since this occurs
            // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.

            MapEntry storage lastEntry = map._entries[lastIndex];

            // Move the last entry to the index where the entry to delete is
            map._entries[toDeleteIndex] = lastEntry;
            // Update the index for the moved entry
            map._indexes[lastEntry._key] = toDeleteIndex + 1; // All indexes are 1-based

            // Delete the slot where the moved entry was stored
            map._entries.pop();

            // Delete the index for the deleted slot
            delete map._indexes[key];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function _contains(Map storage map, bytes32 key) private view returns (bool) {
        return map._indexes[key] != 0;
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function _length(Map storage map) private view returns (uint256) {
        return map._entries.length;
    }

   /**
    * @dev Returns the key-value pair stored at position `index` in the map. O(1).
    *
    * Note that there are no guarantees on the ordering of entries inside the
    * array, and it may change when more entries are added or removed.
    *
    * Requirements:
    *
    * - `index` must be strictly less than {length}.
    */
    function _at(Map storage map, uint256 index) private view returns (bytes32, bytes32) {
        require(map._entries.length > index, "EnumerableMap: index out of bounds");

        MapEntry storage entry = map._entries[index];
        return (entry._key, entry._value);
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function _get(Map storage map, bytes32 key) private view returns (bytes32) {
        return _get(map, key, "EnumerableMap: nonexistent key");
    }

    /**
     * @dev Same as {_get}, with a custom error message when `key` is not in the map.
     */
    function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) {
        uint256 keyIndex = map._indexes[key];
        require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key)
        return map._entries[keyIndex - 1]._value; // All indexes are 1-based
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return _set(map._inner, bytes32(key), bytes32(uint256(value)));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
        return _remove(map._inner, bytes32(key));
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
        return _contains(map._inner, bytes32(key));
    }

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return _length(map._inner);
    }

   /**
    * @dev Returns the element 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(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) {
        (bytes32 key, bytes32 value) = _at(map._inner, index);
        return (uint256(key), address(uint256(value)));
    }

    /**
     * @dev Returns the value associated with `key`.  O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     */
    function get(UintToAddressMap storage map, uint256 key, string memory errorMessage) internal view returns (address) {
        return address(uint256(_get(map._inner, bytes32(key), errorMessage)));
    }
}

File 22 of 29 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev String operations.
 */
library Strings {
    /**
     * @dev Converts a `uint256` to its ASCII `string` representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        uint256 index = digits - 1;
        temp = value;
        while (temp != 0) {
            buffer[index--] = byte(uint8(48 + temp % 10));
            temp /= 10;
        }
        return string(buffer);
    }
}

File 23 of 29 : IUniswapV2Pair.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);

    function symbol() external pure returns (string memory);

    function decimals() external pure returns (uint8);

    function totalSupply() external view returns (uint);

    function balanceOf(address owner) external view returns (uint);

    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);

    function transfer(address to, uint value) external returns (bool);

    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);

    function PERMIT_TYPEHASH() external pure returns (bytes32);

    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);

    function factory() external view returns (address);

    function token0() external view returns (address);

    function token1() external view returns (address);

    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);

    function price0CumulativeLast() external view returns (uint);

    function price1CumulativeLast() external view returns (uint);

    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);

    function burn(address to) external returns (uint amount0, uint amount1);

    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;

    function skim(address to) external;

    function sync() external;

    function initialize(address, address) external;
}

File 24 of 29 : IUniswapV2Factory.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);

    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);

    function allPairs(uint) external view returns (address pair);

    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;

    function setFeeToSetter(address) external;
}

File 25 of 29 : IUniswapV2Router01.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 26 of 29 : IUniswapV2Router02.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);

    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 27 of 29 : IERC20Token.sol
// SPDX-License-Identifier: MIT
pragma solidity >0.6.0;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../DNFTLibrary.sol";

interface IERC20Token is IERC20 {

    function decimals() external view returns (uint8);

}

File 28 of 29 : ERC20Token.sol
// SPDX-License-Identifier: MIT

pragma solidity >0.6.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";


contract ERC20Token is ERC20 {
    constructor(string memory name, string memory symbol, uint8 decimal, uint256 initialBalance) ERC20(name, symbol) {
        _setupDecimals(decimal);
        _mint(msg.sender, initialBalance);
    }
}

File 29 of 29 : ERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "../../GSN/Context.sol";
import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin guidelines: functions revert instead
 * of returning `false` on failure. This behavior is nonetheless conventional
 * and does not conflict with the expectations of ERC20 applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20 {
    using SafeMath for uint256;
    using Address for address;

    mapping (address => uint256) private _balances;

    mapping (address => mapping (address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;
    uint8 private _decimals;

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
    constructor (string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _decimals = 18;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view returns (uint8) {
        return _decimals;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20};
     *
     * Requirements:
     * - `sender` and `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - the caller must have allowance for ``sender``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
        return true;
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     */
    function _transfer(address sender, address recipient, uint256 amount) internal virtual {
        require(sender != address(0), "ERC20: transfer from the zero address");
        require(recipient != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(sender, recipient, amount);

        _balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements
     *
     * - `to` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply = _totalSupply.add(amount);
        _balances[account] = _balances[account].add(amount);
        emit Transfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        _balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
        _totalSupply = _totalSupply.sub(amount);
        emit Transfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Sets {decimals} to a value other than the default one of 18.
     *
     * WARNING: This function should only be called from the constructor. Most
     * applications that interact with token contracts will not expect
     * {decimals} to ever change, and may work incorrectly if it does.
     */
    function _setupDecimals(uint8 decimals_) internal {
        _decimals = decimals_;
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be to transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}

Settings
{
  "metadata": {
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"buy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"canWithdrawValue","outputs":[{"internalType":"uint256","name":"timeNum","type":"uint256"},{"internalType":"uint256","name":"dnftNum","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"costTokenAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"costTokenDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dnftTokenAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDNFTPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_mainAddr","type":"address"},{"internalType":"address","name":"_dnftTokenAddr","type":"address"},{"internalType":"address","name":"_uniswapAddr","type":"address"},{"internalType":"uint16","name":"_id","type":"uint16"},{"internalType":"address","name":"_costTokenAddr","type":"address"},{"internalType":"uint256","name":"_cost","type":"uint256"},{"internalType":"uint32","name":"_totalReturnRate","type":"uint32"},{"internalType":"uint256","name":"_maxMintTime","type":"uint256"},{"internalType":"uint256","name":"_maxTokenSize","type":"uint256"}],"name":"initProduct","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mainAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMintTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokenSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintBegin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintPerTimeValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintTimeInterval","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mintWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pid","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tid","type":"uint256"}],"name":"tokenDetailOf","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bool","name":"mining","type":"bool"},{"internalType":"uint256","name":"totalTime","type":"uint256"},{"internalType":"uint256","name":"totalValue","type":"uint256"},{"internalType":"uint256","name":"propA","type":"uint256"},{"internalType":"uint256","name":"propB","type":"uint256"},{"internalType":"uint256","name":"propC","type":"uint256"},{"components":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"beginTime","type":"uint256"},{"internalType":"uint256","name":"withdrawTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"totalValue","type":"uint256"}],"internalType":"struct Lib.ProductMintItem","name":"currMining","type":"tuple"}],"internalType":"struct Lib.ProductTokenDetail","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tid","type":"uint256"}],"name":"tokenMintHistoryOf","outputs":[{"components":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"beginTime","type":"uint256"},{"internalType":"uint256","name":"withdrawTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"totalValue","type":"uint256"}],"internalType":"struct Lib.ProductMintItem[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bool","name":"mining","type":"bool"},{"internalType":"uint256","name":"totalTime","type":"uint256"},{"internalType":"uint256","name":"totalValue","type":"uint256"},{"internalType":"uint256","name":"propA","type":"uint256"},{"internalType":"uint256","name":"propB","type":"uint256"},{"internalType":"uint256","name":"propC","type":"uint256"},{"components":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"uint256","name":"beginTime","type":"uint256"},{"internalType":"uint256","name":"withdrawTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"totalValue","type":"uint256"}],"internalType":"struct Lib.ProductMintItem","name":"currMining","type":"tuple"}],"internalType":"struct Lib.ProductTokenDetail[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalReturnRate","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"to","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b50604051620042ec380380620042ec83398101604081905262000034916200030a565b8282620000486301ffc9a760e01b6200013f565b81516200005d906006906020850190620001e1565b50805162000073906007906020840190620001e1565b50620000866380ac58cd60e01b6200013f565b62000098635b5e139f60e01b6200013f565b620000aa63780e9d6360e01b6200013f565b5060009050620000b9620001c4565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506200013681846040516020016200012092919062000397565b60408051601f19818403018152919052620001c8565b50505062000409565b6001600160e01b031980821614156200019f576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b3390565b8051620001dd906009906020840190620001e1565b5050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928262000219576000855562000264565b82601f106200023457805160ff191683800117855562000264565b8280016001018555821562000264579182015b828111156200026457825182559160200191906001019062000247565b506200027292915062000276565b5090565b5b8082111562000272576000815560010162000277565b600082601f8301126200029e578081fd5b81516001600160401b0380821115620002b357fe5b604051601f8301601f191681016020018281118282101715620002d257fe5b604052828152925082848301602001861015620002ee57600080fd5b62000301836020830160208801620003d6565b50505092915050565b6000806000606084860312156200031f578283fd5b83516001600160401b038082111562000336578485fd5b62000344878388016200028d565b945060208601519150808211156200035a578384fd5b62000368878388016200028d565b935060408601519150808211156200037e578283fd5b506200038d868287016200028d565b9150509250925092565b60008351620003ab818460208801620003d6565b835190830190620003c1818360208801620003d6565b602f60f81b9101908152600101949350505050565b60005b83811015620003f3578181015183820152602001620003d9565b8381111562000403576000848401525b50505050565b613ed380620004196000396000f3fe608060405234801561001057600080fd5b50600436106102695760003560e01c806370a0823111610151578063bdddd96a116100c3578063e985e9c511610087578063e985e9c5146104e6578063eb1b8f45146104f9578063f088d5471461050e578063f106845414610521578063f2fde38b14610536578063f5ae7b0c1461054957610269565b8063bdddd96a146104a8578063c2b3cf34146104bb578063c34283dc146104c3578063c87b56dd146104cb578063cb926bbc146104de57610269565b806395d89b411161011557806395d89b411461044a578063a172f98114610452578063a22cb4651461045a578063a7306ab91461046d578063b40c245414610475578063b88d4fde1461049557610269565b806370a08231146103f4578063715018a61461040757806372de00961461040f5780638462151c146104225780638da5cb5b1461044257610269565b80631e9a6950116101ea57806341ca6d7c116101ae57806341ca6d7c1461038b57806342842e0e1461039e5780634f6ccce7146103b15780634fcfe726146103c45780636352211e146103d95780636c0360eb146103ec57610269565b80631e9a69501461032957806323b872dd1461034a578063246725941461035d5780632f745c591461037057806331a3a6e61461038357610269565b8063081812fc11610231578063081812fc146102eb578063095ea7b3146102fe578063128a8b051461031157806313faede61461031957806318160ddd1461032157610269565b806301e336671461026e57806301ffc9a714610283578063046436c3146102ac57806304f468a7146102c157806306fdde03146102d6575b600080fd5b61028161027c366004613488565b610569565b005b6102966102913660046136fa565b6105ff565b6040516102a391906138c9565b60405180910390f35b6102b4610622565b6040516102a39190613b7d565b6102c9610628565b6040516102a391906137fd565b6102de610637565b6040516102a391906138d4565b6102c96102f9366004613722565b6106ce565b61028161030c3660046136b3565b610730565b6102c9610801565b6102b4610810565b6102b4610816565b61033c6103373660046136b3565b610827565b6040516102a3929190613b86565b6102816103583660046135ae565b610990565b61028161036b366004613500565b6109e7565b6102b461037e3660046136b3565b610bff565b6102b4610c2a565b6102816103993660046136b3565b610c30565b6102816103ac3660046135ae565b610d43565b6102b46103bf366004613722565b610d5e565b6103cc610d74565b6040516102a39190613b94565b6102c96103e7366004613722565b610d80565b6102de610da8565b6102b4610402366004613450565b610e09565b610281610e71565b61033c61041d3660046136b3565b610f25565b610435610430366004613450565b610f73565b6040516102a39190613886565b6102c961123f565b6102de61124e565b6102b46112af565b610281610468366004613686565b6112b5565b6102c96113ba565b610488610483366004613722565b6113c9565b6040516102a39190613b5f565b6102816104a33660046135c2565b611489565b61033c6104b6366004613722565b6114e7565b6102b46114fd565b6102c9611507565b6102de6104d9366004613722565b611516565b6102b46117bd565b6102966104f43660046134c8565b6117c3565b6105016117f1565b6040516102a39190613ba5565b6102b461051c366004613450565b6117fa565b610529611988565b6040516102a39190613b6e565b610281610544366004613450565b611992565b61055c610557366004613722565b611a9d565b6040516102a39190613844565b6010546001600160a01b0316331461059c5760405162461bcd60e51b815260040161059390613b2f565b60405180910390fd5b6001600160a01b0382166105e6576040516001600160a01b0384169082156108fc029083906000818181858888f193505050501580156105e0573d6000803e3d6000fd5b506105fa565b6105fa6001600160a01b0383168483611b44565b505050565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60135481565b6010546001600160a01b031681565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106c35780601f10610698576101008083540402835291602001916106c3565b820191906000526020600020905b8154815290600101906020018083116106a657829003601f168201915b505050505090505b90565b60006106d982611b96565b6107145760405162461bcd60e51b815260040180806020018281038252602c815260200180613d72602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061073b82610d80565b9050806001600160a01b0316836001600160a01b0316141561078e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613e226021913960400191505060405180910390fd5b806001600160a01b03166107a0611ba3565b6001600160a01b031614806107bc57506107bc816104f4611ba3565b6107f75760405162461bcd60e51b8152600401808060200182810382526038815260200180613ca46038913960400191505060405180910390fd5b6105fa8383611ba7565b600f546001600160a01b031681565b60165481565b60006108226002611c15565b905090565b60105460009081906001600160a01b031633146108565760405162461bcd60e51b815260040161059390613b2f565b6108608484611c20565b60008061086d8686611cbc565b6000878152600b602081815260408084206001808201805460ff1916905542600a8301908155600c855283872080548084018255908852858820600785015460059092020180546001600160a01b0319166001600160a01b03928316178155600885015493810193909355600984015460028401559054600383015594820154600490910155928c168452600d909152909120929450909250906109119087611de5565b5061091a61332b565b80516007830180546001600160a01b0319166001600160a01b03909216919091179055602080820151600884015560408083015160098501556060830151600a8501556080830151600b85015580519182019052600081526109819030908a908a90611df1565b509193509150505b9250929050565b6109a161099b611ba3565b82611e43565b6109dc5760405162461bcd60e51b8152600401808060200182810382526031815260200180613e436031913960400191505060405180910390fd5b6105fa838383611ee7565b6109ef611ba3565b600a546001600160a01b03908116911614610a51576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601b5460ff1615610a745760405162461bcd60e51b815260040161059390613927565b620f42408110610a965760405162461bcd60e51b815260040161059390613a9c565b601080546001600160a01b03199081166001600160a01b038c8116919091179092556012805461ffff191661ffff8a161790556015805482168884169081179091556016879055601484905560138590556017805463ffffffff191663ffffffff8816179055600e805483168c8516179055600f8054909216928a1692909217905515610ba757846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5657600080fd5b505afa158015610b6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8e9190613752565b6019805460ff191660ff92909216919091179055610bb5565b6019805460ff191660121790555b603c6018819055601354610bf191610bcd9190612033565b601654601754610beb91606491839163ffffffff9182169161207516565b90612033565b601155505050505050505050565b6001600160a01b0382166000908152600160205260408120610c2190836120ce565b90505b92915050565b60115481565b6010546001600160a01b03163314610c5a5760405162461bcd60e51b815260040161059390613b2f565b610c648282611e43565b610c805760405162461bcd60e51b815260040161059390613ade565b6000818152600b60205260409020600181015460ff1615610cb35760405162461bcd60e51b815260040161059390613a6d565b601354816002015410610cd85760405162461bcd60e51b815260040161059390613978565b6001818101805460ff191690911790556007810180546001600160a01b0319166001600160a01b03851690811790915542600883018190556000600a84018190556009840191909155908152600d60205260409020610d3790836120da565b506105fa833084611ee7565b6105fa83838360405180602001604052806000815250611489565b600080610d6c6002846120e6565b509392505050565b60175463ffffffff1681565b6000610c2482604051806060016040528060298152602001613d066029913960029190612102565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106c35780601f10610698576101008083540402835291602001916106c3565b60006001600160a01b038216610e505760405162461bcd60e51b815260040180806020018281038252602a815260200180613cdc602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610c2490611c15565b610e79611ba3565b600a546001600160a01b03908116911614610edb576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b60105460009081906001600160a01b03163314610f545760405162461bcd60e51b815260040161059390613b2f565b610f5e8484611c20565b610f688484611cbc565b915091509250929050565b6001600160a01b0381166000908152600d60205260408120606091610f9784610e09565b9050600081610fa584611c15565b01905080610fed5760408051600080825260208201909252606091610fe0565b610fcd613363565b815260200190600190039081610fc55790505b50945061061d9350505050565b60608167ffffffffffffffff8111801561100657600080fd5b5060405190808252806020026020018201604052801561104057816020015b61102d613363565b8152602001906001900390816110255790505b50905060005b61104f85611c15565b81101561113d57600b600061106487846120ce565b8152602080820192909252604090810160002081516101008101835281548152600182015460ff1615158185015260028201548184015260038201546060808301919091526004830154608080840191909152600584015460a080850191909152600685015460c08501528551908101865260078501546001600160a01b03168152600885015496810196909652600984015494860194909452600a83015490850152600b909101549183019190915260e0810191909152825183908390811061112a57fe5b6020908102919091010152600101611046565b60005b8481101561123357600b60006111568a84610bff565b8152602080820192909252604090810160002081516101008101835281548152600182015460ff1615158185015260028201548184015260038201546060808301919091526004830154608080840191909152600584015460a080850191909152600685015460c08501528551908101865260078501546001600160a01b03168152600885015496810196909652600984015494860194909452600a83015490850152600b909101549183019190915260e0810191909152835184908490811061121c57fe5b602090810291909101015260019182019101611140565b50909695505050505050565b600a546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106c35780601f10610698576101008083540402835291602001916106c3565b60185481565b6112bd611ba3565b6001600160a01b0316826001600160a01b03161415611323576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000611330611ba3565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611374611ba3565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6015546001600160a01b031681565b6113d1613363565b506000908152600b602081815260409283902083516101008101855281548152600182015460ff1615158184015260028201548186015260038201546060808301919091526004830154608080840191909152600584015460a080850191909152600685015460c08501528751908101885260078501546001600160a01b03168152600885015495810195909552600984015496850196909652600a830154908401529201549281019290925260e081019190915290565b61149a611494611ba3565b83611e43565b6114d55760405162461bcd60e51b8152600401808060200182810382526031815260200180613e436031913960400191505060405180910390fd5b6114e184848484611df1565b50505050565b6000806114f383612119565b915091505b915091565b600061082261220d565b600e546001600160a01b031681565b606061152182611b96565b61155c5760405162461bcd60e51b815260040180806020018281038252602f815260200180613df3602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156115f15780601f106115c6576101008083540402835291602001916115f1565b820191906000526020600020905b8154815290600101906020018083116115d457829003601f168201915b50506009549394505050506002600019610100600184161502019091160461161a57905061061d565b8051156116eb5760098160405160200180838054600181600116156101000203166002900480156116825780601f10611660576101008083540402835291820191611682565b820191906000526020600020905b81548152906001019060200180831161166e575b5050825160208401908083835b602083106116ae5780518252601f19909201916020918201910161168f565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405291505061061d565b60096116f6846123c6565b60405160200180838054600181600116156101000203166002900480156117545780601f10611732576101008083540402835291820191611754565b820191906000526020600020905b815481529060010190602001808311611740575b5050825160208401908083835b602083106117805780518252601f199092019160209182019101611761565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b60145481565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60195460ff1681565b6010546000906001600160a01b031633146118275760405162461bcd60e51b815260040161059390613b2f565b601454611834601a6124a1565b106118515760405162461bcd60e51b81526004016105939061394c565b61185b601a6124a5565b6000611867601a6124a1565b60125461ffff16620f42400262ffffff16019050611883613363565b81815261189360006127106124ae565b60808201526118a560006127106124ae565b60a08201526118b760006127106124ae565b60c082019081526000838152600b6020818152604092839020855181558186015160018201805460ff19169115159190911790558386015160028201556060808701516003830155608080880151600484015560a088015160058401559551600683015560e087015180516007840180546001600160a01b0319166001600160a01b0390921691909117905592830151600883015593820151600982015592810151600a8401559092015191015561196f8483612587565b6119818261197c846123c6565b6125a1565b5092915050565b60125461ffff1681565b61199a611ba3565b600a546001600160a01b039081169116146119fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611a415760405162461bcd60e51b8152600401808060200182810382526026815260200180613c2e6026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600c6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015611b395760008481526020908190206040805160a0810182526005860290920180546001600160a01b0316835260018082015484860152600282015492840192909252600381015460608401526004015460808301529083529092019101611ad2565b505050509050919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526105fa908490612604565b6000610c246002836126b5565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611bdc82610d80565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610c24826124a1565b611c2a3082611e43565b611c465760405162461bcd60e51b815260040161059390613ade565b6000818152600b6020526040902060019081015460ff16151514611c7c5760405162461bcd60e51b8152600401610593906139a5565b6000818152600b60205260409020600701546001600160a01b03838116911614611cb85760405162461bcd60e51b8152600401610593906139ff565b5050565b600080600080611ccb85612119565b9150915060008111611ce05792509050610989565b6000858152600b602052604090206003810154611cfd90836126c1565b6003820155600b810154611d1190836126c1565b600b820155601854600090611d27908590612075565b6009830154909150611d3990826126c1565b60098301556002820154611d4d90826126c1565b6002830155600e5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90611d84908b90879060040161382b565b602060405180830381600087803b158015611d9e57600080fd5b505af1158015611db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd691906136de565b50919792965091945050505050565b6000610c21838361271b565b611dfc848484611ee7565b611e08848484846127e1565b6114e15760405162461bcd60e51b8152600401808060200182810382526032815260200180613bfc6032913960400191505060405180910390fd5b6000611e4e82611b96565b611e895760405162461bcd60e51b815260040180806020018281038252602c815260200180613c78602c913960400191505060405180910390fd5b6000611e9483610d80565b9050806001600160a01b0316846001600160a01b03161480611ecf5750836001600160a01b0316611ec4846106ce565b6001600160a01b0316145b80611edf5750611edf81856117c3565b949350505050565b826001600160a01b0316611efa82610d80565b6001600160a01b031614611f3f5760405162461bcd60e51b8152600401808060200182810382526029815260200180613dca6029913960400191505060405180910390fd5b6001600160a01b038216611f845760405162461bcd60e51b8152600401808060200182810382526024815260200180613c546024913960400191505060405180910390fd5b611f8f8383836105fa565b611f9a600082611ba7565b6001600160a01b0383166000908152600160205260409020611fbc9082611de5565b506001600160a01b0382166000908152600160205260409020611fdf90826120da565b50611fec60028284612949565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610c2183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061295f565b60008261208457506000610c24565b8282028284828161209157fe5b0414610c215760405162461bcd60e51b8152600401808060200182810382526021815260200180613d516021913960400191505060405180910390fd5b6000610c218383612a01565b6000610c218383612a65565b60008080806120f58686612aaf565b9097909650945050505050565b600061210f848484612b2a565b90505b9392505050565b600080600061212661220d565b6000858152600b602052604081206018546002820154601354949550919361215292610beb9190612bb7565b90506000811161216b57600080945094505050506114f8565b60185460098301546121839190610beb904290612bb7565b945080851115612191578094505b600085116121a857600080945094505050506114f8565b6015546012906001600160a01b0316156121c4575060195460ff165b6121ea81600a0a610beb886121e48860115461207590919063ffffffff16565b90612075565b9450600085116122045760008095509550505050506114f8565b50505050915091565b600e546015546000916001600160a01b039182169116141561223457506305f5e1006106cb565b600f546001600160a01b0316612250575064174876e8006106cb565b600f54604080516315ab88c960e31b815290516001600160a01b0390921691600091839163ad5c464891600480820192602092909190829003018186803b15801561229a57600080fd5b505afa1580156122ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d2919061346c565b600e549091506000906122fb908490670de0b6b3a76400009085906001600160a01b0316612bf9565b6015549091506001600160a01b03166123185792506106cb915050565b60155460009061233e908590670de0b6b3a76400009086906001600160a01b0316612bf9565b60195490915060ff166008141561236a5780826305f5e100028161235e57fe5b049450505050506106cb565b601954600860ff909116101561239d5760195460ff16600803600a0a816305f5e10084028161239557fe5b048161235e57fe5b60195460ff1660071901600a0a816305f5e1008402816123b957fe5b04029450505050506106cb565b6060816123eb57506040805180820190915260018152600360fc1b602082015261061d565b8160005b811561240357600101600a820491506123ef565b60608167ffffffffffffffff8111801561241c57600080fd5b506040519080825280601f01601f191660200182016040528015612447576020820181803683370190505b50859350905060001982015b831561249857600a840660300160f81b8282806001900393508151811061247657fe5b60200101906001600160f81b031916908160001a905350600a84049350612453565b50949350505050565b5490565b80546001019055565b6000805a9050600043423360405160200180826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012060001c816124f557fe5b048345424160405160200180826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012060001c8161253657fe5b044442010101010101604051602001808281526020019150506040516020818303038152906040528051906020012060001c9050848403858503828161257857fe5b04029003840191505092915050565b611cb8828260405180602001604052806000815250612eed565b6125aa82611b96565b6125e55760405162461bcd60e51b815260040180806020018281038252602c815260200180613d9e602c913960400191505060405180910390fd5b600082815260086020908152604090912082516105fa928401906133af565b6060612659826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f3f9092919063ffffffff16565b8051909150156105fa5780806020019051602081101561267857600080fd5b50516105fa5760405162461bcd60e51b815260040180806020018281038252602a815260200180613e74602a913960400191505060405180910390fd5b6000610c218383612f4e565b600082820183811015610c21576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081815260018301602052604081205480156127d7578354600019808301919081019060009087908390811061274e57fe5b906000526020600020015490508087600001848154811061276b57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061279b57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610c24565b6000915050610c24565b60006127f5846001600160a01b0316612f66565b61280157506001611edf565b606061290f630a85bd0160e11b612816611ba3565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561287d578181015183820152602001612865565b50505050905090810190601f1680156128aa5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001613bfc603291396001600160a01b0388169190612f3f565b9050600081806020019051602081101561292857600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b600061210f84846001600160a01b038516612f9f565b600081836129eb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129b0578181015183820152602001612998565b50505050905090810190601f1680156129dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816129f757fe5b0495945050505050565b81546000908210612a435760405162461bcd60e51b8152600401808060200182810382526022815260200180613bda6022913960400191505060405180910390fd5b826000018281548110612a5257fe5b9060005260206000200154905092915050565b6000612a718383612f4e565b612aa757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c24565b506000610c24565b815460009081908310612af35760405162461bcd60e51b8152600401808060200182810382526022815260200180613d2f6022913960400191505060405180910390fd5b6000846000018481548110612b0457fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281612b885760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156129b0578181015183820152602001612998565b50846000016001820381548110612b9b57fe5b9060005260206000209060020201600101549150509392505050565b6000610c2183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613036565b6000808490506000866001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015612c3a57600080fd5b505afa158015612c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c72919061346c565b90506000816001600160a01b031663e6a4390587876040518363ffffffff1660e01b8152600401612ca4929190613811565b60206040518083038186803b158015612cbc57600080fd5b505afa158015612cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf4919061346c565b90506001600160a01b038116612d1c5760405162461bcd60e51b815260040161059390613a36565b6040516370a0823160e01b8152869086906000906001600160a01b038416906370a0823190612d4f9087906004016137fd565b60206040518083038186803b158015612d6757600080fd5b505afa158015612d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9f919061373a565b90506000826001600160a01b03166370a08231866040518263ffffffff1660e01b8152600401612dcf91906137fd565b60206040518083038186803b158015612de757600080fd5b505afa158015612dfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e1f919061373a565b9050600082118015612e315750600081115b612e4d5760405162461bcd60e51b8152600401610593906139cf565b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612e8857600080fd5b505afa158015612e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ec09190613752565b60ff16600a0a9050612edc81610beb846121e48783858f612075565b9d9c50505050505050505050505050565b612ef78383613090565b612f0460008484846127e1565b6105fa5760405162461bcd60e51b8152600401808060200182810382526032815260200180613bfc6032913960400191505060405180910390fd5b606061210f84846000856131be565b60009081526001919091016020526040902054151590565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611edf575050151592915050565b600082815260018401602052604081205480613004575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055612112565b8285600001600183038154811061301757fe5b9060005260206000209060020201600101819055506000915050612112565b600081848411156130885760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156129b0578181015183820152602001612998565b505050900390565b6001600160a01b0382166130eb576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6130f481611b96565b15613146576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b613152600083836105fa565b6001600160a01b038216600090815260016020526040902061317490826120da565b5061318160028284612949565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60606131c985612f66565b61321a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106132595780518252601f19909201916020918201910161323a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146132bb576040519150601f19603f3d011682016040523d82523d6000602084013e6132c0565b606091505b509150915081156132d4579150611edf9050565b8051156132e45780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156129b0578181015183820152602001612998565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6040518061010001604052806000815260200160001515815260200160008152602001600081526020016000815260200160008152602001600081526020016133aa61332b565b905290565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826133e5576000855561342b565b82601f106133fe57805160ff191683800117855561342b565b8280016001018555821561342b579182015b8281111561342b578251825591602001919060010190613410565b5061343792915061343b565b5090565b5b80821115613437576000815560010161343c565b600060208284031215613461578081fd5b8135610c2181613bb3565b60006020828403121561347d578081fd5b8151610c2181613bb3565b60008060006060848603121561349c578182fd5b83356134a781613bb3565b925060208401356134b781613bb3565b929592945050506040919091013590565b600080604083850312156134da578182fd5b82356134e581613bb3565b915060208301356134f581613bb3565b809150509250929050565b60008060008060008060008060006101208a8c03121561351e578485fd5b893561352981613bb3565b985060208a013561353981613bb3565b975060408a013561354981613bb3565b965060608a013561ffff8116811461355f578586fd5b955060808a013561356f81613bb3565b945060a08a0135935060c08a013563ffffffff8116811461358e578384fd5b8093505060e08a013591506101008a013590509295985092959850929598565b60008060006060848603121561349c578283fd5b600080600080608085870312156135d7578384fd5b84356135e281613bb3565b93506020858101356135f381613bb3565b935060408601359250606086013567ffffffffffffffff80821115613616578384fd5b818801915088601f830112613629578384fd5b81358181111561363557fe5b604051601f8201601f191681018501838111828210171561365257fe5b60405281815283820185018b1015613668578586fd5b81858501868301379081019093019390935250939692955090935050565b60008060408385031215613698578182fd5b82356136a381613bb3565b915060208301356134f581613bcb565b600080604083850312156136c5578182fd5b82356136d081613bb3565b946020939093013593505050565b6000602082840312156136ef578081fd5b8151610c2181613bcb565b60006020828403121561370b578081fd5b81356001600160e01b031981168114610c21578182fd5b600060208284031215613733578081fd5b5035919050565b60006020828403121561374b578081fd5b5051919050565b600060208284031215613763578081fd5b815160ff81168114610c21578182fd5b80516001600160a01b03168252602080820151908301526040808201519083015260608082015190830152608090810151910152565b8051825260208101511515602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e08101516105fa60e0840182613773565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561123357613873838551613773565b9284019260a09290920191600101613860565b6020808252825182820181905260009190848201906040850190845b81811015611233576138b58385516137a9565b9284019261018092909201916001016138a2565b901515815260200190565b6000602080835283518082850152825b81811015613900578581018301518582016040015282016138e4565b818111156139115783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600b908201526a1c995c19585d081a5b9a5d60aa1b604082015260600190565b6020808252601290820152710e0e4dec8eac6e840dcdee840cadcdeeaced60731b604082015260600190565b6020808252601390820152722a37b5b2b71030b63932b0b23c903232b0b21760691b604082015260600190565b60208082526010908201526f2a37b5b2b71037379036b4b734b7339760811b604082015260600190565b60208082526016908201527505061697220746f6b656e2062616c616e6365203c20360541b604082015260600190565b60208082526018908201527f546f6b656e206d696e65206973206e6f74206f776e65722e0000000000000000604082015260600190565b6020808252601d908201527f444e465420756e69737761702070616972206e6f74206578697374732e000000604082015260600190565b6020808252601590820152742a37b5b2b71030b63932b0b23c9036b4b734b7339760591b604082015260600190565b60208082526022908201527f70726f6475637420746f74616c20737570706c79206d757374206265203c2031604082015261229b60f11b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526016908201527531b0b63632b91034b9903737ba103a34329036b0b4b760511b604082015260600190565b6101808101610c2482846137a9565b61ffff91909116815260200190565b90815260200190565b918252602082015260400190565b63ffffffff91909116815260200190565b60ff91909116815260200190565b6001600160a01b0381168114613bc857600080fd5b50565b8015158114613bc857600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212201f8c66639218ae299c7a3d86af0862d6feae25cc9f36c204c28db15abf09d35264736f6c63430007040033000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000008506c616e65742d310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004504c543100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002968747470733a2f2f646e66742e696f2f737461746963732f70726f64756374732f6d61696e6e65742f0000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102695760003560e01c806370a0823111610151578063bdddd96a116100c3578063e985e9c511610087578063e985e9c5146104e6578063eb1b8f45146104f9578063f088d5471461050e578063f106845414610521578063f2fde38b14610536578063f5ae7b0c1461054957610269565b8063bdddd96a146104a8578063c2b3cf34146104bb578063c34283dc146104c3578063c87b56dd146104cb578063cb926bbc146104de57610269565b806395d89b411161011557806395d89b411461044a578063a172f98114610452578063a22cb4651461045a578063a7306ab91461046d578063b40c245414610475578063b88d4fde1461049557610269565b806370a08231146103f4578063715018a61461040757806372de00961461040f5780638462151c146104225780638da5cb5b1461044257610269565b80631e9a6950116101ea57806341ca6d7c116101ae57806341ca6d7c1461038b57806342842e0e1461039e5780634f6ccce7146103b15780634fcfe726146103c45780636352211e146103d95780636c0360eb146103ec57610269565b80631e9a69501461032957806323b872dd1461034a578063246725941461035d5780632f745c591461037057806331a3a6e61461038357610269565b8063081812fc11610231578063081812fc146102eb578063095ea7b3146102fe578063128a8b051461031157806313faede61461031957806318160ddd1461032157610269565b806301e336671461026e57806301ffc9a714610283578063046436c3146102ac57806304f468a7146102c157806306fdde03146102d6575b600080fd5b61028161027c366004613488565b610569565b005b6102966102913660046136fa565b6105ff565b6040516102a391906138c9565b60405180910390f35b6102b4610622565b6040516102a39190613b7d565b6102c9610628565b6040516102a391906137fd565b6102de610637565b6040516102a391906138d4565b6102c96102f9366004613722565b6106ce565b61028161030c3660046136b3565b610730565b6102c9610801565b6102b4610810565b6102b4610816565b61033c6103373660046136b3565b610827565b6040516102a3929190613b86565b6102816103583660046135ae565b610990565b61028161036b366004613500565b6109e7565b6102b461037e3660046136b3565b610bff565b6102b4610c2a565b6102816103993660046136b3565b610c30565b6102816103ac3660046135ae565b610d43565b6102b46103bf366004613722565b610d5e565b6103cc610d74565b6040516102a39190613b94565b6102c96103e7366004613722565b610d80565b6102de610da8565b6102b4610402366004613450565b610e09565b610281610e71565b61033c61041d3660046136b3565b610f25565b610435610430366004613450565b610f73565b6040516102a39190613886565b6102c961123f565b6102de61124e565b6102b46112af565b610281610468366004613686565b6112b5565b6102c96113ba565b610488610483366004613722565b6113c9565b6040516102a39190613b5f565b6102816104a33660046135c2565b611489565b61033c6104b6366004613722565b6114e7565b6102b46114fd565b6102c9611507565b6102de6104d9366004613722565b611516565b6102b46117bd565b6102966104f43660046134c8565b6117c3565b6105016117f1565b6040516102a39190613ba5565b6102b461051c366004613450565b6117fa565b610529611988565b6040516102a39190613b6e565b610281610544366004613450565b611992565b61055c610557366004613722565b611a9d565b6040516102a39190613844565b6010546001600160a01b0316331461059c5760405162461bcd60e51b815260040161059390613b2f565b60405180910390fd5b6001600160a01b0382166105e6576040516001600160a01b0384169082156108fc029083906000818181858888f193505050501580156105e0573d6000803e3d6000fd5b506105fa565b6105fa6001600160a01b0383168483611b44565b505050565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60135481565b6010546001600160a01b031681565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106c35780601f10610698576101008083540402835291602001916106c3565b820191906000526020600020905b8154815290600101906020018083116106a657829003601f168201915b505050505090505b90565b60006106d982611b96565b6107145760405162461bcd60e51b815260040180806020018281038252602c815260200180613d72602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061073b82610d80565b9050806001600160a01b0316836001600160a01b0316141561078e5760405162461bcd60e51b8152600401808060200182810382526021815260200180613e226021913960400191505060405180910390fd5b806001600160a01b03166107a0611ba3565b6001600160a01b031614806107bc57506107bc816104f4611ba3565b6107f75760405162461bcd60e51b8152600401808060200182810382526038815260200180613ca46038913960400191505060405180910390fd5b6105fa8383611ba7565b600f546001600160a01b031681565b60165481565b60006108226002611c15565b905090565b60105460009081906001600160a01b031633146108565760405162461bcd60e51b815260040161059390613b2f565b6108608484611c20565b60008061086d8686611cbc565b6000878152600b602081815260408084206001808201805460ff1916905542600a8301908155600c855283872080548084018255908852858820600785015460059092020180546001600160a01b0319166001600160a01b03928316178155600885015493810193909355600984015460028401559054600383015594820154600490910155928c168452600d909152909120929450909250906109119087611de5565b5061091a61332b565b80516007830180546001600160a01b0319166001600160a01b03909216919091179055602080820151600884015560408083015160098501556060830151600a8501556080830151600b85015580519182019052600081526109819030908a908a90611df1565b509193509150505b9250929050565b6109a161099b611ba3565b82611e43565b6109dc5760405162461bcd60e51b8152600401808060200182810382526031815260200180613e436031913960400191505060405180910390fd5b6105fa838383611ee7565b6109ef611ba3565b600a546001600160a01b03908116911614610a51576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b601b5460ff1615610a745760405162461bcd60e51b815260040161059390613927565b620f42408110610a965760405162461bcd60e51b815260040161059390613a9c565b601080546001600160a01b03199081166001600160a01b038c8116919091179092556012805461ffff191661ffff8a161790556015805482168884169081179091556016879055601484905560138590556017805463ffffffff191663ffffffff8816179055600e805483168c8516179055600f8054909216928a1692909217905515610ba757846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610b5657600080fd5b505afa158015610b6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8e9190613752565b6019805460ff191660ff92909216919091179055610bb5565b6019805460ff191660121790555b603c6018819055601354610bf191610bcd9190612033565b601654601754610beb91606491839163ffffffff9182169161207516565b90612033565b601155505050505050505050565b6001600160a01b0382166000908152600160205260408120610c2190836120ce565b90505b92915050565b60115481565b6010546001600160a01b03163314610c5a5760405162461bcd60e51b815260040161059390613b2f565b610c648282611e43565b610c805760405162461bcd60e51b815260040161059390613ade565b6000818152600b60205260409020600181015460ff1615610cb35760405162461bcd60e51b815260040161059390613a6d565b601354816002015410610cd85760405162461bcd60e51b815260040161059390613978565b6001818101805460ff191690911790556007810180546001600160a01b0319166001600160a01b03851690811790915542600883018190556000600a84018190556009840191909155908152600d60205260409020610d3790836120da565b506105fa833084611ee7565b6105fa83838360405180602001604052806000815250611489565b600080610d6c6002846120e6565b509392505050565b60175463ffffffff1681565b6000610c2482604051806060016040528060298152602001613d066029913960029190612102565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106c35780601f10610698576101008083540402835291602001916106c3565b60006001600160a01b038216610e505760405162461bcd60e51b815260040180806020018281038252602a815260200180613cdc602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610c2490611c15565b610e79611ba3565b600a546001600160a01b03908116911614610edb576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b60105460009081906001600160a01b03163314610f545760405162461bcd60e51b815260040161059390613b2f565b610f5e8484611c20565b610f688484611cbc565b915091509250929050565b6001600160a01b0381166000908152600d60205260408120606091610f9784610e09565b9050600081610fa584611c15565b01905080610fed5760408051600080825260208201909252606091610fe0565b610fcd613363565b815260200190600190039081610fc55790505b50945061061d9350505050565b60608167ffffffffffffffff8111801561100657600080fd5b5060405190808252806020026020018201604052801561104057816020015b61102d613363565b8152602001906001900390816110255790505b50905060005b61104f85611c15565b81101561113d57600b600061106487846120ce565b8152602080820192909252604090810160002081516101008101835281548152600182015460ff1615158185015260028201548184015260038201546060808301919091526004830154608080840191909152600584015460a080850191909152600685015460c08501528551908101865260078501546001600160a01b03168152600885015496810196909652600984015494860194909452600a83015490850152600b909101549183019190915260e0810191909152825183908390811061112a57fe5b6020908102919091010152600101611046565b60005b8481101561123357600b60006111568a84610bff565b8152602080820192909252604090810160002081516101008101835281548152600182015460ff1615158185015260028201548184015260038201546060808301919091526004830154608080840191909152600584015460a080850191909152600685015460c08501528551908101865260078501546001600160a01b03168152600885015496810196909652600984015494860194909452600a83015490850152600b909101549183019190915260e0810191909152835184908490811061121c57fe5b602090810291909101015260019182019101611140565b50909695505050505050565b600a546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156106c35780601f10610698576101008083540402835291602001916106c3565b60185481565b6112bd611ba3565b6001600160a01b0316826001600160a01b03161415611323576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000611330611ba3565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611374611ba3565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6015546001600160a01b031681565b6113d1613363565b506000908152600b602081815260409283902083516101008101855281548152600182015460ff1615158184015260028201548186015260038201546060808301919091526004830154608080840191909152600584015460a080850191909152600685015460c08501528751908101885260078501546001600160a01b03168152600885015495810195909552600984015496850196909652600a830154908401529201549281019290925260e081019190915290565b61149a611494611ba3565b83611e43565b6114d55760405162461bcd60e51b8152600401808060200182810382526031815260200180613e436031913960400191505060405180910390fd5b6114e184848484611df1565b50505050565b6000806114f383612119565b915091505b915091565b600061082261220d565b600e546001600160a01b031681565b606061152182611b96565b61155c5760405162461bcd60e51b815260040180806020018281038252602f815260200180613df3602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156115f15780601f106115c6576101008083540402835291602001916115f1565b820191906000526020600020905b8154815290600101906020018083116115d457829003601f168201915b50506009549394505050506002600019610100600184161502019091160461161a57905061061d565b8051156116eb5760098160405160200180838054600181600116156101000203166002900480156116825780601f10611660576101008083540402835291820191611682565b820191906000526020600020905b81548152906001019060200180831161166e575b5050825160208401908083835b602083106116ae5780518252601f19909201916020918201910161168f565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405291505061061d565b60096116f6846123c6565b60405160200180838054600181600116156101000203166002900480156117545780601f10611732576101008083540402835291820191611754565b820191906000526020600020905b815481529060010190602001808311611740575b5050825160208401908083835b602083106117805780518252601f199092019160209182019101611761565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b60145481565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60195460ff1681565b6010546000906001600160a01b031633146118275760405162461bcd60e51b815260040161059390613b2f565b601454611834601a6124a1565b106118515760405162461bcd60e51b81526004016105939061394c565b61185b601a6124a5565b6000611867601a6124a1565b60125461ffff16620f42400262ffffff16019050611883613363565b81815261189360006127106124ae565b60808201526118a560006127106124ae565b60a08201526118b760006127106124ae565b60c082019081526000838152600b6020818152604092839020855181558186015160018201805460ff19169115159190911790558386015160028201556060808701516003830155608080880151600484015560a088015160058401559551600683015560e087015180516007840180546001600160a01b0319166001600160a01b0390921691909117905592830151600883015593820151600982015592810151600a8401559092015191015561196f8483612587565b6119818261197c846123c6565b6125a1565b5092915050565b60125461ffff1681565b61199a611ba3565b600a546001600160a01b039081169116146119fc576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116611a415760405162461bcd60e51b8152600401808060200182810382526026815260200180613c2e6026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6060600c6000838152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b82821015611b395760008481526020908190206040805160a0810182526005860290920180546001600160a01b0316835260018082015484860152600282015492840192909252600381015460608401526004015460808301529083529092019101611ad2565b505050509050919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526105fa908490612604565b6000610c246002836126b5565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611bdc82610d80565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610c24826124a1565b611c2a3082611e43565b611c465760405162461bcd60e51b815260040161059390613ade565b6000818152600b6020526040902060019081015460ff16151514611c7c5760405162461bcd60e51b8152600401610593906139a5565b6000818152600b60205260409020600701546001600160a01b03838116911614611cb85760405162461bcd60e51b8152600401610593906139ff565b5050565b600080600080611ccb85612119565b9150915060008111611ce05792509050610989565b6000858152600b602052604090206003810154611cfd90836126c1565b6003820155600b810154611d1190836126c1565b600b820155601854600090611d27908590612075565b6009830154909150611d3990826126c1565b60098301556002820154611d4d90826126c1565b6002830155600e5460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb90611d84908b90879060040161382b565b602060405180830381600087803b158015611d9e57600080fd5b505af1158015611db2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd691906136de565b50919792965091945050505050565b6000610c21838361271b565b611dfc848484611ee7565b611e08848484846127e1565b6114e15760405162461bcd60e51b8152600401808060200182810382526032815260200180613bfc6032913960400191505060405180910390fd5b6000611e4e82611b96565b611e895760405162461bcd60e51b815260040180806020018281038252602c815260200180613c78602c913960400191505060405180910390fd5b6000611e9483610d80565b9050806001600160a01b0316846001600160a01b03161480611ecf5750836001600160a01b0316611ec4846106ce565b6001600160a01b0316145b80611edf5750611edf81856117c3565b949350505050565b826001600160a01b0316611efa82610d80565b6001600160a01b031614611f3f5760405162461bcd60e51b8152600401808060200182810382526029815260200180613dca6029913960400191505060405180910390fd5b6001600160a01b038216611f845760405162461bcd60e51b8152600401808060200182810382526024815260200180613c546024913960400191505060405180910390fd5b611f8f8383836105fa565b611f9a600082611ba7565b6001600160a01b0383166000908152600160205260409020611fbc9082611de5565b506001600160a01b0382166000908152600160205260409020611fdf90826120da565b50611fec60028284612949565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610c2183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061295f565b60008261208457506000610c24565b8282028284828161209157fe5b0414610c215760405162461bcd60e51b8152600401808060200182810382526021815260200180613d516021913960400191505060405180910390fd5b6000610c218383612a01565b6000610c218383612a65565b60008080806120f58686612aaf565b9097909650945050505050565b600061210f848484612b2a565b90505b9392505050565b600080600061212661220d565b6000858152600b602052604081206018546002820154601354949550919361215292610beb9190612bb7565b90506000811161216b57600080945094505050506114f8565b60185460098301546121839190610beb904290612bb7565b945080851115612191578094505b600085116121a857600080945094505050506114f8565b6015546012906001600160a01b0316156121c4575060195460ff165b6121ea81600a0a610beb886121e48860115461207590919063ffffffff16565b90612075565b9450600085116122045760008095509550505050506114f8565b50505050915091565b600e546015546000916001600160a01b039182169116141561223457506305f5e1006106cb565b600f546001600160a01b0316612250575064174876e8006106cb565b600f54604080516315ab88c960e31b815290516001600160a01b0390921691600091839163ad5c464891600480820192602092909190829003018186803b15801561229a57600080fd5b505afa1580156122ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d2919061346c565b600e549091506000906122fb908490670de0b6b3a76400009085906001600160a01b0316612bf9565b6015549091506001600160a01b03166123185792506106cb915050565b60155460009061233e908590670de0b6b3a76400009086906001600160a01b0316612bf9565b60195490915060ff166008141561236a5780826305f5e100028161235e57fe5b049450505050506106cb565b601954600860ff909116101561239d5760195460ff16600803600a0a816305f5e10084028161239557fe5b048161235e57fe5b60195460ff1660071901600a0a816305f5e1008402816123b957fe5b04029450505050506106cb565b6060816123eb57506040805180820190915260018152600360fc1b602082015261061d565b8160005b811561240357600101600a820491506123ef565b60608167ffffffffffffffff8111801561241c57600080fd5b506040519080825280601f01601f191660200182016040528015612447576020820181803683370190505b50859350905060001982015b831561249857600a840660300160f81b8282806001900393508151811061247657fe5b60200101906001600160f81b031916908160001a905350600a84049350612453565b50949350505050565b5490565b80546001019055565b6000805a9050600043423360405160200180826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012060001c816124f557fe5b048345424160405160200180826001600160a01b031660601b81526014019150506040516020818303038152906040528051906020012060001c8161253657fe5b044442010101010101604051602001808281526020019150506040516020818303038152906040528051906020012060001c9050848403858503828161257857fe5b04029003840191505092915050565b611cb8828260405180602001604052806000815250612eed565b6125aa82611b96565b6125e55760405162461bcd60e51b815260040180806020018281038252602c815260200180613d9e602c913960400191505060405180910390fd5b600082815260086020908152604090912082516105fa928401906133af565b6060612659826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f3f9092919063ffffffff16565b8051909150156105fa5780806020019051602081101561267857600080fd5b50516105fa5760405162461bcd60e51b815260040180806020018281038252602a815260200180613e74602a913960400191505060405180910390fd5b6000610c218383612f4e565b600082820183811015610c21576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600081815260018301602052604081205480156127d7578354600019808301919081019060009087908390811061274e57fe5b906000526020600020015490508087600001848154811061276b57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061279b57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610c24565b6000915050610c24565b60006127f5846001600160a01b0316612f66565b61280157506001611edf565b606061290f630a85bd0160e11b612816611ba3565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561287d578181015183820152602001612865565b50505050905090810190601f1680156128aa5780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001613bfc603291396001600160a01b0388169190612f3f565b9050600081806020019051602081101561292857600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b600061210f84846001600160a01b038516612f9f565b600081836129eb5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156129b0578181015183820152602001612998565b50505050905090810190601f1680156129dd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816129f757fe5b0495945050505050565b81546000908210612a435760405162461bcd60e51b8152600401808060200182810382526022815260200180613bda6022913960400191505060405180910390fd5b826000018281548110612a5257fe5b9060005260206000200154905092915050565b6000612a718383612f4e565b612aa757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c24565b506000610c24565b815460009081908310612af35760405162461bcd60e51b8152600401808060200182810382526022815260200180613d2f6022913960400191505060405180910390fd5b6000846000018481548110612b0457fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b60008281526001840160205260408120548281612b885760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156129b0578181015183820152602001612998565b50846000016001820381548110612b9b57fe5b9060005260206000209060020201600101549150509392505050565b6000610c2183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613036565b6000808490506000866001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015612c3a57600080fd5b505afa158015612c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c72919061346c565b90506000816001600160a01b031663e6a4390587876040518363ffffffff1660e01b8152600401612ca4929190613811565b60206040518083038186803b158015612cbc57600080fd5b505afa158015612cd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf4919061346c565b90506001600160a01b038116612d1c5760405162461bcd60e51b815260040161059390613a36565b6040516370a0823160e01b8152869086906000906001600160a01b038416906370a0823190612d4f9087906004016137fd565b60206040518083038186803b158015612d6757600080fd5b505afa158015612d7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d9f919061373a565b90506000826001600160a01b03166370a08231866040518263ffffffff1660e01b8152600401612dcf91906137fd565b60206040518083038186803b158015612de757600080fd5b505afa158015612dfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e1f919061373a565b9050600082118015612e315750600081115b612e4d5760405162461bcd60e51b8152600401610593906139cf565b6000846001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015612e8857600080fd5b505afa158015612e9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ec09190613752565b60ff16600a0a9050612edc81610beb846121e48783858f612075565b9d9c50505050505050505050505050565b612ef78383613090565b612f0460008484846127e1565b6105fa5760405162461bcd60e51b8152600401808060200182810382526032815260200180613bfc6032913960400191505060405180910390fd5b606061210f84846000856131be565b60009081526001919091016020526040902054151590565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611edf575050151592915050565b600082815260018401602052604081205480613004575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055612112565b8285600001600183038154811061301757fe5b9060005260206000209060020201600101819055506000915050612112565b600081848411156130885760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156129b0578181015183820152602001612998565b505050900390565b6001600160a01b0382166130eb576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6130f481611b96565b15613146576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b613152600083836105fa565b6001600160a01b038216600090815260016020526040902061317490826120da565b5061318160028284612949565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60606131c985612f66565b61321a576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106132595780518252601f19909201916020918201910161323a565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146132bb576040519150601f19603f3d011682016040523d82523d6000602084013e6132c0565b606091505b509150915081156132d4579150611edf9050565b8051156132e45780518082602001fd5b60405162461bcd60e51b81526020600482018181528651602484015286518793919283926044019190850190808383600083156129b0578181015183820152602001612998565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6040518061010001604052806000815260200160001515815260200160008152602001600081526020016000815260200160008152602001600081526020016133aa61332b565b905290565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826133e5576000855561342b565b82601f106133fe57805160ff191683800117855561342b565b8280016001018555821561342b579182015b8281111561342b578251825591602001919060010190613410565b5061343792915061343b565b5090565b5b80821115613437576000815560010161343c565b600060208284031215613461578081fd5b8135610c2181613bb3565b60006020828403121561347d578081fd5b8151610c2181613bb3565b60008060006060848603121561349c578182fd5b83356134a781613bb3565b925060208401356134b781613bb3565b929592945050506040919091013590565b600080604083850312156134da578182fd5b82356134e581613bb3565b915060208301356134f581613bb3565b809150509250929050565b60008060008060008060008060006101208a8c03121561351e578485fd5b893561352981613bb3565b985060208a013561353981613bb3565b975060408a013561354981613bb3565b965060608a013561ffff8116811461355f578586fd5b955060808a013561356f81613bb3565b945060a08a0135935060c08a013563ffffffff8116811461358e578384fd5b8093505060e08a013591506101008a013590509295985092959850929598565b60008060006060848603121561349c578283fd5b600080600080608085870312156135d7578384fd5b84356135e281613bb3565b93506020858101356135f381613bb3565b935060408601359250606086013567ffffffffffffffff80821115613616578384fd5b818801915088601f830112613629578384fd5b81358181111561363557fe5b604051601f8201601f191681018501838111828210171561365257fe5b60405281815283820185018b1015613668578586fd5b81858501868301379081019093019390935250939692955090935050565b60008060408385031215613698578182fd5b82356136a381613bb3565b915060208301356134f581613bcb565b600080604083850312156136c5578182fd5b82356136d081613bb3565b946020939093013593505050565b6000602082840312156136ef578081fd5b8151610c2181613bcb565b60006020828403121561370b578081fd5b81356001600160e01b031981168114610c21578182fd5b600060208284031215613733578081fd5b5035919050565b60006020828403121561374b578081fd5b5051919050565b600060208284031215613763578081fd5b815160ff81168114610c21578182fd5b80516001600160a01b03168252602080820151908301526040808201519083015260608082015190830152608090810151910152565b8051825260208101511515602083015260408101516040830152606081015160608301526080810151608083015260a081015160a083015260c081015160c083015260e08101516105fa60e0840182613773565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b8181101561123357613873838551613773565b9284019260a09290920191600101613860565b6020808252825182820181905260009190848201906040850190845b81811015611233576138b58385516137a9565b9284019261018092909201916001016138a2565b901515815260200190565b6000602080835283518082850152825b81811015613900578581018301518582016040015282016138e4565b818111156139115783604083870101525b50601f01601f1916929092016040019392505050565b6020808252600b908201526a1c995c19585d081a5b9a5d60aa1b604082015260600190565b6020808252601290820152710e0e4dec8eac6e840dcdee840cadcdeeaced60731b604082015260600190565b6020808252601390820152722a37b5b2b71030b63932b0b23c903232b0b21760691b604082015260600190565b60208082526010908201526f2a37b5b2b71037379036b4b734b7339760811b604082015260600190565b60208082526016908201527505061697220746f6b656e2062616c616e6365203c20360541b604082015260600190565b60208082526018908201527f546f6b656e206d696e65206973206e6f74206f776e65722e0000000000000000604082015260600190565b6020808252601d908201527f444e465420756e69737761702070616972206e6f74206578697374732e000000604082015260600190565b6020808252601590820152742a37b5b2b71030b63932b0b23c9036b4b734b7339760591b604082015260600190565b60208082526022908201527f70726f6475637420746f74616c20737570706c79206d757374206265203c2031604082015261229b60f11b606082015260800190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b60208082526016908201527531b0b63632b91034b9903737ba103a34329036b0b4b760511b604082015260600190565b6101808101610c2482846137a9565b61ffff91909116815260200190565b90815260200190565b918252602082015260400190565b63ffffffff91909116815260200190565b60ff91909116815260200190565b6001600160a01b0381168114613bc857600080fd5b50565b8015158114613bc857600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e6473536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f774552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732314d657461646174613a2055524920736574206f66206e6f6e6578697374656e7420746f6b656e4552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f7665645361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212201f8c66639218ae299c7a3d86af0862d6feae25cc9f36c204c28db15abf09d35264736f6c63430007040033

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

000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000008506c616e65742d310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004504c543100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002968747470733a2f2f646e66742e696f2f737461746963732f70726f64756374732f6d61696e6e65742f0000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _name (string): Planet-1
Arg [1] : _symbol (string): PLT1
Arg [2] : baseURI (string): https://dnft.io/statics/products/mainnet/

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [2] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [4] : 506c616e65742d31000000000000000000000000000000000000000000000000
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [6] : 504c543100000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000029
Arg [8] : 68747470733a2f2f646e66742e696f2f737461746963732f70726f6475637473
Arg [9] : 2f6d61696e6e65742f0000000000000000000000000000000000000000000000


Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.