-
Notifications
You must be signed in to change notification settings - Fork 11
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
feat: support system to bridge txs #383
feat: support system to bridge txs #383
Conversation
add unit tests add util functions for determining direction based on asset and dest locations
great to see this out already! One request @marshacb : once this is ready for review, it would be really helpful if you add details to the original post of the differences in UX this feature implies (for example, destinations as multilocations and so on) |
…ocations add SystemToBridge integration tests
updated getGlobalConsensusSystemName to check X1 junction rather than entire string for valid consensus name added consensus name check to xcm tx input checks for system to bridge direction
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/parity-tech-update-for-march/7226/1 |
add AssetTransferType and resolveTransferType util func
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Output/result looks good 👍
Does it support P<>K bridge as well?
Hey @acatangiu, thanks for checking this out! Yes, this feature will support P<>K bridge transaction construction as well. |
add util function for constructing beneficiary add util to construct versioned xcm asset id add ability to explicitly construct transferAssetsUsingTypeAndThen by providing transferAssetsType
update resolveCall to use assetTransferType
update resolveAssetTransferType and createXcmVersionedAssetId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of general comments:
- Can we add an example where we send (bridge) the native token of another ecosystem back to its native ecosystem? For example ROC from Westend AH back to Rococo AH?
- Any reason in particular to have the example with Trappist? In principle, it is normal foreign asset transfer from AH which is already covered in other examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two nits but great work
fix comment spacing in readme
…ive chain removed trappist example added tests for customXcmMessageOnDest dest
|
…o 1 asset outside of transferAssetsUsingTypeAndThen runtime calls
examples/rococo/assetHub/foreignAssetTransfers/teleport/assetHubWETHToBridgeHub.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superb work, I only have a comment about an example. The rest looks good to me.
PS: I found some not accurate error messages while testing different inputs, but I will open a different issue for them since they are not directly related to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
Left some comments for some corrections.
Description
This PR introduces the
SystemToBridge
tx direction for constructing BridgeHub transactions from AssetHub.Changes
transferAssetsUsingTypeAndThen
extrinsic.SystemToBridge
direction.GlobalConsensus
location (e.g.{"parents":"2","interior":{"X1":{"GlobalConsensus":{"Ethereum":{"chainId":"11155111"}}}}}
) to be provided as a value for thedestChainId
parameter increateTransferTransaction
. If a destChainId is provided containing a knownX1
GlobalConsensus
junction it will be considered a Bridge tx. Currently known consensus junctions are set topolkadot
,kusama
,westend
,rococo
, andethereum
.{"parents":"2","interior":{"X2":[{"GlobalConsensus":{"Ethereum":{"chainId":"11155111"}}},{"AccountKey20":{"network":null,"key":"0xfff9976782d46cc05630d1f6ebab18b2324d6b14"}}]}}
on AssetHub Rococo) to be provided asassetIds
increateTransferTransaction
.SystemToBridge
directionSystemToBridge
directiongeneralKey
locations to XCM version 2 inresolveMultiLocation
BridgeHub Snowbridge: (Rococo AssetHub WETH -> Ethereum Sepolia)
Example of constructing a
transferAssets
call sending SnowbridgeWETH
to Ethereum Sepolia from Rococo AssetHub:Expected Output
BridgeHub Polkadot<>Kusama Bridge: (Kusama AssetHub KSM -> Polkadot AssetHub)
Example of constructing a
transferAssets
call sending KSM to Polkadot AssetHub from Kusama AssetHub:Expected Output:
Note
ForeignAssets
pallet of the origin chain the API will throw anAssetNotFound
errorassetTransferType
option will resolve the call totransferAssetsUsingTypeAndThen
if it is found in the runtime. When providing a value ofRemoteReserve
forassetTransferType
orfeesTransferType
, a location value is expected forremoteReserveAssetTransferTypeLocation
and/orremoteReserveFeesTransferTypeLocation
respectively.related issue: #382
closes: #400