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(synapse-constants): chain and token updates #3320

Merged
merged 18 commits into from
Oct 21, 2024

Conversation

abtestingalpha
Copy link
Collaborator

@abtestingalpha abtestingalpha commented Oct 21, 2024

Chain and token updates

Summary by CodeRabbit

  • New Features

    • Introduced new token 'WLD' with entries across multiple networks.
    • Added a new blockchain constant 'WORLDCHAIN' to enhance token management.
  • Bug Fixes

    • Updated symbols for existing tokens 'WMATIC' to 'WPOL' and 'MATIC' to 'POL' for improved clarity.
  • Improvements

    • Simplified token definitions and structures for better functionality and integration.

Copy link
Contributor

coderabbitai bot commented Oct 21, 2024

Walkthrough

The changes in this pull request involve updates to various constant files related to token definitions and mappings across multiple blockchain networks. New entries for the token 'WLD' have been added to the BRIDGE_MAP in several files, while existing token symbols, such as 'WMATIC' and 'MATIC', have been modified to 'WPOL' and 'POL', respectively. Additionally, a new constant WORLDCHAIN has been introduced, and existing token definitions have been adjusted to reflect these updates.

Changes

File Path Change Summary
packages/synapse-constants/src/constants/bridgeMap.ts Added new entries for 'WLD' under networks '1', '10', '480'; updated symbols for 'WMATIC' to 'WPOL' and 'MATIC' to 'POL'.
packages/synapse-constants/src/constants/chains/master.ts Introduced a new constant WORLDCHAIN with various properties.
packages/synapse-constants/src/constants/tokens/bridgeable.ts Added new token 'WLD'; modified definitions for 'MATIC' to 'POL', and 'WMATIC' to 'WPOL'.
packages/widget/src/constants/bridgeMap.ts Added new entries for 'WLD' under networks '1', '10', '480'; updated symbols for 'WMATIC' to 'WPOL' and 'MATIC' to 'POL'.

Possibly related PRs

Suggested labels

size/l

Suggested reviewers

  • trajan0x
  • bigboydiamonds
  • Defi-Moses

🐰 In the land of code where tokens play,
New 'WLD' entries brighten the day.
'WMATIC' now 'WPOL', symbols in flight,
With 'WORLDCHAIN' joining, all feels just right.
Hopping through changes, we dance with delight! 🌟


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

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 464d6c3
Status: ✅  Deploy successful!
Preview URL: https://a82e6d63.sanguine-fe.pages.dev
Branch Preview URL: https://synapse-constants-worldchain.sanguine-fe.pages.dev

View logs

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.44834%. Comparing base (065315d) to head (464d6c3).
Report is 2 commits behind head on master.

Additional details and impacted files
@@                 Coverage Diff                  @@
##              master       #3320          +/-   ##
====================================================
+ Coverage   26.98386%   90.44834%   +63.46448%     
====================================================
  Files            178          54         -124     
  Lines          11833        1026       -10807     
  Branches          82          82                  
====================================================
- Hits            3193         928        -2265     
+ Misses          8357          95        -8262     
+ Partials         283           3         -280     
Flag Coverage Δ
opbot ?
packages 90.44834% <ø> (ø)
rfq ?

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 (4)
packages/widget/src/constants/bridgeMap.ts (1)

31-37: LGTM. Consider adding a comment for the WLD token.

The addition of the WLD token to the Ethereum mainnet (network '1') looks good. The structure is consistent with other token entries.

Consider adding a comment above this entry to briefly describe what WLD represents (e.g., "// Worldcoin token") for better code readability and maintenance.

packages/synapse-constants/src/constants/bridgeMap.ts (2)

31-37: Addition of WLD token looks good.

The new entry for the WLD token is consistent with other token entries in the BRIDGE_MAP. It's correctly structured with decimals, symbol, origin, and destination fields.

Consider adding a comment explaining the significance of 'RFQ.WLD' for clarity, especially if this is a new concept in the system.


889-911: New network '480' added successfully.

The addition of network '480' with entries for WLD, USDC.e, and ETH tokens is structured correctly and consistent with other network entries in the BRIDGE_MAP.

Consider adding a comment or updating the documentation to explain what network '480' represents and why it's being added to the BRIDGE_MAP.

