EIP-7492: Spendable ERC-20

Hi @radek!

The two most similar EIPs are ERC-777 and ERC-677.

For a long time ERC-777 was seen as the natural successor to ERC-20. ERC-677 is the transferAndCall standard developed by chainlink.

Soooo, how does EIP-7942 compare?

ERC-777 (ERC-777: Token Standard): ERC-777 introduces hooks into fungible tokens, allowing ERC-777s to take actions when tokens are received, just like EIP-7492. But it’s adoption has been held back because:

  1. So much infra already supports the ERC-20 interface (ERC-777 has send rather than transfer for example). This means that moving everything from ERC-20 to ERC-777 is a heavy lift.
  2. Hooks are great, but they make the token re-entrant. If people just post ERC-20 functions to ERC-777s you can bet we will see re-entrancy issues.

The hooks in EIP-7492 operate in a similar way, but the developer can make a choice to use them. To use the hooks you need to be making use of the spend method. You will have access to the current ERC-20 transfer, which not only cannot be re-entered, gives backwards compatibility.

You have the best of both worlds: full ERC-20 compatibility, a non-reentrant transfer method, and hooks on the spend method.

ERC-677 (https://github.com/ethereum/EIPs/issues/677). Other than use in chainlink, I can’t find many examples of this being used. Indeed, even the transferAndCall method is less used now, with the advent of chainlink v2 and subscription contracts.

The functionality here is similar to EIP-7492, but EIP-7492 is clearer about how data is passed back up the call stack. ERC-677 is really about one-way traffic, wherever EIP-7492 envisages actions in the called contract hook, and indeed in the caller (through _handleReceipt) if required.

Thanks for asking, I really appreciated it!