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

provide better documentation for marker nav cmd. #2159

Merged
merged 5 commits into from
Oct 2, 2024

Conversation

iramiller
Copy link
Member

@iramiller iramiller commented Sep 23, 2024

Description

Adds documentation for the marker NAV command.

closes: #2128


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Added relevant changelog entries under .changelog/unreleased (see Adding Changes).
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

Summary by CodeRabbit

  • New Features

    • Updated CLI command for adding or updating marker net asset values, now requiring an additional argument for valuations.
    • Expanded command descriptions and examples to clarify usage and requirements for net asset valuations.
  • Documentation

    • Introduced new documentation for the marker navigation command to enhance user guidance and clarity.

@iramiller iramiller requested a review from a team as a code owner September 23, 2024 17:36
Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

Walkthrough

The changes in this pull request update the CLI command for adding or updating marker net asset values in the GetCmdAddNetAssetValues function. The command's usage string is modified to include an additional argument for valuations, and the descriptions are enhanced to clarify the input requirements. Detailed examples are provided to guide users on how to set values correctly, including handling multiple valuations and distinguishing between self-attestation and blockchain transactions.

Changes

Files Change Summary
x/marker/client/cli/tx.go Updated command usage string to require an additional argument for valuations; enhanced descriptions and examples for clarity.
.changelog/unreleased/improvements/2128-marker-nav-docs.md Added new documentation file for marker navigation command to improve clarity and guidance.

Assessment against linked issues

