false
false
0

Contract Address Details

0xf211cAf6C120f5Cb95b56575367a52A8EAa81780

Contract Name
NFTMulticlassBiddableAuction
Creator
0x7b2823–336a35 at 0x781d36–be2553
Balance
106,727 CLO
Tokens
Fetching tokens...
Transactions
Fetching transactions...
Transfers
Fetching transfers...
Gas Used
Fetching gas used...
Last Balance Update
16289220
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
NFTMulticlassBiddableAuction




Optimization enabled
true
Compiler version
v0.8.12+commit.f00d7308




Optimization runs
200
EVM Version
default




Verified at
2024-09-26T15:33:34.053961Z

Contract source code

// SPDX-License-Identifier: GPL

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

abstract contract Ownable is Context {
    address internal _owner;

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    /*
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }
    */
    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

abstract contract MinterRole is Ownable {
    mapping (address => bool) public minter_role;

    function setMinterRole(address _who, bool _status) public onlyOwner
    {
        minter_role[_who] = _status;
    }

    modifier onlyMinter
    {
        require(minter_role[msg.sender], "Minter role required");
        _;
    }
}

//https://github.com/willitscale/solidity-util/blob/000a42d4d7c1491cde4381c29d4b775fa7e99aac/lib/Strings.sol#L317-L336

/**
 * Strings Library
 * 
 * In summary this is a simple library of string functions which make simple 
 * string operations less tedious in solidity.
 * 
 * Please be aware these functions can be quite gas heavy so use them only when
 * necessary not to clog the blockchain with expensive transactions.
 * 
 * @author James Lockhart <[email protected]>
 */
library Strings {

    /**
     * Concat (High gas cost)
     * 
     * Appends two strings together and returns a new value
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string which will be the concatenated
     *              prefix
     * @param _value The value to be the concatenated suffix
     * @return string The resulting string from combinging the base and value
     */
    function concat(string memory _base, string memory _value)
        internal
        pure
        returns (string memory) {
        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        assert(_valueBytes.length > 0);

        string memory _tmpValue = new string(_baseBytes.length +
            _valueBytes.length);
        bytes memory _newValue = bytes(_tmpValue);

        uint i;
        uint j;

        for (i = 0; i < _baseBytes.length; i++) {
            _newValue[j++] = _baseBytes[i];
        }

        for (i = 0; i < _valueBytes.length; i++) {
            _newValue[j++] = _valueBytes[i];
        }

        return string(_newValue);
    }

    /**
     * Index Of
     *
     * Locates and returns the position of a character within a string
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string acting as the haystack to be
     *              searched
     * @param _value The needle to search for, at present this is currently
     *               limited to one character
     * @return int The position of the needle starting from 0 and returning -1
     *             in the case of no matches found
     */
    function indexOf(string memory _base, string memory _value)
        internal
        pure
        returns (int) {
        return _indexOf(_base, _value, 0);
    }

    /**
     * Index Of
     *
     * Locates and returns the position of a character within a string starting
     * from a defined offset
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string acting as the haystack to be
     *              searched
     * @param _value The needle to search for, at present this is currently
     *               limited to one character
     * @param _offset The starting point to start searching from which can start
     *                from 0, but must not exceed the length of the string
     * @return int The position of the needle starting from 0 and returning -1
     *             in the case of no matches found
     */
    function _indexOf(string memory _base, string memory _value, uint _offset)
        internal
        pure
        returns (int) {
        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        assert(_valueBytes.length == 1);

        for (uint i = _offset; i < _baseBytes.length; i++) {
            if (_baseBytes[i] == _valueBytes[0]) {
                return int(i);
            }
        }

        return -1;
    }

    /**
     * Length
     * 
     * Returns the length of the specified string
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string to be measured
     * @return uint The length of the passed string
     */
    function length(string memory _base)
        internal
        pure
        returns (uint) {
        bytes memory _baseBytes = bytes(_base);
        return _baseBytes.length;
    }

    /**
     * Sub String
     * 
     * Extracts the beginning part of a string based on the desired length
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string that will be used for 
     *              extracting the sub string from
     * @param _length The length of the sub string to be extracted from the base
     * @return string The extracted sub string
     */
    function substring(string memory _base, int _length)
        internal
        pure
        returns (string memory) {
        return _substring(_base, _length, 0);
    }

    /**
     * Sub String
     * 
     * Extracts the part of a string based on the desired length and offset. The
     * offset and length must not exceed the lenth of the base string.
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string that will be used for 
     *              extracting the sub string from
     * @param _length The length of the sub string to be extracted from the base
     * @param _offset The starting point to extract the sub string from
     * @return string The extracted sub string
     */
    function _substring(string memory _base, int _length, int _offset)
        internal
        pure
        returns (string memory) {
        bytes memory _baseBytes = bytes(_base);

        assert(uint(_offset + _length) <= _baseBytes.length);

        string memory _tmp = new string(uint(_length));
        bytes memory _tmpBytes = bytes(_tmp);

        uint j = 0;
        for (uint i = uint(_offset); i < uint(_offset + _length); i++) {
            _tmpBytes[j++] = _baseBytes[i];
        }

        return string(_tmpBytes);
    }
    
    function split(string memory _base, string memory _value)
        internal
        pure
        returns (string[] memory splitArr) {
        bytes memory _baseBytes = bytes(_base);

        uint _offset = 0;
        uint _splitsCount = 1;
        while (_offset < _baseBytes.length - 1) {
            int _limit = _indexOf(_base, _value, _offset);
            if (_limit == -1)
                break;
            else {
                _splitsCount++;
                _offset = uint(_limit) + 1;
            }
        }

        splitArr = new string[](_splitsCount);

        _offset = 0;
        _splitsCount = 0;
        while (_offset < _baseBytes.length - 1) {

            int _limit = _indexOf(_base, _value, _offset);
            if (_limit == - 1) {
                _limit = int(_baseBytes.length);
            }

            string memory _tmp = new string(uint(_limit) - _offset);
            bytes memory _tmpBytes = bytes(_tmp);

            uint j = 0;
            for (uint i = _offset; i < uint(_limit); i++) {
                _tmpBytes[j++] = _baseBytes[i];
            }
            _offset = uint(_limit) + 1;
            splitArr[_splitsCount++] = string(_tmpBytes);
        }
        return splitArr;
    }

    /**
     * Compare To
     * 
     * Compares the characters of two strings, to ensure that they have an 
     * identical footprint
     * 
     * @param _base When being used for a data type this is the extended object
     *               otherwise this is the string base to compare against
     * @param _value The string the base is being compared to
     * @return bool Simply notates if the two string have an equivalent
     */
    function compareTo(string memory _base, string memory _value)
        internal
        pure
        returns (bool) {
        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        if (_baseBytes.length != _valueBytes.length) {
            return false;
        }

        for (uint i = 0; i < _baseBytes.length; i++) {
            if (_baseBytes[i] != _valueBytes[i]) {
                return false;
            }
        }

        return true;
    }

    /**
     * Compare To Ignore Case (High gas cost)
     * 
     * Compares the characters of two strings, converting them to the same case
     * where applicable to alphabetic characters to distinguish if the values
     * match.
     * 
     * @param _base When being used for a data type this is the extended object
     *               otherwise this is the string base to compare against
     * @param _value The string the base is being compared to
     * @return bool Simply notates if the two string have an equivalent value
     *              discarding case
     */
    function compareToIgnoreCase(string memory _base, string memory _value)
        internal
        pure
        returns (bool) {
        bytes memory _baseBytes = bytes(_base);
        bytes memory _valueBytes = bytes(_value);

        if (_baseBytes.length != _valueBytes.length) {
            return false;
        }

        for (uint i = 0; i < _baseBytes.length; i++) {
            if (_baseBytes[i] != _valueBytes[i] &&
            _upper(_baseBytes[i]) != _upper(_valueBytes[i])) {
                return false;
            }
        }

        return true;
    }

    /**
     * Upper
     * 
     * Converts all the values of a string to their corresponding upper case
     * value.
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string base to convert to upper case
     * @return string 
     */
    function upper(string memory _base)
        internal
        pure
        returns (string memory) {
        bytes memory _baseBytes = bytes(_base);
        for (uint i = 0; i < _baseBytes.length; i++) {
            _baseBytes[i] = _upper(_baseBytes[i]);
        }
        return string(_baseBytes);
    }

    /**
     * Lower
     * 
     * Converts all the values of a string to their corresponding lower case
     * value.
     * 
     * @param _base When being used for a data type this is the extended object
     *              otherwise this is the string base to convert to lower case
     * @return string 
     */
    function lower(string memory _base)
        internal
        pure
        returns (string memory) {
        bytes memory _baseBytes = bytes(_base);
        for (uint i = 0; i < _baseBytes.length; i++) {
            _baseBytes[i] = _lower(_baseBytes[i]);
        }
        return string(_baseBytes);
    }

    /**
     * Upper
     * 
     * Convert an alphabetic character to upper case and return the original
     * value when not alphabetic
     * 
     * @param _b1 The byte to be converted to upper case
     * @return bytes1 The converted value if the passed value was alphabetic
     *                and in a lower case otherwise returns the original value
     */
    function _upper(bytes1 _b1)
        private
        pure
        returns (bytes1) {

        if (_b1 >= 0x61 && _b1 <= 0x7A) {
            return bytes1(uint8(_b1) - 32);
        }

        return _b1;
    }

    /**
     * Lower
     * 
     * Convert an alphabetic character to lower case and return the original
     * value when not alphabetic
     * 
     * @param _b1 The byte to be converted to lower case
     * @return bytes1 The converted value if the passed value was alphabetic
     *                and in a upper case otherwise returns the original value
     */
    function _lower(bytes1 _b1)
        private
        pure
        returns (bytes1) {

        if (_b1 >= 0x41 && _b1 <= 0x5A) {
            return bytes1(uint8(_b1) + 32);
        }

        return _b1;
    }
}

library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract's constructor, its address will be reported as
     * not containing a contract.
     *
     * > It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }
}

