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

difftreelog

chore fix cargo check warnings

Fahrrader2022-12-14parent: #966149d.patch.diff
in: master

10 files changed

modifiedCargo.tomldiffbeforeafterboth
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,3 @@
-cargo-features = ["workspace-inheritance"]
-
 [workspace]
 resolver = "2"
 members = [
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -701,29 +701,6 @@
 	}
 }
 
-/// ### Note
-/// Do not forget to add: `self.consume_store_reads(1)?;`
-fn check_is_owner_or_admin<T: Config>(
-	caller: caller,
-	collection: &CollectionHandle<T>,
-) -> Result<T::CrossAccountId> {
-	let caller = T::CrossAccountId::from_eth(caller);
-	collection
-		.check_is_owner_or_admin(&caller)
-		.map_err(dispatch_to_evm::<T>)?;
-	Ok(caller)
-}
-
-/// ### Note
-/// Do not forget to add: `self.consume_store_writes(1)?;`
-fn save<T: Config>(collection: &CollectionHandle<T>) -> Result<void> {
-	collection
-		.check_is_internal()
-		.map_err(dispatch_to_evm::<T>)?;
-	collection.save().map_err(dispatch_to_evm::<T>)?;
-	Ok(())
-}
-
 /// Contains static property keys and values.
 pub mod static_property {
 	use evm_coder::{
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -121,6 +121,7 @@
 }
 
 impl EthCrossAccount {
+	/// Converts `CrossAccountId` to `EthCrossAccount` to be correctly usable with Ethereum.
 	pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self
 	where
 		T: pallet_evm::Config,
@@ -139,6 +140,7 @@
 		}
 	}
 
+	/// Converts `EthCrossAccount` to `CrossAccountId` to be correctly usable with Substrate.
 	pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>
 	where
 		T: pallet_evm::Config,
@@ -155,10 +157,14 @@
 		}
 	}
 }
+
+/// Descriptor of the kind of user to be used within collection permissions on certain operations.
 #[derive(Default, Debug, Clone, Copy, AbiCoder)]
 #[repr(u8)]
 pub enum CollectionPermissions {
+	/// Collection admin.
 	#[default]
 	CollectionAdmin,
+	/// Owner of a token.
 	TokenOwner,
 }
