Prepare your collection

Requirements

We only accept NFT collections that have these requirements for the mint method:

  • mandatory recipient parameter: our system sign the transaction and must be able to specify the final recipient (end user)

  • must accept USDC for payment

  • must transfer the whole amount of USDC from the sender to the contract in the mint transaction

Accept token as payment

A basic mint function looks like:

contract NFT is ERC721, PullPayment, Ownable {

  uint256 private _nextTokenId;
  Counters.Counter private currentTokenId;

  constructor() ERC721("MyNFT", "NFT") {}

  function mintTo(address to) public payable {
    uint256 tokenId = _nextTokenId++;
    _safeMint(to, tokenId);
 }

}

To accept USDC as payment in our contract, you must transfer the exact amount in USDC to the contract from the wallet calling the mint function. You can do it by:

  1. Set the amount in USDC and the USDC contract address in the contract: you can find USDC address for each supported network here <link to ressources/USDC contracts>

  2. Make the transfer in mint function, with the exact amount from the sender to the contract. We only allow transfer of the exact amount from our account to the smart contract, any other value will cause the transaction to fail.

In the following exemple we also transfer the amount to the owner of the smart contract.

contract MyNFT is ERC721, ERC721Burnable {

  uint256 private _nextTokenId;
  address public owner;
  IERC20 public immutable usdc;
  uint256 public immutable price;
  using SafeERC20 for IERC20;

  constructor(address _usdc, uint256 _price) ERC721("MyNFT", "NFT") {
    owner = msg.sender;
    
    
  }

  function mint(address to) public {
    
    
    uint256 tokenId = _nextTokenId++;
    _safeMint(to, tokenId);
  }
  
}

Last updated