git.delta.rocks / unique-network / refs/commits / c1d4e9108a7d

difftreelog

Missed tests was added. Scheduler pallet renamed.

Dev2022-06-09parent: #c6fcdce.patch.diff
in: master

13 files changed

modifiedMakefilediffbeforeafterboth
--- a/Makefile
+++ b/Makefile
@@ -103,7 +103,7 @@
 
 .PHONY: bench-scheduler
 bench-scheduler:
-	make _bench2 PALLET=unq-scheduler PALLET_DIR=scheduler
+	make _bench2 PALLET=unique-scheduler PALLET_DIR=scheduler
 
 .PHONY: bench
 bench: bench-evm-migration bench-unique bench-structure bench-fungible bench-refungible bench-nonfungible bench-scheduler
modifiedpallets/scheduler/Cargo.tomldiffbeforeafterboth
--- a/pallets/scheduler/Cargo.toml
+++ b/pallets/scheduler/Cargo.toml
@@ -1,5 +1,5 @@
 [package]
-name = "pallet-unq-scheduler"
+name = "pallet-unique-scheduler"
 version = "0.1.0"
 authors = ["Unique Network <support@uniquenetwork.io>"]
 edition = "2021"
modifiedpallets/scheduler/src/benchmarking.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/benchmarking.rs
+++ b/pallets/scheduler/src/benchmarking.rs
@@ -123,6 +123,18 @@
 		assert!(Agenda::<T>::iter().count() == 0);
 	}
 
+	on_initialize_periodic {
+		let s in 1 .. T::MaxScheduledPerBlock::get();
+		let when = BLOCK_NUMBER.into();
+		fill_schedule::<T>(when, s, true, Some(false))?;
+	}: { Scheduler::<T>::on_initialize(when); }
+	verify {
+		assert_eq!(System::<T>::event_count(), s);
+		for i in 0..s {
+			assert_eq!(Agenda::<T>::get(when + (i + 100).into()).len(), 1 as usize);
+		}
+	}
+
 	on_initialize_periodic_resolved {
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
@@ -135,6 +147,42 @@
 		}
 	}
 
