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

Configured minimum amount for cross chain #287

Merged
merged 3 commits into from
Jun 10, 2024

Conversation

ap211unitech
Copy link
Contributor

@ap211unitech ap211unitech commented Jun 7, 2024

Description

In cross chain transfers, there is always a minimum amount to be transferred so that transfer never fail. We are defining it for some chains which are not being calculated correctly by @moonbeam/sdk package. Except this, minimum amount for other cross chain combinations are being calculated correctly.

Summary by CodeRabbit

  • New Features

    • Introduced minimum amounts for cross-chain transfers for different assets on Polkadex for Interlay and Astar configurations.
  • Improvements

    • Adjusted destination fee amounts for various assets in Astar and Interlay configurations for more accurate fee calculations.
  • Enhancements

    • Updated Astar and Interlay classes to use the new MIN_BRIDGE_AMOUNT for calculating minimum asset amounts before formatting units.

Copy link

changeset-bot bot commented Jun 7, 2024

🦋 Changeset detected

Latest commit: 6f3c20a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@polkadex/thea Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ap211unitech ap211unitech self-assigned this Jun 7, 2024
Copy link

coderabbitai bot commented Jun 7, 2024

Walkthrough

The updates introduce modifications to the amount values in the destinationFee object for various assets across multiple configuration files. Additionally, a new constants file defining minimum amounts for cross-chain transfers has been added, and relevant classes have been updated to use these constants in their calculations.

Changes

File Path Change Summary
.../config/substrate/config/astar.ts Adjusted amount values in destinationFee for assets dot, unq, pha, and ibtc.
.../config/substrate/config/interlay.ts Updated amount values in destinationFee for assets dot and vdot.
.../config/substrate/constants/index.ts Added a new constants file defining minimum amounts for cross-chain transfers.
.../config/substrate/index.ts Added export statement for the constants module in the substrate configuration package.
.../sdk/substrate/astar.ts Updated the Astar class to use MIN_BRIDGE_AMOUNT for minimum asset amount calculations.
.../sdk/substrate/interlay.ts Modified the Interlay class to utilize MIN_BRIDGE_AMOUNT in minimum asset amount calculations.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant Astar
    participant Interlay
    participant Config
    participant Constants

    User->>Astar: Initiate transfer
    Astar->>Constants: Fetch MIN_BRIDGE_AMOUNT
    Constants-->>Astar: Return min amounts
    Astar->>Astar: Calculate min amount
    Astar-->>User: Return result

    User->>Interlay: Initiate transfer
    Interlay->>Constants: Fetch MIN_BRIDGE_AMOUNT
    Constants-->>Interlay: Return min amounts
    Interlay->>Interlay: Calculate min amount
    Interlay-->>User: Return result
Loading

Possibly related issues

Poem

Amidst the lines of code so bright,
We tweaked the fees, set them right.
Constants now hold the bridge's key,
For Astar, Interlay, and more to see.
Transfers smoother, swift, and clear,
With every change, we persevere. 🌟🐇


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 Configration 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.

@ap211unitech ap211unitech linked an issue Jun 7, 2024 that may be closed by this pull request
Copy link

@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

Commits

Files that changed from the base of the PR and between 47f1662 and 6f3c20a.

Files selected for processing (7)
  • .changeset/yellow-swans-hang.md (1 hunks)
  • packages/thea/src/config/substrate/config/astar.ts (4 hunks)
  • packages/thea/src/config/substrate/config/interlay.ts (2 hunks)
  • packages/thea/src/config/substrate/constants/index.ts (1 hunks)
  • packages/thea/src/config/substrate/index.ts (1 hunks)
  • packages/thea/src/sdk/substrate/astar.ts (2 hunks)
  • packages/thea/src/sdk/substrate/interlay.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/thea/src/config/substrate/index.ts
Additional comments not posted (5)
.changeset/yellow-swans-hang.md (1)

5-5: The changeset description is clear and effectively communicates the purpose of the changes.

packages/thea/src/config/substrate/constants/index.ts (1)

30-33: The implementation of MIN_BRIDGE_AMOUNT is correct and well-structured. It effectively supports the new feature for minimum bridge amounts.

packages/thea/src/config/substrate/config/interlay.ts (1)

30-30: The adjustments to destinationFee amounts for dot and vdot are aligned with the PR objectives. Ensure these values are consistent with external documentation or other parts of the application.

Also applies to: 78-78

packages/thea/src/config/substrate/config/astar.ts (1)

30-30: Adjustments to destinationFee amounts for dot, unq, pha, and ibtc are noted. Please confirm that setting the destinationFee to 0 for unq is intentional and verify consistency across the application.

Also applies to: 64-64, 81-81, 132-132

packages/thea/src/sdk/substrate/astar.ts (1)

18-18: Integration of MIN_BRIDGE_AMOUNT in getTransferConfig method looks correct and aligns with the PR objectives to handle minimum transfer amounts for specific chains.

Also applies to: 106-112

Verification successful

The MIN_BRIDGE_AMOUNT constant is used in the following files:

  • packages/thea/src/config/substrate/constants/index.ts
  • packages/thea/src/sdk/substrate/astar.ts
  • packages/thea/src/sdk/substrate/interlay.ts

The integration of MIN_BRIDGE_AMOUNT in the getTransferConfig method in astar.ts aligns with the PR objectives and is consistent with its usage in other relevant parts of the system.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that `MIN_BRIDGE_AMOUNT` is consistently used across other relevant parts of the system.

# Test: Search for usage of `MIN_BRIDGE_AMOUNT` across the project. Expect: Consistent usage in relevant parts.
rg --type python $'MIN_BRIDGE_AMOUNT'

Length of output: 67



Script:

#!/bin/bash
# Description: Verify that `MIN_BRIDGE_AMOUNT` is consistently used across other relevant parts of the system.

# Test: Search for usage of `MIN_BRIDGE_AMOUNT` across the project. Expect: Consistent usage in relevant parts.
rg --type typescript $'MIN_BRIDGE_AMOUNT'

Length of output: 75



Script:

#!/bin/bash
# Description: Verify that `MIN_BRIDGE_AMOUNT` is consistently used across other relevant parts of the system.

# Test: Search for usage of `MIN_BRIDGE_AMOUNT` across the project. Expect: Consistent usage in relevant parts.
rg --type ts $'MIN_BRIDGE_AMOUNT'

Length of output: 517

@nuel77 nuel77 merged commit 66c52ff into main Jun 10, 2024
2 checks passed
@nuel77 nuel77 deleted the feat/configure-minBridge-amount branch June 10, 2024 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure minimum amount for cross chain
2 participants