From c976212bfc1a0612757ad7dc899a7d60a0ce9799 Mon Sep 17 00:00:00 2001 From: Max <82761650+MaxMustermann2@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:17:26 +0530 Subject: [PATCH] feat(generate): support native asset (#103) * feat(generate): support native asset Add the native asset to `x/assets` and `x/dogfood` parameters * fix(generate): add native chain --- script/generate.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/script/generate.js b/script/generate.js index ec7328d3..9b680cc5 100644 --- a/script/generate.js +++ b/script/generate.js @@ -20,6 +20,25 @@ const tokenMetaInfos = [ const tokenNamesForOracle = [ 'ETH', 'wstETH' // not case sensitive ] +const nativeChain = { + "name": "Exocore", + "meta_info": "The (native) Exocore chain", + "finalization_blocks": 10, + "layer_zero_chain_id": 0, // virtual chain + "address_length": 20, +} +const nativeAsset = { + "asset_basic_info": { + "name": "Native EXO token", + "symbol": "exo", + "address": "0x0000000000000000000000000000000000000000", + "decimals": "18", + "layer_zero_chain_id": nativeChain.layer_zero_chain_id, + "exocore_chain_index": "1", + "meta_info": "EXO native to the Exocore chain", + }, + "staking_total_amount": "0" +}; const exocoreBech32Prefix = 'exo'; @@ -658,6 +677,15 @@ async function updateGenesisFile() { genesisJSON.app_state.delegation.delegation_states = delegation_states; genesisJSON.app_state.delegation.stakers_by_operator = stakers_by_operator; + // add the native chain and at the end so that count-related issues don't arise. + genesisJSON.app_state.assets.client_chains.push(nativeChain); + genesisJSON.app_state.assets.tokens.push(nativeAsset); + // TODO: copy the staking data over from the previous genesis, if any. + genesisJSON.app_state.dogfood.params.asset_ids.push( + nativeAsset.asset_basic_info.address.toLowerCase() + '_0x' + + nativeAsset.asset_basic_info.layer_zero_chain_id.toString(16) + ); + await fs.writeFile(RESULT_GENESIS_FILE_PATH, JSONbig.stringify(genesisJSON, null, 2)); console.log('Genesis file updated successfully.'); } catch (error) {