-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add XAI token list #121
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d50c56c
feat: Add XAI token list
chrstph-dvx 7057202
Set ARB_ONE_RPC in CI
chrstph-dvx 5023a72
Add default version if list doesn't exist
chrstph-dvx b8a004e
Add comments
chrstph-dvx a6ce879
Update src/lib/instantiate_bridge.ts
chrstph-dvx 53f977e
Rename L1 to parent and L2 to child
chrstph-dvx 3bef420
Update list url
chrstph-dvx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -7,40 +7,44 @@ export const getNetworkConfig = async () => { | |||||
const networkID = argv.l2NetworkID; | ||||||
console.log('Using L2 networkID:', networkID); | ||||||
|
||||||
const l2Rpc = (() => { | ||||||
if (networkID === 42161) return 'https://arb1.arbitrum.io/rpc'; | ||||||
else if (networkID === 42170) return 'https://nova.arbitrum.io/rpc'; | ||||||
else if (networkID === 421613) | ||||||
return 'https://goerli-rollup.arbitrum.io/rpc'; | ||||||
else if (networkID === 421614) | ||||||
return 'https://sepolia-rollup.arbitrum.io/rpc'; | ||||||
const childRpc = { | ||||||
42161: 'https://arb1.arbitrum.io/rpc', | ||||||
42170: 'https://nova.arbitrum.io/rpc', | ||||||
421613: 'https://goerli-rollup.arbitrum.io/rpc', | ||||||
421614: 'https://sepolia-rollup.arbitrum.io/rpc', | ||||||
660279: 'https://xai-chain.net/rpc', | ||||||
}[networkID]; | ||||||
|
||||||
if (!childRpc) { | ||||||
throw new Error('No L2 RPC detected'); | ||||||
chrstph-dvx marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
})(); | ||||||
const arbProvider = new providers.JsonRpcProvider(l2Rpc); | ||||||
const l2Network = await getL2Network(arbProvider); | ||||||
} | ||||||
|
||||||
const childProvider = new providers.JsonRpcProvider(childRpc); | ||||||
const childNetwork = await getL2Network(childProvider); | ||||||
|
||||||
const expectedEnv = (() => { | ||||||
if (l2Network.partnerChainID === 1) return 'MAINNET_RPC'; | ||||||
else if (l2Network.partnerChainID === 5) return 'GOERLI_RPC'; | ||||||
else if (l2Network.partnerChainID === 11155111) return 'SEPOLIA_RPC'; | ||||||
if (childNetwork.partnerChainID === 1) return 'MAINNET_RPC'; | ||||||
else if (childNetwork.partnerChainID === 5) return 'GOERLI_RPC'; | ||||||
else if (childNetwork.partnerChainID === 11155111) return 'SEPOLIA_RPC'; | ||||||
else if (childNetwork.partnerChainID === 42161) return 'ARB_ONE_RPC'; | ||||||
throw new Error('No L1 RPC detected'); | ||||||
})(); | ||||||
const l1Rpc = process.env[expectedEnv]; | ||||||
if (!l1Rpc) throw new Error(`Please set ${expectedEnv}`); | ||||||
const parentRpc = process.env[expectedEnv]; | ||||||
if (!parentRpc) throw new Error(`Please set ${expectedEnv}`); | ||||||
|
||||||
const ethProvider = new providers.JsonRpcProvider(l1Rpc); | ||||||
const parentProvider = new providers.JsonRpcProvider(parentRpc); | ||||||
|
||||||
const l1MultiCaller = await MultiCaller.fromProvider(ethProvider); | ||||||
const l2MultiCaller = await MultiCaller.fromProvider(arbProvider); | ||||||
const l1MultiCaller = await MultiCaller.fromProvider(parentProvider); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit for consistency
Suggested change
same for L2 |
||||||
const l2MultiCaller = await MultiCaller.fromProvider(childProvider); | ||||||
|
||||||
return { | ||||||
l1: { | ||||||
provider: ethProvider, | ||||||
provider: parentProvider, | ||||||
multiCaller: l1MultiCaller, | ||||||
}, | ||||||
l2: { | ||||||
network: l2Network, | ||||||
provider: arbProvider, | ||||||
network: childNetwork, | ||||||
provider: childProvider, | ||||||
multiCaller: l2MultiCaller, | ||||||
}, | ||||||
}; | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#!/usr/bin/env node | ||
import { addCustomChain } from '@arbitrum/sdk'; | ||
import { Chain } from '@arbitrum/sdk/dist/lib/dataEntities/networks'; | ||
|
||
import { yargsInstance } from './lib/options'; | ||
import * as dotenv from 'dotenv'; | ||
import dotenvExpand from 'dotenv-expand'; | ||
|
@@ -63,4 +66,42 @@ if (process.env.NODE_ENV !== 'test') { | |
alltokenslist.parseAsync(); | ||
} | ||
|
||
const xai: Chain = { | ||
chainID: 660279, | ||
confirmPeriodBlocks: 45818, | ||
ethBridge: { | ||
bridge: '0x7dd8A76bdAeBE3BBBaCD7Aa87f1D4FDa1E60f94f', | ||
inbox: '0xaE21fDA3de92dE2FDAF606233b2863782Ba046F9', | ||
outbox: '0x1E400568AD4840dbE50FB32f306B842e9ddeF726', | ||
rollup: '0xC47DacFbAa80Bd9D8112F4e8069482c2A3221336', | ||
sequencerInbox: '0x995a9d3ca121D48d21087eDE20bc8acb2398c8B1', | ||
}, | ||
explorerUrl: 'https://explorer.xai-chain.net', | ||
isArbitrum: true, | ||
isCustom: true, | ||
name: 'Xai', | ||
partnerChainID: 42161, | ||
retryableLifetimeSeconds: 604800, | ||
tokenBridge: { | ||
l1CustomGateway: '0xb15A0826d65bE4c2fDd961b72636168ee70Af030', | ||
l1ERC20Gateway: '0xb591cE747CF19cF30e11d656EB94134F523A9e77', | ||
l1GatewayRouter: '0x22CCA5Dc96a4Ac1EC32c9c7C5ad4D66254a24C35', | ||
l1MultiCall: '0x842eC2c7D803033Edf55E478F461FC547Bc54EB2', | ||
l1ProxyAdmin: '0x041f85dd87c46b941dc9b15c6628b19ee5358485', | ||
l1Weth: '0x0000000000000000000000000000000000000000', | ||
l1WethGateway: '0x0000000000000000000000000000000000000000', | ||
l2CustomGateway: '0x96551194230725c72ACF8E9573B1382CCBC70635', | ||
l2ERC20Gateway: '0x0c71417917D24F4A6A6A55559B98c5cCEcb33F7a', | ||
l2GatewayRouter: '0xd096e8dE90D34de758B0E0bA4a796eA2e1e272cF', | ||
l2Multicall: '0xEEC168551A85911Ec3A905e0561b656979f3ea67', | ||
l2ProxyAdmin: '0x56800fDCFbE19Ea3EE9d115dAC30d95d6459c44E', | ||
l2Weth: '0x0000000000000000000000000000000000000000', | ||
l2WethGateway: '0x0000000000000000000000000000000000000000', | ||
}, | ||
nitroGenesisBlock: 0, | ||
nitroGenesisL1Block: 0, | ||
depositTimeout: 1800000, | ||
}; | ||
addCustomChain({ customChain: xai }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note that this will change back to |
||
|
||
export { update, yargsInstance }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--ignore-previous-list
will be replaced with--prevArbifiedList
in a subsequent PR, once the list is uploadedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#122