0

How is it exactly determined whether a contract is ERC20 compliant and who determines it? After reading Do I have to implement ERC20 signature as separate contract and use inheritance? and some googling, I have some ideas.

1) Who decides whether a contract is ERC20 compliant? Is it just the one who wants to use it (exchange, wallet, ...)?

2) How do you determine whether a contract is ERC20 compliant? My current understanding is that all you need is to have the right function signatures (right function hashes). So it doesn't exactly have to inherit (implement) from an ERC20 interface. Is that correct?

3) If the answer to the second question is "yes", is it ok to add for example payable modifier to some of the functions (as I've understood, it wouldn't change the hash of the function)?

If the answer to question 2 and 3 is "yes", then the following would be a valid implementation of ERC20 standard (assuming the rest of the functions are implemented also):

contract A {
  ...
  function transfer(address to, uint tokens) public payable returns (bool success) {
    ...
  }
  ...
}

2 Answers 2

1

There wasn't a standard to determine if a contract support an interface at the time ERC20 was conceived (*).

Some block explorers and wallets can make verifications, for example for a ERC20 contracts they can verify if the public functions are available and return something useful, ie symbol, name, decimals, etc.

A block explorer that support contract verification can check the ABI for other methods to also be present, ie transfer, approve, etc.

That obviously is not enough, a contract that always throws, return false, or zero (depending on the function) can still comply with the EIP20 standard.

(*) There's now EIP 165 that allows to query a contract for supported interfaces.

3
  • So basically everyone decides for themselves whether they 'accept' something to be ERC20 compliant, right? Apr 13, 2018 at 18:53
  • That is the more common approach, if a contract support the minimum functionality expected of an ERC20 is it considered an ERC20.
    – Ismael
    Apr 14, 2018 at 18:07
  • There's no standard to determine if a contract support an interface. There is in fact ERC-165, github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md Jun 18, 2019 at 23:13
1

To add further information about this issue, need to check if proper events are emitted.

Looking at ABI: https://api.etherscan.io/api?module=contract&action=getabi&address=0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d

The ABI does not show emit'ted events.

So I think the MANUAL PROCESS is required.

Note that some popular ERC20-like tokens such as Binance (pre swap) and Golem are not fully ERC20.

Your Answer

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

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