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

Maker history from subgraph #4019

Merged
merged 5 commits into from
Sep 24, 2024
Merged

Conversation

piekczyk
Copy link
Collaborator

@piekczyk piekczyk commented Sep 6, 2024

Maker history from subgraph

Changes 👷‍♀️

  • replaced both history and automation history data sources with subgraph
  • CM triggers will be displayed as AS and AB, also no more CM events in history

How to test 🧪

  • history should display as usual

Summary by CodeRabbit

  • New Features

    • Added user notifications for auction completion, including details on remaining collateral.
    • Introduced a notification for auction initiation with collateral and Dai amounts.
    • Implemented a simplified message for opening a new vault.
  • Improvements

    • Enhanced localization support for auction-related messages, providing alternative phrases and simplifying existing messages.

Copy link
Contributor

coderabbitai bot commented Sep 6, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes involve updates to the localization file common.json, introducing new entries that enhance user notifications related to auction and vault operations. Specifically, new strings have been added to clarify messages for auction completion, auction initiation, and the action of opening a vault. Additionally, a modification in the ProductContext.ts file simplifies the initialization of a constant by reducing its dependencies.

Changes

Files Change Summary
public/locales/en/common.json Added new localization entries for auction completion, auction initiation, and opening a vault.
helpers/context/ProductContext.ts Simplified the initialization of automationTriggersData$ by reducing its memoization parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant Localization

    User->>App: Trigger Auction Event
    App->>Localization: Fetch Notification String
    Localization-->>App: Return Notification String
    App-->>User: Display Notification
Loading

🐰 "In the land of bids and vaults so bright,
New messages hop in, a delightful sight!
Auctions now sing of their finish and start,
With clearer words that warm the heart.
So let's cheer for the updates, both big and small,
For better notifications, we celebrate all!" 🐇✨

Possibly related PRs

  • Maker history from subgraph #4019: This PR directly modifies the same public/locales/en/common.json file and introduces identical entries for auctionfinished, liquidation, and opened, indicating a strong connection to the localization changes made in the main PR.

Suggested reviewers

  • marcinciarka

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.

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

Outside diff range, codebase verification and nitpick comments (4)
features/positionHistory/types.ts (1)

144-145: Approved: Addition of new properties to the Trigger interface.

The addition of commandAddress and triggerData to the Trigger interface is appropriate and aligns with the new subgraph-based data retrieval mechanisms. Consider adding documentation comments for these new properties to explain their usage and relevance in the context of triggers.

features/subgraphLoader/types.ts (2)

72-73: Approved: New entries in the Subgraphs type for historical and automation data retrieval.

The addition of getMakerHistoryOld, getMakerTriggersOld, and getMakerAutomationEvents is well-aligned with the PR's objectives to enhance data retrieval through subgraphs. Ensure that the naming conventions are consistent across the application to avoid confusion.

Also applies to: 100-102


180-181: Approved: New response types in the SubgraphsResponses type for subgraph queries.

The addition of response types for getMakerHistoryOld, getMakerTriggersOld, and getMakerAutomationEvents is appropriate and ensures consistent handling of subgraph responses. Consider adding error handling or validation mechanisms to manage potential inconsistencies or errors in the subgraph responses.

Also applies to: 209-209

features/vaultHistory/vaultHistory.ts (1)

417-450: Approved: Integration of subgraph data retrieval in the createVaultHistory$ function.

The modifications to use subgraph loading mechanisms in the createVaultHistory$ function are well-implemented, enhancing the modularity and responsiveness of the data-fetching logic. Consider adding comprehensive error handling for the subgraph data retrieval process to manage potential data inconsistencies or network issues.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between af80b07 and 8b6fb70.

