false
false
0

Contract Address Details

0xA0F8e443c3a8Ba437BDF7378848dEeAeA9fb877f

Contract Name
NFTMulticlassFreeMint
Creator
0x964070–829cff at 0x94e99f–629ee0
Balance
0 CLO
Tokens
Fetching tokens...
Transactions
224 Transactions
Transfers
430 Transfers
Gas Used
48,577,688
Last Balance Update
16288482
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
NFTMulticlassFreeMint




Optimization enabled
true
Compiler version
v0.8.15+commit.e14f2714




Optimization runs
200
EVM Version
default




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

Contract source code

// SPDX-License-Identifier: GPL

pragma solidity ^0.8.0;

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

interface NFTInterface {
    function mintWithClass(uint256 classId) external returns (uint256 _newTokenID);
    function transfer(address _to, uint256 _tokenId, bytes calldata _data) external returns (bool);
    function addPropertyWithContent(uint256 _tokenId, string calldata _content) external;
}

contract NFTMulticlassFreeMint is Ownable{

    event ClassMinterCreated(uint256 indexed tokenClassAuctionID);
    event TokenMinted(uint256 indexed tokenID, uint256 indexed tokenClassID, address indexed beneficiary);
    event NFTContractSet(address indexed newNFTContract, address indexed oldNFTContract);
 
    address public nft_contract;

    struct NFTClassMinter
    {
        uint256 amount_minted;
        mapping (address => bool) isOwner;
        string[] configuration_properties;
    }

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

    constructor()
    {
        _owner = msg.sender;
    }

    function createNFTClassMinter(uint256 _classID) public onlyOwner
    {
        classMinters[_classID].amount_minted = 0; 

        emit ClassMinterCreated(_classID);
    }

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

        nft_contract = _nftContract;
    }

    function mintNFT(uint256 _classID, address _to) public onlyOwner
    {
        require(classMinters[_classID].isOwner[_to] == false, "Token already minted to this address");
        uint256 _mintedId = NFTInterface(nft_contract).mintWithClass(_classID);
        classMinters[_classID].amount_minted++;
        configureNFT(_mintedId, _classID);
        classMinters[_classID].isOwner[_to] = true;
        NFTInterface(nft_contract).transfer(_to, _mintedId, "");

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

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

    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":"ClassMinterCreated","inputs":[{"type":"uint256","name":"tokenClassAuctionID","internalType":"uint256","indexed":true}],"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":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TokenMinted","inputs":[{"type":"uint256","name":"tokenID","internalType":"uint256","indexed":true},{"type":"uint256","name":"tokenClassID","internalType":"uint256","indexed":true},{"type":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"amount_minted","internalType":"uint256"}],"name":"classMinters","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createNFTClassMinter","inputs":[{"type":"uint256","name":"_classID","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mintNFT","inputs":[{"type":"uint256","name":"_classID","internalType":"uint256"},{"type":"address","name":"_to","internalType":"address"}]},{"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":"nonpayable","outputs":[],"name":"setNFTContract","inputs":[{"type":"address","name":"_nftContract","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

0x608060405234801561001057600080fd5b50600080546001600160a01b0319163317905561091d806100326000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063b8cef3871161005b578063b8cef387146100d4578063db34551614610102578063f2fde38b14610115578063fcdcdeee1461012857600080fd5b8063669f5a51146100825780638da5cb5b14610097578063a7ccabdf146100c1575b600080fd5b6100956100903660046106eb565b61013b565b005b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100956100cf366004610717565b610371565b6100f46100e2366004610739565b60026020526000908152604090205481565b6040519081526020016100b8565b610095610110366004610739565b6103f8565b610095610123366004610717565b61045d565b6001546100a4906001600160a01b031681565b6000546001600160a01b0316331461016e5760405162461bcd60e51b815260040161016590610752565b60405180910390fd5b60008281526002602090815260408083206001600160a01b038516845260010190915290205460ff16156101f05760405162461bcd60e51b8152602060048201526024808201527f546f6b656e20616c7265616479206d696e74656420746f2074686973206164646044820152637265737360e01b6064820152608401610165565b600154604051633c65b3eb60e01b8152600481018490526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af115801561023c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102609190610787565b600084815260026020526040812080549293509061027d836107b6565b919050555061028c81846104f8565b60008381526002602090815260408083206001600160a01b038681168086526001928301909452828520805460ff19168317905590549151635f22feb160e11b81526004810193909352602483018590526060604484015260648301939093529091169063be45fd62906084016020604051808303816000875af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c91906107cf565b506040513390849083907ff371d67483809edbc84279729528d26a3e37ce67f1e3a911778dbf88ff927ca290600090a4505050565b6000546001600160a01b0316331461039b5760405162461bcd60e51b815260040161016590610752565b6001546040516001600160a01b03918216918316907f048be79eb9eed95d1a5143dcb6b4b7a5ac915c1decaebd1bd13f267a3cc2dbba90600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146104225760405162461bcd60e51b815260040161016590610752565b6000818152600260205260408082208290555182917f6ea3dd1d908dae17264291defd43931b244a2494ecb4f7fe4e3f7ac2b463c7f091a250565b6000546001600160a01b031633146104875760405162461bcd60e51b815260040161016590610752565b6001600160a01b0381166104ec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610165565b6104f581610576565b50565b6000818152600260205260409020546001546001600160a01b031663290e008c84610522846105c6565b6040518363ffffffff1660e01b815260040161053f9291906107f1565b600060405180830381600087803b15801561055957600080fd5b505af115801561056d573d6000803e3d6000fd5b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816000036105ed5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156106175780610601816107b6565b91506106109050600a83610864565b91506105f1565b60008167ffffffffffffffff81111561063257610632610878565b6040519080825280601f01601f19166020018201604052801561065c576020820181803683370190505b5090505b84156106c75761067160018361088e565b915061067e600a866108a5565b6106899060306108b9565b60f81b81838151811061069e5761069e6108d1565b60200101906001600160f81b031916908160001a9053506106c0600a86610864565b9450610660565b949350505050565b80356001600160a01b03811681146106e657600080fd5b919050565b600080604083850312156106fe57600080fd5b8235915061070e602084016106cf565b90509250929050565b60006020828403121561072957600080fd5b610732826106cf565b9392505050565b60006020828403121561074b57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561079957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600182016107c8576107c86107a0565b5060010190565b6000602082840312156107e157600080fd5b8151801515811461073257600080fd5b82815260006020604081840152835180604085015260005b8181101561082557858101830151858201606001528201610809565b81811115610837576000606083870101525b50601f01601f191692909201606001949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826108735761087361084e565b500490565b634e487b7160e01b600052604160045260246000fd5b6000828210156108a0576108a06107a0565b500390565b6000826108b4576108b461084e565b500690565b600082198211156108cc576108cc6107a0565b500190565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220d1000f1ff485c2340842f361fc174ae2480aa2356fbc7ce461c11c5a2b36856064736f6c634300080f0033

Deployed ByteCode

0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063b8cef3871161005b578063b8cef387146100d4578063db34551614610102578063f2fde38b14610115578063fcdcdeee1461012857600080fd5b8063669f5a51146100825780638da5cb5b14610097578063a7ccabdf146100c1575b600080fd5b6100956100903660046106eb565b61013b565b005b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100956100cf366004610717565b610371565b6100f46100e2366004610739565b60026020526000908152604090205481565b6040519081526020016100b8565b610095610110366004610739565b6103f8565b610095610123366004610717565b61045d565b6001546100a4906001600160a01b031681565b6000546001600160a01b0316331461016e5760405162461bcd60e51b815260040161016590610752565b60405180910390fd5b60008281526002602090815260408083206001600160a01b038516845260010190915290205460ff16156101f05760405162461bcd60e51b8152602060048201526024808201527f546f6b656e20616c7265616479206d696e74656420746f2074686973206164646044820152637265737360e01b6064820152608401610165565b600154604051633c65b3eb60e01b8152600481018490526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af115801561023c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102609190610787565b600084815260026020526040812080549293509061027d836107b6565b919050555061028c81846104f8565b60008381526002602090815260408083206001600160a01b038681168086526001928301909452828520805460ff19168317905590549151635f22feb160e11b81526004810193909352602483018590526060604484015260648301939093529091169063be45fd62906084016020604051808303816000875af1158015610318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033c91906107cf565b506040513390849083907ff371d67483809edbc84279729528d26a3e37ce67f1e3a911778dbf88ff927ca290600090a4505050565b6000546001600160a01b0316331461039b5760405162461bcd60e51b815260040161016590610752565b6001546040516001600160a01b03918216918316907f048be79eb9eed95d1a5143dcb6b4b7a5ac915c1decaebd1bd13f267a3cc2dbba90600090a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146104225760405162461bcd60e51b815260040161016590610752565b6000818152600260205260408082208290555182917f6ea3dd1d908dae17264291defd43931b244a2494ecb4f7fe4e3f7ac2b463c7f091a250565b6000546001600160a01b031633146104875760405162461bcd60e51b815260040161016590610752565b6001600160a01b0381166104ec5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610165565b6104f581610576565b50565b6000818152600260205260409020546001546001600160a01b031663290e008c84610522846105c6565b6040518363ffffffff1660e01b815260040161053f9291906107f1565b600060405180830381600087803b15801561055957600080fd5b505af115801561056d573d6000803e3d6000fd5b50505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816000036105ed5750506040805180820190915260018152600360fc1b602082015290565b8160005b81156106175780610601816107b6565b91506106109050600a83610864565b91506105f1565b60008167ffffffffffffffff81111561063257610632610878565b6040519080825280601f01601f19166020018201604052801561065c576020820181803683370190505b5090505b84156106c75761067160018361088e565b915061067e600a866108a5565b6106899060306108b9565b60f81b81838151811061069e5761069e6108d1565b60200101906001600160f81b031916908160001a9053506106c0600a86610864565b9450610660565b949350505050565b80356001600160a01b03811681146106e657600080fd5b919050565b600080604083850312156106fe57600080fd5b8235915061070e602084016106cf565b90509250929050565b60006020828403121561072957600080fd5b610732826106cf565b9392505050565b60006020828403121561074b57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561079957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b6000600182016107c8576107c86107a0565b5060010190565b6000602082840312156107e157600080fd5b8151801515811461073257600080fd5b82815260006020604081840152835180604085015260005b8181101561082557858101830151858201606001528201610809565b81811115610837576000606083870101525b50601f01601f191692909201606001949350505050565b634e487b7160e01b600052601260045260246000fd5b6000826108735761087361084e565b500490565b634e487b7160e01b600052604160045260246000fd5b6000828210156108a0576108a06107a0565b500390565b6000826108b4576108b461084e565b500690565b600082198211156108cc576108cc6107a0565b500190565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220d1000f1ff485c2340842f361fc174ae2480aa2356fbc7ce461c11c5a2b36856064736f6c634300080f0033