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

Updates Linea svg in synapse constants #2928

Merged
merged 7 commits into from
Jul 28, 2024
Merged

Conversation

Defi-Moses
Copy link
Collaborator

@Defi-Moses Defi-Moses commented Jul 28, 2024

Updates the linea svg so that it is visible in the explorer UI.

Summary by CodeRabbit

  • New Features

    • Introduced a new <Bar> component in the ChainChart for enhanced visual representation.
    • Expanded GraphQL query for daily statistics to include a new linea field, providing more comprehensive data.
    • Added support for the LINEA blockchain, including new tokens and constants for improved interoperability.
    • Integrated RFQ functionality into the bridge mapping, enhancing trading options.
    • Added new utility functions for fetching RFQ data and pretty printing TypeScript outputs.
  • Bug Fixes

    • Improved data handling and error management in the token mapping logic.
  • Chores

    • Updated asset exports to include new image resources for linea and scroll.
    • Streamlined paths and organization in scripts for better maintainability.

@github-actions github-actions bot added javascript Pull requests that update Javascript code go Pull requests that update Go code M-explorer-ui Sol Typescript size/m labels Jul 28, 2024
Copy link
Contributor

coderabbitai bot commented Jul 28, 2024

Walkthrough

This update enhances the application by integrating the Linea blockchain into various components, including visual representations, GraphQL queries, and token mappings. New fields have been added for improved data handling, and several assets and constants have been introduced. These changes collectively broaden the system's capabilities, allowing for richer interactions and statistics related to the Linea chain, ultimately enhancing user experience and functionality.

Changes

Files Change Summary
packages/explorer-ui/components/ChainChart/index.tsx, packages/explorer-ui/graphql/queries/index.ts Added <Bar> component for OverviewChart and introduced linea field to DAILY_STATISTICS_BY_CHAIN query.
packages/synapse-constants/constants/assets/chains/index.ts, packages/synapse-constants/constants/assets/explorer/index.ts Exported lineaImg, scrollExplorerImg, and lineaExplorerImg for new assets.
packages/synapse-constants/constants/bridgeMap.ts, packages/synapse-constants/constants/tokens/bridgeMap.ts Updated BRIDGE_MAP with RFQ.USDC and RFQ.ETH in origin and destination arrays.
packages/synapse-constants/constants/chains/index.ts, packages/synapse-constants/constants/chains/master.ts Added LINEA chain with ID 59144 and updated FASTBRIDGE_CONTRACTS mappings.
packages/synapse-constants/constants/tokens/bridgeable.ts Enhanced token definitions to include support for LINEA and SCROLL chains.
services/explorer/graphql/client/client.go, services/explorer/graphql/server/graph/model/models_gen.go Introduced linea field in relevant structs for enhanced statistics handling.
services/explorer/graphql/server/graph/resolver/server.go, services/explorer/graphql/server/graph/schema/types.graphql Added resolver functions and updated GraphQL schema for the new linea field.
services/explorer/static/chainIDs.yaml Added mapping for new chain ID 59144 associated with Linea.
packages/synapse-constants/scripts/generateMaps.js, packages/synapse-constants/scripts/utils/fetchRfqData.js, packages/synapse-constants/scripts/utils/prettyPrintTs.js Enhanced scripts for better RFQ handling and TypeScript exports.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant GraphQL
    participant DB

    User->>UI: Request Daily Stats
    UI->>GraphQL: Query GetDailyStatisticsByChain
    GraphQL->>DB: Fetch Data (base, blast, scroll, linea)
    DB-->>GraphQL: Return Data
    GraphQL-->>UI: Return Stats
    UI-->>User: Display Stats
Loading

🐰 In the meadow green and bright,
New changes hop with pure delight.
Linea's data flows like streams,
Enhancing all our clever dreams.
With every chart and token's grace,
We're bound to win in this fine race! 🌼


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

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

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4bf3720
Status: ✅  Deploy successful!
Preview URL: https://9da33df4.sanguine-fe.pages.dev
Branch Preview URL: https://explorer-adding-new-chains.sanguine-fe.pages.dev

