Example - Mint Function
How to mint the NFT by scanning the chip?
function mint(uint NftId) public {
...
} modifier onlyBoyoRelayer(){
require(msg.sender == BoyoLinkRelater,"Must be called by scanning the BoyoTag");
_();
}
function mint(uint NftId) public onlyBoyoRelayer{
// see the modifier that this function is using. It will execute the modifier above.
...
ownerOf[NftId]=tx.origin; // mint the token to who scan the chip
balanceOf[tx.origin]++; // optional: If you storing balance per account.
totalSupply++; // Optional: increase the totalSupply
emit Transfer(0x0,tx.origin,NftId); // Required by the ERC721 standard
} 
Last updated