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
--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -90,12 +90,11 @@
 use crate::erc_token::ERC20Events;
 use crate::erc::ERC721Events;
 
-use codec::{Encode, Decode, MaxEncodedLen};
 use core::ops::Deref;
 use derivative::Derivative;
 use evm_coder::ToLog;
 use frame_support::{
-	BoundedBTreeMap, BoundedVec, ensure, fail, storage::with_transaction, transactional,
+	BoundedBTreeMap, ensure, fail, storage::with_transaction, transactional,
 	pallet_prelude::ConstU32,
 };
 use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};
@@ -105,15 +104,14 @@
 	Event as CommonEvent, Pallet as PalletCommon, erc::CollectionHelpersEvents,
 };
 use pallet_structure::Pallet as PalletStructure;
-use scale_info::TypeInfo;
 use sp_core::{Get, H160};
 use sp_runtime::{ArithmeticError, DispatchError, DispatchResult, TransactionOutcome};
 use sp_std::{vec::Vec, vec, collections::btree_map::BTreeMap};
 use up_data_structs::{
 	AccessMode, budget::Budget, CollectionId, CollectionFlags, CollectionPropertiesVec,
-	CreateCollectionData, CustomDataLimit, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH,
-	MAX_REFUNGIBLE_PIECES, Property, PropertyKey, PropertyKeyPermission, PropertyPermission,
-	PropertyScope, PropertyValue, TokenId, TrySetProperty,
+	CreateCollectionData, mapping::TokenAddressMapping, MAX_ITEMS_PER_BATCH, MAX_REFUNGIBLE_PIECES,
+	Property, PropertyKey, PropertyKeyPermission, PropertyPermission, PropertyScope, PropertyValue,
+	TokenId, TrySetProperty,
 };
 
 pub use pallet::*;
@@ -133,17 +131,6 @@
 }
 pub(crate) type SelfWeightOf<T> = <T as Config>::WeightInfo;
 
-/// Token data, stored independently from other data used to describe it
-/// for the convenience of database access. Notably contains the token metadata.
-#[struct_versioning::versioned(version = 2, upper)]
-#[derive(Encode, Decode, Default, TypeInfo, MaxEncodedLen)]
-pub struct ItemData {
-	pub const_data: BoundedVec<u8, CustomDataLimit>,
-
-	#[version(..2)]
-	pub variable_data: BoundedVec<u8, CustomDataLimit>,
-}
-
 #[frame_support::pallet]
 pub mod pallet {
 	use super::*;
@@ -151,7 +138,6 @@
 		Blake2_128, Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key,
 		traits::StorageVersion,
 	};
-	use frame_system::pallet_prelude::*;
 	use up_data_structs::{CollectionId, TokenId};
 	use super::weights::WeightInfo;
 
@@ -192,16 +178,6 @@
 	#[pallet::storage]
 	pub type TokensBurnt<T: Config> =
 		StorageMap<Hasher = Twox64Concat, Key = CollectionId, Value = u32, QueryKind = ValueQuery>;
-
-	/// Token data, used to partially describe a token.
-	// TODO: remove
-	#[pallet::storage]
-	#[deprecated(since = "0.2.0", note = "ItemData is no more contains usefull data")]
-	pub type TokenData<T: Config> = StorageNMap<
-		Key = (Key<Twox64Concat, CollectionId>, Key<Twox64Concat, TokenId>),
-		Value = ItemData,
-		QueryKind = ValueQuery,
-	>;
 
 	/// Amount of pieces a refungible token is split into.
 	#[pallet::storage]
@@ -284,20 +260,6 @@
 		Value = bool,
 		QueryKind = ValueQuery,
 	>;
-
-	#[pallet::hooks]
-	impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
-		fn on_runtime_upgrade() -> Weight {
-			let storage_version = StorageVersion::get::<Pallet<T>>();
-			if storage_version < StorageVersion::new(2) {
-				#[allow(deprecated)]
-				let _ = <TokenData<T>>::clear(u32::MAX, None);
-			}
-			StorageVersion::new(2).put::<Pallet<T>>();
-
-			Weight::zero()
-		}
-	}
 }
 
 pub 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
1################################################################################1################################################################################
2# Package2# Package
3
4cargo-features = ["workspace-inheritance"]
53
6[package]4[package]
7authors = ['Unique Network <support@uniquenetwork.io>']5authors = ['Unique Network <support@uniquenetwork.io>']
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'