Skip to content

Commit

Permalink
feat: mf-5475 add scroll chain
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleBill committed Oct 18, 2023
1 parent b6a2e4f commit e938873
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/plugins/Tips/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const base: Plugin.Shared.Definition = {
ChainId.Fantom,
ChainId.Conflux,
ChainId.Astar,
ChainId.Scroll,
ChainId.Optimism,
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function getEVMAvailableTraderProviders(networkType?: NetworkType) {
return [TradeProvider.DODO, TradeProvider.WANNASWAP, TradeProvider.TRISOLARIS]
case NetworkType.Astar:
return [TradeProvider.ARTHSWAP, TradeProvider.VERSA, TradeProvider.ASTAREXCHANGE, TradeProvider.YUMISWAP]
case NetworkType.Scroll:
case NetworkType.Boba:
case NetworkType.Fuse:
case NetworkType.Metis:
Expand Down
1 change: 1 addition & 0 deletions packages/plugins/Trader/src/providers/ZeroX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function getNativeTokenLabel(networkType: NetworkType) {
case NetworkType.Optimism:
case NetworkType.Conflux:
case NetworkType.Astar:
case NetworkType.Scroll:
case NetworkType.Moonbeam:
case NetworkType.CustomNetwork:
return ZRX_NATIVE_TOKEN_ADDRESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ChainRuntimeContext = createContext<ChainRuntimeOptions>({
networks: EMPTY_LIST,
})

// https://docs.simplehash.com/reference/chains
const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
[NetworkPluginID.PLUGIN_EVM]: [
ChainId.Mainnet,
Expand All @@ -43,6 +44,7 @@ const SimpleHashSupportedChains: Record<NetworkPluginID, number[]> = {
ChainId.Optimism,
ChainId.Avalanche,
ChainId.xDai,
ChainId.Scroll,
],
[NetworkPluginID.PLUGIN_SOLANA]: [SolanaChainId.Mainnet],
[NetworkPluginID.PLUGIN_FLOW]: [FlowChainId.Mainnet],
Expand Down
9 changes: 6 additions & 3 deletions packages/web3-constants/evm/rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
"Aurora": ["https://mainnet.aurora.dev"],
"Aurora_Testnet": ["https://testnet.aurora.dev"],
"Conflux": ["https://evm.confluxrpc.com"],
"Astar": ["https://astar.api.onfinality.io/public"]
"Astar": ["https://astar.api.onfinality.io/public"],
"Scroll": ["https://rpc.scroll.io"]
},
"RPC_URLS_OFFICIAL": {
"Mainnet": ["https://mainnet.infura.io/v3/d65858b010d249419cf8687eca12b094"],
Expand All @@ -96,7 +97,8 @@
"Aurora": ["https://mainnet.aurora.dev"],
"Aurora_Testnet": ["https://testnet.aurora.dev/"],
"Conflux": ["https://evm.confluxrpc.com"],
"Astar": ["https://rpc.astar.network:8545"]
"Astar": ["https://rpc.astar.network:8545"],
"Scroll": ["https://rpc.scroll.io"]
},
"RPC_WEIGHTS": {
"Mainnet": [0, 1, 2, 3, 4],
Expand All @@ -123,6 +125,7 @@
"Aurora": [0, 0, 0, 0, 0],
"Aurora_Testnet": [0, 0, 0, 0, 0],
"Conflux": [0, 0, 0, 0, 0],
"Astar": [0, 0, 0, 0, 0]
"Astar": [0, 0, 0, 0, 0],
"Scroll": [0, 0, 0, 0, 0]
}
}
12 changes: 8 additions & 4 deletions packages/web3-constants/evm/token.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"Celo": "0x471EcE3750Da237f93B8E339c536989b8978a438",
"Fantom": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
"Aurora": "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB",
"Astar": "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720"
"Astar": "0xaeaaf0e2c81af264101b9129c00f4440ccf0f720",
"Scroll": "0x5300000000000000000000000000000000000004"
},
"LDO_stETH_ADDRESS": {
"Mainnet": "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
Expand Down Expand Up @@ -51,7 +52,8 @@
"Celo": "0x2A3684e9Dc20B857375EA04235F2F7edBe818FA7",
"Fantom": "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
"Aurora": "0xb12bfca5a55806aaf64e99521918a4bf0fc40802",
"Astar": "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98"
"Astar": "0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98",
"Scroll": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4"
},
"USDT_ADDRESS": {
"Mainnet": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
Expand All @@ -65,7 +67,8 @@
"Avalanche": "0xc7198437980c041c805A1EDcbA50c1Ce5db95118",
"Celo": "0xb020d981420744f6b0fedd22bb67cd37ce18a1d5",
"Aurora": "0x4988a896b1227218e4a686fde5eabdcabd91571f",
"Astar": "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283"
"Astar": "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283",
"Scroll": "0xf55BEC9cafDbE8730f096Aa55dad6D22d44099Df"
},
"aUSDT_ADDRESS": {
"Mainnet": "0x71fc860F7D3A592A4a98740e39dB31d25db65ae8",
Expand Down Expand Up @@ -305,7 +308,8 @@
"Aurora": "0x0000000000000000000000000000000000000000",
"Aurora_Testnet": "0x0000000000000000000000000000000000000000",
"Conflux": "0x0000000000000000000000000000000000000000",
"Astar": "0x0000000000000000000000000000000000000000"
"Astar": "0x0000000000000000000000000000000000000000",
"Scroll": "0x0000000000000000000000000000000000000000"
},
"WETH_ADDRESS": {
"Mainnet": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
Expand Down
1 change: 1 addition & 0 deletions packages/web3-providers/src/Rabby/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const resolveNetworkOnRabby = createLookupTableResolver<NetworkType, stri
[NetworkType.Celo]: '',
[NetworkType.Conflux]: '',
[NetworkType.Astar]: '',
[NetworkType.Scroll]: '',
[NetworkType.Moonbeam]: '',
[NetworkType.CustomNetwork]: '',
},
Expand Down
Binary file added packages/web3-shared/evm/src/assets/scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions packages/web3-shared/evm/src/constants/chains.json
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,32 @@
}
]
},
{
"chainId": 534352,
"type": "Scroll",
"name": "Scroll",
"network": "mainnet",
"fullName": "Scroll",
"shortName": "Scroll",
"rpc": ["https://rpc.scroll.io"],
"faucets": [],
"features": [],
"nativeCurrency": {
"chainId": 534352,
"name": "ETH",
"symbol": "ETH",
"decimals": 18,
"logoURL": "https://static.debank.com/image/chain/logo_url/astar/398c7e0014bdada3d818367a7273fabe.png"
},
"infoURL": "https://scrollscan.com/",
"explorers": [
{
"name": "blockscout",
"url": "https://scrollscan.com/",
"standard": "EIP3091"
}
]
},
{
"chainId": 25,
"name": "Cronos",
Expand Down
11 changes: 11 additions & 0 deletions packages/web3-shared/evm/src/constants/descriptors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@ export const NETWORK_DESCRIPTORS: ReadonlyArray<NetworkDescriptor<ChainId, Netwo
averageBlockDelay: 10,
isMainnet: true,
},
{
ID: `${PLUGIN_ID}_scroll`,
networkSupporterPluginID: PLUGIN_ID,
chainId: ChainId.Scroll,
type: NetworkType.Scroll,
name: 'Scroll',
icon: new URL('../assets/scroll.png', import.meta.url).href,
iconColor: 'rgb(255, 248, 243)',
averageBlockDelay: 9,
isMainnet: true,
},
{
ID: `${PLUGIN_ID}_optimism`,
networkSupporterPluginID: PLUGIN_ID,
Expand Down
1 change: 1 addition & 0 deletions packages/web3-shared/evm/src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ export const WNATIVE_ONLY: ERC20AgainstToken = {
[ChainId.Optimism]: [WNATIVE[ChainId.Optimism]],
[ChainId.Optimism_Goerli]: [WNATIVE[ChainId.Optimism_Goerli]],
[ChainId.Astar]: [WNATIVE[ChainId.Astar]],
[ChainId.Scroll]: [WNATIVE[ChainId.Scroll]],
}
3 changes: 3 additions & 0 deletions packages/web3-shared/evm/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export enum ChainId {
// Astar
Astar = 592,

Scroll = 534352,

ZKSync_Alpha_Testnet = 280,

Crossbell = 3737,
Expand Down Expand Up @@ -272,6 +274,7 @@ export enum NetworkType {
Optimism = 'Optimism',
Conflux = 'Conflux',
Astar = 'Astar',
Scroll = 'Scroll',
Moonbeam = 'Moonbeam',
CustomNetwork = 'CustomNetwork',
}
Expand Down

0 comments on commit e938873

Please sign in to comment.