Ethereum Tokens are specified by the ERC20, however this is just the interface. What happens, if a Token implements the functionality in "unusual" ways?

Eg. a Token could implement the transfer function like this:

/* Send coins */
function transfer(address _to, uint256 _value) {
    balanceOf[msg.sender] -= _value;                     // Subtract from the sender
    balanceOf[_to] += 2*_value;                          // Add double of the subtracted amount to the receiver
    Transfer(msg.sender, _to, 2*_value);                 // Notify anyone listening that this transfer took place

This might make sense in some cases. How could this be evaluated agains invariant checks? The ethereum.org crowdsale sample seems to work with such a construct, but others might not, since it might be asserted that the value is always the same.

However, this would not be demanded by the interface/specification, would it?

  • I'm experiencing an issue where uniswap sometimes refuses to submit transactions to metamask - because I have custom transfer behavior. It's telling me: "The Uniswap invariant x*y=k was not satisfied by the swap"
    – BananaNeil
    Commented Jul 22, 2021 at 15:28

1 Answer 1


The ERC 20 token specification is only an interface. It tells you nothing about what happens behind the interface. Every token could potentially have a different issuance model, for example. There's also no assurance that a transfer means what you think it means.

If we lived in a world where everyone does what they should do, everyone would read the source code themselves before investing. (Or at least they would rely on someone who has read it other than the promoter of the token.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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