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
1cargo-features = ["workspace-inheritance"]
2
3[workspace]1[workspace]
4resolver = "2"2resolver = "2"
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
701 }701 }
702}702}
703
704/// ### Note
705/// 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 collection
712 .check_is_owner_or_admin(&caller)
713 .map_err(dispatch_to_evm::<T>)?;
714 Ok(caller)
715}
716
717/// ### Note
718/// Do not forget to add: `self.consume_store_writes(1)?;`
719fn save<T: Config>(collection: &CollectionHandle<T>) -> Result<void> {
720 collection
721 .check_is_internal()
722 .map_err(dispatch_to_evm::<T>)?;
723 collection.save().map_err(dispatch_to_evm::<T>)?;
724 Ok(())
725}
726703
727/// Contains static property keys and values.704/// Contains static property keys and values.
728pub mod static_property {705pub mod static_property {
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
121}121}
122122
123impl 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) -> Self
125 where126 where
126 T: pallet_evm::Config,127 T: pallet_evm::Config,
139 }140 }
140 }141 }
141142
143 /// 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 where
144 T: pallet_evm::Config,146 T: pallet_evm::Config,
156 }158 }
157}159}
160
161/// 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}
165171
modifiedpallets/foreign-assets/Cargo.tomldiffbeforeafterboth
1cargo-features = ["workspace-inheritance"]
2
3[package]1[package]
4name = "pallet-foreign-assets"2name = "pallet-foreign-assets"
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
74extern crate alloc;74extern crate alloc;
7575
76use 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,
modifiedruntime/common/config/pallets/app_promotion.rsdiffbeforeafterboth
22use 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};
2828
modifiedruntime/opal/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/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
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>']