+	on_initialize_aborted {
+		let s in 1 .. T::MaxScheduledPerBlock::get();
+		let when = BLOCK_NUMBER.into();
+		fill_schedule::<T>(when, s, false, None)?;
+	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+	verify {
+		assert_eq!(System::<T>::event_count(), 0);
+	}
+
+	on_initialize_named_aborted {
+		let s in 1 .. T::MaxScheduledPerBlock::get();
+		let when = BLOCK_NUMBER.into();
+		fill_schedule::<T>(when, s, false, Some(false))?;
+	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+	verify {
+	}
+
+	on_initialize_named {
+		let s in 1 .. T::MaxScheduledPerBlock::get();
+		let when = BLOCK_NUMBER.into();
+		fill_schedule::<T>(when, s, false, None)?;
+	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+	verify {
+		assert_eq!(System::<T>::event_count(), 0);
+	}
+
+	on_initialize {
+		let s in 1 .. T::MaxScheduledPerBlock::get();
+		let when = BLOCK_NUMBER.into();
+		fill_schedule::<T>(when, s, false, Some(false))?;
+	}: { Scheduler::<T>::on_initialize(BLOCK_NUMBER.into()); }
+	verify {
+		assert_eq!(System::<T>::event_count(), s);
+		assert!(Agenda::<T>::iter().count() == 0);
+	}
+
 	on_initialize_resolved {
 		let s in 1 .. T::MaxScheduledPerBlock::get();
 		let when = BLOCK_NUMBER.into();
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -158,11 +158,10 @@
 				Self::on_initialize_periodic(2) - Self::on_initialize_periodic(1)
 			}
 			(true, true, Some(false)) => {
-				Self::on_initialize_periodic_named(2) - Self::on_initialize_periodic_named(1)
-			}
-			(false, false, Some(true)) => {
-				Self::on_initialize_resolved(2) - Self::on_initialize_resolved(1)
+				Self::on_initialize_periodic_named_resolved(2)
+					- Self::on_initialize_periodic_named_resolved(1)
 			}
+			(false, false, Some(true)) => Self::on_initialize(2) - Self::on_initialize(1),
 			(false, true, Some(true)) => {
 				Self::on_initialize_named_resolved(2) - Self::on_initialize_named_resolved(1)
 			}
modifiedpallets/scheduler/src/weights.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/weights.rs
+++ b/pallets/scheduler/src/weights.rs
@@ -1,6 +1,6 @@
 // Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs
 
-//! Autogenerated weights for pallet_unq_scheduler
+//! Autogenerated weights for pallet_unique_scheduler
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
 //! DATE: 2022-06-09, STEPS: `50`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]`
@@ -11,7 +11,7 @@
 // benchmark
 // pallet
 // --pallet
-// pallet-unq-scheduler
+// pallet-unique-scheduler
 // --wasm-execution
 // compiled
 // --extrinsic
@@ -31,17 +31,22 @@
 use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
 use sp_std::marker::PhantomData;
 
-/// Weight functions needed for pallet_unq_scheduler.
+/// Weight functions needed for pallet_unique_scheduler.
 pub trait WeightInfo {
 	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight;
 	fn on_initialize_named_resolved(s: u32, ) -> Weight;
+	fn on_initialize_periodic(s: u32, ) -> Weight;
 	fn on_initialize_periodic_resolved(s: u32, ) -> Weight;
+	fn on_initialize_aborted(s: u32, ) -> Weight;
+	fn on_initialize_named_aborted(s: u32, ) -> Weight;
+	fn on_initialize_named(s: u32, ) -> Weight;
+	fn on_initialize(s: u32, ) -> Weight;
 	fn on_initialize_resolved(s: u32, ) -> Weight;
 	fn schedule_named(s: u32, ) -> Weight;
 	fn cancel_named(s: u32, ) -> Weight;
 }
 
-/// Weights for pallet_unq_scheduler using the Substrate node and recommended hardware.
+/// Weights for pallet_unique_scheduler using the Substrate node and recommended hardware.
 pub struct SubstrateWeight<T>(PhantomData<T>);
 impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 	// Storage: Scheduler Agenda (r:2 w:2)
@@ -50,9 +55,9 @@
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
-		(39_822_000 as Weight)
-			// Standard Error: 4_000
-			.saturating_add((31_823_000 as Weight).saturating_mul(s as Weight))
+		(35_999_000 as Weight)
+			// Standard Error: 3_000
+			.saturating_add((32_234_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(T::DbWeight::get().reads(4 as Weight))
 			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
@@ -64,9 +69,9 @@
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_named_resolved(s: u32, ) -> Weight {
-		(36_019_000 as Weight)
-			// Standard Error: 3_000
-			.saturating_add((22_660_000 as Weight).saturating_mul(s as Weight))
+		(34_874_000 as Weight)
+			// Standard Error: 2_000
+			.saturating_add((23_114_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(T::DbWeight::get().reads(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
@@ -76,24 +81,84 @@
 	// Storage: System AllExtrinsicsLen (r:1 w:1)
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_periodic(s: u32, ) -> Weight {
+		(36_469_000 as Weight)
+			// Standard Error: 3_000
+			.saturating_add((32_202_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(4 as Weight))
+			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+			.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:2 w:2)
+	// Storage: System Account (r:1 w:1)
+	// Storage: System AllExtrinsicsLen (r:1 w:1)
+	// Storage: System BlockWeight (r:1 w:1)
+	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
-		(36_613_000 as Weight)
+		(35_352_000 as Weight)
 			// Standard Error: 3_000
-			.saturating_add((31_895_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((32_309_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(T::DbWeight::get().reads(4 as Weight))
 			.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
 	}
+	// Storage: Scheduler Agenda (r:2 w:2)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_aborted(s: u32, ) -> Weight {
+		(11_267_000 as Weight)
+			// Standard Error: 1_000
+			.saturating_add((9_368_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:1 w:1)
+	// Storage: System Account (r:1 w:1)
+	// Storage: System AllExtrinsicsLen (r:1 w:1)
+	// Storage: System BlockWeight (r:1 w:1)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_named_aborted(s: u32, ) -> Weight {
+		(35_937_000 as Weight)
+			// Standard Error: 3_000
+			.saturating_add((23_037_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(4 as Weight))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:2 w:2)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_named(s: u32, ) -> Weight {
+		(10_338_000 as Weight)
+			// Standard Error: 2_000
+			.saturating_add((9_422_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes(2 as Weight))
+			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:1 w:1)
+	// Storage: System Account (r:1 w:1)
+	// Storage: System AllExtrinsicsLen (r:1 w:1)
+	// Storage: System BlockWeight (r:1 w:1)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize(s: u32, ) -> Weight {
+		(37_448_000 as Weight)
+			// Standard Error: 7_000
+			.saturating_add((22_907_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(T::DbWeight::get().reads(4 as Weight))
+			.saturating_add(T::DbWeight::get().writes(4 as Weight))
+			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
 	// Storage: Scheduler Agenda (r:1 w:1)
 	// Storage: System Account (r:1 w:1)
 	// Storage: System AllExtrinsicsLen (r:1 w:1)
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_resolved(s: u32, ) -> Weight {
-		(36_252_000 as Weight)
-			// Standard Error: 3_000
-			.saturating_add((22_662_000 as Weight).saturating_mul(s as Weight))
+		(34_841_000 as Weight)
+			// Standard Error: 7_000
+			.saturating_add((22_966_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(T::DbWeight::get().reads(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes(4 as Weight))
 			.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
@@ -101,18 +166,18 @@
 	// Storage: Scheduler Lookup (r:1 w:1)
 	// Storage: Scheduler Agenda (r:1 w:1)
 	fn schedule_named(s: u32, ) -> Weight {
-		(34_561_000 as Weight)
+		(33_845_000 as Weight)
 			// Standard Error: 0
-			.saturating_add((161_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((168_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
 	// Storage: Scheduler Lookup (r:1 w:1)
 	// Storage: Scheduler Agenda (r:1 w:1)
 	fn cancel_named(s: u32, ) -> Weight {
-		(30_932_000 as Weight)
+		(31_169_000 as Weight)
 			// Standard Error: 1_000
-			.saturating_add((1_537_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((1_565_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(T::DbWeight::get().reads(2 as Weight))
 			.saturating_add(T::DbWeight::get().writes(2 as Weight))
 	}
@@ -126,9 +191,9 @@
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_periodic_named_resolved(s: u32, ) -> Weight {
-		(39_822_000 as Weight)
-			// Standard Error: 4_000
-			.saturating_add((31_823_000 as Weight).saturating_mul(s as Weight))
+		(35_999_000 as Weight)
+			// Standard Error: 3_000
+			.saturating_add((32_234_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
 			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
@@ -140,12 +205,26 @@
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_named_resolved(s: u32, ) -> Weight {
-		(36_019_000 as Weight)
+		(34_874_000 as Weight)
+			// Standard Error: 2_000
+			.saturating_add((23_114_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:2 w:2)
+	// Storage: System Account (r:1 w:1)
+	// Storage: System AllExtrinsicsLen (r:1 w:1)
+	// Storage: System BlockWeight (r:1 w:1)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_periodic(s: u32, ) -> Weight {
+		(36_469_000 as Weight)
 			// Standard Error: 3_000
-			.saturating_add((22_660_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((32_202_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
+			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
-			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+			.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
 	}
 	// Storage: Scheduler Agenda (r:2 w:2)
 	// Storage: System Account (r:1 w:1)
@@ -153,23 +232,69 @@
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_periodic_resolved(s: u32, ) -> Weight {
-		(36_613_000 as Weight)
+		(35_352_000 as Weight)
 			// Standard Error: 3_000
-			.saturating_add((31_895_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((32_309_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
 			.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
 			.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
 	}
+	// Storage: Scheduler Agenda (r:2 w:2)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_aborted(s: u32, ) -> Weight {
+		(11_267_000 as Weight)
+			// Standard Error: 1_000
+			.saturating_add((9_368_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:1 w:1)
+	// Storage: System Account (r:1 w:1)
+	// Storage: System AllExtrinsicsLen (r:1 w:1)
+	// Storage: System BlockWeight (r:1 w:1)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_named_aborted(s: u32, ) -> Weight {
+		(35_937_000 as Weight)
+			// Standard Error: 3_000
+			.saturating_add((23_037_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:2 w:2)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize_named(s: u32, ) -> Weight {
+		(10_338_000 as Weight)
+			// Standard Error: 2_000
+			.saturating_add((9_422_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
+	// Storage: Scheduler Agenda (r:1 w:1)
+	// Storage: System Account (r:1 w:1)
+	// Storage: System AllExtrinsicsLen (r:1 w:1)
+	// Storage: System BlockWeight (r:1 w:1)
+	// Storage: Scheduler Lookup (r:0 w:1)
+	fn on_initialize(s: u32, ) -> Weight {
+		(37_448_000 as Weight)
+			// Standard Error: 7_000
+			.saturating_add((22_907_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
+			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
+			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
+	}
 	// Storage: Scheduler Agenda (r:1 w:1)
 	// Storage: System Account (r:1 w:1)
 	// Storage: System AllExtrinsicsLen (r:1 w:1)
 	// Storage: System BlockWeight (r:1 w:1)
 	// Storage: Scheduler Lookup (r:0 w:1)
 	fn on_initialize_resolved(s: u32, ) -> Weight {
-		(36_252_000 as Weight)
-			// Standard Error: 3_000
-			.saturating_add((22_662_000 as Weight).saturating_mul(s as Weight))
+		(34_841_000 as Weight)
+			// Standard Error: 7_000
+			.saturating_add((22_966_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(RocksDbWeight::get().reads(4 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(4 as Weight))
 			.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
@@ -177,18 +302,18 @@
 	// Storage: Scheduler Lookup (r:1 w:1)
 	// Storage: Scheduler Agenda (r:1 w:1)
 	fn schedule_named(s: u32, ) -> Weight {
-		(34_561_000 as Weight)
+		(33_845_000 as Weight)
 			// Standard Error: 0
-			.saturating_add((161_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((168_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
 	// Storage: Scheduler Lookup (r:1 w:1)
 	// Storage: Scheduler Agenda (r:1 w:1)
 	fn cancel_named(s: u32, ) -> Weight {
-		(30_932_000 as Weight)
+		(31_169_000 as Weight)
 			// Standard Error: 1_000
-			.saturating_add((1_537_000 as Weight).saturating_mul(s as Weight))
+			.saturating_add((1_565_000 as Weight).saturating_mul(s as Weight))
 			.saturating_add(RocksDbWeight::get().reads(2 as Weight))
 			.saturating_add(RocksDbWeight::get().writes(2 as Weight))
 	}
modifiedruntime/common/Cargo.tomldiffbeforeafterboth
--- a/runtime/common/Cargo.toml
+++ b/runtime/common/Cargo.toml
@@ -89,7 +89,7 @@
 default-features = false
 path = "../../pallets/refungible"
 
-[dependencies.pallet-unq-scheduler]
+[dependencies.pallet-unique-scheduler]
 default-features = false
 path = "../../pallets/scheduler"
 
modifiedruntime/common/src/runtime_apis.rsdiffbeforeafterboth
before · runtime/common/src/runtime_apis.rs
1#[macro_export]2macro_rules! impl_common_runtime_apis {3    (4        $(5            #![custom_apis]67            $($custom_apis:tt)+8        )?9    ) => {10        impl_runtime_apis! {11            $($($custom_apis)+)?1213            impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {14                fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {15                    dispatch_unique_runtime!(collection.account_tokens(account))16                }17                fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {18                    dispatch_unique_runtime!(collection.collection_tokens())19                }20                fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {21                    dispatch_unique_runtime!(collection.token_exists(token))22                }2324                fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {25                    dispatch_unique_runtime!(collection.token_owner(token))26                }27                fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {28                    let budget = up_data_structs::budget::Value::new(10);2930                    Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))31                }32                fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {33                    Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))34                }35                fn collection_properties(36                    collection: CollectionId,37                    keys: Option<Vec<Vec<u8>>>38                ) -> Result<Vec<Property>, DispatchError> {39                    let keys = keys.map(40                        |keys| Common::bytes_keys_to_property_keys(keys)41                    ).transpose()?;4243                    Common::filter_collection_properties(collection, keys)44                }4546                fn token_properties(47                    collection: CollectionId,48                    token_id: TokenId,49                    keys: Option<Vec<Vec<u8>>>50                ) -> Result<Vec<Property>, DispatchError> {51                    let keys = keys.map(52                        |keys| Common::bytes_keys_to_property_keys(keys)53                    ).transpose()?;5455                    dispatch_unique_runtime!(collection.token_properties(token_id, keys))56                }5758                fn property_permissions(59                    collection: CollectionId,60                    keys: Option<Vec<Vec<u8>>>61                ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {62                    let keys = keys.map(63                        |keys| Common::bytes_keys_to_property_keys(keys)64                    ).transpose()?;6566                    Common::filter_property_permissions(collection, keys)67                }6869                fn token_data(70                    collection: CollectionId,71                    token_id: TokenId,72                    keys: Option<Vec<Vec<u8>>>73                ) -> Result<TokenData<CrossAccountId>, DispatchError> {74                    let token_data = TokenData {75                        properties: Self::token_properties(collection, token_id, keys)?,76                        owner: Self::token_owner(collection, token_id)?77                    };7879                    Ok(token_data)80                }8182                fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {83                    dispatch_unique_runtime!(collection.total_supply())84                }85                fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {86                    dispatch_unique_runtime!(collection.account_balance(account))87                }88                fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {89                    dispatch_unique_runtime!(collection.balance(account, token))90                }91                fn allowance(92                    collection: CollectionId,93                    sender: CrossAccountId,94                    spender: CrossAccountId,95                    token: TokenId,96                ) -> Result<u128, DispatchError> {97                    dispatch_unique_runtime!(collection.allowance(sender, spender, token))98                }99100                fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {101                    Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))102                }103                fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {104                    Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))105                }106                fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {107                    Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))108                }109                fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {110                    dispatch_unique_runtime!(collection.last_token_id())111                }112                fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {113                    Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))114                }115                fn collection_stats() -> Result<CollectionStats, DispatchError> {116                    Ok(<pallet_common::Pallet<Runtime>>::collection_stats())117                }118                fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {119                    Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as120                            $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(121                        collection,122                        account,123                        token))124                }125126                fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {127                    Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))128                }129            }130131            /*132            TODO free RMRK!133            impl rmrk_rpc::RmrkApi<134                Block,135                AccountId,136                RmrkCollectionInfo<AccountId>,137                RmrkInstanceInfo<AccountId>,138                RmrkResourceInfo,139                RmrkPropertyInfo,140                RmrkBaseInfo<AccountId>,141                RmrkPartType,142                RmrkTheme143            > for Runtime {144                fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {145                    Ok(RmrkCore::last_collection_idx())146                }147148                fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {149                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind}};150151                    let collection_id = CollectionId(collection_id);152                    let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Regular) {153                        Ok(c) => c,154                        Err(_) => return Ok(None),155                    };156157                    let nfts_count = dispatch_unique_runtime!(collection_id.total_supply())?;158159                    Ok(Some(RmrkCollectionInfo {160                        issuer: collection.owner.clone(),161                        metadata: RmrkCore::get_collection_property(collection_id, RmrkProperty::Metadata)?.decode_or_default(),162                        max: collection.limits.token_limit,163                        symbol: collection.token_prefix.rebind(),164                        nfts_count165                    }))166                }167168                fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {169                    use up_data_structs::mapping::TokenAddressMapping;170                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::RmrkDecode};171172                    let collection_id = CollectionId(collection_id);173                    let nft_id = TokenId(nft_by_id);174                    if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }175176                    let owner = match dispatch_unique_runtime!(collection_id.token_owner(nft_id))? {177                        Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {178                            Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),179                            None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())180                        },181                        None => return Ok(None)182                    };183184                    let allowance = pallet_nonfungible::Allowance::<Runtime>::get((collection_id, nft_id));185186                    Ok(Some(RmrkInstanceInfo {187                        owner: owner,188                        royalty: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?.decode_or_default(),189                        metadata: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Metadata)?.decode_or_default(),190                        equipped: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Equipped)?.decode_or_default(),191                        pending: allowance.is_some(),192                    }))193                }194195                fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {196                    use pallet_proxy_rmrk_core::misc::CollectionType;197198                    let cross_account_id = CrossAccountId::from_sub(account_id);199                    let collection_id = CollectionId(collection_id);200                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }201202                    Ok(203                        dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id))?204                            .into_iter()205                            .map(|token| token.0)206                            .collect()207                    )208                }209210                fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {211                    let collection_id = CollectionId(collection_id);212                    let nft_id = TokenId(nft_id);213                    if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }214215                    Ok(216                        pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))217                            .filter_map(|(child_id, is_child)|218                                match is_child {219                                    true => Some(RmrkNftChild {220                                        collection_id: child_id.0.0,221                                        nft_id: child_id.1.0,222                                    }),223                                    false => None,224                                }225                            ).collect()226                    )227                }228229                fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {230                    use pallet_proxy_rmrk_core::misc::CollectionType;231232                    let collection_id = CollectionId(collection_id);233                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {234                        return Ok(Vec::new());235                    }236237                    let properties = RmrkCore::filter_user_properties(238                        collection_id,239                        /* token_id = */ None,240                        filter_keys,241                        |key, value| RmrkPropertyInfo {242                            key,243                            value244                        }245                    )?;246247                    Ok(properties)248                }249250                fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {251                    use pallet_proxy_rmrk_core::misc::NftType;252253                    let collection_id = CollectionId(collection_id);254                    let token_id = TokenId(nft_id);255256                    if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {257                        return Ok(Vec::new());258                    }259260		            let properties = RmrkCore::filter_user_properties(261                        collection_id,262                        Some(token_id),263                        filter_keys,264                        |key, value| RmrkPropertyInfo {265                            key,266                            value267                        }268                    )?;269270                    Ok(properties)271                }272273                fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {274                    use frame_support::BoundedVec;275                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};276277                    let collection_id = CollectionId(collection_id);278                    if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo make sure the collection type doesn't matter279280                    let nft_id = TokenId(nft_id);281                    if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }282283                    let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)284                        .unwrap()285                        .decode_or_default();286                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }287288                    let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))289                        .filter_map(|(resource_id, properties)| Some(RmrkResourceInfo {290                            id: BoundedVec::default(), // todo ResourceId property291                            pending: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceAccept).unwrap().decode_or_default(),292                            pending_removal: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceRemoval).unwrap().decode_or_default(),293                            resource: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::ResourceType).unwrap().decode_or_default(),/* {294                                RmrkResourceTypes::Basic(resource) => RmrkResourceTypes::Basic(),/*(RmrkBasicResource {295                                    src: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Src).unwrap().decode_or_default(),296                                    metadata: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Metadata).unwrap().decode_or_default(),297                                    license: RmrkCore::get_nft_property_inner(properties, RmrkProperty::License).unwrap().decode_or_default(),298                                    thumb: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Thumb).unwrap().decode_or_default(),299                                },*///BasicResource<BoundedString>)300                                _ => todo!(), //RmrkResourceTypes::Composable(ComposableResource<BoundedString, BoundedParts>),301                                //RmrkResourceTypes::Slot(SlotResource<BoundedString>),302                            },*/303                        }))304                        .collect();305306                    Ok(resources)307                }308309                fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {310                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};311312                    let collection_id = CollectionId(collection_id);313                    if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo ensure the collection type doesn't matter314315                    let nft_id = TokenId(nft_id);316                    if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }317318                    /*let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)319                        .unwrap()320                        .decode_or_default();321                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }322323                    let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))324                        .filter_map(|(resource_id, properties)| Some((325                            resource_id, // ResourceId property326                            RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::Priority).unwrap().decode_or_default(),327                        )))328                        .collect()329                        .sort_by_key(|(_, index)| *index)330                        .into_iter().map(|(resource_id, _)| resource_id)*/331                    let priorities = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourcePriorities)?.decode_or_default();332333                    Ok(priorities)334                }335336                fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {337                    use pallet_proxy_rmrk_core::{338                        RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind},339                    };340341                    let collection_id = CollectionId(base_id);342                    let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Base) {343                        Ok(c) => c,344                        Err(_) => return Ok(None),345                    };346347                    Ok(Some(RmrkBaseInfo {348                        issuer: collection.owner.clone(),349                        base_type: RmrkCore::get_collection_property(collection_id, RmrkProperty::BaseType)?.decode_or_default(),350                        symbol: collection.token_prefix.rebind(),351                    }))352                }353354                fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {355                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};356357                    let collection_id = CollectionId(base_id);358                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }359360                    let parts = dispatch_unique_runtime!(collection_id.collection_tokens())?361                        .into_iter()362                        .filter_map(|token_id| {363                            let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;364365                            match nft_type {366                                NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {367                                    id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),368                                    src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),369                                    z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),370                                })),371                                NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {372                                    id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),373                                    src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),374                                    z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),375                                    equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),376                                })),377                                _ => None378                            }379                        })380                        .collect();381382                    Ok(parts)383                }384385                fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {386                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode}};387388                    let collection_id = CollectionId(base_id);389                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {390                        return Ok(Vec::new());391                    }392393                    let theme_names = dispatch_unique_runtime!(collection_id.collection_tokens())?394                        .iter()395                        .filter_map(|token_id| {396                            let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();397398                            match nft_type {399                                Theme => Some(400                                    RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ThemeName).unwrap().decode_or_default()401                                ),402                                _ => None403                            }404                        })405                        .collect();406407                    Ok(theme_names)408                }409410                fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {411                    use pallet_proxy_rmrk_core::{412                        RmrkProperty,413                        misc::{CollectionType, NftType, RmrkDecode}414                    };415416                    let collection_id = CollectionId(base_id);417                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {418                        return Ok(None);419                    }420421                    let theme_info = dispatch_unique_runtime!(collection_id.collection_tokens())?422                        .into_iter()423                        .find_map(|token_id| {424                            RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;425426                            let name: RmrkString = RmrkCore::get_nft_property(427                                collection_id, token_id, RmrkProperty::ThemeName428                            ).ok()?.decode_or_default();429430                            if name == theme_name {431                                Some((name, token_id))432                            } else {433                                None434                            }435                        });436437                    let (name, theme_id) = match theme_info {438                        Some((name, theme_id)) => (name, theme_id),439                        None => return Ok(None)440                    };441442                    let properties = RmrkCore::filter_user_properties(443                        collection_id,444                        Some(theme_id),445                        filter_keys,446                        |key, value| RmrkThemeProperty {447                            key,448                            value449                        }450                    )?;451452                    let inherit = RmrkCore::get_nft_property(453                        collection_id,454                        theme_id,455                        RmrkProperty::ThemeInherit456                    )?.decode_or_default();457458                    let theme = RmrkTheme {459                        name,460                        properties,461                        inherit,462                    };463464                    Ok(Some(theme))465                }466            }*/467468            impl sp_api::Core<Block> for Runtime {469                fn version() -> RuntimeVersion {470                    VERSION471                }472473                fn execute_block(block: Block) {474                    Executive::execute_block(block)475                }476477                fn initialize_block(header: &<Block as BlockT>::Header) {478                    Executive::initialize_block(header)479                }480            }481482            impl sp_api::Metadata<Block> for Runtime {483                fn metadata() -> OpaqueMetadata {484                    OpaqueMetadata::new(Runtime::metadata().into())485                }486            }487488            impl sp_block_builder::BlockBuilder<Block> for Runtime {489                fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {490                    Executive::apply_extrinsic(extrinsic)491                }492493                fn finalize_block() -> <Block as BlockT>::Header {494                    Executive::finalize_block()495                }496497                fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {498                    data.create_extrinsics()499                }500501                fn check_inherents(502                    block: Block,503                    data: sp_inherents::InherentData,504                ) -> sp_inherents::CheckInherentsResult {505                    data.check_extrinsics(&block)506                }507508                // fn random_seed() -> <Block as BlockT>::Hash {509                //     RandomnessCollectiveFlip::random_seed().0510                // }511            }512513            impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {514                fn validate_transaction(515                    source: TransactionSource,516                    tx: <Block as BlockT>::Extrinsic,517                    hash: <Block as BlockT>::Hash,518                ) -> TransactionValidity {519                    Executive::validate_transaction(source, tx, hash)520                }521            }522523            impl sp_offchain::OffchainWorkerApi<Block> for Runtime {524                fn offchain_worker(header: &<Block as BlockT>::Header) {525                    Executive::offchain_worker(header)526                }527            }528529            impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {530                fn chain_id() -> u64 {531                    <Runtime as pallet_evm::Config>::ChainId::get()532                }533534                fn account_basic(address: H160) -> EVMAccount {535                    let (account, _) = EVM::account_basic(&address);536                    account537                }538539                fn gas_price() -> U256 {540                    let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();541                    price542                }543544                fn account_code_at(address: H160) -> Vec<u8> {545                    EVM::account_codes(address)546                }547548                fn author() -> H160 {549                    <pallet_evm::Pallet<Runtime>>::find_author()550                }551552                fn storage_at(address: H160, index: U256) -> H256 {553                    let mut tmp = [0u8; 32];554                    index.to_big_endian(&mut tmp);555                    EVM::account_storages(address, H256::from_slice(&tmp[..]))556                }557558                #[allow(clippy::redundant_closure)]559                fn call(560                    from: H160,561                    to: H160,562                    data: Vec<u8>,563                    value: U256,564                    gas_limit: U256,565                    max_fee_per_gas: Option<U256>,566                    max_priority_fee_per_gas: Option<U256>,567                    nonce: Option<U256>,568                    estimate: bool,569                    access_list: Option<Vec<(H160, Vec<H256>)>>,570                ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {571                    let config = if estimate {572                        let mut config = <Runtime as pallet_evm::Config>::config().clone();573                        config.estimate = true;574                        Some(config)575                    } else {576                        None577                    };578579                    let is_transactional = false;580                    <Runtime as pallet_evm::Config>::Runner::call(581                        CrossAccountId::from_eth(from),582                        to,583                        data,584                        value,585                        gas_limit.low_u64(),586                        max_fee_per_gas,587                        max_priority_fee_per_gas,588                        nonce,589                        access_list.unwrap_or_default(),590                        is_transactional,591                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),592                    ).map_err(|err| err.error.into())593                }594595                #[allow(clippy::redundant_closure)]596                fn create(597                    from: H160,598                    data: Vec<u8>,599                    value: U256,600                    gas_limit: U256,601                    max_fee_per_gas: Option<U256>,602                    max_priority_fee_per_gas: Option<U256>,603                    nonce: Option<U256>,604                    estimate: bool,605                    access_list: Option<Vec<(H160, Vec<H256>)>>,606                ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {607                    let config = if estimate {608                        let mut config = <Runtime as pallet_evm::Config>::config().clone();609                        config.estimate = true;610                        Some(config)611                    } else {612                        None613                    };614615                    let is_transactional = false;616                    <Runtime as pallet_evm::Config>::Runner::create(617                        CrossAccountId::from_eth(from),618                        data,619                        value,620                        gas_limit.low_u64(),621                        max_fee_per_gas,622                        max_priority_fee_per_gas,623                        nonce,624                        access_list.unwrap_or_default(),625                        is_transactional,626                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),627                    ).map_err(|err| err.error.into())628                }629630                fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {631                    Ethereum::current_transaction_statuses()632                }633634                fn current_block() -> Option<pallet_ethereum::Block> {635                    Ethereum::current_block()636                }637638                fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {639                    Ethereum::current_receipts()640                }641642                fn current_all() -> (643                    Option<pallet_ethereum::Block>,644                    Option<Vec<pallet_ethereum::Receipt>>,645                    Option<Vec<TransactionStatus>>646                ) {647                    (648                        Ethereum::current_block(),649                        Ethereum::current_receipts(),650                        Ethereum::current_transaction_statuses()651                    )652                }653654                fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {655                    xts.into_iter().filter_map(|xt| match xt.0.function {656                        Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),657                        _ => None658                    }).collect()659                }660661                fn elasticity() -> Option<Permill> {662                    None663                }664            }665666            impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {667                fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic  {668                    UncheckedExtrinsic::new_unsigned(669                        pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),670                    )671                }672            }673674            impl sp_session::SessionKeys<Block> for Runtime {675                fn decode_session_keys(676                    encoded: Vec<u8>,677                ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {678                    SessionKeys::decode_into_raw_public_keys(&encoded)679                }680681                fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {682                    SessionKeys::generate(seed)683                }684            }685686            impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {687                fn slot_duration() -> sp_consensus_aura::SlotDuration {688                    sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())689                }690691                fn authorities() -> Vec<AuraId> {692                    Aura::authorities().to_vec()693                }694            }695696            impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {697                fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {698                    ParachainSystem::collect_collation_info(header)699                }700            }701702            impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {703                fn account_nonce(account: AccountId) -> Index {704                    System::account_nonce(account)705                }706            }707708            impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {709                fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {710                    TransactionPayment::query_info(uxt, len)711                }712                fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {713                    TransactionPayment::query_fee_details(uxt, len)714                }715            }716717            /*718            impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>719                for Runtime720            {721                fn call(722                    origin: AccountId,723                    dest: AccountId,724                    value: Balance,725                    gas_limit: u64,726                    input_data: Vec<u8>,727                ) -> pallet_contracts_primitives::ContractExecResult {728                    Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)729                }730731                fn instantiate(732                    origin: AccountId,733                    endowment: Balance,734                    gas_limit: u64,735                    code: pallet_contracts_primitives::Code<Hash>,736                    data: Vec<u8>,737                    salt: Vec<u8>,738                ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>739                {740                    Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)741                }742743                fn get_storage(744                    address: AccountId,745                    key: [u8; 32],746                ) -> pallet_contracts_primitives::GetStorageResult {747                    Contracts::get_storage(address, key)748                }749750                fn rent_projection(751                    address: AccountId,752                ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {753                    Contracts::rent_projection(address)754                }755            }756            */757758            #[cfg(feature = "runtime-benchmarks")]759            impl frame_benchmarking::Benchmark<Block> for Runtime {760                fn benchmark_metadata(extra: bool) -> (761                    Vec<frame_benchmarking::BenchmarkList>,762                    Vec<frame_support::traits::StorageInfo>,763                ) {764                    use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};765                    use frame_support::traits::StorageInfoTrait;766767                    let mut list = Vec::<BenchmarkList>::new();768769                    list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);770                    list_benchmark!(list, extra, pallet_common, Common);771                    list_benchmark!(list, extra, pallet_unique, Unique);772                    list_benchmark!(list, extra, pallet_structure, Structure);773                    list_benchmark!(list, extra, pallet_inflation, Inflation);774                    list_benchmark!(list, extra, pallet_fungible, Fungible);775                    list_benchmark!(list, extra, pallet_refungible, Refungible);776                    list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);777                    list_benchmark!(list, extra, pallet_unq_scheduler, Scheduler);778                    // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);779780                    let storage_info = AllPalletsReversedWithSystemFirst::storage_info();781782                    return (list, storage_info)783                }784785                fn dispatch_benchmark(786                    config: frame_benchmarking::BenchmarkConfig787                ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {788                    use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};789790                    let allowlist: Vec<TrackedStorageKey> = vec![791                        // Total Issuance792                        hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),793794                        // Block Number795                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),796                        // Execution Phase797                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),798                        // Event Count799                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),800                        // System Events801                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),802803                        // Evm CurrentLogs804                        hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),805806                        // Transactional depth807                        hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),808                    ];809810                    let mut batches = Vec::<BenchmarkBatch>::new();811                    let params = (&config, &allowlist);812813                    add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);814                    add_benchmark!(params, batches, pallet_common, Common);815                    add_benchmark!(params, batches, pallet_unique, Unique);816                    add_benchmark!(params, batches, pallet_structure, Structure);817                    add_benchmark!(params, batches, pallet_inflation, Inflation);818                    add_benchmark!(params, batches, pallet_fungible, Fungible);819                    add_benchmark!(params, batches, pallet_refungible, Refungible);820                    add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);821                    add_benchmark!(params, batches, pallet_unq_scheduler, Scheduler);822823                    // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);824825                    if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }826                    Ok(batches)827                }828            }829830            #[cfg(feature = "try-runtime")]831            impl frame_try_runtime::TryRuntime<Block> for Runtime {832                fn on_runtime_upgrade() -> (Weight, Weight) {833                    log::info!("try-runtime::on_runtime_upgrade unique-chain.");834                    let weight = Executive::try_runtime_upgrade().unwrap();835                    (weight, RuntimeBlockWeights::get().max_block)836                }837838                fn execute_block_no_check(block: Block) -> Weight {839                    Executive::execute_block_no_check(block)840                }841            }842        }843    }844}
after · runtime/common/src/runtime_apis.rs
1#[macro_export]2macro_rules! impl_common_runtime_apis {3    (4        $(5            #![custom_apis]67            $($custom_apis:tt)+8        )?9    ) => {10        impl_runtime_apis! {11            $($($custom_apis)+)?1213            impl up_rpc::UniqueApi<Block, CrossAccountId, AccountId> for Runtime {14                fn account_tokens(collection: CollectionId, account: CrossAccountId) -> Result<Vec<TokenId>, DispatchError> {15                    dispatch_unique_runtime!(collection.account_tokens(account))16                }17                fn collection_tokens(collection: CollectionId) -> Result<Vec<TokenId>, DispatchError> {18                    dispatch_unique_runtime!(collection.collection_tokens())19                }20                fn token_exists(collection: CollectionId, token: TokenId) -> Result<bool, DispatchError> {21                    dispatch_unique_runtime!(collection.token_exists(token))22                }2324                fn token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {25                    dispatch_unique_runtime!(collection.token_owner(token))26                }27                fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {28                    let budget = up_data_structs::budget::Value::new(10);2930                    Ok(Some(<pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)?))31                }32                fn token_children(collection: CollectionId, token: TokenId) -> Result<Vec<TokenChild>, DispatchError> {33                    Ok(<pallet_nonfungible::Pallet<Runtime>>::token_children_ids(collection, token))34                }35                fn collection_properties(36                    collection: CollectionId,37                    keys: Option<Vec<Vec<u8>>>38                ) -> Result<Vec<Property>, DispatchError> {39                    let keys = keys.map(40                        |keys| Common::bytes_keys_to_property_keys(keys)41                    ).transpose()?;4243                    Common::filter_collection_properties(collection, keys)44                }4546                fn token_properties(47                    collection: CollectionId,48                    token_id: TokenId,49                    keys: Option<Vec<Vec<u8>>>50                ) -> Result<Vec<Property>, DispatchError> {51                    let keys = keys.map(52                        |keys| Common::bytes_keys_to_property_keys(keys)53                    ).transpose()?;5455                    dispatch_unique_runtime!(collection.token_properties(token_id, keys))56                }5758                fn property_permissions(59                    collection: CollectionId,60                    keys: Option<Vec<Vec<u8>>>61                ) -> Result<Vec<PropertyKeyPermission>, DispatchError> {62                    let keys = keys.map(63                        |keys| Common::bytes_keys_to_property_keys(keys)64                    ).transpose()?;6566                    Common::filter_property_permissions(collection, keys)67                }6869                fn token_data(70                    collection: CollectionId,71                    token_id: TokenId,72                    keys: Option<Vec<Vec<u8>>>73                ) -> Result<TokenData<CrossAccountId>, DispatchError> {74                    let token_data = TokenData {75                        properties: Self::token_properties(collection, token_id, keys)?,76                        owner: Self::token_owner(collection, token_id)?77                    };7879                    Ok(token_data)80                }8182                fn total_supply(collection: CollectionId) -> Result<u32, DispatchError> {83                    dispatch_unique_runtime!(collection.total_supply())84                }85                fn account_balance(collection: CollectionId, account: CrossAccountId) -> Result<u32, DispatchError> {86                    dispatch_unique_runtime!(collection.account_balance(account))87                }88                fn balance(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<u128, DispatchError> {89                    dispatch_unique_runtime!(collection.balance(account, token))90                }91                fn allowance(92                    collection: CollectionId,93                    sender: CrossAccountId,94                    spender: CrossAccountId,95                    token: TokenId,96                ) -> Result<u128, DispatchError> {97                    dispatch_unique_runtime!(collection.allowance(sender, spender, token))98                }99100                fn adminlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {101                    Ok(<pallet_common::Pallet<Runtime>>::adminlist(collection))102                }103                fn allowlist(collection: CollectionId) -> Result<Vec<CrossAccountId>, DispatchError> {104                    Ok(<pallet_common::Pallet<Runtime>>::allowlist(collection))105                }106                fn allowed(collection: CollectionId, user: CrossAccountId) -> Result<bool, DispatchError> {107                    Ok(<pallet_common::Pallet<Runtime>>::allowed(collection, user))108                }109                fn last_token_id(collection: CollectionId) -> Result<TokenId, DispatchError> {110                    dispatch_unique_runtime!(collection.last_token_id())111                }112                fn collection_by_id(collection: CollectionId) -> Result<Option<RpcCollection<AccountId>>, DispatchError> {113                    Ok(<pallet_common::Pallet<Runtime>>::rpc_collection(collection))114                }115                fn collection_stats() -> Result<CollectionStats, DispatchError> {116                    Ok(<pallet_common::Pallet<Runtime>>::collection_stats())117                }118                fn next_sponsored(collection: CollectionId, account: CrossAccountId, token: TokenId) -> Result<Option<u64>, DispatchError> {119                    Ok(<$crate::sponsoring::UniqueSponsorshipPredict<Runtime> as120                            $crate::sponsoring::SponsorshipPredict<Runtime>>::predict(121                        collection,122                        account,123                        token))124                }125126                fn effective_collection_limits(collection: CollectionId) -> Result<Option<CollectionLimits>, DispatchError> {127                    Ok(<pallet_common::Pallet<Runtime>>::effective_collection_limits(collection))128                }129            }130131            /*132            TODO free RMRK!133            impl rmrk_rpc::RmrkApi<134                Block,135                AccountId,136                RmrkCollectionInfo<AccountId>,137                RmrkInstanceInfo<AccountId>,138                RmrkResourceInfo,139                RmrkPropertyInfo,140                RmrkBaseInfo<AccountId>,141                RmrkPartType,142                RmrkTheme143            > for Runtime {144                fn last_collection_idx() -> Result<RmrkCollectionId, DispatchError> {145                    Ok(RmrkCore::last_collection_idx())146                }147148                fn collection_by_id(collection_id: RmrkCollectionId) -> Result<Option<RmrkCollectionInfo<AccountId>>, DispatchError> {149                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind}};150151                    let collection_id = CollectionId(collection_id);152                    let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Regular) {153                        Ok(c) => c,154                        Err(_) => return Ok(None),155                    };156157                    let nfts_count = dispatch_unique_runtime!(collection_id.total_supply())?;158159                    Ok(Some(RmrkCollectionInfo {160                        issuer: collection.owner.clone(),161                        metadata: RmrkCore::get_collection_property(collection_id, RmrkProperty::Metadata)?.decode_or_default(),162                        max: collection.limits.token_limit,163                        symbol: collection.token_prefix.rebind(),164                        nfts_count165                    }))166                }167168                fn nft_by_id(collection_id: RmrkCollectionId, nft_by_id: RmrkNftId) -> Result<Option<RmrkInstanceInfo<AccountId>>, DispatchError> {169                    use up_data_structs::mapping::TokenAddressMapping;170                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::RmrkDecode};171172                    let collection_id = CollectionId(collection_id);173                    let nft_id = TokenId(nft_by_id);174                    if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(None); }175176                    let owner = match dispatch_unique_runtime!(collection_id.token_owner(nft_id))? {177                        Some(owner) => match <Runtime as pallet_common::Config>::CrossTokenAddressMapping::address_to_token(&owner) {178                            Some((col, tok)) => RmrkAccountIdOrCollectionNftTuple::CollectionAndNftTuple(col.0, tok.0),179                            None => RmrkAccountIdOrCollectionNftTuple::AccountId(owner.as_sub().clone())180                        },181                        None => return Ok(None)182                    };183184                    let allowance = pallet_nonfungible::Allowance::<Runtime>::get((collection_id, nft_id));185186                    Ok(Some(RmrkInstanceInfo {187                        owner: owner,188                        royalty: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::RoyaltyInfo)?.decode_or_default(),189                        metadata: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Metadata)?.decode_or_default(),190                        equipped: RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::Equipped)?.decode_or_default(),191                        pending: allowance.is_some(),192                    }))193                }194195                fn account_tokens(account_id: AccountId, collection_id: RmrkCollectionId) -> Result<Vec<RmrkNftId>, DispatchError> {196                    use pallet_proxy_rmrk_core::misc::CollectionType;197198                    let cross_account_id = CrossAccountId::from_sub(account_id);199                    let collection_id = CollectionId(collection_id);200                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() { return Ok(Vec::new()); }201202                    Ok(203                        dispatch_unique_runtime!(collection_id.account_tokens(cross_account_id))?204                            .into_iter()205                            .map(|token| token.0)206                            .collect()207                    )208                }209210                fn nft_children(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkNftChild>, DispatchError> {211                    let collection_id = CollectionId(collection_id);212                    let nft_id = TokenId(nft_id);213                    if !RmrkCore::nft_exists(collection_id, nft_id) { return Ok(Vec::new()); }214215                    Ok(216                        pallet_nonfungible::TokenChildren::<Runtime>::iter_prefix((collection_id, nft_id))217                            .filter_map(|(child_id, is_child)|218                                match is_child {219                                    true => Some(RmrkNftChild {220                                        collection_id: child_id.0.0,221                                        nft_id: child_id.1.0,222                                    }),223                                    false => None,224                                }225                            ).collect()226                    )227                }228229                fn collection_properties(collection_id: RmrkCollectionId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {230                    use pallet_proxy_rmrk_core::misc::CollectionType;231232                    let collection_id = CollectionId(collection_id);233                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Regular).is_err() {234                        return Ok(Vec::new());235                    }236237                    let properties = RmrkCore::filter_user_properties(238                        collection_id,239                        /* token_id = */ None,240                        filter_keys,241                        |key, value| RmrkPropertyInfo {242                            key,243                            value244                        }245                    )?;246247                    Ok(properties)248                }249250                fn nft_properties(collection_id: RmrkCollectionId, nft_id: RmrkNftId, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Vec<RmrkPropertyInfo>, DispatchError> {251                    use pallet_proxy_rmrk_core::misc::NftType;252253                    let collection_id = CollectionId(collection_id);254                    let token_id = TokenId(nft_id);255256                    if RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Regular).is_err() {257                        return Ok(Vec::new());258                    }259260		            let properties = RmrkCore::filter_user_properties(261                        collection_id,262                        Some(token_id),263                        filter_keys,264                        |key, value| RmrkPropertyInfo {265                            key,266                            value267                        }268                    )?;269270                    Ok(properties)271                }272273                fn nft_resources(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceInfo>, DispatchError> {274                    use frame_support::BoundedVec;275                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};276277                    let collection_id = CollectionId(collection_id);278                    if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo make sure the collection type doesn't matter279280                    let nft_id = TokenId(nft_id);281                    if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }282283                    let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)284                        .unwrap()285                        .decode_or_default();286                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }287288                    let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))289                        .filter_map(|(resource_id, properties)| Some(RmrkResourceInfo {290                            id: BoundedVec::default(), // todo ResourceId property291                            pending: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceAccept).unwrap().decode_or_default(),292                            pending_removal: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::PendingResourceRemoval).unwrap().decode_or_default(),293                            resource: RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::ResourceType).unwrap().decode_or_default(),/* {294                                RmrkResourceTypes::Basic(resource) => RmrkResourceTypes::Basic(),/*(RmrkBasicResource {295                                    src: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Src).unwrap().decode_or_default(),296                                    metadata: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Metadata).unwrap().decode_or_default(),297                                    license: RmrkCore::get_nft_property_inner(properties, RmrkProperty::License).unwrap().decode_or_default(),298                                    thumb: RmrkCore::get_nft_property_inner(properties, RmrkProperty::Thumb).unwrap().decode_or_default(),299                                },*///BasicResource<BoundedString>)300                                _ => todo!(), //RmrkResourceTypes::Composable(ComposableResource<BoundedString, BoundedParts>),301                                //RmrkResourceTypes::Slot(SlotResource<BoundedString>),302                            },*/303                        }))304                        .collect();305306                    Ok(resources)307                }308309                fn nft_resource_priorities(collection_id: RmrkCollectionId, nft_id: RmrkNftId) -> Result<Vec<RmrkResourceId>, DispatchError> {310                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};311312                    let collection_id = CollectionId(collection_id);313                    if !RmrkCore::collection_exists(collection_id) { return Ok(Vec::new()); } // todo ensure the collection type doesn't matter314315                    let nft_id = TokenId(nft_id);316                    if RmrkCore::ensure_nft_type(collection_id, nft_id, NftType::Resource).is_err() { return Ok(Vec::new()); }317318                    /*let resource_collection_id: CollectionId = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourceCollection)319                        .unwrap()320                        .decode_or_default();321                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Resource).is_err() { return Ok(Vec::new()); }322323                    let resources = pallet_nonfungible::TokenProperties::<Runtime>::iter_prefix((resource_collection_id,))324                        .filter_map(|(resource_id, properties)| Some((325                            resource_id, // ResourceId property326                            RmrkCore::get_nft_property(resource_collection_id, resource_id, RmrkProperty::Priority).unwrap().decode_or_default(),327                        )))328                        .collect()329                        .sort_by_key(|(_, index)| *index)330                        .into_iter().map(|(resource_id, _)| resource_id)*/331                    let priorities = RmrkCore::get_nft_property(collection_id, nft_id, RmrkProperty::ResourcePriorities)?.decode_or_default();332333                    Ok(priorities)334                }335336                fn base(base_id: RmrkBaseId) -> Result<Option<RmrkBaseInfo<AccountId>>, DispatchError> {337                    use pallet_proxy_rmrk_core::{338                        RmrkProperty, misc::{CollectionType, RmrkDecode, RmrkRebind},339                    };340341                    let collection_id = CollectionId(base_id);342                    let collection = match RmrkCore::get_typed_nft_collection(collection_id, CollectionType::Base) {343                        Ok(c) => c,344                        Err(_) => return Ok(None),345                    };346347                    Ok(Some(RmrkBaseInfo {348                        issuer: collection.owner.clone(),349                        base_type: RmrkCore::get_collection_property(collection_id, RmrkProperty::BaseType)?.decode_or_default(),350                        symbol: collection.token_prefix.rebind(),351                    }))352                }353354                fn base_parts(base_id: RmrkBaseId) -> Result<Vec<RmrkPartType>, DispatchError> {355                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, NftType, RmrkDecode}};356357                    let collection_id = CollectionId(base_id);358                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() { return Ok(Vec::new()); }359360                    let parts = dispatch_unique_runtime!(collection_id.collection_tokens())?361                        .into_iter()362                        .filter_map(|token_id| {363                            let nft_type = RmrkCore::get_nft_type(collection_id, token_id).ok()?;364365                            match nft_type {366                                NftType::FixedPart => Some(RmrkPartType::FixedPart(RmrkFixedPart {367                                    id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),368                                    src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),369                                    z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),370                                })),371                                NftType::SlotPart => Some(RmrkPartType::SlotPart(RmrkSlotPart {372                                    id: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ExternalPartId).ok()?.decode_or_default(),373                                    src: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::Src).ok()?.decode_or_default(),374                                    z: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::ZIndex).ok()?.decode_or_default(),375                                    equippable: RmrkCore::get_nft_property(collection_id, token_id, RmrkProperty::EquippableList).ok()?.decode_or_default(),376                                })),377                                _ => None378                            }379                        })380                        .collect();381382                    Ok(parts)383                }384385                fn theme_names(base_id: RmrkBaseId) -> Result<Vec<RmrkThemeName>, DispatchError> {386                    use pallet_proxy_rmrk_core::{RmrkProperty, misc::{CollectionType, RmrkDecode}};387388                    let collection_id = CollectionId(base_id);389                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {390                        return Ok(Vec::new());391                    }392393                    let theme_names = dispatch_unique_runtime!(collection_id.collection_tokens())?394                        .iter()395                        .filter_map(|token_id| {396                            let nft_type = RmrkCore::get_nft_type(collection_id, *token_id).unwrap();397398                            match nft_type {399                                Theme => Some(400                                    RmrkCore::get_nft_property(collection_id, *token_id, RmrkProperty::ThemeName).unwrap().decode_or_default()401                                ),402                                _ => None403                            }404                        })405                        .collect();406407                    Ok(theme_names)408                }409410                fn theme(base_id: RmrkBaseId, theme_name: RmrkThemeName, filter_keys: Option<Vec<RmrkPropertyKey>>) -> Result<Option<RmrkTheme>, DispatchError> {411                    use pallet_proxy_rmrk_core::{412                        RmrkProperty,413                        misc::{CollectionType, NftType, RmrkDecode}414                    };415416                    let collection_id = CollectionId(base_id);417                    if RmrkCore::ensure_collection_type(collection_id, CollectionType::Base).is_err() {418                        return Ok(None);419                    }420421                    let theme_info = dispatch_unique_runtime!(collection_id.collection_tokens())?422                        .into_iter()423                        .find_map(|token_id| {424                            RmrkCore::ensure_nft_type(collection_id, token_id, NftType::Theme).ok()?;425426                            let name: RmrkString = RmrkCore::get_nft_property(427                                collection_id, token_id, RmrkProperty::ThemeName428                            ).ok()?.decode_or_default();429430                            if name == theme_name {431                                Some((name, token_id))432                            } else {433                                None434                            }435                        });436437                    let (name, theme_id) = match theme_info {438                        Some((name, theme_id)) => (name, theme_id),439                        None => return Ok(None)440                    };441442                    let properties = RmrkCore::filter_user_properties(443                        collection_id,444                        Some(theme_id),445                        filter_keys,446                        |key, value| RmrkThemeProperty {447                            key,448                            value449                        }450                    )?;451452                    let inherit = RmrkCore::get_nft_property(453                        collection_id,454                        theme_id,455                        RmrkProperty::ThemeInherit456                    )?.decode_or_default();457458                    let theme = RmrkTheme {459                        name,460                        properties,461                        inherit,462                    };463464                    Ok(Some(theme))465                }466            }*/467468            impl sp_api::Core<Block> for Runtime {469                fn version() -> RuntimeVersion {470                    VERSION471                }472473                fn execute_block(block: Block) {474                    Executive::execute_block(block)475                }476477                fn initialize_block(header: &<Block as BlockT>::Header) {478                    Executive::initialize_block(header)479                }480            }481482            impl sp_api::Metadata<Block> for Runtime {483                fn metadata() -> OpaqueMetadata {484                    OpaqueMetadata::new(Runtime::metadata().into())485                }486            }487488            impl sp_block_builder::BlockBuilder<Block> for Runtime {489                fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {490                    Executive::apply_extrinsic(extrinsic)491                }492493                fn finalize_block() -> <Block as BlockT>::Header {494                    Executive::finalize_block()495                }496497                fn inherent_extrinsics(data: sp_inherents::InherentData) -> Vec<<Block as BlockT>::Extrinsic> {498                    data.create_extrinsics()499                }500501                fn check_inherents(502                    block: Block,503                    data: sp_inherents::InherentData,504                ) -> sp_inherents::CheckInherentsResult {505                    data.check_extrinsics(&block)506                }507508                // fn random_seed() -> <Block as BlockT>::Hash {509                //     RandomnessCollectiveFlip::random_seed().0510                // }511            }512513            impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {514                fn validate_transaction(515                    source: TransactionSource,516                    tx: <Block as BlockT>::Extrinsic,517                    hash: <Block as BlockT>::Hash,518                ) -> TransactionValidity {519                    Executive::validate_transaction(source, tx, hash)520                }521            }522523            impl sp_offchain::OffchainWorkerApi<Block> for Runtime {524                fn offchain_worker(header: &<Block as BlockT>::Header) {525                    Executive::offchain_worker(header)526                }527            }528529            impl fp_rpc::EthereumRuntimeRPCApi<Block> for Runtime {530                fn chain_id() -> u64 {531                    <Runtime as pallet_evm::Config>::ChainId::get()532                }533534                fn account_basic(address: H160) -> EVMAccount {535                    let (account, _) = EVM::account_basic(&address);536                    account537                }538539                fn gas_price() -> U256 {540                    let (price, _) = <Runtime as pallet_evm::Config>::FeeCalculator::min_gas_price();541                    price542                }543544                fn account_code_at(address: H160) -> Vec<u8> {545                    EVM::account_codes(address)546                }547548                fn author() -> H160 {549                    <pallet_evm::Pallet<Runtime>>::find_author()550                }551552                fn storage_at(address: H160, index: U256) -> H256 {553                    let mut tmp = [0u8; 32];554                    index.to_big_endian(&mut tmp);555                    EVM::account_storages(address, H256::from_slice(&tmp[..]))556                }557558                #[allow(clippy::redundant_closure)]559                fn call(560                    from: H160,561                    to: H160,562                    data: Vec<u8>,563                    value: U256,564                    gas_limit: U256,565                    max_fee_per_gas: Option<U256>,566                    max_priority_fee_per_gas: Option<U256>,567                    nonce: Option<U256>,568                    estimate: bool,569                    access_list: Option<Vec<(H160, Vec<H256>)>>,570                ) -> Result<pallet_evm::CallInfo, sp_runtime::DispatchError> {571                    let config = if estimate {572                        let mut config = <Runtime as pallet_evm::Config>::config().clone();573                        config.estimate = true;574                        Some(config)575                    } else {576                        None577                    };578579                    let is_transactional = false;580                    <Runtime as pallet_evm::Config>::Runner::call(581                        CrossAccountId::from_eth(from),582                        to,583                        data,584                        value,585                        gas_limit.low_u64(),586                        max_fee_per_gas,587                        max_priority_fee_per_gas,588                        nonce,589                        access_list.unwrap_or_default(),590                        is_transactional,591                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),592                    ).map_err(|err| err.error.into())593                }594595                #[allow(clippy::redundant_closure)]596                fn create(597                    from: H160,598                    data: Vec<u8>,599                    value: U256,600                    gas_limit: U256,601                    max_fee_per_gas: Option<U256>,602                    max_priority_fee_per_gas: Option<U256>,603                    nonce: Option<U256>,604                    estimate: bool,605                    access_list: Option<Vec<(H160, Vec<H256>)>>,606                ) -> Result<pallet_evm::CreateInfo, sp_runtime::DispatchError> {607                    let config = if estimate {608                        let mut config = <Runtime as pallet_evm::Config>::config().clone();609                        config.estimate = true;610                        Some(config)611                    } else {612                        None613                    };614615                    let is_transactional = false;616                    <Runtime as pallet_evm::Config>::Runner::create(617                        CrossAccountId::from_eth(from),618                        data,619                        value,620                        gas_limit.low_u64(),621                        max_fee_per_gas,622                        max_priority_fee_per_gas,623                        nonce,624                        access_list.unwrap_or_default(),625                        is_transactional,626                        config.as_ref().unwrap_or_else(|| <Runtime as pallet_evm::Config>::config()),627                    ).map_err(|err| err.error.into())628                }629630                fn current_transaction_statuses() -> Option<Vec<TransactionStatus>> {631                    Ethereum::current_transaction_statuses()632                }633634                fn current_block() -> Option<pallet_ethereum::Block> {635                    Ethereum::current_block()636                }637638                fn current_receipts() -> Option<Vec<pallet_ethereum::Receipt>> {639                    Ethereum::current_receipts()640                }641642                fn current_all() -> (643                    Option<pallet_ethereum::Block>,644                    Option<Vec<pallet_ethereum::Receipt>>,645                    Option<Vec<TransactionStatus>>646                ) {647                    (648                        Ethereum::current_block(),649                        Ethereum::current_receipts(),650                        Ethereum::current_transaction_statuses()651                    )652                }653654                fn extrinsic_filter(xts: Vec<<Block as sp_api::BlockT>::Extrinsic>) -> Vec<pallet_ethereum::Transaction> {655                    xts.into_iter().filter_map(|xt| match xt.0.function {656                        Call::Ethereum(pallet_ethereum::Call::transact { transaction }) => Some(transaction),657                        _ => None658                    }).collect()659                }660661                fn elasticity() -> Option<Permill> {662                    None663                }664            }665666            impl fp_rpc::ConvertTransactionRuntimeApi<Block> for Runtime {667                fn convert_transaction(transaction: pallet_ethereum::Transaction) -> <Block as BlockT>::Extrinsic  {668                    UncheckedExtrinsic::new_unsigned(669                        pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),670                    )671                }672            }673674            impl sp_session::SessionKeys<Block> for Runtime {675                fn decode_session_keys(676                    encoded: Vec<u8>,677                ) -> Option<Vec<(Vec<u8>, KeyTypeId)>> {678                    SessionKeys::decode_into_raw_public_keys(&encoded)679                }680681                fn generate_session_keys(seed: Option<Vec<u8>>) -> Vec<u8> {682                    SessionKeys::generate(seed)683                }684            }685686            impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {687                fn slot_duration() -> sp_consensus_aura::SlotDuration {688                    sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())689                }690691                fn authorities() -> Vec<AuraId> {692                    Aura::authorities().to_vec()693                }694            }695696            impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {697                fn collect_collation_info(header: &<Block as BlockT>::Header) -> cumulus_primitives_core::CollationInfo {698                    ParachainSystem::collect_collation_info(header)699                }700            }701702            impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {703                fn account_nonce(account: AccountId) -> Index {704                    System::account_nonce(account)705                }706            }707708            impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {709                fn query_info(uxt: <Block as BlockT>::Extrinsic, len: u32) -> RuntimeDispatchInfo<Balance> {710                    TransactionPayment::query_info(uxt, len)711                }712                fn query_fee_details(uxt: <Block as BlockT>::Extrinsic, len: u32) -> FeeDetails<Balance> {713                    TransactionPayment::query_fee_details(uxt, len)714                }715            }716717            /*718            impl pallet_contracts_rpc_runtime_api::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash>719                for Runtime720            {721                fn call(722                    origin: AccountId,723                    dest: AccountId,724                    value: Balance,725                    gas_limit: u64,726                    input_data: Vec<u8>,727                ) -> pallet_contracts_primitives::ContractExecResult {728                    Contracts::bare_call(origin, dest, value, gas_limit, input_data, false)729                }730731                fn instantiate(732                    origin: AccountId,733                    endowment: Balance,734                    gas_limit: u64,735                    code: pallet_contracts_primitives::Code<Hash>,736                    data: Vec<u8>,737                    salt: Vec<u8>,738                ) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, BlockNumber>739                {740                    Contracts::bare_instantiate(origin, endowment, gas_limit, code, data, salt, true, false)741                }742743                fn get_storage(744                    address: AccountId,745                    key: [u8; 32],746                ) -> pallet_contracts_primitives::GetStorageResult {747                    Contracts::get_storage(address, key)748                }749750                fn rent_projection(751                    address: AccountId,752                ) -> pallet_contracts_primitives::RentProjectionResult<BlockNumber> {753                    Contracts::rent_projection(address)754                }755            }756            */757758            #[cfg(feature = "runtime-benchmarks")]759            impl frame_benchmarking::Benchmark<Block> for Runtime {760                fn benchmark_metadata(extra: bool) -> (761                    Vec<frame_benchmarking::BenchmarkList>,762                    Vec<frame_support::traits::StorageInfo>,763                ) {764                    use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};765                    use frame_support::traits::StorageInfoTrait;766767                    let mut list = Vec::<BenchmarkList>::new();768769                    list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);770                    list_benchmark!(list, extra, pallet_common, Common);771                    list_benchmark!(list, extra, pallet_unique, Unique);772                    list_benchmark!(list, extra, pallet_structure, Structure);773                    list_benchmark!(list, extra, pallet_inflation, Inflation);774                    list_benchmark!(list, extra, pallet_fungible, Fungible);775                    list_benchmark!(list, extra, pallet_refungible, Refungible);776                    list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);777                    list_benchmark!(list, extra, pallet_unique_scheduler, Scheduler);778                    // list_benchmark!(list, extra, pallet_evm_coder_substrate, EvmCoderSubstrate);779780                    let storage_info = AllPalletsReversedWithSystemFirst::storage_info();781782                    return (list, storage_info)783                }784785                fn dispatch_benchmark(786                    config: frame_benchmarking::BenchmarkConfig787                ) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, sp_runtime::RuntimeString> {788                    use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};789790                    let allowlist: Vec<TrackedStorageKey> = vec![791                        // Total Issuance792                        hex_literal::hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80").to_vec().into(),793794                        // Block Number795                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),796                        // Execution Phase797                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef7ff553b5a9862a516939d82b3d3d8661a").to_vec().into(),798                        // Event Count799                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef70a98fdbe9ce6c55837576c60c7af3850").to_vec().into(),800                        // System Events801                        hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef780d41e5e16056765bc8461851072c9d7").to_vec().into(),802803                        // Evm CurrentLogs804                        hex_literal::hex!("1da53b775b270400e7e61ed5cbc5a146547f210cec367e9af919603343b9cb56").to_vec().into(),805806                        // Transactional depth807                        hex_literal::hex!("3a7472616e73616374696f6e5f6c6576656c3a").to_vec().into(),808                    ];809810                    let mut batches = Vec::<BenchmarkBatch>::new();811                    let params = (&config, &allowlist);812813                    add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);814                    add_benchmark!(params, batches, pallet_common, Common);815                    add_benchmark!(params, batches, pallet_unique, Unique);816                    add_benchmark!(params, batches, pallet_structure, Structure);817                    add_benchmark!(params, batches, pallet_inflation, Inflation);818                    add_benchmark!(params, batches, pallet_fungible, Fungible);819                    add_benchmark!(params, batches, pallet_refungible, Refungible);820                    add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);821                    add_benchmark!(params, batches, pallet_unique_scheduler, Scheduler);822823                    // add_benchmark!(params, batches, pallet_evm_coder_substrate, EvmCoderSubstrate);824825                    if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }826                    Ok(batches)827                }828            }829830            #[cfg(feature = "try-runtime")]831            impl frame_try_runtime::TryRuntime<Block> for Runtime {832                fn on_runtime_upgrade() -> (Weight, Weight) {833                    log::info!("try-runtime::on_runtime_upgrade unique-chain.");834                    let weight = Executive::try_runtime_upgrade().unwrap();835                    (weight, RuntimeBlockWeights::get().max_block)836                }837838                fn execute_block_no_check(block: Block) -> Weight {839                    Executive::execute_block_no_check(block)840                }841            }842        }843    }844}
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -36,7 +36,7 @@
     'pallet-proxy-rmrk-core/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
-    'pallet-unq-scheduler/runtime-benchmarks',
+    'pallet-unique-scheduler/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
@@ -94,7 +94,7 @@
     'pallet-proxy-rmrk-core/std',
     'pallet-proxy-rmrk-equip/std',
     'pallet-unique/std',
-    'pallet-unq-scheduler/std',
+    'pallet-unique-scheduler/std',
     'pallet-charge-transaction/std',
     'up-data-structs/std',
     'sp-api/std',
@@ -413,7 +413,7 @@
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
 pallet-proxy-rmrk-equip = { default-features = false, path = "../../pallets/proxy-rmrk-equip", package = "pallet-rmrk-equip" }
-pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -68,7 +68,7 @@
 		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
 	},
 };
-use pallet_unq_scheduler::DispatchCall;
+use pallet_unique_scheduler::DispatchCall;
 use up_data_structs::{
 	CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
 	CollectionStats, RpcCollection,
@@ -966,7 +966,7 @@
 }
 
 pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
 	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
 where
 	<T as frame_system::Config>::Call: Member
@@ -976,13 +976,13 @@
 		+ From<frame_system::Call<Runtime>>,
 	SelfContainedSignedInfo: Send + Sync + 'static,
 	Call: From<<T as frame_system::Config>::Call>
-		+ From<<T as pallet_unq_scheduler::Config>::Call>
+		+ From<<T as pallet_unique_scheduler::Config>::Call>
 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
 	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
 {
 	fn dispatch_call(
 		signer: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 	) -> Result<
 		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
 		TransactionValidityError,
@@ -1008,7 +1008,7 @@
 	fn reserve_balance(
 		id: [u8; 16],
 		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 		count: u32,
 	) -> Result<(), DispatchError> {
 		let dispatch_info = call.get_dispatch_info();
@@ -1025,7 +1025,7 @@
 	fn pay_for_call(
 		id: [u8; 16],
 		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 	) -> Result<u128, DispatchError> {
 		let dispatch_info = call.get_dispatch_info();
 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
@@ -1066,7 +1066,7 @@
 	}
 }
 
-impl pallet_unq_scheduler::Config for Runtime {
+impl pallet_unique_scheduler::Config for Runtime {
 	type Event = Event;
 	type Origin = Origin;
 	type Currency = Balances;
@@ -1155,7 +1155,7 @@
 		// Unique Pallets
 		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
 		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
-		Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 		// free = 63
 		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
 		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -36,7 +36,7 @@
     'pallet-proxy-rmrk-core/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
-    'pallet-unq-scheduler/runtime-benchmarks',
+    'pallet-unique-scheduler/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
@@ -93,7 +93,7 @@
     'pallet-nonfungible/std',
     'pallet-proxy-rmrk-core/std',
     'pallet-unique/std',
-    'pallet-unq-scheduler/std',
+    'pallet-unique-scheduler/std',
     'pallet-charge-transaction/std',
     'up-data-structs/std',
     'sp-api/std',
@@ -417,7 +417,7 @@
 pallet-refungible = { default-features = false, path = "../../pallets/refungible" }
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
-pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
modifiedruntime/quartz/src/lib.rsdiffbeforeafterboth
--- a/runtime/quartz/src/lib.rs
+++ b/runtime/quartz/src/lib.rs
@@ -68,7 +68,7 @@
 		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
 	},
 };
-use pallet_unq_scheduler::DispatchCall;
+use pallet_unique_scheduler::DispatchCall;
 use up_data_structs::{
 	CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits, 
 	CollectionStats, RpcCollection, 
@@ -963,7 +963,7 @@
 }
 
 pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
 	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
 where
 	<T as frame_system::Config>::Call: Member
@@ -973,13 +973,13 @@
 		+ From<frame_system::Call<Runtime>>,
 	SelfContainedSignedInfo: Send + Sync + 'static,
 	Call: From<<T as frame_system::Config>::Call>
-		+ From<<T as pallet_unq_scheduler::Config>::Call>
+		+ From<<T as pallet_unique_scheduler::Config>::Call>
 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
 	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
 {
 	fn dispatch_call(
 		signer: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 	) -> Result<
 		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
 		TransactionValidityError,
@@ -1005,7 +1005,7 @@
 	fn reserve_balance(
 		id: [u8; 16],
 		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 		count: u32,
 	) -> Result<(), DispatchError> {
 		let dispatch_info = call.get_dispatch_info();
@@ -1022,7 +1022,7 @@
 	fn pay_for_call(
 		id: [u8; 16],
 		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 	) -> Result<u128, DispatchError> {
 		let dispatch_info = call.get_dispatch_info();
 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
@@ -1063,7 +1063,7 @@
 	}
 }
 
-impl pallet_unq_scheduler::Config for Runtime {
+impl pallet_unique_scheduler::Config for Runtime {
 	type Event = Event;
 	type Origin = Origin;
 	type Currency = Balances;
@@ -1151,7 +1151,7 @@
 		// Unique Pallets
 		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
 		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
-		Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 		// free = 63
 		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
 		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -36,7 +36,7 @@
     'pallet-proxy-rmrk-core/runtime-benchmarks',
     'pallet-unique/runtime-benchmarks',
     'pallet-inflation/runtime-benchmarks',
-    'pallet-unq-scheduler/runtime-benchmarks',
+    'pallet-unique-scheduler/runtime-benchmarks',
     'pallet-xcm/runtime-benchmarks',
     'sp-runtime/runtime-benchmarks',
     'xcm-builder/runtime-benchmarks',
@@ -94,7 +94,7 @@
     'pallet-nonfungible/std',
     'pallet-proxy-rmrk-core/std',
     'pallet-unique/std',
-    'pallet-unq-scheduler/std',
+    'pallet-unique-scheduler/std',
     'pallet-charge-transaction/std',
     'up-data-structs/std',
     'sp-api/std',
@@ -410,7 +410,7 @@
 pallet-refungible = { default-features = false, path = "../../pallets/refungible" }
 pallet-nonfungible = { default-features = false, path = "../../pallets/nonfungible" }
 pallet-proxy-rmrk-core = { default-features = false, path = "../../pallets/proxy-rmrk-core", package = "pallet-rmrk-core" }
-pallet-unq-scheduler = { path = '../../pallets/scheduler', default-features = false }
+pallet-unique-scheduler = { path = '../../pallets/scheduler', default-features = false }
 # pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }
 pallet-charge-transaction = { git = "https://github.com/uniquenetwork/pallet-sponsoring", branch = "polkadot-v0.9.22", package = "pallet-template-transaction-payment", default-features = false, version = "3.0.0" }
 pallet-evm-migration = { path = '../../pallets/evm-migration', default-features = false }
modifiedruntime/unique/src/lib.rsdiffbeforeafterboth
--- a/runtime/unique/src/lib.rs
+++ b/runtime/unique/src/lib.rs
@@ -68,7 +68,7 @@
 		WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, ConstantMultiplier,
 	},
 };
-use pallet_unq_scheduler::DispatchCall;
+use pallet_unique_scheduler::DispatchCall;
 use up_data_structs::{
 	CollectionId, TokenId, TokenData, Property, PropertyKeyPermission, CollectionLimits,
 	CollectionStats, RpcCollection,
@@ -962,7 +962,7 @@
 }
 
 pub struct SchedulerPaymentExecutor;
-impl<T: frame_system::Config + pallet_unq_scheduler::Config, SelfContainedSignedInfo>
+impl<T: frame_system::Config + pallet_unique_scheduler::Config, SelfContainedSignedInfo>
 	DispatchCall<T, SelfContainedSignedInfo> for SchedulerPaymentExecutor
 where
 	<T as frame_system::Config>::Call: Member
@@ -972,13 +972,13 @@
 		+ From<frame_system::Call<Runtime>>,
 	SelfContainedSignedInfo: Send + Sync + 'static,
 	Call: From<<T as frame_system::Config>::Call>
-		+ From<<T as pallet_unq_scheduler::Config>::Call>
+		+ From<<T as pallet_unique_scheduler::Config>::Call>
 		+ SelfContainedCall<SignedInfo = SelfContainedSignedInfo>,
 	sp_runtime::AccountId32: From<<T as frame_system::Config>::AccountId>,
 {
 	fn dispatch_call(
 		signer: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 	) -> Result<
 		Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>,
 		TransactionValidityError,
@@ -1004,7 +1004,7 @@
 	fn reserve_balance(
 		id: [u8; 16],
 		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 		count: u32,
 	) -> Result<(), DispatchError> {
 		let dispatch_info = call.get_dispatch_info();
@@ -1021,7 +1021,7 @@
 	fn pay_for_call(
 		id: [u8; 16],
 		sponsor: <T as frame_system::Config>::AccountId,
-		call: <T as pallet_unq_scheduler::Config>::Call,
+		call: <T as pallet_unique_scheduler::Config>::Call,
 	) -> Result<u128, DispatchError> {
 		let dispatch_info = call.get_dispatch_info();
 		let weight: Balance = ChargeTransactionPayment::traditional_fee(0, &dispatch_info, 0);
@@ -1062,7 +1062,7 @@
 	}
 }
 
-impl pallet_unq_scheduler::Config for Runtime {
+impl pallet_unique_scheduler::Config for Runtime {
 	type Event = Event;
 	type Origin = Origin;
 	type Currency = Balances;
@@ -1150,7 +1150,7 @@
 		// Unique Pallets
 		Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
 		Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
-		Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
+		Scheduler: pallet_unique_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
 		// free = 63
 		Charging: pallet_charge_transaction::{Pallet, Call, Storage } = 64,
 		// ContractHelpers: pallet_contract_helpers::{Pallet, Call, Storage} = 65,