Common Functions
Last updated
Was this helpful?
Last updated
Was this helpful?
Common functions include code found in both ERC721 and ERC1155 Creator Contracts. These functions exist for either ERC721 or ERC1155 implementations. Implementation details can be found in the following smart contract files:
Functions for adding and removing contract admins and transferring contract ownership. Admin controls are implemented via .
Functions for querying or setting royalties on a contract or specific token.
Set the address of a contract that implements the approveTransfer
function of and/or . If configured, it will call the contract's approveTransfer function to see whether or not a token can be transferred as long as
This functionality is useful if you want to enforce on transfer rules, such as the .
Set to the 0x0000000000000000000000000000000000000000
address to disable.
Transfers ownership of a specific NFT from one address to another. When using safeTransferFrom the token contract checks to see that the receiver address is an , which implies that it knows how to handle ERC721 tokens (unlike the standard transferFrom function).
When implementing transfers within your contracts its best practice to always use the safeTransferFrom function (rather than transferFrom) to ensure events set to trigger upon retrieval are successful (ensures receiver knows how to handle the tokens it is about to receive as an or Receiver).
Metadata functions can add or modify a Token's URI, or Uniform Resource Identifier. This URI specifies the endpoint with information representing the NFT including its media and attributes, conforming to the . This JSON is often hosted on decentralized protocols like , like we use within Manifold Studio.
Gets royalty recipients for a given tokenId. Standard interface identifier for .
Gets royalty percentage (bps) for a given tokenId. Standard interface identifier for . Public function callable by anyone.
The contract's
If the token is minted by an extension, and the extension implements the interface, the royalty for that token as defined by the extension
If the token is minted by an extension, the on the contract for all tokens for that extension
The for the contract for all tokens
Gets royalty configuration (receiver and royalty amount) for a given token provided tokenID and salePrice. Supports the same interface as other marketplace platforms such as Rarible or Foundation (). Public function callable by anyone.