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

[OTE-689] add protos for affiliates #2112

Merged
merged 10 commits into from
Aug 22, 2024
Merged

[OTE-689] add protos for affiliates #2112

merged 10 commits into from
Aug 22, 2024

Conversation

affanv14
Copy link
Contributor

@affanv14 affanv14 commented Aug 20, 2024

Changelist

Adds protos for affiliates which includes txs, queries and events

Test Plan

[Describe how this PR was tested (if applicable)]

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 the PR has breaking postgres changes to the indexer add the indexer-postgres-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.

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive affiliate management capabilities, including registration and tier updates.
    • Added querying methods for retrieving affiliate information, referrals, and all affiliate tiers.
    • Enhanced event handling to include affiliate revenue sharing and registration details.
  • Bug Fixes

    • Improved data handling and integrity for affiliate-related queries and transactions.
  • Documentation

    • Updated documentation to reflect new methods, interfaces, and usage examples for affiliate management.
  • Refactor

    • Restructured module imports and organization within the dydxprotocol namespace for better maintainability.

Copy link
Contributor

coderabbitai bot commented Aug 20, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

This update enhances the affiliate management system within the dydxprotocol, introducing new TypeScript interfaces and Protobuf definitions for affiliate tiers, queries, and transaction handling. It adds methods for retrieving affiliate data and processing registrations while enhancing event structures to capture revenue-sharing details, establishing a comprehensive framework for managing affiliate relationships.

Changes

