From b3f7d843b1b8638a603936b55be65e0a8c3bee8a Mon Sep 17 00:00:00 2001 From: Haidar Jbeily Date: Mon, 12 Aug 2024 21:17:46 +0300 Subject: [PATCH 1/6] Add Identity Generation for Tech Account --- pallets/technical/Cargo.toml | 1 + pallets/technical/src/lib.rs | 90 ++++++++++++++++++++++++++++++++++-- 2 files changed, 88 insertions(+), 3 deletions(-) diff --git a/pallets/technical/Cargo.toml b/pallets/technical/Cargo.toml index 70886052b1..c5b81720a2 100644 --- a/pallets/technical/Cargo.toml +++ b/pallets/technical/Cargo.toml @@ -22,6 +22,7 @@ frame-system = { git = "https://github.com/sora-xor/substrate.git", branch = "po hex-literal = { version = "0.4.1", optional = true } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-std = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } diff --git a/pallets/technical/src/lib.rs b/pallets/technical/src/lib.rs index 54ac26be69..39307fb39c 100644 --- a/pallets/technical/src/lib.rs +++ b/pallets/technical/src/lib.rs @@ -35,10 +35,13 @@ use codec::{Decode, Encode}; use common::prelude::Balance; use common::{AssetIdOf, AssetInfoProvider, FromGenericPair, SwapAction, SwapRulesValidation}; -use frame_support::dispatch::{DispatchError, DispatchResult}; +use frame_support::dispatch::{DispatchError, DispatchResult, RawOrigin}; use frame_support::{ensure, Parameter}; +use pallet_identity::IdentityInfo; +use sp_core::bounded::BoundedVec; use sp_runtime::traits::{MaybeSerializeDeserialize, Member}; use sp_runtime::RuntimeDebug; +use sp_std::boxed::Box; use common::{AssetManager, TECH_ACCOUNT_MAGIC_PREFIX}; use sp_core::H256; @@ -53,6 +56,7 @@ type AccountIdOf = ::AccountId; type TechAccountIdOf = ::TechAccountId; type TechAssetIdOf = ::TechAssetId; type DEXIdOf = ::DEXId; +type Identity = pallet_identity::Pallet; /// Pending atomic swap operation. #[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, scale_info::TypeInfo)] @@ -163,6 +167,10 @@ impl Pallet { if let Err(_) = Self::lookup_tech_account_id(&account_id) { frame_system::Pallet::::inc_providers(&account_id); } + let identity_info_opt = Self::gen_tech_account_identity_info(&tech_account_id); + if let Some(identity_info) = identity_info_opt { + Self::set_identity(account_id.clone(), identity_info)?; + } TechAccounts::::insert(account_id, tech_account_id); Ok(()) } @@ -174,11 +182,85 @@ impl Pallet { let account_id = Self::tech_account_id_to_account_id(tech_account_id)?; if let Err(_) = Self::lookup_tech_account_id(&account_id) { frame_system::Pallet::::inc_providers(&account_id); - TechAccounts::::insert(account_id, tech_account_id.clone()); + let identity_info_opt = Self::gen_tech_account_identity_info(&tech_account_id); + if let Some(identity_info) = identity_info_opt { + Self::set_identity(account_id.clone(), identity_info)?; + } + + TechAccounts::::insert(account_id, tech_account_id); + } + Ok(()) + } + + /// Set `IdentityInfo` for a specific `AccountId` using identity pallet + pub fn set_identity( + account_id: T::AccountId, + identity_info: IdentityInfo, + ) -> DispatchResult { + let origin = RawOrigin::Signed(account_id.clone()); + let boxed_identity_info = Box::new(identity_info); + if let Err(_) = + pallet_identity::Pallet::::set_identity(origin.into(), boxed_identity_info) + { + return Err(Error::::IdentityCouldNotBeSet)?; } Ok(()) } + pub fn gen_tech_account_identity_info( + tech_account_id: &T::TechAccountId, + ) -> Option> { + use common::TechAccountId; + use pallet_identity::Data; + use sp_std::vec; + // use sp_core::bounded::BoundedVec; + let common_tech_account_id: common::TechAccountId = + tech_account_id.clone().into(); + let (display_name, additional) = match common_tech_account_id { + TechAccountId::Pure(dex_id, purpose) => ( + b"Pure Tech Account".to_vec(), + BoundedVec::truncate_from(vec![( + Data::Raw(BoundedVec::truncate_from(b"Purpose".encode())), + Data::Raw(BoundedVec::truncate_from(purpose.encode())), + )]), + ), + TechAccountId::Generic(tag, data) => ( + tag.to_vec(), + BoundedVec::truncate_from(vec![( + Data::Raw(BoundedVec::truncate_from(b"Data".encode())), + Data::Raw(BoundedVec::truncate_from(data.encode())), + )]), + ), + TechAccountId::Wrapped(account_id) => ( + b"Wrapper Tech Account".to_vec(), + BoundedVec::truncate_from(vec![( + Data::Raw(BoundedVec::truncate_from(b"AccountId".encode())), + Data::Raw(BoundedVec::truncate_from(account_id.encode())), + )]), + ), + TechAccountId::WrappedRepr(account_id) => ( + b"WrapperRepr Tech Account".to_vec(), + BoundedVec::truncate_from(vec![( + Data::Raw(BoundedVec::truncate_from(b"AccountId".encode())), + Data::Raw(BoundedVec::truncate_from(account_id.encode())), + )]), + ), + TechAccountId::None => return None, + }; + + Some(IdentityInfo { + display: Data::Raw(BoundedVec::truncate_from(display_name)), + additional: additional.into(), + legal: Default::default(), + web: Default::default(), + riot: Default::default(), + email: Default::default(), + pgp_fingerprint: None, + image: Default::default(), + twitter: Default::default(), + }) + } + /// Deregister `TechAccountId` in storage map. pub fn deregister_tech_account_id(tech_account_id: T::TechAccountId) -> DispatchResult { let account_id = Self::tech_account_id_to_account_id(&tech_account_id)?; @@ -262,7 +344,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; #[pallet::config] - pub trait Config: frame_system::Config + common::Config { + pub trait Config: frame_system::Config + common::Config + pallet_identity::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type RuntimeEvent: From> + IsType<::RuntimeEvent>; @@ -410,6 +492,8 @@ pub mod pallet { AssociatedAccountIdNotFound, /// Operation with abstract checking is impossible. OperationWithAbstractCheckingIsImposible, + /// Raised when identity::set_identity fails + IdentityCouldNotBeSet, } /// Registered technical account identifiers. Map from repr `AccountId` into pure `TechAccountId`. From 5caa3e520a770465c4d44fa44743dfecbebcb3fe Mon Sep 17 00:00:00 2001 From: Haidar Jbeily Date: Mon, 12 Aug 2024 21:22:01 +0300 Subject: [PATCH 2/6] Add Identity Generation for Tech Account --- Cargo.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.lock b/Cargo.lock index 61561cbb52..5834383d5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11560,6 +11560,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "parity-scale-codec", "permissions", "scale-info", From a153e37d9d1529d390fa571c4f8c574477c596c3 Mon Sep 17 00:00:00 2001 From: Haidar Jbeily Date: Mon, 12 Aug 2024 22:30:05 +0300 Subject: [PATCH 3/6] Enhance the code --- pallets/technical/src/lib.rs | 49 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/pallets/technical/src/lib.rs b/pallets/technical/src/lib.rs index 39307fb39c..2041844a1f 100644 --- a/pallets/technical/src/lib.rs +++ b/pallets/technical/src/lib.rs @@ -37,11 +37,13 @@ use common::prelude::Balance; use common::{AssetIdOf, AssetInfoProvider, FromGenericPair, SwapAction, SwapRulesValidation}; use frame_support::dispatch::{DispatchError, DispatchResult, RawOrigin}; use frame_support::{ensure, Parameter}; +use pallet_identity::Data; use pallet_identity::IdentityInfo; use sp_core::bounded::BoundedVec; use sp_runtime::traits::{MaybeSerializeDeserialize, Member}; use sp_runtime::RuntimeDebug; use sp_std::boxed::Box; +use sp_std::vec; use common::{AssetManager, TECH_ACCOUNT_MAGIC_PREFIX}; use sp_core::H256; @@ -211,46 +213,43 @@ impl Pallet { tech_account_id: &T::TechAccountId, ) -> Option> { use common::TechAccountId; - use pallet_identity::Data; - use sp_std::vec; - // use sp_core::bounded::BoundedVec; - let common_tech_account_id: common::TechAccountId = + + let common_tech_account_id: TechAccountId = tech_account_id.clone().into(); - let (display_name, additional) = match common_tech_account_id { + + let (display_name, additional_data) = match common_tech_account_id { TechAccountId::Pure(dex_id, purpose) => ( b"Pure Tech Account".to_vec(), - BoundedVec::truncate_from(vec![( - Data::Raw(BoundedVec::truncate_from(b"Purpose".encode())), - Data::Raw(BoundedVec::truncate_from(purpose.encode())), - )]), - ), - TechAccountId::Generic(tag, data) => ( - tag.to_vec(), - BoundedVec::truncate_from(vec![( - Data::Raw(BoundedVec::truncate_from(b"Data".encode())), - Data::Raw(BoundedVec::truncate_from(data.encode())), - )]), + vec![ + (b"Purpose".encode(), purpose.encode()), + (b"DEX ID".encode(), dex_id.encode()), + ], ), + TechAccountId::Generic(tag, data) => { + (tag.to_vec(), vec![(b"Data".encode(), data.encode())]) + } TechAccountId::Wrapped(account_id) => ( b"Wrapper Tech Account".to_vec(), - BoundedVec::truncate_from(vec![( - Data::Raw(BoundedVec::truncate_from(b"AccountId".encode())), - Data::Raw(BoundedVec::truncate_from(account_id.encode())), - )]), + vec![(b"AccountId".encode(), account_id.encode())], ), TechAccountId::WrappedRepr(account_id) => ( b"WrapperRepr Tech Account".to_vec(), - BoundedVec::truncate_from(vec![( - Data::Raw(BoundedVec::truncate_from(b"AccountId".encode())), - Data::Raw(BoundedVec::truncate_from(account_id.encode())), - )]), + vec![(b"AccountId".encode(), account_id.encode())], ), TechAccountId::None => return None, }; + let mut additional = vec![]; + for (key, value) in additional_data { + additional.push(( + Data::Raw(BoundedVec::truncate_from(key)), + Data::Raw(BoundedVec::truncate_from(value)), + )); + } + Some(IdentityInfo { display: Data::Raw(BoundedVec::truncate_from(display_name)), - additional: additional.into(), + additional: BoundedVec::truncate_from(additional), legal: Default::default(), web: Default::default(), riot: Default::default(), From fe2b6b389b5e3960513aefcfbbb28c29c8df20d6 Mon Sep 17 00:00:00 2001 From: Haidar Jbeily Date: Tue, 13 Aug 2024 02:27:46 +0300 Subject: [PATCH 4/6] Add Migration --- Cargo.lock | 4 + common/src/mock.rs | 30 ++++++ pallets/bridge-proxy/Cargo.toml | 1 + pallets/bridge-proxy/src/mock.rs | 6 +- pallets/ceres-staking/Cargo.toml | 1 + pallets/ceres-staking/src/mock.rs | 8 +- pallets/pool-xyk/Cargo.toml | 1 + pallets/pool-xyk/src/mock.rs | 7 +- pallets/technical/Cargo.toml | 3 + pallets/technical/src/lib.rs | 19 ++-- pallets/technical/src/migrations/mod.rs | 31 ++++++ .../src/migrations/set_onchain_identity.rs | 100 ++++++++++++++++++ pallets/technical/src/mock.rs | 10 +- runtime/src/migrations.rs | 1 + 14 files changed, 205 insertions(+), 17 deletions(-) create mode 100644 pallets/technical/src/migrations/mod.rs create mode 100644 pallets/technical/src/migrations/set_onchain_identity.rs diff --git a/Cargo.lock b/Cargo.lock index 5834383d5b..677fc42f92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1170,6 +1170,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -1499,6 +1500,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "parity-scale-codec", "permissions", "scale-info", @@ -7722,6 +7724,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -11556,6 +11559,7 @@ dependencies = [ "frame-support", "frame-system", "hex-literal", + "log", "orml-currencies", "orml-tokens", "orml-traits", diff --git a/common/src/mock.rs b/common/src/mock.rs index 7e5821bf07..965901704c 100644 --- a/common/src/mock.rs +++ b/common/src/mock.rs @@ -389,3 +389,33 @@ macro_rules! mock_pallet_timestamp_config { } }; } + +/// Mock of pallet `pallet_identity::Config`. +#[macro_export] +macro_rules! mock_pallet_identity_config { + ($runtime:ty) => { + parameter_types! { + pub const BasicDeposit: Balance = balance!(0.01); + pub const FieldDeposit: Balance = balance!(0.01); + pub const SubAccountDeposit: Balance = balance!(0.01); + pub const MaxSubAccounts: u32 = 100; + pub const MaxAdditionalFields: u32 = 100; + pub const MaxRegistrars: u32 = 20; + pub const MaxAdditionalDataLengthSwapTransferBatch: u32 = 2000; + } + impl pallet_identity::Config for $runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type BasicDeposit = BasicDeposit; + type FieldDeposit = FieldDeposit; + type SubAccountDeposit = SubAccountDeposit; + type MaxSubAccounts = MaxSubAccounts; + type MaxAdditionalFields = MaxAdditionalFields; + type MaxRegistrars = MaxRegistrars; + type Slashed = (); + type ForceOrigin = EnsureRoot; + type RegistrarOrigin = EnsureRoot; + type WeightInfo = (); + } + }; +} diff --git a/pallets/bridge-proxy/Cargo.toml b/pallets/bridge-proxy/Cargo.toml index 3f43048b60..6f63f70d04 100644 --- a/pallets/bridge-proxy/Cargo.toml +++ b/pallets/bridge-proxy/Cargo.toml @@ -37,6 +37,7 @@ bridge-channel = { git = "https://github.com/sora-xor/sora2-common.git" } sp-keyring = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits" } diff --git a/pallets/bridge-proxy/src/mock.rs b/pallets/bridge-proxy/src/mock.rs index 633db05a4e..7c331dfc72 100644 --- a/pallets/bridge-proxy/src/mock.rs +++ b/pallets/bridge-proxy/src/mock.rs @@ -40,8 +40,9 @@ use bridge_types::{GenericNetworkId, H160}; use common::mock::ExistentialDeposits; use common::{ balance, mock_assets_config, mock_common_config, mock_currencies_config, - mock_pallet_balances_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, - AssetName, AssetSymbol, Balance, DEXId, FromGenericPair, PredefinedAssetId, DAI, ETH, XOR, XST, + mock_pallet_balances_config, mock_pallet_identity_config, mock_technical_config, + mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, Balance, DEXId, FromGenericPair, + PredefinedAssetId, DAI, ETH, XOR, XST, }; use frame_support::parameter_types; use frame_support::traits::{Everything, GenesisBuild}; @@ -95,6 +96,7 @@ mock_currencies_config!(Test); mock_common_config!(Test); mock_tokens_config!(Test); mock_assets_config!(Test); +mock_pallet_identity_config!(Test); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/ceres-staking/Cargo.toml b/pallets/ceres-staking/Cargo.toml index 1476c20db7..f1f4513bfd 100644 --- a/pallets/ceres-staking/Cargo.toml +++ b/pallets/ceres-staking/Cargo.toml @@ -33,6 +33,7 @@ currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-lib sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } permissions = { path = "../permissions" } technical = { path = "../technical", default-features = false } diff --git a/pallets/ceres-staking/src/mock.rs b/pallets/ceres-staking/src/mock.rs index 07c3f8a198..b041749b95 100644 --- a/pallets/ceres-staking/src/mock.rs +++ b/pallets/ceres-staking/src/mock.rs @@ -5,9 +5,9 @@ pub use common::TechAssetId as Tas; pub use common::TechPurpose::*; use common::{ balance, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, ContentSource, DEXId, - Description, CERES_ASSET_ID, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, + ContentSource, DEXId, Description, CERES_ASSET_ID, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, Hooks}; @@ -40,6 +40,7 @@ construct_runtime! { Permissions: permissions::{Pallet, Call, Config, Storage, Event}, Technical: technical::{Pallet, Call, Config, Storage, Event}, CeresStaking: ceres_staking::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -64,6 +65,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/pool-xyk/Cargo.toml b/pallets/pool-xyk/Cargo.toml index 7b35a94094..a336e7ad4e 100644 --- a/pallets/pool-xyk/Cargo.toml +++ b/pallets/pool-xyk/Cargo.toml @@ -37,6 +37,7 @@ trading-pair = { path = "../trading-pair", default-features = false } [dev-dependencies] hex-literal = "0.4.1" pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } common = { path = "../../common", features = ["test"] } dex-manager = { path = "../dex-manager" } diff --git a/pallets/pool-xyk/src/mock.rs b/pallets/pool-xyk/src/mock.rs index 4c1e71898f..4499fe135a 100644 --- a/pallets/pool-xyk/src/mock.rs +++ b/pallets/pool-xyk/src/mock.rs @@ -32,13 +32,14 @@ use crate::{self as pool_xyk, Config}; use common::prelude::{AssetName, AssetSymbol, Balance, Fixed, FromGenericPair, SymbolName}; use common::{ balance, fixed, hash, mock_common_config, mock_currencies_config, mock_frame_system_config, - mock_pallet_balances_config, mock_technical_config, DEXInfo, GetMarketInfo, TBCD, + mock_pallet_balances_config, mock_pallet_identity_config, mock_technical_config, DEXInfo, + GetMarketInfo, TBCD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; -use frame_system; +use frame_system::EnsureRoot; use hex_literal::hex; use orml_traits::parameter_type_with_key; use permissions::{Scope, MANAGE_DEX}; @@ -113,6 +114,7 @@ construct_runtime! { Band: band::{Pallet, Call, Storage, Event}, OracleProxy: oracle_proxy::{Pallet, Call, Storage, Event}, ExtendedAssets: extended_assets::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -121,6 +123,7 @@ mock_currencies_config!(Runtime); mock_technical_config!(Runtime, crate::PolySwapAction); mock_frame_system_config!(Runtime); mock_common_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub GetBuyBackAccountId: AccountId = AccountId32::from([23; 32]); diff --git a/pallets/technical/Cargo.toml b/pallets/technical/Cargo.toml index c5b81720a2..d8b939830d 100644 --- a/pallets/technical/Cargo.toml +++ b/pallets/technical/Cargo.toml @@ -30,6 +30,7 @@ twox-hash = { version = "1.5.0", default-features = false } common = { path = "../../common", default-features = false } permissions = { path = "../permissions", default-features = false, optional = true } +log = { version = "0.4.22", features = [] } [dev-dependencies] sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } @@ -53,11 +54,13 @@ std = [ 'sp-core/std', 'sp-std/std', 'twox-hash/std', + 'pallet-identity/std' ] runtime-benchmarks = [ "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", "permissions", + "pallet-identity/try-runtime", "hex-literal", ] diff --git a/pallets/technical/src/lib.rs b/pallets/technical/src/lib.rs index 2041844a1f..6b73e3466d 100644 --- a/pallets/technical/src/lib.rs +++ b/pallets/technical/src/lib.rs @@ -36,6 +36,7 @@ use codec::{Decode, Encode}; use common::prelude::Balance; use common::{AssetIdOf, AssetInfoProvider, FromGenericPair, SwapAction, SwapRulesValidation}; use frame_support::dispatch::{DispatchError, DispatchResult, RawOrigin}; +use frame_support::traits::Currency; use frame_support::{ensure, Parameter}; use pallet_identity::Data; use pallet_identity::IdentityInfo; @@ -46,7 +47,7 @@ use sp_std::boxed::Box; use sp_std::vec; use common::{AssetManager, TECH_ACCOUNT_MAGIC_PREFIX}; -use sp_core::H256; +use sp_core::{Get, H256}; #[cfg(test)] mod mock; @@ -54,11 +55,12 @@ mod mock; #[cfg(test)] mod tests; +pub mod migrations; + type AccountIdOf = ::AccountId; type TechAccountIdOf = ::TechAccountId; type TechAssetIdOf = ::TechAssetId; type DEXIdOf = ::DEXId; -type Identity = pallet_identity::Pallet; /// Pending atomic swap operation. #[derive(Clone, Eq, PartialEq, RuntimeDebug, Encode, Decode, scale_info::TypeInfo)] @@ -199,13 +201,16 @@ impl Pallet { account_id: T::AccountId, identity_info: IdentityInfo, ) -> DispatchResult { + type BalanceOf = <::Currency as Currency< + ::AccountId, + >>::Balance; + let extra_fields_count = >::from(identity_info.additional.len() as u32); + let basic_deposit = T::BasicDeposit::get(); + let fields_deposit = T::FieldDeposit::get() * extra_fields_count; + T::Currency::make_free_balance_be(&account_id, basic_deposit + fields_deposit); let origin = RawOrigin::Signed(account_id.clone()); let boxed_identity_info = Box::new(identity_info); - if let Err(_) = - pallet_identity::Pallet::::set_identity(origin.into(), boxed_identity_info) - { - return Err(Error::::IdentityCouldNotBeSet)?; - } + pallet_identity::Pallet::::set_identity(origin.into(), boxed_identity_info).unwrap(); Ok(()) } diff --git a/pallets/technical/src/migrations/mod.rs b/pallets/technical/src/migrations/mod.rs new file mode 100644 index 0000000000..7e150df690 --- /dev/null +++ b/pallets/technical/src/migrations/mod.rs @@ -0,0 +1,31 @@ +// This file is part of the SORA network and Polkaswap app. + +// Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved. +// SPDX-License-Identifier: BSD-4-Clause + +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: + +// Redistributions of source code must retain the above copyright notice, this list +// of conditions and the following disclaimer. +// Redistributions in binary form must reproduce the above copyright notice, this +// list of conditions and the following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// All advertising materials mentioning features or use of this software must display +// the following acknowledgement: This product includes software developed by Polka Biome +// Ltd., SORA, and Polkaswap. +// +// Neither the name of the Polka Biome Ltd. nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY Polka Biome Ltd. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Polka Biome Ltd. BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +pub mod set_onchain_identity; diff --git a/pallets/technical/src/migrations/set_onchain_identity.rs b/pallets/technical/src/migrations/set_onchain_identity.rs new file mode 100644 index 0000000000..1931934a76 --- /dev/null +++ b/pallets/technical/src/migrations/set_onchain_identity.rs @@ -0,0 +1,100 @@ +// This file is part of the SORA network and Polkaswap app. + +// Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved. +// SPDX-License-Identifier: BSD-4-Clause + +// Redistribution and use in source and binary forms, with or without modification, +// are permitted provided that the following conditions are met: + +// Redistributions of source code must retain the above copyright notice, this list +// of conditions and the following disclaimer. +// Redistributions in binary form must reproduce the above copyright notice, this +// list of conditions and the following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// All advertising materials mentioning features or use of this software must display +// the following acknowledgement: This product includes software developed by Polka Biome +// Ltd., SORA, and Polkaswap. +// +// Neither the name of the Polka Biome Ltd. nor the names of its contributors may be used +// to endorse or promote products derived from this software without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY Polka Biome Ltd. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, +// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Polka Biome Ltd. BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +use crate::pallet::{Config, Pallet, TechAccounts}; +use core::marker::PhantomData; +use frame_support::pallet_prelude::Get; +use frame_support::traits::OnRuntimeUpgrade; +use frame_support::weights::Weight; + +pub struct SetOnChainIdentity(PhantomData); + +impl OnRuntimeUpgrade for SetOnChainIdentity { + fn on_runtime_upgrade() -> Weight { + let mut reads = 1; + let mut writes = 0; + + for (acc_id, tech_acc_id) in TechAccounts::::iter() { + let identity_info_opt = Pallet::::gen_tech_account_identity_info(&tech_acc_id); + if let Some(identity_info) = identity_info_opt { + Pallet::::set_identity(acc_id, identity_info).unwrap(); + reads += 1; + writes += 1; + } + } + T::DbWeight::get().reads_writes(reads, writes) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::{ExtBuilder, Identity, Runtime, TechAccountId}; + use crate::TechAccounts; + use frame_support::pallet_prelude::StorageVersion; + use pallet_identity::Data; + use sp_core::bounded::BoundedVec; + + #[test] + fn test_set_onchain_identity() { + let mut ext = ExtBuilder::default().build(); + ext.execute_with(|| { + StorageVersion::new(1).put::>(); + let tech_account_id = TechAccountId::Generic("Test123".into(), "Some data".into()); + let account_id = + crate::Pallet::::tech_account_id_to_account_id(&tech_account_id).unwrap(); + TechAccounts::::insert(account_id.clone(), tech_account_id); + + assert_eq!(Identity::identity(account_id.clone()), None); + + // migration + SetOnChainIdentity::::on_runtime_upgrade(); + + let registration = Identity::identity(account_id.clone()).unwrap(); + + // use sp_std::if_std; // Import into scope the if_std! macro. + // if_std! { + // // This code is only being compiled and executed when the `std` feature is enabled. + // println!("Hello native world!"); + // println!("My value is: {:#?}", info.display.encode()); + // } + + assert_eq!( + registration.info.display, + Data::Raw(BoundedVec::truncate_from(b"Test123".to_vec().into())) + ); + // storage version should not change + assert_eq!( + StorageVersion::get::>(), + StorageVersion::new(1) + ); + }); + } +} diff --git a/pallets/technical/src/mock.rs b/pallets/technical/src/mock.rs index bad0d0b54e..8e02fc0ad9 100644 --- a/pallets/technical/src/mock.rs +++ b/pallets/technical/src/mock.rs @@ -32,15 +32,16 @@ use crate::{self as technical, Config}; use codec::{Decode, Encode}; use common::prelude::Balance; use common::{ - mock_assets_config, mock_common_config, mock_currencies_config, mock_frame_system_config, - mock_pallet_balances_config, mock_tokens_config, DEXId, XST, + balance, mock_assets_config, mock_common_config, mock_currencies_config, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_tokens_config, DEXId, XST, }; use currencies::BasicCurrencyAdapter; use dispatch::DispatchResult; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, dispatch, parameter_types}; -use frame_system; +use frame_system::EnsureRoot; use orml_traits::parameter_type_with_key; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -82,6 +83,7 @@ construct_runtime! { UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, Permissions: permissions::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Event}, Tokens: tokens::{Pallet, Call, Config, Storage, Event}, @@ -106,6 +108,8 @@ parameter_types! { pub GetBuyBackAssetId: AssetId = XST.into(); } +mock_pallet_identity_config!(Runtime); + impl Config for Runtime { type RuntimeEvent = RuntimeEvent; type TechAssetId = TechAssetId; diff --git a/runtime/src/migrations.rs b/runtime/src/migrations.rs index 05246c2e14..d585fd26ba 100644 --- a/runtime/src/migrations.rs +++ b/runtime/src/migrations.rs @@ -31,6 +31,7 @@ use crate::*; pub type Migrations = ( + technical::migrations::set_onchain_identity::SetOnChainIdentity, assets::migration::asset_infos_v2::AssetInfosUpdate, WipMigrations, ); From f23dd968dbe462b40340492ba6e2b4c3916abed6 Mon Sep 17 00:00:00 2001 From: Haidar Jbeily Date: Tue, 13 Aug 2024 03:36:39 +0300 Subject: [PATCH 5/6] Add Identity Pallet to all mocks --- Cargo.lock | 28 +++++++++++++++++++ pallets/apollo-platform/Cargo.toml | 1 + pallets/apollo-platform/src/mock.rs | 3 ++ pallets/bridge-proxy/Cargo.toml | 2 +- pallets/bridge-proxy/src/mock.rs | 1 + pallets/ceres-governance-platform/Cargo.toml | 1 + pallets/ceres-governance-platform/src/mock.rs | 9 ++++-- pallets/ceres-launchpad/Cargo.toml | 1 + pallets/ceres-launchpad/src/mock.rs | 10 +++++-- pallets/ceres-liquidity-locker/Cargo.toml | 1 + .../benchmarking/Cargo.toml | 1 + .../benchmarking/src/mock.rs | 7 +++-- pallets/ceres-liquidity-locker/src/mock.rs | 8 ++++-- pallets/ceres-staking/src/mock.rs | 1 + pallets/ceres-token-locker/Cargo.toml | 1 + pallets/ceres-token-locker/src/mock.rs | 9 ++++-- pallets/demeter-farming-platform/Cargo.toml | 1 + .../benchmarking/Cargo.toml | 1 + .../benchmarking/src/mock.rs | 11 +++++--- pallets/demeter-farming-platform/src/mock.rs | 11 +++++--- pallets/dex-api/Cargo.toml | 1 + pallets/dex-api/src/mock.rs | 10 +++++-- pallets/extended-assets/Cargo.toml | 1 + pallets/extended-assets/src/mock.rs | 12 ++++---- pallets/farming/Cargo.toml | 1 + pallets/farming/src/mock.rs | 8 ++++-- pallets/faucet/Cargo.toml | 1 + pallets/faucet/src/mock.rs | 9 ++++-- pallets/hermes-governance-platform/Cargo.toml | 1 + .../hermes-governance-platform/src/mock.rs | 9 ++++-- pallets/iroha-migration/Cargo.toml | 1 + pallets/iroha-migration/src/mock.rs | 11 +++++--- pallets/kensetsu/Cargo.toml | 1 + pallets/kensetsu/src/mock.rs | 16 +++++++---- pallets/liquidity-proxy/Cargo.toml | 1 + .../liquidity-proxy/benchmarking/Cargo.toml | 1 + .../liquidity-proxy/benchmarking/src/mock.rs | 11 +++++--- pallets/mock-liquidity-source/Cargo.toml | 1 + pallets/mock-liquidity-source/src/mock.rs | 11 +++++--- .../Cargo.toml | 1 + .../src/mock.rs | 12 ++++---- pallets/pool-xyk/benchmarking/Cargo.toml | 1 + pallets/pool-xyk/benchmarking/src/mock.rs | 7 +++-- pallets/price-tools/Cargo.toml | 1 + pallets/price-tools/src/mock.rs | 11 +++++--- pallets/pswap-distribution/Cargo.toml | 2 +- .../benchmarking/Cargo.toml | 1 + .../benchmarking/src/mock.rs | 10 +++++-- pallets/pswap-distribution/src/mock.rs | 9 ++++-- pallets/rewards/Cargo.toml | 1 + pallets/rewards/src/mock.rs | 9 ++++-- pallets/soratopia/Cargo.toml | 1 + pallets/soratopia/src/mock.rs | 5 +++- pallets/vested-rewards/Cargo.toml | 1 + pallets/vested-rewards/src/mock.rs | 11 +++++--- pallets/xst/Cargo.toml | 1 + pallets/xst/benchmarking/Cargo.toml | 1 + pallets/xst/benchmarking/src/mock.rs | 11 +++++--- pallets/xst/src/mock.rs | 11 +++++--- 59 files changed, 230 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 677fc42f92..92dcae388f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,6 +280,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -1377,6 +1378,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -1410,6 +1412,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -1441,6 +1444,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -1473,6 +1477,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -1527,6 +1532,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -2229,6 +2235,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -2261,6 +2268,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -2416,6 +2424,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -3074,6 +3083,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -3123,6 +3133,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-scheduler", "pallet-timestamp", "parity-scale-codec", @@ -3189,6 +3200,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "parity-scale-codec", "permissions", "rewards", @@ -4251,6 +4263,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -4696,6 +4709,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-multisig 4.0.0-dev", "parity-scale-codec", "parity-util-mem", @@ -4965,6 +4979,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -5739,6 +5754,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -5777,6 +5793,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -6073,6 +6090,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "parity-scale-codec", "permissions", "scale-info", @@ -6176,6 +6194,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -7758,6 +7777,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -7856,6 +7876,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -8065,6 +8086,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -8095,6 +8117,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -8546,6 +8569,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "parity-scale-codec", "permissions", "scale-info", @@ -10444,6 +10468,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "parity-scale-codec", "permissions", "scale-info", @@ -12329,6 +12354,7 @@ dependencies = [ "orml-tokens", "orml-traits", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -13495,6 +13521,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", @@ -13532,6 +13559,7 @@ dependencies = [ "orml-currencies", "orml-tokens", "pallet-balances", + "pallet-identity", "pallet-timestamp", "parity-scale-codec", "permissions", diff --git a/pallets/apollo-platform/Cargo.toml b/pallets/apollo-platform/Cargo.toml index 38b5bc0e03..edbef6704f 100644 --- a/pallets/apollo-platform/Cargo.toml +++ b/pallets/apollo-platform/Cargo.toml @@ -42,6 +42,7 @@ currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-lib dex-manager = { path = "../dex-manager", default-features = false } apollo-platform = { path = ".", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits", default-features = false } diff --git a/pallets/apollo-platform/src/mock.rs b/pallets/apollo-platform/src/mock.rs index 0fffb9749f..baa71ad91b 100644 --- a/pallets/apollo-platform/src/mock.rs +++ b/pallets/apollo-platform/src/mock.rs @@ -1,3 +1,4 @@ +use common::mock_pallet_identity_config; use { crate as apollo_platform, common::{ @@ -84,6 +85,7 @@ construct_runtime! { Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, DexManager: dex_manager::{Pallet, Call, Config, Storage}, PriceTools: price_tools::{Pallet, Storage, Event}, + Identity: pallet_identity::{Pallet, Storage, Event}, } } @@ -96,6 +98,7 @@ mock_technical_config!(Runtime, pool_xyk::PolySwapAction SendTransactionTypes for Runtime where diff --git a/pallets/bridge-proxy/Cargo.toml b/pallets/bridge-proxy/Cargo.toml index 6f63f70d04..fd6bbee3b9 100644 --- a/pallets/bridge-proxy/Cargo.toml +++ b/pallets/bridge-proxy/Cargo.toml @@ -37,7 +37,7 @@ bridge-channel = { git = "https://github.com/sora-xor/sora2-common.git" } sp-keyring = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } -pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits" } diff --git a/pallets/bridge-proxy/src/mock.rs b/pallets/bridge-proxy/src/mock.rs index 7c331dfc72..91ef153dbc 100644 --- a/pallets/bridge-proxy/src/mock.rs +++ b/pallets/bridge-proxy/src/mock.rs @@ -81,6 +81,7 @@ frame_support::construct_runtime!( BridgeOutboundChannel: bridge_channel::outbound::{Pallet, Config, Storage, Event}, FungibleApp: evm_fungible_app::{Pallet, Call, Config, Storage, Event}, BridgeProxy: proxy::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } ); diff --git a/pallets/ceres-governance-platform/Cargo.toml b/pallets/ceres-governance-platform/Cargo.toml index b89c1a8598..fe05ff9be8 100644 --- a/pallets/ceres-governance-platform/Cargo.toml +++ b/pallets/ceres-governance-platform/Cargo.toml @@ -38,6 +38,7 @@ currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-lib dex-manager = { path = "../dex-manager", default-features = false } ceres-governance-platform = { path = ".", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits", default-features = false } diff --git a/pallets/ceres-governance-platform/src/mock.rs b/pallets/ceres-governance-platform/src/mock.rs index da2fee9fe8..79a2f498c1 100644 --- a/pallets/ceres-governance-platform/src/mock.rs +++ b/pallets/ceres-governance-platform/src/mock.rs @@ -3,15 +3,16 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::Balance; use common::{ balance, fixed, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, ContentSource, - Description, Fixed, CERES_ASSET_ID, PSWAP, TBCD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, + ContentSource, Description, Fixed, CERES_ASSET_ID, PSWAP, TBCD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, Hooks}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -45,6 +46,7 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, CeresGovernancePlatform: ceres_governance_platform::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -67,6 +69,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/ceres-launchpad/Cargo.toml b/pallets/ceres-launchpad/Cargo.toml index 0e90a87464..bc8f63c3c3 100644 --- a/pallets/ceres-launchpad/Cargo.toml +++ b/pallets/ceres-launchpad/Cargo.toml @@ -43,6 +43,7 @@ demeter-farming-platform = { path = "../demeter-farming-platform" } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } permissions = { path = "../permissions" } technical = { path = "../technical" } pswap-distribution = { path = "../pswap-distribution" } diff --git a/pallets/ceres-launchpad/src/mock.rs b/pallets/ceres-launchpad/src/mock.rs index 68fd08df1d..8b0459b73e 100644 --- a/pallets/ceres-launchpad/src/mock.rs +++ b/pallets/ceres-launchpad/src/mock.rs @@ -5,15 +5,17 @@ pub use common::TechAssetId as Tas; pub use common::TechPurpose::*; use common::{ balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetName, AssetSymbol, BalancePrecision, ContentSource, DEXId, DEXInfo, - Description, Fixed, CERES_ASSET_ID, PSWAP, TBCD, XOR, XST, XSTUSD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetName, AssetSymbol, BalancePrecision, + ContentSource, DEXId, DEXInfo, Description, Fixed, CERES_ASSET_ID, PSWAP, TBCD, XOR, XST, + XSTUSD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, Hooks}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use permissions::{Scope, MANAGE_DEX}; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -56,6 +58,7 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, CeresLaunchpad: ceres_launchpad::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -74,6 +77,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/ceres-liquidity-locker/Cargo.toml b/pallets/ceres-liquidity-locker/Cargo.toml index f38af7e9a3..b35c1a93ac 100644 --- a/pallets/ceres-liquidity-locker/Cargo.toml +++ b/pallets/ceres-liquidity-locker/Cargo.toml @@ -38,6 +38,7 @@ demeter-farming-platform = { path = "../demeter-farming-platform", default-featu dex-manager = { path = "../dex-manager", default-features = false } ceres-liquidity-locker = { path = ".", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits", default-features = false } diff --git a/pallets/ceres-liquidity-locker/benchmarking/Cargo.toml b/pallets/ceres-liquidity-locker/benchmarking/Cargo.toml index 6e41496e04..7c783238a4 100644 --- a/pallets/ceres-liquidity-locker/benchmarking/Cargo.toml +++ b/pallets/ceres-liquidity-locker/benchmarking/Cargo.toml @@ -40,6 +40,7 @@ ceres-liquidity-locker = { path = "../../ceres-liquidity-locker" } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } dex-manager = { path = "../../dex-manager" } dex-api = { path = "../../dex-api" } currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } diff --git a/pallets/ceres-liquidity-locker/benchmarking/src/mock.rs b/pallets/ceres-liquidity-locker/benchmarking/src/mock.rs index f216c62787..e81dfcccc4 100644 --- a/pallets/ceres-liquidity-locker/benchmarking/src/mock.rs +++ b/pallets/ceres-liquidity-locker/benchmarking/src/mock.rs @@ -5,8 +5,8 @@ use crate::{Config, *}; use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::{ fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, DEXId, DEXInfo, Fixed, PSWAP, TBCD, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, DEXId, DEXInfo, Fixed, PSWAP, TBCD, XST, }; use currencies::BasicCurrencyAdapter; @@ -16,6 +16,7 @@ use frame_system; use common::prelude::Balance; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use permissions::{Scope, BURN, MANAGE_DEX, MINT}; use sp_core::H256; use sp_runtime::testing::Header; @@ -43,6 +44,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; @@ -80,6 +82,7 @@ construct_runtime! { PswapDistribution: pswap_distribution::{Pallet, Call, Config, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } diff --git a/pallets/ceres-liquidity-locker/src/mock.rs b/pallets/ceres-liquidity-locker/src/mock.rs index 9037a83b11..3d55dfee80 100644 --- a/pallets/ceres-liquidity-locker/src/mock.rs +++ b/pallets/ceres-liquidity-locker/src/mock.rs @@ -4,14 +4,15 @@ use common::mock::GetTradingPairRestrictedFlag; use common::prelude::{Balance, Fixed}; use common::{ balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, DEXId, DEXInfo, - TBCD, XOR, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, DEXId, DEXInfo, TBCD, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, Hooks}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system; +use frame_system::EnsureRoot; use hex_literal::hex; use orml_traits::parameter_type_with_key; use permissions::{Scope, MANAGE_DEX}; @@ -88,6 +89,7 @@ construct_runtime! { PoolXYK: pool_xyk::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -97,7 +99,7 @@ mock_technical_config!(Runtime, pool_xyk::PolySwapAction}, CeresTokenLocker: ceres_token_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -68,6 +70,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/demeter-farming-platform/Cargo.toml b/pallets/demeter-farming-platform/Cargo.toml index 46ac431374..2ce094f73b 100644 --- a/pallets/demeter-farming-platform/Cargo.toml +++ b/pallets/demeter-farming-platform/Cargo.toml @@ -41,6 +41,7 @@ currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-lib sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } permissions = { path = "../permissions" } technical = { path = "../technical" } pool-xyk = { path = "../pool-xyk" } diff --git a/pallets/demeter-farming-platform/benchmarking/Cargo.toml b/pallets/demeter-farming-platform/benchmarking/Cargo.toml index 5d73237777..209474ff03 100644 --- a/pallets/demeter-farming-platform/benchmarking/Cargo.toml +++ b/pallets/demeter-farming-platform/benchmarking/Cargo.toml @@ -43,6 +43,7 @@ common = { path = "../../../common", features = ["test"] } ceres-liquidity-locker = { path = "../../ceres-liquidity-locker" } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } vested-rewards = { path = "../../vested-rewards" } diff --git a/pallets/demeter-farming-platform/benchmarking/src/mock.rs b/pallets/demeter-farming-platform/benchmarking/src/mock.rs index cad8e386f6..c5c8b583c7 100644 --- a/pallets/demeter-farming-platform/benchmarking/src/mock.rs +++ b/pallets/demeter-farming-platform/benchmarking/src/mock.rs @@ -6,9 +6,9 @@ use common::prelude::Balance; pub use common::TechAssetId as Tas; use common::{ balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, DEXId, DEXInfo, Fixed, CERES_ASSET_ID, DEMETER_ASSET_ID, PSWAP, TBCD, XOR, - XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, DEXId, DEXInfo, Fixed, CERES_ASSET_ID, + DEMETER_ASSET_ID, PSWAP, TBCD, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; @@ -16,6 +16,7 @@ use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use permissions::{Scope, MANAGE_DEX}; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -54,7 +55,8 @@ construct_runtime! { MBCPool: multicollateral_bonding_curve_pool::{Pallet, Call, Config, Storage, Event}, VestedRewards: vested_rewards::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, - DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event} + DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -69,6 +71,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/demeter-farming-platform/src/mock.rs b/pallets/demeter-farming-platform/src/mock.rs index 0d8444df0a..afa4f593c8 100644 --- a/pallets/demeter-farming-platform/src/mock.rs +++ b/pallets/demeter-farming-platform/src/mock.rs @@ -3,9 +3,9 @@ use common::prelude::Balance; pub use common::TechAssetId as Tas; use common::{ balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, DEXId, DEXInfo, Fixed, CERES_ASSET_ID, DEMETER_ASSET_ID, PSWAP, TBCD, XOR, - XST, XSTUSD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, DEXId, DEXInfo, Fixed, CERES_ASSET_ID, + DEMETER_ASSET_ID, PSWAP, TBCD, XOR, XST, XSTUSD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, Hooks}; @@ -13,6 +13,7 @@ use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use permissions::{Scope, MANAGE_DEX}; use sp_core::H256; use sp_runtime::testing::Header; @@ -50,7 +51,8 @@ construct_runtime! { MBCPool: multicollateral_bonding_curve_pool::{Pallet, Call, Config, Storage, Event}, VestedRewards: vested_rewards::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, - DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event} + DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -67,6 +69,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/dex-api/Cargo.toml b/pallets/dex-api/Cargo.toml index d9ab933c14..7346637522 100644 --- a/pallets/dex-api/Cargo.toml +++ b/pallets/dex-api/Cargo.toml @@ -24,6 +24,7 @@ frame-support = { git = "https://github.com/sora-xor/substrate.git", branch = "p frame-system = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } mock-liquidity-source = { path = "../mock-liquidity-source", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-std = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } strum = { version = "0.25.0", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } diff --git a/pallets/dex-api/src/mock.rs b/pallets/dex-api/src/mock.rs index d550e6b5c8..87b28b7aac 100644 --- a/pallets/dex-api/src/mock.rs +++ b/pallets/dex-api/src/mock.rs @@ -35,8 +35,9 @@ use common::prelude::{Balance, QuoteAmount, SwapAmount, SwapOutcome}; use common::{ balance, fixed, fixed_from_basis_points, hash, mock_assets_config, mock_common_config, mock_currencies_config, mock_frame_system_config, mock_pallet_balances_config, - mock_technical_config, mock_tokens_config, Amount, AssetId32, DEXId, DEXInfo, Fixed, - LiquiditySource, LiquiditySourceType, RewardReason, DOT, KSM, PSWAP, TBCD, XOR, XST, + mock_pallet_identity_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, + DEXId, DEXInfo, Fixed, LiquiditySource, LiquiditySourceType, RewardReason, DOT, KSM, PSWAP, + TBCD, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::sp_runtime::DispatchError; @@ -44,6 +45,7 @@ use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use permissions::{Scope, INIT_DEX, MANAGE_DEX}; use sp_core::crypto::AccountId32; @@ -81,6 +83,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; @@ -127,7 +130,8 @@ construct_runtime! { PoolXYK: pool_xyk::{Pallet, Call, Storage, Event}, PswapDistribution: pswap_distribution::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, - DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event} + DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } diff --git a/pallets/extended-assets/Cargo.toml b/pallets/extended-assets/Cargo.toml index 80efe2cfe8..537b74433a 100644 --- a/pallets/extended-assets/Cargo.toml +++ b/pallets/extended-assets/Cargo.toml @@ -30,6 +30,7 @@ technical = { path = "../technical", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } hex-literal = { version = "0.4.1"} diff --git a/pallets/extended-assets/src/mock.rs b/pallets/extended-assets/src/mock.rs index da98e7a4e8..27cad2d4de 100644 --- a/pallets/extended-assets/src/mock.rs +++ b/pallets/extended-assets/src/mock.rs @@ -31,19 +31,19 @@ use crate::{self as extended_assets}; use common::mock::ExistentialDeposits; use common::{ - mock_common_config, mock_currencies_config, mock_frame_system_config, - mock_pallet_balances_config, mock_pallet_timestamp_config, mock_permissions_config, - mock_technical_config, mock_tokens_config, Amount, AssetId32, DEXId, LiquiditySourceType, - PredefinedAssetId, XOR, XST, + balance, mock_common_config, mock_currencies_config, mock_frame_system_config, + mock_pallet_balances_config, mock_pallet_identity_config, mock_pallet_timestamp_config, + mock_permissions_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, DEXId, + LiquiditySourceType, PredefinedAssetId, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::Everything; use frame_support::{construct_runtime, parameter_types}; +use frame_system::EnsureRoot; use hex_literal::hex; use sp_core::{ConstU32, H256}; use sp_runtime::testing::Header; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; - use sp_runtime::traits::{IdentifyAccount, Verify}; use sp_runtime::MultiSignature; @@ -66,6 +66,7 @@ mock_frame_system_config!(TestRuntime); mock_permissions_config!(TestRuntime); mock_technical_config!(TestRuntime); mock_pallet_timestamp_config!(TestRuntime); +mock_pallet_identity_config!(TestRuntime); parameter_types! { pub const GetBaseAssetId: AssetId = XOR; @@ -123,6 +124,7 @@ construct_runtime! { ExtendedAssets: extended_assets::{Pallet, Storage, Event, Call}, Technical: technical::{Pallet, Call, Config, Event}, Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } diff --git a/pallets/farming/Cargo.toml b/pallets/farming/Cargo.toml index 7784c1f916..31f8d04b01 100644 --- a/pallets/farming/Cargo.toml +++ b/pallets/farming/Cargo.toml @@ -43,6 +43,7 @@ demeter-farming-platform = { path = "../demeter-farming-platform", default-featu env_logger = "0.10.0" hex-literal = { version = "0.4.1" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } pallet-scheduler = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } diff --git a/pallets/farming/src/mock.rs b/pallets/farming/src/mock.rs index 0a245efe46..d234f0d6d8 100644 --- a/pallets/farming/src/mock.rs +++ b/pallets/farming/src/mock.rs @@ -33,9 +33,9 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::Balance; use common::{ balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetName, AssetSymbol, DEXId, DEXInfo, Fixed, DEFAULT_BALANCE_PRECISION, - DOT, PSWAP, TBCD, VAL, XOR, XST, XSTUSD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetName, AssetSymbol, DEXId, DEXInfo, Fixed, + DEFAULT_BALANCE_PRECISION, DOT, PSWAP, TBCD, VAL, XOR, XST, XSTUSD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, OnFinalize, OnInitialize, PrivilegeCmp}; @@ -150,6 +150,7 @@ construct_runtime! { VestedRewards: vested_rewards::{Pallet, Storage, Event}, Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event}, Farming: farming::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, } @@ -162,6 +163,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl permissions::Config for Runtime { type RuntimeEvent = RuntimeEvent; diff --git a/pallets/faucet/Cargo.toml b/pallets/faucet/Cargo.toml index d6b8c5f45c..2aec3dfcb0 100644 --- a/pallets/faucet/Cargo.toml +++ b/pallets/faucet/Cargo.toml @@ -32,6 +32,7 @@ technical = { path = "../technical", default-features = false } [dev-dependencies] currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } diff --git a/pallets/faucet/src/mock.rs b/pallets/faucet/src/mock.rs index 14f7405b8e..0cbf02104c 100644 --- a/pallets/faucet/src/mock.rs +++ b/pallets/faucet/src/mock.rs @@ -33,14 +33,15 @@ use common::mock::ExistentialDeposits; use common::prelude::{Balance, FixedWrapper}; use common::{ self, balance, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, TechPurpose, - DEFAULT_BALANCE_PRECISION, USDT, VAL, XOR, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, + TechPurpose, DEFAULT_BALANCE_PRECISION, USDT, VAL, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; +use frame_system::EnsureRoot; use permissions::{Scope, BURN, MINT}; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -101,6 +102,7 @@ construct_runtime! { Balances: pallet_balances::{Pallet, Call, Config, Storage, Event}, Tokens: tokens::{Pallet, Call, Config, Storage, Event}, Rewards: rewards::{Pallet, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -113,6 +115,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl Config for Runtime { type RuntimeEvent = RuntimeEvent; diff --git a/pallets/hermes-governance-platform/Cargo.toml b/pallets/hermes-governance-platform/Cargo.toml index aceea23e4d..340dd47594 100644 --- a/pallets/hermes-governance-platform/Cargo.toml +++ b/pallets/hermes-governance-platform/Cargo.toml @@ -39,6 +39,7 @@ currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-lib hermes-governance-platform = { path = ".", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-traits", default-features = false } permissions = { path = "../permissions" } pool-xyk = { path = "../pool-xyk", default-features = false } diff --git a/pallets/hermes-governance-platform/src/mock.rs b/pallets/hermes-governance-platform/src/mock.rs index 65073f2f1a..5f1522d04c 100644 --- a/pallets/hermes-governance-platform/src/mock.rs +++ b/pallets/hermes-governance-platform/src/mock.rs @@ -5,9 +5,9 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::Balance; use common::{ balance, fixed, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, ContentSource, - Description, Fixed, HERMES_ASSET_ID, PSWAP, TBCD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, + ContentSource, Description, Fixed, HERMES_ASSET_ID, PSWAP, TBCD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, Hooks}; @@ -15,6 +15,7 @@ use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -49,6 +50,7 @@ construct_runtime! { CeresGovernancePlatform: ceres_governance_platform::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, HermesGovernancePlatform: hermes_governance_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -77,6 +79,7 @@ pub struct OldHermesVotingInfo { pub hermes_withdrawn: bool, } +mock_pallet_identity_config!(Runtime); mock_technical_config!(Runtime, pool_xyk::PolySwapAction); mock_currencies_config!(Runtime); mock_pallet_balances_config!(Runtime); diff --git a/pallets/iroha-migration/Cargo.toml b/pallets/iroha-migration/Cargo.toml index c7076373a1..d52833d64c 100644 --- a/pallets/iroha-migration/Cargo.toml +++ b/pallets/iroha-migration/Cargo.toml @@ -39,6 +39,7 @@ eth-bridge = { path = "../eth-bridge", default-features = false } [dev-dependencies] currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } parity-util-mem = { version = "0.12.0", default-features = false, features = [ "primitive-types", ] } diff --git a/pallets/iroha-migration/src/mock.rs b/pallets/iroha-migration/src/mock.rs index 8ee40b200b..8938f4cfd4 100644 --- a/pallets/iroha-migration/src/mock.rs +++ b/pallets/iroha-migration/src/mock.rs @@ -34,14 +34,15 @@ use common::mock::ExistentialDeposits; use common::prelude::Balance; use common::{ balance, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, PredefinedAssetId, - DEFAULT_BALANCE_PRECISION, VAL, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, + PredefinedAssetId, DEFAULT_BALANCE_PRECISION, VAL, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; +use frame_system::EnsureRoot; use permissions::{Scope, MINT}; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -92,7 +93,8 @@ construct_runtime!( Technical: technical::{Pallet, Call, Config, Event}, Permissions: permissions::{Pallet, Call, Storage, Config, Event}, Referrals: referrals::{Pallet, Call, Storage, Config}, - IrohaMigration: iroha_migration::{Pallet, Call, Storage, Config, Event} + IrohaMigration: iroha_migration::{Pallet, Call, Storage, Config, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } ); @@ -105,6 +107,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const GetBuyBackAssetId: AssetId = XST; diff --git a/pallets/kensetsu/Cargo.toml b/pallets/kensetsu/Cargo.toml index 2fe283164e..65a9dfefe3 100644 --- a/pallets/kensetsu/Cargo.toml +++ b/pallets/kensetsu/Cargo.toml @@ -34,6 +34,7 @@ technical = { path = "../technical", default-features = false } common = { path = "../../common", features = ["test"] } currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } permissions = { path = "../permissions" } hex-literal = "0.4" sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } diff --git a/pallets/kensetsu/src/mock.rs b/pallets/kensetsu/src/mock.rs index c9eb5e120b..cbe03523ba 100644 --- a/pallets/kensetsu/src/mock.rs +++ b/pallets/kensetsu/src/mock.rs @@ -35,18 +35,20 @@ use common::mock::ExistentialDeposits; use common::prelude::{QuoteAmount, SwapAmount, SwapOutcome}; use common::{ balance, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_pallet_timestamp_config, - mock_permissions_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, - AssetInfoProvider, AssetName, AssetSymbol, DEXId, DataFeed, FromGenericPair, - LiquidityProxyTrait, LiquiditySourceFilter, LiquiditySourceType, PredefinedAssetId, - PriceToolsProvider, PriceVariant, Rate, SymbolName, TradingPairSourceManager, DAI, - DEFAULT_BALANCE_PRECISION, KARMA, KEN, KGOLD, KUSD, KXOR, TBCD, XOR, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_pallet_timestamp_config, mock_permissions_config, mock_technical_config, + mock_tokens_config, Amount, AssetId32, AssetInfoProvider, AssetName, AssetSymbol, DEXId, + DataFeed, FromGenericPair, LiquidityProxyTrait, LiquiditySourceFilter, LiquiditySourceType, + PredefinedAssetId, PriceToolsProvider, PriceVariant, Rate, SymbolName, + TradingPairSourceManager, DAI, DEFAULT_BALANCE_PRECISION, KARMA, KEN, KGOLD, KUSD, KXOR, TBCD, + XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::dispatch::DispatchResult; use frame_support::parameter_types; use frame_support::traits::{ConstU64, Everything, GenesisBuild, Randomness}; use frame_system::offchain::SendTransactionTypes; +use frame_system::EnsureRoot; use permissions::Scope; use sp_arithmetic::Percent; use sp_core::crypto::AccountId32; @@ -284,6 +286,7 @@ frame_support::construct_runtime!( Tokens: tokens::{Pallet, Call, Config, Storage, Event}, Permissions: permissions::{Pallet, Call, Config, Storage, Event}, Kensetsu: kensetsu::{Pallet, Call, Storage, Event, ValidateUnsigned}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } ); @@ -331,6 +334,7 @@ mock_permissions_config!(TestRuntime); mock_tokens_config!(TestRuntime); mock_pallet_timestamp_config!(TestRuntime); mock_technical_config!(TestRuntime); +mock_pallet_identity_config!(TestRuntime); impl kensetsu::Config for TestRuntime { type RuntimeEvent = RuntimeEvent; diff --git a/pallets/liquidity-proxy/Cargo.toml b/pallets/liquidity-proxy/Cargo.toml index b9f8b6ad28..1dd6c32947 100644 --- a/pallets/liquidity-proxy/Cargo.toml +++ b/pallets/liquidity-proxy/Cargo.toml @@ -21,6 +21,7 @@ traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library frame-support = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } frame-system = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-std = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } common = { path = "../../common", default-features = false } diff --git a/pallets/liquidity-proxy/benchmarking/Cargo.toml b/pallets/liquidity-proxy/benchmarking/Cargo.toml index 1a23f1c27d..9c25550252 100644 --- a/pallets/liquidity-proxy/benchmarking/Cargo.toml +++ b/pallets/liquidity-proxy/benchmarking/Cargo.toml @@ -39,6 +39,7 @@ dex-api = { path = "../../dex-api", default-features = false } [dev-dependencies] currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } ceres-liquidity-locker = { path = "../../ceres-liquidity-locker", default-features = false } demeter-farming-platform = { path = "../../demeter-farming-platform", default-features = false } serde = { version = "1.0.101", default-features = false, features = ["derive"] } diff --git a/pallets/liquidity-proxy/benchmarking/src/mock.rs b/pallets/liquidity-proxy/benchmarking/src/mock.rs index 02920ded91..ebe4da7330 100644 --- a/pallets/liquidity-proxy/benchmarking/src/mock.rs +++ b/pallets/liquidity-proxy/benchmarking/src/mock.rs @@ -38,10 +38,11 @@ use common::prelude::{Balance, QuoteAmount}; use common::{ balance, fixed, fixed_from_basis_points, hash, mock_assets_config, mock_common_config, mock_currencies_config, mock_frame_system_config, mock_pallet_balances_config, - mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, - BalancePrecision, ContentSource, DEXId, DEXInfo, Description, Fixed, FromGenericPair, - LiquidityProxyTrait, LiquiditySourceFilter, LiquiditySourceType, PriceToolsProvider, - PriceVariant, TechPurpose, DEFAULT_BALANCE_PRECISION, DOT, PSWAP, TBCD, USDT, VAL, XOR, XST, + mock_pallet_identity_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, + AssetName, AssetSymbol, BalancePrecision, ContentSource, DEXId, DEXInfo, Description, Fixed, + FromGenericPair, LiquidityProxyTrait, LiquiditySourceFilter, LiquiditySourceType, + PriceToolsProvider, PriceVariant, TechPurpose, DEFAULT_BALANCE_PRECISION, DOT, PSWAP, TBCD, + USDT, VAL, XOR, XST, }; use currencies::BasicCurrencyAdapter; use hex_literal::hex; @@ -134,11 +135,13 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, ExtendedAssets: extended_assets::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } mock_currencies_config!(Runtime); mock_pallet_balances_config!(Runtime); +mock_pallet_identity_config!(Runtime); mock_technical_config!(Runtime, pool_xyk::PolySwapAction); mock_frame_system_config!(Runtime); mock_common_config!(Runtime); diff --git a/pallets/mock-liquidity-source/Cargo.toml b/pallets/mock-liquidity-source/Cargo.toml index 043eb77d9e..1583f68cd0 100644 --- a/pallets/mock-liquidity-source/Cargo.toml +++ b/pallets/mock-liquidity-source/Cargo.toml @@ -34,6 +34,7 @@ technical = { path = "../technical", default-features = false } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } hex-literal = "0.4.1" common = { path = "../../common", features = ["test"] } diff --git a/pallets/mock-liquidity-source/src/mock.rs b/pallets/mock-liquidity-source/src/mock.rs index 74e4c48a7c..c4fce62081 100644 --- a/pallets/mock-liquidity-source/src/mock.rs +++ b/pallets/mock-liquidity-source/src/mock.rs @@ -32,15 +32,17 @@ use crate::{self as mock_liquidity_source, Config}; use common::mock::ExistentialDeposits; use common::prelude::Balance; use common::{ - self, fixed_from_basis_points, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, DEXId, DEXInfo, Fixed, XOR, XST, + self, balance, fixed_from_basis_points, mock_assets_config, mock_common_config, + mock_currencies_config, mock_frame_system_config, mock_pallet_balances_config, + mock_pallet_identity_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, + DEXId, DEXInfo, Fixed, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::sp_runtime::AccountId32; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; +use frame_system::EnsureRoot; use sp_core::H256; use sp_runtime::testing::Header; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; @@ -89,6 +91,7 @@ construct_runtime! { Balances: pallet_balances::{Pallet, Call, Storage, Event}, Permissions: permissions::{Pallet, Call, Config, Storage, Event}, DexManager: dex_manager::{Pallet, Call, Config, Storage}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -99,7 +102,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); - +mock_pallet_identity_config!(Runtime); impl Config for Runtime { type GetFee = GetFee; type EnsureDEXManager = dex_manager::Pallet; diff --git a/pallets/multicollateral-bonding-curve-pool/Cargo.toml b/pallets/multicollateral-bonding-curve-pool/Cargo.toml index 97f720adb5..d34961d493 100644 --- a/pallets/multicollateral-bonding-curve-pool/Cargo.toml +++ b/pallets/multicollateral-bonding-curve-pool/Cargo.toml @@ -42,6 +42,7 @@ ceres-liquidity-locker = { path = "../ceres-liquidity-locker", default-features demeter-farming-platform = { path = "../demeter-farming-platform", default-features = false } hex-literal = "0.4.1" pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } common = { path = "../../common", features = ["test"] } diff --git a/pallets/multicollateral-bonding-curve-pool/src/mock.rs b/pallets/multicollateral-bonding-curve-pool/src/mock.rs index a6ed7c3cc5..3f737342f4 100644 --- a/pallets/multicollateral-bonding-curve-pool/src/mock.rs +++ b/pallets/multicollateral-bonding-curve-pool/src/mock.rs @@ -37,10 +37,10 @@ use common::prelude::{ use common::{ self, balance, fixed, fixed_wrapper, hash, mock_assets_config, mock_common_config, mock_currencies_config, mock_frame_system_config, mock_pallet_balances_config, - mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, - BuyBackHandler, DEXInfo, Fixed, LiquidityProxyTrait, LiquiditySourceFilter, - LiquiditySourceType, PriceVariant, TechPurpose, Vesting, DAI, DEFAULT_BALANCE_PRECISION, PSWAP, - TBCD, USDT, VAL, XOR, XST, XSTUSD, + mock_pallet_identity_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, + AssetName, AssetSymbol, BuyBackHandler, DEXInfo, Fixed, LiquidityProxyTrait, + LiquiditySourceFilter, LiquiditySourceType, PriceVariant, TechPurpose, Vesting, DAI, + DEFAULT_BALANCE_PRECISION, PSWAP, TBCD, USDT, VAL, XOR, XST, XSTUSD, }; use currencies::BasicCurrencyAdapter; use frame_support::pallet_prelude::OptionQuery; @@ -48,6 +48,7 @@ use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types, Blake2_128Concat}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use orml_traits::MultiCurrency; use permissions::{Scope, INIT_DEX, MANAGE_DEX}; @@ -155,6 +156,7 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, PriceTools: price_tools::{Pallet, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -165,7 +167,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); - +mock_pallet_identity_config!(Runtime); impl dex_manager::Config for Runtime {} impl trading_pair::Config for Runtime { diff --git a/pallets/pool-xyk/benchmarking/Cargo.toml b/pallets/pool-xyk/benchmarking/Cargo.toml index 2a0d2abaea..5c86fee9c5 100644 --- a/pallets/pool-xyk/benchmarking/Cargo.toml +++ b/pallets/pool-xyk/benchmarking/Cargo.toml @@ -37,6 +37,7 @@ serde = { version = "1.0.101", default-features = false, features = ["derive"] } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } dex-manager = { path = "../../dex-manager", default-features = false } dex-api = { path = "../../dex-api", default-features = false } currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies", default-features = false } diff --git a/pallets/pool-xyk/benchmarking/src/mock.rs b/pallets/pool-xyk/benchmarking/src/mock.rs index b13a8e847a..a102247ca4 100644 --- a/pallets/pool-xyk/benchmarking/src/mock.rs +++ b/pallets/pool-xyk/benchmarking/src/mock.rs @@ -34,8 +34,8 @@ use crate::{Config, *}; use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::{ fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, DEXId, DEXInfo, Fixed, PSWAP, TBCD, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, DEXId, DEXInfo, Fixed, PSWAP, TBCD, XST, }; use currencies::BasicCurrencyAdapter; @@ -45,6 +45,7 @@ use frame_system; use common::prelude::Balance; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use permissions::{Scope, BURN, MANAGE_DEX, MINT}; use sp_core::{ConstU32, H256}; use sp_runtime::testing::Header; @@ -103,6 +104,7 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, ExtendedAssets: extended_assets::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -113,6 +115,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const GetBuyBackAssetId: AssetId = TBCD; diff --git a/pallets/price-tools/Cargo.toml b/pallets/price-tools/Cargo.toml index 9ccf78e101..fb24e3ce0e 100644 --- a/pallets/price-tools/Cargo.toml +++ b/pallets/price-tools/Cargo.toml @@ -37,6 +37,7 @@ ceres-liquidity-locker = { path = "../ceres-liquidity-locker", default-features demeter-farming-platform = { path = "../demeter-farming-platform", default-features = false } hex-literal = "0.4.1" pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } common = { path = "../../common", features = ["test"] } dex-manager = { path = "../dex-manager" } mock-liquidity-source = { path = "../mock-liquidity-source" } diff --git a/pallets/price-tools/src/mock.rs b/pallets/price-tools/src/mock.rs index aebaa93ad0..4de7fe7eac 100644 --- a/pallets/price-tools/src/mock.rs +++ b/pallets/price-tools/src/mock.rs @@ -33,16 +33,17 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::{Balance, QuoteAmount, SwapAmount, SwapOutcome}; use common::{ self, balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, DEXInfo, Fixed, - LiquidityProxyTrait, LiquiditySourceFilter, LiquiditySourceType, DEFAULT_BALANCE_PRECISION, - ETH, PSWAP, TBCD, USDT, VAL, XOR, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, DEXInfo, + Fixed, LiquidityProxyTrait, LiquiditySourceFilter, LiquiditySourceType, + DEFAULT_BALANCE_PRECISION, ETH, PSWAP, TBCD, USDT, VAL, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use permissions::{Scope, INIT_DEX, MANAGE_DEX}; use sp_core::crypto::AccountId32; @@ -123,6 +124,7 @@ construct_runtime! { PriceTools: price_tools::{Pallet, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -133,6 +135,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl dex_manager::Config for Runtime {} diff --git a/pallets/pswap-distribution/Cargo.toml b/pallets/pswap-distribution/Cargo.toml index 7e539667be..7c14ee4352 100644 --- a/pallets/pswap-distribution/Cargo.toml +++ b/pallets/pswap-distribution/Cargo.toml @@ -39,7 +39,7 @@ ceres-liquidity-locker = { path = "../ceres-liquidity-locker", default-features demeter-farming-platform = { path = "../demeter-farming-platform", default-features = false } hex-literal = { version = '0.4.1' } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } - +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } common = { path = "../../common", features = ["test"] } dex-manager = { path = "../dex-manager" } mock-liquidity-source = { path = "../mock-liquidity-source" } diff --git a/pallets/pswap-distribution/benchmarking/Cargo.toml b/pallets/pswap-distribution/benchmarking/Cargo.toml index 564923b77d..4543994bc9 100644 --- a/pallets/pswap-distribution/benchmarking/Cargo.toml +++ b/pallets/pswap-distribution/benchmarking/Cargo.toml @@ -41,6 +41,7 @@ currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-lib demeter-farming-platform = { path = "../../demeter-farming-platform", default-features = false } hex-literal = { version = '0.4.1' } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } serde = { version = "1.0.101", features = ["derive"] } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } diff --git a/pallets/pswap-distribution/benchmarking/src/mock.rs b/pallets/pswap-distribution/benchmarking/src/mock.rs index e27c9e33eb..ecc056ea6a 100644 --- a/pallets/pswap-distribution/benchmarking/src/mock.rs +++ b/pallets/pswap-distribution/benchmarking/src/mock.rs @@ -32,15 +32,17 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::Balance; use common::{ balance, fixed, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetName, AssetSymbol, BalancePrecision, ContentSource, Description, - Fixed, FromGenericPair, DEFAULT_BALANCE_PRECISION, PSWAP, TBCD, XOR, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetName, AssetSymbol, BalancePrecision, + ContentSource, Description, Fixed, FromGenericPair, DEFAULT_BALANCE_PRECISION, PSWAP, TBCD, + XOR, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system; +use frame_system::EnsureRoot; use hex_literal::hex; use permissions::Scope; use sp_core::H256; @@ -141,6 +143,7 @@ construct_runtime! { PoolXYK: pool_xyk::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -151,6 +154,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl Config for Runtime {} diff --git a/pallets/pswap-distribution/src/mock.rs b/pallets/pswap-distribution/src/mock.rs index 0bcc62432b..e5bc7fecd1 100644 --- a/pallets/pswap-distribution/src/mock.rs +++ b/pallets/pswap-distribution/src/mock.rs @@ -33,9 +33,9 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::Balance; use common::{ balance, fixed, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetName, AssetSymbol, BalancePrecision, ContentSource, Description, - Fixed, FromGenericPair, DEFAULT_BALANCE_PRECISION, PSWAP, TBCD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetName, AssetSymbol, BalancePrecision, + ContentSource, Description, Fixed, FromGenericPair, DEFAULT_BALANCE_PRECISION, PSWAP, TBCD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; @@ -43,6 +43,7 @@ use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use permissions::Scope; use sp_core::H256; @@ -150,6 +151,7 @@ construct_runtime! { PoolXYK: pool_xyk::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -160,6 +162,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl Config for Runtime { const PSWAP_BURN_PERCENT: Percent = Percent::from_percent(3); diff --git a/pallets/rewards/Cargo.toml b/pallets/rewards/Cargo.toml index ea8dc49c29..7bb1b336e4 100644 --- a/pallets/rewards/Cargo.toml +++ b/pallets/rewards/Cargo.toml @@ -37,6 +37,7 @@ technical = { path = "../technical", default-features = false } [dev-dependencies] currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-runtime = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens" } diff --git a/pallets/rewards/src/mock.rs b/pallets/rewards/src/mock.rs index df84876d55..816a6ac2bb 100644 --- a/pallets/rewards/src/mock.rs +++ b/pallets/rewards/src/mock.rs @@ -32,6 +32,7 @@ use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild, OnFinalize, OnInitialize}; use frame_support::weights::{RuntimeDbWeight, Weight}; use frame_support::{construct_runtime, parameter_types}; +use frame_system::EnsureRoot; use hex_literal::hex; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -43,9 +44,9 @@ use common::mock::ExistentialDeposits; use common::prelude::{Balance, OnValBurned}; use common::{ self, balance, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, TechPurpose, - DEFAULT_BALANCE_PRECISION, PSWAP, VAL, XOR, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, + TechPurpose, DEFAULT_BALANCE_PRECISION, PSWAP, VAL, XOR, XST, }; use permissions::{Scope, BURN, MINT}; @@ -102,6 +103,7 @@ construct_runtime! { System: frame_system::{Pallet, Call, Config, Storage, Event}, Technical: technical::{Pallet, Call, Config, Storage, Event}, Tokens: tokens::{Pallet, Call, Config, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -114,6 +116,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl Config for Runtime { const BLOCKS_PER_DAY: BlockNumber = 20; diff --git a/pallets/soratopia/Cargo.toml b/pallets/soratopia/Cargo.toml index 50cd814624..4f9f27cc63 100644 --- a/pallets/soratopia/Cargo.toml +++ b/pallets/soratopia/Cargo.toml @@ -33,6 +33,7 @@ common = { path = "../../common", features = ["test"] } currencies = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-currencies" } hex-literal = "0.4" pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } permissions = { path = "../permissions" } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } technical = { path = "../technical", default-features = false } diff --git a/pallets/soratopia/src/mock.rs b/pallets/soratopia/src/mock.rs index d3fac7c626..c987972e8e 100644 --- a/pallets/soratopia/src/mock.rs +++ b/pallets/soratopia/src/mock.rs @@ -31,7 +31,7 @@ use crate as soratopia; use common::mock::ExistentialDeposits; -use common::Amount; +use common::{balance, mock_pallet_identity_config, Amount}; use common::{ mock_assets_config, mock_common_config, mock_currencies_config, mock_frame_system_config, mock_pallet_balances_config, mock_permissions_config, mock_technical_config, @@ -41,6 +41,7 @@ use currencies::BasicCurrencyAdapter; use frame_support::parameter_types; use frame_support::traits::Everything; use frame_system::offchain::SendTransactionTypes; +use frame_system::EnsureRoot; use hex_literal::hex; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -73,6 +74,7 @@ frame_support::construct_runtime!( Tokens: tokens::{Pallet, Call, Config, Storage, Event}, Permissions: permissions::{Pallet, Call, Config, Storage, Event}, Soratopia: soratopia::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } ); @@ -99,6 +101,7 @@ mock_frame_system_config!(TestRuntime); mock_permissions_config!(TestRuntime); mock_tokens_config!(TestRuntime); mock_technical_config!(TestRuntime); +mock_pallet_identity_config!(TestRuntime); parameter_types! { pub AdminAccount: AccountId = hex!("8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48").into(); diff --git a/pallets/vested-rewards/Cargo.toml b/pallets/vested-rewards/Cargo.toml index 57460c9c61..9f8d360eaa 100644 --- a/pallets/vested-rewards/Cargo.toml +++ b/pallets/vested-rewards/Cargo.toml @@ -40,6 +40,7 @@ pallet-timestamp = { git = "https://github.com/sora-xor/substrate.git", branch = [dev-dependencies] pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } assets = { path = "../assets" } common = { path = "../../common", features = ["test"] } ceres-liquidity-locker = { path = "../ceres-liquidity-locker", default-features = false } diff --git a/pallets/vested-rewards/src/mock.rs b/pallets/vested-rewards/src/mock.rs index 413c449116..dc091a5c5b 100644 --- a/pallets/vested-rewards/src/mock.rs +++ b/pallets/vested-rewards/src/mock.rs @@ -34,16 +34,17 @@ use common::prelude::{Balance, DEXInfo}; use common::prelude::{LiquiditySourceType, QuoteAmount, SwapAmount, SwapOutcome}; use common::{ balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, ContentSource, DEXId, - Description, Fixed, LiquidityProxyTrait, LiquiditySourceFilter, DEFAULT_BALANCE_PRECISION, DOT, - KSM, PSWAP, TBCD, XOR, XST, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, AssetId32, AssetName, AssetSymbol, BalancePrecision, + ContentSource, DEXId, Description, Fixed, LiquidityProxyTrait, LiquiditySourceFilter, + DEFAULT_BALANCE_PRECISION, DOT, KSM, PSWAP, TBCD, XOR, XST, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use permissions::{Scope, INIT_DEX, MANAGE_DEX}; use sp_core::crypto::AccountId32; use sp_core::H256; @@ -75,6 +76,7 @@ construct_runtime! { MBCPool: multicollateral_bonding_curve_pool::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -138,6 +140,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); parameter_types! { pub const BlockHashCount: u64 = 250; diff --git a/pallets/xst/Cargo.toml b/pallets/xst/Cargo.toml index 9194bc4bad..66f3083a4f 100644 --- a/pallets/xst/Cargo.toml +++ b/pallets/xst/Cargo.toml @@ -43,6 +43,7 @@ ceres-liquidity-locker = { path = "../ceres-liquidity-locker" } demeter-farming-platform = { path = "../demeter-farming-platform" } hex-literal = "0.4.1" pallet-balances = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } common = { path = "../../common", features = ["test"] } diff --git a/pallets/xst/benchmarking/Cargo.toml b/pallets/xst/benchmarking/Cargo.toml index 019b40a33c..90dbd42458 100644 --- a/pallets/xst/benchmarking/Cargo.toml +++ b/pallets/xst/benchmarking/Cargo.toml @@ -37,6 +37,7 @@ price-tools = { path = "../../price-tools", default-features = false } [dev-dependencies] sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.38", default-features = false } tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library.git", package = "orml-tokens", default-features = false } dex-api = { path = "../../dex-api", default-features = false } diff --git a/pallets/xst/benchmarking/src/mock.rs b/pallets/xst/benchmarking/src/mock.rs index d3faf81c07..3eb3ff169e 100644 --- a/pallets/xst/benchmarking/src/mock.rs +++ b/pallets/xst/benchmarking/src/mock.rs @@ -33,15 +33,16 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::Balance; use common::{ self, balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, DEXInfo, Fixed, FromGenericPair, - DAI, DEFAULT_BALANCE_PRECISION, PSWAP, USDT, VAL, XOR, XST, XSTUSD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, DEXInfo, + Fixed, FromGenericPair, DAI, DEFAULT_BALANCE_PRECISION, PSWAP, USDT, VAL, XOR, XST, XSTUSD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use permissions::{Scope, INIT_DEX, MANAGE_DEX}; use sp_core::crypto::AccountId32; @@ -140,7 +141,8 @@ construct_runtime! { OracleProxy: oracle_proxy::{Pallet, Call, Storage, Event}, CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, - PriceTools: price_tools::{Pallet, Call, Storage, Event} + PriceTools: price_tools::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -151,6 +153,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl dex_manager::Config for Runtime {} diff --git a/pallets/xst/src/mock.rs b/pallets/xst/src/mock.rs index c0de847e39..6a52f91f5f 100644 --- a/pallets/xst/src/mock.rs +++ b/pallets/xst/src/mock.rs @@ -33,16 +33,17 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::prelude::{Balance, PriceToolsProvider}; use common::{ self, balance, fixed, hash, mock_assets_config, mock_common_config, mock_currencies_config, - mock_frame_system_config, mock_pallet_balances_config, mock_technical_config, - mock_tokens_config, Amount, AssetId32, AssetIdOf, AssetName, AssetSymbol, DEXInfo, Fixed, - FromGenericPair, PriceVariant, DAI, DEFAULT_BALANCE_PRECISION, PSWAP, TBCD, USDT, VAL, XOR, - XST, XSTUSD, + mock_frame_system_config, mock_pallet_balances_config, mock_pallet_identity_config, + mock_technical_config, mock_tokens_config, Amount, AssetId32, AssetIdOf, AssetName, + AssetSymbol, DEXInfo, Fixed, FromGenericPair, PriceVariant, DAI, DEFAULT_BALANCE_PRECISION, + PSWAP, TBCD, USDT, VAL, XOR, XST, XSTUSD, }; use currencies::BasicCurrencyAdapter; use frame_support::traits::{Everything, GenesisBuild}; use frame_support::weights::Weight; use frame_support::{construct_runtime, parameter_types}; use frame_system::pallet_prelude::BlockNumberFor; +use frame_system::EnsureRoot; use hex_literal::hex; use permissions::{Scope, INIT_DEX, MANAGE_DEX}; use sp_core::crypto::AccountId32; @@ -142,9 +143,11 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, PriceTools: price_tools::{Pallet, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } +mock_pallet_identity_config!(Runtime); mock_technical_config!(Runtime, pool_xyk::PolySwapAction); mock_currencies_config!(Runtime); mock_pallet_balances_config!(Runtime); From 3228e6615b80902419a050017fba3f9506ba3129 Mon Sep 17 00:00:00 2001 From: Haidar Jbeily Date: Tue, 13 Aug 2024 04:14:29 +0300 Subject: [PATCH 6/6] Add Identity Pallet to all mocks --- pallets/liquidity-proxy/Cargo.toml | 1 + pallets/liquidity-proxy/src/mock.rs | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pallets/liquidity-proxy/Cargo.toml b/pallets/liquidity-proxy/Cargo.toml index 1dd6c32947..4d9f7d6e2d 100644 --- a/pallets/liquidity-proxy/Cargo.toml +++ b/pallets/liquidity-proxy/Cargo.toml @@ -38,6 +38,7 @@ demeter-farming-platform = { path = "../demeter-farming-platform", default-featu serde = { version = "1.0.101", default-features = false, features = ["derive"] } sp-core = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } sp-io = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38", default-features = false } +pallet-identity = { git = "https://github.com/sora-xor/substrate.git", branch = "polkadot-v0.9.38" } dex-api = { path = "../dex-api" } dex-manager = { path = "../dex-manager" } framenode-chain-spec = { path = "../../node/chain_spec", features = ["test", "private-net"] } diff --git a/pallets/liquidity-proxy/src/mock.rs b/pallets/liquidity-proxy/src/mock.rs index 02d99b4da7..568af12e86 100644 --- a/pallets/liquidity-proxy/src/mock.rs +++ b/pallets/liquidity-proxy/src/mock.rs @@ -34,10 +34,10 @@ use common::mock::{ExistentialDeposits, GetTradingPairRestrictedFlag}; use common::{ self, balance, fixed, fixed_from_basis_points, fixed_wrapper, hash, mock_assets_config, mock_common_config, mock_currencies_config, mock_frame_system_config, - mock_pallet_balances_config, mock_technical_config, mock_tokens_config, Amount, AssetId32, - AssetName, AssetSymbol, DEXInfo, Fixed, FromGenericPair, GetMarketInfo, LiquiditySource, - LiquiditySourceType, RewardReason, DAI, DEFAULT_BALANCE_PRECISION, DOT, ETH, KSM, PSWAP, TBCD, - USDT, VAL, XOR, XST, XSTUSD, + mock_pallet_balances_config, mock_pallet_identity_config, mock_technical_config, + mock_tokens_config, Amount, AssetId32, AssetName, AssetSymbol, DEXInfo, Fixed, FromGenericPair, + GetMarketInfo, LiquiditySource, LiquiditySourceType, RewardReason, DAI, + DEFAULT_BALANCE_PRECISION, DOT, ETH, KSM, PSWAP, TBCD, USDT, VAL, XOR, XST, XSTUSD, }; use currencies::BasicCurrencyAdapter; @@ -165,6 +165,7 @@ construct_runtime! { CeresLiquidityLocker: ceres_liquidity_locker::{Pallet, Call, Storage, Event}, DemeterFarmingPlatform: demeter_farming_platform::{Pallet, Call, Storage, Event}, ExtendedAssets: extended_assets::{Pallet, Call, Storage, Event}, + Identity: pallet_identity::{Pallet, Call, Storage, Event}, } } @@ -175,6 +176,7 @@ mock_frame_system_config!(Runtime); mock_common_config!(Runtime); mock_tokens_config!(Runtime); mock_assets_config!(Runtime); +mock_pallet_identity_config!(Runtime); impl Config for Runtime { type RuntimeEvent = RuntimeEvent;