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

Conversation

abtestingalpha
Copy link
Collaborator

@abtestingalpha abtestingalpha commented Oct 24, 2024

Summary by CodeRabbit

  • New Features

    • Introduced support for Worldcoin (WLD) and added it as a bridgeable token.
    • Added support for the Worldchain network, including its properties and configuration.
    • Updated token definitions for Ethereum (ETH) and renamed MATIC to POL, reflecting changes in the underlying structure.
  • Bug Fixes

    • Updated route symbols for wrapped tokens to ensure consistency across the platform.

Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

Walkthrough

The changes in this pull request involve the addition of new constants and modifications to existing ones within the bridgeable.ts, chains.ts, and index.tsx files. A new token for "Worldcoin" (WLD) is introduced, while existing tokens for Ethereum (ETH) and MATIC are updated to support new chain configurations. Additionally, the WORLDCHAIN constant is added to the chain definitions, and the exports in the index file are adjusted to reflect these changes.

Changes

File Path Change Summary
packages/widget/src/constants/bridgeable.ts Added new WLD token, updated ETH and POL (formerly MATIC), and modified route symbol for WMATIC to WPOL.
packages/widget/src/constants/chains.ts Introduced WORLDCHAIN constant and updated CHAINS object to include it.
packages/widget/src/index.tsx Added exports for POL and WLD, replaced WMATIC with WPOL.

Possibly related PRs

Suggested labels

M-synapse-interface

Suggested reviewers

  • trajan0x
  • bigboydiamonds
  • aureliusbtc

🐇 In the world of tokens, we leap and bound,
New chains and symbols, oh what a sound!
WLD joins the dance, with colors so bright,
POL takes the stage, a marvelous sight.
With each little change, our bridge grows strong,
Hopping through code, where we all belong! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.44834%. Comparing base (0651118) to head (0aaeda8).
Report is 5 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                  @@
##              master       #3331          +/-   ##
====================================================
+ Coverage   33.25951%   90.44834%   +57.18883%     
====================================================
  Files            543          54         -489     
  Lines          34769        1026       -33743     
  Branches          82          82                  
====================================================
- Hits           11564         928       -10636     
+ Misses         22182          95       -22087     
+ Partials        1023           3        -1020     
Flag Coverage Δ
cctp-relayer ?
core ?
ethergo ?
git-changes-action ?
omnirpc ?
opbot ?
packages 90.44834% <ø> (ø)
promexporter ?
rfq ?
screener-api ?
scribe ?
tools ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (1)
packages/widget/src/index.tsx (1)

Line range hint 90-114: Review token export organization

Consider reorganizing token exports to maintain a consistent pattern:

  1. Group by token type (native, wrapped, stable)
  2. Maintain alphabetical ordering within groups

Consider applying this structure:

// Native Tokens
export const ETH = BRIDGEABLE.ETH
export const POL = BRIDGEABLE.POL
// ... other native tokens

// Wrapped Tokens
export const WETH = BRIDGEABLE.WETH
export const WPOL = BRIDGEABLE.WPOL
// ... other wrapped tokens

// Stable Tokens
export const USDC = BRIDGEABLE.USDC
export const USDT = BRIDGEABLE.USDT
// ... other stable tokens

// Other Tokens
export const WLD = BRIDGEABLE.WLD
// ... other tokens
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6595fb4 and 0aaeda8.

📒 Files selected for processing (3)
  • packages/widget/src/constants/bridgeable.ts (6 hunks)
  • packages/widget/src/constants/chains.ts (2 hunks)
  • packages/widget/src/index.tsx (2 hunks)
🔇 Additional comments (6)
packages/widget/src/index.tsx (2)

111-111: Verify WLD (Worldcoin) token integration

The new WLD token export needs verification of its complete implementation.

#!/bin/bash
# Description: Verify WLD token implementation and chain support
# Test: Check WLD token definition
rg -A 10 "WLD\s*=\s*{" packages/widget/src/constants/bridgeable.ts

# Test: Check WORLDCHAIN configuration
rg -A 5 "WORLDCHAIN" packages/widget/src/constants/chains.ts

114-114: Breaking Change: WMATIC renamed to WPOL

The renaming of WMATIC to WPOL is a breaking change that requires careful consideration.

This change could break existing implementations. Consider:

  1. Adding a deprecation notice for WMATIC
  2. Maintaining backward compatibility temporarily
  3. Documenting the migration path
#!/bin/bash
# Description: Check for existing WMATIC usage that needs updating
# Test: Look for WMATIC references in the codebase
rg "WMATIC" --type ts
packages/widget/src/constants/chains.ts (1)

511-511: LGTM!

The integration of WORLDCHAIN into the CHAINS object follows the established pattern and maintains proper ordering.

packages/widget/src/constants/bridgeable.ts (3)

810-810: LGTM: ETH token WORLDCHAIN support added correctly.

The addition of WORLDCHAIN support follows the established pattern of using ZeroAddress for native tokens and 18 decimals.

Also applies to: 823-823


999-999: LGTM: USDCe token WORLDCHAIN support added correctly.

The addition of WORLDCHAIN support uses the correct decimals (6) for USDC and follows the established pattern.

Also applies to: 1006-1006


1433-1452: LGTM: WLD token added with proper configuration.

The Worldcoin (WLD) token is correctly implemented with:

  • Support for ETHEREUM, OPTIMISM, and WORLDCHAIN
  • Consistent use of 18 decimals
  • Proper priority ranking

@@ -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

Comment on lines +467 to +486
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,
},
}
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

Comment on lines +1217 to +1232
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',
}
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

@abtestingalpha abtestingalpha merged commit 294306c into master Oct 24, 2024
43 checks passed
@abtestingalpha abtestingalpha deleted the widget/chain-update branch October 24, 2024 19:58
Copy link

codecov bot commented Oct 24, 2024

Bundle Report

Changes will decrease total bundle size by 3.91MB (-10.96%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sdk-router-@synapsecns/sdk-router-esm* 255.26kB 609 bytes (0.24%) ⬆️
sdk-router-@synapsecns/sdk-router-cjs* 117.55kB 312 bytes (0.27%) ⬆️
explorer-ui-server-cjs* 708.77kB 157.29kB (-18.16%) ⬇️
explorer-ui-client-array-push* 2.15MB 162.81kB (-7.04%) ⬇️
synapse-interface-client-array-push* 7.38MB 100.39kB (1.38%) ⬆️
synapse-interface-server-cjs* 1.65MB 151.21kB (10.12%) ⬆️
widget-cjs-esm 274.69kB 1.39kB (0.51%) ⬆️
docs-bridge-client-array-push* 7.28MB 619.59kB (-7.84%) ⬇️
docs-bridge-server-cjs* 11.31MB 3.57MB (-23.99%) ⬇️
synapse-constants-esm-cjs* 174.63kB 174.63kB (100%) ⬆️
synapse-constants-cjs-esm* 174.18kB 174.18kB (100%) ⬆️

ℹ️ *Bundle size includes cached data from a previous commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant