Token migration contract

In the Lima hard-fork the remaining (frozen) Aeternity tokens from the Ethereum ERC20 contract are put into a contract and can be retreived by the entity holding the correct Ethereum private key. This contract is added to chain as part of the hard-fork, and the contract is also funded as part of the hard-fork. Here we describe how we prepare the data (the contracts.json file) that is used during the hard-fork. The .json-file has the following format and constraints (apps/aecore/src/aec_fork_block_settings.erl):

%%% { <API encoded pubkey for contract> : { "amount" : <integer>,
%%%                                         "vm_version" : <integer>,
%%%                                         "abi_version" : <integer>,
%%%                                         "nonce" : <integer>
%%%                                         "code" : <API encoded contract byte array>
%%%                                         "call_data" : <API encoded contract byte array>
%%%                                       }
%%% ...
%%% }
%%%
%%% The locked token account will be the owner of the contracts.
%%% The nonces must correspond to the nonces of the owner account.
%%% The nonces must be consecutive (but not necessarity ordered)
%%% The pubkey of the contract must correspond to the computed pubkey
%%%    (based on owner account and nonce). This is mostly a fail safe to ensure
%%%    that the contract pubkey is visible in the file.

Since this is the first contract to be added by this mechanism, the nonce to be used is 1 and we can compute the contract pubkey using Erlang:

25> Locked = aec_governance:locked_coins_holder_account(), Nonce = 1.
1
26> CtPK = aect_contracts:compute_contract_pubkey(Locked, Nonce).
<<84,180,196,235,185,254,235,68,37,168,101,128,127,111,97,
  136,141,11,134,251,228,200,73,71,175,98,22,115,172,...>>
27> aeser_api_encoder:encode(contract_pubkey, CtPK).
<<"ct_eJhrbPPS4V97VLKEVbSCJFpdA4uyXiZujQyLqMFoYV88TzDe6">>

Then we need to compute the total sum of tokens. The final list of accounts that has not migrated their tokens is in test/json/contracts_accounts.json. The sum of the tokens is:

We also need the root-hash of the Merkle tree (the tree contains all the Ethereum accounts and their respective balances).

Finally we need to compile the contract available HEREarrow-up-right, and the contract init call data:

The resulting data is then:

Last updated

Was this helpful?