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

[IND-486] add new trade type #789

Merged
merged 4 commits into from
Nov 10, 2023
Merged

[IND-486] add new trade type #789

merged 4 commits into from
Nov 10, 2023

Conversation

dydxwill
Copy link
Contributor

Changelist

add new trade type

Test Plan

unit tests

Author/Reviewer Checklist

  • If this PR has changes that result in a different app state given the same prior state and transaction list, manually add the state-breaking label.
  • If this PR isn't state-breaking but has changes that modify behavior in PrepareProposal or ProcessProposal, manually add the label proposal-breaking.
  • If this PR is one of many that implement a specific feature, manually label them all feature:[feature-name].
  • If you wish to for mergify-bot to automatically create a PR to backport your change to a release branch, manually add the label backport/[branch-name].
  • Manually add any of the following labels: refactor, chore, bug.

Copy link

linear bot commented Nov 10, 2023

Copy link
Contributor

coderabbitai bot commented Nov 10, 2023

The provided walkthrough and changes are already well-structured and aligned with the instructions. Therefore, no further modifications are necessary.


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 197f530 and 10c7228.
Files ignored due to filter (1)
  • indexer/services/comlink/public/swagger.json
Files selected for processing (11)
  • indexer/packages/postgres/src/types/index.ts (1 hunks)
  • indexer/packages/postgres/src/types/trade-types.ts (1 hunks)
  • indexer/packages/postgres/src/types/websocket-message-types.ts (2 hunks)
  • indexer/services/comlink/public/api-documentation.md (2 hunks)
  • indexer/services/comlink/public/websocket-documentation.md (3 hunks)
  • indexer/services/comlink/src/request-helpers/request-transformer.ts (2 hunks)
  • indexer/services/comlink/src/types.ts (2 hunks)
  • indexer/services/ender/tests/helpers/constants.ts (2 hunks)
  • indexer/services/ender/tests/helpers/indexer-proto-helpers.ts (2 hunks)
  • indexer/services/ender/tests/lib/kafka-publisher.test.ts (4 hunks)
  • indexer/services/ender/src/handlers/order-fills/abstract-order-fill-handler.ts (2 hunks)
Files skipped from review due to trivial changes (2)
  • indexer/packages/postgres/src/types/index.ts
  • indexer/packages/postgres/src/types/websocket-message-types.ts
Additional comments: 20
indexer/services/ender/src/handlers/order-fills/abstract-order-fill-handler.ts (1)
  • 427-431: The fillTypeToTradeType function is used to convert FillType to TradeType. Ensure that this function handles all possible FillType values correctly and that the TradeType enum includes all necessary values.
indexer/packages/postgres/src/types/trade-types.ts (2)
  • 1-10: The new TradeType enum is well defined and the comments provide clear explanations for each type.

  • 12-23: The fillTypeToTradeType function is correctly implemented. It handles all possible FillType values and throws an error for unknown types. However, it's important to ensure that this error is properly handled wherever this function is used to prevent unexpected crashes.

indexer/services/ender/__tests__/helpers/indexer-proto-helpers.ts (2)
  • 29-33: The new import fillTypeToTradeType is correctly imported from @dydxprotocol-indexer/postgres.

  • 806-812: The function fillTypeToTradeType is correctly used to convert the takerFill.type to a trade type. Ensure that the function fillTypeToTradeType correctly handles all possible values of takerFill.type.

indexer/services/ender/__tests__/lib/kafka-publisher.test.ts (4)
  • 14-19: The import of TradeType is correct and its usage in the codebase should be verified to ensure that it replaces FillType as intended.

  • 410-414: The TradeType.LIMIT is used correctly in the tradeContent1 object. Ensure that the TradeType enum is used consistently throughout the codebase.

  • 423-427: The TradeType.LIMIT is used correctly in the tradeContent2 object. Ensure that the TradeType enum is used consistently throughout the codebase.

  • 437-441: The TradeType.LIMIT is used correctly in the tradeContent3 object. Ensure that the TradeType enum is used consistently throughout the codebase.

indexer/services/comlink/src/types.ts (2)
  • 16-21: The TradeType has been added to the import statement. Ensure that the TradeType enum is correctly defined in the @dydxprotocol-indexer/postgres module.

  • 174-180: The type property in TradeResponseObject has been changed from FillType to TradeType. Make sure that all instances where TradeResponseObject is used have been updated to handle TradeType instead of FillType.

indexer/services/comlink/src/request-helpers/request-transformer.ts (2)
  • 4-10: The new function fillTypeToTradeType has been added to the import statement. Ensure that this function is correctly implemented and tested.

  • 177-183: The type property of the fill object is now being processed through the fillTypeToTradeType function. This suggests a change in how the type property is handled in the trade response object. Make sure that the fillTypeToTradeType function correctly converts FillType to TradeType.

indexer/services/ender/__tests__/helpers/constants.ts (2)
  • 1-5: The import statement for TradeType has been updated correctly. Ensure that the TradeType enum is correctly defined in the @dydxprotocol-indexer/postgres module.

  • 325-329: The type property of defaultTradeContent has been updated to use TradeType.LIMIT. Ensure that all instances of defaultTradeContent in the codebase are updated to handle this change.

indexer/services/comlink/public/api-documentation.md (2)
  • 3052-3077: The new TradeType enum is well defined with the values LIMIT, LIQUIDATED, and DELEVERAGED. Ensure that these values are correctly handled in the codebase where this enum is used.

  • 3106-3106: The type property in TradeResponseObject now references TradeType instead of FillType. Make sure that all instances of TradeResponseObject in the codebase are updated to handle TradeType.

indexer/services/comlink/public/websocket-documentation.md (3)
  • 269-276: The new TradeType enum is well defined and the comments provide clear explanations for each type. Ensure that these new types are correctly handled in the rest of the codebase.

  • 724-724: The type property in the TradeContent interface has been updated to use the TradeType enum. Ensure that all instances of TradeContent in the codebase have been updated accordingly.

  • 746-754: The example JSON response has been updated to use the new TradeType enum. Ensure that the actual response from the server matches this example.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 10c7228 and 26c3841.
Files selected for processing (2)
  • indexer/services/comlink/src/request-helpers/request-transformer.ts (2 hunks)
  • indexer/services/comlink/src/types.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • indexer/services/comlink/src/types.ts
Additional comments: 2
indexer/services/comlink/src/request-helpers/request-transformer.ts (2)
  • 5-11: The new function fillTypeToTradeType is imported but there is no check for its return value. Ensure that it always returns a valid TradeType for all possible FillType values.

  • 178-184: The fillToTradeResponseObject function now uses fillTypeToTradeType(fill.type) to determine the type property. Ensure that this change does not break any code that relies on the previous type value.

-    type: fill.type,
+    type: fillTypeToTradeType(fill.type),

@dydxwill dydxwill merged commit dd16df6 into main Nov 10, 2023
11 checks passed
@dydxwill dydxwill deleted the wl/newtradetype branch November 10, 2023 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants