Easiest way to store the message on blockchain is to emit an event. Event is permanently stored and publicly readable.
MintMessage
event outside the mint()
function. I don't recommend expanding the default Transfer
event that is used during minting, because external tools (such as Etherscan) might ignore the non-standard event and not show minted tokens as a result.mint()
functionMintMessage
event within the mint()
functionevent MintMessage(string message);
function mint(address to, string message) public virtual {
// keep the rest of your function as is
// add a new line emiting the event to the end of the function
emit MintMessage(message);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.