-
Notifications
You must be signed in to change notification settings - Fork 52
Add account key base asset transfer support. #1862
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR adds support for account-based asset transfers by introducing new extrinsics transfer_asset and receiver_affirm_asset_transfer to the Asset pallet. The implementation leverages the settlement engine to handle transfers between default portfolios, with support for receiver affirmations when required.
Key changes include:
- New settlement trait (
SettlementFnTrait) providing a unified interface for asset and NFT transfers - Modified
WeightMeter::from_limitAPI to auto-adjust limits instead of returning errors - New pending transfer storage and events for tracking transfers awaiting receiver affirmation
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| primitives/src/weight_meter.rs | Changed from_limit to return Self instead of Result, auto-adjusting limit when below minimum |
| primitives/src/traits/settlement.rs | New trait defining settlement functions for transferring fungible and non-fungible assets |
| primitives/src/traits.rs | Added exports for the new settlement trait module |
| pallets/weights/src/pallet_asset.rs | Added weight functions for the new transfer extrinsics |
| pallets/settlement/src/lib.rs | Implemented SettlementFnTrait, added new error type, and updated weight meter validation |
| pallets/runtime/common/src/runtime.rs | Configured the Asset pallet to use the Settlement pallet for transfers |
| pallets/asset/src/lib.rs | Added new extrinsics, events, storage, and implementation for account-based asset transfers |
| pallets/asset/src/benchmarking.rs | Added benchmarks for new transfer functions and updated existing benchmarks with new parameter |
| pallets/sto/src/benchmarking.rs | Updated benchmark calls with new move_to_sender_portfolio parameter |
| pallets/settlement/src/benchmarking.rs | Updated benchmark calls with new move_to_sender_portfolio parameter |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
changelog
new features
new external API
transfer_assetandreceiver_affirm_asset_transferto the Asset pallet.new events
Transferred { asset_id: AssetId, from: AccountId, to: AccountId, amount: u128, memo: Option<Memo> }andTransferPending { pending_transfer_id: PendingTransferId, asset_id: AssetId, from: AccountId, to: AccountId, amount: u128, memo: Option<Memo> }to the Assets pallet.