2

Just curious for some background on approveAndCall()

1) Is it initially an ERC223 method ? or is it officially part of the ERC20 interface ?

2) Also Im working with an old contract so Im wondering is there a newer more up to date way of achieving similar functionality but with Solidity ˆ0.5.0

3) And finally probably a dumb question but does adding in approveAndCall() to an existing ERC20 contract break its compatibility with exchanges and what not ? I read online elsewhere that it does as its not officially part of the specification

2 Answers 2

1

To answer your questions

1) approveAndCall is not part of the ERC223 or ERC20 standard. approveAndCall is included in the ERC827 an extension of the ERC20 standard

2) You can check out newer proposals for token standards e.g. ERC827 is compatible with the ERC20 standard

3) approveAndCall would not break compatibility with exchanges as long as the contract implements the required ERC20 interface methods

Also, beware of the implementation of ERC827 as it can make a contract vulnerable to reentrancy attacks

0

Suggest you have a look at ERC777 which allows contracts to react to token transfers. ERC777 is now final and OpenZeppelin 2.3.0 includes an ERC777 implementation.

There is an ongoing discussion in our community forum for lightweight developing standards with approve and call type mechanisms. Come and join the discussion.

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.