Purpose of token standard interfaces when implement smart contract

1

I am studying to write smart contract and see that there are some token standards such as ERC20. My question is: what is the purpose of those standards ? Why do we need to add those interface to our code rather than just implement "some" functions that we need.

Thanks

hqt

Posted 2018-03-24T19:21:12.240

Reputation: 115

Answers

3

It's a standard.

ALL those ERC20 based tokens have (at least) the same attribute names, the same method names.

So I do automaticly know that I need to call the method "transfer" when I want to transfer my tokens. No one would name it "transfer_tokens_hello_world". Irrelevant which of the thousands of token I want to transfer: It's always the same method.

The advantage for exchanges and/or user interfaces is that it's really easy to implement. If an exchange list token A and B, then token C has the same structure and it's easy to implement it, too.

ndsvw

Posted 2018-03-24T19:21:12.240

Reputation: 1 947

Thanks. In case exchange tokens, I have 2 points that I don't understand: 1. Who decide transfer rate between 2 different tokens. 2. Why does ERC20 support exchange token ? thanks.hqt 2018-03-24T20:13:23.097