View logs

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.

Caution

Inline review comments failed to post

Actionable comments posted: 4

Outside diff range, codebase verification and nitpick comments (1)
packages/synapse-constants/scripts/generateMaps.js (1)

3-4: Update the import paths to the correct locations.

The following files exist in the repository but are not in the paths specified in the import statements. Here are the correct paths:

  • ./utils/prettyPrintTs should be ./utils/prettyPrintTs.js
  • ./utils/fetchRfqData should be ./utils/fetchRfqData.js
  • ./data/providers.json is correct
  • ./data/ignoredBridgeSymbols.json is correct
  • ./data/symbolOverrides.json is correct
  • ./abi/SynapseRouter.json is correct
  • ./abi/SynapseCCTP.json is correct
  • ./abi/SynapseCCTPRouter.json is correct
  • ./abi/SwapQuoter.json is correct
  • ./abi/IERC20Metadata.json is correct
  • ./abi/IDefaultPool.json is correct

Please update the import statements to reflect these correct paths.

Analysis chain

Verify the correctness of the new import paths.

The import paths have been modified to stay within the same directory. Ensure that these paths are correct and that the files exist in the specified locations.

Also applies to: 6-6, 8-8, 10-10, 12-17


The specified import paths are incorrect or the files are missing from the repository.

The following files were not found in the specified paths:

  • ./utils/prettyPrintTs
  • ./utils/fetchRfqData
  • ./data/providers.json
  • ./data/ignoredBridgeSymbols.json
  • ./data/symbolOverrides.json
  • ./abi/SynapseRouter.json
  • ./abi/SynapseCCTP.json
  • ./abi/SynapseCCTPRouter.json
  • ./abi/SwapQuoter.json
  • ./abi/IERC20Metadata.json
  • ./abi/IDefaultPool.json

Please verify if these files exist in the repository and update the import paths accordingly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence of the imported files in the specified paths.

# Test: Check if the files exist. Expect: All files should exist.
for file in ./utils/prettyPrintTs ./utils/fetchRfqData ./data/providers.json ./data/ignoredBridgeSymbols.json ./data/symbolOverrides.json ./abi/SynapseRouter.json ./abi/SynapseCCTP.json ./abi/SynapseCCTPRouter.json ./abi/SwapQuoter.json ./abi/IERC20Metadata.json ./abi/IDefaultPool.json; do
  if [ ! -f "$file" ]; then
    echo "File not found: $file"
  fi
done

Length of output: 4641


Script:

#!/bin/bash
# Description: Search for the existence of the specified files in the repository.

# List of files to search for
files=(
  "prettyPrintTs"
  "fetchRfqData"
  "providers.json"
  "ignoredBridgeSymbols.json"
  "symbolOverrides.json"
  "SynapseRouter.json"
  "SynapseCCTP.json"
  "SynapseCCTPRouter.json"
  "SwapQuoter.json"
  "IERC20Metadata.json"
  "IDefaultPool.json"
)

# Search for each file in the repository
for file in "${files[@]}"; do
  echo "Searching for: $file"
  fd "$file"
done

Length of output: 3062

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 58df7a7 and 40a9c85.

Files ignored due to path filters (2)
  • packages/synapse-constants/constants/assets/chains/linea.svg is excluded by !**/*.svg
  • packages/synapse-constants/constants/assets/explorer/linea.svg is excluded by !**/*.svg
