Skip to content

feat(dpp)!: add marketplace rules accessor to token configuration #2651

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

Merged
merged 1 commit into from
Jun 1, 2025

Conversation

QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Jun 1, 2025

Issue being fixed or feature implemented

Add support for accessing marketplace rules in the token configuration.

What was done?

Introduced a new accessor for marketplace rules within the TokenConfigurationV0Getters implementation. This includes the addition of trade_mode_change_rules to the existing set of rules.

How Has This Been Tested?

Not tested, but obvious.

Breaking Changes

Yes

Checklist

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas

  • I have added or updated relevant unit/integration/functional/e2e tests

    For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features
    • Added visibility of trade mode change rules for marketplace settings within token configuration details.

Copy link
Contributor

coderabbitai bot commented Jun 1, 2025

Walkthrough

The change enhances the TokenConfigurationV0Getters implementation by updating the all_change_control_rules method to include marketplace trade mode change rules. This is achieved by importing an additional trait and appending a new entry referencing trade_mode_change_rules from marketplace_rules.

Changes

File(s) Change Summary
packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs Added support for accessing marketplace trade mode change rules in all_change_control_rules method.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant TokenConfigurationV0Getters
    participant MarketplaceRules

    Caller->>TokenConfigurationV0Getters: call all_change_control_rules()
    TokenConfigurationV0Getters->>MarketplaceRules: access trade_mode_change_rules
    TokenConfigurationV0Getters-->>Caller: return vector including trade_mode_change_rules
Loading

Possibly related PRs

Suggested reviewers

  • lklimek

Poem

A hop and a skip through the code so neat,
Marketplace rules now join the fleet.
Trade mode changes, easy to find,
With accessors updated, all well-aligned.
In the carrot fields of code, we cheer—
New rules for tokens, loud and clear! 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@QuantumExplorer QuantumExplorer changed the title feat:! add marketplace rules accessor to token configuration feat(dpp):! add marketplace rules accessor to token configuration Jun 1, 2025
@QuantumExplorer QuantumExplorer added this to the v2.0.0 milestone Jun 1, 2025
@QuantumExplorer
Copy link
Member Author

Self reviewed

@QuantumExplorer QuantumExplorer merged commit db0027b into v2.0-dev Jun 1, 2025
37 of 45 checks passed
@QuantumExplorer QuantumExplorer deleted the featadd-marketplace-rules-accessor branch June 1, 2025 21:43
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

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94c8f97 and 809eb5d.

📒 Files selected for processing (1)
  • packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: QuantumExplorer
PR: dashpay/platform#2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PR title
  • GitHub Check: Rust packages (dpp) / Detect immutable structure changes
  • GitHub Check: Rust packages (dpp) / Linting
  • GitHub Check: Rust packages (dash-sdk) / Tests
  • GitHub Check: Rust packages (dash-sdk) / Unused dependencies
  • GitHub Check: Rust packages (dash-sdk) / Linting
  • GitHub Check: Rust packages (drive-abci) / Unused dependencies
  • GitHub Check: Rust packages (drive-abci) / Check each feature
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / Linting
  • GitHub Check: Rust packages (drive) / Tests
  • GitHub Check: Rust packages (drive) / Linting
  • GitHub Check: Rust packages (drive) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp) / Unused dependencies
  • GitHub Check: Rust packages (wasm-dpp) / Linting
  • GitHub Check: Rust packages (wasm-dpp) / Tests
  • GitHub Check: Build Docker images (Drive, drive, drive-abci) / Build Drive image
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build Docker images (DAPI, dapi, dapi) / Build DAPI image
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (1)
packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs (1)

11-11: LGTM! Import addition is correct.

The import of TokenMarketplaceRulesV0Getters trait is necessary to access the trade_mode_change_rules() method used in the all_change_control_rules method below.

Comment on lines +190 to +193
(
"trade_mode_change_rules",
&self.marketplace_rules.trade_mode_change_rules(),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

LGTM! Verify marketplace_rules field exists and consider updating all_used_group_positions.

The addition follows the existing pattern correctly. However, please verify two things:

  1. Ensure the marketplace_rules field exists on the TokenConfigurationV0 struct
  2. If the trade mode change rules can contain group positions, consider updating the all_used_group_positions method (lines 118-165) to also process marketplace rules

🏁 Script executed:

#!/bin/bash
# Description: Verify that marketplace_rules field exists on TokenConfigurationV0 struct and check if all_used_group_positions needs updating

# Check if marketplace_rules field exists in TokenConfigurationV0 struct
ast-grep --pattern $'struct TokenConfigurationV0 {
  $$$
  marketplace_rules: $_,
  $$$
}'

# Check if marketplace_rules is referenced elsewhere in all_used_group_positions logic
rg -A 5 -B 5 "marketplace_rules" --type rust

Length of output: 45548


🏁 Script executed:

#!/bin/bash
# Extract the all_used_group_positions method to verify inclusion of marketplace_rules
rg -n -A60 -B5 "fn all_used_group_positions" packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs

Length of output: 3541


Include marketplace_rules in all_used_group_positions

The new tuple in all_change_control_rules is correct and the marketplace_rules field exists on TokenConfigurationV0. However, all_used_group_positions (lines 118–165 in packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs) doesn’t process marketplace_rules.trade_mode_change_rules(). To capture any group positions from those change rules, add:

// After existing add_from_change_control_rules calls
add_from_change_control_rules(&self.marketplace_rules.trade_mode_change_rules());
🤖 Prompt for AI Agents
In
packages/rs-dpp/src/data_contract/associated_token/token_configuration/v0/accessors.rs
between lines 118 and 165, the all_used_group_positions method does not
currently process the marketplace_rules.trade_mode_change_rules(). To fix this,
add a call to add_from_change_control_rules passing
self.marketplace_rules.trade_mode_change_rules() after the existing calls to
add_from_change_control_rules within that method. This ensures group positions
from marketplace_rules are included in the aggregation.

@QuantumExplorer QuantumExplorer changed the title feat(dpp):! add marketplace rules accessor to token configuration feat(dpp)!: add marketplace rules accessor to token configuration Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant