Example Mint Function

Here is an example mint function on Ethereum that works well with NFTpay

  function purchase(uint256 num) public payable {
        uint256 supply = totalSupply();
        require( num < 21,                              "You can purchase a maximum of 20 NFTs" );
        require( supply + num < 10000 - _reserved,      "Exceeds maximum NFTs supply" );
        require( msg.value >= _price * num,             "Ether sent is not correct" );

        for(uint256 i; i < num; i++){
            _safeMint( msg.sender, supply + i );
        }
    }

Last updated