mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 02:57:57 +00:00
6b7be115fd
We are introducing a new set of `XcmController` traits (final name yet to be determined). These traits are implemented by `pallet-xcm` and allows other pallets, such as `pallet_contracts`, to rely on these traits instead of tight coupling them to `pallet-xcm`. Using only the existing Xcm traits would mean duplicating the logic from `pallet-xcm` in these other pallets, which we aim to avoid. Our objective is to ensure that when these APIs are called from `pallet-contracts`, they produce the exact same outcomes as if called directly from `pallet-xcm`. The other benefits is that we can also expose return values to `pallet-contracts` instead of just calling `pallet-xcm` dispatchable and getting a `DispatchResult` back. See traits integration in this PR https://github.com/paritytech/polkadot-sdk/pull/1248, where the traits are used as follow to define and implement `pallet-contracts` Config. ```rs // Contracts config: pub trait Config: frame_system::Config { // ... /// A type that exposes XCM APIs, allowing contracts to interact with other parachains, and /// execute XCM programs. type Xcm: xcm_executor::traits::Controller< OriginFor<Self>, <Self as frame_system::Config>::RuntimeCall, BlockNumberFor<Self>, >; } // implementation impl pallet_contracts::Config for Runtime { // ... type Xcm = pallet_xcm::Pallet<Self>; } ``` --------- Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: command-bot <>
16 lines
528 B
Plaintext
16 lines
528 B
Plaintext
title: "Contracts: Add XCM traits to interface with contracts"
|
|
|
|
doc:
|
|
- audience: Core Dev
|
|
description: |
|
|
We are introducing a new set of `XcmController` traits in `pallet-xcm`.
|
|
These traits extract functionality from `pallet-xcm` and provide high-level interaction with XCM.
|
|
They enable other pallets, like `pallet_contracts`, to rely on these traits instead of tight coupling to `pallet-xcm` itself.
|
|
|
|
crates:
|
|
- name: "pallet-xcm"
|
|
semver: patch
|
|
- name: "xcm-executor"
|
|
semver: patch
|
|
|