MintNFT

Git Source

Inherits: NFTBase, IMintNFT, ERC2981, Initializable

State Variables

_characterId

uint256 internal _characterId;

_noteId

uint256 internal _noteId;

_web3Entry

address internal _web3Entry;

_tokenCounter

uint256 internal _tokenCounter;

_originalReceiver

mapping(uint256 => address) internal _originalReceiver;

Functions

onlyWeb3Entry

modifier onlyWeb3Entry();

onlyOwner

modifier onlyOwner();

initialize

Initialize the mint nft.

function initialize(
    uint256 characterId_,
    uint256 noteId_,
    address web3Entry_,
    string calldata name_,
    string calldata symbol_
) external override initializer;

Parameters

NameTypeDescription
characterId_uint256The character ID of the note to initialize.
noteId_uint256The note ID to initialize.
web3Entry_addressThe address of web3Entry contract.
name_stringThe name to set for this NFT.
symbol_stringThe symbol to set for this NFT.

mint

Mints a note NFT to the specified address. This can only be called by web3Entry, and is called upon note.

function mint(address to) external override onlyWeb3Entry returns (uint256 tokenId);

Parameters

NameTypeDescription
toaddressThe address to mint the NFT to.

Returns

NameTypeDescription
tokenIduint256uint256 The minted token ID.

setTokenRoyalty

Changes the royalty percentage of specific token ID for secondary sales. Can only be called by character owner of note.

function setTokenRoyalty(uint256 tokenId, address recipient, uint96 fraction)
    external
    override
    onlyOwner;

Parameters

NameTypeDescription
tokenIduint256The token ID to set.
recipientaddressThe receive address.
fractionuint96The royalty percentage measured in basis points. Each basis point represents 0.01%.

setDefaultRoyalty

Changes the default royalty percentage for secondary sales. Can only be called by character owner of note.

function setDefaultRoyalty(address recipient, uint96 fraction) external override onlyOwner;

Parameters

NameTypeDescription
recipientaddressThe receive address.
fractionuint96The royalty percentage measured in basis points. Each basis point represents 0.01%.

deleteDefaultRoyalty

Deletes the default royalty percentage. Can only be called by character owner of note.

function deleteDefaultRoyalty() external override onlyOwner;

originalReceiver

Returns the original receiver of specified NFT.

function originalReceiver(uint256 tokenId) external view override returns (address);

Returns

NameTypeDescription
<none>addressThe address of original receiver.

getSourceNotePointer

Returns the source note pointer mapped to this note NFT.

function getSourceNotePointer()
    external
    view
    override
    returns (uint256 characterId, uint256 noteId);

Returns

NameTypeDescription
characterIduint256The character ID.
noteIduint256The note ID.

supportsInterface

Query if a contract implements an interface

Interface identification is specified in ERC-165. This function uses less than 30,000 gas.

function supportsInterface(bytes4 interfaceId)
    public
    view
    virtual
    override(ERC2981, ERC721Enumerable)
    returns (bool);

Parameters

NameTypeDescription
interfaceIdbytes4

Returns

NameTypeDescription
<none>booltrue if the contract implements interfaceID and interfaceID is not 0xffffffff, false otherwise

totalSupply

Count NFTs tracked by this contract

function totalSupply() public view override returns (uint256);

Returns

NameTypeDescription
<none>uint256A count of valid NFTs tracked by this contract, where each one of them has an assigned and queryable owner not equal to the zero address

tokenURI

A distinct Uniform Resource Identifier (URI) for a given asset.

Throws if _tokenId is not a valid NFT. URIs are defined in RFC 3986. The URI may point to a JSON file that conforms to the "ERC721 Metadata JSON Schema".

function tokenURI(uint256 tokenId) public view override returns (string memory uri);