TokenScript-Examples icon indicating copy to clipboard operation
TokenScript-Examples copied to clipboard

Handling a token contract which has been migrated/replaced (like DAI->SAI, or TUSD)

Open hboon opened this issue 5 years ago • 2 comments

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).

hboon avatar Jun 01 '20 07:06 hboon

Weiwu commented:

  1. 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.
  2. if old_balance is greater than a certain value, make a selection called "migration-needed", which enables the 'migration' action.
  3. 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.

hboon avatar Jul 30 '20 08:07 hboon

I should provide an example implementation on how to handle migration.

SmartLayer avatar Jul 30 '20 08:07 SmartLayer