Skip to content

Commit 2501382

Browse files
authored
feat(new-chains): add q4 chains (#606)
* feat: add basic Linea info * feat: add basic Plasma info * feat: add linea/plasma to bridge providers config * chore: add link to linea assets for future reference * feat: export linea/plasma configs * feat: add wrapped tokens for linea/plasma * feat: add orderbook api config for linea/plasma * feat: add subgraph config for linea/plasma * feat: add linea/plasma to sdk readme * feat: add linea/plasma USDC for wagmi example * chore: rename USDT token symbol and name * fix: adjust linea logos * fix: adjust plasma logo * fix: add plasma native token logo * fix: remove trailing slashes from linea/plasma
1 parent 6e67787 commit 2501382

File tree

18 files changed

+181
-7
lines changed

18 files changed

+181
-7
lines changed

examples/react/wagmi/src/tokens.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ export const USDC_TOKENS: Record<SupportedChainId, TokenInfo> = {
5757
name: 'USD Coin',
5858
symbol: 'USDC',
5959
},
60+
[SupportedChainId.LINEA]: {
61+
chainId: SupportedChainId.LINEA,
62+
address: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff', // USDC (Native Linea)
63+
decimals: 6,
64+
name: 'USD Coin',
65+
symbol: 'USDC',
66+
},
67+
[SupportedChainId.PLASMA]: {
68+
// TODO: This is USDT, not USDC!!! Update if/when there's a USDC deployment on Plasma
69+
chainId: SupportedChainId.PLASMA,
70+
address: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb', // USDT (Native Plasma)
71+
decimals: 6,
72+
name: 'USDT',
73+
symbol: 'USDT',
74+
},
6075
[SupportedChainId.SEPOLIA]: {
6176
chainId: SupportedChainId.SEPOLIA,
6277
address: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238', // USDC (Sepolia testnet deployment by Circle)

packages/bridging/src/providers/across/const/contracts.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export const ACROSS_SPOOK_CONTRACT_ADDRESSES: Record<TargetChainId, string | und
1515
[SupportedChainId.LENS]: '0xe7cb3e167e7475dE1331Cf6E0CEb187654619E12',
1616
// https://docs.across.to/reference/contract-addresses/bnb-smart-chain
1717
[SupportedChainId.BNB]: '0x4e8E101924eDE233C13e2D8622DC8aED2872d505',
18+
// https://docs.across.to/reference/contract-addresses/linea-chain-id-59144
19+
[SupportedChainId.LINEA]: '0xE0BCff426509723B18D6b2f0D8F4602d143bE3e0',
20+
// https://docs.across.to/reference/contract-addresses/plasma
21+
[SupportedChainId.PLASMA]: '0x50039fAEfebef707cFD94D6d462fE6D10B39207a',
1822

1923
// Not supported chains
2024
// TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
@@ -37,4 +41,6 @@ export const ACROSS_MATH_CONTRACT_ADDRESSES: Record<TargetChainId, string | unde
3741
[SupportedChainId.AVALANCHE]: undefined,
3842
[SupportedChainId.LENS]: undefined, // TODO: confirm
3943
[SupportedChainId.BNB]: undefined, // TODO: confirm
44+
[SupportedChainId.LINEA]: undefined, // TODO: confirm
45+
[SupportedChainId.PLASMA]: undefined, // TODO: confirm
4046
}

packages/bridging/src/providers/bungee/const/contracts.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export const BungeeCowswapLibAddresses: Record<TargetChainId, string | undefined
1010
[SupportedChainId.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
1111
[SupportedChainId.LENS]: undefined, // TODO: confirm
1212
[SupportedChainId.BNB]: undefined, // TODO: confirm
13+
[SupportedChainId.LINEA]: undefined, // TODO: confirm
14+
[SupportedChainId.PLASMA]: undefined, // TODO: confirm
1315
[SupportedChainId.SEPOLIA]: undefined,
1416
[AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
1517
}
@@ -24,6 +26,8 @@ export const SocketVerifierAddresses: Record<TargetChainId, string | undefined>
2426
[SupportedChainId.POLYGON]: SOCKET_VERIFIER_ADDRESS,
2527
[SupportedChainId.LENS]: undefined, // TODO: confirm
2628
[SupportedChainId.BNB]: undefined, // TODO: confirm
29+
[SupportedChainId.LINEA]: undefined, // TODO: confirm
30+
[SupportedChainId.PLASMA]: undefined, // TODO: confirm
2731
[SupportedChainId.SEPOLIA]: undefined,
2832
[AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
2933
}
@@ -38,6 +42,8 @@ export const BungeeApproveAndBridgeV1Addresses: Record<TargetChainId, string | u
3842
[SupportedChainId.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
3943
[SupportedChainId.LENS]: undefined, // TODO: confirm
4044
[SupportedChainId.BNB]: undefined, // TODO: confirm
45+
[SupportedChainId.LINEA]: undefined, // TODO: confirm
46+
[SupportedChainId.PLASMA]: undefined, // TODO: confirm
4147
[SupportedChainId.SEPOLIA]: undefined,
4248
[AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4349
}

packages/bridging/src/test/getWallet.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ethers } from 'ethers'
2-
import { getWallet, getRpcProvider, getPk } from './getWallet'
2+
import { getPk, getRpcProvider, getWallet } from './getWallet'
33
import { SupportedChainId } from '@cowprotocol/sdk-config'
44

55
// Mock ethers to avoid actual network calls
@@ -92,6 +92,8 @@ describe('getWallet utilities', () => {
9292
SupportedChainId.AVALANCHE,
9393
SupportedChainId.LENS,
9494
SupportedChainId.BNB,
95+
SupportedChainId.LINEA,
96+
SupportedChainId.PLASMA,
9597
]
9698

9799
for (const chainId of chainIds) {

packages/bridging/src/test/getWallet.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ import {
66
bnb,
77
gnosisChain,
88
lens,
9+
linea,
910
mainnet,
11+
plasma,
1012
polygon,
1113
sepolia,
1214
SupportedChainId,
@@ -22,6 +24,8 @@ const DEFAULT_RPC_URL: Record<SupportedChainId, string | undefined> = {
2224
[SupportedChainId.AVALANCHE]: avalanche.rpcUrls.default.http[0],
2325
[SupportedChainId.LENS]: lens.rpcUrls.default.http[0],
2426
[SupportedChainId.BNB]: bnb.rpcUrls.default.http[0],
27+
[SupportedChainId.LINEA]: linea.rpcUrls.default.http[0],
28+
[SupportedChainId.PLASMA]: plasma.rpcUrls.default.http[0],
2529
}
2630

2731
export async function getRpcProvider(chainId: SupportedChainId) {

packages/config/src/chains/const/chainIds.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import { polygon } from '../details/polygon'
99
import { lens } from '../details/lens'
1010
import { bnb } from '../details/bnb'
1111
import { optimism } from '../details/optimism'
12+
import { linea } from '../details/linea'
13+
import { plasma } from '../details/plasma'
1214

1315
/**
1416
* Details of all supported chains.
@@ -22,6 +24,8 @@ export const ALL_SUPPORTED_CHAINS_MAP: Record<SupportedChainId, ChainInfo> = {
2224
[SupportedChainId.POLYGON]: polygon,
2325
[SupportedChainId.BNB]: bnb,
2426
[SupportedChainId.LENS]: lens,
27+
[SupportedChainId.PLASMA]: plasma,
28+
[SupportedChainId.LINEA]: linea,
2529
[SupportedChainId.SEPOLIA]: sepolia,
2630
}
2731

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { ChainInfo, SupportedChainId } from '../types'
2+
import { nativeCurrencyTemplate, RAW_CHAINS_FILES_PATH } from '../../constants'
3+
4+
const light = `${RAW_CHAINS_FILES_PATH}/images/linea-logo-light.svg`
5+
const dark = `${RAW_CHAINS_FILES_PATH}/images/linea-logo-dark.svg`
6+
7+
// See https://github.com/wevm/viem/blob/main/src/chains/definitions/linea.ts
8+
// and https://github.com/ethereum-lists/chains/blob/master/_data/chains/eip155-59144.json
9+
export const linea: ChainInfo = {
10+
id: SupportedChainId.LINEA,
11+
label: 'Linea',
12+
eip155Label: 'Linea Mainnet',
13+
logo: { light, dark },
14+
nativeCurrency: {
15+
...nativeCurrencyTemplate,
16+
chainId: SupportedChainId.LINEA,
17+
},
18+
addressPrefix: 'linea',
19+
isTestnet: false,
20+
contracts: {
21+
multicall3: {
22+
address: '0xca11bde05977b3631167028862be2a173976ca11',
23+
blockCreated: 42,
24+
},
25+
},
26+
rpcUrls: {
27+
default: {
28+
http: ['https://rpc.linea.build'],
29+
},
30+
},
31+
color: '#61dfff', // Brand assets https://linea.build/assets
32+
website: {
33+
name: 'Linea',
34+
url: 'https://linea.build',
35+
},
36+
docs: {
37+
name: 'Linea Docs',
38+
url: 'https://docs.linea.build',
39+
},
40+
blockExplorer: {
41+
name: 'LineaScan',
42+
url: 'https://lineascan.build',
43+
},
44+
bridges: [
45+
{
46+
name: 'Linea Bridge',
47+
url: 'https://linea.build/hub/bridge',
48+
},
49+
],
50+
isUnderDevelopment: true, // TODO: Remove when ready for production
51+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { ChainInfo, SupportedChainId } from '../types'
2+
import { nativeCurrencyTemplate, RAW_CHAINS_FILES_PATH } from '../../constants'
3+
4+
const light = `${RAW_CHAINS_FILES_PATH}/images/plasma-logo.svg`
5+
const dark = light
6+
7+
// See https://github.com/wevm/viem/blob/main/src/chains/definitions/plasma.ts
8+
// and https://github.com/ethereum-lists/chains/blob/master/_data/chains/eip155-9745.json
9+
export const plasma: ChainInfo = {
10+
id: SupportedChainId.PLASMA,
11+
label: 'Plasma',
12+
eip155Label: 'Plasma Mainnet',
13+
logo: { light, dark },
14+
nativeCurrency: {
15+
...nativeCurrencyTemplate,
16+
chainId: SupportedChainId.PLASMA,
17+
name: 'Plasma',
18+
symbol: 'XPL',
19+
logoUrl: light,
20+
},
21+
addressPrefix: 'plasma',
22+
isTestnet: false,
23+
contracts: {
24+
multicall3: {
25+
address: '0xca11bde05977b3631167028862be2a173976ca11',
26+
blockCreated: 0,
27+
},
28+
},
29+
rpcUrls: {
30+
default: {
31+
http: ['https://rpc.plasma.to'],
32+
},
33+
},
34+
color: '#569F8C', // brand kit https://www.plasma.to/brand
35+
website: {
36+
name: 'Plasma',
37+
url: 'https://www.plasma.to',
38+
},
39+
docs: {
40+
name: 'Plasma Docs',
41+
url: 'https://docs.plasma.to',
42+
},
43+
blockExplorer: {
44+
name: 'PlasmaScan',
45+
url: 'https://plasmascan.to',
46+
},
47+
// No native bridge available AFAICT
48+
// bridges: [
49+
// {
50+
// name: 'Plasma Bridge',
51+
// url: '',
52+
// },
53+
// ],
54+
isUnderDevelopment: true, // TODO: Remove when ready for production
55+
}
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)