Files selected for processing (22)
  • packages/explorer-ui/components/ChainChart/index.tsx (1 hunks)
  • packages/explorer-ui/graphql/queries/index.ts (1 hunks)
  • packages/synapse-constants/constants/assets/chains/index.ts (1 hunks)
  • packages/synapse-constants/constants/assets/explorer/index.ts (1 hunks)
  • packages/synapse-constants/constants/bridgeMap.ts (38 hunks)
  • packages/synapse-constants/constants/chains/index.ts (2 hunks)
  • packages/synapse-constants/constants/chains/master.ts (3 hunks)
  • packages/synapse-constants/constants/tokens/bridgeMap.ts (39 hunks)
  • packages/synapse-constants/constants/tokens/bridgeable.ts (5 hunks)
  • packages/synapse-constants/constants/tokens/deprecated.ts (1 hunks)
  • packages/synapse-constants/constants/tokens/swapMaster.ts (1 hunks)
  • packages/synapse-constants/scripts/generateMaps.js (9 hunks)
  • packages/synapse-constants/scripts/utils/fetchRfqData.js (1 hunks)
  • packages/synapse-constants/scripts/utils/prettyPrintTs.js (1 hunks)
  • services/explorer/api/server_test.go (1 hunks)
  • services/explorer/graphql/client/client.go (2 hunks)
  • services/explorer/graphql/client/queries/queries.graphql (1 hunks)
  • services/explorer/graphql/server/graph/model/models_gen.go (1 hunks)
  • services/explorer/graphql/server/graph/partials.go (6 hunks)
  • services/explorer/graphql/server/graph/resolver/server.go (6 hunks)
  • services/explorer/graphql/server/graph/schema/types.graphql (1 hunks)
  • services/explorer/static/chainIDs.yaml (1 hunks)
Files skipped from review due to trivial changes (5)
  • packages/synapse-constants/constants/assets/chains/index.ts
  • packages/synapse-constants/constants/assets/explorer/index.ts
  • packages/synapse-constants/constants/tokens/deprecated.ts
  • packages/synapse-constants/constants/tokens/swapMaster.ts
  • services/explorer/static/chainIDs.yaml
Additional comments not posted (53)
packages/explorer-ui/graphql/queries/index.ts (1)

213-213: LGTM! The addition of the linea field is correct.

The linea field has been correctly added to the DAILY_STATISTICS_BY_CHAIN query.

services/explorer/graphql/server/graph/schema/types.graphql (1)

182-182: Addition of linea field looks good.

The new field linea is consistent with the existing fields in the DateResultByChain type and is appropriately typed as Float.

packages/synapse-constants/constants/chains/index.ts (2)

78-78: Addition of LINEA entry in ChainId looks good.

The new entry LINEA with the value 59144 is consistent with the existing entries in the ChainId mapping.


128-130: Additions to FASTBRIDGE_CONTRACTS look good.

The new entries for ChainId.LINEA, ChainId.BLAST, and ChainId.BSC are consistent with the existing entries and the addresses are correctly formatted.

services/explorer/api/server_test.go (1)

60-60: Addition of Linea field in the test struct looks good.

The new field Linea is consistent with the existing fields and is appropriately typed as a pointer to float64 with JSON and GraphQL tags for serialization.

services/explorer/graphql/client/queries/queries.graphql (1)

157-157: LGTM! The linea field addition is correct.

The addition of the linea field to the GetDailyStatisticsByChain query is consistent with the existing fields and follows the correct pattern.

packages/explorer-ui/components/ChainChart/index.tsx (1)

317-322: LGTM! The <Bar> component for linea is correctly added.

The addition of the new <Bar> component for the linea data series is consistent with the existing <Bar> components and follows the correct pattern.

packages/synapse-constants/constants/chains/master.ts (3)

22-22: LGTM! The import statement for lineaImg is correct.

The import statement for the lineaImg asset is correctly added.


44-44: LGTM! The import statement for lineaExplorerImg is correct.

The import statement for the lineaExplorerImg asset is correctly added.


484-506: LGTM! The LINEA entity is correctly added.

The addition of the LINEA entity is comprehensive and follows the same pattern as the other blockchain entities. It includes all necessary properties.

packages/synapse-constants/scripts/generateMaps.js (4)

33-37: Verify the correctness and usage of new constants.

The new constants allowedChainIdsForSynapseBridge and allowedChainIdsForRfq have been introduced. Ensure that these constants are correctly defined and used appropriately in the code.

Also applies to: 42-43

Verification successful

The new constants are correctly defined and used appropriately in the codebase.

The constants allowedChainIdsForSynapseBridge and allowedChainIdsForRfq are defined and used consistently in both packages/synapse-constants/scripts/generateMaps.js and packages/synapse-interface/scripts/generateMaps.js.

  • allowedChainIdsForSynapseBridge is used in forEach loops.
  • allowedChainIdsForRfq is used in includes checks.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new constants in the codebase.

