Search code examples
transactionsblockchainethereumsmartcontracts

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.


Solution

    1. Smart contract cannot ask users to get tokens or eth, you should program your DApp or Front End for asking transaction fee.
    2. you can set something like require(msg.value==transactionFee) followed by payable(AddressToCollectFees).transfer(msg.value) in the function of smart contract