Skip to content

Commit

Permalink
Merge pull request #472 from sander2/fix/orml-xcm
Browse files Browse the repository at this point in the history
feat: add orml-xcm pallet to send xcm message with sovereign account
  • Loading branch information
sander2 authored Jan 14, 2022
2 parents 9a44f1d + 4402b12 commit 7def8cc
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 21 deletions.
23 changes: 20 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions parachain/runtime/interlay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li
orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }

orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }

Expand Down
16 changes: 10 additions & 6 deletions parachain/runtime/interlay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@ use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
use polkadot_parachain::primitives::Sibling;
use sp_runtime::traits::Convert;
use xcm::{
v1::{prelude::*, MultiAsset, MultiLocation, NetworkId},
AlwaysV1,
};
use xcm::latest::prelude::*;

use xcm_builder::{
AccountId32Aliases, AllowTopLevelPaidExecutionFrom, EnsureXcmOrigin, FixedWeightBounds, LocationInverter,
NativeAsset, ParentAsSuperuser, ParentIsDefault, RelayChainAsNative, SiblingParachainAsNative,
Expand Down Expand Up @@ -671,7 +669,7 @@ pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, ParentN
/// queues.
pub type XcmRouter = (
// Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, AlwaysV1>,
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm>,
// ..and XCMP to communicate with the sibling chains.
XcmpQueue,
);
Expand Down Expand Up @@ -702,7 +700,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
type VersionWrapper = AlwaysV1;
type VersionWrapper = PolkadotXcm;
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
Expand Down Expand Up @@ -1161,6 +1159,11 @@ impl nomination::Config for Runtime {
type WeightInfo = ();
}

impl orml_xcm::Config for Runtime {
type Event = Event;
type SovereignOrigin = EnsureRoot;
}

construct_runtime! {
pub enum Runtime where
Block = Block,
Expand Down Expand Up @@ -1224,6 +1227,7 @@ construct_runtime! {
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin},
OrmlXcm: orml_xcm::{Pallet, Call, Event<T>},
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>},

XTokens: orml_xtokens::{Pallet, Storage, Call, Event<T>},
Expand Down
1 change: 1 addition & 0 deletions parachain/runtime/kintsugi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li
orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }

orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }

Expand Down
16 changes: 10 additions & 6 deletions parachain/runtime/kintsugi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
use pallet_xcm::XcmPassthrough;
use polkadot_parachain::primitives::Sibling;
use sp_runtime::{traits::Convert, FixedPointNumber, Perquintill};
use xcm::{
v1::{prelude::*, MultiAsset, MultiLocation, NetworkId},
AlwaysV1,
};
use xcm::latest::prelude::*;

use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
Expand Down Expand Up @@ -693,7 +691,7 @@ pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, ParentN
/// queues.
pub type XcmRouter = (
// Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, AlwaysV1>,
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm>,
// ..and XCMP to communicate with the sibling chains.
XcmpQueue,
);
Expand Down Expand Up @@ -724,7 +722,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
type VersionWrapper = AlwaysV1;
type VersionWrapper = PolkadotXcm;
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
Expand All @@ -745,6 +743,11 @@ pub type LocalAssetTransactor = MultiCurrencyAdapter<

pub use currency_id_convert::CurrencyIdConvert;

impl orml_xcm::Config for Runtime {
type Event = Event;
type SovereignOrigin = EnsureRoot;
}

mod currency_id_convert {
use super::*;
use codec::{Decode, Encode};
Expand Down Expand Up @@ -1246,6 +1249,7 @@ construct_runtime! {
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin},
OrmlXcm: orml_xcm::{Pallet, Call, Event<T>},
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>},

XTokens: orml_xtokens::{Pallet, Storage, Call, Event<T>},
Expand Down
1 change: 1 addition & 0 deletions parachain/runtime/testnet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-li
orml-vesting = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }

orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-xcm = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }
orml-unknown-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", rev = "1f520348f31b5e94b8a5dd7f8e6b8ec359df4177", default-features = false }

Expand Down
16 changes: 10 additions & 6 deletions parachain/runtime/testnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment};
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough};
use polkadot_parachain::primitives::Sibling;
use sp_runtime::{traits::Convert, FixedPointNumber, Perquintill};
use xcm::{
v1::{prelude::*, MultiAsset, MultiLocation, NetworkId},
AlwaysV1,
};
use xcm::latest::prelude::*;

use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom,
EnsureXcmOrigin, FixedRateOfFungible, FixedWeightBounds, LocationInverter, NativeAsset, ParentAsSuperuser,
Expand Down Expand Up @@ -732,7 +730,7 @@ pub type LocalOriginToLocation = (SignedToAccountId32<Origin, AccountId, ParentN
/// queues.
pub type XcmRouter = (
// Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, AlwaysV1>,
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, PolkadotXcm>,
// ..and XCMP to communicate with the sibling chains.
XcmpQueue,
);
Expand Down Expand Up @@ -763,7 +761,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type Event = Event;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
type VersionWrapper = AlwaysV1;
type VersionWrapper = PolkadotXcm;
}

impl cumulus_pallet_dmp_queue::Config for Runtime {
Expand Down Expand Up @@ -1222,6 +1220,11 @@ impl nomination::Config for Runtime {
type WeightInfo = ();
}

impl orml_xcm::Config for Runtime {
type Event = Event;
type SovereignOrigin = EnsureRoot;
}

construct_runtime! {
pub enum Runtime where
Block = Block,
Expand Down Expand Up @@ -1285,6 +1288,7 @@ construct_runtime! {
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin},
OrmlXcm: orml_xcm::{Pallet, Call, Event<T>},
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>},

XTokens: orml_xtokens::{Pallet, Storage, Call, Event<T>},
Expand Down

0 comments on commit 7def8cc

Please sign in to comment.