packages/synapse-constants/src/constants/tokens/bridgeable.ts (1)

Line range hint 1151-1163: Inconsistent symbol in WPOL token definition

The WPOL token has symbol set to 'WMATIC', but routeSymbol is 'WPOL'. Consider updating the symbol to 'WPOL' to maintain consistency.

Apply this diff to fix the inconsistency:

 export const WPOL = new Token({
   addresses: {
     [CHAINS.POLYGON.id]: '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270',
   },
   decimals: 18,
-  symbol: 'WMATIC',
+  symbol: 'WPOL',
   name: 'WMATIC',
   logo: 'https://8f3ea9f2.sanguine-fe.pages.dev/_next/static/media/matic.237cd2b6.svg',
   swapableType: 'MATIC',
   color: 'blue',
   visibilityRank: 90,
   priorityRank: 3,
   routeSymbol: 'WPOL',
 })
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 563909c and 464d6c3.

📒 Files selected for processing (4)
  • packages/synapse-constants/src/constants/bridgeMap.ts (12 hunks)
  • packages/synapse-constants/src/constants/chains/master.ts (1 hunks)
  • packages/synapse-constants/src/constants/tokens/bridgeable.ts (5 hunks)
  • packages/widget/src/constants/bridgeMap.ts (6 hunks)
🧰 Additional context used
🔇 Additional comments (13)
packages/synapse-constants/src/constants/chains/master.ts (3)

508-532: LGTM: WORLDCHAIN constant structure is consistent with other chain definitions.

The overall structure and properties of the WORLDCHAIN constant align well with other chain definitions in the file. It includes all necessary fields and follows the established pattern.


514-515: Ensure consistency in image URL domains.

The chainImg and explorerImg URLs for WORLDCHAIN use a different domain (synapse-interface-worldchain.sanguine-fe.pages.dev) compared to other chains in the file. Consider using the same domain as other chains for consistency.

#!/bin/bash
# Check the domains used for chainImg and explorerImg across all chains
grep -E "chainImg:|explorerImg:" packages/synapse-constants/src/constants/chains/master.ts

Also applies to: 523-524


518-519: Consider using different URLs for primary and fallback RPC endpoints.

The primary and fallback RPC URLs are currently identical. For better redundancy and fault tolerance, it's recommended to use different endpoints for the primary and fallback URLs.

packages/widget/src/constants/bridgeMap.ts (2)

465-471: LGTM. WLD token successfully added to Optimism network.

The addition of the WLD token to the Optimism network (network '10') is consistent with the Ethereum mainnet entry and follows the established structure for token entries.


889-911: New network 480 added with WLD, USDC.e, and ETH tokens.

The addition of network '480' with entries for WLD, USDC.e, and ETH tokens looks structurally correct and consistent with other network entries.

As this is a new network addition, please confirm the following:

  1. The network ID '480' is correct and corresponds to the intended blockchain.
  2. The token addresses are accurate for this network.
  3. The origin and destination arrays for each token are correctly specified.
✅ Verification successful

Verification Successful: Network '480' and Associated Tokens Confirmed

The addition of network '480' along with the WLD, USDC.e, and ETH tokens has been thoroughly verified and is consistent across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of network 480 in the codebase
echo "Searching for other occurrences of network 480:"
rg "480" --type ts

# Verify consistency of token addresses across the codebase
echo "Verifying WLD token address:"
rg "0x2cFc85d8E48F8EAB294be644d9E25C3030863003" --type ts
echo "Verifying USDC.e token address:"
rg "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1" --type ts

Length of output: 21358

packages/synapse-constants/src/constants/bridgeMap.ts (4)

934-940: Addition of WMetis and Metis tokens to network '1088' looks good.

The new entries for WMetis and Metis tokens are structured correctly and consistent with other token entries in the BRIDGE_MAP. The use of 'Metis' for both origin and destination in the Metis token entry suggests it's the native token of this network.

Also applies to: 969-975


1861-1890: New network '59144' added successfully, but verify USDT configuration.

The addition of network '59144' with entries for USDC, USDT, ETH, and WETH tokens is structured correctly and mostly consistent with other network entries in the BRIDGE_MAP.

