From b640f83791f4b4bbdafc2373e767a98c786aba66 Mon Sep 17 00:00:00 2001 From: fewensa Date: Tue, 4 Jun 2024 03:48:24 +0000 Subject: [PATCH 1/9] Add definition --- conf/additional.base.yml | 47 +++++ conf/additional.prod.yml | 6 + conf/additional.test.yml | 6 + conf/definition.yml | 420 +++++++++++++++++++++++++++++++++++++++ conf/template.yml | 45 +++++ 5 files changed, 524 insertions(+) create mode 100644 conf/additional.base.yml create mode 100644 conf/additional.prod.yml create mode 100644 conf/additional.test.yml create mode 100644 conf/definition.yml create mode 100644 conf/template.yml diff --git a/conf/additional.base.yml b/conf/additional.base.yml new file mode 100644 index 0000000..bebb0fa --- /dev/null +++ b/conf/additional.base.yml @@ -0,0 +1,47 @@ + +apollo: + lnv2: + arbitrum: + tokens: + ring: + remoteInfos: + ethereum: + protocolFee: '100000000000000000000' + bridgeType: opposite + channel: arbitrum-l2 + + lnv3: + arbitrum: + # url: https://polygon-bor-rpc.publicnode.com + level0Indexer: 'thegraph' + tokens: + ring: + - protocolFee: 30000000000000000000 + # outerAddress: '0x9e523234D36973f9e38642886197D023C88e307e' + usdt: + - protocolFee: 100000 + eth: + - protocolFee: 10000000000000 + channels: + - chain: polygon + channel: layerzero + - chain: bsc + channel: layerzero + - chain: linea + channel: layerzero + - chain: op + channel: layerzero + - chain: gnosis + channel: layerzero + - chain: mantle + channel: layerzero + - chain: scroll + channel: layerzero + - chain: darwinia-dvm + channel: msgline + - chain: blast + channel: layerzero + - chain: astar-zkevm + channel: layerzero + - chain: moonbeam + channel: layerzero diff --git a/conf/additional.prod.yml b/conf/additional.prod.yml new file mode 100644 index 0000000..fcd986a --- /dev/null +++ b/conf/additional.prod.yml @@ -0,0 +1,6 @@ + +apollo: + lnv2: + arbitrum: + defaultEndpoint: https://api.studio.thegraph.com/query/59403/lndefault-arbitrum/v2.0.0 + oppositeEndpoint: https://api.studio.thegraph.com/query/59403/lnopposite-arbitrum/v2.0.0 diff --git a/conf/additional.test.yml b/conf/additional.test.yml new file mode 100644 index 0000000..55702f8 --- /dev/null +++ b/conf/additional.test.yml @@ -0,0 +1,6 @@ + +apollo: + lnv2: + arbitrum: + defaultEndpoint: https://api.studio.thegraph.com/query/61328/ln-default-arbisepolia/v1.0.1 + oppositeEndpoint: https://api.studio.thegraph.com/query/61328/ln-opposite-arbisepolia/v1.0.1 diff --git a/conf/definition.yml b/conf/definition.yml new file mode 100644 index 0000000..37d1719 --- /dev/null +++ b/conf/definition.yml @@ -0,0 +1,420 @@ +chain: + mainnets: + - id: 42161 + code: arbitrum + name: Arbitrum + rpcs: + - https://polygon-bor-rpc.publicnode.com + tokens: + - symbol: eth + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: usdt + address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' + decimals: 6 + - symbol: usdc + address: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' + decimals: 6 + - symbol: ring + address: '0x9e523234D36973f9e38642886197D023C88e307e' + decimals: 18 + + - id: 1 + code: ethereum + name: Ethereum + rpcs: + - https://ethereum-rpc.publicnode.com + tokens: + - symbol: ring + address: '0x9469D013805bFfB7D3DEBe5E7839237e535ec483' + decimals: 18 + + - id: 137 + code: polygon + name: Polygon + rpcs: + - https://polygon-bor-rpc.publicnode.com + tokens: + - symbol: ring + address: '0x9C1C23E60B72Bc88a043bf64aFdb16A02540Ae8f' + decimals: 18 + - symbol: usdt + address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' + decimals: 6 + + - id: 46 + code: darwinia-dvm + name: Darwinia + rpcs: + - https://rpc.darwinia.network + tokens: + - symbol: ring + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: crab + address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' + decimals: 18 + - symbol: ahPINK + address: '0x0000000000000000000000000000000000000404' + decimals: 10 + - symbol: ahUSDT + address: '0x0000000000000000000000000000000000000403' + decimals: 6 + + - id: 44 + code: crab-dvm + name: Crab + rpcs: + - https://crab-rpc.darwinia.network + tokens: + - symbol: crab + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: ring + address: '0x273131F7CB50ac002BDd08cA721988731F7e1092' + decimals: 18 + + - id: 5000 + code: mantle + name: Mantle + rpcs: + - https://mantle-rpc.publicnode.com + tokens: + - symbol: usdt + address: '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE' + decimals: 6 + - symbol: usdc + address: '0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9' + decimals: 6 + + - id: 324 + code: zksync + name: zksync + rpcs: + - https://mainnet.era.zksync.io + tokens: + - symbol: usdt + address: '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C' + decimals: 6 + - symbol: usdc + address: '0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4' + decimals: 6 + + - id: 534352 + code: scroll + name: Scroll + rpcs: + - https://scroll-mainnet.public.blastapi.io + tokens: + - symbol: usdt + address: '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df' + decimals: 6 + - symbol: usdc + address: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4' + decimals: 6 + + - id: 56 + code: bsc + name: bsc + rpcs: + - https://bsc-rpc.publicnode.com + tokens: + - symbol: 'usdt' + address: '0x55d398326f99059fF775485246999027B3197955' + decimals: 6 + - symbol: 'usdc' + address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' + decimals: 6 + + - id: 59144 + code: linea + name: Linea + rpcs: + - https://linea.decubate.com + tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + - symbol: 'usdt' + address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93' + + - id: 10 + code: op + name: Op + rpcs: + - https://optimism-rpc.publicnode.com + tokens: + - symbol: 'usdt' + address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + + - id: 100 + code: gnosis + name: Gnosis + rpcs: + - https://gnosis-rpc.publicnode.com + tokens: + - symbol: 'usdt' + address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6' + + - id: 81457 + code: blast + name: Blast + rpcs: + - https://rpc.blastblockchain.com + tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + + - id: 3776 + code: astar-zkevm + name: Astar zkEVM + rpcs: + - https://rpc.startale.com/astar-zkevm + tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + + - id: 1284 + code: moonbeam + name: Moonbeam + rpcs: + - https://moonbeam-rpc.dwellir.com + tokens: + - symbol: 'xcUSDT' + address: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d' + - symbol: 'xcPINK' + address: '0xffffffff30478fafbe935e466da114e14fb3563d' + + testnets: + - id: 421614 + code: arbitrum-sepolia + name: Arbitrum sepolia + rpcs: + - https://public.stackup.sh/api/v1/node/arbitrum-sepolia + tokens: + - symbol: 'usdt' + address: '0x3b8Bb7348D4F581e67E2498574F73e4B9Fc51855' + - symbol: 'usdc' + address: '0x8A87497488073307E1a17e8A12475a94Afcb413f' + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + + - id: 11155111 + code: sepolia + name: Sepolia + rpcs: + - https://ethereum-sepolia-rpc.publicnode.com + tokens: + - symbol: 'usdt' + address: '0x876A4f6eCF13EEb101F9E75FCeF58f19Ff383eEB' + - symbol: 'usdc' + address: '0x0ac58Df0cc3542beC4cDa71B16D06C3cCc39f405' + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + + - id: 300 + code: zksync-sepolia + name: zksync-sepolia + rpcs: + - https://zksync-sepolia.drpc.org + tokens: + - symbol: 'usdt' + address: '0x3350f1ef046e21E052dCbA60Fc575919CCaFEdeb' + - symbol: 'usdc' + address: '0x253adBFE99Fcd096B9b5502753F96CF78D42eaD0' + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + + - id: 167009 + code: taiko-hekla + name: taiko-hekla + rpcs: + - https://rpc.hekla.taiko.xyz + tokens: + - symbol: 'usdt' + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + - symbol: 'usdc' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + + - id: 80085 + code: bera + name: bera + rpcs: + - https://artio.rpc.berachain.com + tokens: + - symbol: 'usdt' + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + - symbol: 'usdc' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + + - id: 2710 + code: morph + name: morph + rpcs: + - https://rpc-testnet.morphl2.io + tokens: + - symbol: 'usdt' + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + - symbol: 'usdc' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + +helix: + bridge: + arbitrum: + lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' + - name: layerzero + address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' + ethereum: + lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' + polygon: + lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' + - name: layerzero + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + + darwinia-dvm: + lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' + + crab-dvm: + lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' + + mantle: + lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: layerzero + address: 0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1 + + zksync: + lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' + lnv2OppositeAddress: null + lnv3Address: null + messagers: + - name: layerzero + address: '0x96892F3EaD26515592Da38432cFABad991BBd69d' + + scroll: + lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: 'layerzero' + address: '0x463d1730a8527ca58d48ef70c7460b9920346567' + + bsc: + lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: 'layerzero' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + + linea: + lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: 'layerzero' + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' + + op: + lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: 'layerzero' + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' + + gnosis: + lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: 'layerzero' + address: '0x3F7DF5866591e7E48D18C8EbeAE61Bc343a63283' + + blast: + lnv2DefaultAddress: null + lnv2OppositeAddress: null + lnv3Address: '0xB180D7DcB5CC161C862aD60442FA37527546cAFC' + messagers: + - name: 'msgline' + address: '0x98982b1685a63596834a05C1288dA7fbF27d684E' + + astar-zkevm: + lnv2DefaultAddress: null + lnv2OppositeAddress: null + lnv3Address: '0xD476650e03a45E70202b0bcAfa04E1513920f83a' + messagers: + - name: 'layerzero' + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' + + moonbeam: + lnv2DefaultAddress: null + lnv2OppositeAddress: null + lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: 'layerzero' + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' + + arbitrum-sepolia: + lnv2DefaultAddress: '0x8429D7Dfd91D6F970ba89fFC005e67D15f1E4739' + lnv2OppositeAddress: '0xbA96d83E2A04c4E50F2D6D7eCA03D70bA2426e5f' + lnv3Address: '0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa' + messagers: [ ] + + sepolia: + lnv2DefaultAddress: '0x8429D7Dfd91D6F970ba89fFC005e67D15f1E4739' + lnv2OppositeAddress: '0xbA96d83E2A04c4E50F2D6D7eCA03D70bA2426e5f' + lnv3Address: '0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa' + messagers: [ ] + + zksync-sepolia: + lnv2DefaultAddress: '0xBe23e871318E49C747CB909AC65aCCFAEAac3a37' + lnv2OppositeAddress: null + lnv3Address: '0xDc55fF59F82AA50D8A4A61dB8CcaDffD26Fb7dD2' + messagers: [ ] + + taiko-hekla: + lnv2DefaultAddress: null + lnv2OppositeAddress: null + lnv3Address: '0xD476650e03a45E70202b0bcAfa04E1513920f83a' + messagers: [ ] + + bera: + lnv2DefaultAddress: null + lnv2OppositeAddress: null + lnv3Address: '0x00e7EFf0826dfCDf2AA5945dFF710B48f4AA7E64' + messagers: [ ] + + morph: + lnv2DefaultAddress: null + lnv2OppositeAddress: null + lnv3Address: '0xD476650e03a45E70202b0bcAfa04E1513920f83a' + messagers: [ ] diff --git a/conf/template.yml b/conf/template.yml new file mode 100644 index 0000000..240053e --- /dev/null +++ b/conf/template.yml @@ -0,0 +1,45 @@ + +apollo: + lnv2: + chainId: '$chain.id' + chainName: '$chain.code' + defaultEndpoint: '$chain.defaultEndpoint' + oppositeEndpoint: '$chain.oppositeEndpoint' + tokens: + $type: 'array' + key: '$token.symbol' + fromSymbol: '$token.symbol' + fromAddress: '$token.address' + decimals: '$token.decimals' + remoteInfos: + $type: 'array' + toChain: '$remote.toChain' + toChainName: '$remote.toChainCode' + toSymbol: '$remote.toSymbol' + toAddress: '$remote.toAddress' + protocolFee: '$remote.protocolFee' + decimals: '$remote.decimals' + bridgeType: '$remote.bridgeType' + channel: '$remote.channel' + + + + lnv3: + chainId: '$chain.id' + chain: '$chain.code' + url: '$chain.url' + level0Indexer: '$chain.level0Indexer' + bridge: 'lnv3' + symbols: + $type: 'array' + key: '$token.symbol' + symbol: '$token.symbol' + address: '$token.address' + outerAddress: '$token.address' + decimals: '$token.decimals' + protocolFee: '$token.protocolFee' + channels: + $type: 'array' + chain: '$channel.chain' + channel: '$channel.channel' + From ad2d52eb2495fb4c40ee7dd6a1bb12a68e3a056c Mon Sep 17 00:00:00 2001 From: fewensa Date: Tue, 4 Jun 2024 03:57:11 +0000 Subject: [PATCH 2/9] add decimals --- conf/definition.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/conf/definition.yml b/conf/definition.yml index 37d1719..47acbd8 100644 --- a/conf/definition.yml +++ b/conf/definition.yml @@ -134,8 +134,10 @@ chain: tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - symbol: 'usdt' address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93' + decimals: 6 - id: 10 code: op @@ -145,8 +147,10 @@ chain: tokens: - symbol: 'usdt' address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' + decimals: 6 - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - id: 100 code: gnosis @@ -156,6 +160,7 @@ chain: tokens: - symbol: 'usdt' address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6' + decimals: 6 - id: 81457 code: blast @@ -165,6 +170,7 @@ chain: tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - id: 3776 code: astar-zkevm @@ -174,6 +180,7 @@ chain: tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - id: 1284 code: moonbeam @@ -183,8 +190,10 @@ chain: tokens: - symbol: 'xcUSDT' address: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d' + decimals: 6 - symbol: 'xcPINK' address: '0xffffffff30478fafbe935e466da114e14fb3563d' + decimals: 10 testnets: - id: 421614 @@ -195,10 +204,13 @@ chain: tokens: - symbol: 'usdt' address: '0x3b8Bb7348D4F581e67E2498574F73e4B9Fc51855' + decimals: 18 - symbol: 'usdc' address: '0x8A87497488073307E1a17e8A12475a94Afcb413f' + decimals: 18 - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - id: 11155111 code: sepolia @@ -208,10 +220,13 @@ chain: tokens: - symbol: 'usdt' address: '0x876A4f6eCF13EEb101F9E75FCeF58f19Ff383eEB' + decimals: 18 - symbol: 'usdc' address: '0x0ac58Df0cc3542beC4cDa71B16D06C3cCc39f405' + decimals: 18 - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - id: 300 code: zksync-sepolia @@ -221,10 +236,13 @@ chain: tokens: - symbol: 'usdt' address: '0x3350f1ef046e21E052dCbA60Fc575919CCaFEdeb' + decimals: 6 - symbol: 'usdc' address: '0x253adBFE99Fcd096B9b5502753F96CF78D42eaD0' + decimals: 6 - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' + decimals: 18 - id: 167009 code: taiko-hekla @@ -234,8 +252,10 @@ chain: tokens: - symbol: 'usdt' address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + decimals: 18 - symbol: 'usdc' address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 - id: 80085 code: bera @@ -245,8 +265,10 @@ chain: tokens: - symbol: 'usdt' address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + decimals: 18 - symbol: 'usdc' address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 - id: 2710 code: morph @@ -256,8 +278,10 @@ chain: tokens: - symbol: 'usdt' address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + decimals: 18 - symbol: 'usdc' address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 helix: bridge: From a9d04b0b782e952c1d56c007d9accd643ed9d1b8 Mon Sep 17 00:00:00 2001 From: fewensa Date: Tue, 4 Jun 2024 04:00:21 +0000 Subject: [PATCH 3/9] rename bridge to chain --- conf/definition.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/definition.yml b/conf/definition.yml index 47acbd8..66cab31 100644 --- a/conf/definition.yml +++ b/conf/definition.yml @@ -284,7 +284,7 @@ chain: decimals: 18 helix: - bridge: + chain: arbitrum: lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' From f575b334a040346f6ba11588eb76306afdff1e0b Mon Sep 17 00:00:00 2001 From: fewensa Date: Wed, 3 Jul 2024 14:58:13 +0000 Subject: [PATCH 4/9] graphql training --- .editorconfig | 9 + .gitignore | 3 + conf/additional.base.yml | 47 --- conf/additional.prod.yml | 6 - conf/additional.test.yml | 6 - conf/definition.yml | 455 +---------------------------- conf/mainnets/arbitrum.yml | 79 +++++ conf/mainnets/astar-zkevm.yml | 9 + conf/mainnets/base.yml | 16 + conf/mainnets/blast.yml | 9 + conf/mainnets/bsc.yml | 37 +++ conf/mainnets/crab.yml | 29 ++ conf/mainnets/darwinia.yml | 44 +++ conf/mainnets/ethereum.yml | 22 ++ conf/mainnets/gnosis.yml | 9 + conf/mainnets/linea.yml | 24 ++ conf/mainnets/mantle.yml | 39 +++ conf/mainnets/moonbeam.yml | 12 + conf/mainnets/optimism.yml | 18 ++ conf/mainnets/polygon.yml | 26 ++ conf/mainnets/scroll.yml | 34 +++ conf/mainnets/zksync.yml | 29 ++ conf/template.yml | 45 --- conf/testnets/arbitrum-sepolia.yml | 49 ++++ conf/testnets/bera.yml | 12 + conf/testnets/morph.yml | 12 + conf/testnets/sepolia.yml | 51 ++++ conf/testnets/taiko-hekla.yml | 12 + conf/testnets/zksync-sepolia.yml | 48 +++ template/lnv2.yml | 23 ++ template/lnv3.yml | 19 ++ 31 files changed, 688 insertions(+), 545 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitignore delete mode 100644 conf/additional.base.yml delete mode 100644 conf/additional.prod.yml delete mode 100644 conf/additional.test.yml create mode 100644 conf/mainnets/arbitrum.yml create mode 100644 conf/mainnets/astar-zkevm.yml create mode 100644 conf/mainnets/base.yml create mode 100644 conf/mainnets/blast.yml create mode 100644 conf/mainnets/bsc.yml create mode 100644 conf/mainnets/crab.yml create mode 100644 conf/mainnets/darwinia.yml create mode 100644 conf/mainnets/ethereum.yml create mode 100644 conf/mainnets/gnosis.yml create mode 100644 conf/mainnets/linea.yml create mode 100644 conf/mainnets/mantle.yml create mode 100644 conf/mainnets/moonbeam.yml create mode 100644 conf/mainnets/optimism.yml create mode 100644 conf/mainnets/polygon.yml create mode 100644 conf/mainnets/scroll.yml create mode 100644 conf/mainnets/zksync.yml delete mode 100644 conf/template.yml create mode 100644 conf/testnets/arbitrum-sepolia.yml create mode 100644 conf/testnets/bera.yml create mode 100644 conf/testnets/morph.yml create mode 100644 conf/testnets/sepolia.yml create mode 100644 conf/testnets/taiko-hekla.yml create mode 100644 conf/testnets/zksync-sepolia.yml create mode 100644 template/lnv2.yml create mode 100644 template/lnv3.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..99580d0 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc34c6a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.retry +.DS_Store +*.local.* diff --git a/conf/additional.base.yml b/conf/additional.base.yml deleted file mode 100644 index bebb0fa..0000000 --- a/conf/additional.base.yml +++ /dev/null @@ -1,47 +0,0 @@ - -apollo: - lnv2: - arbitrum: - tokens: - ring: - remoteInfos: - ethereum: - protocolFee: '100000000000000000000' - bridgeType: opposite - channel: arbitrum-l2 - - lnv3: - arbitrum: - # url: https://polygon-bor-rpc.publicnode.com - level0Indexer: 'thegraph' - tokens: - ring: - - protocolFee: 30000000000000000000 - # outerAddress: '0x9e523234D36973f9e38642886197D023C88e307e' - usdt: - - protocolFee: 100000 - eth: - - protocolFee: 10000000000000 - channels: - - chain: polygon - channel: layerzero - - chain: bsc - channel: layerzero - - chain: linea - channel: layerzero - - chain: op - channel: layerzero - - chain: gnosis - channel: layerzero - - chain: mantle - channel: layerzero - - chain: scroll - channel: layerzero - - chain: darwinia-dvm - channel: msgline - - chain: blast - channel: layerzero - - chain: astar-zkevm - channel: layerzero - - chain: moonbeam - channel: layerzero diff --git a/conf/additional.prod.yml b/conf/additional.prod.yml deleted file mode 100644 index fcd986a..0000000 --- a/conf/additional.prod.yml +++ /dev/null @@ -1,6 +0,0 @@ - -apollo: - lnv2: - arbitrum: - defaultEndpoint: https://api.studio.thegraph.com/query/59403/lndefault-arbitrum/v2.0.0 - oppositeEndpoint: https://api.studio.thegraph.com/query/59403/lnopposite-arbitrum/v2.0.0 diff --git a/conf/additional.test.yml b/conf/additional.test.yml deleted file mode 100644 index 55702f8..0000000 --- a/conf/additional.test.yml +++ /dev/null @@ -1,6 +0,0 @@ - -apollo: - lnv2: - arbitrum: - defaultEndpoint: https://api.studio.thegraph.com/query/61328/ln-default-arbisepolia/v1.0.1 - oppositeEndpoint: https://api.studio.thegraph.com/query/61328/ln-opposite-arbisepolia/v1.0.1 diff --git a/conf/definition.yml b/conf/definition.yml index 66cab31..765fc65 100644 --- a/conf/definition.yml +++ b/conf/definition.yml @@ -1,444 +1,17 @@ chain: mainnets: - - id: 42161 - code: arbitrum - name: Arbitrum - rpcs: - - https://polygon-bor-rpc.publicnode.com - tokens: - - symbol: eth - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - symbol: usdt - address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' - decimals: 6 - - symbol: usdc - address: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' - decimals: 6 - - symbol: ring - address: '0x9e523234D36973f9e38642886197D023C88e307e' - decimals: 18 - - - id: 1 - code: ethereum - name: Ethereum - rpcs: - - https://ethereum-rpc.publicnode.com - tokens: - - symbol: ring - address: '0x9469D013805bFfB7D3DEBe5E7839237e535ec483' - decimals: 18 - - - id: 137 - code: polygon - name: Polygon - rpcs: - - https://polygon-bor-rpc.publicnode.com - tokens: - - symbol: ring - address: '0x9C1C23E60B72Bc88a043bf64aFdb16A02540Ae8f' - decimals: 18 - - symbol: usdt - address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' - decimals: 6 - - - id: 46 - code: darwinia-dvm - name: Darwinia - rpcs: - - https://rpc.darwinia.network - tokens: - - symbol: ring - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - symbol: crab - address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' - decimals: 18 - - symbol: ahPINK - address: '0x0000000000000000000000000000000000000404' - decimals: 10 - - symbol: ahUSDT - address: '0x0000000000000000000000000000000000000403' - decimals: 6 - - - id: 44 - code: crab-dvm - name: Crab - rpcs: - - https://crab-rpc.darwinia.network - tokens: - - symbol: crab - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - symbol: ring - address: '0x273131F7CB50ac002BDd08cA721988731F7e1092' - decimals: 18 - - - id: 5000 - code: mantle - name: Mantle - rpcs: - - https://mantle-rpc.publicnode.com - tokens: - - symbol: usdt - address: '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE' - decimals: 6 - - symbol: usdc - address: '0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9' - decimals: 6 - - - id: 324 - code: zksync - name: zksync - rpcs: - - https://mainnet.era.zksync.io - tokens: - - symbol: usdt - address: '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C' - decimals: 6 - - symbol: usdc - address: '0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4' - decimals: 6 - - - id: 534352 - code: scroll - name: Scroll - rpcs: - - https://scroll-mainnet.public.blastapi.io - tokens: - - symbol: usdt - address: '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df' - decimals: 6 - - symbol: usdc - address: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4' - decimals: 6 - - - id: 56 - code: bsc - name: bsc - rpcs: - - https://bsc-rpc.publicnode.com - tokens: - - symbol: 'usdt' - address: '0x55d398326f99059fF775485246999027B3197955' - decimals: 6 - - symbol: 'usdc' - address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' - decimals: 6 - - - id: 59144 - code: linea - name: Linea - rpcs: - - https://linea.decubate.com - tokens: - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - symbol: 'usdt' - address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93' - decimals: 6 - - - id: 10 - code: op - name: Op - rpcs: - - https://optimism-rpc.publicnode.com - tokens: - - symbol: 'usdt' - address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' - decimals: 6 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - - id: 100 - code: gnosis - name: Gnosis - rpcs: - - https://gnosis-rpc.publicnode.com - tokens: - - symbol: 'usdt' - address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6' - decimals: 6 - - - id: 81457 - code: blast - name: Blast - rpcs: - - https://rpc.blastblockchain.com - tokens: - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - - id: 3776 - code: astar-zkevm - name: Astar zkEVM - rpcs: - - https://rpc.startale.com/astar-zkevm - tokens: - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - - id: 1284 - code: moonbeam - name: Moonbeam - rpcs: - - https://moonbeam-rpc.dwellir.com - tokens: - - symbol: 'xcUSDT' - address: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d' - decimals: 6 - - symbol: 'xcPINK' - address: '0xffffffff30478fafbe935e466da114e14fb3563d' - decimals: 10 - + protocol: + lnv2-default: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2-opposite: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' testnets: - - id: 421614 - code: arbitrum-sepolia - name: Arbitrum sepolia - rpcs: - - https://public.stackup.sh/api/v1/node/arbitrum-sepolia - tokens: - - symbol: 'usdt' - address: '0x3b8Bb7348D4F581e67E2498574F73e4B9Fc51855' - decimals: 18 - - symbol: 'usdc' - address: '0x8A87497488073307E1a17e8A12475a94Afcb413f' - decimals: 18 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - - id: 11155111 - code: sepolia - name: Sepolia - rpcs: - - https://ethereum-sepolia-rpc.publicnode.com - tokens: - - symbol: 'usdt' - address: '0x876A4f6eCF13EEb101F9E75FCeF58f19Ff383eEB' - decimals: 18 - - symbol: 'usdc' - address: '0x0ac58Df0cc3542beC4cDa71B16D06C3cCc39f405' - decimals: 18 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - - id: 300 - code: zksync-sepolia - name: zksync-sepolia - rpcs: - - https://zksync-sepolia.drpc.org - tokens: - - symbol: 'usdt' - address: '0x3350f1ef046e21E052dCbA60Fc575919CCaFEdeb' - decimals: 6 - - symbol: 'usdc' - address: '0x253adBFE99Fcd096B9b5502753F96CF78D42eaD0' - decimals: 6 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 - - - id: 167009 - code: taiko-hekla - name: taiko-hekla - rpcs: - - https://rpc.hekla.taiko.xyz - tokens: - - symbol: 'usdt' - address: '0x463D1730a8527CA58d48EF70C7460B9920346567' - decimals: 18 - - symbol: 'usdc' - address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' - decimals: 18 - - - id: 80085 - code: bera - name: bera - rpcs: - - https://artio.rpc.berachain.com - tokens: - - symbol: 'usdt' - address: '0x463D1730a8527CA58d48EF70C7460B9920346567' - decimals: 18 - - symbol: 'usdc' - address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' - decimals: 18 - - - id: 2710 - code: morph - name: morph - rpcs: - - https://rpc-testnet.morphl2.io - tokens: - - symbol: 'usdt' - address: '0x463D1730a8527CA58d48EF70C7460B9920346567' - decimals: 18 - - symbol: 'usdc' - address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' - decimals: 18 - -helix: - chain: - arbitrum: - lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' - - name: layerzero - address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' - ethereum: - lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' - polygon: - lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' - - name: layerzero - address: '0x463D1730a8527CA58d48EF70C7460B9920346567' - - darwinia-dvm: - lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2OppositeAddress: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' - - crab-dvm: - lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' - - mantle: - lnv2DefaultAddress: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: layerzero - address: 0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1 - - zksync: - lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' - lnv2OppositeAddress: null - lnv3Address: null - messagers: - - name: layerzero - address: '0x96892F3EaD26515592Da38432cFABad991BBd69d' - - scroll: - lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: 'layerzero' - address: '0x463d1730a8527ca58d48ef70c7460b9920346567' - - bsc: - lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: 'layerzero' - address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' - - linea: - lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: 'layerzero' - address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' - - op: - lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: 'layerzero' - address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' - - gnosis: - lnv2DefaultAddress: '0x767Bc046c989f5e63683fB530f939DD34b91ceAC' - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: 'layerzero' - address: '0x3F7DF5866591e7E48D18C8EbeAE61Bc343a63283' - - blast: - lnv2DefaultAddress: null - lnv2OppositeAddress: null - lnv3Address: '0xB180D7DcB5CC161C862aD60442FA37527546cAFC' - messagers: - - name: 'msgline' - address: '0x98982b1685a63596834a05C1288dA7fbF27d684E' - - astar-zkevm: - lnv2DefaultAddress: null - lnv2OppositeAddress: null - lnv3Address: '0xD476650e03a45E70202b0bcAfa04E1513920f83a' - messagers: - - name: 'layerzero' - address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' - - moonbeam: - lnv2DefaultAddress: null - lnv2OppositeAddress: null - lnv3Address: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: 'layerzero' - address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' - - arbitrum-sepolia: - lnv2DefaultAddress: '0x8429D7Dfd91D6F970ba89fFC005e67D15f1E4739' - lnv2OppositeAddress: '0xbA96d83E2A04c4E50F2D6D7eCA03D70bA2426e5f' - lnv3Address: '0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa' - messagers: [ ] - - sepolia: - lnv2DefaultAddress: '0x8429D7Dfd91D6F970ba89fFC005e67D15f1E4739' - lnv2OppositeAddress: '0xbA96d83E2A04c4E50F2D6D7eCA03D70bA2426e5f' - lnv3Address: '0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa' - messagers: [ ] - - zksync-sepolia: - lnv2DefaultAddress: '0xBe23e871318E49C747CB909AC65aCCFAEAac3a37' - lnv2OppositeAddress: null - lnv3Address: '0xDc55fF59F82AA50D8A4A61dB8CcaDffD26Fb7dD2' - messagers: [ ] - - taiko-hekla: - lnv2DefaultAddress: null - lnv2OppositeAddress: null - lnv3Address: '0xD476650e03a45E70202b0bcAfa04E1513920f83a' - messagers: [ ] - - bera: - lnv2DefaultAddress: null - lnv2OppositeAddress: null - lnv3Address: '0x00e7EFf0826dfCDf2AA5945dFF710B48f4AA7E64' - messagers: [ ] - - morph: - lnv2DefaultAddress: null - lnv2OppositeAddress: null - lnv3Address: '0xD476650e03a45E70202b0bcAfa04E1513920f83a' - messagers: [ ] + address: + lnv2-default: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2-opposite: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' + messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' diff --git a/conf/mainnets/arbitrum.yml b/conf/mainnets/arbitrum.yml new file mode 100644 index 0000000..3a89e7b --- /dev/null +++ b/conf/mainnets/arbitrum.yml @@ -0,0 +1,79 @@ +id: 42161 +code: arbitrum +name: Arbitrum +rpcs: + - https://polygon-bor-rpc.publicnode.com +protocol: + lnv2-default: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2-opposite: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' +messagers: + - name: layerzero + address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' +tokens: + - symbol: ETH + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: USDT + address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' + decimals: 6 + - symbol: USDC + address: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' + decimals: 6 + - symbol: RING + address: '0x9e523234D36973f9e38642886197D023C88e307e' + decimals: 18 +couples: + - chain: ethereum + symbol: + from: RING + to: RING + protocol: 'lnv2-opposite' + fee: '100000000000000000000' + messager: + name: 'arbitrum-l2' + - chain: polygon + symbol: RING + protocol: 'lnv2-default' + fee: '100000000000000000000' + messager: + name: layerzero + address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' + - chain: darwinia + symbol: RING/RING + protocol: lnv2-default + fee: '100000000000000000000' + messager: 'msgline' + + - chain: mantle + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: zksync + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: bsc + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: linea + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + + - chain: mantle + symbol: USDC + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: USDC + protol: lnv2-default + fee: '100000' + messager: layerzero + diff --git a/conf/mainnets/astar-zkevm.yml b/conf/mainnets/astar-zkevm.yml new file mode 100644 index 0000000..a03a483 --- /dev/null +++ b/conf/mainnets/astar-zkevm.yml @@ -0,0 +1,9 @@ +id: 3776 +code: astar-zkevm +name: Astar zkEVM +rpcs: + - https://rpc.startale.com/astar-zkevm +tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 diff --git a/conf/mainnets/base.yml b/conf/mainnets/base.yml new file mode 100644 index 0000000..92443aa --- /dev/null +++ b/conf/mainnets/base.yml @@ -0,0 +1,16 @@ +id: 8453 +code: base +name: base +rpcs: + - https://mainnet.base.org +tokens: + - symbol: 'usdc' + address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' + decimals: 6 + +couples: + - chain: bsc + symbol: usdc + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/blast.yml b/conf/mainnets/blast.yml new file mode 100644 index 0000000..d299ed6 --- /dev/null +++ b/conf/mainnets/blast.yml @@ -0,0 +1,9 @@ +id: 81457 +code: blast +name: Blast +rpcs: + - https://rpc.blastblockchain.com +tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 diff --git a/conf/mainnets/bsc.yml b/conf/mainnets/bsc.yml new file mode 100644 index 0000000..8fa0fb2 --- /dev/null +++ b/conf/mainnets/bsc.yml @@ -0,0 +1,37 @@ +id: 56 +code: bsc +name: bsc +rpcs: + - https://bsc-rpc.publicnode.com +tokens: + - symbol: 'usdt' + address: '0x55d398326f99059fF775485246999027B3197955' + decimals: 6 + - symbol: 'usdc' + address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' + decimals: 6 + +couples: + - chain: arbitrum + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: op + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: linea + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + - chain: base + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + diff --git a/conf/mainnets/crab.yml b/conf/mainnets/crab.yml new file mode 100644 index 0000000..c64cbe4 --- /dev/null +++ b/conf/mainnets/crab.yml @@ -0,0 +1,29 @@ +id: 44 +code: crab-dvm +name: Crab +rpcs: + - https://crab-rpc.darwinia.network +tokens: + - symbol: crab + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: ring + address: '0x273131F7CB50ac002BDd08cA721988731F7e1092' + decimals: 18 + - symbol: xWRING + address: '0x273131F7CB50ac002BDd08cA721988731F7e1092' + decimals: 18 + +couples: + - chain: darwinia + symbol: crab/xWCRAB + protocol: lnv2-default + fee: '100000000000000000000' + messager: msgline + + - chain: darwinia + symbol: xWRING/ring + protocol: lnv2-default + fee: '10000000000000000000' + messager: msgline + diff --git a/conf/mainnets/darwinia.yml b/conf/mainnets/darwinia.yml new file mode 100644 index 0000000..664c56b --- /dev/null +++ b/conf/mainnets/darwinia.yml @@ -0,0 +1,44 @@ +id: 46 +code: darwinia-dvm +name: Darwinia +rpcs: + - https://rpc.darwinia.network +tokens: + - symbol: ring + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: crab + address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' + decimals: 18 + - symbol: xwcrab + address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' + decimals: 18 + - symbol: ahPINK + address: '0x0000000000000000000000000000000000000404' + decimals: 10 + - symbol: ahUSDT + address: '0x0000000000000000000000000000000000000403' + decimals: 6 + +couples: + - chain: arbitrum + symbol: ring + protocol: lnv2-default + fee: '100000000000000000000' + messager: msgline + - chain: ethereum + symbol: ring + protocol: lnv2-opposite + fee: '100000000000000000000' + messager: msgline + - chain: crab + symbol: ring/xWRING + protocol: lnv2-default + fee: '100000000000000000000' + messager: msgline + + - chain: crab + symbol: crab + protocol: lnv2-default + fee: '100000000000000000000' + messager: msgline diff --git a/conf/mainnets/ethereum.yml b/conf/mainnets/ethereum.yml new file mode 100644 index 0000000..0dd3c62 --- /dev/null +++ b/conf/mainnets/ethereum.yml @@ -0,0 +1,22 @@ +id: 1 +code: ethereum +name: Ethereum +rpcs: + - https://ethereum-rpc.publicnode.com +tokens: + - symbol: ring + address: '0x9469D013805bFfB7D3DEBe5E7839237e535ec483' + decimals: 18 +couples: + - chain: arbitrum + symbol: RING + protocol: 'lnv2-default' + fee: '100000000000000000000' + messager: + name: 'arbitrum-l2' + - chain: darwinia-dvm + symbol: RING + protocol: lnv2-default + fee: '100000000000000000000' + messager: msgline + diff --git a/conf/mainnets/gnosis.yml b/conf/mainnets/gnosis.yml new file mode 100644 index 0000000..bca3af6 --- /dev/null +++ b/conf/mainnets/gnosis.yml @@ -0,0 +1,9 @@ +id: 100 +code: gnosis +name: Gnosis +rpcs: + - https://gnosis-rpc.publicnode.com +tokens: + - symbol: 'usdt' + address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6' + decimals: 6 diff --git a/conf/mainnets/linea.yml b/conf/mainnets/linea.yml new file mode 100644 index 0000000..7e23b03 --- /dev/null +++ b/conf/mainnets/linea.yml @@ -0,0 +1,24 @@ +id: 59144 +code: linea +name: Linea +rpcs: + - https://linea.decubate.com +tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + - symbol: 'usdt' + address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93' + decimals: 6 +couples: + - chain: bsc + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: arbitrum + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + diff --git a/conf/mainnets/mantle.yml b/conf/mainnets/mantle.yml new file mode 100644 index 0000000..07e9178 --- /dev/null +++ b/conf/mainnets/mantle.yml @@ -0,0 +1,39 @@ +id: 5000 +code: mantle +name: Mantle +rpcs: + - https://mantle-rpc.publicnode.com +tokens: + - symbol: usdt + address: '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE' + decimals: 6 + - symbol: usdc + address: '0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9' + decimals: 6 +couples: + - chain: arbitrum + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: zksync + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + + - chain: arbitrum + symbol: USDC + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: USDC + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/moonbeam.yml b/conf/mainnets/moonbeam.yml new file mode 100644 index 0000000..75c15a9 --- /dev/null +++ b/conf/mainnets/moonbeam.yml @@ -0,0 +1,12 @@ +id: 1284 +code: moonbeam +name: Moonbeam +rpcs: + - https://moonbeam-rpc.dwellir.com +tokens: + - symbol: 'xcUSDT' + address: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d' + decimals: 6 + - symbol: 'xcPINK' + address: '0xffffffff30478fafbe935e466da114e14fb3563d' + decimals: 10 diff --git a/conf/mainnets/optimism.yml b/conf/mainnets/optimism.yml new file mode 100644 index 0000000..a731fba --- /dev/null +++ b/conf/mainnets/optimism.yml @@ -0,0 +1,18 @@ +id: 10 +code: op +name: Op +rpcs: + - https://optimism-rpc.publicnode.com +tokens: + - symbol: 'usdt' + address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' + decimals: 6 + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 +couples: + - chain: bsc + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/polygon.yml b/conf/mainnets/polygon.yml new file mode 100644 index 0000000..c502564 --- /dev/null +++ b/conf/mainnets/polygon.yml @@ -0,0 +1,26 @@ +id: 137 +code: polygon +name: Polygon +rpcs: + - https://polygon-bor-rpc.publicnode.com +tokens: + - symbol: ring + address: '0x9C1C23E60B72Bc88a043bf64aFdb16A02540Ae8f' + decimals: 18 + - symbol: usdt + address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' + decimals: 6 +couples: + - chain: arbitrum + symbol: ring + protocol: lnv2-default + fee: '100000000000000000000' + messager: layerzero + + - chain: arbitrum + symbol: RING + protocol: lnv3 + fee: '30000000000000000000' + messager: layerzero + + diff --git a/conf/mainnets/scroll.yml b/conf/mainnets/scroll.yml new file mode 100644 index 0000000..c9a15fa --- /dev/null +++ b/conf/mainnets/scroll.yml @@ -0,0 +1,34 @@ +id: 534352 +code: scroll +name: Scroll +rpcs: + - https://scroll-mainnet.public.blastapi.io +tokens: + - symbol: usdt + address: '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df' + decimals: 6 + - symbol: usdc + address: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4' + decimals: 6 +couples: + - chain: mantle + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: zksync + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + + - chain: mantle + symbol: usdc + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: arbitrum + symbol: usdc + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/zksync.yml b/conf/mainnets/zksync.yml new file mode 100644 index 0000000..cd8f7d0 --- /dev/null +++ b/conf/mainnets/zksync.yml @@ -0,0 +1,29 @@ +id: 324 +code: zksync +name: zksync +rpcs: + - https://mainnet.era.zksync.io +tokens: + - symbol: usdt + address: '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C' + decimals: 6 + - symbol: usdc + address: '0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4' + decimals: 6 +couples: + - chain: arbitrum + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: mantle + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + diff --git a/conf/template.yml b/conf/template.yml deleted file mode 100644 index 240053e..0000000 --- a/conf/template.yml +++ /dev/null @@ -1,45 +0,0 @@ - -apollo: - lnv2: - chainId: '$chain.id' - chainName: '$chain.code' - defaultEndpoint: '$chain.defaultEndpoint' - oppositeEndpoint: '$chain.oppositeEndpoint' - tokens: - $type: 'array' - key: '$token.symbol' - fromSymbol: '$token.symbol' - fromAddress: '$token.address' - decimals: '$token.decimals' - remoteInfos: - $type: 'array' - toChain: '$remote.toChain' - toChainName: '$remote.toChainCode' - toSymbol: '$remote.toSymbol' - toAddress: '$remote.toAddress' - protocolFee: '$remote.protocolFee' - decimals: '$remote.decimals' - bridgeType: '$remote.bridgeType' - channel: '$remote.channel' - - - - lnv3: - chainId: '$chain.id' - chain: '$chain.code' - url: '$chain.url' - level0Indexer: '$chain.level0Indexer' - bridge: 'lnv3' - symbols: - $type: 'array' - key: '$token.symbol' - symbol: '$token.symbol' - address: '$token.address' - outerAddress: '$token.address' - decimals: '$token.decimals' - protocolFee: '$token.protocolFee' - channels: - $type: 'array' - chain: '$channel.chain' - channel: '$channel.channel' - diff --git a/conf/testnets/arbitrum-sepolia.yml b/conf/testnets/arbitrum-sepolia.yml new file mode 100644 index 0000000..656a9ae --- /dev/null +++ b/conf/testnets/arbitrum-sepolia.yml @@ -0,0 +1,49 @@ +id: 421614 +code: arbitrum-sepolia +name: Arbitrum sepolia +rpcs: + - https://public.stackup.sh/api/v1/node/arbitrum-sepolia +tokens: + - symbol: 'usdt' + address: '0x3b8Bb7348D4F581e67E2498574F73e4B9Fc51855' + decimals: 18 + - symbol: 'usdc' + address: '0x8A87497488073307E1a17e8A12475a94Afcb413f' + decimals: 18 + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 +couples: + - chain: sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: zksync-sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + - chain: sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: zksync-sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + - chain: sepolia + symbol: eth + protocol: lnv2-opposite + fee: '100000000000000000' + messager: layerzero + - chain: zksync-sepolia + symbol: eth + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + diff --git a/conf/testnets/bera.yml b/conf/testnets/bera.yml new file mode 100644 index 0000000..ca34c82 --- /dev/null +++ b/conf/testnets/bera.yml @@ -0,0 +1,12 @@ +id: 80085 +code: bera +name: bera +rpcs: + - https://artio.rpc.berachain.com +tokens: + - symbol: 'usdt' + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + decimals: 18 + - symbol: 'usdc' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 diff --git a/conf/testnets/morph.yml b/conf/testnets/morph.yml new file mode 100644 index 0000000..523ee33 --- /dev/null +++ b/conf/testnets/morph.yml @@ -0,0 +1,12 @@ +id: 2710 +code: morph +name: morph +rpcs: + - https://rpc-testnet.morphl2.io +tokens: + - symbol: 'usdt' + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + decimals: 18 + - symbol: 'usdc' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 diff --git a/conf/testnets/sepolia.yml b/conf/testnets/sepolia.yml new file mode 100644 index 0000000..8758fff --- /dev/null +++ b/conf/testnets/sepolia.yml @@ -0,0 +1,51 @@ +id: 11155111 +code: sepolia +name: Sepolia +rpcs: + - https://ethereum-sepolia-rpc.publicnode.com +tokens: + - symbol: 'usdt' + address: '0x876A4f6eCF13EEb101F9E75FCeF58f19Ff383eEB' + decimals: 18 + - symbol: 'usdc' + address: '0x0ac58Df0cc3542beC4cDa71B16D06C3cCc39f405' + decimals: 18 + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 +couples: + - chain: arbitrum-sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: zksync-sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + + - chain: arbitrum-sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: zksync-sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + - chain: arbitrum-sepolia + symbol: eth + protocol: lnv2-opposite + fee: '100000000000000000' + messager: layerzero + - chain: zksync-sepolia + symbol: eth + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + diff --git a/conf/testnets/taiko-hekla.yml b/conf/testnets/taiko-hekla.yml new file mode 100644 index 0000000..036bac0 --- /dev/null +++ b/conf/testnets/taiko-hekla.yml @@ -0,0 +1,12 @@ +id: 167009 +code: taiko-hekla +name: taiko-hekla +rpcs: + - https://rpc.hekla.taiko.xyz +tokens: + - symbol: 'usdt' + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' + decimals: 18 + - symbol: 'usdc' + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 diff --git a/conf/testnets/zksync-sepolia.yml b/conf/testnets/zksync-sepolia.yml new file mode 100644 index 0000000..1b46433 --- /dev/null +++ b/conf/testnets/zksync-sepolia.yml @@ -0,0 +1,48 @@ +id: 300 +code: zksync-sepolia +name: zksync-sepolia +rpcs: + - https://zksync-sepolia.drpc.org +tokens: + - symbol: 'usdt' + address: '0x3350f1ef046e21E052dCbA60Fc575919CCaFEdeb' + decimals: 6 + - symbol: 'usdc' + address: '0x253adBFE99Fcd096B9b5502753F96CF78D42eaD0' + decimals: 6 + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 +couples: + - chain: sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: arbitrum-sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + - chain: sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: arbitrum-sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + - chain: sepolia + symbol: eth + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: arbitrum-sepolia + symbol: eth + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero diff --git a/template/lnv2.yml b/template/lnv2.yml new file mode 100644 index 0000000..298f809 --- /dev/null +++ b/template/lnv2.yml @@ -0,0 +1,23 @@ +chainId: '$chain.id' +chainName: '$chain.code' +rpc: '$chain.rpc' +address: + default: '$chain.addressDefault' + opposite: '$chain.addressOpposite' +tokens: + $type: 'array' + key: '$token.symbol' + fromSymbol: '$token.symbol' + fromAddress: '$token.address' + decimals: '$token.decimals' + remoteInfos: + $type: 'array' + toChain: '$remote.toChain' + toChainName: '$remote.toChainCode' + toSymbol: '$remote.toSymbol' + toAddress: '$remote.toAddress' + protocolFee: '$remote.protocolFee' + decimals: '$remote.decimals' + bridgeType: '$remote.bridgeType' + channel: '$remote.channel' + diff --git a/template/lnv3.yml b/template/lnv3.yml new file mode 100644 index 0000000..a3862eb --- /dev/null +++ b/template/lnv3.yml @@ -0,0 +1,19 @@ +chainId: '$chain.id' +chainName: '$chain.code' +rpc: '$chain.rpc' +address: '$chain.address' +level0Indexer: '$chain.level0Indexer' +bridge: 'lnv3' +tokens: + $type: 'array' + key: '$token.symbol' + symbol: '$token.symbol' + address: '$token.address' + outerAddress: '$token.address' + decimals: '$token.decimals' + protocolFee: '$token.protocolFee' +channels: + $type: 'array' + chain: '$channel.chain' + channel: '$channel.channel' + From ae053c23febb180ea1d9e972de9a6f21c62fdd74 Mon Sep 17 00:00:00 2001 From: fewensa Date: Fri, 5 Jul 2024 02:21:00 +0000 Subject: [PATCH 5/9] standard conf --- .gitignore | 5 ++ conf/definition.yml | 17 ------ conf/mainnets/$.yml | 8 +++ conf/mainnets/arbitrum.yml | 15 +++-- conf/mainnets/astar-zkevm.yml | 1 + conf/mainnets/base.yml | 5 ++ conf/mainnets/blast.yml | 1 + conf/mainnets/bsc.yml | 14 +++-- conf/mainnets/crab.yml | 8 ++- conf/mainnets/darwinia.yml | 12 +++- conf/mainnets/ethereum.yml | 5 ++ conf/mainnets/gnosis.yml | 8 ++- conf/mainnets/linea.yml | 2 + conf/mainnets/mantle.yml | 6 ++ conf/mainnets/moonbeam.yml | 16 +++++- conf/mainnets/optimism.yml | 10 ++-- conf/mainnets/polygon-zkevm.yml | 17 ++++++ conf/mainnets/polygon.yml | 6 ++ conf/mainnets/scroll.yml | 6 ++ conf/mainnets/taiko.yml | 18 ++++++ conf/mainnets/zksync.yml | 6 ++ conf/testnets/$.yml | 8 +++ conf/testnets/arbitrum-sepolia.yml | 9 ++- conf/testnets/bera.yml | 6 ++ conf/testnets/morph.yml | 10 +++- conf/testnets/sepolia.yml | 9 ++- conf/testnets/taiko-hekla.yml | 10 +++- conf/testnets/zksync-sepolia.yml | 9 ++- package-lock.json | 65 +++++++++++++++++++++ package.json | 13 +++++ scripts/generate/_helper.mjs | 48 ++++++++++++++++ scripts/generate/index.mjs | 61 ++++++++++++++++++++ scripts/generate/stdconf.mjs | 91 ++++++++++++++++++++++++++++++ 33 files changed, 474 insertions(+), 51 deletions(-) delete mode 100644 conf/definition.yml create mode 100644 conf/mainnets/$.yml create mode 100644 conf/mainnets/polygon-zkevm.yml create mode 100644 conf/mainnets/taiko.yml create mode 100644 conf/testnets/$.yml create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 scripts/generate/_helper.mjs create mode 100644 scripts/generate/index.mjs create mode 100644 scripts/generate/stdconf.mjs diff --git a/.gitignore b/.gitignore index bc34c6a..862569e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ *.retry .DS_Store *.local.* + +node_modules + +_tmp + diff --git a/conf/definition.yml b/conf/definition.yml deleted file mode 100644 index 765fc65..0000000 --- a/conf/definition.yml +++ /dev/null @@ -1,17 +0,0 @@ -chain: - mainnets: - protocol: - lnv2-default: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2-opposite: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' - lnv3: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' - testnets: - address: - lnv2-default: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' - lnv2-opposite: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' - lnv3: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' - messagers: - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' diff --git a/conf/mainnets/$.yml b/conf/mainnets/$.yml new file mode 100644 index 0000000..87f3eac --- /dev/null +++ b/conf/mainnets/$.yml @@ -0,0 +1,8 @@ + +protocol: + lnv2-default: '0x94C614DAeFDbf151E1BB53d6A201ae5fF56A9337' + lnv2-opposite: '0x48d769d5C7ff75703cDd1543A1a2ed9bC9044A23' + lnv3: '0xbA5D580B18b6436411562981e02c8A9aA1776D10' +messagers: + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' diff --git a/conf/mainnets/arbitrum.yml b/conf/mainnets/arbitrum.yml index 3a89e7b..d2a30e8 100644 --- a/conf/mainnets/arbitrum.yml +++ b/conf/mainnets/arbitrum.yml @@ -10,19 +10,25 @@ protocol: messagers: - name: layerzero address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' + - name: msgline + address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' tokens: - symbol: ETH address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native - symbol: USDT address: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9' decimals: 6 + type: erc20 - symbol: USDC address: '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8' decimals: 6 + type: erc20 - symbol: RING address: '0x9e523234D36973f9e38642886197D023C88e307e' decimals: 18 + type: erc20 couples: - chain: ethereum symbol: @@ -30,16 +36,13 @@ couples: to: RING protocol: 'lnv2-opposite' fee: '100000000000000000000' - messager: - name: 'arbitrum-l2' + messager: 'arbitrum-l2' - chain: polygon symbol: RING protocol: 'lnv2-default' fee: '100000000000000000000' - messager: - name: layerzero - address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' - - chain: darwinia + messager: layerzero + - chain: darwinia-dvm symbol: RING/RING protocol: lnv2-default fee: '100000000000000000000' diff --git a/conf/mainnets/astar-zkevm.yml b/conf/mainnets/astar-zkevm.yml index a03a483..e49fff2 100644 --- a/conf/mainnets/astar-zkevm.yml +++ b/conf/mainnets/astar-zkevm.yml @@ -7,3 +7,4 @@ tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native diff --git a/conf/mainnets/base.yml b/conf/mainnets/base.yml index 92443aa..c2ca835 100644 --- a/conf/mainnets/base.yml +++ b/conf/mainnets/base.yml @@ -4,9 +4,14 @@ name: base rpcs: - https://mainnet.base.org tokens: + - symbol: 'eth' + address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' + decimals: 18 + type: native - symbol: 'usdc' address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' decimals: 6 + type: erc20 couples: - chain: bsc diff --git a/conf/mainnets/blast.yml b/conf/mainnets/blast.yml index d299ed6..111a925 100644 --- a/conf/mainnets/blast.yml +++ b/conf/mainnets/blast.yml @@ -7,3 +7,4 @@ tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native diff --git a/conf/mainnets/bsc.yml b/conf/mainnets/bsc.yml index 8fa0fb2..0df588a 100644 --- a/conf/mainnets/bsc.yml +++ b/conf/mainnets/bsc.yml @@ -4,12 +4,18 @@ name: bsc rpcs: - https://bsc-rpc.publicnode.com tokens: - - symbol: 'usdt' + - symbol: bnb + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: usdt address: '0x55d398326f99059fF775485246999027B3197955' - decimals: 6 - - symbol: 'usdc' + decimals: 18 + type: erc20 + - symbol: usdc address: '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' - decimals: 6 + decimals: 18 + type: erc20 couples: - chain: arbitrum diff --git a/conf/mainnets/crab.yml b/conf/mainnets/crab.yml index c64cbe4..8f81fa4 100644 --- a/conf/mainnets/crab.yml +++ b/conf/mainnets/crab.yml @@ -7,21 +7,25 @@ tokens: - symbol: crab address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native - symbol: ring address: '0x273131F7CB50ac002BDd08cA721988731F7e1092' decimals: 18 + type: erc20 - symbol: xWRING + name: xWRING address: '0x273131F7CB50ac002BDd08cA721988731F7e1092' decimals: 18 + type: erc20 couples: - - chain: darwinia + - chain: darwinia-dvm symbol: crab/xWCRAB protocol: lnv2-default fee: '100000000000000000000' messager: msgline - - chain: darwinia + - chain: darwinia-dvm symbol: xWRING/ring protocol: lnv2-default fee: '10000000000000000000' diff --git a/conf/mainnets/darwinia.yml b/conf/mainnets/darwinia.yml index 664c56b..ee94d7f 100644 --- a/conf/mainnets/darwinia.yml +++ b/conf/mainnets/darwinia.yml @@ -7,18 +7,26 @@ tokens: - symbol: ring address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native - symbol: crab address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' decimals: 18 + type: erc20 - symbol: xwcrab + name: xWCRAB address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' decimals: 18 + type: erc20 - symbol: ahPINK + name: ahPINK address: '0x0000000000000000000000000000000000000404' decimals: 10 + type: erc20 - symbol: ahUSDT + name: ahUSDT address: '0x0000000000000000000000000000000000000403' decimals: 6 + type: erc20 couples: - chain: arbitrum @@ -31,13 +39,13 @@ couples: protocol: lnv2-opposite fee: '100000000000000000000' messager: msgline - - chain: crab + - chain: crab-dvm symbol: ring/xWRING protocol: lnv2-default fee: '100000000000000000000' messager: msgline - - chain: crab + - chain: crab-dvm symbol: crab protocol: lnv2-default fee: '100000000000000000000' diff --git a/conf/mainnets/ethereum.yml b/conf/mainnets/ethereum.yml index 0dd3c62..1e56797 100644 --- a/conf/mainnets/ethereum.yml +++ b/conf/mainnets/ethereum.yml @@ -4,9 +4,14 @@ name: Ethereum rpcs: - https://ethereum-rpc.publicnode.com tokens: + - symbol: ring + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: ring address: '0x9469D013805bFfB7D3DEBe5E7839237e535ec483' decimals: 18 + type: erc20 couples: - chain: arbitrum symbol: RING diff --git a/conf/mainnets/gnosis.yml b/conf/mainnets/gnosis.yml index bca3af6..d36be83 100644 --- a/conf/mainnets/gnosis.yml +++ b/conf/mainnets/gnosis.yml @@ -4,6 +4,12 @@ name: Gnosis rpcs: - https://gnosis-rpc.publicnode.com tokens: - - symbol: 'usdt' + - symbol: xDai + name: xDai + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: usdt address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6' decimals: 6 + type: erc20 diff --git a/conf/mainnets/linea.yml b/conf/mainnets/linea.yml index 7e23b03..fe92c43 100644 --- a/conf/mainnets/linea.yml +++ b/conf/mainnets/linea.yml @@ -7,9 +7,11 @@ tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native - symbol: 'usdt' address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93' decimals: 6 + type: erc20 couples: - chain: bsc symbol: usdt diff --git a/conf/mainnets/mantle.yml b/conf/mainnets/mantle.yml index 07e9178..3107e1d 100644 --- a/conf/mainnets/mantle.yml +++ b/conf/mainnets/mantle.yml @@ -4,12 +4,18 @@ name: Mantle rpcs: - https://mantle-rpc.publicnode.com tokens: + - symbol: MNT + address: '0x0000000000000000000000000000000000000000' + decimals: 6 + type: native - symbol: usdt address: '0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE' decimals: 6 + type: erc20 - symbol: usdc address: '0x09Bc4E0D864854c6aFB6eB9A9cdF58aC190D0dF9' decimals: 6 + type: erc20 couples: - chain: arbitrum symbol: USDT diff --git a/conf/mainnets/moonbeam.yml b/conf/mainnets/moonbeam.yml index 75c15a9..81dce8f 100644 --- a/conf/mainnets/moonbeam.yml +++ b/conf/mainnets/moonbeam.yml @@ -4,9 +4,21 @@ name: Moonbeam rpcs: - https://moonbeam-rpc.dwellir.com tokens: - - symbol: 'xcUSDT' + - symbol: GLMR + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: ETH + address: '0xfa9343c3897324496a05fc75abed6bac29f8a40f' + decimals: 18 + type: erc20 + - symbol: xcUSDT + name: xcUSDT address: '0xFFFFFFfFea09FB06d082fd1275CD48b191cbCD1d' decimals: 6 - - symbol: 'xcPINK' + type: erc20 + - symbol: xcPINK + name: xcPINK address: '0xffffffff30478fafbe935e466da114e14fb3563d' decimals: 10 + type: erc20 diff --git a/conf/mainnets/optimism.yml b/conf/mainnets/optimism.yml index a731fba..b7d56a6 100644 --- a/conf/mainnets/optimism.yml +++ b/conf/mainnets/optimism.yml @@ -4,12 +4,14 @@ name: Op rpcs: - https://optimism-rpc.publicnode.com tokens: - - symbol: 'usdt' - address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' - decimals: 6 - - symbol: 'eth' + - symbol: eth address: '0x0000000000000000000000000000000000000000' decimals: 18 + type: native + - symbol: usdt + address: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58' + decimals: 6 + type: erc20 couples: - chain: bsc symbol: usdt diff --git a/conf/mainnets/polygon-zkevm.yml b/conf/mainnets/polygon-zkevm.yml new file mode 100644 index 0000000..9e28ae4 --- /dev/null +++ b/conf/mainnets/polygon-zkevm.yml @@ -0,0 +1,17 @@ +id: 1101 +code: polygon-zkEvm +name: Polygon zkEVM +rpcs: + - https://zkevm-rpc.com +tokens: + - symbol: eth + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: usdt + address: '0x1E4a5963aBFD975d8c9021ce480b42188849D41d' + decimals: 6 + type: erc20 +couples: + + diff --git a/conf/mainnets/polygon.yml b/conf/mainnets/polygon.yml index c502564..36b3e88 100644 --- a/conf/mainnets/polygon.yml +++ b/conf/mainnets/polygon.yml @@ -4,12 +4,18 @@ name: Polygon rpcs: - https://polygon-bor-rpc.publicnode.com tokens: + - symbol: MATIC + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: ring address: '0x9C1C23E60B72Bc88a043bf64aFdb16A02540Ae8f' decimals: 18 + type: erc20 - symbol: usdt address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F' decimals: 6 + type: erc20 couples: - chain: arbitrum symbol: ring diff --git a/conf/mainnets/scroll.yml b/conf/mainnets/scroll.yml index c9a15fa..40e23fa 100644 --- a/conf/mainnets/scroll.yml +++ b/conf/mainnets/scroll.yml @@ -4,12 +4,18 @@ name: Scroll rpcs: - https://scroll-mainnet.public.blastapi.io tokens: + - symbol: eth + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: usdt address: '0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df' decimals: 6 + type: erc20 - symbol: usdc address: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4' decimals: 6 + type: erc20 couples: - chain: mantle symbol: USDT diff --git a/conf/mainnets/taiko.yml b/conf/mainnets/taiko.yml new file mode 100644 index 0000000..6db8830 --- /dev/null +++ b/conf/mainnets/taiko.yml @@ -0,0 +1,18 @@ +id: 167000 +code: taiko +name: taiko +rpcs: + - https://rpc.taiko.xyz +tokens: + - symbol: eth + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: usdt + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' + decimals: 18 + type: erc20 + - symbol: usdc + address: '0x3F7DF5866591e7E48D18C8EbeAE61Bc343a63283' + decimals: 18 + type: erc20 diff --git a/conf/mainnets/zksync.yml b/conf/mainnets/zksync.yml index cd8f7d0..cdfa70c 100644 --- a/conf/mainnets/zksync.yml +++ b/conf/mainnets/zksync.yml @@ -4,12 +4,18 @@ name: zksync rpcs: - https://mainnet.era.zksync.io tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: usdt address: '0x493257fD37EDB34451f62EDf8D2a0C418852bA4C' decimals: 6 + type: erc20 - symbol: usdc address: '0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4' decimals: 6 + type: erc20 couples: - chain: arbitrum symbol: USDT diff --git a/conf/testnets/$.yml b/conf/testnets/$.yml new file mode 100644 index 0000000..9c2e74d --- /dev/null +++ b/conf/testnets/$.yml @@ -0,0 +1,8 @@ + +address: + lnv2-default: '0x8429D7Dfd91D6F970ba89fFC005e67D15f1E4739' + lnv2-opposite: '0xbA96d83E2A04c4E50F2D6D7eCA03D70bA2426e5f' + lnv3: '0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa' +messagers: +# - name: msgline +# address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' diff --git a/conf/testnets/arbitrum-sepolia.yml b/conf/testnets/arbitrum-sepolia.yml index 656a9ae..531a907 100644 --- a/conf/testnets/arbitrum-sepolia.yml +++ b/conf/testnets/arbitrum-sepolia.yml @@ -4,15 +4,18 @@ name: Arbitrum sepolia rpcs: - https://public.stackup.sh/api/v1/node/arbitrum-sepolia tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: 'usdt' address: '0x3b8Bb7348D4F581e67E2498574F73e4B9Fc51855' decimals: 18 + type: erc20 - symbol: 'usdc' address: '0x8A87497488073307E1a17e8A12475a94Afcb413f' decimals: 18 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 + type: erc20 couples: - chain: sepolia symbol: usdc diff --git a/conf/testnets/bera.yml b/conf/testnets/bera.yml index ca34c82..0de89fc 100644 --- a/conf/testnets/bera.yml +++ b/conf/testnets/bera.yml @@ -4,9 +4,15 @@ name: bera rpcs: - https://artio.rpc.berachain.com tokens: + - symbol: 'BERA' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: 'usdt' address: '0x463D1730a8527CA58d48EF70C7460B9920346567' decimals: 18 + type: erc20 - symbol: 'usdc' address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' decimals: 18 + type: erc20 diff --git a/conf/testnets/morph.yml b/conf/testnets/morph.yml index 523ee33..49b7d2f 100644 --- a/conf/testnets/morph.yml +++ b/conf/testnets/morph.yml @@ -4,9 +4,15 @@ name: morph rpcs: - https://rpc-testnet.morphl2.io tokens: - - symbol: 'usdt' + - symbol: eth + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: usdt address: '0x463D1730a8527CA58d48EF70C7460B9920346567' decimals: 18 - - symbol: 'usdc' + type: erc20 + - symbol: usdc address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' decimals: 18 + type: erc20 diff --git a/conf/testnets/sepolia.yml b/conf/testnets/sepolia.yml index 8758fff..df7f3ae 100644 --- a/conf/testnets/sepolia.yml +++ b/conf/testnets/sepolia.yml @@ -4,15 +4,18 @@ name: Sepolia rpcs: - https://ethereum-sepolia-rpc.publicnode.com tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: 'usdt' address: '0x876A4f6eCF13EEb101F9E75FCeF58f19Ff383eEB' decimals: 18 + type: erc20 - symbol: 'usdc' address: '0x0ac58Df0cc3542beC4cDa71B16D06C3cCc39f405' decimals: 18 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 + type: erc20 couples: - chain: arbitrum-sepolia symbol: usdc diff --git a/conf/testnets/taiko-hekla.yml b/conf/testnets/taiko-hekla.yml index 036bac0..dcac573 100644 --- a/conf/testnets/taiko-hekla.yml +++ b/conf/testnets/taiko-hekla.yml @@ -4,9 +4,15 @@ name: taiko-hekla rpcs: - https://rpc.hekla.taiko.xyz tokens: - - symbol: 'usdt' + - symbol: eth + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native + - symbol: usdt address: '0x463D1730a8527CA58d48EF70C7460B9920346567' decimals: 18 - - symbol: 'usdc' + type: erc20 + - symbol: usdc address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' decimals: 18 + type: erc20 diff --git a/conf/testnets/zksync-sepolia.yml b/conf/testnets/zksync-sepolia.yml index 1b46433..533d3c7 100644 --- a/conf/testnets/zksync-sepolia.yml +++ b/conf/testnets/zksync-sepolia.yml @@ -4,15 +4,18 @@ name: zksync-sepolia rpcs: - https://zksync-sepolia.drpc.org tokens: + - symbol: 'eth' + address: '0x0000000000000000000000000000000000000000' + decimals: 18 + type: native - symbol: 'usdt' address: '0x3350f1ef046e21E052dCbA60Fc575919CCaFEdeb' decimals: 6 + type: erc20 - symbol: 'usdc' address: '0x253adBFE99Fcd096B9b5502753F96CF78D42eaD0' decimals: 6 - - symbol: 'eth' - address: '0x0000000000000000000000000000000000000000' - decimals: 18 + type: erc20 couples: - chain: sepolia symbol: usdc diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..4795848 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,65 @@ +{ + "name": "helixconf", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "helixconf", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "zx": "^8.1.3" + } + }, + "node_modules/@types/fs-extra": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", + "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", + "optional": true, + "dependencies": { + "@types/jsonfile": "*", + "@types/node": "*" + } + }, + "node_modules/@types/jsonfile": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", + "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "optional": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", + "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "optional": true, + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "optional": true + }, + "node_modules/zx": { + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/zx/-/zx-8.1.3.tgz", + "integrity": "sha512-fA44CRlggDOKeqt66aMwzLj1tb0zEQJmIjsSDXpmNjRRKaLFYkpeGE/zXnO05sJvSuzAlbVM50zexJJGMrIvuQ==", + "bin": { + "zx": "build/cli.js" + }, + "engines": { + "node": ">= 12.17.0" + }, + "optionalDependencies": { + "@types/fs-extra": ">=11", + "@types/node": ">=20" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..9cc2b58 --- /dev/null +++ b/package.json @@ -0,0 +1,13 @@ +{ + "name": "helixconf", + "version": "1.0.0", + "description": "Helix conf", + "scripts": { + "generate": "zx scripts/generate/index.mjs" + }, + "author": "", + "license": "ISC", + "dependencies": { + "zx": "^8.1.3" + } +} diff --git a/scripts/generate/_helper.mjs b/scripts/generate/_helper.mjs new file mode 100644 index 0000000..f8fe478 --- /dev/null +++ b/scripts/generate/_helper.mjs @@ -0,0 +1,48 @@ +export function mergeObjects(obj1, obj2) { + for (let key in obj1) { + if (!obj1.hasOwnProperty(key)) { + continue; + } + + if (Array.isArray(obj1[key])) { + if (!Array.isArray(obj2[key])) { + obj2[key] = []; + } + obj2[key] = mergeArrays(obj1[key], obj2[key]); + } else if (typeof obj1[key] === 'object' && obj1[key] !== null) { + if (typeof obj2[key] !== 'object' || obj2[key] === null) { + obj2[key] = {}; + } + mergeObjects(obj1[key], obj2[key]); + } else if (!(key in obj2)) { + obj2[key] = obj1[key]; + } + } + return obj2; +} + +export function mergeArrays(arr1, arr2) { + arr1.forEach(item1 => { + if (Array.isArray(item1)) { + arr2.push(mergeArrays(item1, [])); + } else if (typeof item1 === 'object' && item1 !== null) { + // let found = false; + // for (let i = 0; i < arr2.length; i++) { + // if (typeof arr2[i] === 'object' && arr2[i] !== null && !Array.isArray(arr2[i])) { + // if (Object.keys(item1).every(key => arr2[i].hasOwnProperty(key))) { + // console.log('found' , item1) + // mergeObjects(item1, arr2[i]); + // found = true; + // break; + // } + // } + // } + // if (!found) { + arr2.push(mergeObjects(item1, {})); + // } + } else if (!arr2.includes(item1)) { + arr2.push(item1); + } + }); + return arr2; +} diff --git a/scripts/generate/index.mjs b/scripts/generate/index.mjs new file mode 100644 index 0000000..ae26576 --- /dev/null +++ b/scripts/generate/index.mjs @@ -0,0 +1,61 @@ +import * as helper from './_helper.mjs' +import * as stdconf from './stdconf.mjs' + + +const BIN_PATH = path.resolve(__filename, '../'); +const WORK_PATH = path.resolve(BIN_PATH, '../../'); + +async function readConf(lifecycle) { + const chainMap = {}; + for (const network of lifecycle.networks) { + const pathNetwork = `${WORK_PATH}/conf/${network}`; + const rawDefinition = await fs.readFile(`${pathNetwork}/$.yml`, 'utf8'); + const global = YAML.parse(rawDefinition); + + const filesOfNetwork = await fs.readdir(pathNetwork); + for (const fileName of filesOfNetwork) { + if (fileName === '$.yml') continue; + const rawNetwork = await fs.readFile(`${pathNetwork}/${fileName}`, 'utf8'); + const networkConf = YAML.parse(rawNetwork); + chainMap[networkConf.code] = { + ...networkConf, + _network: network, + _global: global, + }; + } + } + return chainMap; +} + +function reorganizationConf(conf) { + const names = Object.keys(conf); + const newChainConf = {}; + for (const name of names) { + const ccf = conf[name]; + const nccf = helper.mergeObjects(ccf._global, ccf); + stdconf.standardization(conf, nccf); + + newChainConf[name] = nccf; + } + return newChainConf; +} + + +async function main() { + const _networkArg = argv['network']; + const networks = _networkArg + ? (typeof _networkArg) === 'string' ? [_networkArg] : _networkArg + : ['mainnets', 'testnets']; + const lifecycle = { + networks, + }; + const baseConf = await readConf(lifecycle); + lifecycle.conf = reorganizationConf(baseConf); + await fs.writeFile(`${WORK_PATH}/_tmp/output.json`, JSON.stringify(lifecycle.conf, null, 2)); +} + +await main(); + + + + diff --git a/scripts/generate/stdconf.mjs b/scripts/generate/stdconf.mjs new file mode 100644 index 0000000..08b8e87 --- /dev/null +++ b/scripts/generate/stdconf.mjs @@ -0,0 +1,91 @@ +export function standardization(global, ccf) { + _stdTokens(global, ccf); + _stdCouples(global, ccf); + _cleanConf(global, ccf); +} + +function _stdCouples(global, ccf) { + if (!ccf.couples) return; + for (const couple of ccf.couples) { + _stdSymbol(global, ccf, couple); + _stdMessager(global, ccf, couple); + _stdProtocol(global, ccf, couple); + _stdChain(global, ccf, couple); + } +} + + +function _stdTokens(global, ccf) { + for (const token of ccf.tokens) { + token.symbol = token.symbol.toUpperCase(); + if (!token.name) { + token.name = token.symbol; + } + } +} + +function _stdSymbol(global, ccf, couple) { + const rawSymbol = couple.symbol; + if (typeof rawSymbol === 'string') { + const pairs = rawSymbol.split('/'); + if (pairs.length === 1) { + couple.symbol = { + from: pairs[0].toUpperCase(), + to: pairs[0].toUpperCase(), + }; + return; + } + couple.symbol = { + from: pairs[0].toUpperCase(), + to: pairs[1].toUpperCase(), + }; + return; + } + if (rawSymbol.from && rawSymbol.to) { + rawSymbol.from = rawSymbol.from.toUpperCase(); + rawSymbol.to = rawSymbol.to.toUpperCase(); + return; + } + console.log(chalk.red('missing symbol; symbol: {from, to}')); + process.exit(1); +} + +function _stdMessager(global, ccf, couple) { + if (!couple.messager) return; + couple.messager = __pickMessager(ccf, couple.messager); +} + +function _stdProtocol(global, ccf, couple) { + if (!ccf.protocol || !couple.protocol) return; + const protocolAddress = ccf.protocol[couple.protocol]; + couple.protocol = { + name: couple.protocol, + address: protocolAddress, + }; +} + +function _stdChain(global, ccf, couple) { + const chainCode = couple.chain; + const targetChain = global[chainCode]; + if (!targetChain) { + console.log(chalk.red(`missing couple chain [${chainCode}] from [${ccf.code}], maybe you typed wrong chain code`)); + process.exit(1); + } + couple.chain = { + id: targetChain.id, + code: chainCode, + name: targetChain.name, + }; +} + +function _cleanConf(global, ccf) { + delete ccf['_global']; +} + +function __pickMessager(ccf, name) { + if (!ccf.messagers) return; + for (const messager of ccf.messagers) { + if (messager.name === name) return messager; + } + return {name}; +} From 32cd85c83a6ec255aefe984de2e95ac5ec47ce7f Mon Sep 17 00:00:00 2001 From: fewensa Date: Fri, 5 Jul 2024 16:52:56 +0000 Subject: [PATCH 6/9] Chain conf --- conf/mainnets/arbitrum.yml | 62 +++++++++++++++++++++++++++--- conf/mainnets/astar-zkevm.yml | 9 +++++ conf/mainnets/base.yml | 1 + conf/mainnets/blast.yml | 9 +++++ conf/mainnets/bsc.yml | 32 ++++++++++++++- conf/mainnets/crab.yml | 5 +++ conf/mainnets/darwinia.yml | 33 +++++++++++++++- conf/mainnets/ethereum.yml | 7 ++-- conf/mainnets/gnosis.yml | 38 ++++++++++++++++++ conf/mainnets/linea.yml | 35 ++++++++++++++++- conf/mainnets/mantle.yml | 34 ++++++++++++++++ conf/mainnets/moonbeam.yml | 24 ++++++++++++ conf/mainnets/optimism.yml | 39 +++++++++++++++++++ conf/mainnets/polygon-zkevm.yml | 11 ++++++ conf/mainnets/polygon.yml | 48 +++++++++++++++++++++-- conf/mainnets/scroll.yml | 34 ++++++++++++++++ conf/mainnets/taiko.yml | 16 ++++++++ conf/mainnets/zksync.yml | 2 + conf/testnets/$.yml | 2 +- conf/testnets/arbitrum-sepolia.yml | 46 +++++++++++++++++++++- conf/testnets/bera.yml | 16 ++++++++ conf/testnets/morph.yml | 16 ++++++++ conf/testnets/sepolia.yml | 2 + conf/testnets/taiko-hekla.yml | 14 +++++++ conf/testnets/zksync-sepolia.yml | 5 +++ scripts/generate/stdconf.mjs | 20 ++++++++-- 26 files changed, 539 insertions(+), 21 deletions(-) diff --git a/conf/mainnets/arbitrum.yml b/conf/mainnets/arbitrum.yml index d2a30e8..bae8cab 100644 --- a/conf/mainnets/arbitrum.yml +++ b/conf/mainnets/arbitrum.yml @@ -30,24 +30,50 @@ tokens: decimals: 18 type: erc20 couples: + + ## eth + - chain: blast + symbol: eth + protocol: lnv3 + fee: '10000000000000' + messager: layerzero + - chain: linea + symbol: eth + protocol: lnv2-default + fee: '10000000000000' + messager: layerzero + - chain: astar-zkevm + symbol: eth + protocol: lnv3 + fee: '10000000000000' + messager: layerzero + - chain: op + symbol: eth + protocol: lnv3 + fee: '10000000000000' + messager: layerzero + + + ## ring - chain: ethereum symbol: from: RING to: RING - protocol: 'lnv2-opposite' + protocol: lnv2-opposite fee: '100000000000000000000' - messager: 'arbitrum-l2' + messager: arbitrum-l2 - chain: polygon symbol: RING - protocol: 'lnv2-default' + protocol: lnv2-default fee: '100000000000000000000' messager: layerzero - chain: darwinia-dvm symbol: RING/RING protocol: lnv2-default - fee: '100000000000000000000' - messager: 'msgline' + fee: '10000000000000000000' + messager: msgline + ## usdt - chain: mantle symbol: USDT protocol: lnv2-default @@ -68,7 +94,33 @@ couples: protocol: lnv2-default fee: '100000' messager: layerzero + - chain: polygon + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: op + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: gnosis + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: moonbeam + symbol: USDT + protocol: lnv3 + fee: '100000' + messager: layerzero + ## usdc - chain: mantle symbol: USDC protocol: lnv2-default diff --git a/conf/mainnets/astar-zkevm.yml b/conf/mainnets/astar-zkevm.yml index e49fff2..79b155a 100644 --- a/conf/mainnets/astar-zkevm.yml +++ b/conf/mainnets/astar-zkevm.yml @@ -8,3 +8,12 @@ tokens: address: '0x0000000000000000000000000000000000000000' decimals: 18 type: native +couples: + + ## eth + - chain: arbitrum + symbol: eth + protocol: lnv3 + fee: '10000000000000' + messager: layerzero + diff --git a/conf/mainnets/base.yml b/conf/mainnets/base.yml index c2ca835..15e4176 100644 --- a/conf/mainnets/base.yml +++ b/conf/mainnets/base.yml @@ -14,6 +14,7 @@ tokens: type: erc20 couples: + ## usdc - chain: bsc symbol: usdc protocol: lnv2-default diff --git a/conf/mainnets/blast.yml b/conf/mainnets/blast.yml index 111a925..3f19999 100644 --- a/conf/mainnets/blast.yml +++ b/conf/mainnets/blast.yml @@ -8,3 +8,12 @@ tokens: address: '0x0000000000000000000000000000000000000000' decimals: 18 type: native + +couples: + ## eth + - chain: arbitrum + symbol: eth + protocol: lnv3 + fee: '10000000000000' + messager: layerzero + diff --git a/conf/mainnets/bsc.yml b/conf/mainnets/bsc.yml index 0df588a..943c8da 100644 --- a/conf/mainnets/bsc.yml +++ b/conf/mainnets/bsc.yml @@ -18,6 +18,8 @@ tokens: type: erc20 couples: + + ## usdt - chain: arbitrum symbol: usdt protocol: lnv2-default @@ -33,11 +35,39 @@ couples: protocol: lnv2-default fee: '100000000000000000' messager: layerzero + - chain: polygon + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: polygon-zkEvm + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: mantle + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: scroll + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: gnosis + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + + ## usdc - chain: base - symbol: usdt + symbol: usdc protocol: lnv2-default fee: '100000000000000000' messager: layerzero + diff --git a/conf/mainnets/crab.yml b/conf/mainnets/crab.yml index 8f81fa4..f91bbbf 100644 --- a/conf/mainnets/crab.yml +++ b/conf/mainnets/crab.yml @@ -19,15 +19,20 @@ tokens: type: erc20 couples: + + ## crab - chain: darwinia-dvm symbol: crab/xWCRAB protocol: lnv2-default fee: '100000000000000000000' messager: msgline + hidden: true - chain: darwinia-dvm symbol: xWRING/ring protocol: lnv2-default fee: '10000000000000000000' messager: msgline + category: ring + hidden: true diff --git a/conf/mainnets/darwinia.yml b/conf/mainnets/darwinia.yml index ee94d7f..9d895d5 100644 --- a/conf/mainnets/darwinia.yml +++ b/conf/mainnets/darwinia.yml @@ -12,7 +12,7 @@ tokens: address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' decimals: 18 type: erc20 - - symbol: xwcrab + - symbol: xWCRAB name: xWCRAB address: '0x656567Eb75b765FC320783cc6EDd86bD854b2305' decimals: 18 @@ -29,6 +29,8 @@ tokens: type: erc20 couples: + + ## ring - chain: arbitrum symbol: ring protocol: lnv2-default @@ -44,9 +46,36 @@ couples: protocol: lnv2-default fee: '100000000000000000000' messager: msgline + hidden: true + - chain: polygon + symbol: ring + protocol: lnv3 + fee: '100000000000000000000' + messager: msgline + ## crab - chain: crab-dvm - symbol: crab + symbol: xWCRAB/crab protocol: lnv2-default fee: '100000000000000000000' messager: msgline + category: crab + hidden: true + + ## ahUSDT + - chain: moonbeam + symbol: ahUSDT/xcUSDT + protocol: lnv3 + fee: '1000' + messager: msgline + category: usdt + + ## ahPINK + - chain: moonbeam + symbol: ahPINK/xcPINK + protocol: lnv3 + fee: '10000000' + messager: msgline + category: pink + + diff --git a/conf/mainnets/ethereum.yml b/conf/mainnets/ethereum.yml index 1e56797..2a48d54 100644 --- a/conf/mainnets/ethereum.yml +++ b/conf/mainnets/ethereum.yml @@ -13,12 +13,13 @@ tokens: decimals: 18 type: erc20 couples: + + ## ring - chain: arbitrum symbol: RING - protocol: 'lnv2-default' + protocol: lnv2-default fee: '100000000000000000000' - messager: - name: 'arbitrum-l2' + messager: arbitrum-l2 - chain: darwinia-dvm symbol: RING protocol: lnv2-default diff --git a/conf/mainnets/gnosis.yml b/conf/mainnets/gnosis.yml index d36be83..7da67e5 100644 --- a/conf/mainnets/gnosis.yml +++ b/conf/mainnets/gnosis.yml @@ -13,3 +13,41 @@ tokens: address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6' decimals: 6 type: erc20 +couples: + + ## usdt + - chain: bsc + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: polygon + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: linea + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: op + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: mantle + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: scroll + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + - chain: arbitrum + symbol: USDT + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero diff --git a/conf/mainnets/linea.yml b/conf/mainnets/linea.yml index fe92c43..67def18 100644 --- a/conf/mainnets/linea.yml +++ b/conf/mainnets/linea.yml @@ -13,12 +13,45 @@ tokens: decimals: 6 type: erc20 couples: + ## eth + - chain: arbitrum + symbol: eth + protocol: lnv2-default + fee: '10000000000000' + messager: layerzero + + ## usdt + - chain: arbitrum + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero - chain: bsc symbol: usdt protocol: lnv2-default fee: '100000' messager: layerzero - - chain: arbitrum + - chain: polygon + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: op + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: mantle + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: gnosis symbol: usdt protocol: lnv2-default fee: '100000' diff --git a/conf/mainnets/mantle.yml b/conf/mainnets/mantle.yml index 3107e1d..55accdf 100644 --- a/conf/mainnets/mantle.yml +++ b/conf/mainnets/mantle.yml @@ -17,6 +17,8 @@ tokens: decimals: 6 type: erc20 couples: + + # usdt - chain: arbitrum symbol: USDT protocol: lnv2-default @@ -32,7 +34,39 @@ couples: protocol: lnv2-default fee: '100000' messager: layerzero + - chain: scroll + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: bsc + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: linea + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: op + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: polygon + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: gnosis + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + + ## usdc - chain: arbitrum symbol: USDC protocol: lnv2-default diff --git a/conf/mainnets/moonbeam.yml b/conf/mainnets/moonbeam.yml index 81dce8f..b1417bb 100644 --- a/conf/mainnets/moonbeam.yml +++ b/conf/mainnets/moonbeam.yml @@ -22,3 +22,27 @@ tokens: address: '0xffffffff30478fafbe935e466da114e14fb3563d' decimals: 10 type: erc20 +couples: + + # usdt + - chain: darwinia-dvm + symbol: xcUSDT/ahUSDT + protocol: lnv3 + fee: '1000' + messager: msgline + category: usdt + - chain: arbitrum + symbol: USDT + protocol: lnv3 + fee: '10000000' + messager: msgline + + + ## pingk + - chain: darwinia-dvm + symbol: xcPINK/ahPINK + protocol: lnv3 + fee: '1000' + messager: msgline + category: pink + diff --git a/conf/mainnets/optimism.yml b/conf/mainnets/optimism.yml index b7d56a6..e124f7b 100644 --- a/conf/mainnets/optimism.yml +++ b/conf/mainnets/optimism.yml @@ -13,8 +13,47 @@ tokens: decimals: 6 type: erc20 couples: + + ## eth + - chain: arbitrum + symbol: eth + protocol: lnv3 + fee: '10000000000000' + messager: layerzero + + ## usdt - chain: bsc symbol: usdt protocol: lnv2-default fee: '100000' messager: layerzero + - chain: polygon + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: linea + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: arbitrum + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: mantle + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: gnosis + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/polygon-zkevm.yml b/conf/mainnets/polygon-zkevm.yml index 9e28ae4..a41e7bd 100644 --- a/conf/mainnets/polygon-zkevm.yml +++ b/conf/mainnets/polygon-zkevm.yml @@ -14,4 +14,15 @@ tokens: type: erc20 couples: + ## usdt + - chain: polygon + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: bsc + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/polygon.yml b/conf/mainnets/polygon.yml index 36b3e88..e5f0e5e 100644 --- a/conf/mainnets/polygon.yml +++ b/conf/mainnets/polygon.yml @@ -17,16 +17,58 @@ tokens: decimals: 6 type: erc20 couples: + + ## ring - chain: arbitrum symbol: ring protocol: lnv2-default fee: '100000000000000000000' messager: layerzero - - - chain: arbitrum + - chain: darwinia-dvm symbol: RING protocol: lnv3 fee: '30000000000000000000' - messager: layerzero + messager: msgline + ## usdt + - chain: polygon-zkEvm + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: arbitrum + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: linea + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: op + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: bsc + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: mantle + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: scroll + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: gnosis + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero diff --git a/conf/mainnets/scroll.yml b/conf/mainnets/scroll.yml index 40e23fa..f888f37 100644 --- a/conf/mainnets/scroll.yml +++ b/conf/mainnets/scroll.yml @@ -17,6 +17,8 @@ tokens: decimals: 6 type: erc20 couples: + + ## usdt - chain: mantle symbol: USDT protocol: lnv2-default @@ -27,7 +29,39 @@ couples: protocol: lnv2-default fee: '100000' messager: layerzero + - chain: arbitrum + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: bsc + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: polygon + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: linea + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: op + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + - chain: gnosis + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + + ## usdc - chain: mantle symbol: usdc protocol: lnv2-default diff --git a/conf/mainnets/taiko.yml b/conf/mainnets/taiko.yml index 6db8830..3ce1892 100644 --- a/conf/mainnets/taiko.yml +++ b/conf/mainnets/taiko.yml @@ -16,3 +16,19 @@ tokens: address: '0x3F7DF5866591e7E48D18C8EbeAE61Bc343a63283' decimals: 18 type: erc20 +couples: + + ## usdt + - chain: arbitrum-sepolia + symbol: USDT + protocol: lnv2-default + fee: '100000' + messager: layerzero + + ## usdc + - chain: arbitrum-sepolia + symbol: USDC + protocol: lnv2-default + fee: '100000' + messager: layerzero + diff --git a/conf/mainnets/zksync.yml b/conf/mainnets/zksync.yml index cdfa70c..48946a0 100644 --- a/conf/mainnets/zksync.yml +++ b/conf/mainnets/zksync.yml @@ -17,6 +17,8 @@ tokens: decimals: 6 type: erc20 couples: + + ## usdt - chain: arbitrum symbol: USDT protocol: lnv2-default diff --git a/conf/testnets/$.yml b/conf/testnets/$.yml index 9c2e74d..99a0b10 100644 --- a/conf/testnets/$.yml +++ b/conf/testnets/$.yml @@ -1,5 +1,5 @@ -address: +protocol: lnv2-default: '0x8429D7Dfd91D6F970ba89fFC005e67D15f1E4739' lnv2-opposite: '0xbA96d83E2A04c4E50F2D6D7eCA03D70bA2426e5f' lnv3: '0x38627Cb033De66a1E07e73f5D0a7a7adFB6741fa' diff --git a/conf/testnets/arbitrum-sepolia.yml b/conf/testnets/arbitrum-sepolia.yml index 531a907..fea6bd7 100644 --- a/conf/testnets/arbitrum-sepolia.yml +++ b/conf/testnets/arbitrum-sepolia.yml @@ -17,36 +17,78 @@ tokens: decimals: 18 type: erc20 couples: - - chain: sepolia + - chain: morph + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + category: usdc + - chain: bera + symbol: usdc + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + category: usdc + - chain: taiko-hekla symbol: usdc protocol: lnv2-default fee: '100000000000000000' messager: layerzero + category: usdc + - chain: sepolia + symbol: usdc + protocol: lnv2-opposite + fee: '100000000000000000' + category: usdc + messager: layerzero - chain: zksync-sepolia symbol: usdc protocol: lnv2-default fee: '100000000000000000' messager: layerzero + category: usdc - - chain: sepolia + - chain: morph + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + category: usdt + - chain: bera + symbol: usdt + protocol: lnv2-default + fee: '100000000000000000' + messager: layerzero + category: usdt + - chain: taiko-hekla symbol: usdt protocol: lnv2-default fee: '100000000000000000' messager: layerzero + category: usdt + - chain: sepolia + symbol: usdt + protocol: lnv2-opposite + fee: '100000000000000000' + messager: layerzero + category: usdt - chain: zksync-sepolia symbol: usdt protocol: lnv2-default fee: '100000000000000000' messager: layerzero + category: usdt - chain: sepolia symbol: eth protocol: lnv2-opposite fee: '100000000000000000' messager: layerzero + category: eth - chain: zksync-sepolia symbol: eth protocol: lnv2-default fee: '100000000000000000' messager: layerzero + category: eth diff --git a/conf/testnets/bera.yml b/conf/testnets/bera.yml index 0de89fc..7947566 100644 --- a/conf/testnets/bera.yml +++ b/conf/testnets/bera.yml @@ -16,3 +16,19 @@ tokens: address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' decimals: 18 type: erc20 + +couples: + ## usdt + - chain: arbitrum-sepolia + symbol: usdt + protocol: lnv2-default + fee: '100000' + messager: layerzero + + ## usdc + - chain: arbitrum-sepolia + symbol: usdc + protocol: lnv2-default + fee: '100000' + messager: layerzero + diff --git a/conf/testnets/morph.yml b/conf/testnets/morph.yml index 49b7d2f..8220df0 100644 --- a/conf/testnets/morph.yml +++ b/conf/testnets/morph.yml @@ -16,3 +16,19 @@ tokens: address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' decimals: 18 type: erc20 +couples: + + # usdt + - chain: arbitrum-sepolia + symbol: usdt + protocol: lnv3 + fee: '100000' + messager: layerzero + + + # usdc + - chain: arbitrum-sepolia + symbol: usdc + protocol: lnv3 + fee: '100000' + messager: layerzero diff --git a/conf/testnets/sepolia.yml b/conf/testnets/sepolia.yml index df7f3ae..b4bc81c 100644 --- a/conf/testnets/sepolia.yml +++ b/conf/testnets/sepolia.yml @@ -17,6 +17,7 @@ tokens: decimals: 18 type: erc20 couples: + ## usdc - chain: arbitrum-sepolia symbol: usdc protocol: lnv2-default @@ -29,6 +30,7 @@ couples: messager: layerzero + ## usdt - chain: arbitrum-sepolia symbol: usdt protocol: lnv2-default diff --git a/conf/testnets/taiko-hekla.yml b/conf/testnets/taiko-hekla.yml index dcac573..ccedb1c 100644 --- a/conf/testnets/taiko-hekla.yml +++ b/conf/testnets/taiko-hekla.yml @@ -16,3 +16,17 @@ tokens: address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' decimals: 18 type: erc20 +couples: + ## usdt + - chain: arbitrum-sepolia + symbol: usdt + protocol: lnv3 + fee: '100000000000000000' + messager: layerzero + + ## usdc + - chain: arbitrum-sepolia + symbol: usdc + protocol: lnv3 + fee: '100000000000000000' + messager: layerzero diff --git a/conf/testnets/zksync-sepolia.yml b/conf/testnets/zksync-sepolia.yml index 533d3c7..78522d7 100644 --- a/conf/testnets/zksync-sepolia.yml +++ b/conf/testnets/zksync-sepolia.yml @@ -17,6 +17,9 @@ tokens: decimals: 6 type: erc20 couples: + + + ## usdc - chain: sepolia symbol: usdc protocol: lnv2-default @@ -28,6 +31,7 @@ couples: fee: '100000000000000000' messager: layerzero + ## usdt - chain: sepolia symbol: usdt protocol: lnv2-default @@ -39,6 +43,7 @@ couples: fee: '100000000000000000' messager: layerzero + ## eth - chain: sepolia symbol: eth protocol: lnv2-default diff --git a/scripts/generate/stdconf.mjs b/scripts/generate/stdconf.mjs index 08b8e87..7628486 100644 --- a/scripts/generate/stdconf.mjs +++ b/scripts/generate/stdconf.mjs @@ -1,7 +1,7 @@ export function standardization(global, ccf) { _stdTokens(global, ccf); _stdCouples(global, ccf); - _cleanConf(global, ccf); + // _cleanConf(global, ccf); } function _stdCouples(global, ccf) { @@ -11,6 +11,7 @@ function _stdCouples(global, ccf) { _stdMessager(global, ccf, couple); _stdProtocol(global, ccf, couple); _stdChain(global, ccf, couple); + _stdCategory(global, ccf, couple); } } @@ -56,7 +57,12 @@ function _stdMessager(global, ccf, couple) { } function _stdProtocol(global, ccf, couple) { - if (!ccf.protocol || !couple.protocol) return; + if (!ccf.protocol) { + couple.protocol = { + name: couple.protocol, + }; + return; + } const protocolAddress = ccf.protocol[couple.protocol]; couple.protocol = { name: couple.protocol, @@ -64,6 +70,14 @@ function _stdProtocol(global, ccf, couple) { }; } +function _stdCategory(global, ccf, couple) { + if (couple.category) { + couple.category = couple.category.toUpperCase(); + return; + } + couple.category = couple.symbol.from; +} + function _stdChain(global, ccf, couple) { const chainCode = couple.chain; const targetChain = global[chainCode]; @@ -83,7 +97,7 @@ function _cleanConf(global, ccf) { } function __pickMessager(ccf, name) { - if (!ccf.messagers) return; + if (!ccf.messagers) return {name}; for (const messager of ccf.messagers) { if (messager.name === name) return messager; } From a87388eddf9134c5851a4200468ab59c86c46bbd Mon Sep 17 00:00:00 2001 From: fewensa Date: Sat, 6 Jul 2024 08:53:47 +0000 Subject: [PATCH 7/9] generate ts --- .gitignore | 1 + conf/mainnets/arbitrum.yml | 4 +- conf/mainnets/astar-zkevm.yml | 3 + conf/mainnets/bsc.yml | 3 + conf/mainnets/gnosis.yml | 3 + conf/mainnets/linea.yml | 3 + conf/mainnets/mantle.yml | 3 + conf/mainnets/moonbeam.yml | 3 + conf/mainnets/optimism.yml | 3 + conf/mainnets/polygon.yml | 3 + conf/mainnets/scroll.yml | 3 + conf/mainnets/zksync.yml | 3 + package-lock.json | 38 ++++++- package.json | 9 +- scripts/generate/index.mjs | 9 ++ scripts/generate/renderer/index.mjs | 37 +++++++ scripts/generate/renderer/lang_ts.mjs | 42 ++++++++ scripts/generate/stdconf.mjs | 2 +- template/lnv2.yml | 23 ----- template/lnv3.yml | 19 ---- template/ts/files/package.json | 11 ++ template/ts/files/src/helixconf.ts | 132 ++++++++++++++++++++++++ template/ts/templates/chain.ts.mustache | 3 + template/ts/templates/index.ts.mustache | 21 ++++ 24 files changed, 329 insertions(+), 52 deletions(-) create mode 100644 scripts/generate/renderer/index.mjs create mode 100644 scripts/generate/renderer/lang_ts.mjs delete mode 100644 template/lnv2.yml delete mode 100644 template/lnv3.yml create mode 100644 template/ts/files/package.json create mode 100644 template/ts/files/src/helixconf.ts create mode 100644 template/ts/templates/chain.ts.mustache create mode 100644 template/ts/templates/index.ts.mustache diff --git a/.gitignore b/.gitignore index 862569e..8fa97e8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ node_modules +/generated _tmp diff --git a/conf/mainnets/arbitrum.yml b/conf/mainnets/arbitrum.yml index bae8cab..222b091 100644 --- a/conf/mainnets/arbitrum.yml +++ b/conf/mainnets/arbitrum.yml @@ -10,8 +10,6 @@ protocol: messagers: - name: layerzero address: '0x509354A4ebf98aCC7a65d2264694A65a2938cac9' - - name: msgline - address: '0x65Be094765731F394bc6d9DF53bDF3376F1Fc8B0' tokens: - symbol: ETH address: '0x0000000000000000000000000000000000000000' @@ -128,7 +126,7 @@ couples: messager: layerzero - chain: scroll symbol: USDC - protol: lnv2-default + protocol: lnv2-default fee: '100000' messager: layerzero diff --git a/conf/mainnets/astar-zkevm.yml b/conf/mainnets/astar-zkevm.yml index 79b155a..a907092 100644 --- a/conf/mainnets/astar-zkevm.yml +++ b/conf/mainnets/astar-zkevm.yml @@ -3,6 +3,9 @@ code: astar-zkevm name: Astar zkEVM rpcs: - https://rpc.startale.com/astar-zkevm +messagers: + - name: layerzero + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/bsc.yml b/conf/mainnets/bsc.yml index 943c8da..8de8700 100644 --- a/conf/mainnets/bsc.yml +++ b/conf/mainnets/bsc.yml @@ -3,6 +3,9 @@ code: bsc name: bsc rpcs: - https://bsc-rpc.publicnode.com +messagers: + - name: layerzero + address: '0x89AF830781A2C1d3580Db930bea11094F55AfEae' tokens: - symbol: bnb address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/gnosis.yml b/conf/mainnets/gnosis.yml index 7da67e5..74e7d59 100644 --- a/conf/mainnets/gnosis.yml +++ b/conf/mainnets/gnosis.yml @@ -3,6 +3,9 @@ code: gnosis name: Gnosis rpcs: - https://gnosis-rpc.publicnode.com +messagers: + - name: layerzero + address: '0x3F7DF5866591e7E48D18C8EbeAE61Bc343a63283' tokens: - symbol: xDai name: xDai diff --git a/conf/mainnets/linea.yml b/conf/mainnets/linea.yml index 67def18..4a64d9a 100644 --- a/conf/mainnets/linea.yml +++ b/conf/mainnets/linea.yml @@ -3,6 +3,9 @@ code: linea name: Linea rpcs: - https://linea.decubate.com +messagers: + - name: layerzero + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/mantle.yml b/conf/mainnets/mantle.yml index 55accdf..6de34c0 100644 --- a/conf/mainnets/mantle.yml +++ b/conf/mainnets/mantle.yml @@ -3,6 +3,9 @@ code: mantle name: Mantle rpcs: - https://mantle-rpc.publicnode.com +messagers: + - name: layerzero + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' tokens: - symbol: MNT address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/moonbeam.yml b/conf/mainnets/moonbeam.yml index b1417bb..56a13e2 100644 --- a/conf/mainnets/moonbeam.yml +++ b/conf/mainnets/moonbeam.yml @@ -3,6 +3,9 @@ code: moonbeam name: Moonbeam rpcs: - https://moonbeam-rpc.dwellir.com +messagers: + - name: layerzero + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' tokens: - symbol: GLMR address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/optimism.yml b/conf/mainnets/optimism.yml index e124f7b..64e2f57 100644 --- a/conf/mainnets/optimism.yml +++ b/conf/mainnets/optimism.yml @@ -3,6 +3,9 @@ code: op name: Op rpcs: - https://optimism-rpc.publicnode.com +messagers: + - name: layerzero + address: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1' tokens: - symbol: eth address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/polygon.yml b/conf/mainnets/polygon.yml index e5f0e5e..87b2c7e 100644 --- a/conf/mainnets/polygon.yml +++ b/conf/mainnets/polygon.yml @@ -3,6 +3,9 @@ code: polygon name: Polygon rpcs: - https://polygon-bor-rpc.publicnode.com +messagers: + - name: layerzero + address: '0x463D1730a8527CA58d48EF70C7460B9920346567' tokens: - symbol: MATIC address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/scroll.yml b/conf/mainnets/scroll.yml index f888f37..40e1f85 100644 --- a/conf/mainnets/scroll.yml +++ b/conf/mainnets/scroll.yml @@ -3,6 +3,9 @@ code: scroll name: Scroll rpcs: - https://scroll-mainnet.public.blastapi.io +messagers: + - name: layerzero + address: '0x463d1730a8527ca58d48ef70c7460b9920346567' tokens: - symbol: eth address: '0x0000000000000000000000000000000000000000' diff --git a/conf/mainnets/zksync.yml b/conf/mainnets/zksync.yml index 48946a0..b42363f 100644 --- a/conf/mainnets/zksync.yml +++ b/conf/mainnets/zksync.yml @@ -3,6 +3,9 @@ code: zksync name: zksync rpcs: - https://mainnet.era.zksync.io +messagers: + - name: layerzero + address: '0x96892F3EaD26515592Da38432cFABad991BBd69d' tokens: - symbol: 'eth' address: '0x0000000000000000000000000000000000000000' diff --git a/package-lock.json b/package-lock.json index 4795848..a8bebe2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,21 +1,34 @@ { - "name": "helixconf", + "name": "helixconf-generate", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "helixconf", + "name": "helixconf-generate", "version": "1.0.0", "license": "ISC", - "dependencies": { + "devDependencies": { + "@jvitela/mustache-wax": "^1.0.4", + "change-case": "^5.4.4", + "mustache": "^4.2.0", "zx": "^8.1.3" } }, + "node_modules/@jvitela/mustache-wax": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@jvitela/mustache-wax/-/mustache-wax-1.0.4.tgz", + "integrity": "sha512-cGugVYp0WO7w89KQlyyt2rQyCO5MbrKeqtIAkG8oBfOaiHoeGeKG7WYdBFHftvoZUuK4WFbWyn3hgFipdetC+Q==", + "dev": true, + "peerDependencies": { + "mustache": "^4.2.0" + } + }, "node_modules/@types/fs-extra": { "version": "11.0.4", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-11.0.4.tgz", "integrity": "sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==", + "dev": true, "optional": true, "dependencies": { "@types/jsonfile": "*", @@ -26,6 +39,7 @@ "version": "6.1.4", "resolved": "https://registry.npmjs.org/@types/jsonfile/-/jsonfile-6.1.4.tgz", "integrity": "sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==", + "dev": true, "optional": true, "dependencies": { "@types/node": "*" @@ -35,21 +49,39 @@ "version": "20.14.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "dev": true, "optional": true, "dependencies": { "undici-types": "~5.26.4" } }, + "node_modules/change-case": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", + "dev": true + }, + "node_modules/mustache": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", + "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", + "dev": true, + "bin": { + "mustache": "bin/mustache" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, "optional": true }, "node_modules/zx": { "version": "8.1.3", "resolved": "https://registry.npmjs.org/zx/-/zx-8.1.3.tgz", "integrity": "sha512-fA44CRlggDOKeqt66aMwzLj1tb0zEQJmIjsSDXpmNjRRKaLFYkpeGE/zXnO05sJvSuzAlbVM50zexJJGMrIvuQ==", + "dev": true, "bin": { "zx": "build/cli.js" }, diff --git a/package.json b/package.json index 9cc2b58..ee26607 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,16 @@ { - "name": "helixconf", + "name": "helixconf-generate", "version": "1.0.0", - "description": "Helix conf", + "description": "Generate Helix conf", "scripts": { "generate": "zx scripts/generate/index.mjs" }, "author": "", "license": "ISC", - "dependencies": { + "devDependencies": { + "@jvitela/mustache-wax": "^1.0.4", + "change-case": "^5.4.4", + "mustache": "^4.2.0", "zx": "^8.1.3" } } diff --git a/scripts/generate/index.mjs b/scripts/generate/index.mjs index ae26576..3714530 100644 --- a/scripts/generate/index.mjs +++ b/scripts/generate/index.mjs @@ -1,5 +1,6 @@ import * as helper from './_helper.mjs' import * as stdconf from './stdconf.mjs' +import * as renderer from './renderer/index.mjs' const BIN_PATH = path.resolve(__filename, '../'); @@ -41,17 +42,25 @@ function reorganizationConf(conf) { } +async function generateLangauge(lifecycle) { + const language = (argv['language'] || 'js').toUpperCase(); + await renderer.render(lifecycle, language); +} + async function main() { const _networkArg = argv['network']; const networks = _networkArg ? (typeof _networkArg) === 'string' ? [_networkArg] : _networkArg : ['mainnets', 'testnets']; const lifecycle = { + workdir: WORK_PATH, networks, }; const baseConf = await readConf(lifecycle); lifecycle.conf = reorganizationConf(baseConf); await fs.writeFile(`${WORK_PATH}/_tmp/output.json`, JSON.stringify(lifecycle.conf, null, 2)); + + await generateLangauge(lifecycle); } await main(); diff --git a/scripts/generate/renderer/index.mjs b/scripts/generate/renderer/index.mjs new file mode 100644 index 0000000..d9b2db2 --- /dev/null +++ b/scripts/generate/renderer/index.mjs @@ -0,0 +1,37 @@ +import * as langTs from './lang_ts.mjs' + +import * as changeCase from "change-case"; + +const Mustache = require('mustache'); +const Wax = require('@jvitela/mustache-wax'); + +Wax(Mustache); +Mustache.Formatters = { + json_stringify: object => JSON.stringify(object, null, 2), + camel_case: text => changeCase.camelCase(text), // twoWords + capital_case: text => changeCase.capitalCase(text), // Two Words + constant_case: text => changeCase.constantCase(text), // TWO_WORDS + dot_case: text => changeCase.dotCase(text), // two.words + kebab_case: text => changeCase.kebabCase(text), // two-words + no_case: text => changeCase.noCase(text), // two words + pascal_case: text => changeCase.pascalCase(text), // TwoWords + pascal_snake_case: text => changeCase.pascalSnakeCase(text), // Two_Words + path_case: text => changeCase.pathCase(text), // two/words + sentence_case: text => changeCase.sentenceCase(text), // Two words + snake_case: text => changeCase.snakeCase(text), // two_words + train_case: text => changeCase.trainCase(text), // Two-Words + upper_case: text => text ? text.toUpperCase() : text, // TWO WORDS + lower_case: text => text ? text.toLowerCase() : text, // two words +}; + + +export async function render(lifecycle, language) { + switch (language) { + case 'JS': + case 'TS': + case 'JAVASCRIPT': + case 'TYPESCRIPT': { + await langTs.render(lifecycle); + } + } +} diff --git a/scripts/generate/renderer/lang_ts.mjs b/scripts/generate/renderer/lang_ts.mjs new file mode 100644 index 0000000..adf5b4a --- /dev/null +++ b/scripts/generate/renderer/lang_ts.mjs @@ -0,0 +1,42 @@ +const Mustache = require('mustache'); + +export async function render(lifecycle) { + const {workdir, conf} = lifecycle + const langTs = { + templateDir: `${workdir}/template/ts/templates`, + filesDir: `${workdir}/template/ts/files`, + baseDir: `${workdir}/generated/typescript`, + srcDir: `${workdir}/generated/typescript/src`, + }; + lifecycle.langTs = langTs; + + await fs.mkdirp(langTs.srcDir); + await copyFiles(lifecycle) + await renderChain(lifecycle); +} + +async function renderChain(lifecycle) { + const {conf, langTs} = lifecycle; + const chainNames = Object.keys(conf); + const chainTpl = await fs.readFile(`${langTs.templateDir}/chain.ts.mustache`, 'utf8'); + + const chainList = []; + for (const name of chainNames) { + const cf = conf[name]; + const networkDir = `${langTs.srcDir}/${cf._network}`; + await fs.mkdirp(networkDir); + const output = Mustache.render(chainTpl, {chain: cf}); + await fs.writeFile(`${networkDir}/${name}.ts`, output); + chainList.push({network: cf._network, name: name}); + } + chainList[chainList.length - 1].last = true + + const indexTpl = await fs.readFile(`${langTs.templateDir}/index.ts.mustache`, 'utf8'); + const output = Mustache.render(indexTpl, {chains: chainList}); + await fs.writeFile(`${langTs.srcDir}/index.ts`, output); +} + +async function copyFiles(lifecycle) { + const {conf, langTs} = lifecycle; + await fs.copy(langTs.filesDir, langTs.baseDir, {overwrite: true}); +} diff --git a/scripts/generate/stdconf.mjs b/scripts/generate/stdconf.mjs index 7628486..fae3381 100644 --- a/scripts/generate/stdconf.mjs +++ b/scripts/generate/stdconf.mjs @@ -1,7 +1,7 @@ export function standardization(global, ccf) { _stdTokens(global, ccf); _stdCouples(global, ccf); - // _cleanConf(global, ccf); + _cleanConf(global, ccf); } function _stdCouples(global, ccf) { diff --git a/template/lnv2.yml b/template/lnv2.yml deleted file mode 100644 index 298f809..0000000 --- a/template/lnv2.yml +++ /dev/null @@ -1,23 +0,0 @@ -chainId: '$chain.id' -chainName: '$chain.code' -rpc: '$chain.rpc' -address: - default: '$chain.addressDefault' - opposite: '$chain.addressOpposite' -tokens: - $type: 'array' - key: '$token.symbol' - fromSymbol: '$token.symbol' - fromAddress: '$token.address' - decimals: '$token.decimals' - remoteInfos: - $type: 'array' - toChain: '$remote.toChain' - toChainName: '$remote.toChainCode' - toSymbol: '$remote.toSymbol' - toAddress: '$remote.toAddress' - protocolFee: '$remote.protocolFee' - decimals: '$remote.decimals' - bridgeType: '$remote.bridgeType' - channel: '$remote.channel' - diff --git a/template/lnv3.yml b/template/lnv3.yml deleted file mode 100644 index a3862eb..0000000 --- a/template/lnv3.yml +++ /dev/null @@ -1,19 +0,0 @@ -chainId: '$chain.id' -chainName: '$chain.code' -rpc: '$chain.rpc' -address: '$chain.address' -level0Indexer: '$chain.level0Indexer' -bridge: 'lnv3' -tokens: - $type: 'array' - key: '$token.symbol' - symbol: '$token.symbol' - address: '$token.address' - outerAddress: '$token.address' - decimals: '$token.decimals' - protocolFee: '$token.protocolFee' -channels: - $type: 'array' - chain: '$channel.chain' - channel: '$channel.channel' - diff --git a/template/ts/files/package.json b/template/ts/files/package.json new file mode 100644 index 0000000..b04c613 --- /dev/null +++ b/template/ts/files/package.json @@ -0,0 +1,11 @@ +{ + "name": "helixconf", + "version": "0.0.1", + "description": "Helix conf", + "scripts": { + }, + "author": "HelixBridge", + "license": "MIT", + "devDependencies": { + } +} diff --git a/template/ts/files/src/helixconf.ts b/template/ts/files/src/helixconf.ts new file mode 100644 index 0000000..f303c35 --- /dev/null +++ b/template/ts/files/src/helixconf.ts @@ -0,0 +1,132 @@ +export type HelixProtocolName = 'lnv2-default' | 'lnv2-opposite' | 'lnv3'; +export type TokenType = 'native' | 'erc20'; +export type _NetworkType = 'mainnets' | 'testnets'; + + +export interface ChainMessager { + name: string + address?: string +} + +export interface ChainToken { + symbol: string + address: string + decimals: number + type: TokenType, + name: string +} + +export interface ChainCouple { + category: string + messager: ChainMessager + fee: string + protocol: HelixProtocol + symbol: CoupleSymbol + chain: CoupleChain +} + +export interface CoupleChain { + id: BigInt + code: string + name: string +} + +export interface CoupleSymbol { + from: string + to: string +} + +export interface HelixProtocol { + name: HelixProtocolName, + address: string +} + +export interface CoupleFilter { + category?: string + messager?: string + protocol?: string + chain?: string + symbolFrom?: string + symbolTo?: string + symbol?: string +} + + +export class HelixChainConf { + private _network: _NetworkType; + private id: BigInt; + private code: string; + private name: string; + private rpcs: string[]; + private protocol: Partial>; + private messagers: ChainMessager[]; + private tokens: ChainToken[]; + private couples: ChainCouple[]; + + static fromJson(json): HelixChainConf { + const hcc = new HelixChainConf(); + hcc._network = json._network; + hcc.id = BigInt(json.id); + hcc.code = json.code; + hcc.name = json.name; + hcc.rpcs = json.rpcs; + hcc.protocol = json.protocol; + hcc.messagers = json.messagers; + hcc.tokens = json.tokens; + hcc.couples = json.couples; + return hcc; + } + + categories(): string[] { + return this.couples.map(item => item.category); + } + + filterCouple(filter: CoupleFilter): ChainCouple[] { + if (!filter) return this.couples; + return this.couples.filter(item => { + if (filter.category) { + if (!_equalsIgnoreCase(item.category, filter.category)) { + return false; + } + } + if (filter.messager) { + const eq = _equalsIgnoreCase(item.messager.name, filter.messager) + || _equalsIgnoreCase(item.messager.address, filter.messager); + if (!eq) return false; + } + if (filter.protocol) { + const eq = _equalsIgnoreCase(item.protocol.name, filter.messager) + || _equalsIgnoreCase(item.protocol.address, filter.messager); + if (!eq) return false; + } + if (filter.chain) { + const eq = _equalsIgnoreCase(item.chain.id.toString(), filter.chain) + || _equalsIgnoreCase(item.chain.code, filter.chain) + || _equalsIgnoreCase(item.chain.name, filter.chain); + if (!eq) return false; + } + if (filter.symbolFrom) { + if (!_equalsIgnoreCase(item.symbol.from, filter.symbolFrom)) return false; + } + if (filter.symbolTo) { + if (!_equalsIgnoreCase(item.symbol.to, filter.symbolTo)) return false; + } + if (filter.symbol) { + const eq = _equalsIgnoreCase(item.symbol.from, filter.symbol) + || _equalsIgnoreCase(item.symbol.to, filter.symbol); + if (!eq) return false; + } + return true; + }); + } + +} + + +function _equalsIgnoreCase(t1, t2) { + if (!t1 || !t2) { + return false; + } + return t1.toLowerCase() === t2.toLowerCase(); +} + diff --git a/template/ts/templates/chain.ts.mustache b/template/ts/templates/chain.ts.mustache new file mode 100644 index 0000000..1217768 --- /dev/null +++ b/template/ts/templates/chain.ts.mustache @@ -0,0 +1,3 @@ +import {HelixChainConf} from '../helixconf' + +export const {{ chain.code | camel_case }}Chain: HelixChainConf = HelixChainConf.fromJson({{ &chain | json_stringify }}); diff --git a/template/ts/templates/index.ts.mustache b/template/ts/templates/index.ts.mustache new file mode 100644 index 0000000..cc0bbbb --- /dev/null +++ b/template/ts/templates/index.ts.mustache @@ -0,0 +1,21 @@ +{{#chains}} +import { {{ name | camel_case }}Chain } from './{{ network }}/{{ name }}' +{{/chains}} +import { HelixChainConf } from './helixconf' + + +export class HelixChain { +{{#chains}} + static {{ name | camel_case }}: HelixChainConf = {{ name | camel_case }}Chain; +{{/chains}} + static get(name: string): HelixChainConf | undefined { + switch(name.toUpperCase()) { + {{#chains}} + case '{{ name | upper_case }}': + return {{ name | camel_case }}Chain; + {{/chains}} + } + } +} + + From 44c2a2ab1e8a724bec6b435b37babe0dd6afdfa0 Mon Sep 17 00:00:00 2001 From: fewensa Date: Sat, 6 Jul 2024 08:54:48 +0000 Subject: [PATCH 8/9] make string to chain id --- conf/mainnets/arbitrum.yml | 2 +- conf/mainnets/astar-zkevm.yml | 2 +- conf/mainnets/base.yml | 2 +- conf/mainnets/blast.yml | 2 +- conf/mainnets/bsc.yml | 2 +- conf/mainnets/crab.yml | 2 +- conf/mainnets/darwinia.yml | 2 +- conf/mainnets/ethereum.yml | 2 +- conf/mainnets/gnosis.yml | 2 +- conf/mainnets/linea.yml | 2 +- conf/mainnets/mantle.yml | 2 +- conf/mainnets/moonbeam.yml | 2 +- conf/mainnets/optimism.yml | 2 +- conf/mainnets/polygon-zkevm.yml | 2 +- conf/mainnets/polygon.yml | 2 +- conf/mainnets/scroll.yml | 2 +- conf/mainnets/taiko.yml | 2 +- conf/mainnets/zksync.yml | 2 +- conf/testnets/arbitrum-sepolia.yml | 2 +- conf/testnets/bera.yml | 2 +- conf/testnets/morph.yml | 2 +- conf/testnets/sepolia.yml | 2 +- conf/testnets/taiko-hekla.yml | 2 +- conf/testnets/zksync-sepolia.yml | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/conf/mainnets/arbitrum.yml b/conf/mainnets/arbitrum.yml index 222b091..bfabee1 100644 --- a/conf/mainnets/arbitrum.yml +++ b/conf/mainnets/arbitrum.yml @@ -1,4 +1,4 @@ -id: 42161 +id: "42161" code: arbitrum name: Arbitrum rpcs: diff --git a/conf/mainnets/astar-zkevm.yml b/conf/mainnets/astar-zkevm.yml index a907092..2afbe76 100644 --- a/conf/mainnets/astar-zkevm.yml +++ b/conf/mainnets/astar-zkevm.yml @@ -1,4 +1,4 @@ -id: 3776 +id: "3776" code: astar-zkevm name: Astar zkEVM rpcs: diff --git a/conf/mainnets/base.yml b/conf/mainnets/base.yml index 15e4176..5d098d0 100644 --- a/conf/mainnets/base.yml +++ b/conf/mainnets/base.yml @@ -1,4 +1,4 @@ -id: 8453 +id: "8453" code: base name: base rpcs: diff --git a/conf/mainnets/blast.yml b/conf/mainnets/blast.yml index 3f19999..5db6b56 100644 --- a/conf/mainnets/blast.yml +++ b/conf/mainnets/blast.yml @@ -1,4 +1,4 @@ -id: 81457 +id: "81457" code: blast name: Blast rpcs: diff --git a/conf/mainnets/bsc.yml b/conf/mainnets/bsc.yml index 8de8700..0772d6f 100644 --- a/conf/mainnets/bsc.yml +++ b/conf/mainnets/bsc.yml @@ -1,4 +1,4 @@ -id: 56 +id: "56" code: bsc name: bsc rpcs: diff --git a/conf/mainnets/crab.yml b/conf/mainnets/crab.yml index f91bbbf..f4e75eb 100644 --- a/conf/mainnets/crab.yml +++ b/conf/mainnets/crab.yml @@ -1,4 +1,4 @@ -id: 44 +id: "44" code: crab-dvm name: Crab rpcs: diff --git a/conf/mainnets/darwinia.yml b/conf/mainnets/darwinia.yml index 9d895d5..9fd48c1 100644 --- a/conf/mainnets/darwinia.yml +++ b/conf/mainnets/darwinia.yml @@ -1,4 +1,4 @@ -id: 46 +id: "46" code: darwinia-dvm name: Darwinia rpcs: diff --git a/conf/mainnets/ethereum.yml b/conf/mainnets/ethereum.yml index 2a48d54..b11e165 100644 --- a/conf/mainnets/ethereum.yml +++ b/conf/mainnets/ethereum.yml @@ -1,4 +1,4 @@ -id: 1 +id: "1" code: ethereum name: Ethereum rpcs: diff --git a/conf/mainnets/gnosis.yml b/conf/mainnets/gnosis.yml index 74e7d59..3caf85c 100644 --- a/conf/mainnets/gnosis.yml +++ b/conf/mainnets/gnosis.yml @@ -1,4 +1,4 @@ -id: 100 +id: "100" code: gnosis name: Gnosis rpcs: diff --git a/conf/mainnets/linea.yml b/conf/mainnets/linea.yml index 4a64d9a..ed1751d 100644 --- a/conf/mainnets/linea.yml +++ b/conf/mainnets/linea.yml @@ -1,4 +1,4 @@ -id: 59144 +id: "59144" code: linea name: Linea rpcs: diff --git a/conf/mainnets/mantle.yml b/conf/mainnets/mantle.yml index 6de34c0..ce6f588 100644 --- a/conf/mainnets/mantle.yml +++ b/conf/mainnets/mantle.yml @@ -1,4 +1,4 @@ -id: 5000 +id: "5000" code: mantle name: Mantle rpcs: diff --git a/conf/mainnets/moonbeam.yml b/conf/mainnets/moonbeam.yml index 56a13e2..ffad8de 100644 --- a/conf/mainnets/moonbeam.yml +++ b/conf/mainnets/moonbeam.yml @@ -1,4 +1,4 @@ -id: 1284 +id: "1284" code: moonbeam name: Moonbeam rpcs: diff --git a/conf/mainnets/optimism.yml b/conf/mainnets/optimism.yml index 64e2f57..01bfc7d 100644 --- a/conf/mainnets/optimism.yml +++ b/conf/mainnets/optimism.yml @@ -1,4 +1,4 @@ -id: 10 +id: "10" code: op name: Op rpcs: diff --git a/conf/mainnets/polygon-zkevm.yml b/conf/mainnets/polygon-zkevm.yml index a41e7bd..a3b397e 100644 --- a/conf/mainnets/polygon-zkevm.yml +++ b/conf/mainnets/polygon-zkevm.yml @@ -1,4 +1,4 @@ -id: 1101 +id: "1101" code: polygon-zkEvm name: Polygon zkEVM rpcs: diff --git a/conf/mainnets/polygon.yml b/conf/mainnets/polygon.yml index 87b2c7e..75cc936 100644 --- a/conf/mainnets/polygon.yml +++ b/conf/mainnets/polygon.yml @@ -1,4 +1,4 @@ -id: 137 +id: "137" code: polygon name: Polygon rpcs: diff --git a/conf/mainnets/scroll.yml b/conf/mainnets/scroll.yml index 40e1f85..bb042f3 100644 --- a/conf/mainnets/scroll.yml +++ b/conf/mainnets/scroll.yml @@ -1,4 +1,4 @@ -id: 534352 +id: "534352" code: scroll name: Scroll rpcs: diff --git a/conf/mainnets/taiko.yml b/conf/mainnets/taiko.yml index 3ce1892..7dbd179 100644 --- a/conf/mainnets/taiko.yml +++ b/conf/mainnets/taiko.yml @@ -1,4 +1,4 @@ -id: 167000 +id: "167000" code: taiko name: taiko rpcs: diff --git a/conf/mainnets/zksync.yml b/conf/mainnets/zksync.yml index b42363f..789b7c3 100644 --- a/conf/mainnets/zksync.yml +++ b/conf/mainnets/zksync.yml @@ -1,4 +1,4 @@ -id: 324 +id: "324" code: zksync name: zksync rpcs: diff --git a/conf/testnets/arbitrum-sepolia.yml b/conf/testnets/arbitrum-sepolia.yml index fea6bd7..eb98a38 100644 --- a/conf/testnets/arbitrum-sepolia.yml +++ b/conf/testnets/arbitrum-sepolia.yml @@ -1,4 +1,4 @@ -id: 421614 +id: "421614" code: arbitrum-sepolia name: Arbitrum sepolia rpcs: diff --git a/conf/testnets/bera.yml b/conf/testnets/bera.yml index 7947566..c409d82 100644 --- a/conf/testnets/bera.yml +++ b/conf/testnets/bera.yml @@ -1,4 +1,4 @@ -id: 80085 +id: "80085" code: bera name: bera rpcs: diff --git a/conf/testnets/morph.yml b/conf/testnets/morph.yml index 8220df0..4eef6ba 100644 --- a/conf/testnets/morph.yml +++ b/conf/testnets/morph.yml @@ -1,4 +1,4 @@ -id: 2710 +id: "2710" code: morph name: morph rpcs: diff --git a/conf/testnets/sepolia.yml b/conf/testnets/sepolia.yml index b4bc81c..b194322 100644 --- a/conf/testnets/sepolia.yml +++ b/conf/testnets/sepolia.yml @@ -1,4 +1,4 @@ -id: 11155111 +id: "11155111" code: sepolia name: Sepolia rpcs: diff --git a/conf/testnets/taiko-hekla.yml b/conf/testnets/taiko-hekla.yml index ccedb1c..c6fc91b 100644 --- a/conf/testnets/taiko-hekla.yml +++ b/conf/testnets/taiko-hekla.yml @@ -1,4 +1,4 @@ -id: 167009 +id: "167009" code: taiko-hekla name: taiko-hekla rpcs: diff --git a/conf/testnets/zksync-sepolia.yml b/conf/testnets/zksync-sepolia.yml index 78522d7..74a8313 100644 --- a/conf/testnets/zksync-sepolia.yml +++ b/conf/testnets/zksync-sepolia.yml @@ -1,4 +1,4 @@ -id: 300 +id: "300" code: zksync-sepolia name: zksync-sepolia rpcs: From b13f6837281734ac7f240cecff5dabf76f69a815 Mon Sep 17 00:00:00 2001 From: fewensa Date: Sat, 6 Jul 2024 15:02:13 +0000 Subject: [PATCH 9/9] ts output --- package.json | 4 +- scripts/generate/stdconf.mjs | 1 + template/ts/files/.editorconfig | 9 ++++ template/ts/files/.gitignore | 10 +++++ template/ts/files/jest.config.js | 5 +++ template/ts/files/package.json | 8 ++++ template/ts/files/src/helixconf.ts | 51 ++++++++++++----------- template/ts/files/tests/helixconf.test.ts | 10 +++++ template/ts/files/tsconfig.json | 18 ++++++++ 9 files changed, 91 insertions(+), 25 deletions(-) create mode 100644 template/ts/files/.editorconfig create mode 100644 template/ts/files/.gitignore create mode 100644 template/ts/files/jest.config.js create mode 100644 template/ts/files/tests/helixconf.test.ts create mode 100644 template/ts/files/tsconfig.json diff --git a/package.json b/package.json index ee26607..dbf6636 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,9 @@ "version": "1.0.0", "description": "Generate Helix conf", "scripts": { - "generate": "zx scripts/generate/index.mjs" + "generate": "zx scripts/generate/index.mjs", + "build:ts": "npm run generate -- --language=ts && cd generated/typescript && npm i && npm run build", + "test:ts": "npm run build:ts && cd generated/typescript && npm run test" }, "author": "", "license": "ISC", diff --git a/scripts/generate/stdconf.mjs b/scripts/generate/stdconf.mjs index fae3381..eec4fca 100644 --- a/scripts/generate/stdconf.mjs +++ b/scripts/generate/stdconf.mjs @@ -52,6 +52,7 @@ function _stdSymbol(global, ccf, couple) { } function _stdMessager(global, ccf, couple) { + if (!ccf.messagers) ccf.messagers = []; if (!couple.messager) return; couple.messager = __pickMessager(ccf, couple.messager); } diff --git a/template/ts/files/.editorconfig b/template/ts/files/.editorconfig new file mode 100644 index 0000000..99580d0 --- /dev/null +++ b/template/ts/files/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/template/ts/files/.gitignore b/template/ts/files/.gitignore new file mode 100644 index 0000000..9f65662 --- /dev/null +++ b/template/ts/files/.gitignore @@ -0,0 +1,10 @@ +*.retry +.DS_Store +*.local.* + +node_modules + +/generated +dist +_tmp + diff --git a/template/ts/files/jest.config.js b/template/ts/files/jest.config.js new file mode 100644 index 0000000..3745fc2 --- /dev/null +++ b/template/ts/files/jest.config.js @@ -0,0 +1,5 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + preset: 'ts-jest', + testEnvironment: 'node', +}; diff --git a/template/ts/files/package.json b/template/ts/files/package.json index b04c613..1d50475 100644 --- a/template/ts/files/package.json +++ b/template/ts/files/package.json @@ -2,10 +2,18 @@ "name": "helixconf", "version": "0.0.1", "description": "Helix conf", + "main": "dist/index.js", "scripts": { + "build": "rm -rf dist && tsc", + "test": "jest" }, "author": "HelixBridge", "license": "MIT", "devDependencies": { + "@types/jest": "^29.5.12", + "jest": "^29.7.0", + "ts-jest": "^29.1.5", + "ts-node": "^10.9.2", + "typescript": "^5.5.3" } } diff --git a/template/ts/files/src/helixconf.ts b/template/ts/files/src/helixconf.ts index f303c35..4ea12f7 100644 --- a/template/ts/files/src/helixconf.ts +++ b/template/ts/files/src/helixconf.ts @@ -51,30 +51,33 @@ export interface CoupleFilter { symbol?: string } - export class HelixChainConf { - private _network: _NetworkType; - private id: BigInt; - private code: string; - private name: string; - private rpcs: string[]; - private protocol: Partial>; - private messagers: ChainMessager[]; - private tokens: ChainToken[]; - private couples: ChainCouple[]; - - static fromJson(json): HelixChainConf { - const hcc = new HelixChainConf(); - hcc._network = json._network; - hcc.id = BigInt(json.id); - hcc.code = json.code; - hcc.name = json.name; - hcc.rpcs = json.rpcs; - hcc.protocol = json.protocol; - hcc.messagers = json.messagers; - hcc.tokens = json.tokens; - hcc.couples = json.couples; - return hcc; + + constructor( + public readonly _network: _NetworkType, + public readonly id: BigInt, + public readonly code: string, + public readonly name: string, + public readonly rpcs: string[], + public readonly protocol: Partial>, + public readonly messagers: ChainMessager[], + public readonly tokens: ChainToken[], + public readonly couples: ChainCouple[], + ) { + } + + static fromJson(json: any): HelixChainConf { + return new HelixChainConf( + json._network, + BigInt(json.id), + json.code, + json.name, + json.rpcs, + json.protocol, + json.messagers, + json.tokens, + json.couples, + ); } categories(): string[] { @@ -123,7 +126,7 @@ export class HelixChainConf { } -function _equalsIgnoreCase(t1, t2) { +function _equalsIgnoreCase(t1?: string, t2?: string) { if (!t1 || !t2) { return false; } diff --git a/template/ts/files/tests/helixconf.test.ts b/template/ts/files/tests/helixconf.test.ts new file mode 100644 index 0000000..1d785c7 --- /dev/null +++ b/template/ts/files/tests/helixconf.test.ts @@ -0,0 +1,10 @@ +import {HelixChain} from '../src/' + +describe('helixconf_test', () => { + test('test_chainId', () => { + expect(42161n).toStrictEqual(HelixChain.arbitrum.id); + expect(46n).toStrictEqual(HelixChain.darwiniaDvm.id); + expect(44n).toStrictEqual(HelixChain.crabDvm.id); + }); +}); + diff --git a/template/ts/files/tsconfig.json b/template/ts/files/tsconfig.json new file mode 100644 index 0000000..3abc7b9 --- /dev/null +++ b/template/ts/files/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "CommonJS", + "rootDir": "./", + "moduleResolution": "node", + "declaration": true, + "outDir": "./dist", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true + }, + "exclude": [ + "node_modules", + "dist" + ] +}