mradkov / aeternity-fungible-token

Aeternity blockchain Fungible Token reference implementation. The implementation is based on the proposed AEX9 standard for creating and usage of Sophia smart contract-based fungible tokens.
ISC License
6 stars 13 forks source link

migration to native tokens #23

Closed thepiwo closed 5 years ago

mradkov commented 5 years ago

We should return the int amount of burned tokens, so it's easier for migration paths implementations to get it.

thepiwo commented 5 years ago

IMG_20191118_184057

thepiwo commented 5 years ago

Version 1 (Doesn't support Contract owned tokens)

  1. USER calls Native Token mint
  2. Mint calls swap on AEX-9
  3. AEX-9 burns for Call.origin Account, returns amount burned
  4. Native Token mints tokens based on return value for Call.origin

Version 2 (Supports Contract owned tokens, more complicated)

  1. Contract/User calls AEX-9 swap
  2. AEX-9 burns full amount and keeps track of Call.caller and amount
  3. Contract/User calls Native Token mint
  4. Mint calls check_swap with argument Call.caller on AEX-9
  5. AEX-9 returns amount of tokens for argument account
  6. Native Tokens marks Call.caller as migrated, keeps from migrating more for account
thepiwo commented 5 years ago

We did choose Version 2 to be implemented to have better support for all possible cases