false
false
0

Contract Address Details

0x2789F7D59116a2AF8feB1B239EBf2a7812ABa831

Contract Name
NFTFreeMint
Creator
0xb00b52–c4530f at 0xfff7c3–c855aa
Balance
0 CLO
Tokens
Fetching tokens...
Transactions
35 Transactions
Transfers
70 Transfers
Gas Used
7,138,749
Last Balance Update
16289571
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
NFTFreeMint




Optimization enabled
true
Compiler version
v0.8.16+commit.07a7930e




Optimization runs
1000
EVM Version
default




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

Constructor Arguments

0x00000000000000000000000069c878b44fb427cd084125ce3b76a8ee4685e78c0000000000000000000000000000000000000000000000000000000000000066

Arg [0] (address) : 0x69c878b44fb427cd084125ce3b76a8ee4685e78c
Arg [1] (uint256) : 102

              

Contract source code

// Sources flattened with hardhat v2.10.2 https://hardhat.org

// File @openzeppelin/contracts/utils/[email protected]

// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}


// File @openzeppelin/contracts/access/[email protected]

// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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);
    }
}


// File contracts/NFTFreeMint.sol

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

// SPDX-License-Identifier: GPL

pragma solidity ^0.8.0;

contract NFTFreeMint is Ownable{

    event TokenMinted(uint256 indexed tokenID, address indexed beneficiary);
 
    address public nft_contract;
    uint256 public amount_minted;
    uint256 public max_amount;
    uint256 public classID;
    mapping (address => bool) public addressUsed;

    constructor(address _nft_contract, uint256 _classID)
    {
        nft_contract = _nft_contract;
        classID = _classID;
    }

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

        emit TokenMinted(_mintedId, msg.sender);
    }

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

    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":"address","name":"_nft_contract","internalType":"address"},{"type":"uint256","name":"_classID","internalType":"uint256"}]},{"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":"address","name":"beneficiary","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"addressUsed","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"amount_minted","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"classID","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"max_amount","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mintNFT","inputs":[{"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":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
              

Contract Creation Code

