1

Is it possible to create a token contract that pays a tiny transaction fee in the ERC20 token to a third party?

This transaction fee has nothing to do with the ETH fees which will be paid first and foremost. This is a tiny fee on every transaction paid by the receiver at the time of the payment, like a credit card transaction fee off the top of the token value coming into the receiver's wallet.

Can a tiny part of each payment be diverted to a central account?

Let's just say as an example:

1% of each payment is skimmed off the top of each payment and sent or collected into a central wallet. Is this possible?? (this is not related to the ETH transaction fee)

  • Yes, just take 1% of ETH sent and send it to the "central account". By the way, format your post, it is quite hard (at least for non english native speaker like me) to understand, because you just put everything in one paragraph. Press "enter" ;) – Florian Castelain Nov 17 '17 at 1:16
  • Thank you for the response, but that is not what I'm asking. We need 1% of the token skimmed, not the ETH, we don't want ETH, this is in addition to the ETH transaction fee. – digitalcurrency Nov 17 '17 at 2:20
  • Then just take 1% of the token (if it has enough decimals, of course) – Florian Castelain Nov 17 '17 at 5:42
2

Yes. That's pretty possible. It depends on the code of your smart contract. You can have a function that transfers 1% of the fee to a central account. You can have a function like this:

function transfer(address _to, uint256 _value) {
        require(_value%100 == 0);
        uint fee = _value/100; // for 1% fee
        require (balanceOf[msg.sender] > _value) ;                          // Check if the sender has enough balance
        require (balanceOf[_to] + _value > balanceOf[_to]);                // Check for overflows
        balanceOf[msg.sender] -= _value;                                    // Subtract from the sender
        balanceOf[_to] += (_value-fee);                                           // Add the same to the recipient
        balanceOf[thirdPartyAddress] += value;
    }
  • Thank you. To clarify, I send 100 tokens to another user, 99 tokens arrive in his wallet and 1 token is routed to a central third-party wallet that just collects fees. Thank you, Prashant Prabhakar Singh for your code example. – digitalcurrency Nov 17 '17 at 19:47
  • Yeah, exactly same will happen. Do test this. Cheers :) – Prashant Prabhakar Singh Nov 17 '17 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.