difftreelog
chore fix cargo check warnings
in: master
10 files changed
Cargo.tomldiffbeforeafterboth1cargo-features = ["workspace-inheritance"]23[workspace]1[workspace]4resolver = "2"2resolver = "2"pallets/common/src/erc.rsdiffbeforeafterboth701 }701 }702}702}703704/// ### Note705/// Do not forget to add: `self.consume_store_reads(1)?;`706fn check_is_owner_or_admin<T: Config>(707 caller: caller,708 collection: &CollectionHandle<T>,709) -> Result<T::CrossAccountId> {710 let caller = T::CrossAccountId::from_eth(caller);711 collection712 .check_is_owner_or_admin(&caller)713 .map_err(dispatch_to_evm::<T>)?;714 Ok(caller)715}716717/// ### Note718/// Do not forget to add: `self.consume_store_writes(1)?;`719fn save<T: Config>(collection: &CollectionHandle<T>) -> Result<void> {720 collection721 .check_is_internal()722 .map_err(dispatch_to_evm::<T>)?;723 collection.save().map_err(dispatch_to_evm::<T>)?;724 Ok(())725}726703727/// Contains static property keys and values.704/// Contains static property keys and values.728pub mod static_property {705pub mod static_property {pallets/common/src/eth.rsdiffbeforeafterboth121}121}122122123impl EthCrossAccount {123impl EthCrossAccount {124 /// Converts `CrossAccountId` to `EthCrossAccount` to be correctly usable with Ethereum.124 pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self125 pub fn from_sub_cross_account<T>(cross_account_id: &T::CrossAccountId) -> Self125 where126 where126 T: pallet_evm::Config,127 T: pallet_evm::Config,139 }140 }140 }141 }141142143 /// Converts `EthCrossAccount` to `CrossAccountId` to be correctly usable with Substrate.142 pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>144 pub fn into_sub_cross_account<T>(&self) -> evm_coder::execution::Result<T::CrossAccountId>143 where145 where144 T: pallet_evm::Config,146 T: pallet_evm::Config,156 }158 }157}159}160161/// Descriptor of the kind of user to be used within collection permissions on certain operations.158#[derive(Default, Debug, Clone, Copy, AbiCoder)]162#[derive(Default, Debug, Clone, Copy, AbiCoder)]159#[repr(u8)]163#[repr(u8)]160pub enum CollectionPermissions {164pub enum CollectionPermissions {165 /// Collection admin.161 #[default]166 #[default]162 CollectionAdmin,167 CollectionAdmin,168 /// Owner of a token.163 TokenOwner,169 TokenOwner,164}170}165171pallets/foreign-assets/Cargo.tomldiffbeforeafterboth1cargo-features = ["workspace-inheritance"]23[package]1[package]4name = "pallet-foreign-assets"2name = "pallet-foreign-assets"pallets/refungible/src/lib.rsdiffbeforeafterboth90use crate::erc_token::ERC20Events;90use crate::erc_token::ERC20Events;91use crate::erc::ERC721Events;91use crate::erc::ERC721Events;929293use 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;135136/// Token data, stored independently from other data used to describe it137/// 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>,142143 #[version(..2)]144 pub variable_data: BoundedVec<u8, CustomDataLimit>,145}146133147#[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;157143193 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>;195196 /// Token data, used to partially describe a token.197 // TODO: remove198 #[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 >;205181206 /// 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 >;287288 #[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>>();297298 Weight::zero()299 }300 }301}263}302264303pub struct RefungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);265pub struct RefungibleHandle<T: Config>(pallet_common::CollectionHandle<T>);pallets/unique/src/lib.rsdiffbeforeafterboth74extern crate alloc;74extern crate alloc;757576use frame_support::{76use frame_support::{77 decl_module, decl_storage, decl_error, decl_event,77 decl_module, decl_storage, decl_error,78 dispatch::DispatchResult,78 dispatch::DispatchResult,79 ensure, fail,79 ensure, fail,80 weights::{Weight},80 weights::{Weight},91 CreateItemData, CollectionLimits, CollectionPermissions, CollectionId, CollectionMode, TokenId,91 CreateItemData, CollectionLimits, CollectionPermissions, CollectionId, CollectionMode, TokenId,92 CreateCollectionData, CreateItemExData, budget, Property, PropertyKey, PropertyKeyPermission,92 CreateCollectionData, CreateItemExData, budget, Property, PropertyKey, PropertyKeyPermission,93};93};94use pallet_evm::{account::CrossAccountId};94use pallet_evm::account::CrossAccountId;95use pallet_common::{95use pallet_common::{96 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,96 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,97 dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,97 dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,runtime/common/config/pallets/app_promotion.rsdiffbeforeafterboth22use frame_support::{parameter_types, PalletId};22use frame_support::{parameter_types, PalletId};23use sp_arithmetic::Perbill;23use sp_arithmetic::Perbill;24use up_common::{24use up_common::{25 constants::{UNIQUE, RELAY_DAYS, DAYS},25 constants::{UNIQUE, RELAY_DAYS},26 types::Balance,26 types::Balance,27};27};2828runtime/opal/Cargo.tomldiffbeforeafterboth1################################################################################1################################################################################2# Package2# Package34cargo-features = ["workspace-inheritance"]536[package]4[package]7authors = ['Unique Network <support@uniquenetwork.io>']5authors = ['Unique Network <support@uniquenetwork.io>']runtime/quartz/Cargo.tomldiffbeforeafterboth1################################################################################1################################################################################2# Package2# Package34cargo-features = ["workspace-inheritance"]536[package]4[package]7authors = ['Unique Network <support@uniquenetwork.io>']5authors = ['Unique Network <support@uniquenetwork.io>']runtime/unique/Cargo.tomldiffbeforeafterboth1################################################################################1################################################################################2# Package2# Package34cargo-features = ["workspace-inheritance"]536[package]4[package]7authors = ['Unique Network <support@uniquenetwork.io>']5authors = ['Unique Network <support@uniquenetwork.io>']