【发布时间】:2021-04-30 18:18:58
【问题描述】:
在代码中的什么位置以及向我的 ERC20 智能合约添加法律措辞的正确方法是什么?
我见过一些示例,它保存在变量中,然后使用 memory 在函数体中引用该变量值。
即
contract MyToken is ERC20, Ownable {
string public processNumber = "0041518-41.1982.8.26.0053";
string public legalBinding = "a lot, a lot of verbiage would go here";
constructor() ERC20("MyToken", "MTK") {
_mint(msg.sender, 9000000 * 10 ** decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
function setProcessNumber (string memory v) public onlyOwner() {
processNumber = v;
}
function setLegalBinding (string memory v) public onlyOwner() {
legalBinding = v;
}
}
最后这两个函数是做什么的,它是被执行还是只是保存在内存中?
这是正确的做法吗?
有更好的方法吗?
开发人员通常会在代码中的什么位置添加此类信息?
如果我要保存包含所有法律用语的大量文本字符串。在 variable 上,我可以使用反引号将它们保存在模板文字上,以利用字符串内的多个换行符等吗?
【问题讨论】:
标签: ethereum solidity remix erc20 binance-smart-chain