Files Changed Change Summary
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/*.ts, proto/dydxprotocol/affiliates/*.proto Added TypeScript interfaces and Protobuf definitions for managing affiliate tiers and transaction requests, including MsgRegisterAffiliate and MsgUpdateAffiliateTiers.
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.proto Introduced new RPC methods (AffiliateInfo, ReferredBy, AllAffiliateTiers) for retrieving affiliate-related data.
proto/dydxprotocol/indexer/events/events.proto Enhanced event structures with affiliate_rev_share and added a new RegisterAffiliateEventV1 for tracking affiliate registrations.
indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts, indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts Restructured imports and exports to improve organization within the dydxprotocol namespace.
protocol/app/basic_manager/basic_manager.go, protocol/x/affiliates/keeper/grpc_query.go, protocol/x/affiliates/keeper/msg_server.go Added methods to handle affiliate registration, tier updates, and queries within the basic manager and keeper logic.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AffiliateService
    participant Database

    Client->>AffiliateService: Query affiliate data
    AffiliateService->>Database: Fetch affiliate information
    Database-->>AffiliateService: Return affiliate data
    AffiliateService-->>Client: Return queried affiliate information
Loading
sequenceDiagram
    participant Client
    participant MsgService
    participant Database

    Client->>MsgService: Register new affiliate
    MsgService->>Database: Store affiliate registration
    Database-->>MsgService: Confirm registration
    MsgService-->>Client: Registration success
Loading

🐰 "In the fields where bunnies play,
New affiliates join the fray,
With tiers and fees all set to share,
Hoppin' into business with flair!
The world of finance, bright and bold,
With friendly rabbits, brave and bold!" 🌼


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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4dfe799 and 70a6437.

Files ignored due to path filters (4)
  • protocol/indexer/events/events.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/affiliates.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (14)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (8 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts (1 hunks)
  • proto/dydxprotocol/affiliates/affiliates.proto (1 hunks)
  • proto/dydxprotocol/affiliates/query.proto (1 hunks)
  • proto/dydxprotocol/affiliates/tx.proto (1 hunks)
  • proto/dydxprotocol/indexer/events/events.proto (2 hunks)
Files skipped from review due to trivial changes (1)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
Additional context used
Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (41)
indexer/packages/v4-protos/src/codegen/google/bundle.ts (1)

1-14: Verify the impact of import changes on the codebase.

The reordering and modification of imports affect the api and protobuf exports. Ensure that these changes do not break existing functionality or dependencies in other parts of the codebase.

Run the following script to check for any usage of the affected imports:

Verification successful

Verification Successful: Import Changes Do Not Impact Codebase Negatively

The import changes in indexer/packages/v4-protos/src/codegen/google/bundle.ts involving _127 are consistent with its usage. The reference to _121 is irrelevant to this file and does not affect the api and protobuf exports. No issues were found regarding the functionality or dependencies in the codebase.

  • _127 is correctly used in google/bundle.ts.
  • _121 is unrelated to the changes in google/bundle.ts.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify usage of affected imports in the codebase.

# Test: Search for usage of _121 and _127 in the codebase. Expect: No references to _121 and valid references to _127.
rg --type ts '_121|_127'

Length of output: 375

proto/dydxprotocol/affiliates/affiliates.proto (1)

1-22: Ensure correct usage of protocol buffer options.

The AffiliateTiers message and its nested Tier message are well-structured. Verify that the use of gogoproto.nullable aligns with your intended serialization behavior.

Ensure that the gogoproto.nullable option is correctly applied and does not conflict with other serialization settings.

indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1)

8-8: Verify integration of the affiliates property.

The addition of the affiliates property in the createRPCMsgClient function integrates affiliate-related functionality. Ensure that this integration is seamless and does not disrupt existing functionality.

Check for any existing tests or usage of createRPCMsgClient to ensure that the new affiliates property is correctly utilized.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts (1)

1-34: Verify correctness of RPC method implementations.

The MsgClientImpl class provides methods for handling affiliate-related messages. Ensure that the RPC requests and responses are correctly implemented and tested.

Check for any existing tests or examples of using MsgClientImpl to ensure that the methods are functioning as expected.

proto/dydxprotocol/affiliates/tx.proto (1)

12-46: Verify implementation of new service methods and message types.

The new service methods and message types enhance the protocol's capabilities for managing affiliate relationships. Ensure that the message definitions and RPC methods are correctly implemented and tested.

Check for any existing tests or documentation that validate the new service methods and message types.

proto/dydxprotocol/affiliates/query.proto (7)

4-6: Ensure imported protos are necessary.

Verify that all imported proto files are required for the definitions in this file. Unused imports can be removed to keep the file clean.


12-19: Review RPC method definitions for completeness.

The Query service now includes methods for querying affiliate information. Ensure that these methods are correctly implemented in the corresponding server-side code and that they align with the intended functionality.


23-23: Use of custom scalar type for address.

The AffiliateInfoRequest message uses a custom scalar type for the address field. Ensure that this type is correctly defined in the cosmos_proto package and that it meets the requirements for address validation.


34-44: Custom types for bytes fields.

The AffiliateInfoResponse message uses custom types for referred_volume and staked_amount. Ensure that these custom types are correctly implemented and that they provide the necessary functionality for serialization and deserialization.


50-50: Use of custom scalar type for address.

The ReferredByRequest message uses a custom scalar type for the address field. Ensure that this type is correctly defined in the cosmos_proto package and that it meets the requirements for address validation.


55-56: Use of custom scalar type for affiliate address.

The ReferredByResponse message uses a custom scalar type for the affiliate address field. Ensure that this type is correctly defined in the cosmos_proto package and that it meets the requirements for address validation.


67-67: Non-nullable field in response message.

The AllAffiliateTiersResponse message includes a non-nullable field for tiers. Ensure that the server-side implementation correctly populates this field and handles cases where no tiers are available.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (6)

9-15: Ensure correct implementation of Query methods.

The Query interface now includes methods for querying affiliate information. Ensure that these methods are correctly implemented and that they handle all edge cases, such as invalid requests or network errors.


22-25: Binding methods in constructor.

The methods in QueryClientImpl are bound in the constructor. This is a good practice to ensure the correct context when the methods are called. Ensure that this pattern is consistently used across similar implementations.


27-31: Review encoding and decoding logic.

The affiliateInfo method includes encoding and decoding logic for Protobuf messages. Ensure that this logic is correctly implemented and that it handles all possible edge cases, such as malformed data or unexpected message formats.


33-37: Review encoding and decoding logic.

The referredBy method includes encoding and decoding logic for Protobuf messages. Ensure that this logic is correctly implemented and that it handles all possible edge cases, such as malformed data or unexpected message formats.


39-42: Review encoding and decoding logic.

The allAffiliateTiers method includes encoding and decoding logic for Protobuf messages. Ensure that this logic is correctly implemented and that it handles all possible edge cases, such as malformed data or unexpected message formats.


49-60: Ensure correct implementation of RPC query extension.

The createRpcQueryExtension function exposes the new query methods. Ensure that this function is correctly implemented and that it integrates seamlessly with the broader application context.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts (6)

5-8: Ensure affiliate tiers are correctly defined.

The AffiliateTiers interface defines the structure for affiliate tiers. Ensure that the tiers are correctly populated and sorted as expected in the application logic.


17-29: Review tier structure and properties.

The AffiliateTiers_Tier interface defines properties for each tier. Ensure that these properties are correctly used and validated in the application logic, particularly the numeric fields like level and takerFeeSharePpm.


52-59: Review encoding logic for AffiliateTiers.

The encode method for AffiliateTiers ensures that all tiers are serialized correctly. Verify that this method handles all edge cases, such as empty tiers or invalid data.


61-80: Review decoding logic for AffiliateTiers.

The decode method for AffiliateTiers reconstructs the message from serialized data. Ensure that this method handles all edge cases, such as malformed data or unexpected message formats.


100-118: Review encoding logic for AffiliateTiers_Tier.

The encode method for AffiliateTiers_Tier ensures that each tier is serialized correctly. Verify that this method handles all edge cases, such as default values or missing fields.


121-152: Review decoding logic for AffiliateTiers_Tier.

The decode method for AffiliateTiers_Tier reconstructs the message from serialized data. Ensure that this method handles all edge cases, such as malformed data or unexpected message formats.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (6)

6-12: Ensure correct definition of MsgRegisterAffiliate.

The MsgRegisterAffiliate interface defines the structure for registering affiliate relationships. Ensure that the fields are correctly populated and validated in the application logic.


30-36: Ensure correct definition of MsgUpdateAffiliateTiers.

The MsgUpdateAffiliateTiers interface defines the structure for updating affiliate tiers. Ensure that the fields are correctly populated and validated in the application logic.


60-70: Review encoding logic for MsgRegisterAffiliate.

The encode method for MsgRegisterAffiliate ensures that the message is serialized correctly. Verify that this method handles all edge cases, such as default values or missing fields.


73-96: Review decoding logic for MsgRegisterAffiliate.

The decode method for MsgRegisterAffiliate reconstructs the message from serialized data. Ensure that this method handles all edge cases, such as malformed data or unexpected message formats.


150-159: Review encoding logic for MsgUpdateAffiliateTiers.

The encode method for MsgUpdateAffiliateTiers ensures that the message is serialized correctly. Verify that this method handles all edge cases, such as default values or missing fields.


162-185: Review decoding logic for MsgUpdateAffiliateTiers.

The decode method for MsgUpdateAffiliateTiers reconstructs the message from serialized data. Ensure that this method handles all edge cases, such as malformed data or unexpected message formats.

indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (3)

3-6: Verify module reorganization.

The imports for the affiliates module have been updated. Ensure that these changes align with the intended module structure and that all necessary components are correctly imported.


180-184: Ensure correct export of affiliates module.

The affiliates module is now aggregated from multiple sources. Verify that all necessary components are included and that the export aligns with the intended functionality.


380-382: Review ClientFactory export.

The ClientFactory export has been updated to include new imports. Ensure that these changes reflect the intended enhancements or adjustments in client creation logic.

proto/dydxprotocol/indexer/events/events.proto (2)

167-168: Addition of affiliate_rev_share field in OrderFillEventV1.

The new field affiliate_rev_share is added to track the revenue share for affiliates. Ensure this field is correctly integrated into any logic that processes OrderFillEventV1.


586-593: Introduction of RegisterAffiliateEventV1 message.

The new message RegisterAffiliateEventV1 is introduced to handle affiliate registration events. Ensure this message is integrated into the event processing logic and is correctly serialized/deserialized.

indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (6)

418-420: Addition of affiliateRevShare in OrderFillEventV1.

The new property affiliateRevShare is added to the interface. Ensure that this property is correctly handled in any logic that processes OrderFillEventV1.


450-452: Addition of affiliate_rev_share in OrderFillEventV1SDKType.

The new property affiliate_rev_share is added to the SDK type. Ensure that this property is correctly handled in any logic that processes OrderFillEventV1SDKType.


1488-1499: Introduction of RegisterAffiliateEventV1 interface.

The new interface RegisterAffiliateEventV1 is introduced to handle affiliate registration events. Ensure this interface is integrated into the event processing logic and is correctly serialized/deserialized.


1502-1511: Introduction of RegisterAffiliateEventV1SDKType interface.

The new interface RegisterAffiliateEventV1SDKType is introduced to handle affiliate registration events in SDK types. Ensure this interface is integrated into the event processing logic and is correctly serialized/deserialized.


3758-3764: Base function for RegisterAffiliateEventV1.

The function createBaseRegisterAffiliateEventV1 initializes the RegisterAffiliateEventV1 structure. Ensure that default values are appropriate and consistent with the rest of the system.


3766-3820: Encoding and decoding functions for RegisterAffiliateEventV1.

The encoding and decoding functions ensure that RegisterAffiliateEventV1 is correctly serialized and deserialized. Verify that these functions are integrated into the system where necessary.

*/