interface ICallistoNFT {

    event NewBid       (uint256 indexed tokenID, uint256 indexed bidAmount, bytes bidData);
    event TokenTrade   (uint256 indexed tokenID, address indexed new_owner, address indexed previous_owner, uint256 priceInWEI);
    event Transfer     (address indexed from, address indexed to, uint256 indexed tokenId);
    event TransferData (bytes data);
    
    struct Properties {
        
        // In this example properties of the given NFT are stored
        // in a dynamically sized array of strings
        // properties can be re-defined for any specific info
        // that a particular NFT is intended to store.
        
        /* Properties could look like this:
        bytes   property1;
        bytes   property2;
        address property3;
        */
        
        string[] properties;
    }
    
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function standard() external view returns (string memory);
    function balanceOf(address _who) external view returns (uint256);
    function ownerOf(uint256 _tokenId) external view returns (address);
    function transfer(address _to, uint256 _tokenId, bytes calldata _data) external returns (bool);
    function silentTransfer(address _to, uint256 _tokenId) external returns (bool);
    
    function priceOf(uint256 _tokenId) external view returns (uint256);
    function bidOf(uint256 _tokenId) external view returns (uint256 price, address payable bidder, uint256 timestamp);
    function getTokenProperties(uint256 _tokenId) external view returns (Properties memory);
    
    function setBid(uint256 _tokenId, bytes calldata _data) payable external; // bid amount is defined by msg.value
    function setPrice(uint256 _tokenId, uint256 _amountInWEI, bytes calldata _data) external;
    function withdrawBid(uint256 _tokenId) external returns (bool);

    function getUserContent(uint256 _tokenId) external view returns (string memory _content);
    function setUserContent(uint256 _tokenId, string calldata _content) external returns (bool);
}

abstract contract NFTReceiver {
    function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external virtual returns(bytes4);
}