Files selected for processing (11)
  • features/automation/api/automationTriggersData.ts (2 hunks)
  • features/automation/api/automationTxHandlers.ts (4 hunks)
  • features/positionHistory/types.ts (1 hunks)
  • features/subgraphLoader/consts.ts (1 hunks)
  • features/subgraphLoader/types.ts (5 hunks)
  • features/vaultHistory/VaultHistoryView.tsx (1 hunks)
  • features/vaultHistory/mapMakerSubgraphAutomationHistoryOld.ts (1 hunks)
  • features/vaultHistory/mapMakerSubgraphHistoryOld.ts (1 hunks)
  • features/vaultHistory/vaultHistory.ts (3 hunks)
  • handlers/portfolio/positions/handlers/maker/types.ts (1 hunks)
  • helpers/context/ProductContext.ts (1 hunks)
Additional comments not posted (11)
features/vaultHistory/VaultHistoryView.tsx (1)

43-43: Enhanced Key Generation Logic in VaultHistoryView.

The updated key generation logic now includes eventType and timestamp, which should help in reducing key collisions and improving rendering performance. However, ensure that the conditional inclusion of eventType does not introduce inconsistencies in scenarios where eventType might not be defined.

Verify the consistency of key generation across different scenarios to ensure that no rendering issues occur due to undefined eventType.

handlers/portfolio/positions/handlers/maker/types.ts (3)

44-88: Interface MakerHistoryOldItem is well-defined but verify data types.

The interface is comprehensive and covers all necessary fields for historical data related to Maker's operations. However, ensure that the use of strings for all properties is intentional and appropriate for the data handling requirements.

Consider verifying whether numeric operations are required on any of these fields and if so, adjust the data types accordingly.


90-94: Interface MakerHistoryOldResponse is correctly structured.

The interface is appropriately designed to handle multiple historical records for each CDP, aligning with typical response patterns in TypeScript interfaces.


96-104: Interface MakerTriggersOldResponse is suitably designed.

The interface is well-structured for managing trigger events related to Maker's operations, using an array to encapsulate the triggers within each CDP.

helpers/context/ProductContext.ts (1)

372-372: Simplification of automationTriggersData$ initialization approved, but verify impact.

The change reduces the complexity of the initialization of automationTriggersData$ by removing unnecessary parameters. However, ensure that this simplification does not remove any critical functionality related to automation triggers.

Run the following script to verify the impact of the change on the functionality:

features/subgraphLoader/consts.ts (3)

951-961: Approval of getMakerTriggersOld query, but verify functionality.

The query is concise and correctly targets the triggers associated with a specific CDP. However, verify that it functions as intended and retrieves the correct trigger data.

Run the following script to verify the functionality of the query:


900-949: Approval of getMakerHistoryOld query, but verify correctness.

The query is well-structured and appears to correctly target the necessary data for historical state logs of a CDP. However, verify that it retrieves data accurately from the subgraph.

Run the following script to verify the correctness of the query:


962-982: Approval of getMakerAutomationEvents query, but verify correctness and functionality.

The query is detailed and appears to correctly target the necessary data for automation events linked to a CDP. However, verify that it retrieves data accurately and functions as intended.

Run the following script to verify the correctness and functionality of the query:

features/automation/api/automationTxHandlers.ts (2)

Line range hint 26-35: Parameter Renaming and Logic Check

The renaming of the parameter from sendWithGasEstimation to send simplifies the function signature and focuses on a more generalized transaction sending mechanism. Ensure that the send function is correctly integrated and used within the function logic.

Verification successful

Parameter Renaming and Logic Check Verified

The renaming of the parameter from sendWithGasEstimation to send simplifies the function signature and maintains the correct transaction handling logic. The send function is correctly used within the removeAutomationTrigger function to manage transactions. No issues found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `send` function is used correctly in the `removeAutomationTrigger` function.

# Test: Search for the `send` function usage within the `removeAutomationTrigger` function.
ast-grep --lang typescript --pattern $'export function removeAutomationTrigger($$$) {
  $$$
  send($_, $_) {
    $$$
  }
  $$$
}'

Length of output: 130