# Test: Search for the usage of the constants. Expect: Constants should be used in appropriate places.
rg --type js 'allowedChainIdsForSynapseBridge'
rg --type js 'allowedChainIdsForRfq'

Length of output: 1167


462-463: Ensure correctness of the new function logic.

The function getRFQSymbol has been introduced to generate RFQ symbols. Ensure that the function logic is correct and follows best practices.

Verification successful

Ensure correctness of the new function logic.

The function getRFQSymbol has been introduced to generate RFQ symbols by concatenating "RFQ." with the provided symbol. The logic is straightforward and appears to be correctly implemented in both packages/synapse-constants/scripts/generateMaps.js and packages/synapse-interface/scripts/generateMaps.js.

  • packages/synapse-constants/scripts/generateMaps.js
  • packages/synapse-interface/scripts/generateMaps.js
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new function logic in the `getRFQSymbol` function.

# Test: Search for the function definition and its usage. Expect: Function logic should be correctly implemented.
rg --type js 'const getRFQSymbol'
rg --type js 'getRFQSymbol'

Length of output: 649


81-86: Ensure correctness and performance of the updated function logic.

The function getBridgeOriginMap has been updated to return early for chains without a corresponding SwapQuoter. Ensure that this logic is correct and optimizes performance by preventing unnecessary processing.

Verification successful

The early return logic in the getBridgeOriginMap function is correctly implemented and optimizes performance by preventing unnecessary processing.

  • The function returns early if there is no SwapQuoter for the given chainId, ensuring efficient execution.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the early return logic in the `getBridgeOriginMap` function.

# Test: Search for the function definition and its usage. Expect: Early return logic should be correctly implemented.
rg --type js 'const getBridgeOriginMap'
rg --type js 'getBridgeOriginMap'

Length of output: 717


Script:

#!/bin/bash
# Extract the full implementation of `getBridgeOriginMap` from both files.

# Extract from packages/synapse-constants/scripts/generateMaps.js
ast-grep --lang javascript --pattern $'const getBridgeOriginMap = async (chainId) => {
  $$$
}' packages/synapse-constants/scripts/generateMaps.js

# Extract from packages/synapse-interface/scripts/generateMaps.js
ast-grep --lang javascript --pattern $'const getBridgeOriginMap = async (chainId) => {
  $$$
}' packages/synapse-interface/scripts/generateMaps.js

Length of output: 12657


Line range hint 277-297:
Ensure correctness and integration of new RFQ data handling logic.

The function printMaps has been expanded to handle RFQ data. Ensure that the new logic is correct and integrates well with the existing code.

Also applies to: 312-369

Verification successful

The new RFQ data handling logic in the printMaps function is correctly implemented and well-integrated with the existing code.

  • The function correctly checks for allowed chain IDs and adds RFQ symbols to the origin and destination lists.
  • The RFQ responses are processed and integrated into the existing token maps.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new RFQ data handling logic in the `printMaps` function.

# Test: Search for the function definition and its usage. Expect: RFQ data handling logic should be correctly implemented.
rg --type js 'const printMaps'
rg --type js 'printMaps'

Length of output: 515


Script:

#!/bin/bash
# Extract the implementation of the `printMaps` function from both files for comparison and review.

# Extract from `packages/synapse-constants/scripts/generateMaps.js`
rg --type js -A 50 'const printMaps = async () => {' packages/synapse-constants/scripts/generateMaps.js

# Extract from `packages/synapse-interface/scripts/generateMaps.js`
rg --type js -A 50 'const printMaps = async () => {' packages/synapse-interface/scripts/generateMaps.js

Length of output: 463


Script:

#!/bin/bash
# Extract the implementation of the `printMaps` function from both files for comparison and review.

# Extract from `packages/synapse-constants/scripts/generateMaps.js`
rg --type js -A 50 'const printMaps = async () =>' packages/synapse-constants/scripts/generateMaps.js