modifiedpallets/foreign-assets/Cargo.tomldiffbeforeafterboth
--- a/pallets/foreign-assets/Cargo.toml
+++ b/pallets/foreign-assets/Cargo.toml
@@ -1,5 +1,3 @@
-cargo-features = ["workspace-inheritance"]
-
 [package]
 name = "pallet-foreign-assets"
 version = "0.1.0"
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
90use crate::erc_token::ERC20Events;90use crate::erc_token::ERC20Events;
91use crate::erc::ERC721Events;91use crate::erc::ERC721Events;
9292
93use codec::{Encode, Decode, MaxEncodedLen};
94use core::ops::Deref;93use core::ops::Deref;
95use derivative::Derivative;94use derivative::Derivative;
96use evm_coder::ToLog;95use evm_coder::ToLog;
97use frame_support::{96use frame_support::{
98 BoundedBTreeMap, BoundedVec, ensure, fail, storage::with_transaction, transactional,97 BoundedBTreeMap, ensure, fail, storage::with_transaction, transactional,
99 pallet_prelude::ConstU32,98 pallet_prelude::ConstU32,
100};99};
101use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};100use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
105 Event as CommonEvent, Pallet as PalletCommon, erc::CollectionHelpersEvents,104 Event as CommonEvent, Pallet as PalletCommon, erc::CollectionHelpersEvents,
106};105};
107use pallet_structure::Pallet as PalletStructure;106use pallet_structure::Pallet as PalletStructure;
108use scale_info::TypeInfo;
109use sp_core::{Get, H160};107use sp_core::{Get, H160};
110use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};108use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
111use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};109use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
112use up_data_structs::{110use up_data_structs::{
113 AccessMode, budget::Budget, CollectionId, CollectionFlags, CollectionPropertiesVec,111 AccessMode, budget::Budget, CollectionId, CollectionFlags, CollectionPropertiesVec,
114 CreateCollectionData, CustomDataLimit, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH,112 CreateCollectionData, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH, MAX_REFUNGIBLE_PIECES,
115 MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,113 Property, PropertyKey, PropertyKeyPermission, PropertyPermission, PropertyScope, PropertyValue,
116 PropertyScope, PropertyValue, TokenId, TrySetProperty,114 TokenId, TrySetProperty,
117};115};
133}131}
134pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;132pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
135
136/// Token data, stored independently from other data used to describe it
137/// for the convenience of database access. Notably contains the token metadata.
138#[struct_versioning::versioned(version = 2, upper)]
139#[derive(Encode, Decode, Default, TypeInfo, MaxEncodedLen)]
140pub struct ItemData {
141 pub const_data: BoundedVec<u8, CustomDataLimit>,
142
143 #[version(..2)]
144 pub variable_data: BoundedVec<u8, CustomDataLimit>,
145}
146133
147#[frame_support::pallet]134#[frame_support::pallet]
148pub mod pallet {135pub mod pallet {
151 Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key,138 Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key,
152 traits::StorageVersion,139 traits::StorageVersion,
153 };140 };
154 use frame_system::pallet_prelude::*;
155 use up_data_structs::{CollectionId, TokenId};141 use up_data_structs::{CollectionId, TokenId};
156 use super::weights::WeightInfo;142 use super::weights::WeightInfo;
157143
193 pub type TokensBurnt<T: Config> =179 pub type TokensBurnt<T: Config> =
194 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;180 StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
195
196 /// Token data, used to partially describe a token.
197 // TODO: remove
198 #[pallet::storage]
199 #[deprecated(since = "0.2.0", note = "ItemData is no more contains usefull data")]
200 pub type TokenData<T: Config> = StorageNMap<
201 Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
202 Value = ItemData,
203 QueryKind = ValueQuery,
204 >;
205181
206 /// Amount of pieces a refungible token is split into.182 /// Amount of pieces a refungible token is split into.
207 #[pallet::storage]183 #[pallet::storage]
285 QueryKind = ValueQuery,261 QueryKind = ValueQuery,
286 >;262 >;
287
288 #[pallet::hooks]
289 impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
290 fn on_runtime_upgrade() -> Weight {
291 let storage_version = StorageVersion::get::<Pallet<T>>();
292 if storage_version < StorageVersion::new(2) {
293 #[allow(deprecated)]
294 let _ = <TokenData<T>>::clear(u32::MAX, None);
295 }
296 StorageVersion::new(2).put::<Pallet<T>>();
297
298 Weight::zero()
299 }
300 }
301}263}
302264
303pub struct RefungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);265pub struct RefungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -74,7 +74,7 @@
 extern crate alloc;
 
 use frame_support::{
-	decl_module, decl_storage, decl_error, decl_event,
+	decl_module, decl_storage, decl_error,
 	dispatch::DispatchResult,
 	ensure, fail,
 	weights::{Weight},
@@ -91,7 +91,7 @@
 	CreateItemData, CollectionLimits, CollectionPermissions, CollectionId, CollectionMode, TokenId,
 	CreateCollectionData, CreateItemExData, budget, Property, PropertyKey, PropertyKeyPermission,
 };
-use pallet_evm::{account::CrossAccountId};
+use pallet_evm::account::CrossAccountId;
 use pallet_common::{
 	CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,
 	dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,
modifiedruntime/common/config/pallets/app_promotion.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/app_promotion.rs
+++ b/runtime/common/config/pallets/app_promotion.rs
@@ -22,7 +22,7 @@
 use frame_support::{parameter_types, PalletId};
 use sp_arithmetic::Perbill;
 use up_common::{
-	constants::{UNIQUE, RELAY_DAYS, DAYS},
+	constants::{UNIQUE, RELAY_DAYS},
 	types::Balance,
 };
 
modifiedruntime/opal/Cargo.tomldiffbeforeafterboth
--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -1,8 +1,6 @@
 ################################################################################
 # Package
 
-cargo-features = ["workspace-inheritance"]
-
 [package]
 authors = ['Unique Network <support@uniquenetwork.io>']
 build = 'build.rs'
modifiedruntime/quartz/Cargo.tomldiffbeforeafterboth
--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -1,8 +1,6 @@
 ################################################################################
 # Package
 
-cargo-features = ["workspace-inheritance"]
-
 [package]
 authors = ['Unique Network <support@uniquenetwork.io>']
 build = 'build.rs'
modifiedruntime/unique/Cargo.tomldiffbeforeafterboth
--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -1,8 +1,6 @@
 ################################################################################
 # Package
 
-cargo-features = ["workspace-inheritance"]
-
 [package]
 authors = ['Unique Network <support@uniquenetwork.io>']
 build = 'build.rs'