export interface AllAffiliateTiersRequest {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

The AllAffiliateTiersRequest interface is empty and could be replaced with a type alias for clarity and simplicity.

Use a type alias as follows:

- export interface AllAffiliateTiersRequest {}
+ export type AllAffiliateTiersRequest = {};
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.

Suggested change
export interface AllAffiliateTiersRequest {}
export type AllAffiliateTiersRequest = {};
Tools
Biome

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

* RPC method.
*/

export interface AllAffiliateTiersRequestSDKType {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

The AllAffiliateTiersRequestSDKType interface is empty and could be replaced with a type alias for clarity and simplicity.

Use a type alias as follows:

- export interface AllAffiliateTiersRequestSDKType {}
+ export type AllAffiliateTiersRequestSDKType = {};
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.

Suggested change
export interface AllAffiliateTiersRequestSDKType {}
export type AllAffiliateTiersRequestSDKType = {};
Tools
Biome

[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

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

Outside diff range, codebase verification and nitpick comments (3)
proto/dydxprotocol/affiliates/tx.proto (2)

12-19: Add comments for clarity on RPC methods.

The RPC methods RegisterAffiliate and UpdateAffiliateTiers are well-defined. Consider adding more detailed comments to explain the expected behavior and use cases for these methods.

  // RegisterAffiliate registers a referee-affiliate relationship
+ // This method establishes a link between a referee and an affiliate, allowing for tracking and management of affiliate activities.
  rpc RegisterAffiliate(MsgRegisterAffiliate)
      returns (MsgRegisterAffiliateResponse);
  // UpdateAffiliateTiers updates affiliate tiers
+ // This method allows the modification of existing affiliate tiers, enabling dynamic adjustments to affiliate structures.
  rpc UpdateAffiliateTiers(MsgUpdateAffiliateTiers)
      returns (MsgUpdateAffiliateTiersResponse);

37-42: Clarify the purpose of authority in MsgUpdateAffiliateTiers.

The authority field is crucial for governance-related actions. Ensure that the documentation clearly states its role and any constraints on its use.

  // Authority sending this message. Will be sent by gov
+ // This field should contain the address authorized to make governance changes, ensuring that only valid entities can update affiliate tiers.
  string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
proto/dydxprotocol/affiliates/query.proto (1)

11-19: Add comments for clarity on RPC methods.

The RPC methods AffiliateInfo, ReferredBy, and AllAffiliateTiers are well-defined. Consider adding more detailed comments to explain the expected behavior and use cases for these methods.

  // Query AffiliateInfo returns the affiliate info for a given address.
+ // This method retrieves detailed information about an affiliate, including tier and financial metrics.
  rpc AffiliateInfo(AffiliateInfoRequest) returns (AffiliateInfoResponse);
  // Query ReferredBy returns the affiliate that referred a given address.
+ // This method identifies the affiliate responsible for referring a specific address, aiding in tracking referral chains.
  rpc ReferredBy(ReferredByRequest) returns (ReferredByResponse);
  // Query AllAffiliateTiers returns all affiliate tiers.
+ // This method provides a comprehensive list of all defined affiliate tiers, useful for understanding the affiliate structure.
  rpc AllAffiliateTiers(AllAffiliateTiersRequest)
      returns (AllAffiliateTiersResponse);
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 70a6437 and 754243d.

Files ignored due to path filters (4)
  • protocol/indexer/events/events.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/affiliates.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (14)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (8 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts (1 hunks)
  • proto/dydxprotocol/affiliates/affiliates.proto (1 hunks)
  • proto/dydxprotocol/affiliates/query.proto (1 hunks)
  • proto/dydxprotocol/affiliates/tx.proto (1 hunks)
  • proto/dydxprotocol/indexer/events/events.proto (2 hunks)
Files skipped from review due to trivial changes (2)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
  • proto/dydxprotocol/affiliates/affiliates.proto
Files skipped from review as they are similar to previous changes (6)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts
  • proto/dydxprotocol/indexer/events/events.proto
Additional context used
Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (16)
proto/dydxprotocol/affiliates/tx.proto (1)

21-31: Ensure message options are necessary.

The MsgRegisterAffiliate message includes options for cosmos.msg.v1.signer, gogoproto.equal, and gogoproto.goproto_getters. Verify that these options are required for your use case.

If these options are not necessary, consider removing them to simplify the message definition.

proto/dydxprotocol/affiliates/query.proto (1)

28-45: Ensure custom types are necessary.

The AffiliateInfoResponse message uses custom types for referred_volume and staked_amount. Verify that these custom types are necessary and correctly implemented.

If simpler types can be used without losing functionality, consider simplifying the message definition.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (2)

7-16: Ensure method names reflect functionality.

The method names affiliateInfo, referredBy, and allAffiliateTiers are descriptive. Ensure they accurately reflect the functionality and are consistent with naming conventions in the rest of the codebase.

If there are any inconsistencies, consider renaming the methods for clarity.


22-25: Bind methods in the constructor.

Binding methods in the constructor ensures the correct context when they are called. This is a good practice for maintaining method behavior.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (4)

24-27: Use type alias instead of empty interface.

The MsgRegisterAffiliateResponse interface is empty. Consider using a type alias instead, as suggested by static analysis tools.

Tools
Biome

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


48-51: Use type alias instead of empty interface.

The MsgUpdateAffiliateTiersResponse interface is empty. Consider using a type alias instead, as suggested by static analysis tools.

Tools
Biome

[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


60-71: Ensure encoding logic is robust.

The encoding logic for MsgRegisterAffiliate is straightforward. Ensure that all fields are correctly encoded and that any necessary validation is performed before encoding.

If there are any additional constraints or validations, consider implementing them before encoding.


150-160: Ensure encoding logic is robust.

The encoding logic for MsgUpdateAffiliateTiers is straightforward. Ensure that all fields are correctly encoded and that any necessary validation is performed before encoding.

If there are any additional constraints or validations, consider implementing them before encoding.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (4)

85-85: Use a type alias instead of an empty interface.

The AllAffiliateTiersRequest interface is empty and could be replaced with a type alias for clarity and simplicity.

Tools
Biome

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


91-91: Use a type alias instead of an empty interface.

The AllAffiliateTiersRequestSDKType interface is empty and could be replaced with a type alias for clarity and simplicity.

Tools
Biome

[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


118-124: Ensure encoding logic is robust.

The encoding logic for AffiliateInfoRequest is straightforward. Ensure that all fields are correctly encoded and that any necessary validation is performed before encoding.

If there are any additional constraints or validations, consider implementing them before encoding.


166-184: Ensure encoding logic is robust.

The encoding logic for AffiliateInfoResponse is straightforward. Ensure that all fields are correctly encoded and that any necessary validation is performed before encoding.

If there are any additional constraints or validations, consider implementing them before encoding.

indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (4)

418-420: Addition of affiliateRevShare is appropriate.

The new property affiliateRevShare in the OrderFillEventV1 interface correctly extends the data structure to include affiliate revenue sharing information.


450-452: Addition of affiliate_rev_share is consistent.

The new property affiliate_rev_share in the OrderFillEventV1SDKType interface ensures consistency with the OrderFillEventV1 interface.


1488-1498: Introduction of RegisterAffiliateEventV1 is well-structured.

The new interface RegisterAffiliateEventV1 effectively captures the necessary details for affiliate registration events.


3766-3819: Encoding and decoding functions for RegisterAffiliateEventV1 are correctly implemented.

The functions handle the serialization and deserialization of RegisterAffiliateEventV1 data appropriately.

Comment on lines +27 to +42
affiliateInfo(request: AffiliateInfoRequest): Promise<AffiliateInfoResponse> {
const data = AffiliateInfoRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.affiliates.Query", "AffiliateInfo", data);
return promise.then(data => AffiliateInfoResponse.decode(new _m0.Reader(data)));
}

referredBy(request: ReferredByRequest): Promise<ReferredByResponse> {
const data = ReferredByRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.affiliates.Query", "ReferredBy", data);
return promise.then(data => ReferredByResponse.decode(new _m0.Reader(data)));
}

allAffiliateTiers(request: AllAffiliateTiersRequest = {}): Promise<AllAffiliateTiersResponse> {
const data = AllAffiliateTiersRequest.encode(request).finish();
const promise = this.rpc.request("dydxprotocol.affiliates.Query", "AllAffiliateTiers", data);
return promise.then(data => AllAffiliateTiersResponse.decode(new _m0.Reader(data)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Handle potential errors in RPC requests.

Ensure that potential errors in the RPC requests are handled appropriately, possibly by adding error handling logic or comments indicating how errors should be managed.

Consider adding try-catch blocks or similar error handling mechanisms to manage potential errors in the RPC requests.

@affanv14 affanv14 force-pushed the affan/affiliates-protos branch 2 times, most recently from 88882b4 to 342081c Compare August 20, 2024 18:07
@affanv14 affanv14 changed the title add protos for affiliates [OTE-689] add protos for affiliates Aug 20, 2024
Copy link

linear bot commented Aug 20, 2024

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 754243d and 88882b4.

Files ignored due to path filters (4)
  • protocol/indexer/events/events.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/affiliates.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (20)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (8 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts (1 hunks)
  • indexer/services/ender/tests/helpers/constants.ts (4 hunks)
  • indexer/services/ender/src/helpers/translation-helper.ts (3 hunks)
  • indexer/services/ender/src/lib/translated-types.ts (1 hunks)
  • indexer/services/ender/src/lib/types.ts (2 hunks)
  • proto/dydxprotocol/affiliates/affiliates.proto (1 hunks)
  • proto/dydxprotocol/affiliates/query.proto (1 hunks)
  • proto/dydxprotocol/affiliates/tx.proto (1 hunks)
  • proto/dydxprotocol/indexer/events/events.proto (2 hunks)
  • protocol/x/affiliates/keeper/grpc_query.go (1 hunks)
  • protocol/x/affiliates/keeper/msg_server.go (1 hunks)
Files skipped from review due to trivial changes (2)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
  • proto/dydxprotocol/affiliates/affiliates.proto
Files skipped from review as they are similar to previous changes (8)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts
  • proto/dydxprotocol/affiliates/query.proto
  • proto/dydxprotocol/affiliates/tx.proto
  • proto/dydxprotocol/indexer/events/events.proto
Additional context used
Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (29)
indexer/services/ender/src/lib/translated-types.ts (1)

37-38: Verify integration of affiliateRevShare.

The affiliateRevShare property has been added to the OrderFillWithLiquidity interface. Ensure that all code interacting with this interface is updated to handle this new property.

Run the following script to verify the usage of affiliateRevShare:

Verification successful

Integration of affiliateRevShare Verified

The affiliateRevShare property is integrated into various parts of the codebase, indicating that it is being handled appropriately. Here are some key locations where it is used:

  • Protobuf Definition: protocol/indexer/events/events.pb.go
  • TypeScript Codegen: indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts
  • Test Constants: indexer/services/ender/__tests__/helpers/constants.ts
  • Translation Helper: indexer/services/ender/src/helpers/translation-helper.ts
  • Type Definitions: indexer/services/ender/src/lib/types.ts and indexer/services/ender/src/lib/translated-types.ts

These references suggest that the property is being utilized across different components, including serialization, testing, and helper functions.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `affiliateRevShare` in the codebase.

# Test: Search for occurrences of `affiliateRevShare`. Expect: Proper handling in all relevant code.
rg --type typescript 'affiliateRevShare'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify the usage of `affiliateRevShare` in the codebase.

# Test: Search for occurrences of `affiliateRevShare`. Expect: Proper handling in all relevant code.
rg 'affiliateRevShare'

Length of output: 2029

indexer/services/ender/src/helpers/translation-helper.ts (1)

29-29: Verify integration of affiliateRevShare parameter.

The affiliateRevShare parameter has been added to several functions. Ensure that the parameter is correctly integrated and utilized in the business logic.

Run the following script to verify the usage of affiliateRevShare in the functions:

Also applies to: 44-44, 59-59

Verification successful

affiliateRevShare Parameter Integration Verified

The affiliateRevShare parameter is well-integrated into the codebase, appearing in type definitions, helper functions, and test files. This comprehensive integration suggests that the parameter is correctly utilized and its functionality is being validated through tests.

  • Files Involved:
    • indexer/services/ender/src/helpers/translation-helper.ts
    • indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts
    • indexer/services/ender/src/lib/types.ts
    • indexer/services/ender/__tests__/helpers/constants.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of `affiliateRevShare` in the functions.

# Test: Search for function definitions and usages involving `affiliateRevShare`. Expect: Proper handling in all relevant code.
rg --type typescript 'affiliateRevShare'

Length of output: 75


Script:

#!/bin/bash
# Description: Verify the usage of `affiliateRevShare` in the functions.

# Test: Search for function definitions and usages involving `affiliateRevShare`. Expect: Proper handling in all relevant code.
rg --type ts 'affiliateRevShare'

Length of output: 1858

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (1)

27-42: Acknowledge existing comments on error handling.

Ensure that potential errors in the RPC requests are handled appropriately, as suggested in previous comments.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (6)

6-12: LGTM!

The MsgRegisterAffiliate interface is well-defined and aligns with the expected structure.


15-21: LGTM!

The MsgRegisterAffiliateSDKType interface is well-defined and aligns with the expected structure.


24-24: Replace empty interfaces with type aliases.

The MsgRegisterAffiliateResponse interface is empty. Consider using a type alias instead, as suggested by static analysis tools.

Also applies to: 26-26

Tools
Biome

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


30-36: LGTM!

The MsgUpdateAffiliateTiers interface is well-defined and aligns with the expected structure.


39-45: LGTM!

The MsgUpdateAffiliateTiersSDKType interface is well-defined and aligns with the expected structure.


48-48: Replace empty interfaces with type aliases.

The MsgUpdateAffiliateTiersResponse interface is empty. Consider using a type alias instead, as suggested by static analysis tools.

Also applies to: 50-50

Tools
Biome

[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

indexer/services/ender/src/lib/types.ts (2)

198-199: LGTM!

The addition of affiliateRevShare to OrderFillEventWithOrder enhances the type by including affiliate revenue sharing information.


209-210: LGTM!

The addition of affiliateRevShare to OrderFillEventWithLiquidation enhances the type by including affiliate revenue sharing information.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (12)

9-11: LGTM!

The AffiliateInfoRequest interface is well-defined and aligns with the expected structure.


17-19: LGTM!

The AffiliateInfoRequestSDKType interface is well-defined and aligns with the expected structure.


25-37: LGTM!

The AffiliateInfoResponse interface is well-defined and aligns with the expected structure.


43-55: LGTM!

The AffiliateInfoResponseSDKType interface is well-defined and aligns with the expected structure.


58-61: LGTM!

The ReferredByRequest interface is well-defined and aligns with the expected structure.


64-67: LGTM!

The ReferredByRequestSDKType interface is well-defined and aligns with the expected structure.


70-73: LGTM!

The ReferredByResponse interface is well-defined and aligns with the expected structure.


76-79: LGTM!

The ReferredByResponseSDKType interface is well-defined and aligns with the expected structure.


85-85: Use a type alias instead of an empty interface.

The AllAffiliateTiersRequest interface is empty and could be replaced with a type alias for clarity and simplicity.

Tools
Biome

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


91-91: Use a type alias instead of an empty interface.

The AllAffiliateTiersRequestSDKType interface is empty and could be replaced with a type alias for clarity and simplicity.

Tools
Biome

[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


97-100: LGTM!

The AllAffiliateTiersResponse interface is well-defined and aligns with the expected structure.


106-109: LGTM!

The AllAffiliateTiersResponseSDKType interface is well-defined and aligns with the expected structure.

indexer/services/ender/__tests__/helpers/constants.ts (4)

283-284: LGTM!

The addition of affiliateRevShare to defaultOrderEvent enhances the constant by including affiliate revenue sharing information.


293-294: LGTM!

The addition of affiliateRevShare to defaultOrder enhances the constant by including affiliate revenue sharing information.


303-304: LGTM!

The addition of affiliateRevShare to defaultLiquidationEvent enhances the constant by including affiliate revenue sharing information.


313-314: LGTM!

The addition of affiliateRevShare to defaultLiquidation enhances the constant by including affiliate revenue sharing information.

indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (2)

418-420: LGTM!

The addition of affiliateRevShare to OrderFillEventV1 enhances the interface by including affiliate revenue sharing information.


1490-1499: LGTM!

The RegisterAffiliateEventV1 interface is well-defined and aligns with the expected structure.

Comments failed to post (7)
protocol/x/affiliates/keeper/grpc_query.go

11-13: Implement the AffiliateInfo method.

The AffiliateInfo method is currently a stub. Implement the logic to handle affiliate information queries.

Would you like assistance in drafting the implementation for this method?


15-17: Implement the ReferredBy method.

The ReferredBy method is currently a stub. Implement the logic to handle queries for affiliates that referred a given address.

Would you like assistance in drafting the implementation for this method?


19-21: Implement the AllAffiliateTiers method.

The AllAffiliateTiers method is currently a stub. Implement the logic to handle queries for all affiliate tiers.

Would you like assistance in drafting the implementation for this method?

protocol/x/affiliates/keeper/msg_server.go

14-16: Implement the RegisterAffiliate method.

The RegisterAffiliate method is currently a stub. Implement the logic to handle affiliate registration.

Would you like assistance in drafting the implementation for this method?


18-20: Implement the UpdateAffiliateTiers method.

The UpdateAffiliateTiers method is currently a stub. Implement the logic to handle updates to affiliate tiers.

Would you like assistance in drafting the implementation for this method?

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts

27-27: Replace empty interfaces with type aliases.

The MsgRegisterAffiliateResponseSDKType interface is empty. Consider using a type alias instead, as suggested by static analysis tools.

Replace the interface with a type alias:

- export interface MsgRegisterAffiliateResponseSDKType {}
+ export type MsgRegisterAffiliateResponseSDKType = {};
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.

export type MsgRegisterAffiliateResponseSDKType = {};
Tools
Biome

[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


51-51: Replace empty interfaces with type aliases.

The MsgUpdateAffiliateTiersResponseSDKType interface is empty. Consider using a type alias instead, as suggested by static analysis tools.

Replace the interface with a type alias:

- export interface MsgUpdateAffiliateTiersResponseSDKType {}
+ export type MsgUpdateAffiliateTiersResponseSDKType = {};
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.

export type MsgUpdateAffiliateTiersResponseSDKType = {};
Tools
Biome

[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

@@ -580,3 +582,13 @@ message LiquidityTierUpsertEventV2 {
// Upper cap of open interest in quote quantums.
uint64 open_interest_upper_cap = 7;
}

// Event emiited when a referee is registered with an affiliate.
Copy link
Contributor

Choose a reason for hiding this comment

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

emitted

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 88882b4 and 2a14448.

Files ignored due to path filters (4)
  • protocol/indexer/events/events.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/affiliates.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/query.pb.go is excluded by !**/*.pb.go
  • protocol/x/affiliates/types/tx.pb.go is excluded by !**/*.pb.go
Files selected for processing (23)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts (2 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (8 hunks)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts (1 hunks)
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts (1 hunks)
  • indexer/services/ender/tests/handlers/order-fills/liquidation-handler.test.ts (2 hunks)
  • indexer/services/ender/tests/handlers/order-fills/order-handler.test.ts (2 hunks)
  • indexer/services/ender/tests/helpers/constants.ts (4 hunks)
  • indexer/services/ender/src/helpers/translation-helper.ts (3 hunks)
  • indexer/services/ender/src/lib/translated-types.ts (1 hunks)
  • indexer/services/ender/src/lib/types.ts (2 hunks)
  • proto/dydxprotocol/affiliates/affiliates.proto (1 hunks)
  • proto/dydxprotocol/affiliates/query.proto (1 hunks)
  • proto/dydxprotocol/affiliates/tx.proto (1 hunks)
  • proto/dydxprotocol/indexer/events/events.proto (2 hunks)
  • protocol/app/basic_manager/basic_manager.go (2 hunks)
  • protocol/x/affiliates/keeper/grpc_query.go (1 hunks)
  • protocol/x/affiliates/keeper/msg_server.go (1 hunks)
Files skipped from review due to trivial changes (3)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/affiliates.ts
  • indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts
  • indexer/packages/v4-protos/src/codegen/google/bundle.ts
Files skipped from review as they are similar to previous changes (11)
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.rpc.msg.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts
  • indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.tx.ts
  • indexer/services/ender/tests/helpers/constants.ts
  • indexer/services/ender/src/helpers/translation-helper.ts
  • indexer/services/ender/src/lib/translated-types.ts
  • indexer/services/ender/src/lib/types.ts
  • proto/dydxprotocol/affiliates/affiliates.proto
  • proto/dydxprotocol/affiliates/tx.proto
  • proto/dydxprotocol/indexer/events/events.proto
  • protocol/x/affiliates/keeper/grpc_query.go
Additional context used
Biome
indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

Additional comments not posted (49)
protocol/x/affiliates/keeper/msg_server.go (1)

13-20: Verify MsgServer interface implementation.

Ensure that the msgServer struct correctly implements the MsgServer interface.

Run the following script to verify the interface implementation:

Verification successful

msgServer correctly implements the MsgServer interface.

The msgServer struct in the affiliates module implements all required methods of the MsgServer interface, confirming correct implementation.

  • RegisterAffiliate
  • UpdateAffiliateTiers
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that `msgServer` implements the `MsgServer` interface.

# Test: Search for the `MsgServer` interface definition. Expect: `msgServer` implements all methods.
ast-grep --lang go --pattern 'interface MsgServer { $$$ }'

Length of output: 405


Script:

#!/bin/bash
# Search for the definition of the MsgServer interface and list its methods.
ast-grep --lang go --pattern 'interface MsgServer { $$$ }'

# Search for the implementation of the msgServer struct to verify its methods.
ast-grep --lang go --pattern 'type msgServer struct { $$$ }'

Length of output: 3507


Script:

#!/bin/bash
# Search for the MsgServer interface definition with a refined pattern to capture its methods.
rg 'type MsgServer interface' -A 10

# Search for the methods implemented by the msgServer struct in the affiliates module.
rg 'func (k msgServer) ' protocol/x/affiliates/keeper/msg_server.go

Length of output: 17039

proto/dydxprotocol/affiliates/query.proto (3)

34-44: Verify custom type SerializableInt usage.

Ensure that the custom type SerializableInt is correctly used and defined in the codebase.

Run the following script to verify the custom type usage:

Verification successful

Custom type SerializableInt is correctly used and defined.

The custom type SerializableInt is well-integrated into the codebase, with its definition and multiple usages confirmed across various files. The struct is defined in protocol/dtypes/serializable_int.go and is utilized in several protobuf and Go source files, indicating correct implementation.

  • Definition: protocol/dtypes/serializable_int.go
  • Usages: Various files including protobuf and Go source files
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of custom type `SerializableInt`.

# Test: Search for the definition and usage of `SerializableInt`. Expect: Correct definition and usage.
rg --type go 'SerializableInt'

Length of output: 19429


23-24: Ensure correct address type usage.

The AffiliateInfoRequest uses a custom scalar for the address. Verify that this matches the expected address format.

Run the following script to verify the address type usage:

Verification successful

Correct Address Type Usage Verified

The AffiliateInfoRequest and other relevant messages correctly use the cosmos.AddressString scalar for address fields, matching the expected format. No issues found.

  • AffiliateInfoRequest uses cosmos.AddressString for the address field.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of custom scalar for address.

# Test: Search for the address type usage. Expect: Correct usage of "cosmos.AddressString".
rg --type proto --context 3 'cosmos.AddressString'

Length of output: 80


Script:

#!/bin/bash
# Description: Verify the usage of custom scalar for address in .proto files.

# Find all .proto files and search for the usage of "cosmos.AddressString".
fd --extension proto --exec rg --context 3 'cosmos.AddressString' {}

Length of output: 14284


4-5: Verify import usage for custom options.

Ensure that the imported cosmos.proto and gogo.proto files are correctly used for defining custom options.

Run the following script to verify the import usage:

Verification successful

Custom Options Usage Verified

The imported cosmos.proto and gogo.proto files are correctly used for defining custom options in proto/dydxprotocol/affiliates/query.proto. The usage of cosmos_proto.scalar and gogoproto.customtype is evident in the message definitions.

  • cosmos_proto.scalar is used with string address fields.
  • gogoproto.customtype is used with bytes referred_volume and bytes staked_amount fields.

These usages confirm that the custom options are correctly implemented.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of imported proto files for custom options.

# Test: Search for the usage of custom options. Expect: Correct usage of cosmos and gogo options.
rg --type proto --context 3 'cosmos_proto.scalar|gogoproto.customtype'

Length of output: 102


Script:

#!/bin/bash
# Description: Verify the usage of imported proto files for custom options.

# Test: Search for the usage of custom options. Expect: Correct usage of cosmos and gogo options.
rg --context 3 'cosmos_proto.scalar|gogoproto.customtype' -- '*.proto'

Length of output: 120


Script:

#!/bin/bash
# Description: Locate .proto files in the repository.

# Find all .proto files in the repository
fd --extension proto

Length of output: 4972


Script:

#!/bin/bash
# Description: Verify the usage of imported proto files for custom options.

# Test: Search for the usage of custom options. Expect: Correct usage of cosmos and gogo options.
rg --context 3 'cosmos_proto.scalar|gogoproto.customtype' proto/dydxprotocol/affiliates/query.proto

Length of output: 1439

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.rpc.Query.ts (1)

27-42: Verify error handling in RPC requests.

Ensure that potential errors in the RPC requests are handled appropriately.

Run the following script to verify error handling:

protocol/app/basic_manager/basic_manager.go (2)

27-27: New import statement for affiliatesmodule.

The import statement for affiliatesmodule has been added, which is consistent with the integration of affiliate-related functionalities.


105-105: Added affiliatesmodule.AppModuleBasic to ModuleBasics.

The affiliatesmodule.AppModuleBasic is now part of ModuleBasics, allowing the application to handle affiliate-related operations.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/tx.ts (12)

6-12: New interface MsgRegisterAffiliate.

The MsgRegisterAffiliate interface defines the structure for registering a referee-affiliate relationship.


15-21: New interface MsgRegisterAffiliateSDKType.

The MsgRegisterAffiliateSDKType interface is introduced for SDK compatibility, using snake_case for property names.


30-36: New interface MsgUpdateAffiliateTiers.

The MsgUpdateAffiliateTiers interface defines the structure for updating affiliate tiers, including an optional tiers property.


39-45: New interface MsgUpdateAffiliateTiersSDKType.

The MsgUpdateAffiliateTiersSDKType interface is introduced for SDK compatibility, using snake_case for property names.


53-58: Helper function createBaseMsgRegisterAffiliate.

The function initializes a MsgRegisterAffiliate instance with default values.


60-106: Encoding, decoding, and partial methods for MsgRegisterAffiliate.

These methods handle the serialization and deserialization of MsgRegisterAffiliate messages, ensuring proper communication.


108-110: Helper function createBaseMsgRegisterAffiliateResponse.

The function initializes a MsgRegisterAffiliateResponse instance, which is currently empty.


112-140: Encoding, decoding, and partial methods for MsgRegisterAffiliateResponse.

These methods handle the serialization and deserialization of MsgRegisterAffiliateResponse messages, even though the response is empty.


142-147: Helper function createBaseMsgUpdateAffiliateTiers.

The function initializes a MsgUpdateAffiliateTiers instance with default values.


149-195: Encoding, decoding, and partial methods for MsgUpdateAffiliateTiers.

These methods handle the serialization and deserialization of MsgUpdateAffiliateTiers messages, ensuring proper communication.


197-199: Helper function createBaseMsgUpdateAffiliateTiersResponse.

The function initializes a MsgUpdateAffiliateTiersResponse instance, which is currently empty.


201-229: Encoding, decoding, and partial methods for MsgUpdateAffiliateTiersResponse.

These methods handle the serialization and deserialization of MsgUpdateAffiliateTiersResponse messages, even though the response is empty.

indexer/packages/v4-protos/src/codegen/dydxprotocol/affiliates/query.ts (24)

9-11: New interface AffiliateInfoRequest.

The AffiliateInfoRequest interface defines the structure for requesting affiliate information.


17-19: New interface AffiliateInfoRequestSDKType.

The AffiliateInfoRequestSDKType interface is introduced for SDK compatibility, using snake_case for property names.


25-37: New interface AffiliateInfoResponse.

The AffiliateInfoResponse interface defines the structure for responding with affiliate information, including properties like tier, feeSharePpm, referredVolume, and stakedAmount.


43-55: New interface AffiliateInfoResponseSDKType.

The AffiliateInfoResponseSDKType interface is introduced for SDK compatibility, using snake_case for property names.


58-61: New interface ReferredByRequest.

The ReferredByRequest interface defines the structure for querying which affiliate referred a specific address.


64-67: New interface ReferredByRequestSDKType.

The ReferredByRequestSDKType interface is introduced for SDK compatibility, using snake_case for property names.


70-73: New interface ReferredByResponse.

The ReferredByResponse interface defines the structure for responding with the affiliate's address that referred the queried address.


76-79: New interface ReferredByResponseSDKType.

The ReferredByResponseSDKType interface is introduced for SDK compatibility, using snake_case for property names.


85-85: Use a type alias instead of an empty interface.

The AllAffiliateTiersRequest interface is empty and could be replaced with a type alias for clarity and simplicity.

Tools
Biome

[error] 85-85: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


91-91: Use a type alias instead of an empty interface.

The AllAffiliateTiersRequestSDKType interface is empty and could be replaced with a type alias for clarity and simplicity.

Tools
Biome

[error] 91-91: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)


97-100: New interface AllAffiliateTiersResponse.

The AllAffiliateTiersResponse interface defines the structure for responding with all affiliate tiers information.


106-109: New interface AllAffiliateTiersResponseSDKType.

The AllAffiliateTiersResponseSDKType interface is introduced for SDK compatibility, using snake_case for property names.


111-115: Helper function createBaseAffiliateInfoRequest.

The function initializes an AffiliateInfoRequest instance with default values.


117-154: Encoding, decoding, and partial methods for AffiliateInfoRequest.

These methods handle the serialization and deserialization of AffiliateInfoRequest messages, ensuring proper communication.


156-163: Helper function createBaseAffiliateInfoResponse.

The function initializes an AffiliateInfoResponse instance with default values.


165-228: Encoding, decoding, and partial methods for AffiliateInfoResponse.

These methods handle the serialization and deserialization of AffiliateInfoResponse messages, ensuring proper communication.


231-235: Helper function createBaseReferredByRequest.

The function initializes a ReferredByRequest instance with default values.


237-273: Encoding, decoding, and partial methods for ReferredByRequest.

These methods handle the serialization and deserialization of ReferredByRequest messages, ensuring proper communication.


276-280: Helper function createBaseReferredByResponse.

The function initializes a ReferredByResponse instance with default values.


282-318: Encoding, decoding, and partial methods for ReferredByResponse.

These methods handle the serialization and deserialization of ReferredByResponse messages, ensuring proper communication.


321-323: Helper function createBaseAllAffiliateTiersRequest.

The function initializes an AllAffiliateTiersRequest instance, which is currently empty.


325-353: Encoding, decoding, and partial methods for AllAffiliateTiersRequest.

These methods handle the serialization and deserialization of AllAffiliateTiersRequest messages, even though the request is empty.


355-359: Helper function createBaseAllAffiliateTiersResponse.

The function initializes an AllAffiliateTiersResponse instance with default values.


361-397: Encoding, decoding, and partial methods for AllAffiliateTiersResponse.

These methods handle the serialization and deserialization of AllAffiliateTiersResponse messages, ensuring proper communication.

indexer/services/ender/__tests__/handlers/order-fills/liquidation-handler.test.ts (1)

Line range hint 1182-1192: Ensure the new parameter is tested.

The addition of the affiliateRevShare parameter enhances the function's capability to handle affiliate revenue sharing. Ensure that this new functionality is covered by tests to verify its correctness.

Consider adding or updating tests to cover the new parameter affiliateRevShare.

indexer/services/ender/__tests__/handlers/order-fills/order-handler.test.ts (1)

Line range hint 1825-1835: Ensure the new parameter is tested.

The addition of the affiliateRevShare parameter enhances the function's capability to handle affiliate revenue sharing. Ensure that this new functionality is covered by tests to verify its correctness.

Consider adding or updating tests to cover the new parameter affiliateRevShare.

indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts (4)

418-420: Verify integration of affiliateRevShare.

Ensure that the affiliateRevShare property is correctly integrated with the encoding and decoding logic for OrderFillEventV1.

Run the following script to verify the integration:

Verification successful

Integration of affiliateRevShare is correct.

The affiliateRevShare property is properly integrated into the encoding and decoding logic within the events.ts file, ensuring it is handled correctly in the OrderFillEventV1 interface. The logic for writing and reading the field is present and consistent.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of `affiliateRevShare` in encoding and decoding logic.

# Test: Search for encoding and decoding logic for `affiliateRevShare`. Expect: Correct integration.
rg --type ts 'affiliateRevShare'

Length of output: 2370


1488-1499: Verify encoding and decoding logic for RegisterAffiliateEventV1.

Ensure that the encoding and decoding logic for RegisterAffiliateEventV1 is correctly implemented.

Run the following script to verify the encoding and decoding logic:

Verification successful

Encoding and decoding logic for RegisterAffiliateEventV1 is correctly implemented.

The RegisterAffiliateEventV1 interface has associated encode and decode methods, confirming that the logic for serialization and deserialization is in place. No issues were found.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the encoding and decoding logic for `RegisterAffiliateEventV1`.

# Test: Search for encoding and decoding logic for `RegisterAffiliateEventV1`. Expect: Correct implementation.
rg --type ts 'RegisterAffiliateEventV1'

Length of output: 1334


450-452: Verify integration of affiliate_rev_share.

Ensure that the affiliate_rev_share property is correctly integrated with the encoding and decoding logic for OrderFillEventV1SDKType.

Run the following script to verify the integration:


1502-1511: Verify encoding and decoding logic for RegisterAffiliateEventV1SDKType.

Ensure that the encoding and decoding logic for RegisterAffiliateEventV1SDKType is correctly implemented.

Run the following script to verify the encoding and decoding logic:

Comment on lines 14 to 17
func (k msgServer) RegisterAffiliate(ctx context.Context, msg *types.MsgRegisterAffiliate) (*types.MsgRegisterAffiliateResponse, error) {
return nil, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Implement the RegisterAffiliate method.

The RegisterAffiliate method is currently a stub. Consider implementing the logic for registering an affiliate.

Would you like assistance in implementing this method or opening a GitHub issue to track this task?

Comment on lines 18 to 22
func (k msgServer) UpdateAffiliateTiers(ctx context.Context, msg *types.MsgUpdateAffiliateTiers) (*types.MsgUpdateAffiliateTiersResponse, error) {
return nil, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Implement the UpdateAffiliateTiers method.

The UpdateAffiliateTiers method is currently a stub. Consider implementing the logic for updating affiliate tiers.

Would you like assistance in implementing this method or opening a GitHub issue to track this task?

/** Response to MsgRegisterAffiliate */

export interface MsgRegisterAffiliateResponse {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

The MsgRegisterAffiliateResponse interface is empty and could be replaced with a type alias for clarity and simplicity.

Use a type alias as follows:

- export interface MsgRegisterAffiliateResponse {}
+ export type MsgRegisterAffiliateResponse = {};
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.

Suggested change
export interface MsgRegisterAffiliateResponse {}
export type MsgRegisterAffiliateResponse = {};
Tools
Biome

[error] 24-24: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

export interface MsgUpdateAffiliateTiersResponse {}
/** Response to MsgUpdateAffiliateTiers */

export interface MsgUpdateAffiliateTiersResponseSDKType {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

The MsgUpdateAffiliateTiersResponseSDKType interface is empty and could be replaced with a type alias for clarity and simplicity.

Use a type alias as follows:

- export interface MsgUpdateAffiliateTiersResponseSDKType {}
+ export type MsgUpdateAffiliateTiersResponseSDKType = {};
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.

Suggested change
export interface MsgUpdateAffiliateTiersResponseSDKType {}
export type MsgUpdateAffiliateTiersResponseSDKType = {};
Tools
Biome

[error] 51-51: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

export interface MsgRegisterAffiliateResponse {}
/** Response to MsgRegisterAffiliate */

export interface MsgRegisterAffiliateResponseSDKType {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

The MsgRegisterAffiliateResponseSDKType interface is empty and could be replaced with a type alias for clarity and simplicity.

Use a type alias as follows:

- export interface MsgRegisterAffiliateResponseSDKType {}
+ export type MsgRegisterAffiliateResponseSDKType = {};
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.

Suggested change
export interface MsgRegisterAffiliateResponseSDKType {}
export type MsgRegisterAffiliateResponseSDKType = {};
Tools
Biome

[error] 27-27: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

}
/** Response to MsgUpdateAffiliateTiers */

export interface MsgUpdateAffiliateTiersResponse {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use a type alias instead of an empty interface.

The MsgUpdateAffiliateTiersResponse interface is empty and could be replaced with a type alias for clarity and simplicity.

Use a type alias as follows:

- export interface MsgUpdateAffiliateTiersResponse {}
+ export type MsgUpdateAffiliateTiersResponse = {};
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.

Suggested change
export interface MsgUpdateAffiliateTiersResponse {}
export type MsgUpdateAffiliateTiersResponse = {};
Tools
Biome

[error] 48-48: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2a14448 and f6be492.

Files selected for processing (7)
  • protocol/app/msgs/all_msgs.go (1 hunks)
  • protocol/app/msgs/internal_msgs.go (2 hunks)
  • protocol/app/msgs/internal_msgs_test.go (1 hunks)
  • protocol/app/msgs/normal_msgs.go (2 hunks)
  • protocol/app/msgs/normal_msgs_test.go (1 hunks)
  • protocol/lib/ante/internal_msg.go (2 hunks)
  • protocol/x/affiliates/keeper/msg_server.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • protocol/x/affiliates/keeper/msg_server.go
Additional comments not posted (8)
protocol/lib/ante/internal_msg.go (1)

18-18: Integration of affiliates module in IsInternalMsg function approved.

The addition of the affiliates module and the inclusion of *affiliates.MsgUpdateAffiliateTiers in the IsInternalMsg function correctly extends the internal message handling capabilities.

Also applies to: 143-144

protocol/app/msgs/internal_msgs_test.go (1)

66-68: Test cases for affiliate messages in TestInternalMsgSamples_Gov_Key approved.

The addition of test cases for MsgUpdateAffiliateTiers and MsgUpdateAffiliateTiersResponse ensures that these messages are correctly recognized and handled as internal messages.

protocol/app/msgs/normal_msgs_test.go (1)

121-123: Test cases for affiliate registration messages in TestNormalMsgs_Key approved.

The addition of test cases for MsgRegisterAffiliate and MsgRegisterAffiliateResponse ensures that these messages are correctly recognized and handled as normal messages.

protocol/app/msgs/internal_msgs.go (2)

19-19: Import statement for affiliates package added.

The import statement for the affiliates package is correctly added, allowing the use of affiliate-related types.


111-112: New message types for affiliates added to InternalMsgSamplesDydxCustom.

The entries for MsgUpdateAffiliateTiers and MsgUpdateAffiliateTiersResponse are correctly added to handle affiliate tier updates.

protocol/app/msgs/normal_msgs.go (2)

20-20: Import statement for affiliates package added.

The import statement for the affiliates package is correctly added, allowing the use of affiliate-related types.


222-223: New message types for affiliates added to NormalMsgsDydxCustom.

The entries for MsgRegisterAffiliate and MsgRegisterAffiliateResponse are correctly added to handle affiliate registration.

protocol/app/msgs/all_msgs.go (1)

152-155: New message types for affiliates added to AllTypeMessages.

The entries for MsgRegisterAffiliate, MsgRegisterAffiliateResponse, MsgUpdateAffiliateTiers, and MsgUpdateAffiliateTiersResponse are correctly added to handle affiliate operations.

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f6be492 and 54fb883.

Files selected for processing (1)
  • protocol/x/affiliates/keeper/grpc_query.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • protocol/x/affiliates/keeper/grpc_query.go

string affiliate = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
// Block number at which the affiliate was registered.
uint64 registered_at_block = 3;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

New line EOF

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 UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54fb883 and f844992.

Files selected for processing (1)
  • proto/dydxprotocol/indexer/events/events.proto (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • proto/dydxprotocol/indexer/events/events.proto

@affanv14 affanv14 merged commit 6bd7465 into main Aug 22, 2024
38 checks passed
@affanv14 affanv14 deleted the affan/affiliates-protos branch August 22, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants