简体   繁体   English

如何使用 Remix 使 ERC20 智能合约要求以太币作为交易费用

[英]How to make ERC20 smart contracts ask for ether as transaction fee using Remix

please am a newbie in solidity I have been trying to make the transfer not to work if the wallet holding the token does not transfer ether to an address i will specify in my code thanks in advance.如果持有令牌的钱包没有将以太币转移到我将在我的代码中指定的地址,我一直在尝试使转移不起作用,我将在我的代码中指定。

  1. Smart contract cannot ask users to get tokens or eth, you should program your DApp or Front End for asking transaction fee.智能合约不能要求用户获取代币或以太币,你应该对你的 DApp 或前端进行编程以收取交易费用。
  2. you can set something like require(msg.value==transactionFee) followed by payable(AddressToCollectFees).transfer(msg.value) in the function of smart contract您可以在智能合约的 function 中设置类似require(msg.value==transactionFee)后跟payable(AddressToCollectFees).transfer(msg.value)的内容

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

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