difftreelog
Cleanup code in scheduler and rename white to allow in comments in nft
in: master
3 files changed
Cargo.lockdiffbeforeafterboth5055 "sp-transaction-pool",5055 "sp-transaction-pool",5056 "substrate-frame-rpc-system",5056 "substrate-frame-rpc-system",5057 "tokio 0.2.25",5057 "tokio 0.2.25",5058 "uc-rpc",5059 "up-rpc",5058]5060]505950615060[[package]]5062[[package]]5082 "nft-data-structs",5084 "nft-data-structs",5083 "pallet-aura",5085 "pallet-aura",5084 "pallet-balances",5086 "pallet-balances",5087 "pallet-common",5085 "pallet-ethereum",5088 "pallet-ethereum",5086 "pallet-evm",5089 "pallet-evm",5087 "pallet-evm-coder-substrate",5090 "pallet-evm-coder-substrate",5088 "pallet-evm-contract-helpers",5091 "pallet-evm-contract-helpers",5089 "pallet-evm-migration",5092 "pallet-evm-migration",5090 "pallet-evm-transaction-payment",5093 "pallet-evm-transaction-payment",5094 "pallet-fungible",5091 "pallet-inflation",5095 "pallet-inflation",5092 "pallet-nft",5096 "pallet-nft",5093 "pallet-nft-transaction-payment",5097 "pallet-nft-transaction-payment",5098 "pallet-nonfungible",5094 "pallet-randomness-collective-flip",5099 "pallet-randomness-collective-flip",5100 "pallet-refungible",5095 "pallet-sudo",5101 "pallet-sudo",5096 "pallet-template-charge-transaction",5102 "pallet-template-transaction-payment",5097 "pallet-timestamp",5103 "pallet-timestamp",5098 "pallet-transaction-payment",5104 "pallet-transaction-payment",5099 "pallet-transaction-payment-rpc-runtime-api",5105 "pallet-transaction-payment-rpc-runtime-api",5121 "sp-transaction-pool",5127 "sp-transaction-pool",5122 "sp-version",5128 "sp-version",5123 "substrate-wasm-builder",5129 "substrate-wasm-builder",5130 "up-rpc",5124 "xcm",5131 "xcm",5125 "xcm-builder",5132 "xcm-builder",5126 "xcm-executor",5133 "xcm-executor",5537 "sp-std",5544 "sp-std",5538]5545]55465547[[package]]5548name = "pallet-common"5549version = "0.1.0"5550dependencies = [5551 "evm-coder",5552 "frame-support",5553 "frame-system",5554 "nft-data-structs",5555 "pallet-evm",5556 "pallet-evm-coder-substrate",5557 "parity-scale-codec",5558 "scale-info",5559 "serde",5560 "sp-core",5561 "sp-runtime",5562 "sp-std",5563]553955645540[[package]]5565[[package]]5541name = "pallet-contract-helpers"5566name = "pallet-contract-helpers"5787 "up-sponsorship",5812 "up-sponsorship",5788]5813]58145815[[package]]5816name = "pallet-fungible"5817version = "0.1.0"5818dependencies = [5819 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",5820 "evm-coder",5821 "frame-benchmarking",5822 "frame-support",5823 "frame-system",5824 "nft-data-structs",5825 "pallet-common",5826 "pallet-evm-coder-substrate",5827 "parity-scale-codec",5828 "scale-info",5829 "sp-core",5830 "sp-runtime",5831 "sp-std",5832]578958335790[[package]]5834[[package]]5791name = "pallet-gilt"5835name = "pallet-gilt"5993 "hex-literal",6037 "hex-literal",5994 "nft-data-structs",6038 "nft-data-structs",5995 "pallet-balances",6039 "pallet-balances",6040 "pallet-common",5996 "pallet-ethereum",6041 "pallet-ethereum",5997 "pallet-evm",6042 "pallet-evm",5998 "pallet-evm-coder-substrate",6043 "pallet-evm-coder-substrate",6044 "pallet-fungible",6045 "pallet-nonfungible",5999 "pallet-randomness-collective-flip",6046 "pallet-randomness-collective-flip",6047 "pallet-refungible",6000 "pallet-timestamp",6048 "pallet-timestamp",6001 "pallet-transaction-payment",6049 "pallet-transaction-payment",6002 "parity-scale-codec",6050 "parity-scale-codec",6044 "sp-std",6092 "sp-std",6045]6093]60946095[[package]]6096name = "pallet-nonfungible"6097version = "0.1.0"6098dependencies = [6099 "ethereum 0.9.0 (git+https://github.com/purestake/ethereum?branch=joshy-scale-info)",6100 "evm-coder",6101 "frame-benchmarking",6102 "frame-support",6103 "frame-system",6104 "nft-data-structs",6105 "pallet-common",6106 "pallet-evm-coder-substrate",6107 "parity-scale-codec",6108 "scale-info",6109 "sp-core",6110 "sp-runtime",6111 "sp-std",6112]604661136047[[package]]6114[[package]]6048name = "pallet-offences"6115name = "pallet-offences"6127 "sp-std",6194 "sp-std",6128]6195]61966197[[package]]6198name = "pallet-refungible"6199version = "0.1.0"6200dependencies = [6201 "frame-benchmarking",6202 "frame-support",6203 "frame-system",6204 "nft-data-structs",6205 "pallet-common",6206 "parity-scale-codec",6207 "scale-info",6208 "sp-core",6209 "sp-runtime",6210 "sp-std",6211]612962126130[[package]]6213[[package]]6131name = "pallet-scheduler"6214name = "pallet-scheduler"6252]6335]625363366254[[package]]6337[[package]]6255name = "pallet-template-charge-transaction"6338name = "pallet-template-transaction-payment"6256version = "3.0.0"6339version = "3.0.0"6257source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#e5d3354ab68face1b2ef709dc7f629803f56598d"6340source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"6258dependencies = [6341dependencies = [6259 "frame-benchmarking",6342 "frame-benchmarking",6260 "frame-support",6343 "frame-support",11598source = "registry+https://github.com/rust-lang/crates.io-index"11681source = "registry+https://github.com/rust-lang/crates.io-index"11599checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e"11682checksum = "1f559b464de2e2bdabcac6a210d12e9b5a5973c251e102c44c585c71d51bd78e"11600dependencies = [11683dependencies = [11601 "cfg-if 0.1.10",11684 "cfg-if 1.0.0",11602 "rand 0.8.4",11685 "rand 0.8.4",11603 "static_assertions",11686 "static_assertions",11604]11687]11609source = "registry+https://github.com/rust-lang/crates.io-index"11692source = "registry+https://github.com/rust-lang/crates.io-index"11610checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"11693checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec"1169411695[[package]]11696name = "uc-rpc"11697version = "0.1.0"11698dependencies = [11699 "jsonrpc-core",11700 "jsonrpc-core-client",11701 "jsonrpc-derive",11702 "nft-data-structs",11703 "pallet-common",11704 "parity-scale-codec",11705 "sp-api",11706 "sp-blockchain",11707 "sp-core",11708 "sp-rpc",11709 "sp-runtime",11710 "up-rpc",11711]116111171211612[[package]]11713[[package]]11613name = "ucd-trie"11714name = "ucd-trie"11715source = "registry+https://github.com/rust-lang/crates.io-index"11816source = "registry+https://github.com/rust-lang/crates.io-index"11716checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"11817checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"1181811819[[package]]11820name = "up-rpc"11821version = "0.1.0"11822dependencies = [11823 "nft-data-structs",11824 "pallet-common",11825 "parity-scale-codec",11826 "sp-api",11827 "sp-core",11828 "sp-runtime",11829 "sp-std",11830]117171183111718[[package]]11832[[package]]11719name = "up-sponsorship"11833name = "up-sponsorship"11720version = "0.1.0"11834version = "0.1.0"11721source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#e5d3354ab68face1b2ef709dc7f629803f56598d"11835source = "git+https://github.com/UniqueNetwork/pallet-sponsoring#ab8b91e9350a31133f3a3e4f52a84c6de4108e95"11722dependencies = [11836dependencies = [11723 "impl-trait-for-tuples 0.2.1",11837 "impl-trait-for-tuples 0.2.1",11724]11838]pallets/nft/src/lib.rsdiffbeforeafterboth162 0162 0163 }163 }164164165 /// 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 /// # Permissions168 ///168 ///262 Ok(())262 Ok(())263 }263 }264264265 /// Add an address to white list.265 /// Add an address to allow list.266 ///266 ///267 /// # Permissions267 /// # Permissions268 ///268 ///291 Ok(())291 Ok(())292 }292 }293293294 /// Remove an address from white list.294 /// Remove an address from allow list.295 ///295 ///296 /// # Permissions296 /// # Permissions297 ///297 ///320 Ok(())320 Ok(())321 }321 }322322323 /// 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 /// # Permissions326 ///326 ///345 }345 }346346347 /// Allows Anyone to create tokens if:347 /// Allows Anyone to create tokens if:348 /// * White List is enabled, and348 /// * Allow List is enabled, and349 /// * Address is added to white list, and349 /// * Address is added to allow list, and350 /// * This method was called with True parameter350 /// * This method was called with True parameter351 ///351 ///352 /// # Permissions352 /// # Permissions514 /// * Collection Owner.514 /// * Collection Owner.515 /// * Collection Admin.515 /// * Collection Admin.516 /// * Anyone if516 /// * Anyone if517 /// * White List is enabled, and517 /// * Allow List is enabled, and518 /// * Address is added to white list, and518 /// * Address is added to allow list, and519 /// * MintPermission is enabled (see SetMintPermission method)519 /// * MintPermission is enabled (see SetMintPermission method)520 ///520 ///521 /// # Arguments521 /// # Arguments540 /// * Collection Owner.540 /// * Collection Owner.541 /// * Collection Admin.541 /// * Collection Admin.542 /// * Anyone if542 /// * Anyone if543 /// * White List is enabled, and543 /// * Allow List is enabled, and544 /// * Address is added to white list, and544 /// * Address is added to allow list, and545 /// * MintPermission is enabled (see SetMintPermission method)545 /// * MintPermission is enabled (see SetMintPermission method)546 ///546 ///547 /// # Arguments547 /// # Argumentspallets/scheduler/src/lib.rsdiffbeforeafterboth62 traits::{Zero, One, BadOrigin, Saturating},62 traits::{Zero, One, BadOrigin, Saturating},63};63};64use frame_support::{64use frame_support::{65 decl_module, decl_storage, decl_event, decl_error, IterableStorageMap,65 decl_module, decl_storage, decl_event, decl_error,66 dispatch::{Dispatchable, DispatchError, DispatchResult, Parameter},66 dispatch::{Dispatchable, DispatchError, DispatchResult, Parameter},67 traits::{67 traits::{68 Get,68 Get,456}456}457457458impl<T: Config> Module<T> {458impl<T: Config> Module<T> {459 /// Migrate storage format from V1 to V2.460 /// Return true if migration is performed.461 pub fn migrate_v1_to_t2() -> bool {462 if StorageVersion::get() == Releases::V1 {463 StorageVersion::put(Releases::V2);464465 Agenda::<T>::translate::<466 Vec<Option<ScheduledV1<<T as Config>::Call, T::BlockNumber>>>,467 _,468 >(|_, agenda| {469 Some(470 agenda471 .into_iter()472 .map(|schedule| {473 schedule.map(|schedule| ScheduledV2 {474 maybe_id: schedule.maybe_id,475 priority: schedule.priority,476 call: schedule.call,477 maybe_periodic: schedule.maybe_periodic,478 origin: system::RawOrigin::Root.into(),479 _phantom: Default::default(),480 })481 })482 .collect::<Vec<_>>(),483 )484 });485486 true487 } else {488 false489 }490 }491492 /// Helper to migrate scheduler when the pallet origin type has changed.493 pub fn migrate_origin<OldOrigin: Into<T::PalletsOrigin> + codec::Decode>() {494 Agenda::<T>::translate::<495 Vec<Option<Scheduled<<T as Config>::Call, T::BlockNumber, OldOrigin, T::AccountId>>>,496 _,497 >(|_, agenda| {498 Some(499 agenda500 .into_iter()501 .map(|schedule| {502 schedule.map(|schedule| Scheduled {503 maybe_id: schedule.maybe_id,504 priority: schedule.priority,505 call: schedule.call,506 maybe_periodic: schedule.maybe_periodic,507 origin: schedule.origin.into(),508 _phantom: Default::default(),509 })510 })511 .collect::<Vec<_>>(),512 )513 });514 }515516 fn resolve_time(when: DispatchTime<T::BlockNumber>) -> Result<T::BlockNumber, DispatchError> {459 fn resolve_time(when: DispatchTime<T::BlockNumber>) -> Result<T::BlockNumber, DispatchError> {517 let now = frame_system::Pallet::<T>::block_number();460 let now = frame_system::Pallet::<T>::block_number();