The USDT token has an empty destination array, which is different from other tokens. Please verify if this is intentional or if it needs to be updated.

Consider adding a comment or updating the documentation to explain what network '59144' represents and why it's being added to the BRIDGE_MAP.


1944-1973: New network '534352' added successfully, but verify token configurations.

The addition of network '534352' with entries for USDC, WETH, ETH, and USDT tokens is structured correctly and mostly consistent with other network entries in the BRIDGE_MAP.

The WETH and USDT tokens have empty destination arrays, which is different from other tokens. Please verify if this is intentional or if these need to be updated.

Consider adding a comment or updating the documentation to explain what network '534352' represents and why it's being added to the BRIDGE_MAP.


687-687: Verify the impact of changing MATIC to POL.

The symbol change from 'MATIC' to 'POL' has been implemented correctly. This change appears to be related to the previous WMATIC to WPOL change, suggesting a network-wide rebranding.

Please ensure this change is consistent across the entire codebase. Run the following script to check for any remaining instances of 'MATIC':

#!/bin/bash
# Description: Check for remaining instances of 'MATIC' in the codebase

# Search for 'MATIC' in all files
rg -i '\bMATIC\b'
packages/synapse-constants/src/constants/tokens/bridgeable.ts (4)

752-752: Addition of WORLDCHAIN to ETH token addresses

The addition of WORLDCHAIN to the ETH token addresses with nullAddress appears appropriate.


915-915: Include USDCe on WORLDCHAIN

The inclusion of USDCe on WORLDCHAIN with the specified address looks correct.


1298-1316: Addition of WLD token

The WLD token is correctly defined with appropriate addresses and properties.


1134-1149: ⚠️ Potential issue

Inconsistent symbol and name in POL token definition

The POL token has symbol and name set to 'MATIC', but routeSymbol is 'POL'. Consider updating the symbol and name to 'POL' to maintain consistency.

