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.

1 Answer 1


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.

  • Thanks Rob, great explanation!! If i like to provide the token migration/trade feature do I need to keep the old version(contract id)? or do I only need the target ContratId? and do I need to pay fees for the trade? thanks again.
    – Carlos C
    Commented Aug 1, 2019 at 19:35
  • To my knowledge, there is no standard way to handle it, so you will be challenged to generalize the interface. To give you an idea of how it might be implemented - consider an escrow contract with knowledge of NewToken and OldToken. It holds a balance of NewToken that it trades for OldTokens. So, a configured wallet would see the balance in OldToken go to zero after sending them all to a function in the Escrow. The wallet would also see NewTokens arrive. So, I think you would need the original token, the new token, and conversion contract/function. The latter element isn't standardized. Commented Aug 2, 2019 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.