繁体   English   中英

合约创建者的 Solidity NFT 铸造费?

[英]Solidity NFT Minting Fees to Contract Creator?

我目前正在尝试在 Solidity 中编写 ERC721 智能合约,允许用户从中铸造。 但是对于每一个铸币厂,我都希望用户向指定的钱包支付费用。 我怎样才能做到这一点? 非常感谢任何帮助,在此先感谢!

首先,您将 de 变量声明为应付地址,您将在其中存储将接收费用的地址,然后在构造函数中将地址作为参数接收并将其存储在您之前定义的变量中

您必须使铸币厂 function 应付,然后在铸币厂 function 内部像这样require(msg.value == mintfee, "some error message in case the ether is not the especified amount"); 或者如果你想输入一个最小值而不是一个确切的数量require(msg.value >= mintfee, "some error message in case the ether is not the especified amount"); , 现在你可以像这样支付费用了

(bool result,) = variableWhereYouStoreTheAddress.call{value:msg.value}("");
revert(result,"the fees payment has failed");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM