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

Non native tokens transfer b/w Astar & Polkadex #282

Merged
merged 25 commits into from
Jun 7, 2024

Conversation

ap211unitech
Copy link
Member

@ap211unitech ap211unitech commented Jun 7, 2024

📝 Description

As of now, we have successfully migrated exisiting THEA functionalities to @polkadex/thea package i.e. THEA deposits and withdrawals for existing chains and assets. This task is the second part of THEA enhancement task.

Now, our next goal is to allow depositing non-native assets of exisiting chains to Polkadex network and allow withdrawals from Polkadex network back to original chain.
For example, Astar supports DOT, GLMR and more assets which are already supported by Polkadex network, but we never integrated it frontend. Technically, Transfer for these assets should work. So, we will be testing and allowing these transfers.

In this task, we will be adding these assets for Astar & Polkadex network -

  • Astar to Polkadex & vice versa
    • DOT
    • GLMR
    • IBTC
    • PHA
    • UNQ
    • BNC
    • vDOT

Summary by CodeRabbit

  • New Features
    • Expanded asset support for the astar instance, including dot, glmr, unq, pha, ibtc, bnc, and vdot.
    • Enhanced asset transfer configurations with detailed parameters for balances, destinations, fees, and extrinsics.

Copy link

changeset-bot bot commented Jun 7, 2024

🦋 Changeset detected

Latest commit: 8538be3

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 Minor

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

Warning

Rate limit exceeded

@ap211unitech has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 29 minutes and 8 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 709e6e2 and 8538be3.

Walkthrough

The recent updates enhance the configuration of various assets within the astar and polkadex configurations. Specifically, new assets such as dot, glmr, unq, pha, ibtc, bnc, and vdot have been added, with detailed configurations for balances, destinations, fees, and extrinsics. These changes expand the cross-chain transfer capabilities between Astar, Polkadex, and other networks.

Changes

File Path Change Summary
.../substrate/chains.ts Added new assets (dot, glmr, unq, pha, ibtc, bnc, vdot) with decimals and IDs to the astar instance.
.../substrate/config/astar.ts Added new assets configurations (dot, glmr, unq, pha, bnc, vdot, ibtc) within the toPolkadex array.
.../substrate/config/polkadex.ts Added new AssetConfig instances for assets (dot, glmr, unq, pha, bnc, vdot, ibtc) for transfers.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant Astar
    participant Polkadex

    User->>Astar: Initiate asset transfer (dot, glmr, etc.)
    Astar->>Polkadex: Send asset transfer request
    Polkadex->>Astar: Confirm asset transfer
    Astar->>User: Transfer complete notification
Loading

Possibly related issues

Poem

In the realm of chains, where assets flow,
New tokens join, their values grow.
From Astar’s heart to Polkadex’s gate,
Cross-chain dreams now resonate.
With dot and glmr, pha and more,
Thea's magic we explore. 🌐✨


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
1 task
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 30db32c and c12d819.

Files selected for processing (4)
  • .changeset/stupid-dryers-invite.md (1 hunks)
  • packages/thea/src/config/substrate/chains.ts (1 hunks)
  • packages/thea/src/config/substrate/config/astar.ts (2 hunks)
  • packages/thea/src/config/substrate/config/polkadex.ts (2 hunks)
Files not reviewed due to errors (2)
  • packages/thea/src/config/substrate/chains.ts (no review received)
  • packages/thea/src/config/substrate/config/polkadex.ts (no review received)
Files skipped from review due to trivial changes (1)
  • .changeset/stupid-dryers-invite.md
Additional comments not posted (7)
packages/thea/src/config/substrate/config/astar.ts (7)

142-142: Ensure all assets are correctly included in the Astar chain configuration.


42-57: Review the fee values for GLMR to ensure they align with network requirements.

Verification successful

The fee values for GLMR in the Astar network appear to be consistent across the system. The search results show multiple instances of AssetConfig using glmr in various configuration files, including astar.ts, moonbeam.ts, and polkadex.ts.

  • packages/thea/src/config/substrate/config/astar.ts
  • packages/thea/src/config/substrate/config/moonbeam.ts
  • packages/thea/src/config/substrate/config/polkadex.ts

These instances indicate that the fee values for GLMR are being used consistently.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the fee values for GLMR in the Astar network.

# Test: Search for the fee values usage. Expect: Consistent usage across the system.
rg --type typescript $'new AssetConfig({ asset: glmr, $$$ })'

Length of output: 191



Script:

#!/bin/bash
# Description: Verify the fee values for GLMR in the Astar network.

# Test: Search for the fee values usage. Expect: Consistent usage across the system.
rg --type typescript 'new AssetConfig\(\{ asset: glmr, .*\}\)'

Length of output: 99



Script:

#!/bin/bash
# Description: Verify the fee values for GLMR in the Astar network.

