From 5a850c731442bf2ddf2f751c87797fca45d97028 Mon Sep 17 00:00:00 2001 From: Nuno Alexandre Date: Thu, 7 Sep 2023 15:05:17 +0200 Subject: [PATCH] liquidityPools: Clean up orphan storage and events (#1535) * liquidity-pools: Drop DomainRouter storage * liquidity-pools: Drop events * liquidity-pools: Remove RuntimeEvent type --- pallets/liquidity-pools/src/lib.rs | 46 +----------------------------- runtime/altair/src/lib.rs | 3 +- runtime/centrifuge/src/lib.rs | 3 +- runtime/development/src/lib.rs | 3 +- 4 files changed, 4 insertions(+), 51 deletions(-) diff --git a/pallets/liquidity-pools/src/lib.rs b/pallets/liquidity-pools/src/lib.rs index bb4f225705..a2644d19e2 100644 --- a/pallets/liquidity-pools/src/lib.rs +++ b/pallets/liquidity-pools/src/lib.rs @@ -34,7 +34,7 @@ use sp_runtime::{ traits::{AtLeast32BitUnsigned, Convert}, FixedPointNumber, SaturatedConversion, }; -use sp_std::{convert::TryInto, vec, vec::Vec}; +use sp_std::{convert::TryInto, vec}; use xcm::{ latest::NetworkId, prelude::{AccountKey20, GlobalConsensus, PalletInstance, X3}, @@ -106,9 +106,6 @@ pub mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - /// The overarching event type. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -248,31 +245,6 @@ pub mod pallet { type TreasuryAccount: Get; } - #[pallet::event] - #[pallet::generate_deposit(pub (super) fn deposit_event)] - pub enum Event { - /// A message was sent to a domain - MessageSent { - message: MessageOf, - domain: Domain, - }, - - /// The Router for a given domain was set - SetDomainRouter { - domain: Domain, - router: Router>, - }, - - IncomingMessage { - sender: T::AccountId, - message: Vec, - }, - } - - #[pallet::storage] - pub(crate) type DomainRouter = - StorageMap<_, Blake2_128Concat, Domain, Router>>; - #[pallet::error] pub enum Error { /// Failed to map the asset to the corresponding LiquidityPools' General @@ -333,22 +305,6 @@ pub mod pallet { where ::AccountId: From<[u8; 32]>, { - /// Set a Domain's router - #[pallet::weight(< T as Config >::WeightInfo::set_domain_router())] - #[pallet::call_index(0)] - pub fn set_domain_router( - origin: OriginFor, - domain: Domain, - router: Router>, - ) -> DispatchResult { - T::AdminOrigin::ensure_origin(origin.clone())?; - - >::insert(domain.clone(), router.clone()); - Self::deposit_event(Event::SetDomainRouter { domain, router }); - - Ok(()) - } - /// Add a pool to a given domain #[pallet::weight(< T as Config >::WeightInfo::add_pool())] #[pallet::call_index(2)] diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index 5559baeb52..a7bc2b8c78 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1401,7 +1401,6 @@ impl pallet_liquidity_pools::Config for Runtime { type Permission = Permissions; type PoolId = PoolId; type PoolInspect = PoolSystem; - type RuntimeEvent = RuntimeEvent; type Time = Timestamp; type Tokens = Tokens; type TrancheCurrency = TrancheCurrency; @@ -1796,7 +1795,7 @@ construct_runtime!( BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event, Config} = 105, Keystore: pallet_keystore::{Pallet, Call, Storage, Event} = 106, PriceCollector: pallet_data_collector::{Pallet, Storage} = 107, - LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event} = 108, + LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage} = 108, LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event, Origin } = 109, LiquidityRewardsBase: pallet_rewards::::{Pallet, Storage, Event, Config} = 110, LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event} = 111, diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 93b8f001aa..0340cd1e68 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -448,7 +448,6 @@ impl pallet_liquidity_pools::Config for Runtime { type Permission = Permissions; type PoolId = PoolId; type PoolInspect = PoolSystem; - type RuntimeEvent = RuntimeEvent; type Time = Timestamp; type Tokens = Tokens; type TrancheCurrency = TrancheCurrency; @@ -1961,7 +1960,7 @@ construct_runtime!( BlockRewardsBase: pallet_rewards::::{Pallet, Storage, Event, Config} = 100, BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event, Config} = 101, PriceCollector: pallet_data_collector::{Pallet, Storage} = 102, - LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event} = 103, + LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage} = 103, LiquidityRewardsBase: pallet_rewards::::{Pallet, Storage, Event, Config} = 104, LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event} = 105, GapRewardMechanism: pallet_rewards::mechanism::gap = 106, diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index c89bf877c7..97f2e4c38c 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1561,7 +1561,6 @@ impl pallet_liquidity_pools::Config for Runtime { type Permission = Permissions; type PoolId = PoolId; type PoolInspect = PoolSystem; - type RuntimeEvent = RuntimeEvent; type Time = Timestamp; type Tokens = Tokens; type TrancheCurrency = TrancheCurrency; @@ -1893,7 +1892,7 @@ construct_runtime!( Investments: pallet_investments::{Pallet, Call, Storage, Event} = 105, LiquidityRewardsBase: pallet_rewards::::{Pallet, Storage, Event, Config} = 106, LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event} = 107, - LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event} = 108, + LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage} = 108, PoolRegistry: pallet_pool_registry::{Pallet, Call, Storage, Event} = 109, BlockRewardsBase: pallet_rewards::::{Pallet, Storage, Event, Config} = 110, BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event, Config} = 111,