git.delta.rocks / unique-network / refs/commits / 73163286b889

difftreelog

Cleanup code in scheduler and rename white to allow in comments in nft

Greg Zaitsev2021-11-10parent: #dfd6dab.patch.diff
in: master

3 files changed

modifiedCargo.lockdiffbeforeafterboth
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5055,6 +5055,8 @@
  "sp-transaction-pool",
  "substrate-frame-rpc-system",
  "tokio 0.2.25",
+ "uc-rpc",
+ "up-rpc",
 ]
 
 [[package]]
@@ -5082,18 +5084,22 @@
  "nft-data-structs",
  "pallet-aura",
  "pallet-balances",
+ "pallet-common",
  "pallet-ethereum",
  "pallet-evm",
  "pallet-evm-coder-substrate",
  "pallet-evm-contract-helpers",
  "pallet-evm-migration",
  "pallet-evm-transaction-payment",
+ "pallet-fungible",
  "pallet-inflation",
  "pallet-nft",
  "pallet-nft-transaction-payment",
+ "pallet-nonfungible",
  "pallet-randomness-collective-flip",
+ "pallet-refungible",
  "pallet-sudo",
- "pallet-template-charge-transaction",
+ "pallet-template-transaction-payment",
  "pallet-timestamp",
  "pallet-transaction-payment",
  "pallet-transaction-payment-rpc-runtime-api",
@@ -5121,6 +5127,7 @@
  "sp-transaction-pool",
  "sp-version",
  "substrate-wasm-builder",
+ "up-rpc",
  "xcm",
  "xcm-builder",
  "xcm-executor",
@@ -5538,6 +5545,24 @@
 ]
 
 [[package]]