Script:

#!/bin/bash
# Description: Verify the existence of the `removeAutomationTrigger` function and the usage of `send` within the file.

# Search for the definition of the `removeAutomationTrigger` function.
ast-grep --lang typescript --pattern 'function removeAutomationTrigger($$$) { $$$ }' features/automation/api/automationTxHandlers.ts

# Search for any usage of the `send` function within the file.
rg 'send\(' features/automation/api/automationTxHandlers.ts

Length of output: 2099


Line range hint 48-63: Parameter Renaming and Logic Check

The renaming of the parameter from sendWithGasEstimation to send simplifies the function signature and focuses on a more generalized transaction sending mechanism. Ensure that the send function is correctly integrated and used within the function logic.

Verification successful

Correct Usage of send in addAutomationTrigger Function

The send function is correctly used within the addAutomationTrigger function. It is part of an observable pattern, which is appropriate for handling asynchronous transaction operations.

  • The send function is called with resolvedTxDef and txData as arguments.
  • The observable pattern with pipe and subscribe is correctly implemented.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `send` function is used correctly in the `addAutomationTrigger` function.

# Test: Search for the `send` function usage within the `addAutomationTrigger` function.
ast-grep --lang typescript --pattern $'export function addAutomationTrigger($$$) {
  $$$
  send($_, $_) {
    $$$
  }
  $$$
}'

Length of output: 127


Script:

#!/bin/bash
# Description: Search for the `addAutomationTrigger` function definition and its usage of `send`.

# Search for the `addAutomationTrigger` function definition.
ast-grep --lang typescript --pattern 'function addAutomationTrigger($$$) {
  $$$
}'

# Search for the usage of `send` within the `addAutomationTrigger` function.
rg 'send\(' -A 5 --type=typescript

Length of output: 2381

features/automation/api/automationTriggersData.ts (1)

17-42: Function Renaming and Logic Update

The renaming of loadTriggerDataFromCache to loadTriggerDataFromSubgraph and the shift to subgraph-based data retrieval are aligned with the PR objectives to enhance efficiency. Ensure that the loadSubgraph function is correctly integrated and used within the function logic.

Verification successful

Correct Usage of loadSubgraph in loadTriggerDataFromSubgraph

The loadSubgraph function is correctly integrated and used within the loadTriggerDataFromSubgraph function in the features/automation/api/automationTriggersData.ts file. The parameters passed are consistent with the intended usage, confirming the function's correct implementation.

  • Location: features/automation/api/automationTriggersData.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the `loadSubgraph` function is used correctly in the `loadTriggerDataFromSubgraph` function.

# Test: Search for the `loadSubgraph` function usage within the `loadTriggerDataFromSubgraph` function.
ast-grep --lang typescript --pattern $'async function loadTriggerDataFromSubgraph($$$) {
  $$$
  loadSubgraph($_) {
    $$$
  }
  $$$
}'

Length of output: 137


Script:

#!/bin/bash
# Description: Verify that the `loadSubgraph` function is used correctly in the `loadTriggerDataFromSubgraph` function.

# Test: Search for the `loadSubgraph` function usage within the `loadTriggerDataFromSubgraph` function.
ast-grep --lang typescript --pattern $'async function loadTriggerDataFromSubgraph($$$) {
  $$$
  const { response } = await loadSubgraph({
    $$$
  })
  $$$
}'

Length of output: 161


Script:

#!/bin/bash
# Description: Verify that the `loadSubgraph` function is used correctly in the `loadTriggerDataFromSubgraph` function.

# Test: Search for any usage of `loadSubgraph` within the codebase to ensure it is being called correctly.
rg 'loadSubgraph\(' -A 5

Length of output: 14971

@piekczyk piekczyk merged commit 3e2f5fe into dev Sep 24, 2024
13 checks passed
@piekczyk piekczyk deleted the sp/untracked/maker-history-from-subgraph branch September 24, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants