diff --git a/example/runtime/src/zenlink.rs b/example/runtime/src/zenlink.rs index 99a4eef..57f9f0c 100644 --- a/example/runtime/src/zenlink.rs +++ b/example/runtime/src/zenlink.rs @@ -33,6 +33,7 @@ impl zenlink_protocol::Config for Runtime { type TargetChains = (); type SelfParaId = SelfParaId; type WeightInfo = (); + type ControlOrigin = EnsureRoot; } type MultiAssets = ZenlinkMultiAssets>; diff --git a/zenlink-protocol/src/lib.rs b/zenlink-protocol/src/lib.rs index c6bc3bf..4069344 100644 --- a/zenlink-protocol/src/lib.rs +++ b/zenlink-protocol/src/lib.rs @@ -80,6 +80,8 @@ pub mod pallet { pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type RuntimeEvent: From> + IsType<::RuntimeEvent>; + /// The only origin that can create pair. + type ControlOrigin: EnsureOrigin<::RuntimeOrigin>; /// The assets interface beyond native currency and other assets. type MultiAssetsHandler: MultiAssetsHandler; /// This pallet id. @@ -521,7 +523,7 @@ pub mod pallet { asset_0: T::AssetId, asset_1: T::AssetId, ) -> DispatchResult { - ensure_root(origin)?; + T::ControlOrigin::ensure_origin(origin)?; ensure!(asset_0.is_support() && asset_1.is_support(), Error::::UnsupportedAssetType); ensure!(asset_0 != asset_1, Error::::DeniedCreatePair);