# Test: Search for the fee values usage. Expect: Consistent usage across the system.
rg --type ts 'new AssetConfig\(\{ asset: glmr, .*\}\)'

Length of output: 56



Script:

#!/bin/bash
# Description: Verify the fee values for GLMR in the Astar network.

# Test: Search for all instances of AssetConfig and filter for GLMR usage.
rg --type ts 'new AssetConfig' | xargs -I {} rg 'glmr' {}

Length of output: 4590



Script:

#!/bin/bash
# Description: Verify the fee values for GLMR in the Astar network.

# Test: Search for all instances of AssetConfig and filter for GLMR usage.
rg --type ts -l 'new AssetConfig' | xargs rg 'glmr'

Length of output: 1046


59-74: Verify the zero fee configuration for UNQ to ensure it is intentional.


93-108: Verify the small fee configuration for BNC to ensure it is appropriate.

Verification successful

The previous script encountered a syntax error due to an incorrect regex pattern. Let's correct the pattern and re-run the script to verify the small fee configuration for BNC.


The previous script encountered a syntax error due to an incorrect regex pattern. Let's correct the pattern and re-run the script to verify the small fee configuration for BNC.


The previous script encountered an error due to an unrecognized file type. Let's remove the file type specification and re-run the script to verify the small fee configuration for BNC.


The previous script did not produce any output, indicating that the specific configuration might not be used elsewhere or the search pattern might need adjustment. Let's broaden the search to include more general patterns related to AssetConfig and bnc.


The previous attempts to search for the usage of AssetConfig with bnc did not produce any output. To ensure thorough verification, let's use ast-grep to search for the specific configuration pattern in the codebase.


The verification process has revealed multiple instances of AssetConfig with bnc across different files. The small fee configuration for BNC in the Astar network appears to be consistent with other configurations.

  • File: packages/thea/src/config/substrate/config/astar.ts

    • Lines: 93-108
    • Fee Amount: 0.0006 BNC
  • File: packages/thea/src/config/substrate/config/bifrost.ts

    • Lines: 9-23
    • Fee Amount: 0 BNC
  • File: packages/thea/src/config/substrate/config/polkadex.ts

    • Lines: 260-280
    • Fee Amount: 0.001 BNC
    • Lines: 445-465
    • Fee Amount: 0.000563136 BNC

The small fee configuration for BNC in the Astar network is consistent with other configurations, suggesting it is appropriate.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the small fee configuration for BNC in the Astar network.

# Test: Search for the small fee configuration usage. Expect: Consistent usage across the system.
rg --type typescript $'new AssetConfig({ asset: bnc, $$$ })'

Length of output: 189



Script:

#!/bin/bash
# Description: Verify the small fee configuration for BNC in the Astar network.

# Test: Search for the small fee configuration usage. Expect: Consistent usage across the system.
rg --type typescript 'new AssetConfig\({ asset: bnc,'

Length of output: 187



Script:

#!/bin/bash
# Description: Verify the small fee configuration for BNC in the Astar network.

# Test: Search for the small fee configuration usage. Expect: Consistent usage across the system.
rg --type typescript 'new AssetConfig\(\{ asset: bnc,'

Length of output: 91



Script:

#!/bin/bash
# Description: Verify the small fee configuration for BNC in the Astar network.

# Test: Search for the small fee configuration usage. Expect: Consistent usage across the system.
rg 'new AssetConfig\(\{ asset: bnc,'

Length of output: 38



Script:

#!/bin/bash
# Description: Verify the small fee configuration for BNC in the Astar network.

# Test: Search for any usage of AssetConfig with bnc. Expect: Consistent usage across the system.
rg 'AssetConfig.*bnc'

Length of output: 23



Script:

#!/bin/bash
# Description: Verify the small fee configuration for BNC in the Astar network using ast-grep.

# Test: Search for any usage of AssetConfig with bnc. Expect: Consistent usage across the system.
ast-grep --lang typescript --pattern $'new AssetConfig({
  asset: bnc,
  $$$
})'

Length of output: 6382


25-40: Ensure the destination fee and minimum asset configurations are consistent with the intended functionality.


76-91: Review the fee values for PHA to ensure they align with network requirements.


110-125: Review the very small fee values for VDOT to ensure they align with network requirements.

packages/thea/src/config/substrate/config/astar.ts Outdated Show resolved Hide resolved
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c12d819 and 709e6e2.

Files selected for processing (2)
  • packages/thea/src/config/substrate/chains.ts (1 hunks)
  • packages/thea/src/config/substrate/config/polkadex.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • packages/thea/src/config/substrate/chains.ts
  • packages/thea/src/config/substrate/config/polkadex.ts

@nuel77 nuel77 merged commit f2488c2 into main Jun 7, 2024
2 checks passed
@nuel77 nuel77 deleted the feat/thea-enhancements-ii branch June 7, 2024 12:03
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.

Non native tokens transfer b/w Astar & Polkadex
3 participants