From a94868ff0606c26cc8188f6160e70dc22a3d45aa Mon Sep 17 00:00:00 2001 From: Fahrrader Date: Wed, 14 Dec 2022 16:46:56 +0000 Subject: [PATCH] chore: fix cargo check warnings --- --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,3 @@ -cargo-features = ["workspace-inheritance"] - [workspace] resolver = "2" members = [ --- 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( - caller: caller, - collection: &CollectionHandle, -) -> Result { - let caller = T::CrossAccountId::from_eth(caller); - collection - .check_is_owner_or_admin(&caller) - .map_err(dispatch_to_evm::)?; - Ok(caller) -} - -/// ### Note -/// Do not forget to add: `self.consume_store_writes(1)?;` -fn save(collection: &CollectionHandle) -> Result { - collection - .check_is_internal() - .map_err(dispatch_to_evm::)?; - collection.save().map_err(dispatch_to_evm::)?; - Ok(()) -} - /// Contains static property keys and values. pub mod static_property { use evm_coder::{ --- 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(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(&self) -> evm_coder::execution::Result 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, } --- 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" --- 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 = ::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, - - #[version(..2)] - pub variable_data: BoundedVec, -} - #[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 = StorageMap; - - /// 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 = StorageNMap< - Key = (Key, Key), - 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 Hooks> for Pallet { - fn on_runtime_upgrade() -> Weight { - let storage_version = StorageVersion::get::>(); - if storage_version < StorageVersion::new(2) { - #[allow(deprecated)] - let _ = >::clear(u32::MAX, None); - } - StorageVersion::new(2).put::>(); - - Weight::zero() - } - } } pub struct RefungibleHandle(pallet_common::CollectionHandle); --- 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, --- 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, }; --- a/runtime/opal/Cargo.toml +++ b/runtime/opal/Cargo.toml @@ -1,8 +1,6 @@ ################################################################################ # Package -cargo-features = ["workspace-inheritance"] - [package] authors = ['Unique Network '] build = 'build.rs' --- a/runtime/quartz/Cargo.toml +++ b/runtime/quartz/Cargo.toml @@ -1,8 +1,6 @@ ################################################################################ # Package -cargo-features = ["workspace-inheritance"] - [package] authors = ['Unique Network '] build = 'build.rs' --- a/runtime/unique/Cargo.toml +++ b/runtime/unique/Cargo.toml @@ -1,8 +1,6 @@ ################################################################################ # Package -cargo-features = ["workspace-inheritance"] - [package] authors = ['Unique Network '] build = 'build.rs' -- gitstuff