# Extract from `packages/synapse-interface/scripts/generateMaps.js`
rg --type js -A 50 'const printMaps = async () =>' packages/synapse-interface/scripts/generateMaps.js

Length of output: 207


Script:

#!/bin/bash
# Extract the implementation of the `printMaps` function from both files for comparison and review.

# Extract from `packages/synapse-constants/scripts/generateMaps.js`
rg --type js -A 100 'printMaps' packages/synapse-constants/scripts/generateMaps.js

# Extract from `packages/synapse-interface/scripts/generateMaps.js`
rg --type js -A 100 'printMaps' packages/synapse-interface/scripts/generateMaps.js

Length of output: 7669

services/explorer/graphql/server/graph/model/models_gen.go (1)

106-106: Ensure correctness and integration of the new field.

The new field Linea has been added to the DateResultByChain struct. Ensure that the field is correctly defined and integrates well with the existing code.

Verification successful

Ensure the new field Linea is correctly integrated and used.

The new field Linea has been added to the DateResultByChain struct. We need to verify its usage and integration in the codebase.


The new field Linea is correctly defined and integrated.

The field Linea has been added to the DateResultByChain struct and is correctly utilized in the codebase, including JSON and GraphQL contexts, as well as in resolver logic.

  • services/explorer/graphql/client/client.go
  • services/explorer/graphql/server/graph/model/models_gen.go
  • services/explorer/graphql/server/graph/resolver/server.go
  • services/explorer/api/server_test.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new field in the `DateResultByChain` struct.

# Test: Search for the struct definition and its usage. Expect: Field should be correctly implemented.
rg --type go 'type DateResultByChain struct'
rg --type go 'DateResultByChain'

Length of output: 35107


Script:

#!/bin/bash
# Description: Verify the usage of the new field `Linea` in the codebase.

# Test: Search for the term `Linea` to check its usage.
rg --type go 'Linea'

Length of output: 735

services/explorer/graphql/client/client.go (2)

504-504: Ensure correctness and integration of the query updates.

The query GetDailyStatisticsByChainDocument has been updated to include the linea field. Ensure that the query updates are correctly defined and integrate well with the existing code.

Verification successful

The linea field has been correctly defined and integrated into the GetDailyStatisticsByChainDocument query and the rest of the codebase.

  • services/explorer/graphql/client/client.go: The linea field is defined and included in the query.
  • services/explorer/graphql/server/graph/partials.go: The linea field is used in query results.
  • services/explorer/graphql/server/graph/model/models_gen.go: The linea field is included in the model.
  • services/explorer/graphql/server/graph/resolver/server.go: The linea field is handled in the resolver.
  • services/explorer/api/server_test.go: The linea field is included in the tests.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the query updates in the `GetDailyStatisticsByChainDocument`.

# Test: Search for the query definition and its usage. Expect: Query updates should be correctly implemented.
rg --type go 'const GetDailyStatisticsByChainDocument'
rg --type go 'GetDailyStatisticsByChainDocument'

Length of output: 735


Script:

#!/bin/bash
# Description: Verify the inclusion and usage of the `linea` field in the `GetDailyStatisticsByChainDocument` query.

# Test: Search for the `linea` field within the `GetDailyStatisticsByChainDocument` query definition.
rg --type go 'linea' services/explorer/graphql/client/client.go

# Test: Search for the usage of the `linea` field in the codebase.
rg --type go 'linea'

Length of output: 2170


131-131: Ensure correctness and integration of the new field.

The new field Linea has been added to the GetDailyStatisticsByChain struct. Ensure that the field is correctly defined and integrates well with the existing code.

Verification successful

Ensure correctness and integration of the new field.

The new field Linea has been added to the GetDailyStatisticsByChain struct. Ensure that the field is correctly defined and integrates well with the existing code.

  • Verify the struct definition in services/explorer/graphql/client/client.go.
  • Check the usage instances in the same file and other files to confirm proper integration.

Ensure correctness and integration of the new field.

