Skip to content

docs: add Mars Lending library documentation #373

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 3 commits into from
Jun 7, 2025

Conversation

hxrts
Copy link
Contributor

@hxrts hxrts commented Jun 3, 2025

add docs for the mars library added by the hydro team

Summary by CodeRabbit

  • Documentation
    • Added comprehensive documentation for the Valence Mars Lending library, including usage instructions, flow diagrams, function descriptions, configuration details, and integration features with the Mars Protocol.
    • Updated the documentation summary to include the new Mars Lending library under CosmWasm libraries.

Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

"""

Walkthrough

A new documentation file for the Mars Lending library has been added. This file provides an overview of the library's functionality, configuration, implementation details, error handling, and protocol integration, including a flow diagram and acknowledgments. A new public struct, LibraryConfig, is described within the documentation.

Changes

File(s) Change Summary
docs/src/libraries/cosmwasm/mars_lending.md Added comprehensive documentation for the Mars Lending library, including usage, flow, and config.
docs/src/SUMMARY.md Added "Mars Lending" entry under CosmWasm libraries section in the documentation summary.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Library
    participant MarsCreditManager
    participant MarsCreditAccount

    User->>Library: Lend(asset)
    Library->>MarsCreditManager: Create credit account (if needed)
    Library->>MarsCreditAccount: Deposit and lend asset
    MarsCreditAccount-->>Library: Confirmation
    Library-->>User: Lend complete

    User->>Library: Withdraw(amount)
    Library->>MarsCreditAccount: Reclaim and withdraw asset
    MarsCreditAccount-->>Library: Confirmation
    Library-->>User: Withdraw complete
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers

  • keyleu

Poem

In the warren of docs, a new page appears,
Lending and borrowing—no need for fears!
Mars Protocol mapped, with configs so neat,
Diagrams and details, documentation complete.
🐇 Now rabbits can lend with a hop and a cheer,
For clear guides are here, year after year!
"""


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b34bf43 and b459be1.

📒 Files selected for processing (1)
  • docs/src/SUMMARY.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/src/SUMMARY.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build

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.

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

🧹 Nitpick comments (7)
docs/src/libraries/cosmwasm/mars_lending.md (7)

1-3: Use Title Case for the document header.
The main heading should consistently follow title-case conventions.

Apply this diff:

-# Valence Mars Lending library
+# Valence Mars Lending Library

7-34: Refine Mermaid diagram labels and formatting.
The “Input” and “Output” nodes are split across lines, which may render awkwardly. Also, the “if needed” parenthetical can be on the same line as its arrow for clarity.

-  IA((Input
-      Account))
-  OA((Output
-      Account))
+  IA((Input Account))
+  OA((Output Account))
@@
-  S -- 3/Execute Create Credit Account
-  (if needed) --> IA
+  S -- 3/Execute Create Credit Account (if needed) --> IA

38-42: Consistently format function names in the table.
Wrap function names in backticks for monospace styling and ensure the table separators remain aligned.

-| **Lend**    | -                            | Creates a Mars credit account (if one doesn't exist) and lends the entire balance of the specified denom from the input account to the Mars Protocol through the credit account. |
+| `Lend`      | -                            | Creates a Mars credit account (if one doesn't exist) and lends the entire balance of the specified denom from the input account to the Mars Protocol through the credit account. |
@@
-| **Withdraw** | `amount: Option<Uint128>`   | Withdraws lent assets from the Mars credit account to the output account. If no amount is specified, withdraws the entire position. |
+| `Withdraw`  | `amount: Option<Uint128>`    | Withdraws lent assets from the Mars credit account to the output account. If no amount is specified, withdraws the entire position. |

48-57: Add doc comments for LibraryConfig fields.
Including inline Rust doc comments enhances readability and helps generate API docs.

pub struct LibraryConfig {
    /// Address that will own the credit account
    pub input_addr: LibraryAccountType,
    /// Address that will receive withdrawn funds
    pub output_addr: LibraryAccountType,
    /// Mars credit manager contract address
    pub credit_manager_addr: String,
    /// Denom of the asset to lend
    pub denom: String,
}

64-69: Grammar: add missing article.
Insert “the” before “Mars credit account lifecycle” for clarity.

-- The library automatically handles Mars credit account lifecycle:
+- The library automatically handles the Mars credit account lifecycle:
🧰 Tools
🪛 LanguageTool

[uncategorized] ~64-~64: You might be missing the article “the” here.
Context: ...ment The library automatically handles Mars credit account lifecycle: - **Account ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


85-90: Standardize bullet punctuation in Error Handling.
Either omit periods at the end of each bullet or add them consistently.

- - **No Funds**: Returns error if attempting to lend with zero balance
- - **No Credit Account**: Returns error if attempting to withdraw without an existing credit account
+ - **No Funds**: Returns error if attempting to lend with zero balance.
+ - **No Credit Account**: Returns error if attempting to withdraw without an existing credit account.

100-102: Use a more formal header for acknowledgments.
“Acknowledgments” is preferred over “Thanks” in technical documentation.

-## Thanks
+## Acknowledgments
🧰 Tools
🪛 LanguageTool

[typographical] ~100-~100: This sign-off should end with a comma when followed by your name.
Context: ...i strategies beyond simple lending ## Thanks Thank you to Stana and the [Hydro](htt...

(EN_SIGN_OFF_WITHOUT_COMMA)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 91bb2e2 and ccf9084.

📒 Files selected for processing (1)
  • docs/src/libraries/cosmwasm/mars_lending.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/src/libraries/cosmwasm/mars_lending.md

[uncategorized] ~64-~64: You might be missing the article “the” here.
Context: ...ment The library automatically handles Mars credit account lifecycle: - **Account ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[grammar] ~80-~80: Using ‘plenty’ without ‘of’ is considered to be informal.
Context: ...edit account for the input address 2. Amount Calculation: Uses exact amount if specified, othe...

(PLENTY_OF_NOUNS)


[typographical] ~100-~100: This sign-off should end with a comma when followed by your name.
Context: ...i strategies beyond simple lending ## Thanks Thank you to Stana and the [Hydro](htt...

(EN_SIGN_OFF_WITHOUT_COMMA)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: build-and-deploy

@hxrts hxrts enabled auto-merge (squash) June 4, 2025 09:32
@hxrts hxrts merged commit b96ab6e into main Jun 7, 2025
19 checks passed
@hxrts hxrts deleted the docs/add-mars-lending-library branch June 7, 2025 00:12
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.

3 participants