// ExtendedNFT is a version of the CallistoNFT standard token
// that implements a set of function for NFT content management
contract ExtendedNFT is ICallistoNFT, ReentrancyGuard {
    using Strings for string;
    using Address for address;
    
    mapping (uint256 => Properties) private _tokenProperties;
    mapping (uint32 => Fee)         public feeLevels; // level # => (fee receiver, fee percentage)
    
    uint256 public bidLock = 1 days; // Time required for a bid to become withdrawable.
    
    struct Bid {
        address payable bidder;
        uint256 amountInWEI;
        uint256 timestamp;
    }
    
    struct Fee {
        address payable feeReceiver;
        uint256 feePercentage; // Will be divided by 100000 during calculations
                               // feePercentage of 100 means 0.1% fee
                               // feePercentage of 2500 means 2.5% fee
    }
    
    mapping (uint256 => uint256) private _asks; // tokenID => price of this token (in WEI)
    mapping (uint256 => Bid)     private _bids; // tokenID => price of this token (in WEI)
    mapping (uint256 => uint32)  internal _tokenFeeLevels; // tokenID => level ID / 0 by default

    uint256 public next_mint_id;

    // Token name
    string internal _name;

    // Token symbol
    string internal _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) internal _owners;

    // Mapping owner address to token count
    mapping(address => uint256) internal _balances;
    

    // Reward is always paid based on BID
    modifier checkTrade(uint256 _tokenId, bytes calldata _data)
    {
        _;
        (uint256 _bid, address payable _bidder,) = bidOf(_tokenId);
        if(priceOf(_tokenId) > 0 && priceOf(_tokenId) <= _bid)
        {
            uint256 _reward = _bid - _claimFee(_bid, _tokenId);

            emit TokenTrade(_tokenId, _bidder, ownerOf(_tokenId), _reward);

            payable(ownerOf(_tokenId)).transfer(_reward);

            //bytes calldata _empty;
            delete _bids[_tokenId];
            delete _asks[_tokenId];
            _transfer(ownerOf(_tokenId), _bidder, _tokenId, _data);
        }
    }
    
    function standard() public view virtual override returns (string memory)
    {
        return "CallistoNFT";
    }

    function mint() internal returns (uint256 _mintedId)
    {
        _safeMint(msg.sender, next_mint_id);
        _mintedId = next_mint_id;
        next_mint_id++;

        _configureNFT(_mintedId);
    }
    
    function priceOf(uint256 _tokenId) public view virtual override returns (uint256)
    {
        address owner = _owners[_tokenId];
        require(owner != address(0), "NFT: owner query for nonexistent token");
        return _asks[_tokenId];
    }
    
    function bidOf(uint256 _tokenId) public view virtual override returns (uint256 price, address payable bidder, uint256 timestamp)
    {
        address owner = _owners[_tokenId];
        require(owner != address(0), "NFT: owner query for nonexistent token");
        return (_bids[_tokenId].amountInWEI, _bids[_tokenId].bidder, _bids[_tokenId].timestamp);
    }
    
    function getTokenProperties(uint256 _tokenId) public view virtual override returns (Properties memory)
    {
        return _tokenProperties[_tokenId];
    }

    function getTokenProperty(uint256 _tokenId, uint256 _propertyId)  public view virtual returns (string memory)
    {
        return _tokenProperties[_tokenId].properties[_propertyId];
    }

    function getUserContent(uint256 _tokenId) public view virtual override returns (string memory _content)
    {
        return (_tokenProperties[_tokenId].properties[0]);
    }

    function setUserContent(uint256 _tokenId, string calldata _content) public virtual override returns (bool success)
    {
        require(msg.sender == ownerOf(_tokenId), "NFT: only owner can change NFT content");
        _tokenProperties[_tokenId].properties[0] = _content;
        return true;
    }

    function _addPropertyWithContent(uint256 _tokenId, string calldata _content) internal
    {
        // Check permission criteria

        _tokenProperties[_tokenId].properties.push(_content);
    }

    function _modifyProperty(uint256 _tokenId, uint256 _propertyId, string calldata _content) internal
    {
        _tokenProperties[_tokenId].properties[_propertyId] = _content;
    }

    function _appendProperty(uint256 _tokenId, uint256 _propertyId, string calldata _content) internal
    {
        _tokenProperties[_tokenId].properties[_propertyId] = _tokenProperties[_tokenId].properties[_propertyId].concat(_content);
    }
    
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "NFT: balance query for the zero address");
        return _balances[owner];
    }
    
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "NFT: owner query for nonexistent token");
        return owner;
    }
    
    /* 
        Price == 0, "NFT not on sale"
        Price > 0, "NFT on sale"
    */
    function setPrice(uint256 _tokenId, uint256 _amountInWEI, bytes calldata _data) checkTrade(_tokenId, _data) public virtual override nonReentrant {
        require(ownerOf(_tokenId) == msg.sender, "Setting asks is only allowed for owned NFTs!");
        _asks[_tokenId] = _amountInWEI;
    }
    
    function setBid(uint256 _tokenId, bytes calldata _data) payable checkTrade(_tokenId, _data) public virtual override nonReentrant
    {
        (uint256 _previousBid, address payable _previousBidder, ) = bidOf(_tokenId);
        require(msg.value > _previousBid, "New bid must exceed the existing one");

        uint256 _bid;
        
        // Return previous bid if the current one exceeds it.
        if(_previousBid != 0)
        {
            _previousBidder.transfer(_previousBid);
        }
        // Refund overpaid amount.
        if (priceOf(_tokenId) < msg.value)
        {
            _bid = priceOf(_tokenId);
        }
        else
        {
            _bid = msg.value;
        }
        _bids[_tokenId].amountInWEI = _bid;
        _bids[_tokenId].bidder      = payable(msg.sender);
        _bids[_tokenId].timestamp   = block.timestamp;

        emit NewBid(_tokenId, _bid, _data);
        
        // Send back overpaid amount.
        // WARHNING: Creates possibility for reentrancy.
        if (priceOf(_tokenId) < msg.value)
        {
            payable(msg.sender).transfer(msg.value - priceOf(_tokenId));
        }
    }
    
    function withdrawBid(uint256 _tokenId) public virtual override nonReentrant returns (bool) 
    {
        (uint256 _bid, address payable _bidder, uint256 _timestamp) = bidOf(_tokenId);
        require(msg.sender == _bidder, "Can not withdraw someone elses bid");
        require(block.timestamp > _timestamp + bidLock, "Bid is time-locked");
        
        _bidder.transfer(_bid);
        delete _bids[_tokenId];
        return true;
    }
    
    function name() public view virtual override returns (string memory) {
        return _name;
    }
    
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }
    
    function transfer(address _to, uint256 _tokenId, bytes calldata _data) public override returns (bool)
    {
        _transfer(msg.sender, _to, _tokenId, _data);
        emit TransferData(_data);
        return true;
    }
    
    function silentTransfer(address _to, uint256 _tokenId) public override returns (bool)
    {
        require(ExtendedNFT.ownerOf(_tokenId) == msg.sender, "NFT: transfer of token that is not own");
        require(_to != address(0), "NFT: transfer to the zero address");
        
        _asks[_tokenId] = 0; // Zero out price on transfer
        
        // When a user transfers the NFT to another user
        // it does not automatically mean that the new owner
        // would like to sell this NFT at a price
        // specified by the previous owner.
        
        // However bids persist regardless of token transfers
        // because we assume that the bidder still wants to buy the NFT
        // no matter from whom.

        _beforeTokenTransfer(msg.sender, _to, _tokenId);

        _balances[msg.sender] -= 1;
        _balances[_to] += 1;
        _owners[_tokenId] = _to;

        emit Transfer(msg.sender, _to, _tokenId);
        return true;
    }
    
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }
    
    function _claimFee(uint256 _amountFrom, uint256 _tokenId) internal returns (uint256)
    {
        uint32 _level          = _tokenFeeLevels[_tokenId];
        address _feeReceiver   = feeLevels[_level].feeReceiver;
        uint256 _feePercentage = feeLevels[_level].feePercentage;
        
        uint256 _feeAmount = _amountFrom * _feePercentage / 100000;
        payable(_feeReceiver).transfer(_feeAmount);
        return _feeAmount;        
    }
    
    function _safeMint(
        address to,
        uint256 tokenId
    ) internal virtual {
        _mint(to, tokenId);
    }
    
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "NFT: mint to the zero address");
        require(!_exists(tokenId), "NFT: token already minted");

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

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }
    
    function _burn(uint256 tokenId) internal virtual {
        address owner = ExtendedNFT.ownerOf(tokenId);

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

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }
    
    function _transfer(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) internal virtual {
        require(ExtendedNFT.ownerOf(tokenId) == from, "NFT: transfer of token that is not own");
        require(to != address(0), "NFT: transfer to the zero address");
        
        _asks[tokenId] = 0; // Zero out price on transfer
        
        // When a user transfers the NFT to another user
        // it does not automatically mean that the new owner
        // would like to sell this NFT at a price
        // specified by the previous owner.
        
        // However bids persist regardless of token transfers
        // because we assume that the bidder still wants to buy the NFT
        // no matter from whom.

        _beforeTokenTransfer(from, to, tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        if(to.isContract())
        {
            NFTReceiver(to).onERC721Received(msg.sender, from, tokenId, data);
        }

        emit Transfer(from, to, tokenId);
    }
    
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    function _configureNFT(uint256 _tokenId) internal
    {
        if(_tokenProperties[_tokenId].properties.length == 0)
        {
            _tokenProperties[_tokenId].properties.push("");
        }
    }
}

interface IClassifiedNFT is ICallistoNFT {
    function setClassForTokenID(uint256 _tokenID, uint256 _tokenClass) external;
    function addNewTokenClass(uint32 _feeLevel, string memory _property) external;
    function addTokenClassProperties(uint256 _propertiesCount, uint256 classId) external;
    function modifyClassProperty(uint256 _classID, uint256 _propertyID, string memory _content) external;
    function getClassProperty(uint256 _classID, uint256 _propertyID) external view returns (string memory);
    function addClassProperty(uint256 _classID) external;
    function getClassProperties(uint256 _classID) external view returns (string[] memory);
    function getClassForTokenID(uint256 _tokenID) external view returns (uint256);
    function getClassPropertiesForTokenID(uint256 _tokenID) external view returns (string[] memory);
    function getClassPropertyForTokenID(uint256 _tokenID, uint256 _propertyID) external view returns (string memory);
    function mintWithClass(uint256 classId)  external  returns (uint256 _newTokenID);
    function appendClassProperty(uint256 _classID, uint256 _propertyID, string memory _content) external;
}

