Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hamdiallam authored Mar 13, 2024
1 parent 4aa1872 commit ab47a3c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion optimism.tokenlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -7174,4 +7174,4 @@
"minor": 0,
"patch": 49
}
}
}
15 changes: 9 additions & 6 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,18 @@ const getBridges = (tokenData: TokenData, chain: string, token: Token) => {
if (tokenBridgeOverride && typeof tokenBridgeOverride !== 'string') {
throw new Error('L2 Bridge override should be a string')
}
const networkSep = chain.indexOf('-')
const chainName = networkSep === -1 ? chain : chain.slice(0, networkSep)
const bridgeKey = `${chainName}BridgeAddress`
return [
{
[chain === 'optimism' || chain === 'optimism-goerli' || chain === 'optimism-sepolia'
? 'optimismBridgeAddress'
: 'baseBridgeAddress']:
[bridgeKey]:
tokenBridgeOverride ??
L2_STANDARD_BRIDGE_INFORMATION[chain].l2StandardBridgeAddress,
},
]
}

if (isL1Chain(chain)) {
const l2ChainsForL1 = L1_STANDARD_BRIDGE_INFORMATION[chain].map(
(l1Bridge) => l1Bridge.l2Chain
Expand All @@ -116,10 +118,11 @@ const getBridges = (tokenData: TokenData, chain: string, token: Token) => {
'L1 Bridge override should be a map from l2 chain to bridge address'
)
}
const networkSep = l2Chain.indexOf('-')
const chainName = networkSep === -1 ? l2Chain : l2Chain.slice(0, networkSep)
const bridgeKey = `${chainName}BridgeAddress`
return {
[l2Chain === 'optimism' || l2Chain === 'optimism-goerli' || l2Chain === 'optimism-sepolia'
? 'optimismBridgeAddress'
: 'baseBridgeAddress']:
[bridgeKey]:
tokenBridgeOverride?.[l2Chain] ??
l1StandardBridgeInfoForL2.l1StandardBridgeAddress,
}
Expand Down

0 comments on commit ab47a3c

Please sign in to comment.