Apply this diff to fix the inconsistency:

 export const POL = new Token({
   addresses: {
     [CHAINS.POLYGON.id]: zeroAddress,
   },
   decimals: 18,
-  symbol: 'MATIC',
-  name: 'MATIC',
+  symbol: 'POL',
+  name: 'POL',
   logo: 'https://8f3ea9f2.sanguine-fe.pages.dev/_next/static/media/matic.237cd2b6.svg',
   isNative: true,
   swapableType: 'MATIC',

Likely invalid or redundant comment.

@@ -591,7 +605,7 @@ export const BRIDGE_MAP = {
},
'0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270': {
decimals: 18,
symbol: 'WMATIC',
symbol: 'WPOL',
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

Residual 'WMATIC' Instances Detected After Changing to 'WPOL'.

Multiple files still reference 'WMATIC', indicating the symbol change to 'WPOL' may be incomplete.

  • packages/widget/src/types/index.d.ts
  • packages/widget/src/index.tsx
  • packages/widget/src/constants/bridgeable.ts
  • packages/synapse-interface/tests/getFromTokens.test.ts
  • packages/synapse-interface/tests/getToTokens.test.ts
  • packages/synapse-interface/tests/fixtures/mockRoutes.ts
  • packages/synapse-interface/constants/tokens/bridgeable.ts
  • packages/synapse-constants/src/constants/tokens/bridgeable.ts
  • packages/rest-api/src/constants/bridgeable.ts
  • packages/rest-api/src/constants/tokens/bridgeable.ts
🔗 Analysis chain

Verify the intention behind changing WMATIC to WPOL.

The symbol change from 'WMATIC' to 'WPOL' for the Polygon network (137) has been noted. This could represent a significant update in token representation.

Please confirm that this change is intentional and aligns with any broader updates in the project or the Polygon ecosystem. Also, ensure that this change is reflected consistently across all relevant parts of the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining instances of 'WMATIC' in the codebase
echo "Searching for remaining 'WMATIC' instances:"
rg "WMATIC" --type ts

# Search for new 'WPOL' instances to ensure consistent implementation
echo "Searching for new 'WPOL' instances:"
rg "WPOL" --type ts

Length of output: 2258

@@ -670,7 +684,7 @@
},
'0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE': {
decimals: 18,
symbol: 'MATIC',
symbol: '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

Incomplete symbol replacement detected.

Multiple instances of 'MATIC' remain in the codebase, which may lead to inconsistencies with the recent change to 'POL'. Please ensure that all occurrences of 'MATIC' are appropriately updated to 'POL' to maintain consistency across the project.

🔗 Analysis chain

Consistent change from MATIC to POL noted.

The symbol change from 'MATIC' to 'POL' for the native token on the Polygon network (137) is consistent with the earlier WMATIC to WPOL change.

This change further supports the notion of a broader update in token representation on Polygon. Please ensure this change is part of the same intended update as the WMATIC to WPOL change, and verify its consistency across the project.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining instances of 'MATIC' in the codebase
echo "Searching for remaining 'MATIC' instances:"
rg "MATIC" --type ts

# Search for new 'POL' instances to ensure consistent implementation
echo "Searching for new 'POL' instances:"
rg "POL" --type ts

Length of output: 21358


Script:

#!/bin/bash
# Search for any remaining instances of 'MATIC' in the codebase
echo "Searching for remaining 'MATIC' instances:"
rg "MATIC" --type ts

# Search for new 'POL' instances to ensure consistent implementation
echo "Searching for new 'POL' instances:"
rg "POL" --type ts

Length of output: 21308

@@ -591,7 +605,7 @@ export const BRIDGE_MAP = {
},
'0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270': {
decimals: 18,
symbol: 'WMATIC',
symbol: 'WPOL',
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

Residual 'WMATIC' instances found in the codebase.

The symbol 'WMATIC' is still present in multiple files and needs to be updated to 'WPOL' to ensure consistency across the project.

Affected files include, but are not limited to:

  • packages/widget/src/types/index.d.ts
  • packages/synapse-interface/constants/tokens/bridgeable.ts
  • packages/synapse-interface/__tests__/getToTokens.test.ts
  • packages/synapse-interface/__tests__/__fixtures__/mockRoutes.ts
  • packages/widget/src/index.tsx
  • packages/synapse-constants/src/constants/tokens/bridgeable.ts
  • packages/rest-api/src/constants/bridgeable.ts

Please update all instances of 'WMATIC' to 'WPOL' to complete the symbol change.

🔗 Analysis chain

Verify the impact of changing WMATIC to WPOL.

The symbol change from 'WMATIC' to 'WPOL' has been implemented correctly. However, this change could have wider implications across the project.

Please ensure this change is consistent across the entire codebase. Run the following script to check for any remaining instances of 'WMATIC':

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for remaining instances of 'WMATIC' in the codebase

# Search for 'WMATIC' in all files
rg -i 'WMATIC'

Length of output: 9950


Script:

#!/bin/bash
# Description: Check for remaining instances of 'WMATIC' in the codebase

# Search for 'WMATIC' in all files
rg -i '\bWMATIC\b'

Length of output: 1263

@abtestingalpha abtestingalpha merged commit d0f6e6f into master Oct 21, 2024
38 checks passed
@abtestingalpha abtestingalpha deleted the synapse-constants/worldchain branch October 21, 2024 15:01
Copy link

codecov bot commented Oct 21, 2024

Bundle Report

Changes will increase total bundle size by 165.0kB (0.52%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sdk-router-@synapsecns/sdk-router-esm* 255.08kB 183 bytes (-0.07%) ⬇️
sdk-router-@synapsecns/sdk-router-cjs* 117.47kB 78 bytes (-0.07%) ⬇️
explorer-ui-server-cjs* 708.77kB 245 bytes (-0.03%) ⬇️
explorer-ui-client-array-push* 2.15MB 408 bytes (-0.02%) ⬇️
synapse-interface-client-array-push* 7.38MB 5.6kB (-0.08%) ⬇️
synapse-interface-server-cjs* 1.65MB 5.77kB (-0.35%) ⬇️
widget-cjs-esm 273.04kB 1.77kB (0.65%) ⬆️
docs-bridge-client-array-push* 7.28MB 463 bytes (-0.01%) ⬇️
docs-bridge-server-cjs* 11.31MB 1.97kB (-0.02%) ⬇️
@synapsecns/synapse-constants-cjs-esm 177.96kB 177.96kB (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.

2 participants