The new field Linea has been added to the GetDailyStatisticsByChain struct. Ensure that the field is correctly defined and integrates well with the existing code.

  • Verify the presence and correct definition of the Linea field in the GetDailyStatisticsByChain struct.
  • Check the usage instances in the same file and other files to confirm proper integration.

Ensure correctness and integration of the new field.

The new field Linea has been correctly added to the GetDailyStatisticsByChain struct and is integrated into the existing codebase.

  • The Linea field is defined in the GetDailyStatisticsByChain struct in services/explorer/graphql/client/client.go.
  • The Linea field is also referenced in test files and other related model and resolver files, indicating proper integration.

The field Linea appears to be correctly implemented and integrated.

  • services/explorer/graphql/client/client.go
  • services/explorer/api/server_test.go
  • services/explorer/graphql/server/graph/model/models_gen.go
  • services/explorer/graphql/server/graph/resolver/server.go
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the new field in the `GetDailyStatisticsByChain` struct.

# Test: Search for the struct definition and its usage. Expect: Field should be correctly implemented.
rg --type go 'type GetDailyStatisticsByChain struct'
rg --type go 'GetDailyStatisticsByChain'

Length of output: 8681


Script:

#!/bin/bash
# Description: Verify the new field in the `GetDailyStatisticsByChain` struct.

# Test: Search for the struct definition and its usage. Expect: Field should be correctly implemented.
rg --type go 'type GetDailyStatisticsByChain struct' -A 10
rg --type go 'GetDailyStatisticsByChain' -A 10

Length of output: 40315


Script:

#!/bin/bash
# Description: Verify the new field in the `GetDailyStatisticsByChain` struct.

# Test: Search for the specific field `Linea` in the struct definition. Expect: Field should be correctly implemented.
rg --type go 'Linea' -A 5 -B 5

Length of output: 6137

services/explorer/graphql/server/graph/partials.go (6)

403-403: LGTM!

The addition of the linea field to the dailyVolumeBridgeMvPt1 query is consistent with the existing fields.


447-447: LGTM!

The addition of the linea field to the dailyVolumeBridge query is consistent with the existing fields.


543-543: LGTM!

The addition of the linea field to the dailyStatisticGenericSelect query is consistent with the existing fields.


645-645: LGTM!

The addition of the linea field to the dailyStatisticGenericSinglePlatform query is consistent with the existing fields.


676-676: LGTM!

The addition of the linea field to the dailyStatisticGenericSinglePlatformMv query is consistent with the existing fields.


708-708: LGTM!

The addition of the linea field to the dailyStatisticGenericSinglePlatformMvFee query is consistent with the existing fields.

packages/synapse-constants/constants/tokens/bridgeable.ts (3)

415-415: LGTM!

The addition of the LINEA chain entry to the USDC token definition is consistent with the existing entries.


492-492: LGTM!

The addition of the SCROLL chain entry to the USDT token definition is consistent with the existing entries.


792-792: LGTM!

The addition of the LINEA chain entry to the ETH token definition is consistent with the existing entries.

packages/synapse-constants/constants/bridgeMap.ts (10)

34-42: Approved: Addition of RFQ.USDC to nUSD origin array.

The addition of RFQ.USDC to the origin array for nUSD is consistent with the PR objective of integrating RFQ mechanisms.


71-79: Approved: Addition of RFQ.USDC to LUSD origin array.

The addition of RFQ.USDC to the origin array for LUSD is consistent with the PR objective of integrating RFQ mechanisms.


101-109: Approved: Addition of RFQ.USDC to DAI origin array.

The addition of RFQ.USDC to the origin array for DAI is consistent with the PR objective of integrating RFQ mechanisms.


124-132: Approved: Addition of RFQ.USDC to PYUSD origin array.

The addition of RFQ.USDC to the origin array for PYUSD is consistent with the PR objective of integrating RFQ mechanisms.


161-169: Approved: Addition of RFQ.USDC to FRAX origin array.

The addition of RFQ.USDC to the origin array for FRAX is consistent with the PR objective of integrating RFQ mechanisms.


191-200: Approved: Addition of RFQ.USDC to USDC origin and destination arrays.

