mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 21:31:02 +00:00
Contracts: Add XCM traits to interface with contracts (#2086)
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 <>
This commit is contained in:
@@ -115,3 +115,9 @@ pub use origin_aliases::AliasForeignAccountId32;
|
||||
|
||||
mod pay;
|
||||
pub use pay::{FixedLocation, LocatableAssetId, PayAccountId32OnChainOverXcm, PayOverXcm};
|
||||
|
||||
mod controller;
|
||||
pub use controller::{
|
||||
Controller, ExecuteController, ExecuteControllerWeightInfo, QueryController,
|
||||
QueryControllerWeightInfo, SendController, SendControllerWeightInfo,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user