Handling a token contract which has been migrated/replaced (like DAI->SAI, or TUSD)
Tomek reports that he sees 2 TUSD tokens with the same balance in his wallet. This is happening because they have migrated their contract:
https://etherscan.io/address/0x8dd5fbCe2F6a956C3022bA3663759011Dd51e73E https://etherscan.io/address/0x0000000000085d4780B73119b644AE5ecd22b376
This is just a placeholder so we don't forget about the problem. Some design is needed.
eg:
We can have a simple fix like storing a list of such contract pairs where 1 is replaced by the other and display the old version slightly differently ("legacy" or a bit of generic explanation text). We can't just hide the tokens automatically since the user might want/need to migrate manually (like DAI/SAI).
Weiwu commented:
- have 1 tokenscript that has 2 contracts in it, one is used for displaying balance and the other used to get an attribute called old_balance.
- if old_balance is greater than a certain value, make a selection called "migration-needed", which enables the 'migration' action.
- make the item view and token view both have a status icon or flash or in red colour if old_balance is greater than a certain value.
I should provide an example implementation on how to handle migration.