If you want to let your contract interact with an other contract, you have to know the functions before actually finishing your contract. So for example in order to one contract be able to transfer and own tokens of an other contract, that one contract has to have the transfer(), transferFrom() etc. functions in it (it's called interface). Due to this fact, there have been standards being established so that contracts keep a fixed pattern. Otherwise, if for example one contract uses transfer(), the other transferTokens(), the other send(), then one giveTokens() etc. it would not be possible to easily communicate for example for a DEX. But with standards it's easy since the DEX knows that each token follows the same pattern. However, it does not ensure that tokens do what they have to do. Scam tokens could use the transfer() to only transfer to themself (the owner) etc. Only the function name has to exist, what's inside is decided by the owners.

Dec 8, 2020, 3:18 PM

© 2024 Draquery.com All rights reserved.