The addition of RFQ.USDC to the origin and destination arrays for USDC is consistent with the PR objective of integrating RFQ mechanisms.


235-235: Approved: Addition of RFQ.ETH to WETH origin array.

The addition of RFQ.ETH to the origin array for WETH is consistent with the PR objective of integrating RFQ mechanisms.


242-243: Approved: Addition of RFQ.ETH to ETH origin and destination arrays.

The addition of RFQ.ETH to the origin and destination arrays for ETH is consistent with the PR objective of integrating RFQ mechanisms.


256-264: Approved: Addition of RFQ.USDC to USDT origin array.

The addition of RFQ.USDC to the origin array for USDT is consistent with the PR objective of integrating RFQ mechanisms.


311-312: Approved: Addition of RFQ.USDC to USDC origin array on chain 10.

The addition of RFQ.USDC to the origin array for USDC on chain 10 is consistent with the PR objective of integrating RFQ mechanisms.

packages/synapse-constants/constants/tokens/bridgeMap.ts (11)

34-42: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0x1B84765dE8B7566e4cEAF4D0fD3c5aF52D3DdE4F is a beneficial change.


71-79: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0x5f98805A4E8be255a32880FDeC7F6728C6568bA0 is a beneficial change.


101-109: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0x6B175474E89094C44Da98b954EedeAC495271d0F is a beneficial change.


124-132: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0x6c3ea9036406852006290770BEdFcAbA0e23A0e8 is a beneficial change.


161-169: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0x853d955aCEf822Db058eb8505911ED77F175b99e is a beneficial change.


191-200: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin and destination fields for the token 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 is a beneficial change.


256-264: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0xdAC17F958D2ee523a2206206994597C13D831ec7 is a beneficial change.


286-294: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E is a beneficial change.


311-312: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin and destination fields for the token 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 is a beneficial change.


355-355: LGTM! The inclusion of RFQ.USDC enhances liquidity and trading routes.

The addition of RFQ.USDC to the origin field for the token 0x67C10C397dD0Ba417329543c1a40eb48AAa7cd00 is a beneficial change.


218-224: LGTM! The addition of the new token entry is a beneficial enhancement.

The new entry for the token 0xAdF7C35560035944e805D98fF17d58CDe2449389 with origin, destination, and swappable fields expands the bridge's capabilities.

services/explorer/graphql/server/graph/resolver/server.go (6)

119-119: LGTM!

The addition of the Linea function to the ComplexityRoot struct is consistent with the existing fields.


607-613: LGTM!

The addition of the linea case in the complexity calculation logic is consistent with the existing cases.


1666-1666: LGTM!

The addition of the linea field to the DateResultByChain struct is consistent with the existing fields.


4794-4833: LGTM!

The resolver function _DateResultByChain_linea and its field context management are consistent with the existing resolver functions and field context management.


7191-7192: LGTM!

The addition of the linea case in the field context management switch-case is consistent with the existing cases.


10435-10436: LGTM!

The addition of the linea case in the resolver switch-case is consistent with the existing cases.

Comments failed to post (3)
packages/synapse-constants/scripts/utils/fetchRfqData.js

4-14: Handle network issues more gracefully.

Consider retrying the fetch request a few times before failing.

const fetchRfqData = async (retries = 3) => {
  try {
    const controller = new AbortController();
    const timeoutId = setTimeout(() => controller.abort(), 5000); // 5 seconds timeout
    const response = await fetch(RFQ_URL, { signal: controller.signal });
    clearTimeout(timeoutId);
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    if (retries > 0) {
      console.warn(`Retrying... (${3 - retries + 1})`);
      return fetchRfqData(retries - 1);
    } else {
      console.error('Failed to fetch RFQ data:', error);
      return [];
    }
  }
};

Consider adding a timeout to the fetch request.

Adding a timeout can help prevent the function from hanging indefinitely if the server does not respond.

+ const controller = new AbortController();
+ const timeoutId = setTimeout(() => controller.abort(), 5000); // 5 seconds timeout
  const response = await fetch(RFQ_URL, { signal: controller.signal });
+ clearTimeout(timeoutId);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

