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

Solana deposit and call #520

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Solana deposit and call #520

wants to merge 1 commit into from

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Dec 10, 2024

Separated deposit and deposit and call functions.

Depends on zeta-chain/toolkit#203

Summary by CodeRabbit

  • New Features

    • Updated documentation for the Solana Gateway's deposit and deposit_and_call functionalities.
    • Introduced a new deposit_and_call function that allows for simultaneous deposits and contract calls.
  • Documentation

    • Simplified the deposit function signature and clarified the receiver parameter requirements.
    • Provided examples for using the updated deposit and deposit_and_call functions.

Copy link

vercel bot commented Dec 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview Dec 10, 2024 4:40pm

Copy link
Contributor

coderabbitai bot commented Dec 10, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request focus on updating the documentation for the Solana Gateway, specifically for the deposit and deposit_and_call functions. The deposit function's signature has been modified to replace the memo parameter with a receiver parameter, which is now a fixed-length array representing the receiver's address. Additionally, a new deposit_and_call function has been introduced, allowing deposits while invoking a universal application. The documentation has been streamlined to enhance clarity, with examples provided for both functionalities.

Changes

File Path Change Summary
src/pages/developers/chains/solana.mdx - Updated deposit function signature: replaced memo with receiver (array of bytes).
- Introduced deposit_and_call function with message parameter.
- Clarified documentation for both functions, including examples and error handling updates.

Possibly related issues

  • Expand the Solana doc #465: The changes address the request to expand the Solana documentation by detailing the deposit and deposit_and_call functions, aligning with the goal to enhance understanding of the Solana Gateway.

Possibly related PRs

  • Update Solana gateway docs #480: This PR discusses the deposit function and its memo parameter, which is directly relevant to the changes made in the current PR regarding the new receiver parameter.

Suggested reviewers

  • bbbeeeee
  • brewmaster012
  • GMaiolo

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 generate docstrings to generate docstrings for this PR. (Experiment)
  • @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.

@fadeev fadeev marked this pull request as ready for review December 10, 2024 16:28
@fadeev fadeev requested a review from a team as a code owner December 10, 2024 16:28
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 (3)
src/pages/developers/chains/solana.mdx (3)

13-17: Consider adding address format details

The documentation should specify that the receiver parameter expects an Ethereum-style address (20 bytes). Consider adding a note about address format compatibility.

 pub fn deposit(ctx: Context<Deposit>, amount: u64, receiver: [u8; 20]) -> Result<()>

 - `amount`: The amount of SOL (in lamports) to deposit.
-  `receiver`: An array of bytes containing the receiver's address
+  `receiver`: A 20-byte array containing the receiver's Ethereum-style address on ZetaChain
🧰 Tools
🪛 LanguageTool

[uncategorized] ~16-~16: Loose punctuation mark.
Context: ... [u8; 20]) -> Result<()> ``` - amount: The amount of SOL (in lamports) to depo...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~17-~17: Loose punctuation mark.
Context: ...L (in lamports) to deposit. - receiver: An array of bytes containing the receiv...

(UNLIKELY_OPENING_PUNCTUATION)


62-65: Enhance migration notice visibility

The note about onCrossChainCall vs onCall contains critical information about upcoming changes. Consider making this more prominent.

-Note: `deposit_and_call` currently calls universal contract's `onCrossChainCall`
-function and not the new `onCall` function that the EVM Gateway calls. This will
-be changed in the upcoming versions of the protocol after the full migration to
-Gateway.
+> ⚠️ **Important Migration Notice**
+> 
+> `deposit_and_call` currently uses the `onCrossChainCall` function instead of the
+> new `onCall` function (used by EVM Gateway). This will be updated in future
+> versions during the Gateway migration.

44-46: Enhance CLI examples with expected output

Consider adding example output or success messages to help users verify their commands executed correctly.

 npx hardhat solana-deposit --amount 0.01 --recipient 0x2DCB13e7Eb5253fD5255Ce3CbCB199B48A0C7dD9
+
+# Expected output:
+# ✓ Successfully deposited 0.01 SOL
+# Transaction: https://solscan.io/tx/...

Also applies to: 69-71

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between da4d38f and c0dd1b6.

📒 Files selected for processing (1)
  • src/pages/developers/chains/solana.mdx (2 hunks)
🧰 Additional context used
🪛 LanguageTool
src/pages/developers/chains/solana.mdx

[uncategorized] ~16-~16: Loose punctuation mark.
Context: ... [u8; 20]) -> Result<()> ``` - amount: The amount of SOL (in lamports) to depo...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~17-~17: Loose punctuation mark.
Context: ...L (in lamports) to deposit. - receiver: An array of bytes containing the receiv...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~57-~57: Loose punctuation mark.
Context: ...: Vec) -> Result<()> ``` - amount: The amount of SOL (in lamports) to depo...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~58-~58: Loose punctuation mark.
Context: ...L (in lamports) to deposit. - receiver: An array of bytes containing a universa...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~60-~60: Loose punctuation mark.
Context: ...ract address on ZetaChain. - message: A message passed to the universal contr...

(UNLIKELY_OPENING_PUNCTUATION)

🔇 Additional comments (2)
src/pages/developers/chains/solana.mdx (2)

Line range hint 1-6: Well-structured introduction

The introduction clearly establishes the distinction between simple deposits and deposits with contract calls, setting appropriate context for the rest of the documentation.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~2-~2: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ... (the native gas token of Solana) to an externally-owned account (EOA) or a universal applicatio...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


[uncategorized] ~16-~16: Loose punctuation mark.
Context: ... [u8; 20]) -> Result<()> ``` - amount: The amount of SOL (in lamports) to depo...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~17-~17: Loose punctuation mark.
Context: ...L (in lamports) to deposit. - receiver: An array of bytes containing the receiv...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~57-~57: Loose punctuation mark.
Context: ...: Vec) -> Result<()> ``` - amount: The amount of SOL (in lamports) to depo...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~58-~58: Loose punctuation mark.
Context: ...L (in lamports) to deposit. - receiver: An array of bytes containing a universa...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~60-~60: Loose punctuation mark.
Context: ...ract address on ZetaChain. - message: A message passed to the universal contr...

(UNLIKELY_OPENING_PUNCTUATION)


129-131: Documentation is complete and accurate

The conclusion effectively summarizes the Gateway's capabilities and aligns with the updated function signatures and examples throughout the document.

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.

2 participants