ERC721 NFT deployment with limited supply
The capped meta-transaction smart contract template for single-copy Non Fungible Tokens (NFT). In a video game, you can sell an NFT and pay for gas in place of the NFT receiver. Within this standard, the token is linked to its owner's address and to the URI (Unique Resource Identifier) which references the NFT content.
This version enables you to send transactions on behalf of your users so they can use their NFT without having to pay for gas fees. In contrast to the standard version of meta-transaction where you can mint infinite amount of NFTS, here you can set a maximum limit to the supply of NFTs.
It also includes another feature which is called blacklist. It allows the owner to blacklist one or more addresses to transfer tokens on behalf of your users for example if you want to block sales happening in a marketplace.
Notice that we do not store any content in the smart contract. Smart contract store only references. It is up to smart contract readers to find the content using references.
Starton provides an IPFS integration in case you need to host your NFT content.
Parameters
- definitiveName: The name of your smart contract which will be reflected on-chain.
- definitiveSymbol: The symbol associated with the NFT or its collection.
- definitiveMaxSupply: The maximum number of NFT that can be minted.
- initialBaseTokenUri: Will be used to concatenate NFT URIs :
- Using IPFS:
ipfs://ipfs/
- Using a centralised server:
https://yourapi.com/endpoint/
- Using IPFS:
- initialContractUri: The URI of the metadata that will be used to give more details about the description.
- initialOwnerOrMultisigContract: The address that will own the NFT Collection.
Functions
Function | Input Parameters | Description |
---|---|---|
PAUSER_ROLE | None | Returns the value of the pauser role. |
MINTER_ROLE | None | Returns the value of the minter role. |
LOCKER_ROLE | None | Returns the value of the locker role. |
METADATA_ROLE | None | Returns the value of the metadata role. |
DEFAULT_ADMIN_ROLE | None | Returns the address of the admin role. |
pause | None | Called to pause by address with a pauser role, disables every variable state changes of the contract. |
paused | None | Returns true when the contract is paused. Returns false otherwise. |
unpause | None | Called to unpause by address with a pauser role. |
executeMetaTransaction | (address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV) | Executes a transaction on behalf of another user by providing their address, the function to call and the signature of the transaction. |
getDomainSeparator | None | Returns the domain separator according to the EIP712. |
getChainId | None | Returns the chain id according to the EIP712. |
supportsInterface | (bytes4 interfaceID) | Returns true if the contract implements the specified interface. |
hasRole | (bytes32 role, address account) | Returns true if the address specified has been granted the role. |
getRoleAdmin | (bytes32 role) | Returns the role that can control the specified role. |
grantRole | (bytes32 role, address account) | Grants a role to the address specified. |
revokeRole | (bytes32 role, address account) | Removes a role from an address. |
renounceRole | (bytes32 role, address account) | Removes a role from an address. The address must be the caller address. |
burn | (address, uint256 amount) | Erases a specified amount of token. |
name | None | Returns the descriptive name of the smart contract. |
symbol | None | Returns the symbol set for this contract. |
totalSupply | None | Returns the total amount of tokens. |
safeTransferFrom | (address from, address to, uint256 tokenId) | Returns true when the transfer of the token has been successful to the specified address. Notice that the spender must be either way the owner or have the approval to transfer this token. |
safeTransferFrom | (address from, address to, uint256 tokenId, bytes memory data) | Returns true when the transfer of the token has been successful to the specified address. Notice that the spender must be either way the owner or have the approval to transfer this token. |
transferFrom | (address from, address to, uint256 tokenId) | Returns true when the transfer of the token has been successful to the specified address. Notice that the spender must be either way the owner or have the approval to transfer this token. Opposite to sateTransferFrom, it doesn’t check that the to address can receive the token. |
approve | (address to, uint256 tokenId) | Approve the spending of the token to a certain address. |
balanceOf | (address owner) | Returns the amount of tokens owned by the owner. |
ownerOf | (uint256 tokenId) | Returns the address that own the token. |
tokenURI | (uint256 tokenId) | Returns the URI for a token. |
getApproved | (uint256 tokenId) | Returns the address that has been approved to transfer this token. |
setApprovalForAll | (address operator, bool approved) | Set the approval of all tokens owned to a true or false that a operator can transfer. |
isApprovedForAll | (address owner, address operator) | Returns true if the operator can transfer all the tokens owned by owner. |
tokenOfOwnerByIndex | (address owner, uint256 tokenId) | Returns the nth tokens minted by a specified address. |
tokenByIndex | (uint256 index) | Returns the token id of the nth token minted. |
maxSupply | None | Returns the max amount of tokens that can ever be minted. |
contractURI | None | Returns a public URL that contains the metadata of the collection |
lockMint | None | Revokes the ability to mint. Sender must have the LOCKER_ROLE. |
lockMetadata | None | Revokes the ability to change metadata. Sender must have the LOCKER_ROLE. |
mint | (address to, string memory uri) | Mint a new token with the given URI. |
setContractURI | (string memory newContractURI) | Change the contract URI to a new URI. |
setBaseTokenURI | (string memory newBaseTokenURI) | Change the base token URI to a new URI. |