const fetchRfqData = async () => {
  const controller = new AbortController();
  const timeoutId = setTimeout(() => controller.abort(), 5000); // 5 seconds timeout
  try {
    const response = await fetch(RFQ_URL, { signal: controller.signal });
    clearTimeout(timeoutId);
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    console.error('Failed to fetch RFQ data:', error);
    return [];
  }
}
packages/synapse-constants/scripts/utils/prettyPrintTs.js

10-10: Add error handling for the Prettier execution step.

Consider wrapping the Prettier execution step in a try-catch block to handle potential errors.

- execSync(`npx prettier --write ${fn}`);
+ try {
+   execSync(`npx prettier --write ${fn}`);
+ } catch (error) {
+   console.error(`Failed to format file ${fn} with Prettier:`, error);
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

  try {
    execSync(`npx prettier --write ${fn}`);
  } catch (error) {
    console.error(`Failed to format file ${fn} with Prettier:`, error);
  }

5-10: Add error handling for the file writing step.

Consider wrapping the file writing step in a try-catch block to handle potential errors.

  const json = JSON.stringify(map);
- fs.writeFileSync(fn, `export const ${mapName} = ${json}`);
+ try {
+   fs.writeFileSync(fn, `export const ${mapName} = ${json}`);
+ } catch (error) {
+   console.error(`Failed to write file ${fn}:`, error);
+   return;
+ }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

const prettyPrintTS = (map, mapName, fn) => {
  console.log(`Writing ${mapName} to ${fn}`)
  const json = JSON.stringify(map)
  try {
    fs.writeFileSync(fn, `export const ${mapName} = ${json}`)
  } catch (error) {
    console.error(`Failed to write file ${fn}:`, error)
    return;
  }
  // Run prettier on the file using terminal command:
  execSync(`npx prettier --write ${fn}`)

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

Updated Linea SVG and integrated it into the explorer UI, ensuring visibility and data representation.

  • ChainChart Update: Added Bar element for linea in packages/explorer-ui/components/ChainChart/index.tsx with specific fill colors.
  • GraphQL Query Update: Included linea chain in DAILY_STATISTICS_BY_CHAIN query in packages/explorer-ui/graphql/queries/index.ts.
  • SVG Export: Added linea.svg export in packages/synapse-constants/constants/assets/chains/index.ts.
  • Bridge Map Update: Added new origins and destinations for tokens in packages/synapse-constants/constants/bridgeMap.ts.
  • Chain Constants Update: Added Linea and Blast chains in packages/synapse-constants/constants/chains/index.ts.

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

Copy link

codecov bot commented Jul 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.70023%. Comparing base (9332b15) to head (4bf3720).

Additional details and impacted files
@@                 Coverage Diff                 @@
##              master       #2928         +/-   ##
===================================================
+ Coverage   25.69758%   25.70023%   +0.00265%     
===================================================
  Files            771         770          -1     
  Lines          55585       55482        -103     
  Branches          80          80                 
===================================================
- Hits           14284       14259         -25     
+ Misses         39821       39748         -73     
+ Partials        1480        1475          -5     
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

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

Updated Linea SVG and integrated it into the explorer UI, ensuring visibility and data representation.

  • Refactored getTxAge Function: Improved modularity and error handling in contrib/opbot/botmd/commands.go.
  • New Test for GetTxAge: Added TestTxAge in contrib/opbot/botmd/commands_test.go to validate transaction age calculation.
  • Metrics for Address Screening: Introduced new metrics in contrib/screener-api/screener/screener.go for better monitoring.
  • OpenTelemetry Integration: Enhanced Guard service with otelRecorder in services/rfq/guard/service/guard.go and otel.go.
  • Retry Mechanism for Withdrawals: Added retry logic in services/rfq/relayer/cmd/commands.go for fetching transaction hashes.

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

@trajan0x trajan0x merged commit 372197f into master Jul 28, 2024
36 checks passed
@trajan0x trajan0x deleted the explorer/adding-new-chains branch July 28, 2024 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code javascript Pull requests that update Javascript code size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants