Skip to content
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

feature(synapse-interface): Chain and bridgeMap updates #3318

Merged
merged 19 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/synapse-interface/assets/chains/worldchain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/synapse-interface/assets/icons/wld.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ export function LandingPageWrapper({ children }: { children: any }) {
style={TODO_REMOVE_wrapperStyle}
>
<AnnouncementBanner
bannerId="2024-07-22-rfq"
bannerContent="Synapse now supports Linea - bridge to & from in 10 seconds"
startDate={new Date('2024-07-10T18:45:09+00:00')}
endDate={new Date('2024-08-15T18:45:09+00:00')}
bannerId="2024-10-10-rfq"
bannerContent="Synapse now supports World Chain! Bridge to & from in 10 seconds"
startDate={new Date('2024-10-09T18:45:09+00:00')}
endDate={new Date('2024-11-15T18:45:09+00:00')}
/>
<MaintenanceBanners />
<LandingNav />
Expand Down
43 changes: 40 additions & 3 deletions packages/synapse-interface/constants/bridgeMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ export const BRIDGE_MAP = {
destination: ['JEWEL'],
swappable: [],
},
'0x163f8C2467924be0ae7B5347228CABF260318753': {
decimals: 18,
symbol: 'WLD',
origin: ['RFQ.WLD'],
destination: ['RFQ.WLD'],
swappable: [],
},
'0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F': {
decimals: 18,
symbol: 'nUSD',
Expand Down Expand Up @@ -455,6 +462,13 @@ export const BRIDGE_MAP = {
destination: ['L2DAO'],
swappable: [],
},
'0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1': {
decimals: 18,
symbol: 'WLD',
origin: ['RFQ.WLD'],
destination: ['RFQ.WLD'],
swappable: [],
},
},
'25': {
'0x396c9c192dd323995346632581BEF92a31AC623b': {
Expand Down Expand Up @@ -591,7 +605,7 @@ export const BRIDGE_MAP = {
},
'0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270': {
decimals: 18,
symbol: 'WMATIC',
symbol: 'WPOL',
origin: ['MATIC'],
destination: ['MATIC'],
abtestingalpha marked this conversation as resolved.
Show resolved Hide resolved
swappable: [],
Expand Down Expand Up @@ -670,7 +684,7 @@ export const BRIDGE_MAP = {
},
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': {
decimals: 18,
symbol: 'MATIC',
symbol: 'POL',
origin: ['MATIC'],
destination: ['MATIC'],
swappable: [],
Expand Down Expand Up @@ -872,6 +886,29 @@ export const BRIDGE_MAP = {
],
},
},
'480': {
'0x2cFc85d8E48F8EAB294be644d9E25C3030863003': {
decimals: 18,
symbol: 'WLD',
origin: ['RFQ.WLD'],
destination: ['RFQ.WLD'],
swappable: [],
},
'0x79A02482A880bCE3F13e09Da970dC34db4CD24d1': {
decimals: 6,
symbol: 'USDC.e',
origin: ['RFQ.USDC'],
destination: ['RFQ.USDC'],
swappable: [],
},
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': {
decimals: 18,
symbol: 'ETH',
origin: ['RFQ.ETH'],
destination: ['RFQ.ETH'],
swappable: [],
},
},
'1088': {
'0x17C09cfC96C865CF546d73365Cedb6dC66986963': {
decimals: 18,
Expand All @@ -896,7 +933,7 @@ export const BRIDGE_MAP = {
},
'0x75cb093E4D61d2A2e65D8e0BBb01DE8d89b53481': {
decimals: 18,
symbol: 'WMETIS',
symbol: 'WMetis',
origin: ['Metis'],
destination: ['Metis'],
swappable: [],
Expand Down
27 changes: 27 additions & 0 deletions packages/synapse-interface/constants/chains/extraWagmiChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,30 @@ export const dogechain = {
},
},
}

export const worldchain = {
id: 480,
name: 'World Chain',
network: 'worldchain',
nativeCurrency: {
decimals: 18,
name: 'Ether',
symbol: 'ETH',
},
rpcUrls: {
default: { http: ['https://worldchain-mainnet.g.alchemy.com/public'] },
public: { http: ['https://worldchain-mainnet.g.alchemy.com/public'] },
},
blockExplorers: {
default: {
name: 'World Chain Explorer',
url: 'https://worldchain-mainnet.explorer.alchemy.com',
},
},
contracts: {
multicall3: {
address: '0xca11bde05977b3631167028862be2a173976ca11',
blockCreated: 1517589,
},
},
}
1 change: 1 addition & 0 deletions packages/synapse-interface/constants/chains/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const ChainId = {
POLYGON: 137,
FANTOM: 250,
BOBA: 288,
WORLDCHAIN: 480,
METIS: 1088,
MOONBEAM: 1284,
MOONRIVER: 1285,
Expand Down
31 changes: 29 additions & 2 deletions packages/synapse-interface/constants/chains/master.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import optimismImg from '@assets/chains/optimism.svg'
import polygonImg from '@assets/chains/polygon.svg'
import scrollImg from '@assets/chains/scroll.svg'
import lineaImg from '@assets/chains/linea.svg'
import worldchainImg from '@assets/chains/worldchain.svg'

import ethExplorerImg from '@assets/explorer/etherscan.svg'
import arbitrumExplorerImg from '@assets/explorer/arbiscan.svg'
Expand Down Expand Up @@ -161,7 +162,7 @@ export const CANTO: Chain = {
}

export const OPTIMISM: Chain = {
priorityRank: 80,
priorityRank: 91,
id: 10,
chainSymbol: 'OPTIMISM',
name: 'Optimism',
Expand Down Expand Up @@ -562,7 +563,6 @@ export const SCROLL: Chain = {
icon: scrollImg,
},
color: 'orange',
isNew: true,
}

export const LINEA: Chain = {
Expand All @@ -588,5 +588,32 @@ export const LINEA: Chain = {
icon: lineaImg,
},
color: 'black',
isNew: false,
}

export const WORLDCHAIN: Chain = {
priorityRank: 99,
id: 480,
chainSymbol: 'WORLDCHAIN',
name: 'World Chain',
chainImg: worldchainImg,
layer: 2,
rpcUrls: {
primary:
'https://worldchain-mainnet.g.alchemy.com/v2/kThJADa4Pb6x6kTS--MoMQRI7d3OliUH',
fallback: 'https://worldchain-mainnet.g.alchemy.com/public',
},
explorerUrl: 'https://worldchain-mainnet.explorer.alchemy.com',
explorerName: 'World Chain Explorer',
explorerImg: worldchainImg,
blockTime: 3000,
nativeCurrency: {
name: 'Ethereum',
symbol: 'ETH',
decimals: 18,
address: zeroAddress,
icon: ethImg,
},
color: 'black',
isNew: true,
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ import {
linea,
} from '@wagmi/core/chains'

import { dfk, dogechain } from '@/constants/chains/extraWagmiChains'
import { dfk, dogechain, worldchain } from '@/constants/chains/extraWagmiChains'
import { CHAINS_BY_ID } from '@/constants/chains'

export const supportedChains = [
mainnet,
worldchain,
optimism,
arbitrum,
avalanche,
base,
optimism,
scroll,
linea,
blast,
Expand Down
45 changes: 42 additions & 3 deletions packages/synapse-interface/constants/tokens/bridgeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import usdtLogo from '@assets/icons/usdt.svg'
import vstaLogo from '@assets/icons/vsta.svg'
import wbtcLogo from '@assets/icons/wbtc.svg'
import wethLogo from '@assets/icons/weth.svg'
import wldLogo from '@assets/icons/wld.svg'

import { Token } from '@/utils/types'
import * as CHAINS from '@/constants/chains/master'
Expand Down Expand Up @@ -711,6 +712,7 @@ export const ETH = new Token({
[CHAINS.BLAST.id]: zeroAddress,
[CHAINS.SCROLL.id]: zeroAddress,
[CHAINS.LINEA.id]: zeroAddress,
[CHAINS.WORLDCHAIN.id]: zeroAddress,
},
decimals: 18,
symbol: 'ETH',
Expand Down Expand Up @@ -859,6 +861,7 @@ export const USDCe = new Token({
[CHAINS.ARBITRUM.id]: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
[CHAINS.AURORA.id]: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
[CHAINS.POLYGON.id]: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',
[CHAINS.WORLDCHAIN.id]: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1',
},
decimals: 6,
symbol: 'USDC.e',
Expand Down Expand Up @@ -1046,7 +1049,6 @@ export const WKLAY = new Token({

export const MATIC = new Token({
addresses: {
[CHAINS.POLYGON.id]: zeroAddress,
[CHAINS.DFK.id]: '0xD17a41Cd199edF1093A9Be4404EaDe52Ec19698e',
},
decimals: 18,
Expand All @@ -1061,7 +1063,23 @@ export const MATIC = new Token({
routeSymbol: 'MATIC',
})

export const WMATIC = new Token({
export const POL = new Token({
addresses: {
[CHAINS.POLYGON.id]: zeroAddress,
},
decimals: 18,
symbol: 'MATIC',
name: 'MATIC',
logo: maticLogo,
isNative: true,
swapableType: 'MATIC',
color: 'blue',
visibilityRank: 90,
priorityRank: 300,
routeSymbol: 'POL',
})
abtestingalpha marked this conversation as resolved.
Show resolved Hide resolved

export const WPOL = new Token({
addresses: {
[CHAINS.POLYGON.id]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
},
Expand All @@ -1073,7 +1091,7 @@ export const WMATIC = new Token({
color: 'blue',
visibilityRank: 90,
priorityRank: 350,
routeSymbol: 'WMATIC',
routeSymbol: 'WPOL',
})

export const FTM = new Token({
Expand Down Expand Up @@ -1230,3 +1248,24 @@ export const METIS = new Token({
color: 'blue',
routeSymbol: 'Metis',
})

export const WLD = new Token({
visibilityRank: 106,
addresses: {
[CHAINS.ETH.id]: '0x163f8C2467924be0ae7B5347228CABF260318753',
[CHAINS.OPTIMISM.id]: '0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1',
[CHAINS.WORLDCHAIN.id]: '0x2cFc85d8E48F8EAB294be644d9E25C3030863003',
},
decimals: {
[CHAINS.ETH.id]: 18,
[CHAINS.OPTIMISM.id]: 18,
[CHAINS.WORLDCHAIN.id]: 18,
},
symbol: 'WLD',
name: 'Worldcoin',
logo: wldLogo,
swapableType: 'WLD',
color: 'gray',
priorityRank: 106,
routeSymbol: 'WLD',
})
1 change: 1 addition & 0 deletions packages/synapse-interface/scripts/data/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"137": "https://polygon-bor.publicnode.com",
"250": "https://rpc3.fantom.network",
"288": "https://replica.boba.network",
"480": "https://worldchain-mainnet.g.alchemy.com/public",
abtestingalpha marked this conversation as resolved.
Show resolved Hide resolved
"1088": "https://andromeda.metis.io/?owner=1088",
"1284": "https://moonbeam.public.blastapi.io",
"1285": "https://moonriver.public.blastapi.io",
Expand Down
28 changes: 21 additions & 7 deletions packages/synapse-interface/scripts/generateMaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ const allowedChainIdsForSynapseBridge = [
const allowedChainIdsForSynapseCCTPRouter = [1, 10, 137, 8453, 42161, 43114]

// Chain IDs where RFQ is allowed
const allowedChainIdsForRfq = [1, 10, 56, 8453, 42161, 59144, 81457, 534352]
const allowedChainIdsForRfq = [
1, 10, 56, 480, 8453, 42161, 59144, 81457, 534352,
]

// Get SynapseRouter contract instances for each chain
const SynapseRouters = {}
Expand Down Expand Up @@ -374,12 +376,20 @@ const printMaps = async () => {
const tokens = {}
await Promise.all(
Object.keys(originMap).map(async (token) => {
const decimals = await getTokenDecimals(chainId, token)
const symbol = await getTokenSymbol(chainId, token)
const origin = Array.from(originMap[token])
.map((t) => (t === 'RFQ.USDC.e' ? 'RFQ.USDC' : t))
.sort()
const destination = await getDestinationBridgeSymbols(chainId, token)
const swappable = extractSwappable(poolSets, token)

tokens[token] = {
decimals: await getTokenDecimals(chainId, token),
symbol: await getTokenSymbol(chainId, token),
origin: Array.from(originMap[token]).sort(),
destination: await getDestinationBridgeSymbols(chainId, token),
swappable: extractSwappable(poolSets, token),
decimals,
symbol,
origin,
destination,
swappable,
}
// Check if token is supported as destination asset in RFQ
if (
Expand Down Expand Up @@ -457,7 +467,11 @@ const getTokenDecimals = async (chainId, token) => {
}

const getRFQSymbol = (symbol) => {
return `RFQ.${symbol}`
if (symbol === 'USDC.e') {
return 'RFQ.USDC'
} else {
return `RFQ.${symbol}`
}
}

printMaps()
Loading