Skip to content

Commit

Permalink
Add support for Lisk and Lisk Sepolia Testnet networks (#897)
Browse files Browse the repository at this point in the history
* feat: adds support for Lisk and Lisk Sepolia Testnet networks

* chore: lint fixes

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
sameersubudhi and mergify[bot] authored Jul 19, 2024
1 parent 06fbd11 commit 4a32ae6
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 10 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ For right now, each OP Chain has their own review process. So, if you are adding
- If you're adding a token to `Base` (e.g. `base` [mainnet] or `base-sepolia` [testnet]), instead of using the predeploy token factory on Base, we recommend you use the token factory [listed here](https://docs.base.org/base-contracts/#l2-contract-addresses) to avoid having a token address that may conflict with a different token on Optimism.
- If you are adding a token to `Zora`: please use the [`zora` label](https://github.com/ethereum-optimism/ethereum-optimism.github.io/labels/zora) and add [@tbtstl](https://github.com/tbtstl) as a reviewer.
- If you are adding a token to `Mode`: please use the [`mode` label](https://github.com/ethereum-optimism/ethereum-optimism.github.io/labels/mode).
- If you are adding a token to `Lisk` (e.g. `lisk` [mainnet] or `lisk-sepolia` [testnet]): please use the [`lisk` label](https://github.com/ethereum-optimism/ethereum-optimism.github.io/labels/lisk) and add [@shuse2](https://github.com/shuse2) as a reviewer.

### Automated checks

Expand Down Expand Up @@ -115,6 +116,8 @@ We currently accept tokens on the following chains:
- `optimism-sepolia`
- `mode`
- `pgn`
- `lisk`
- `lisk-sepolia`

#### Non-bridgable tokens

Expand Down
4 changes: 2 additions & 2 deletions bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ program
fs.writeFileSync(
validationResultsFilePath,
`Below are the results from running validation for the token changes. To ` +
`re-run the validation locally run: ` +
`pnpm validate --datadir ./data --tokens ${options.tokens}\n\n`
`re-run the validation locally run: ` +
`pnpm validate --datadir ./data --tokens ${options.tokens}\n\n`
)
}

Expand Down
45 changes: 40 additions & 5 deletions src/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const NETWORK_DATA: Record<Chain, Network> = {
id: 8453,
name: 'Base',
provider: new ethers.providers.StaticJsonRpcProvider(
'https://mainnet.base.org',
'https://mainnet.base.org'
),
layer: 2,
},
Expand All @@ -39,14 +39,25 @@ export const NETWORK_DATA: Record<Chain, Network> = {
id: 34443,
name: 'Mode',
provider: new ethers.providers.StaticJsonRpcProvider(
'https://mainnet.mode.network',
'https://mainnet.mode.network'
),
layer: 2,
},
lisk: {
id: 1135,
name: 'Lisk',
provider: new ethers.providers.StaticJsonRpcProvider(
'https://rpc.api.lisk.com'
),
layer: 2,
},
sepolia: {
id: 11155111,
name: 'Sepolia',
provider: new ethers.providers.StaticJsonRpcProvider(`https://sepolia.infura.io/v3/${DEFAULT_INFURA_KEY}`, 11155111),
provider: new ethers.providers.StaticJsonRpcProvider(
`https://sepolia.infura.io/v3/${DEFAULT_INFURA_KEY}`,
11155111
),
layer: 1,
},
'optimism-sepolia': {
Expand Down Expand Up @@ -74,6 +85,14 @@ export const NETWORK_DATA: Record<Chain, Network> = {
),
layer: 2,
},
'lisk-sepolia': {
id: 4202,
name: 'Lisk Sepolia',
provider: new ethers.providers.StaticJsonRpcProvider(
'https://rpc.sepolia-api.lisk.com'
),
layer: 2,
},
}

interface L2BridgeInformation {
Expand Down Expand Up @@ -101,6 +120,9 @@ export const L2_STANDARD_BRIDGE_INFORMATION: Record<
mode: {
l2StandardBridgeAddress: '0x4200000000000000000000000000000000000010',
},
lisk: {
l2StandardBridgeAddress: '0x4200000000000000000000000000000000000010',
},
'optimism-sepolia': {
l2StandardBridgeAddress: '0x4200000000000000000000000000000000000010',
},
Expand All @@ -110,16 +132,21 @@ export const L2_STANDARD_BRIDGE_INFORMATION: Record<
'pgn-sepolia': {
l2StandardBridgeAddress: '0x4200000000000000000000000000000000000010',
},
'lisk-sepolia': {
l2StandardBridgeAddress: '0x4200000000000000000000000000000000000010',
},
}

export const L2_TO_L1_PAIR: Partial<Record<L2Chain, L1Chain>> = {
optimism: 'ethereum',
base: 'ethereum',
pgn: 'ethereum',
mode: 'ethereum',
lisk: 'ethereum',
'optimism-sepolia': 'sepolia',
'base-sepolia': 'sepolia',
'pgn-sepolia': 'sepolia'
'pgn-sepolia': 'sepolia',
'lisk-sepolia': 'sepolia',
}

export const L1_STANDARD_BRIDGE_INFORMATION: Record<
Expand All @@ -143,6 +170,10 @@ export const L1_STANDARD_BRIDGE_INFORMATION: Record<
l2Chain: 'mode',
l1StandardBridgeAddress: '0x735aDBbE72226BD52e818E7181953f42E3b0FF21',
},
{
l2Chain: 'lisk',
l1StandardBridgeAddress: '0x2658723Bf70c7667De6B25F99fcce13A16D25d08',
},
],
sepolia: [
{
Expand All @@ -157,5 +188,9 @@ export const L1_STANDARD_BRIDGE_INFORMATION: Record<
l2Chain: 'base-sepolia',
l1StandardBridgeAddress: '0xfd0Bf71F60660E2f608ed56e1659C450eB113120',
},
]
{
l2Chain: 'lisk-sepolia',
l1StandardBridgeAddress: '0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5',
},
],
}
3 changes: 2 additions & 1 deletion src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ const getBridges = (tokenData: TokenData, chain: string, token: Token) => {
)
}
const networkSep = l2Chain.indexOf('-')
const chainName = networkSep === -1 ? l2Chain : l2Chain.slice(0, networkSep)
const chainName =
networkSep === -1 ? l2Chain : l2Chain.slice(0, networkSep)
const bridgeKey = `${chainName}BridgeAddress`
return {
[bridgeKey]:
Expand Down
6 changes: 5 additions & 1 deletion src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const TOKEN_SCHEMA = {
},
symbol: {
type: 'string',
pattern: '^\\S+$' // allow unicode
pattern: '^\\S+$', // allow unicode
},
decimals: {
type: 'integer',
Expand Down Expand Up @@ -62,11 +62,13 @@ export const TOKEN_DATA_SCHEMA = {
ethereum: TOKEN_SCHEMA,
optimism: TOKEN_SCHEMA,
base: TOKEN_SCHEMA,
lisk: TOKEN_SCHEMA,
mode: TOKEN_SCHEMA,
pgn: TOKEN_SCHEMA,
sepolia: TOKEN_SCHEMA,
'base-sepolia': TOKEN_SCHEMA,
'optimism-sepolia': TOKEN_SCHEMA,
'lisk-sepolia': TOKEN_SCHEMA,
},
additionalProperties: false,
anyOf: [
Expand All @@ -75,9 +77,11 @@ export const TOKEN_DATA_SCHEMA = {
{ required: ['base'] },
{ required: ['mode'] },
{ required: ['pgn'] },
{ required: ['lisk'] },
{ required: ['sepolia'] },
{ required: ['base-sepolia'] },
{ required: ['optimism-sepolia'] },
{ required: ['lisk-sepolia'] },
],
},
},
Expand Down
14 changes: 13 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,20 @@ export type Chain =
| 'pgn-sepolia'
| 'sepolia'
| 'mode'
| 'lisk'
| 'lisk-sepolia'

const l2Chains = ['optimism', 'optimism-sepolia', 'base', 'base-sepolia', 'pgn-sepolia', 'pgn', 'mode'] as const
const l2Chains = [
'optimism',
'optimism-sepolia',
'base',
'base-sepolia',
'pgn-sepolia',
'pgn',
'mode',
'lisk',
'lisk-sepolia',
] as const
export type L2Chain = typeof l2Chains[number]

export const isL2Chain = (chain: string): chain is L2Chain => {
Expand Down

0 comments on commit 4a32ae6

Please sign in to comment.