Verify & Publish
0x608060405234801561001057600080fd5b5060405161097238038061097283398101604081905261002f916100b1565b61003833610061565b600180546001600160a01b0319166001600160a01b0393909316929092179091556004556100eb565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100c457600080fd5b82516001600160a01b03811681146100db57600080fd5b6020939093015192949293505050565b610878806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106100a35760003560e01c8063715018a611610076578063b1b957241161005b578063b1b9572414610118578063f2fde38b1461014b578063fcdcdeee1461015e57600080fd5b8063715018a6146100eb5780638da5cb5b146100f357600080fd5b80631a34fe81146100a857806354ba0f27146100c45780635bdfab88146100d95780635df0d4fa146100e2575b600080fd5b6100b160035481565b6040519081526020015b60405180910390f35b6100d76100d23660046106bc565b610171565b005b6100b160045481565b6100b160025481565b6100d76103a4565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100bb565b61013b6101263660046106bc565b60056020526000908152604090205460ff1681565b60405190151581526020016100bb565b6100d76101593660046106bc565b6103b8565b600154610100906001600160a01b031681565b610179610448565b6001600160a01b03811660009081526005602052604090205460ff161561020c5760405162461bcd60e51b8152602060048201526024808201527f546f6b656e20616c7265616479206d696e74656420746f20746869732061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600154600480546040517f3c65b3eb000000000000000000000000000000000000000000000000000000008152918201526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af1158015610272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029691906106ec565b6002805491925060006102a88361071b565b91905055506102b6816104a2565b6001600160a01b03828116600081815260056020526040808220805460ff191660019081179091555490517fbe45fd620000000000000000000000000000000000000000000000000000000081526004810193909352602483018590526060604484015260648301919091529091169063be45fd62906084016020604051808303816000875af115801561034e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103729190610734565b50604051339082907f3a5398bda6f1f57d6c96834fa9bf02b5517bdc847d14312015a917ba421c31c990600090a35050565b6103ac610448565b6103b66000610517565b565b6103c0610448565b6001600160a01b03811661043c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610203565b61044581610517565b50565b6000546001600160a01b031633146103b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610203565b6001546002546001600160a01b039091169063290e008c9083906104c59061057f565b6040518363ffffffff1660e01b81526004016104e2929190610756565b600060405180830381600087803b1580156104fc57600080fd5b505af1158015610510573d6000803e3d6000fd5b5050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816000036105c257505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156105ec57806105d68161071b565b91506105e59050600a836107c2565b91506105c6565b60008167ffffffffffffffff811115610607576106076107d6565b6040519080825280601f01601f191660200182016040528015610631576020820181803683370190505b5090505b84156106b4576106466001836107ec565b9150610653600a86610805565b61065e906030610819565b60f81b8183815181106106735761067361082c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506106ad600a866107c2565b9450610635565b949350505050565b6000602082840312156106ce57600080fd5b81356001600160a01b03811681146106e557600080fd5b9392505050565b6000602082840312156106fe57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60006001820161072d5761072d610705565b5060010190565b60006020828403121561074657600080fd5b815180151581146106e557600080fd5b82815260006020604081840152835180604085015260005b8181101561078a5785810183015185820160600152820161076e565b506000606082860101526060601f19601f830116850101925050509392505050565b634e487b7160e01b600052601260045260246000fd5b6000826107d1576107d16107ac565b500490565b634e487b7160e01b600052604160045260246000fd5b818103818111156107ff576107ff610705565b92915050565b600082610814576108146107ac565b500690565b808201808211156107ff576107ff610705565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220602297b79efbc112d7f6a766ba690dceb66f36f6ed26d38f1156540138df7ebc64736f6c6343000810003300000000000000000000000069c878b44fb427cd084125ce3b76a8ee4685e78c0000000000000000000000000000000000000000000000000000000000000066

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100a35760003560e01c8063715018a611610076578063b1b957241161005b578063b1b9572414610118578063f2fde38b1461014b578063fcdcdeee1461015e57600080fd5b8063715018a6146100eb5780638da5cb5b146100f357600080fd5b80631a34fe81146100a857806354ba0f27146100c45780635bdfab88146100d95780635df0d4fa146100e2575b600080fd5b6100b160035481565b6040519081526020015b60405180910390f35b6100d76100d23660046106bc565b610171565b005b6100b160045481565b6100b160025481565b6100d76103a4565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100bb565b61013b6101263660046106bc565b60056020526000908152604090205460ff1681565b60405190151581526020016100bb565b6100d76101593660046106bc565b6103b8565b600154610100906001600160a01b031681565b610179610448565b6001600160a01b03811660009081526005602052604090205460ff161561020c5760405162461bcd60e51b8152602060048201526024808201527f546f6b656e20616c7265616479206d696e74656420746f20746869732061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b600154600480546040517f3c65b3eb000000000000000000000000000000000000000000000000000000008152918201526000916001600160a01b031690633c65b3eb906024016020604051808303816000875af1158015610272573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061029691906106ec565b6002805491925060006102a88361071b565b91905055506102b6816104a2565b6001600160a01b03828116600081815260056020526040808220805460ff191660019081179091555490517fbe45fd620000000000000000000000000000000000000000000000000000000081526004810193909352602483018590526060604484015260648301919091529091169063be45fd62906084016020604051808303816000875af115801561034e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103729190610734565b50604051339082907f3a5398bda6f1f57d6c96834fa9bf02b5517bdc847d14312015a917ba421c31c990600090a35050565b6103ac610448565b6103b66000610517565b565b6103c0610448565b6001600160a01b03811661043c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610203565b61044581610517565b50565b6000546001600160a01b031633146103b65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610203565b6001546002546001600160a01b039091169063290e008c9083906104c59061057f565b6040518363ffffffff1660e01b81526004016104e2929190610756565b600060405180830381600087803b1580156104fc57600080fd5b505af1158015610510573d6000803e3d6000fd5b5050505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060816000036105c257505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b81156105ec57806105d68161071b565b91506105e59050600a836107c2565b91506105c6565b60008167ffffffffffffffff811115610607576106076107d6565b6040519080825280601f01601f191660200182016040528015610631576020820181803683370190505b5090505b84156106b4576106466001836107ec565b9150610653600a86610805565b61065e906030610819565b60f81b8183815181106106735761067361082c565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506106ad600a866107c2565b9450610635565b949350505050565b6000602082840312156106ce57600080fd5b81356001600160a01b03811681146106e557600080fd5b9392505050565b6000602082840312156106fe57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60006001820161072d5761072d610705565b5060010190565b60006020828403121561074657600080fd5b815180151581146106e557600080fd5b82815260006020604081840152835180604085015260005b8181101561078a5785810183015185820160600152820161076e565b506000606082860101526060601f19601f830116850101925050509392505050565b634e487b7160e01b600052601260045260246000fd5b6000826107d1576107d16107ac565b500490565b634e487b7160e01b600052604160045260246000fd5b818103818111156107ff576107ff610705565b92915050565b600082610814576108146107ac565b500690565b808201808211156107ff576107ff610705565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220602297b79efbc112d7f6a766ba690dceb66f36f6ed26d38f1156540138df7ebc64736f6c63430008100033