abstract contract ClassifiedNFT is MinterRole, ExtendedNFT, IClassifiedNFT {
    using Strings for string;

    mapping (uint256 => string[]) public class_properties;
    mapping (uint256 => uint32)   public class_feeLevel;
    mapping (uint256 => uint256)  public token_classes;

    uint256 public nextClassIndex = 0;

    modifier onlyExistingClasses(uint256 classId)
    {
        require(classId < nextClassIndex, "Queried class does not exist");
        _;
    }

    function setClassForTokenID(uint256 _tokenID, uint256 _tokenClass) public onlyOwner override
    {
        token_classes[_tokenID] = _tokenClass;
    }

    function addNewTokenClass(uint32 _feeLevel, string memory _property) public onlyOwner override
    {
        class_properties[nextClassIndex].push(_property);
        class_feeLevel[nextClassIndex] = _feeLevel; // Configures who will receive fees from this class of NFTs
                                                    // Zero sets fees to default address and percentage.
        nextClassIndex++;
    }

    function addTokenClassProperties(uint256 _propertiesCount, uint256 classId) public onlyOwner override
    {
        for (uint i = 0; i < _propertiesCount; i++)
        {
            class_properties[classId].push("");
        }
    }

    function modifyClassProperty(uint256 _classID, uint256 _propertyID, string memory _content) public onlyOwner onlyExistingClasses(_classID) override
    {
        class_properties[_classID][_propertyID] = _content;
    }

    function getClassProperty(uint256 _classID, uint256 _propertyID) public view onlyExistingClasses(_classID) override returns (string memory)
    {
        return class_properties[_classID][_propertyID];
    }

    function addClassProperty(uint256 _classID) public onlyOwner onlyExistingClasses(_classID) override
    {
        class_properties[_classID].push("");
    }

    function getClassProperties(uint256 _classID) public view onlyExistingClasses(_classID) override returns (string[] memory)
    {
        return class_properties[_classID];
    }

    function getClassForTokenID(uint256 _tokenID) public view onlyExistingClasses(token_classes[_tokenID]) override returns (uint256)
    {
        return token_classes[_tokenID];
    }

    function getClassPropertiesForTokenID(uint256 _tokenID) public view onlyExistingClasses(token_classes[_tokenID]) override returns (string[] memory)
    {
        return class_properties[token_classes[_tokenID]];
    }

    function getClassPropertyForTokenID(uint256 _tokenID, uint256 _propertyID) public view onlyExistingClasses(token_classes[_tokenID]) override returns (string memory)
    {
        return class_properties[token_classes[_tokenID]][_propertyID];
    }
    
    function mintWithClass(uint256 classId)  public onlyExistingClasses(classId) onlyMinter override returns (uint256 _newTokenID)
    {
        //_mint(to, tokenId);
        _newTokenID = mint();
        token_classes[_newTokenID] = classId;
        _tokenFeeLevels[_newTokenID] = class_feeLevel[classId];
    }

    function appendClassProperty(uint256 _classID, uint256 _propertyID, string memory _content) public onlyOwner onlyExistingClasses(_classID) override
    {
        class_properties[_classID][_propertyID] = class_properties[_classID][_propertyID].concat(_content);
    }
}

