false
false
0

Contract Address Details

0xd09c8De30277A4B1c34f806636BDEEbC1ee38beB

Contract Name
NFTMulticlassFreeMint
Creator
0x964070–829cff at 0x3ed1a8–8d7be1
Balance
0 CLO
Tokens
Fetching tokens...
Transactions
2 Transactions
Transfers
0 Transfers
Gas Used
109,628
Last Balance Update
16409240
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.17+commit.8df45f5f




Optimization runs
1000
EVM Version
default




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

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;
        uint256 max_amount;
        mapping (address => bool) isOwner;
    }

    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, uint256 _max_amount, uint256 _amount_minted) public onlyOwner
    {
        classMinters[_classID].amount_minted = _amount_minted; 
        classMinters[_classID].max_amount = _max_amount; 

        emit ClassMinterCreated(_classID);
    }

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

        nft_contract = _nftContract;
    }

    function getIsOwner(uint _classID, address _address) public view returns (bool) {
        return classMinters[_classID].isOwner[_address];
    }

    function mintNFT(uint256 _classID, address _to) public onlyOwner
    {
        require(classMinters[_classID].max_amount > classMinters[_classID].amount_minted, "There are no more NFTs left");
        require(classMinters[_classID].isOwner[_to] == false, "Token already minted to this address");
        uint256 _mintedId = NFTInterface(nft_contract).mintWithClass(_classID);
        unchecked{
            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) {
            unchecked{
                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"},{"type":"uint256","name":"max_amount","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":"uint256","name":"_max_amount","internalType":"uint256"},{"type":"uint256","name":"_amount_minted","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"getIsOwner","inputs":[{"type":"uint256","name":"_classID","internalType":"uint256"},{"type":"address","name":"_address","internalType":"address"}]},{"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

Verify & Publish
0x608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610b17806100326000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c8063a7ccabdf1161005b578063a7ccabdf14610102578063b8cef38714610115578063f2fde38b14610151578063fcdcdeee1461016457600080fd5b8063126301ff1461008d578063669f5a51146100a25780638da5cb5b146100b5578063a4cbe513146100df575b600080fd5b6100a061009b3660046108fb565b610177565b005b6100a06100b0366004610943565b610219565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100f26100ed366004610943565b610519565b60405190151581526020016100d6565b6100a061011036600461096f565b610548565b61013c610123366004610991565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152016100d6565b6100a061015f36600461096f565b61060c565b6001546100c2906001600160a01b031681565b6000546001600160a01b031633146101d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6000838152600260205260408082208381556001018490555184917f6ea3dd1d908dae17264291defd43931b244a2494ecb4f7fe4e3f7ac2b463c7f091a2505050565b6000546001600160a01b031633146102735760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101cd565b60008281526002602052604090208054600190910154116102d65760405162461bcd60e51b815260206004820152601b60248201527f546865726520617265206e6f206d6f7265204e465473206c656674000000000060448201526064016101cd565b60008281526002602081815260408084206001600160a01b0386168552909201905290205460ff16156103705760405162461bcd60e51b8152602060048201526024808201527f546f6b656e20616c7265616479206d696e74656420746f20746869732061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016101cd565b6001546040517f3c65b3eb000000000000000000000000000000000000000000000000000000008152600481018490526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af11580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f991906109aa565b600084815260026020526040902080546001019055905061041a81846106ee565b60008381526002602081815260408084206001600160a01b0387811680875291909401909252808420805460ff191660019081179091555490517fbe45fd6200000000000000000000000000000000000000000000000000000000815260048101929092526024820185905260606044830152606482019390935291169063be45fd62906084016020604051808303816000875af11580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e491906109c3565b506040513390849083907ff371d67483809edbc84279729528d26a3e37ce67f1e3a911778dbf88ff927ca290600090a4505050565b60008281526002602081815260408084206001600160a01b0386168552909201905290205460ff165b92915050565b6000546001600160a01b031633146105a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101cd565b6001546040516001600160a01b03918216918316907f048be79eb9eed95d1a5143dcb6b4b7a5ac915c1decaebd1bd13f267a3cc2dbba90600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146106665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101cd565b6001600160a01b0381166106e25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101cd565b6106eb8161076c565b50565b6000818152600260205260409020546001546001600160a01b031663290e008c84610718846107c9565b6040518363ffffffff1660e01b81526004016107359291906109e5565b600060405180830381600087803b15801561074f57600080fd5b505af1158015610763573d6000803e3d6000fd5b50505050505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60608160000361080c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561082b57600101610824600a83610a67565b9150610810565b60008167ffffffffffffffff81111561084657610846610a7b565b6040519080825280601f01601f191660200182016040528015610870576020820181803683370190505b5090505b84156108f357610885600183610a91565b9150610892600a86610aa4565b61089d906030610ab8565b60f81b8183815181106108b2576108b2610acb565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506108ec600a86610a67565b9450610874565b949350505050565b60008060006060848603121561091057600080fd5b505081359360208301359350604090920135919050565b80356001600160a01b038116811461093e57600080fd5b919050565b6000806040838503121561095657600080fd5b8235915061096660208401610927565b90509250929050565b60006020828403121561098157600080fd5b61098a82610927565b9392505050565b6000602082840312156109a357600080fd5b5035919050565b6000602082840312156109bc57600080fd5b5051919050565b6000602082840312156109d557600080fd5b8151801515811461098a57600080fd5b82815260006020604081840152835180604085015260005b81811015610a19578581018301518582016060015282016109fd565b506000606082860101526060601f19601f830116850101925050509392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082610a7657610a76610a3b565b500490565b634e487b7160e01b600052604160045260246000fd5b8181038181111561054257610542610a51565b600082610ab357610ab3610a3b565b500690565b8082018082111561054257610542610a51565b634e487b7160e01b600052603260045260246000fdfea264697066735822122055bafdbbbaa26483b9c56366fdb8780dd4590950f32b15d2d1a734f2ca56a6b764736f6c63430008110033

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100885760003560e01c8063a7ccabdf1161005b578063a7ccabdf14610102578063b8cef38714610115578063f2fde38b14610151578063fcdcdeee1461016457600080fd5b8063126301ff1461008d578063669f5a51146100a25780638da5cb5b146100b5578063a4cbe513146100df575b600080fd5b6100a061009b3660046108fb565b610177565b005b6100a06100b0366004610943565b610219565b6000546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6100f26100ed366004610943565b610519565b60405190151581526020016100d6565b6100a061011036600461096f565b610548565b61013c610123366004610991565b6002602052600090815260409020805460019091015482565b604080519283526020830191909152016100d6565b6100a061015f36600461096f565b61060c565b6001546100c2906001600160a01b031681565b6000546001600160a01b031633146101d65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6000838152600260205260408082208381556001018490555184917f6ea3dd1d908dae17264291defd43931b244a2494ecb4f7fe4e3f7ac2b463c7f091a2505050565b6000546001600160a01b031633146102735760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101cd565b60008281526002602052604090208054600190910154116102d65760405162461bcd60e51b815260206004820152601b60248201527f546865726520617265206e6f206d6f7265204e465473206c656674000000000060448201526064016101cd565b60008281526002602081815260408084206001600160a01b0386168552909201905290205460ff16156103705760405162461bcd60e51b8152602060048201526024808201527f546f6b656e20616c7265616479206d696e74656420746f20746869732061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016101cd565b6001546040517f3c65b3eb000000000000000000000000000000000000000000000000000000008152600481018490526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af11580156103d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f991906109aa565b600084815260026020526040902080546001019055905061041a81846106ee565b60008381526002602081815260408084206001600160a01b0387811680875291909401909252808420805460ff191660019081179091555490517fbe45fd6200000000000000000000000000000000000000000000000000000000815260048101929092526024820185905260606044830152606482019390935291169063be45fd62906084016020604051808303816000875af11580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e491906109c3565b506040513390849083907ff371d67483809edbc84279729528d26a3e37ce67f1e3a911778dbf88ff927ca290600090a4505050565b60008281526002602081815260408084206001600160a01b0386168552909201905290205460ff165b92915050565b6000546001600160a01b031633146105a25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101cd565b6001546040516001600160a01b03918216918316907f048be79eb9eed95d1a5143dcb6b4b7a5ac915c1decaebd1bd13f267a3cc2dbba90600090a36001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6000546001600160a01b031633146106665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101cd565b6001600160a01b0381166106e25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016101cd565b6106eb8161076c565b50565b6000818152600260205260409020546001546001600160a01b031663290e008c84610718846107c9565b6040518363ffffffff1660e01b81526004016107359291906109e5565b600060405180830381600087803b15801561074f57600080fd5b505af1158015610763573d6000803e3d6000fd5b50505050505050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60608160000361080c57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b811561082b57600101610824600a83610a67565b9150610810565b60008167ffffffffffffffff81111561084657610846610a7b565b6040519080825280601f01601f191660200182016040528015610870576020820181803683370190505b5090505b84156108f357610885600183610a91565b9150610892600a86610aa4565b61089d906030610ab8565b60f81b8183815181106108b2576108b2610acb565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506108ec600a86610a67565b9450610874565b949350505050565b60008060006060848603121561091057600080fd5b505081359360208301359350604090920135919050565b80356001600160a01b038116811461093e57600080fd5b919050565b6000806040838503121561095657600080fd5b8235915061096660208401610927565b90509250929050565b60006020828403121561098157600080fd5b61098a82610927565b9392505050565b6000602082840312156109a357600080fd5b5035919050565b6000602082840312156109bc57600080fd5b5051919050565b6000602082840312156109d557600080fd5b8151801515811461098a57600080fd5b82815260006020604081840152835180604085015260005b81811015610a19578581018301518582016060015282016109fd565b506000606082860101526060601f19601f830116850101925050509392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082610a7657610a76610a3b565b500490565b634e487b7160e01b600052604160045260246000fd5b8181038181111561054257610542610a51565b600082610ab357610ab3610a3b565b500690565b8082018082111561054257610542610a51565b634e487b7160e01b600052603260045260246000fdfea264697066735822122055bafdbbbaa26483b9c56366fdb8780dd4590950f32b15d2d1a734f2ca56a6b764736f6c63430008110033