+name = "pallet-common"
+version = "0.1.0"
+dependencies = [
+ "evm-coder",
+ "frame-support",
+ "frame-system",
+ "nft-data-structs",
+ "pallet-evm",
+ "pallet-evm-coder-substrate",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "pallet-contract-helpers"
 version = "0.1.0"
 dependencies = [
@@ -5788,6 +5813,25 @@
 ]
 
 [[package]]
+name = "pallet-fungible"
+version = "0.1.0"
+dependencies = [
+ "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",
+ "evm-coder",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "nft-data-structs",
+ "pallet-common",
+ "pallet-evm-coder-substrate",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "pallet-gilt"
 version = "4.0.0-dev"
 source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"
@@ -5993,10 +6037,14 @@
  "hex-literal",
  "nft-data-structs",
  "pallet-balances",
+ "pallet-common",
  "pallet-ethereum",
  "pallet-evm",
  "pallet-evm-coder-substrate",
+ "pallet-fungible",
+ "pallet-nonfungible",
  "pallet-randomness-collective-flip",
+ "pallet-refungible",
  "pallet-timestamp",
  "pallet-transaction-payment",
  "parity-scale-codec",
@@ -6045,6 +6093,25 @@
 ]
 
 [[package]]
+name = "pallet-nonfungible"
+version = "0.1.0"
+dependencies = [
+ "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",
+ "evm-coder",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "nft-data-structs",
+ "pallet-common",
+ "pallet-evm-coder-substrate",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "pallet-offences"
 version = "4.0.0-dev"
 source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"
@@ -6128,6 +6195,22 @@
 ]
 
 [[package]]
+name = "pallet-refungible"
+version = "0.1.0"
+dependencies = [
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "nft-data-structs",
+ "pallet-common",
+ "parity-scale-codec",
+ "scale-info",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "pallet-scheduler"
 version = "4.0.0-dev"
 source = "git+https://github.com/paritytech/substrate.git?branch=polkadot-v0.9.12#d76f39995315ec36980908e4b99709bd14927044"
@@ -6252,9 +6335,9 @@
 ]
 
 [[package]]
-name = "pallet-template-charge-transaction"
+name = "pallet-template-transaction-payment"
 version = "3.0.0"
-source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#e5d3354ab68face1b2ef709dc7f629803f56598d"
+source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"
 dependencies = [
  "frame-benchmarking",
  "frame-support",
@@ -11598,7 +11681,7 @@
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e"
 dependencies = [
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
  "rand 0.8.4",
  "static_assertions",
 ]
@@ -11610,6 +11693,24 @@
 checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"
 
 [[package]]
+name = "uc-rpc"
+version = "0.1.0"
+dependencies = [
+ "jsonrpc-core",
+ "jsonrpc-core-client",
+ "jsonrpc-derive",
+ "nft-data-structs",
+ "pallet-common",
+ "parity-scale-codec",
+ "sp-api",
+ "sp-blockchain",
+ "sp-core",
+ "sp-rpc",
+ "sp-runtime",
+ "up-rpc",
+]
+
+[[package]]
 name = "ucd-trie"
 version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -11716,9 +11817,22 @@
 checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
 
 [[package]]
+name = "up-rpc"
+version = "0.1.0"
+dependencies = [
+ "nft-data-structs",
+ "pallet-common",
+ "parity-scale-codec",
+ "sp-api",
+ "sp-core",
+ "sp-runtime",
+ "sp-std",
+]
+
+[[package]]
 name = "up-sponsorship"
 version = "0.1.0"
-source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#e5d3354ab68face1b2ef709dc7f629803f56598d"
+source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"
 dependencies = [
  "impl-trait-for-tuples 0.2.1",
 ]
modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
162 0162 0
163 }163 }
164164
165 /// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner and admin of the collection are set to the address that signed the transaction. Both addresses can be changed later.165 /// This method creates a Collection of NFTs. Each Token may have multiple properties encoded as an array of bytes of certain length. The initial owner of the collection is set to the address that signed the transaction and can be changed later.
166 ///166 ///
167 /// # Permissions167 /// # Permissions
168 ///168 ///
262 Ok(())262 Ok(())
263 }263 }
264264
265 /// Add an address to white list.265 /// Add an address to allow list.
266 ///266 ///
267 /// # Permissions267 /// # Permissions
268 ///268 ///
291 Ok(())291 Ok(())
292 }292 }
293293
294 /// Remove an address from white list.294 /// Remove an address from allow list.
295 ///295 ///
296 /// # Permissions296 /// # Permissions
297 ///297 ///
320 Ok(())320 Ok(())
321 }321 }
322322
323 /// Toggle between normal and white list access for the methods with access for `Anyone`.323 /// Toggle between normal and allow list access for the methods with access for `Anyone`.
324 ///324 ///
325 /// # Permissions325 /// # Permissions
326 ///326 ///
345 }345 }
346346
347 /// Allows Anyone to create tokens if:347 /// Allows Anyone to create tokens if:
348 /// * White List is enabled, and348 /// * Allow List is enabled, and
349 /// * Address is added to white list, and349 /// * Address is added to allow list, and
350 /// * This method was called with True parameter350 /// * This method was called with True parameter
351 ///351 ///
352 /// # Permissions352 /// # Permissions
514 /// * Collection Owner.514 /// * Collection Owner.
515 /// * Collection Admin.515 /// * Collection Admin.
516 /// * Anyone if516 /// * Anyone if
517 /// * White List is enabled, and517 /// * Allow List is enabled, and
518 /// * Address is added to white list, and518 /// * Address is added to allow list, and
519 /// * MintPermission is enabled (see SetMintPermission method)519 /// * MintPermission is enabled (see SetMintPermission method)
520 ///520 ///
521 /// # Arguments521 /// # Arguments
540 /// * Collection Owner.540 /// * Collection Owner.
541 /// * Collection Admin.541 /// * Collection Admin.
542 /// * Anyone if542 /// * Anyone if
543 /// * White List is enabled, and543 /// * Allow List is enabled, and
544 /// * Address is added to white list, and544 /// * Address is added to allow list, and
545 /// * MintPermission is enabled (see SetMintPermission method)545 /// * MintPermission is enabled (see SetMintPermission method)
546 ///546 ///
547 /// # Arguments547 /// # Arguments
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -62,7 +62,7 @@
 	traits::{Zero, One, BadOrigin, Saturating},
 };
 use frame_support::{
-	decl_module, decl_storage, decl_event, decl_error, IterableStorageMap,
+	decl_module, decl_storage, decl_event, decl_error,
 	dispatch::{Dispatchable, DispatchError, DispatchResult, Parameter},
 	traits::{
 		Get,
@@ -456,63 +456,6 @@
 }
 
 impl<T: Config> Module<T> {
-	/// Migrate storage format from V1 to V2.
-	/// Return true if migration is performed.
-	pub fn migrate_v1_to_t2() -> bool {
-		if StorageVersion::get() == Releases::V1 {
-			StorageVersion::put(Releases::V2);
-
-			Agenda::<T>::translate::<
-				Vec<Option<ScheduledV1<<T as Config>::Call, T::BlockNumber>>>,
-				_,
-			>(|_, agenda| {
-				Some(
-					agenda
-						.into_iter()
-						.map(|schedule| {
-							schedule.map(|schedule| ScheduledV2 {
-								maybe_id: schedule.maybe_id,
-								priority: schedule.priority,
-								call: schedule.call,
-								maybe_periodic: schedule.maybe_periodic,
-								origin: system::RawOrigin::Root.into(),
-								_phantom: Default::default(),
-							})
-						})
-						.collect::<Vec<_>>(),
-				)
-			});
-
-			true
-		} else {
-			false
-		}
-	}
-
-	/// Helper to migrate scheduler when the pallet origin type has changed.
-	pub fn migrate_origin<OldOrigin: Into<T::PalletsOrigin> + codec::Decode>() {
-		Agenda::<T>::translate::<
-			Vec<Option<Scheduled<<T as Config>::Call, T::BlockNumber, OldOrigin, T::AccountId>>>,
-			_,
-		>(|_, agenda| {
-			Some(
-				agenda
-					.into_iter()
-					.map(|schedule| {
-						schedule.map(|schedule| Scheduled {
-							maybe_id: schedule.maybe_id,
-							priority: schedule.priority,
-							call: schedule.call,
-							maybe_periodic: schedule.maybe_periodic,
-							origin: schedule.origin.into(),
-							_phantom: Default::default(),
-						})
-					})
-					.collect::<Vec<_>>(),
-			)
-		});
-	}
-
 	fn resolve_time(when: DispatchTime<T::BlockNumber>) -> Result<T::BlockNumber, DispatchError> {
 		let now = frame_system::Pallet::<T>::block_number();