Mint pattern requirements
You can choose this pattern to allow your users to mint items at claim
This option is suitable for advances users who can create their NFTs deploying their own contract.
This way, when you will use the contract that follows the requirements below and select "Mint" pattern when setting up a campaign, your NFTs will not be pre-minted, but can be minted at claim, when user will follow the claim link.
In order to be able to use the “mint at claim” pattern the NFT contract in addition to standard ERC721/1155 ABIs, contracts should have the functions based on OpenZeppelin Access pattern (https://wizard.openzeppelin.com/#erc721).
interface IERC721Mintable {
function safeMint(address to) external; // increments token ID for each minted token incrementally starting from 1
function grantRole(bytes32 role, address account) external;
function hasRole(bytes32 role, address account) public view returns (bool)
}
Please note that
safeMint
function doesn’t have tokenURI
parameter, so metadata for ERC721 tokens should be uploaded to all tokens in advance and tokenURI
function should automatically compute metadata URL by concatenating baseURI
and `tokenId together.You can see an example ERC721 Mintable Contract implementation here -https://polygonscan.com/address/0xc5271d9Df75c0FBE241730F2Fbc9e2480359Cf77#codeinterface IERC1155Mintable {
function mintTo(address account, uint256 id, string calldata tokenURI, uint256 amount) external;
function grantRole(bytes32 role, address account) external;
function hasRole(bytes32 role, address account) public view returns (bool)
}
When claiming ERC1155 token, Linkdrop Escrow contract will call the NFT contract's
mintTo
function and empty string will be passed as tokenURI.
Metadata for each token id should be prepared before claim by minting 0 tokens and passing correct tokenURI for that token id. The NFT contract should respect that logic, please refer to the Thirdweb ERC1155 implementation to learn more. safeMint
for ERC721 and mint
for ERC1155 contracts should both respect MINTER_ROLE, which is computed the following way:
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
Last modified 1mo ago