【发布时间】:2022-07-08 03:02:00
【问题描述】:
function mint(uint256 addr, uint256 id) public payable {
require(id < 10000000000, "id invalid");
require(saleActive == true, "Public Sale not active!");
require(msg.value >= mintPrice, "No enough Eth supplied!");
require(availableSupply > 0, "Not enough supply of tokens");
_safeMint(msg.sender, currentID.current());
currentID.increment();
availableSupply = availableSupply - 1;
}
假设我在 ERC721 合约中有这个铸币厂功能。当 saleActive 为 false 时,如何在此函数上使用 eth_estimateGas?换句话说,在销售活动开始之前,我如何估计转移事件的 gas 限制?当我在这个函数上运行 eth_estimateGas 时,我收到一个交易恢复错误,标签为“Public Sale Active!”
【问题讨论】:
标签: javascript ethereum smartcontracts web3js nft