簡體   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