-
Notifications
You must be signed in to change notification settings - Fork 108
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
Gateway should no longer build token registration XCM #1381
base: v2
Are you sure you want to change the base?
Conversation
library XcmKind { | ||
/// SCALE-encoded raw bytes for `VersionedXcm` | ||
uint8 constant Raw = 0; | ||
/// Create a new asset in the ForeignAssets pallet of AssetHub | ||
uint8 constant CreateAsset = 1; | ||
} |
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.
@alistair-singh @claravanstaden @yrong to give more context, this change opens up the possibility of users not strictly needing to pass raw XCM through the bridge to Polkadot.
Instead they can pass in a simpler ABI-encoded data, like:
struct Transfer {
destination: Location,
destination_fee: DestinationFee,
beneficiary: Location,
transact: Option<Bytes>,
}
// How to obtain destination fee on AH
enum DestinationFee {
// Swap native ether in `message.value`
SwapEther {
in: amount
out: (Location, amount)
},
// Swap asset in `message.assets`
SwapAsset {
in: (u8, amount)
out: (Location, amount)
},
// Directly use some amount of an asset in `message.assets`.
Asset: (u8, amount),
}
Then the inbound-queue can build an XCM that does the following:
- Obtain the destination fee according to the
DestinationFee
instruction on AH - Adds an
InitiateTransfer
instruction that forwardsmessage.assets
to destination- Sets the asset claimer on the destination to
beneficiary
- Deposits into
beneficiary
account - Optionally executes an XCM::Transact
- Sets the asset claimer on the destination to
This would simplify the UX and also make it easier for to on-chain contracts to send messages to Polkadot without having to build XCM. It is hard to build XCM onchain.
Would this be useful?
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.
IMHO, it will introduce additional complexity to the on-chain logic. I still prefer the raw XCM version, which offloads the complexity to off-chain.
Instead, I've modified the protocol so that:
CreateAssetXCM
of raw xcm.Then the inbound-queue on BH can either passthrough the raw xcm or build the create asset XCM.