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

feat(widget): Chain & token update #3331

Merged
merged 5 commits into from
Oct 24, 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
48 changes: 44 additions & 4 deletions packages/widget/src/constants/bridgeable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ export const ETH: BridgeableToken = {
[CHAINS.BLAST.id]: ZeroAddress,
[CHAINS.SCROLL.id]: ZeroAddress,
[CHAINS.LINEA.id]: ZeroAddress,
[CHAINS.WORLDCHAIN.id]: ZeroAddress,
},
decimals: {
[CHAINS.ETHEREUM.id]: 18,
Expand All @@ -819,6 +820,7 @@ export const ETH: BridgeableToken = {
[CHAINS.BLAST.id]: 18,
[CHAINS.SCROLL.id]: 18,
[CHAINS.LINEA.id]: 18,
[CHAINS.WORLDCHAIN.id]: 18,
},
symbol: 'ETH',
name: 'Ethereum',
Expand Down Expand Up @@ -994,12 +996,14 @@ export const USDCe: BridgeableToken = {
[CHAINS.AVALANCHE.id]: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664',
[CHAINS.ARBITRUM.id]: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',
[CHAINS.AURORA.id]: '0xB12BFcA5A55806AaF64E99521918A4bf0fC40802',
[CHAINS.WORLDCHAIN.id]: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1',
},
decimals: {
[CHAINS.OPTIMISM.id]: 6,
[CHAINS.AVALANCHE.id]: 6,
[CHAINS.ARBITRUM.id]: 6,
[CHAINS.AURORA.id]: 6,
[CHAINS.WORLDCHAIN.id]: 6,
},
symbol: 'USDC.e',
name: 'Bridged USDC',
Expand Down Expand Up @@ -1195,11 +1199,9 @@ export const WKLAY: BridgeableToken = {

export const MATIC: BridgeableToken = {
addresses: {
[CHAINS.POLYGON.id]: ZeroAddress,
[CHAINS.DFK.id]: '0xD17a41Cd199edF1093A9Be4404EaDe52Ec19698e',
},
decimals: {
[CHAINS.POLYGON.id]: 18,
[CHAINS.DFK.id]: 18,
},
symbol: 'MATIC',
Expand All @@ -1212,7 +1214,24 @@ export const MATIC: BridgeableToken = {
'https://45a97b3d.sanguine-fe.pages.dev/_next/static/media/matic.237cd2b6.svg',
}

export const WMATIC: BridgeableToken = {
export const POL: BridgeableToken = {
addresses: {
[CHAINS.POLYGON.id]: ZeroAddress,
},
decimals: {
[CHAINS.POLYGON.id]: 18,
},
symbol: 'MATIC',
name: 'MATIC',
swapableType: 'MATIC',
color: 'blue',
priorityRank: 300,
routeSymbol: 'POL',
imgUrl:
'https://45a97b3d.sanguine-fe.pages.dev/_next/static/media/matic.237cd2b6.svg',
}
Comment on lines +1217 to +1232
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

MATIC to POL renaming requires additional updates

The renaming from MATIC to POL is not consistently applied across the codebase. While the route symbols have been updated in some files, there are still several references to MATIC that need attention:

  • The token symbol and name are still set as "MATIC" in the POL token definition
  • Multiple chain-specific references like 'MATIC-137' and 'MATIC-53935' remain unchanged
  • No documentation of this rename was found in changelog or markdown files
  • Other packages (synapse-interface, synapse-constants, rest-api) have inconsistent implementations with both old and new route symbols

Please ensure:

  1. All token references are consistently using either MATIC or POL naming
  2. The change is properly documented in the changelog
  3. The naming convention is aligned across all packages
🔗 Analysis chain

Verify the impact of MATIC to POL renaming.

While the implementation looks correct, please ensure:

  1. The renaming from MATIC to POL is documented
  2. All references to these route symbols in the codebase are updated

Also applies to: 1246-1246

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for MATIC/POL route symbol references
echo "Searching for MATIC route symbol references..."
rg "routeSymbol.*MATIC"

echo "Searching for POL route symbol references..."
rg "routeSymbol.*POL"

echo "Searching for WMATIC route symbol references..."
rg "routeSymbol.*WMATIC"

Length of output: 1289


Script:

#!/bin/bash
# Let's check for any documentation about this change
echo "Checking for documentation mentioning MATIC to POL rename..."
rg -i "matic.*pol|polygon.*pol" -g "*.md" -g "CHANGELOG*"

# Let's also check for any other potential MATIC references that might need updating
echo "Checking for other MATIC references..."
rg "MATIC" -g "*.ts" -g "*.tsx" --no-filename | sort | uniq

Length of output: 2482


export const WPOL: BridgeableToken = {
addresses: {
[CHAINS.POLYGON.id]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
},
Expand All @@ -1224,7 +1243,7 @@ export const WMATIC: BridgeableToken = {
swapableType: 'MATIC',
color: 'blue',
priorityRank: 350,
routeSymbol: 'WMATIC',
routeSymbol: 'WPOL',
imgUrl:
'https://45a97b3d.sanguine-fe.pages.dev/_next/static/media/matic.237cd2b6.svg',
}
Expand Down Expand Up @@ -1410,3 +1429,24 @@ export const METIS: BridgeableToken = {
imgUrl:
'https://7bdf4de3.sanguine-fe.pages.dev/_next/static/media/metis.90b6abf0.svg',
}

export const WLD: BridgeableToken = {
priorityRank: 106,
addresses: {
[CHAINS.ETHEREUM.id]: '0x163f8C2467924be0ae7B5347228CABF260318753',
[CHAINS.OPTIMISM.id]: '0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1',
[CHAINS.WORLDCHAIN.id]: '0x2cFc85d8E48F8EAB294be644d9E25C3030863003',
},
decimals: {
[CHAINS.ETHEREUM.id]: 18,
[CHAINS.OPTIMISM.id]: 18,
[CHAINS.WORLDCHAIN.id]: 18,
},
symbol: 'WLD',
name: 'Worldcoin',
swapableType: 'WLD',
color: 'gray',
routeSymbol: 'WLD',
imgUrl:
'https://synapse-interface-worldchain.sanguine-fe.pages.dev/_next/static/media/worldchain.62d1dfd2.svg',
}
22 changes: 22 additions & 0 deletions packages/widget/src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,27 @@ export const LINEA: Chain = {
},
}

export const WORLDCHAIN: Chain = {
id: 480,
name: 'World Chain',
rpcUrls: {
primary: 'https://worldchain-mainnet.g.alchemy.com/public',
fallback: 'https://worldchain-mainnet.g.alchemy.com/public',
},
explorerUrl: 'https://worldchain-mainnet.explorer.alchemy.com',
explorerName: 'World Chain Explorer',
blockTime: 3000,
imgUrl:
'https://synapse-interface-worldchain.sanguine-fe.pages.dev/_next/static/media/worldchain.62d1dfd2.svg',
networkName: 'World Chain',
networkUrl: 'https://worldchain-mainnet.g.alchemy.com/public',
nativeCurrency: {
name: 'Ethereum',
symbol: 'ETH',
decimals: 18,
},
}
Comment on lines +467 to +486
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

⚠️ Potential issue

Update RPC fallback URL and verify image URL configuration

The image URL is accessible and properly configured with appropriate cache headers and immutable content settings, indicating it's a stable resource. However, the RPC configuration still needs attention:

  • The primary and fallback RPC URLs are identical (https://worldchain-mainnet.g.alchemy.com/public), which doesn't provide true failover capability.
  • Consider using a different RPC provider for the fallback URL to ensure service continuity during provider-specific outages.
🔗 Analysis chain

Configure different primary and fallback RPC URLs for redundancy.

The current configuration uses identical URLs for both primary and fallback RPC endpoints, which defeats the purpose of having a fallback. Consider using a different provider for the fallback URL to ensure reliability during outages.

Also verify if the image URL is pointing to a permanent location, as it appears to reference a specific deployment.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the image URL is accessible
curl -I "https://synapse-interface-worldchain.sanguine-fe.pages.dev/_next/static/media/worldchain.62d1dfd2.svg"

Length of output: 1389


export const CHAINS = {
ETHEREUM,
ARBITRUM,
Expand All @@ -487,6 +508,7 @@ export const CHAINS = {
BLAST,
SCROLL,
LINEA,
WORLDCHAIN,
}

export const CHAINS_ARRAY = Object.values(CHAINS)
Expand Down
4 changes: 3 additions & 1 deletion packages/widget/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const ONEETH = BRIDGEABLE.ONEETH
export const ONEUSDC = BRIDGEABLE.ONEUSDC
export const ONEUSDT = BRIDGEABLE.ONEUSDT
export const PEPE = BRIDGEABLE.PEPE
export const POL = BRIDGEABLE.POL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

POL token export requires comprehensive updates across the codebase

The verification reveals several issues that need to be addressed:

  • The POL token is not properly defined in bridgeable.ts despite being exported in index.tsx
  • While there are references to POL and WPOL symbols in bridgeMap.ts, the corresponding token definitions are missing
  • Multiple packages still reference MATIC/WMATIC tokens that need to be updated:
    • packages/widget/src/constants/bridgeable.ts
    • packages/synapse-interface/constants/tokens/bridgeable.ts
    • packages/synapse-constants/src/constants/tokens/bridgeable.ts
    • packages/rest-api/src/constants/bridgeable.ts

The export of POL token cannot be done in isolation without first implementing the proper token definitions and updating all related MATIC references across the codebase.

🔗 Analysis chain

Verify POL token implementation

The addition of POL token export needs verification to ensure all necessary chain configurations are in place.


Let me gather more information about the POL token implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify POL token implementation and its chain configurations
# Test: Check if POL is properly defined in bridgeable constants
rg -A 5 "POL\s*=\s*{" packages/widget/src/constants/bridgeable.ts

# Test: Check for any existing MATIC references that might need updates
rg "MATIC" --type ts

Length of output: 8595


Script:

#!/bin/bash
# Check if POL token is properly defined in bridgeable constants
rg -A 5 "POL\s*=\s*" packages/widget/src/constants/bridgeable.ts

# Check for POL references in bridge maps and routes
rg "POL" packages/widget/src/constants/bridgeMap.ts

# Check for POL chain configuration
rg -A 5 "POL" packages/widget/src/constants/chains.ts

Length of output: 446

export const PLS = BRIDGEABLE.PLS
export const SDT = BRIDGEABLE.SDT
export const SFI = BRIDGEABLE.SFI
Expand All @@ -107,9 +108,10 @@ export const WBTC = BRIDGEABLE.WBTC
export const WETH = BRIDGEABLE.WETH
export const WETHE = BRIDGEABLE.WETHE
export const WFTM = BRIDGEABLE.WFTM
export const WLD = BRIDGEABLE.WLD
export const WJEWEL = BRIDGEABLE.WJEWEL
export const WKLAY = BRIDGEABLE.WKLAY
export const WMATIC = BRIDGEABLE.WMATIC
export const WPOL = BRIDGEABLE.WPOL
export const WMOVR = BRIDGEABLE.WMOVR
export const WSOHM = BRIDGEABLE.WSOHM
export const XJEWEL = BRIDGEABLE.XJEWEL
Loading