contract ArtefinNFT is ExtendedNFT, ClassifiedNFT {

    function initialize(string memory name_, string memory symbol_, uint256 _defaultFee) external {
        require(_owner == address(0), "Already initialized");
        _owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
        bidLock = 1 days;
        _name   = name_;
        _symbol = symbol_;
        feeLevels[0].feeReceiver   = payable(msg.sender);
        feeLevels[0].feePercentage = _defaultFee;
    }

    function setFeeLevel(uint32 _levelIndex, address _feeReceiver, uint256 _feePercentage) public onlyOwner
    {
        feeLevels[_levelIndex].feeReceiver = payable(_feeReceiver);
        feeLevels[_levelIndex].feePercentage = _feePercentage;
    }

    function setFeeLevelForToken(uint256 _tokenId, uint32 _feeLevel) public onlyOwner
    {
        _tokenFeeLevels[_tokenId] = _feeLevel;
    }

    function modifyClassFeeLevel(uint256 _classId, uint32 _feeLevel) public onlyOwner
    {
        class_feeLevel[_classId] = _feeLevel;
    }

    function addPropertyWithContent(uint256 _tokenId, string calldata _content) public /* onlyOwner or Minter */
    {
        require(owner() == msg.sender || minter_role[msg.sender], "Ownable: caller is not the owner");
        _addPropertyWithContent( _tokenId, _content);
    }

/*
    function addPropertyWithContentForMinter(uint256 _tokenId, string calldata _content) public onlyMinter
    {
        _addPropertyWithContent( _tokenId, _content);
    }
    */

    function modifyProperty(uint256 _tokenId, uint256 _propertyId, string calldata _content) public onlyOwner
    {
        _modifyProperty(_tokenId, _propertyId, _content);
    }

    function appendProperty(uint256 _tokenId, uint256 _propertyId, string calldata _content) public onlyOwner
    {
        _appendProperty(_tokenId, _propertyId, _content);
    }

    function migrationMint (address to, uint256 _tokenId, uint256 _classID, string calldata _serialNumber) public onlyMinter {
        require(to != address(0), "NFT: mint to the zero address");
        require(!_exists(_tokenId), "NFT: token already minted");

        _beforeTokenTransfer(address(0), to, _tokenId);
        _configureNFT(_tokenId);

        token_classes[_tokenId] = _classID;
        _tokenFeeLevels[_tokenId] = class_feeLevel[_classID];
        _addPropertyWithContent(_tokenId, _serialNumber);
        _balances[to] += 1;
        _owners[_tokenId] = to;

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

    function setNextMintID (uint256 _next_mint_id) public onlyOwner {
        require(_next_mint_id > next_mint_id, "next_mint_id must be higher than last token ID");
        next_mint_id = _next_mint_id;
    }
}

contract ActivatedByOwner is Ownable {
    bool public active = true;

    function setActive(bool _active) public  onlyOwner
    {
        active = _active;
    }

    modifier onlyActive
    {
        require(active, "This contract is deactivated by owner");
        _;
    }
}

contract NFTMulticlassLinearAuction is ActivatedByOwner {

    event AuctionCreated(uint256 indexed tokenClassAuctionID, uint256 timestamp);
    event TokenSold(uint256 indexed tokenID, uint256 indexed tokenClassID, address indexed buyer);
    event NFTContractSet(address indexed newNFTContract, address indexed oldNFTContract);
    event RevenueWithdrawal(uint256 amount);
    

    address public nft_contract;

    struct NFTAuctionClass
    {
        uint256 max_supply;
        uint256 amount_sold;
        uint256 start_timestamp;
        uint256 duration;
        uint256 priceInWei;
        string[] configuratin_properties;
    }

    mapping (uint256 => NFTAuctionClass) public auctions; // Mapping from classID (at NFT contract) to set of variables
                                                          //  defining the auction for this token class.

    address payable public revenue = payable(0x01000B5fE61411C466b70631d7fF070187179Bbf); // This address has the rights to withdraw funds from the auction.

    constructor()
    {
        _owner = msg.sender;
    }

    function createNFTAuction(
        uint256 _classID, 
        uint256 _max_supply, 
        uint256 _start_timestamp, 
        uint256 _duration, 
        uint256 _priceInWEI,
        uint256 _already_sold 
        ) public onlyOwner
    {
        auctions[_classID].max_supply      = _max_supply;
        auctions[_classID].amount_sold     = _already_sold; 
        auctions[_classID].start_timestamp = _start_timestamp;
        auctions[_classID].duration        = _duration;
        auctions[_classID].priceInWei      = _priceInWEI;

        emit AuctionCreated(_classID, block.timestamp);
    }

    function setRevenueAddress(address payable _revenue_address) public  onlyOwner {
        revenue = _revenue_address;
    }


    function setNFTContract(address _nftContract) public onlyOwner
    {
        emit NFTContractSet(_nftContract, nft_contract);

        nft_contract = _nftContract;
    }

    function buyNFT(uint256 _classID) public payable onlyActive
    {
        // WARNING!
        // This function does not refund overpaid amount at the moment.
        // TODO

        require(msg.value >= auctions[_classID].priceInWei, "Insufficient funds");
        require(auctions[_classID].amount_sold < auctions[_classID].max_supply, "This auction has already sold all allocated NFTs");
        require(block.timestamp < auctions[_classID].start_timestamp + auctions[_classID].duration, "This auction already expired");
        require(block.timestamp > auctions[_classID].start_timestamp, "This auction is not yet started");
        require(auctions[_classID].priceInWei != 0, "Min price is not configured by the owner");

        uint256 _mintedId = ClassifiedNFT(nft_contract).mintWithClass(_classID);
        auctions[_classID].amount_sold++;
        configureNFT(_mintedId, _classID);

        ClassifiedNFT(nft_contract).transfer(msg.sender, _mintedId, "");

        emit TokenSold(_mintedId, _classID, msg.sender);
    }

    function configureNFT(uint256 _tokenId, uint256 _classId) internal
    {
        //Add Serial Number to the created Token
        uint256 tokenSerialNumber = auctions[_classId].amount_sold;
        ArtefinNFT(nft_contract).addPropertyWithContent(_tokenId, toString(tokenSerialNumber));
    }

    function withdrawRevenue() public onlyOwner
    {
        require(msg.sender == revenue, "This action requires revenue permission");

        emit RevenueWithdrawal(address(this).balance);

        revenue.transfer(address(this).balance);
    }

    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol#L15-L35

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

contract NFTMulticlassBiddableAuction is ActivatedByOwner {

    event AuctionCreated(uint256 indexed tokenClassAuctionID, uint256 timestamp);
    //event TokenSold(uint256 indexed tokenID, uint256 indexed tokenClassID, address indexed buyer);
    event NFTContractSet(address indexed newNFTContract, address indexed oldNFTContract);
    event RevenueWithdrawal(uint256 amount);
    event RoundEnd(uint256 indexed tokenClassAuctionID, address indexed winner, uint256 indexed acquiredTokenID);
    event NewRound(uint256 indexed tokenClassAuctionID, uint256 indexed startTimestamp, uint256 indexed endTimestamp);

    address public nft_contract;

    struct NFTBiddableAuctionClass
    {
        uint256 max_supply;
        uint256 amount_sold;
        uint256 start_timestamp;
        uint256 duration;
        uint256 min_priceInWei;
        uint256 highest_bid;
        address winner;
        string[] configuratin_properties;
    }

    struct NFTBidClass
    {
        uint256 classID;
        address owner;
        uint256 bid_amount;
        uint256 bid_timestamp;
    }

    mapping (uint256 => NFTBidClass) public bids; // Mapping all bids
    uint256 public nextBidIndex = 0; //Bids index

    mapping (uint256 => NFTBiddableAuctionClass) public auctions; // Mapping from classID (at NFT contract) to set of variables
                                                                  //  defining the auction for this token class.
    uint256 public revenue_amount; // total amount of revenue

    address payable public revenue = payable(0x01000B5fE61411C466b70631d7fF070187179Bbf); // This address has the rights to withdraw funds from the auction.

    constructor()
    {
        _owner = msg.sender;
    }

    function createNFTAuction(
        uint256 _classID, 
        uint256 _max_supply, 
        uint256 _start_timestamp, 
        uint256 _duration, 
        uint256 _minPriceInWEI,
        uint256 _already_sold 
    ) public onlyOwner
    {
        auctions[_classID].max_supply      = _max_supply;
        auctions[_classID].amount_sold     = _already_sold;
        auctions[_classID].start_timestamp = _start_timestamp;
        auctions[_classID].duration        = _duration;
        auctions[_classID].min_priceInWei  = _minPriceInWEI;
        auctions[_classID].winner          = owner();

        emit AuctionCreated(_classID, block.timestamp);
    }

    function setRevenueAddress(address payable _revenue_address) public onlyOwner {
        revenue = _revenue_address;
    }

    function setNFTContract(address _nftContract) public onlyOwner
    {
        emit NFTContractSet(nft_contract, _nftContract);

        nft_contract = _nftContract;
    }
    
    function bidOnNFT(uint256 _classID) public payable onlyActive
    {

        uint256 _bid = msg.value;

        require(_bid >= auctions[_classID].min_priceInWei, "Min price criteria is not met");
        require(auctions[_classID].start_timestamp < block.timestamp, "Auction did not start yet");

        if(auctions[_classID].start_timestamp + auctions[_classID].duration < block.timestamp)
        {
            endRound(_classID);
            payable(msg.sender).transfer(_bid - auctions[_classID].min_priceInWei);
            _bid = auctions[_classID].min_priceInWei;
        }

        require(auctions[_classID].max_supply > auctions[_classID].amount_sold, "All NFTs of this artwork are already sold");

        require(
            _bid >= auctions[_classID].highest_bid + auctions[_classID].highest_bid/20 && 
            _bid >= auctions[_classID].highest_bid + 1e18,
            "Does not outbid current winner by 5%"
        );
        require(auctions[_classID].min_priceInWei != 0, "Min price is not configured by the owner");

        payable(auctions[_classID].winner).transfer(auctions[_classID].highest_bid);

        auctions[_classID].winner      = msg.sender;
        auctions[_classID].highest_bid = _bid;

        bids[nextBidIndex].classID = _classID;
        bids[nextBidIndex].owner = msg.sender;
        bids[nextBidIndex].bid_amount = _bid;
        bids[nextBidIndex].bid_timestamp = block.timestamp;

        nextBidIndex++;

    }

    function resetRound(uint256 _classID) internal
    {
        auctions[_classID].winner          = owner();
        auctions[_classID].highest_bid     = 0;
        auctions[_classID].start_timestamp = block.timestamp + 600;

        emit NewRound(_classID, auctions[_classID].start_timestamp, auctions[_classID].start_timestamp + auctions[_classID].duration);
    }

    function endRound(uint256 _classID) public
    {
        require(block.timestamp > auctions[_classID].start_timestamp + auctions[_classID].duration, "Auction is still in progress");
        require(auctions[_classID].max_supply > auctions[_classID].amount_sold, "All NFTs of this artwork are already sold");
        auctions[_classID].amount_sold++;

        uint256 _mintedId = ClassifiedNFT(nft_contract).mintWithClass(_classID);
        configureNFT(_mintedId, _classID);

        ClassifiedNFT(nft_contract).transfer(auctions[_classID].winner, _mintedId, "");

        emit RoundEnd(_classID, auctions[_classID].winner, _mintedId);
        revenue_amount += auctions[_classID].highest_bid;

        if(auctions[_classID].amount_sold != auctions[_classID].max_supply)
        {
            resetRound(_classID);
        }
    }

    function configureNFT(uint256 _tokenId, uint256 _classId) internal
    {
        //Add Serial Number to the created Token
        uint256 tokenSerialNumber = auctions[_classId].amount_sold;
        ArtefinNFT(nft_contract).addPropertyWithContent(_tokenId, toString(tokenSerialNumber));
    }

    function withdrawRevenue() public onlyOwner
    {
        require(msg.sender == revenue, "This action requires revenue permission");

        uint256 toPay = revenue_amount;

        revenue_amount = 0;

        revenue.transfer(toPay);

        emit RevenueWithdrawal(toPay);
    }

    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Strings.sol#L15-L35

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

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"AuctionCreated","inputs":[{"type":"uint256","name":"tokenClassAuctionID","internalType":"uint256","indexed":true},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NFTContractSet","inputs":[{"type":"address","name":"newNFTContract","internalType":"address","indexed":true},{"type":"address","name":"oldNFTContract","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"NewRound","inputs":[{"type":"uint256","name":"tokenClassAuctionID","internalType":"uint256","indexed":true},{"type":"uint256","name":"startTimestamp","internalType":"uint256","indexed":true},{"type":"uint256","name":"endTimestamp","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RevenueWithdrawal","inputs":[{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoundEnd","inputs":[{"type":"uint256","name":"tokenClassAuctionID","internalType":"uint256","indexed":true},{"type":"address","name":"winner","internalType":"address","indexed":true},{"type":"uint256","name":"acquiredTokenID","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"active","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"max_supply","internalType":"uint256"},{"type":"uint256","name":"amount_sold","internalType":"uint256"},{"type":"uint256","name":"start_timestamp","internalType":"uint256"},{"type":"uint256","name":"duration","internalType":"uint256"},{"type":"uint256","name":"min_priceInWei","internalType":"uint256"},{"type":"uint256","name":"highest_bid","internalType":"uint256"},{"type":"address","name":"winner","internalType":"address"}],"name":"auctions","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"bidOnNFT","inputs":[{"type":"uint256","name":"_classID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"classID","internalType":"uint256"},{"type":"address","name":"owner","internalType":"address"},{"type":"uint256","name":"bid_amount","internalType":"uint256"},{"type":"uint256","name":"bid_timestamp","internalType":"uint256"}],"name":"bids","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createNFTAuction","inputs":[{"type":"uint256","name":"_classID","internalType":"uint256"},{"type":"uint256","name":"_max_supply","internalType":"uint256"},{"type":"uint256","name":"_start_timestamp","internalType":"uint256"},{"type":"uint256","name":"_duration","internalType":"uint256"},{"type":"uint256","name":"_minPriceInWEI","internalType":"uint256"},{"type":"uint256","name":"_already_sold","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"endRound","inputs":[{"type":"uint256","name":"_classID","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nextBidIndex","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"nft_contract","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address payable"}],"name":"revenue","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"revenue_amount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setActive","inputs":[{"type":"bool","name":"_active","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNFTContract","inputs":[{"type":"address","name":"_nftContract","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRevenueAddress","inputs":[{"type":"address","name":"_revenue_address","internalType":"address payable"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawRevenue","inputs":[]}]
              

Contract Creation Code

Verify & Publish
0x60806040526000805460ff60a01b1916600160a01b178155600355600680546001600160a01b0319167301000b5fe61411c466b70631d7ff070187179bbf17905534801561004c57600080fd5b50600080546001600160a01b0319163317905561131b8061006e6000396000f3fe6080604052600436106100f35760003560e01c8063571a26a01161008a578063a7ccabdf11610059578063a7ccabdf1461035c578063acec338a1461037c578063f2fde38b1461039c578063fcdcdeee146103bc57600080fd5b8063571a26a0146102695780635a1e6ca1146103085780638da5cb5b14610328578063982f45e21461034657600080fd5b80634423c5f1116100c65780634423c5f11461019f57806345338d63146102145780634e055c47146102345780634f573cb21461025457600080fd5b806302fb0c5e146100f857806322efda771461012e57806327bf3410146101525780633e9491a214610167575b600080fd5b34801561010457600080fd5b5060005461011990600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b34801561013a57600080fd5b5061014460035481565b604051908152602001610125565b61016561016036600461104a565b6103dc565b005b34801561017357600080fd5b50600654610187906001600160a01b031681565b6040516001600160a01b039091168152602001610125565b3480156101ab57600080fd5b506101ec6101ba36600461104a565b6002602081905260009182526040909120805460018201549282015460039092015490926001600160a01b0316919084565b604080519485526001600160a01b039093166020850152918301526060820152608001610125565b34801561022057600080fd5b5061016561022f366004611078565b6107da565b34801561024057600080fd5b5061016561024f36600461109c565b610826565b34801561026057600080fd5b506101656108de565b34801561027557600080fd5b506102ca61028436600461104a565b600460208190526000918252604090912080546001820154600283015460038401549484015460058501546006909501549395929491939091906001600160a01b031687565b604080519788526020880196909652948601939093526060850191909152608084015260a08301526001600160a01b031660c082015260e001610125565b34801561031457600080fd5b5061016561032336600461104a565b6109ee565b34801561033457600080fd5b506000546001600160a01b0316610187565b34801561035257600080fd5b5061014460055481565b34801561036857600080fd5b50610165610377366004611078565b610c65565b34801561038857600080fd5b506101656103973660046110ed565b610ceb565b3480156103a857600080fd5b506101656103b7366004611078565b610d33565b3480156103c857600080fd5b50600154610187906001600160a01b031681565b600054600160a01b900460ff166104485760405162461bcd60e51b815260206004820152602560248201527f5468697320636f6e74726163742069732064656163746976617465642062792060448201526437bbb732b960d91b60648201526084015b60405180910390fd5b6000818152600460208190526040909120015434908110156104ac5760405162461bcd60e51b815260206004820152601d60248201527f4d696e207072696365206372697465726961206973206e6f74206d6574000000604482015260640161043f565b600082815260046020526040902060020154421161050c5760405162461bcd60e51b815260206004820152601960248201527f41756374696f6e20646964206e6f742073746172742079657400000000000000604482015260640161043f565b60008281526004602052604090206003810154600290910154429161053091611120565b10156105a05761053f826109ee565b6000828152600460208190526040909120015433906108fc906105629084611138565b6040518115909202916000818181858888f1935050505015801561058a573d6000803e3d6000fd5b5050600081815260046020819052604090912001545b600082815260046020526040902060018101549054116105d25760405162461bcd60e51b815260040161043f9061114f565b6000828152600460205260409020600501546105f0906014906111ae565b60008381526004602052604090206005015461060c9190611120565b811015801561063e575060008281526004602052604090206005015461063a90670de0b6b3a7640000611120565b8110155b6106965760405162461bcd60e51b8152602060048201526024808201527f446f6573206e6f74206f75746269642063757272656e742077696e6e657220626044820152637920352560e01b606482015260840161043f565b600082815260046020819052604090912001546107065760405162461bcd60e51b815260206004820152602860248201527f4d696e207072696365206973206e6f7420636f6e66696775726564206279207460448201526734329037bbb732b960c11b606482015260840161043f565b600082815260046020526040808220600681015460059091015491516001600160a01b039091169282156108fc02929190818181858888f19350505050158015610754573d6000803e3d6000fd5b506000828152600460209081526040808320600681018054336001600160a01b0319918216811790925560059092018690556003805486526002948590528386208890558054865283862060010180549093169091179091558054845281842090920184905581548352822042908201558054916107d1836111c2565b91905055505050565b6000546001600160a01b031633146108045760405162461bcd60e51b815260040161043f906111dd565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146108505760405162461bcd60e51b815260040161043f906111dd565b60008681526004602081815260408084208981556001810186905560028101899055600381018890559283018690559254600690920180546001600160a01b0319166001600160a01b03909316929092179091558151428152915188927fe00a2da3a0f34a566402a244ab7ec63f8ab7472591cb18edf3269aa00461a41092908290030190a2505050505050565b6000546001600160a01b031633146109085760405162461bcd60e51b815260040161043f906111dd565b6006546001600160a01b031633146109725760405162461bcd60e51b815260206004820152602760248201527f5468697320616374696f6e20726571756972657320726576656e75652070657260448201526636b4b9b9b4b7b760c91b606482015260840161043f565b6005805460009182905560065460405191926001600160a01b039091169183156108fc0291849190818181858888f193505050501580156109b7573d6000803e3d6000fd5b506040518181527f3449177c5be4aca5ea828acefea3213c1a52e1ad402fd9571d234a265e6d63119060200160405180910390a150565b60008181526004602052604090206003810154600290910154610a119190611120565b4211610a5f5760405162461bcd60e51b815260206004820152601c60248201527f41756374696f6e206973207374696c6c20696e2070726f677265737300000000604482015260640161043f565b60008181526004602052604090206001810154905411610a915760405162461bcd60e51b815260040161043f9061114f565b6000818152600460205260408120600101805491610aae836111c2565b9091555050600154604051633c65b3eb60e01b8152600481018390526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af1158015610aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b239190611212565b9050610b2f8183610dce565b6001546000838152600460208190526040808320600601549051635f22feb160e11b81526001600160a01b03918216928101929092526024820185905260606044830152606482019290925291169063be45fd62906084016020604051808303816000875af1158015610ba6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bca919061122b565b5060008281526004602052604080822060060154905183926001600160a01b039092169185917fa49385eb61e4f439063d5c00de2ab7a1fff06ca35f6f06fb634d21a2e8ad32799190a460008281526004602052604081206005908101548154909290610c38908490611120565b90915550506000828152600460205260409020805460019091015414610c6157610c6182610e50565b5050565b6000546001600160a01b03163314610c8f5760405162461bcd60e51b815260040161043f906111dd565b6001546040516001600160a01b038084169216907f048be79eb9eed95d1a5143dcb6b4b7a5ac915c1decaebd1bd13f267a3cc2dbba90600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610d155760405162461bcd60e51b815260040161043f906111dd565b60008054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610d5d5760405162461bcd60e51b815260040161043f906111dd565b6001600160a01b038116610dc25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043f565b610dcb81610ef4565b50565b600081815260046020526040902060019081015490546001600160a01b031663290e008c84610dfc84610f44565b6040518363ffffffff1660e01b8152600401610e19929190611248565b600060405180830381600087803b158015610e3357600080fd5b505af1158015610e47573d6000803e3d6000fd5b50505050505050565b600080548282526004602052604082206006810180546001600160a01b0319166001600160a01b039093169290921790915560050155610e9242610258611120565b60008281526004602052604090206002810182905560030154610eb491611120565b600082815260046020526040808220600201549051909184917f5aec57d81928b24d30b1a2aec0d23d693412c37d7ec106b5d8259413716bb1f49190a450565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081610f685750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610f925780610f7c816111c2565b9150610f8b9050600a836111ae565b9150610f6c565b60008167ffffffffffffffff811115610fad57610fad6112a5565b6040519080825280601f01601f191660200182016040528015610fd7576020820181803683370190505b5090505b841561104257610fec600183611138565b9150610ff9600a866112bb565b611004906030611120565b60f81b818381518110611019576110196112cf565b60200101906001600160f81b031916908160001a90535061103b600a866111ae565b9450610fdb565b949350505050565b60006020828403121561105c57600080fd5b5035919050565b6001600160a01b0381168114610dcb57600080fd5b60006020828403121561108a57600080fd5b813561109581611063565b9392505050565b60008060008060008060c087890312156110b557600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b8015158114610dcb57600080fd5b6000602082840312156110ff57600080fd5b8135611095816110df565b634e487b7160e01b600052601160045260246000fd5b600082198211156111335761113361110a565b500190565b60008282101561114a5761114a61110a565b500390565b60208082526029908201527f416c6c204e465473206f66207468697320617274776f726b2061726520616c726040820152681958591e481cdbdb1960ba1b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826111bd576111bd611198565b500490565b60006000198214156111d6576111d661110a565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561122457600080fd5b5051919050565b60006020828403121561123d57600080fd5b8151611095816110df565b82815260006020604081840152835180604085015260005b8181101561127c57858101830151858201606001528201611260565b8181111561128e576000606083870101525b50601f01601f191692909201606001949350505050565b634e487b7160e01b600052604160045260246000fd5b6000826112ca576112ca611198565b500690565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220c02994834216b6ed7a7e5f0e0e001bbfc3a357594d42c2d919bd576e37f645bd64736f6c634300080c0033

Deployed ByteCode

0x6080604052600436106100f35760003560e01c8063571a26a01161008a578063a7ccabdf11610059578063a7ccabdf1461035c578063acec338a1461037c578063f2fde38b1461039c578063fcdcdeee146103bc57600080fd5b8063571a26a0146102695780635a1e6ca1146103085780638da5cb5b14610328578063982f45e21461034657600080fd5b80634423c5f1116100c65780634423c5f11461019f57806345338d63146102145780634e055c47146102345780634f573cb21461025457600080fd5b806302fb0c5e146100f857806322efda771461012e57806327bf3410146101525780633e9491a214610167575b600080fd5b34801561010457600080fd5b5060005461011990600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b34801561013a57600080fd5b5061014460035481565b604051908152602001610125565b61016561016036600461104a565b6103dc565b005b34801561017357600080fd5b50600654610187906001600160a01b031681565b6040516001600160a01b039091168152602001610125565b3480156101ab57600080fd5b506101ec6101ba36600461104a565b6002602081905260009182526040909120805460018201549282015460039092015490926001600160a01b0316919084565b604080519485526001600160a01b039093166020850152918301526060820152608001610125565b34801561022057600080fd5b5061016561022f366004611078565b6107da565b34801561024057600080fd5b5061016561024f36600461109c565b610826565b34801561026057600080fd5b506101656108de565b34801561027557600080fd5b506102ca61028436600461104a565b600460208190526000918252604090912080546001820154600283015460038401549484015460058501546006909501549395929491939091906001600160a01b031687565b604080519788526020880196909652948601939093526060850191909152608084015260a08301526001600160a01b031660c082015260e001610125565b34801561031457600080fd5b5061016561032336600461104a565b6109ee565b34801561033457600080fd5b506000546001600160a01b0316610187565b34801561035257600080fd5b5061014460055481565b34801561036857600080fd5b50610165610377366004611078565b610c65565b34801561038857600080fd5b506101656103973660046110ed565b610ceb565b3480156103a857600080fd5b506101656103b7366004611078565b610d33565b3480156103c857600080fd5b50600154610187906001600160a01b031681565b600054600160a01b900460ff166104485760405162461bcd60e51b815260206004820152602560248201527f5468697320636f6e74726163742069732064656163746976617465642062792060448201526437bbb732b960d91b60648201526084015b60405180910390fd5b6000818152600460208190526040909120015434908110156104ac5760405162461bcd60e51b815260206004820152601d60248201527f4d696e207072696365206372697465726961206973206e6f74206d6574000000604482015260640161043f565b600082815260046020526040902060020154421161050c5760405162461bcd60e51b815260206004820152601960248201527f41756374696f6e20646964206e6f742073746172742079657400000000000000604482015260640161043f565b60008281526004602052604090206003810154600290910154429161053091611120565b10156105a05761053f826109ee565b6000828152600460208190526040909120015433906108fc906105629084611138565b6040518115909202916000818181858888f1935050505015801561058a573d6000803e3d6000fd5b5050600081815260046020819052604090912001545b600082815260046020526040902060018101549054116105d25760405162461bcd60e51b815260040161043f9061114f565b6000828152600460205260409020600501546105f0906014906111ae565b60008381526004602052604090206005015461060c9190611120565b811015801561063e575060008281526004602052604090206005015461063a90670de0b6b3a7640000611120565b8110155b6106965760405162461bcd60e51b8152602060048201526024808201527f446f6573206e6f74206f75746269642063757272656e742077696e6e657220626044820152637920352560e01b606482015260840161043f565b600082815260046020819052604090912001546107065760405162461bcd60e51b815260206004820152602860248201527f4d696e207072696365206973206e6f7420636f6e66696775726564206279207460448201526734329037bbb732b960c11b606482015260840161043f565b600082815260046020526040808220600681015460059091015491516001600160a01b039091169282156108fc02929190818181858888f19350505050158015610754573d6000803e3d6000fd5b506000828152600460209081526040808320600681018054336001600160a01b0319918216811790925560059092018690556003805486526002948590528386208890558054865283862060010180549093169091179091558054845281842090920184905581548352822042908201558054916107d1836111c2565b91905055505050565b6000546001600160a01b031633146108045760405162461bcd60e51b815260040161043f906111dd565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146108505760405162461bcd60e51b815260040161043f906111dd565b60008681526004602081815260408084208981556001810186905560028101899055600381018890559283018690559254600690920180546001600160a01b0319166001600160a01b03909316929092179091558151428152915188927fe00a2da3a0f34a566402a244ab7ec63f8ab7472591cb18edf3269aa00461a41092908290030190a2505050505050565b6000546001600160a01b031633146109085760405162461bcd60e51b815260040161043f906111dd565b6006546001600160a01b031633146109725760405162461bcd60e51b815260206004820152602760248201527f5468697320616374696f6e20726571756972657320726576656e75652070657260448201526636b4b9b9b4b7b760c91b606482015260840161043f565b6005805460009182905560065460405191926001600160a01b039091169183156108fc0291849190818181858888f193505050501580156109b7573d6000803e3d6000fd5b506040518181527f3449177c5be4aca5ea828acefea3213c1a52e1ad402fd9571d234a265e6d63119060200160405180910390a150565b60008181526004602052604090206003810154600290910154610a119190611120565b4211610a5f5760405162461bcd60e51b815260206004820152601c60248201527f41756374696f6e206973207374696c6c20696e2070726f677265737300000000604482015260640161043f565b60008181526004602052604090206001810154905411610a915760405162461bcd60e51b815260040161043f9061114f565b6000818152600460205260408120600101805491610aae836111c2565b9091555050600154604051633c65b3eb60e01b8152600481018390526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af1158015610aff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b239190611212565b9050610b2f8183610dce565b6001546000838152600460208190526040808320600601549051635f22feb160e11b81526001600160a01b03918216928101929092526024820185905260606044830152606482019290925291169063be45fd62906084016020604051808303816000875af1158015610ba6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bca919061122b565b5060008281526004602052604080822060060154905183926001600160a01b039092169185917fa49385eb61e4f439063d5c00de2ab7a1fff06ca35f6f06fb634d21a2e8ad32799190a460008281526004602052604081206005908101548154909290610c38908490611120565b90915550506000828152600460205260409020805460019091015414610c6157610c6182610e50565b5050565b6000546001600160a01b03163314610c8f5760405162461bcd60e51b815260040161043f906111dd565b6001546040516001600160a01b038084169216907f048be79eb9eed95d1a5143dcb6b4b7a5ac915c1decaebd1bd13f267a3cc2dbba90600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610d155760405162461bcd60e51b815260040161043f906111dd565b60008054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610d5d5760405162461bcd60e51b815260040161043f906111dd565b6001600160a01b038116610dc25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161043f565b610dcb81610ef4565b50565b600081815260046020526040902060019081015490546001600160a01b031663290e008c84610dfc84610f44565b6040518363ffffffff1660e01b8152600401610e19929190611248565b600060405180830381600087803b158015610e3357600080fd5b505af1158015610e47573d6000803e3d6000fd5b50505050505050565b600080548282526004602052604082206006810180546001600160a01b0319166001600160a01b039093169290921790915560050155610e9242610258611120565b60008281526004602052604090206002810182905560030154610eb491611120565b600082815260046020526040808220600201549051909184917f5aec57d81928b24d30b1a2aec0d23d693412c37d7ec106b5d8259413716bb1f49190a450565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081610f685750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610f925780610f7c816111c2565b9150610f8b9050600a836111ae565b9150610f6c565b60008167ffffffffffffffff811115610fad57610fad6112a5565b6040519080825280601f01601f191660200182016040528015610fd7576020820181803683370190505b5090505b841561104257610fec600183611138565b9150610ff9600a866112bb565b611004906030611120565b60f81b818381518110611019576110196112cf565b60200101906001600160f81b031916908160001a90535061103b600a866111ae565b9450610fdb565b949350505050565b60006020828403121561105c57600080fd5b5035919050565b6001600160a01b0381168114610dcb57600080fd5b60006020828403121561108a57600080fd5b813561109581611063565b9392505050565b60008060008060008060c087890312156110b557600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b8015158114610dcb57600080fd5b6000602082840312156110ff57600080fd5b8135611095816110df565b634e487b7160e01b600052601160045260246000fd5b600082198211156111335761113361110a565b500190565b60008282101561114a5761114a61110a565b500390565b60208082526029908201527f416c6c204e465473206f66207468697320617274776f726b2061726520616c726040820152681958591e481cdbdb1960ba1b606082015260800190565b634e487b7160e01b600052601260045260246000fd5b6000826111bd576111bd611198565b500490565b60006000198214156111d6576111d661110a565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561122457600080fd5b5051919050565b60006020828403121561123d57600080fd5b8151611095816110df565b82815260006020604081840152835180604085015260005b8181101561127c57858101830151858201606001528201611260565b8181111561128e576000606083870101525b50601f01601f191692909201606001949350505050565b634e487b7160e01b600052604160045260246000fd5b6000826112ca576112ca611198565b500690565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220c02994834216b6ed7a7e5f0e0e001bbfc3a357594d42c2d919bd576e37f645bd64736f6c634300080c0033