2

From ERC 677

Motivation
ERC20 requires a multistep process for tokens to be transferred to a contract. First approvemust be called on the token contract, enabling the contract to withdraw the tokens. Next, the contract needs to be informed that it has been approved to withdraw tokens. Finally, the contract has to actually withdraw the tokens, and run any code related to receiving tokens. This process typically takes two to three steps, which is inefficient and a poor user experience.

There have been other proposed solutions to this problem, including: ERC 223 and ERC 777.

This leads the motivation for my question.

Presumably, there are active token contracts that implement any one of these token standards including ERC 20. I want to create a single PaymentReceiver contract that can handle all of these standards and will then call my other contracts on paymentRecieved(address payer, address token, uint amount, bytes data);.

What is the best way to achieve my goal? Is it worth it to support all of the token standards? Can someone point me to contract that already does this?

Thanks

  • To answer your header's question: I'd estimate 90% to be Erc20, 5% Erc721, 5% something else. Although not all of those erc20 are fully erc20 compatible. – Lauri Peltonen Jun 20 at 18:42
  • Thanks! How did you come up with your estimate? – Moshe Stauber Jun 20 at 18:54
  • An educated guess. – Lauri Peltonen Jun 21 at 15:38
  • @LauriPeltonen What say you of my research? – Moshe Stauber Jun 24 at 5:38
2

Alright, y'all are lazy so I did it myself. This is a super rough estimate.

Here's a gist of my script to get all the function names in the top 1000 'verified contracts' on etherscan.

The script downloads the abis for all the top contracts and checks for the existence of functions with the names in the following list: ['transfer(with bytes)', 'transferandcall', 'approveandcall', 'operatorsend']

This covers erc223, erc677, erc 777 and non-standard approveAndCall. I'm not sure of all the other standards.

Results:

  • non-standard - approveandcall, Count: 180
  • erc223 - transferwithbytes, Count: 31
  • erc677 - transferandcall, Count: 12

Contracts implementing each standard
Raw function count for top 1000 contracts


UPDATE:

Modified the scripts a bit (updated the gists too). I did minimal checking for erc20 compatibility, looking for approve and transferFrom in the same contract.

Results:

  • erc20compatible: 887
  • non-standard - approveandcall: 180
  • erc223 - transferwithbytes: 31
  • erc677 - transferandcall: 12

179 approveandcall tokens are erc20compatible
Scanned 909 contracts

  • 1
    Interesting result. I would imagine that most of those 180 are erc20. Too bad you didn't check for those. – Lauri Peltonen Jun 24 at 5:39
  • 1
    @LauriPeltonen Looks like you were right. Thanks for your help – Moshe Stauber Jun 25 at 23:38

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.