0

ERC20 defines contract signature for contract in order for them to be accepted by wallets, exchanges etc.

I have seen that for some reason, even when signature contract (interface/abstract contract) is not reused, token contract inherits from contracts that has this signature. Typically those interfaces have name like ERC20.

I have hard time to understand why they do that. If my token contract is the only source of ERC20 signature, meaning, I'm not using any interface or other contract that token contract inherits form, will that mean I will still comply wallets and exchange networks? I do not know how third party applications manages that, but I think my contract should be valid.

1 Answer 1

1

I have seen that for some reason, even when signature contract (interface/abstract contract) is not reused, token contract inherits from contracts that has this signature. Typically those interfaces have name like ERC20. I have hard time to understand why they do that.

First off,ERC20 is standard that was proposed as an EIP https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md

According to the proposal,every ERC20-contract is recommended(not mandatory) to implement functions from standard interfaces.The link gives you the motivation or purpose to have such interfaces.

You might ask why would you need to have an interface but instead have the methods/functions directly defined in contract ?

If you prefer the later you are tightly coupling the contract and storage. Interfaces are one way to have loosely coupled system, i.e contract and its storage.

Links to benefits of having functions of contracts via interfaces :

https://blog.colony.io/writing-upgradeable-contracts-in-solidity-6743f0eecc88

https://medium.com/@nrchandan/interfaces-make-your-solidity-contracts-upgradeable-74cd1646a717

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.