Objective Addressed Explanation
Improve the clarity and usefulness of the documentation for the command (Issue #2128)
Add clear description for the --value flag and clarify examples (Issue #2128)
Specify whether values are for a single or multiple tokens and provide guidance (Issue #2128)

Possibly related PRs

Suggested labels

CLI, marker

Poem

In the garden where markers play,
New values sprout, bright as day.
With clearer paths and examples bright,
Adding assets feels just right!
Hop along, let’s set the score,
For every token, there’s so much more! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (4)
x/marker/client/cli/tx.go (4)

1056-1058: Improve clarity of command usage

The updated Use field is more informative, but it could be even clearer.

Consider updating the Use field to:

Use: "add-net-asset-values <denom> <valuation> [<valuation>...]",

This format more clearly indicates that at least one valuation is required, and multiple valuations are optional.


1059-1059: Enhance the short description

The short description has been improved, but it could provide more context.

Consider expanding the short description to:

Short: "Provide net asset values for a marker, allowing for multiple valuations",

This gives users a bit more information about the command's capabilities at a glance.


1060-1086: Approve and suggest improvements for the long description

The addition of a detailed long description is a significant improvement. However, there are a few areas where it could be enhanced for clarity.

Consider the following improvements:

  1. Add a brief explanation of what net asset values are used for at the beginning.
  2. Clarify the relationship between "price" and "volume" in the valuation ratio.
  3. Explain why USD is represented in mils.
  4. Add a note about the importance of using whole integers for all values.

Here's a suggested revision:

Long: `
Provide net asset valuations for a marker. Net asset values are used to establish 
the relative value of the marker in relation to other assets or currencies.

Net asset values are expressed as a ratio between an amount of coin paid (price) 
and a volume of the marker's tokens which are considered equivalent in value.

The denomination of the amount paid (price) must either:
1) Exist on-chain as a separate marker, or
2) Be supplied as a [usd] integer valued in mils (1000 mils = $1 USD).

The volume is supplied as an integer count of the current marker's tokens.

IMPORTANT: All values must be represented as whole integers. If a decimal value 
is required, adjust the ratio between the price and volume to achieve the 
desired precision.
`,

This revision provides more context and clarity on the purpose and usage of the command.


1067-1086: Approve expanded examples with minor formatting suggestion

The expanded examples are excellent and provide clear guidance for various use cases.

To improve readability, consider adding empty lines between each example and its description. For instance:

Example: fmt.Sprintf(`
  Set a value of $1 = 1markercoin (Note USD is denominated in mils)
  $ %[1]s tx %[2]s add-net-asset-values markercoin 1000usd,1

  Provide more than one valuation in a single call
  $ %[1]s tx %[2]s add-net-asset-values markercoin 1000usd,1;5000000000nhash,1

  Valuations for larger trades with volumes greater than 1
  $ %[1]s tx %[2]s add-net-asset-values markercoin 100000usd,199;1000stake,19

  All values must be represented as whole integers. If a decimal value is required
  then the ratio between the price and volume must be adjusted to achieve the decimal
  required.

  Note: When the valuations are recorded, each will indicate the address of the admin
  who provided the value. This will be published in the associated event data and 
  captured in the NAV record. For NAVs set by other modules such as x/exchange the
  protocol will indicate these sources. This separates established values from
  the owner (self-attestation) from those set through blockchain transactions.
`,

This formatting makes it easier to distinguish between different examples and their explanations.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b0bda07 and 5ce4f6d.

Files selected for processing (1)
  • x/marker/client/cli/tx.go (1 hunks)
Additional comments not posted (1)
x/marker/client/cli/tx.go (1)

1056-1087: Approve changes to GetCmdAddNetAssetValues function

The updates to the GetCmdAddNetAssetValues function significantly improve the documentation for the add-net-asset-values command. The changes align well with the PR objectives, providing clearer guidance on command usage, more detailed explanations, and expanded examples.

While I've suggested some minor improvements for even better clarity and readability, the overall changes are a substantial improvement and address the documentation issues mentioned in the linked GitHub issue.

@iramiller
Copy link
Member Author

iramiller commented Sep 23, 2024

%%> ./build/provenanced tx marker add-net-asset-values --help 

Provide net asset valuations for a marker. Net asset values are used to establish 
the relative value of the marker in relation to other assets or currencies.

Net asset values are expressed as a ratio between an amount of coin paid (price) 
and a volume of the marker's tokens which are considered equivalent in value.

The denomination of the amount paid (price) must either:
1) Exist on-chain as a separate marker, or
2) Be supplied as [1000usd], an integer valued in mils (1000 mils = $1 USD).

The volume is supplied as an integer count of the current marker's tokens.

IMPORTANT: All values must be represented as whole integers. If a decimal value 
is required, adjust the ratio between the price and volume to achieve the 
desired precision.

Usage:
  provenanced tx marker add-net-asset-values <denom> <valuation[;valuation...]> [flags]

Aliases:
  add-net-asset-values, add-navs, anavs

Examples:

  Set a value of $1 = 1markercoin (Note USD is denominated in mils)
  $ provenanced tx marker add-net-asset-values markercoin 1000usd,1
  
  Provide more than one valuation in a single call
  $ provenanced tx marker add-net-asset-values markercoin 1000usd,1;5000000000nhash,1

  Valuations for larger trades with volumes greater than 1
  $ provenanced tx marker add-net-asset-values markercoin 100000usd,199;1000stake,19

  All values must be represented as whole integers.  If a decimal value is required
  then the ratio between the price and volume must be adjusted to achieve the decimal
  required.

  Note: When the valuations are recorded, each will indicate the address of the admin
  who provided the value. This will be published in the associated event data and 
  captured in the NAV record.  For NAVs set by other modules such as x/exchange the
  protocol will indicate these sources.  This separates established values from
  the owner (self-attestation) from those set through blockchain transactions.

scirner22
scirner22 previously approved these changes Sep 23, 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.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5ce4f6d and 95ef09f.

Files selected for processing (1)
  • x/marker/client/cli/tx.go (1 hunks)
Additional comments not posted (1)
x/marker/client/cli/tx.go (1)

1058-1095: Documentation enhancements enhance command clarity

The detailed explanations and additional examples in the Long description significantly improve the user's understanding of the add-net-asset-values command. This will help users utilize the command effectively.

x/marker/client/cli/tx.go Outdated Show resolved Hide resolved
x/marker/client/cli/tx.go Outdated Show resolved Hide resolved
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 051af65 and e996479.

Files selected for processing (1)
  • .changelog/unreleased/improvements/2128-marker-nav-docs.md (1 hunks)
Additional comments not posted (1)
.changelog/unreleased/improvements/2128-marker-nav-docs.md (1)

1-1: Changelog entry location and format are appropriate.

The location of the changelog entry in the .changelog/unreleased/improvements/ directory and the file naming convention including the issue number are correct. The Markdown format is also appropriate for changelog entries.

The structure and placement of this changelog entry align with best practices for maintaining a clear and organized changelog.

@iramiller iramiller enabled auto-merge (squash) October 2, 2024 21:29
@iramiller iramiller merged commit 13b0a5e into main Oct 2, 2024
34 checks passed
@iramiller iramiller deleted the 2128-marker-nav-documentation branch October 2, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve marker net asset value command documentation
4 participants