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-interface): alternate eth address #2923

Merged
merged 4 commits into from
Jul 29, 2024

Conversation

bigboydiamonds
Copy link
Collaborator

@bigboydiamonds bigboydiamonds commented Jul 25, 2024

Update token parsing function to read address '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' same as zeroAddress

Summary by CodeRabbit

  • New Features
    • Enhanced token mapping to include support for ETH, improving the recognition of additional token addresses.

0901a58: synapse-interface preview link
fd37156: synapse-interface preview link
6c476cf: synapse-interface preview link

Copy link
Contributor

coderabbitai bot commented Jul 25, 2024

Walkthrough

The recent update enhances the tokenAddressToToken function by introducing a new conditional check for the Ethereum token address. This addition allows the function to recognize and return the ETH constant when the specified address is matched, thereby improving the mapping capabilities of token addresses to their respective entities. This change increases the overall efficiency of token identification within the project.

Changes

Files Change Summary
packages/synapse-interface/constants/tokens/... Added a conditional check for the ETH token address in tokenAddressToToken, expanding token recognition.

Poem

🐇 In the meadow where tokens play,
A new friend joins the fray today.
With a hop and a skip, ETH's now in sight,
Mapping magic, oh what a delight!
Tokens dance, a joyful show,
Thanks to changes, we all now know! 🌸


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

The update standardizes the handling of the Ethereum address '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' by treating it as equivalent to the zero address in the token parsing function.

  • Modified packages/synapse-interface/constants/tokens/index.ts to handle '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' as zero address.
  • Ensures the tokenAddressToToken function returns the ETH token object for the specified address.
  • Aligns with the pull request description to standardize address handling across the codebase.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8e30911 and e8b6aa5.

Files selected for processing (1)
  • packages/synapse-interface/constants/tokens/index.ts (1 hunks)
Additional comments not posted (1)
packages/synapse-interface/constants/tokens/index.ts (1)

138-139: Ensure the new address is handled correctly.

The added condition checks if the tokenAddress matches the Ethereum address 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE and returns ETH. This change is correct and follows the intended functionality to treat this address as equivalent to the zero address.

Copy link

codecov bot commented Jul 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.70802%. Comparing base (390bf29) to head (aa216ff).
Report is 1 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##              master       #2923   +/-   ##
=============================================
  Coverage   25.70802%   25.70802%           
=============================================
  Files            771         771           
  Lines          55613       55613           
  Branches          80          80           
=============================================
  Hits           14297       14297           
  Misses         39830       39830           
  Partials        1486        1486           
Flag Coverage Δ
packages 90.48563% <ø> (ø)

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

cloudflare-workers-and-pages bot commented Jul 25, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: aa216ff
Status: ✅  Deploy successful!
Preview URL: https://9a3b55f3.sanguine-fe.pages.dev
Branch Preview URL: https://fe-alternate-eth-adddress.sanguine-fe.pages.dev

View logs

Copy link

codecov bot commented Jul 25, 2024

Bundle Report

Changes will increase total bundle size by 533.85kB ⬆️

Bundle name Size Change
sdk-router-@synapsecns/sdk-router-cjs 521.95kB 404.94kB ⬆️
sdk-router-@synapsecns/sdk-router-esm 252.32kB 0 bytes
synapse-interface-server-cjs 1.38MB 146.35kB ⬇️
synapse-interface-edge-server-array-push 83 bytes 0 bytes
synapse-interface-client-array-push 7.46MB 11 bytes ⬆️
widget-esm-cjs 275.25kB 275.25kB ⬆️
widget-cjs-esm 273.3kB 0 bytes

Copy link

cloudflare-workers-and-pages bot commented Jul 25, 2024

Deploying sanguine with  Cloudflare Pages  Cloudflare Pages

Latest commit: bdeabe5
Status:🚫  Build failed.

View logs

@@ -135,6 +135,8 @@ export const tokenAddressToToken = (
if (chainId) {
if (tokenAddress === WETH.addresses[chainId]) {
return WETH
} else if (tokenAddress === '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

'constants/index.ts' file has this address so dont have to hardcode here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

missed that - thank you! updated in bdeabe5

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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e8b6aa5 and bdeabe5.

Files selected for processing (1)
  • packages/synapse-interface/constants/tokens/index.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/synapse-interface/constants/tokens/index.ts

@abtestingalpha abtestingalpha merged commit e84f0f6 into master Jul 29, 2024
38 checks passed
@abtestingalpha abtestingalpha deleted the fe/alternate-eth-adddress branch July 29, 2024 15:27
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

The pull request introduces significant updates to enhance token mapping and improve the maintainability of the codebase.

  • Token Parsing Enhancement: Updated packages/synapse-interface/constants/tokens/index.ts to treat '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' as the zero address.
  • Prometheus Exporter Refactor: Refactored contrib/promexporter/exporters/bridge.go to replace OpenTelemetry metrics with a custom otelRecorder.
  • New Metrics Collection: Added contrib/promexporter/exporters/dfk.go and contrib/promexporter/exporters/submitter.go for enhanced metrics collection.
  • Chain and Token Support: Added support for new chains and tokens in packages/synapse-interface/constants/chains/index.tsx and packages/synapse-interface/constants/tokens/bridgeable.ts.
  • Maintenance State Management: Introduced new hooks and reducers in packages/synapse-interface/components/Maintenance for better maintenance state handling.

71 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

The pull request enhances token mapping to include support for ETH, improving the recognition of additional token addresses.

  • Token Parsing Enhancement: Updated packages/synapse-interface/constants/tokens/index.ts to treat '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' as the zero address.
  • Transaction Payload Detail: Modified packages/synapse-interface/components/Activity/Transaction/components/TransactionPayloadDetail.tsx to use formatAmount utility for token amount formatting, increasing precision to 18 decimal places.
  • Token Address Handling: Updated packages/synapse-interface/utils/getUnderlyingBridgeTokens.ts to map zero address to '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'.
  • Token Approval: Adjusted packages/synapse-interface/utils/approveToken.tsx to handle the new ETH address format.
  • Token Lookup: Modified packages/synapse-interface/utils/findTokenByAddressAndChainId.ts to recognize the new ETH address format.

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

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