ERC-20 – Understanding Token Contract Address Changes

erc-20

I'm making a mobile wallet to send and receive ERC20 tokens, I finished with the code to Send and Receive, but I don't know what to do if a Token Contract Address changes, what happen if somebody have BAT (for example) and they change de address, do I need to do something? thanks.

Best Answer

A contract cannot change its address. Token contracts are not an exception.

In practice, a token author may issue a new contract. In such a case, it is always a migration from the old contract to the new, so you have two contracts - the old token and the new token.

You could treat those as separate assets because technically that's what they are. Some user assistance at the UI level is not inconceivable. You might, for example, think of your catalogue of known popular tokens (if there is such a thing) with a version-wise awareness. e.g. TOKv1 @ 0x123... and TOKv2 @ 0x456.

When a token author commences with the unfortunate process of migrating users, users themselves are generally required to trade their V1 tokens for V2 - a process that can be orchestrated via a smart contract. You could consider a friendly user-facing UI to help with that but I think it would need to be flexibly configured on your side to deal with case-by-case implementations as there is no standardized interface (that I know of) for such an exchange contract.

Hope it helps.

Related Topic