difftreelog
Merge pull request #1007 from UniqueNetwork/fix/token-properties-benchmarks
in: master
Fix token properties and nesting weights
32 files changed
pallets/balances-adapter/src/common.rsdiffbeforeafterboth30 Weight::default()30 Weight::default()31 }31 }3233 fn delete_collection_properties(_amount: u32) -> Weight {34 Weight::default()35 }363237 fn set_token_properties(_amount: u32) -> Weight {33 fn set_token_properties(_amount: u32) -> Weight {38 Weight::default()34 Weight::default()39 }35 }4041 fn delete_token_properties(_amount: u32) -> Weight {42 Weight::default()43 }443645 fn set_token_property_permissions(_amount: u32) -> Weight {37 fn set_token_property_permissions(_amount: u32) -> Weight {46 Weight::default()38 Weight::default()66 Weight::default()58 Weight::default()67 }59 }6869 fn burn_recursively_self_raw() -> Weight {70 Weight::default()71 }7273 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {74 Weight::default()75 }7677 fn token_owner() -> Weight {78 Weight::default()79 }806081 fn set_allowance_for_all() -> Weight {61 fn set_allowance_for_all() -> Weight {82 Weight::default()62 Weight::default()128 fail!(<pallet_common::Error<T>>::UnsupportedOperation);108 fail!(<pallet_common::Error<T>>::UnsupportedOperation);129 }109 }130131 fn burn_item_recursively(132 &self,133 _sender: <T>::CrossAccountId,134 _token: TokenId,135 _self_budget: &dyn up_data_structs::budget::Budget,136 _breadth_budget: &dyn up_data_structs::budget::Budget,137 ) -> frame_support::pallet_prelude::DispatchResultWithPostInfo {138 fail!(<pallet_common::Error<T>>::UnsupportedOperation);139 }140110141 fn set_collection_properties(111 fn set_collection_properties(142 &self,112 &self,pallets/common/src/benchmarking.rsdiffbeforeafterboth29use sp_std::{vec, vec::Vec};29use sp_std::{vec, vec::Vec};30use up_data_structs::{30use up_data_structs::{31 AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,31 AccessMode, CollectionId, CollectionMode, CollectionPermissions, CreateCollectionData,32 NestingPermissions, PropertiesPermissionMap, Property, PropertyKey, PropertyValue,32 NestingPermissions, Property, PropertyKey, PropertyValue, MAX_COLLECTION_DESCRIPTION_LENGTH,33 MAX_COLLECTION_DESCRIPTION_LENGTH, MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM,33 MAX_COLLECTION_NAME_LENGTH, MAX_PROPERTIES_PER_ITEM, MAX_TOKEN_PREFIX_LENGTH,34 MAX_TOKEN_PREFIX_LENGTH,35};34};363537use crate::{CollectionHandle, Config, Pallet};36use crate::{BenchmarkPropertyWriter, CollectionHandle, Config, Pallet};383739const SEED: u32 = 1;38const SEED: u32 = 1;4039126 )125 )127}126}128129pub fn load_is_admin_and_property_permissions<T: Config>(130 collection: &CollectionHandle<T>,131 sender: &T::CrossAccountId,132) -> (bool, PropertiesPermissionMap) {133 (134 collection.is_owner_or_admin(sender),135 <Pallet<T>>::property_permissions(collection.id),136 )137}138127139/// Helper macros, which handles all benchmarking preparation in semi-declarative way128/// Helper macros, which handles all benchmarking preparation in semi-declarative way140///129///205 Ok(())194 Ok(())206 }195 }207208 #[benchmark]209 fn delete_collection_properties(210 b: Linear<0, MAX_PROPERTIES_PER_ITEM>,211 ) -> Result<(), BenchmarkError> {212 bench_init! {213 owner: sub; collection: collection(owner);214 owner: cross_from_sub;215 };216 let props = (0..b)217 .map(|p| Property {218 key: property_key(p as usize),219 value: property_value(),220 })221 .collect::<Vec<_>>();222 <Pallet<T>>::set_collection_properties(&collection, &owner, props.into_iter())?;223 let to_delete = (0..b).map(|p| property_key(p as usize)).collect::<Vec<_>>();224225 #[block]226 {227 <Pallet<T>>::delete_collection_properties(&collection, &owner, to_delete.into_iter())?;228 }229230 Ok(())231 }232196233 #[benchmark]197 #[benchmark]234 fn check_accesslist() -> Result<(), BenchmarkError> {198 fn check_accesslist() -> Result<(), BenchmarkError> {263 }227 }264228265 #[benchmark]229 #[benchmark]266 fn init_token_properties_common() -> Result<(), BenchmarkError> {230 fn property_writer_load_collection_info() -> Result<(), BenchmarkError> {267 bench_init! {231 bench_init! {268 owner: sub; collection: collection(owner);232 owner: sub; collection: collection(owner);269 sender: sub;233 sender: sub;272236273 #[block]237 #[block]274 {238 {275 load_is_admin_and_property_permissions(&collection, &sender);239 <BenchmarkPropertyWriter<T>>::load_collection_info(&&collection, &sender);276 }240 }277241278 Ok(())242 Ok(())pallets/common/src/erc.rsdiffbeforeafterboth126 ///126 ///127 /// @param key Property key.127 /// @param key Property key.128 #[solidity(hide)]128 #[solidity(hide)]129 #[weight(<SelfWeightOf<T>>::delete_collection_properties(1))]129 #[weight(<SelfWeightOf<T>>::set_collection_properties(1))]130 fn delete_collection_property(&mut self, caller: Caller, key: String) -> Result<()> {130 fn delete_collection_property(&mut self, caller: Caller, key: String) -> Result<()> {131 let caller = T::CrossAccountId::from_eth(caller);131 let caller = T::CrossAccountId::from_eth(caller);132 let key = <Vec<u8>>::from(key)132 let key = <Vec<u8>>::from(key)139 /// Delete collection properties.139 /// Delete collection properties.140 ///140 ///141 /// @param keys Properties keys.141 /// @param keys Properties keys.142 #[weight(<SelfWeightOf<T>>::delete_collection_properties(keys.len() as u32))]142 #[weight(<SelfWeightOf<T>>::set_collection_properties(keys.len() as u32))]143 fn delete_collection_properties(&mut self, caller: Caller, keys: Vec<String>) -> Result<()> {143 fn delete_collection_properties(&mut self, caller: Caller, keys: Vec<String>) -> Result<()> {144 let caller = T::CrossAccountId::from_eth(caller);144 let caller = T::CrossAccountId::from_eth(caller);145 let keys = keys145 let keys = keyspallets/common/src/lib.rsdiffbeforeafterboth53#![cfg_attr(not(feature = "std"), no_std)]53#![cfg_attr(not(feature = "std"), no_std)]54extern crate alloc;54extern crate alloc;555556use alloc::boxed::Box;56use core::{57use core::{57 marker::PhantomData,58 marker::PhantomData,58 ops::{Deref, DerefMut},59 ops::{Deref, DerefMut},59 slice::from_ref,60 slice::from_ref,61 unreachable,60};62};616362use evm_coder::ToLog;64use evm_coder::ToLog;871 >;873 >;872}874}873875876enum LazyValueState<'a, T> {877 Pending(Box<dyn FnOnce() -> T + 'a>),878 InProgress,879 Computed(T),880}881874/// Value representation with delayed initialization time.882/// Value representation with delayed initialization time.875pub struct LazyValue<T, F: FnOnce() -> T> {883pub struct LazyValue<'a, T> {876 value: Option<T>,884 state: LazyValueState<'a, T>,877 f: Option<F>,878}885}879886880impl<T, F: FnOnce() -> T> LazyValue<T, F> {887impl<'a, T> LazyValue<'a, T> {881 /// Create a new LazyValue.888 /// Create a new LazyValue.882 pub fn new(f: F) -> Self {889 pub fn new(f: impl FnOnce() -> T + 'a) -> Self {883 Self {890 Self {884 value: None,891 state: LazyValueState::Pending(Box::new(f)),885 f: Some(f),886 }892 }887 }893 }888894889 /// Get the value. If it is called the first time, the value will be initialized.895 /// Get the value. If it is called the first time, the value will be initialized.890 pub fn value(&mut self) -> &T {896 pub fn value(&mut self) -> &T {891 self.force_value();897 self.force_value();892 self.value.as_ref().unwrap()898 self.value_mut()893 }899 }894900895 /// Get the value. If it is called the first time, the value will be initialized.901 /// Get the value. If it is called the first time, the value will be initialized.896 pub fn value_mut(&mut self) -> &mut T {902 pub fn value_mut(&mut self) -> &mut T {897 self.force_value();903 self.force_value();904898 self.value.as_mut().unwrap()905 if let LazyValueState::Computed(value) = &mut self.state {906 value907 } else {908 unreachable!()909 }899 }910 }900911901 fn into_inner(mut self) -> T {912 fn into_inner(mut self) -> T {902 self.force_value();913 self.force_value();903 self.value.unwrap()914 if let LazyValueState::Computed(value) = self.state {915 value916 } else {917 unreachable!()918 }904 }919 }905920906 /// Is value initialized?921 /// Is value initialized?907 pub fn has_value(&self) -> bool {922 pub fn has_value(&self) -> bool {908 self.value.is_some()923 matches!(self.state, LazyValueState::Computed(_))909 }924 }910925911 fn force_value(&mut self) {926 fn force_value(&mut self) {912 if self.value.is_none() {927 use LazyValueState::*;928929 if self.has_value() {913 self.value = Some(self.f.take().unwrap()())930 return;914 }931 }932933 match sp_std::mem::replace(&mut self.state, InProgress) {934 Pending(f) => self.state = Computed(f()),935 _ => panic!("recursion isn't supported"),936 }915 }937 }916}938}917939918fn check_token_permissions<T, FCA, FTO, FTE>(940fn check_token_permissions<T: Config>(919 collection_admin_permitted: bool,941 collection_admin_permitted: bool,920 token_owner_permitted: bool,942 token_owner_permitted: bool,921 is_collection_admin: &mut LazyValue<bool, FCA>,943 is_collection_admin: &mut LazyValue<bool>,922 is_token_owner: &mut LazyValue<Result<bool, DispatchError>, FTO>,944 is_token_owner: &mut LazyValue<Result<bool, DispatchError>>,923 is_token_exist: &mut LazyValue<bool, FTE>,945 is_token_exist: &mut LazyValue<bool>,924) -> DispatchResult946) -> DispatchResult {925where926 T: Config,927 FCA: FnOnce() -> bool,928 FTO: FnOnce() -> Result<bool, DispatchError>,929 FTE: FnOnce() -> bool,930{931 if !(collection_admin_permitted && *is_collection_admin.value()947 if !(collection_admin_permitted && *is_collection_admin.value()932 || token_owner_permitted && (*is_token_owner.value())?)948 || token_owner_permitted && (*is_token_owner.value())?)933 {949 {1902 /// Collection property deletion weight.1918 /// Collection property deletion weight.1903 ///1919 ///1904 /// * `amount`- The number of properties to set.1920 /// * `amount`- The number of properties to set.1905 fn delete_collection_properties(amount: u32) -> Weight;1921 fn delete_collection_properties(amount: u32) -> Weight {1922 Self::set_collection_properties(amount)1923 }190619241907 /// Token property setting weight.1925 /// Token property setting weight.1908 ///1926 ///1912 /// Token property deletion weight.1930 /// Token property deletion weight.1913 ///1931 ///1914 /// * `amount`- The number of properties to delete.1932 /// * `amount`- The number of properties to delete.1915 fn delete_token_properties(amount: u32) -> Weight;1933 fn delete_token_properties(amount: u32) -> Weight {1934 Self::set_token_properties(amount)1935 }191619361917 /// Token property permissions set weight.1937 /// Token property permissions set weight.1918 ///1938 ///1934 /// The price of burning a token from another user.1954 /// The price of burning a token from another user.1935 fn burn_from() -> Weight;1955 fn burn_from() -> Weight;193619561937 /// Differs from burn_item in case of Fungible and Refungible, as it should burn1938 /// whole users's balance.1939 ///1940 /// This method shouldn't be used directly, as it doesn't count breadth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead1941 fn burn_recursively_self_raw() -> Weight;19421943 /// Cost of iterating over `amount` children while burning, without counting child burning itself.1944 ///1945 /// This method shouldn't be used directly, as it doesn't count depth price, use [burn_recursively](CommonWeightInfo::burn_recursively) instead1946 fn burn_recursively_breadth_raw(amount: u32) -> Weight;19471948 /// The price of recursive burning a token.1949 ///1950 /// `max_selfs` - The maximum burning weight of the token itself.1951 /// `max_breadth` - The maximum number of nested tokens to burn.1952 fn burn_recursively(max_selfs: u32, max_breadth: u32) -> Weight {1953 Self::burn_recursively_self_raw()1954 .saturating_mul(max_selfs.max(1) as u64)1955 .saturating_add(Self::burn_recursively_breadth_raw(max_breadth))1956 }19571958 /// The price of retrieving token owner1959 fn token_owner() -> Weight;19601961 /// The price of setting approval for all1957 /// The price of setting approval for all1962 fn set_allowance_for_all() -> Weight;1958 fn set_allowance_for_all() -> Weight;196319592029 amount: u128,2025 amount: u128,2030 ) -> DispatchResultWithPostInfo;2026 ) -> DispatchResultWithPostInfo;203120272032 /// Burn token and all nested tokens recursievly.2033 ///2034 /// * `sender` - The user who owns the token.2035 /// * `token` - Token id that will burned.2036 /// * `self_budget` - The budget that can be spent on burning tokens.2037 /// * `breadth_budget` - The budget that can be spent on burning nested tokens.2038 fn burn_item_recursively(2039 &self,2040 sender: T::CrossAccountId,2041 token: TokenId,2042 self_budget: &dyn Budget,2043 breadth_budget: &dyn Budget,2044 ) -> DispatchResultWithPostInfo;20452046 /// Set collection properties.2028 /// Set collection properties.2047 ///2029 ///2048 /// * `sender` - Must be either the owner of the collection or its admin.2030 /// * `sender` - Must be either the owner of the collection or its admin.2374 }2356 }2375}2357}237623582377/// A marker structure that enables the writer implementation2378/// to provide the interface to write properties to **newly created** tokens.2379pub struct NewTokenPropertyWriter;23802381/// A marker structure that enables the writer implementation2382/// to provide the interface to write properties to **already existing** tokens.2383pub struct ExistingTokenPropertyWriter;23842385/// The type-safe interface for writing properties (setting or deleting) to tokens.2359/// The type-safe interface for writing properties (setting or deleting) to tokens.2386/// It has two distinct implementations for newly created tokens and existing ones.2360/// It has two distinct implementations for newly created tokens and existing ones.2387///2361///2388/// This type utilizes the lazy evaluation to avoid repeating the computation2362/// This type utilizes the lazy evaluation to avoid repeating the computation2389/// of several performance-heavy or PoV-heavy tasks,2363/// of several performance-heavy or PoV-heavy tasks,2390/// such as checking the indirect ownership or reading the token property permissions.2364/// such as checking the indirect ownership or reading the token property permissions.2391pub struct PropertyWriter<2365pub struct PropertyWriter<'a, WriterVariant, T, Handle> {2392 'a,2393 T,2394 Handle,2395 WriterVariant,2396 FIsAdmin,2397 FPropertyPermissions,2398 FCheckTokenExist,2399 FGetProperties,2400> where2401 T: Config,2402 FIsAdmin: FnOnce() -> bool,2403 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2404{2405 collection: &'a Handle,2366 collection: &'a Handle,2406 is_collection_admin: LazyValue<bool, FIsAdmin>,2367 collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,2407 property_permissions: LazyValue<PropertiesPermissionMap, FPropertyPermissions>,2408 check_token_exist: FCheckTokenExist,2409 get_properties: FGetProperties,2410 _phantom: PhantomData<(T, WriterVariant)>,2368 _phantom: PhantomData<(T, WriterVariant)>,2411}2369}241223702413impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>2371impl<'a, T, Handle, WriterVariant> PropertyWriter<'a, WriterVariant, T, Handle>2414 PropertyWriter<2415 'a,2416 T,2417 Handle,2418 NewTokenPropertyWriter,2419 FIsAdmin,2420 FPropertyPermissions,2421 FCheckTokenExist,2422 FGetProperties,2423 > where2372where2424 T: Config,2373 T: Config,2425 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2374 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2426 FIsAdmin: FnOnce() -> bool,2427 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2428 FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2429 FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2430{2375{2431 /// A function to write properties to a **newly created** token.2376 fn internal_write_token_properties(2432 pub fn write_token_properties(2433 &mut self,2377 &mut self,2434 mint_target_is_sender: bool,2435 token_id: TokenId,2378 token_id: TokenId,2436 properties_updates: impl Iterator<Item = Property>,2379 mut token_lazy_info: PropertyWriterLazyTokenInfo,2437 log: evm_coder::ethereum::Log,2438 ) -> DispatchResult {2439 self.internal_write_token_properties(2440 token_id,2441 properties_updates.map(|p| (p.key, Some(p.value))),2442 |_| Ok(mint_target_is_sender),2443 log,2444 )2445 }2446}24472448impl<'a, T, Handle, FIsAdmin, FPropertyPermissions, FCheckTokenExist, FGetProperties>2449 PropertyWriter<2450 'a,2451 T,2452 Handle,2453 ExistingTokenPropertyWriter,2454 FIsAdmin,2455 FPropertyPermissions,2456 FCheckTokenExist,2457 FGetProperties,2458 > where2459 T: Config,2460 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2461 FIsAdmin: FnOnce() -> bool,2462 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2463 FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2464 FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2465{2466 /// A function to write properties to an **already existing** token.2467 pub fn write_token_properties(2468 &mut self,2469 sender: &T::CrossAccountId,2470 token_id: TokenId,2471 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2380 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2472 nesting_budget: &dyn Budget,2473 log: evm_coder::ethereum::Log,2381 log: evm_coder::ethereum::Log,2474 ) -> DispatchResult {2382 ) -> DispatchResult {2475 self.internal_write_token_properties(2476 token_id,2477 properties_updates,2478 |collection| collection.check_token_indirect_owner(token_id, sender, nesting_budget),2479 log,2480 )2481 }2482}24832484impl<2485 'a,2486 T,2487 Handle,2488 WriterVariant,2489 FIsAdmin,2490 FPropertyPermissions,2491 FCheckTokenExist,2492 FGetProperties,2493 >2494 PropertyWriter<2495 'a,2496 T,2497 Handle,2498 WriterVariant,2499 FIsAdmin,2500 FPropertyPermissions,2501 FCheckTokenExist,2502 FGetProperties,2503 > where2504 T: Config,2505 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2506 FIsAdmin: FnOnce() -> bool,2507 FPropertyPermissions: FnOnce() -> PropertiesPermissionMap,2508 FCheckTokenExist: Copy + FnOnce(TokenId) -> bool,2509 FGetProperties: Copy + FnOnce(TokenId) -> TokenProperties,2510{2511 fn internal_write_token_properties<FCheckTokenOwner>(2512 &mut self,2513 token_id: TokenId,2514 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2515 check_token_owner: FCheckTokenOwner,2516 log: evm_coder::ethereum::Log,2517 ) -> DispatchResult2518 where2519 FCheckTokenOwner: FnOnce(&Handle) -> Result<bool, DispatchError>,2520 {2521 let get_properties = self.get_properties;2522 let mut stored_properties = LazyValue::new(move || get_properties(token_id));25232524 let mut is_token_owner = LazyValue::new(|| check_token_owner(self.collection));25252526 let check_token_exist = self.check_token_exist;2527 let mut is_token_exist = LazyValue::new(move || check_token_exist(token_id));25282529 for (key, value) in properties_updates {2383 for (key, value) in properties_updates {2530 let permission = self2384 let permission = self2385 .collection_lazy_info2531 .property_permissions2386 .property_permissions2532 .value()2387 .value()2533 .get(&key)2388 .get(&key)253623912537 match permission {2392 match permission {2538 PropertyPermission { mutable: false, .. }2393 PropertyPermission { mutable: false, .. }2539 if stored_properties.value().get(&key).is_some() =>2394 if token_lazy_info2395 .stored_properties2396 .value()2397 .get(&key)2398 .is_some() =>2540 {2399 {2541 return Err(<Error<T>>::NoPermission.into());2400 return Err(<Error<T>>::NoPermission.into());2542 }2401 }2545 collection_admin,2404 collection_admin,2546 token_owner,2405 token_owner,2547 ..2406 ..2548 } => check_token_permissions::<T, _, _, _>(2407 } => check_token_permissions::<T>(2549 collection_admin,2408 collection_admin,2550 token_owner,2409 token_owner,2551 &mut self.is_collection_admin,2410 &mut self.collection_lazy_info.is_collection_admin,2552 &mut is_token_owner,2411 &mut token_lazy_info.is_token_owner,2553 &mut is_token_exist,2412 &mut token_lazy_info.is_token_exist,2554 )?,2413 )?,2555 }2414 }255624152557 match value {2416 match value {2558 Some(value) => {2417 Some(value) => {2559 stored_properties2418 token_lazy_info2419 .stored_properties2560 .value_mut()2420 .value_mut()2561 .try_set(key.clone(), value)2421 .try_set(key.clone(), value)2562 .map_err(<Error<T>>::from)?;2422 .map_err(<Error<T>>::from)?;2568 ));2428 ));2569 }2429 }2570 None => {2430 None => {2571 stored_properties2431 token_lazy_info2432 .stored_properties2572 .value_mut()2433 .value_mut()2573 .remove(&key)2434 .remove(&key)2574 .map_err(<Error<T>>::from)?;2435 .map_err(<Error<T>>::from)?;2582 }2443 }2583 }2444 }258424452585 let properties_changed = stored_properties.has_value();2446 let properties_changed = token_lazy_info.stored_properties.has_value();2586 if properties_changed {2447 if properties_changed {2587 <PalletEvm<T>>::deposit_log(log);2448 <PalletEvm<T>>::deposit_log(log);258824492589 self.collection2450 self.collection2590 .set_token_properties_raw(token_id, stored_properties.into_inner());2451 .set_token_properties_raw(token_id, token_lazy_info.stored_properties.into_inner());2591 }2452 }259224532593 Ok(())2454 Ok(())2594 }2455 }2595}2456}259624572597/// Create a [`PropertyWriter`] for newly created tokens.2458/// A helper structure for the [`PropertyWriter`] that holds2459/// the collection-related info. The info is loaded using lazy evaluation.2460/// This info is common for any token for which we write properties.2598pub fn property_writer_for_new_token<'a, T, Handle>(2461pub struct PropertyWriterLazyCollectionInfo<'a> {2599 collection: &'a Handle,2462 is_collection_admin: LazyValue<'a, bool>,2600 sender: &'a T::CrossAccountId,2463 property_permissions: LazyValue<'a, PropertiesPermissionMap>,2464}24652601) -> PropertyWriter<2466/// A helper structure for the [`PropertyWriter`] that holds2467/// the token-related info. The info is loaded using lazy evaluation.2468pub struct PropertyWriterLazyTokenInfo<'a> {2602 'a,2469 is_token_exist: LazyValue<'a, bool>,2603 T,2470 is_token_owner: LazyValue<'a, Result<bool, DispatchError>>,2604 Handle,2471 stored_properties: LazyValue<'a, TokenProperties>,2472}24732474impl<'a> PropertyWriterLazyTokenInfo<'a> {2605 NewTokenPropertyWriter,2475 /// Create a lazy token info.2606 impl FnOnce() -> bool + 'a,2476 pub fn new(2477 check_token_exist: impl FnOnce() -> bool + 'a,2607 impl FnOnce() -> PropertiesPermissionMap + 'a,2478 check_token_owner: impl FnOnce() -> Result<bool, DispatchError> + 'a,2608 impl Copy + FnOnce(TokenId) -> bool + 'a,2479 get_token_properties: impl FnOnce() -> TokenProperties + 'a,2609 impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,2480 ) -> Self {2481 Self {2482 is_token_exist: LazyValue::new(check_token_exist),2483 is_token_owner: LazyValue::new(check_token_owner),2484 stored_properties: LazyValue::new(get_token_properties),2485 }2486 }2487}24882489/// A marker structure that enables the writer implementation2490/// to provide the interface to write properties to **newly created** tokens.2491pub struct NewTokenPropertyWriter<T>(PhantomData<T>);2492impl<T: Config> NewTokenPropertyWriter<T> {2493 /// Creates a [`PropertyWriter`] for **newly created** tokens.2494 pub fn new<'a, Handle>(2495 collection: &'a Handle,2496 sender: &'a T::CrossAccountId,2497 ) -> PropertyWriter<'a, Self, T, Handle>2498 where2499 T: Config,2500 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2501 {2502 PropertyWriter {2503 collection,2504 collection_lazy_info: PropertyWriterLazyCollectionInfo {2505 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2506 property_permissions: LazyValue::new(|| {2507 <Pallet<T>>::property_permissions(collection.id)2508 }),2509 },2510 _phantom: PhantomData,2511 }2512 }2513}25142610>2515impl<'a, T, Handle> PropertyWriter<'a, NewTokenPropertyWriter<T>, T, Handle>2611where2516where2612 T: Config,2517 T: Config,2613 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2518 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2614{2519{2615 PropertyWriter {2520 /// A function to write properties to a **newly created** token.2616 collection,2521 pub fn write_token_properties(2522 &mut self,2617 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2523 mint_target_is_sender: bool,2524 token_id: TokenId,2618 property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),2525 properties_updates: impl Iterator<Item = Property>,2526 log: evm_coder::ethereum::Log,2619 check_token_exist: |token_id| {2527 ) -> DispatchResult {2528 let check_token_exist = || {2620 debug_assert!(collection.token_exists(token_id));2529 debug_assert!(self.collection.token_exists(token_id));2621 true2530 true2622 },2531 };25322623 get_properties: |token_id| {2533 let check_token_owner = || Ok(mint_target_is_sender);25342535 let get_token_properties = || {2624 debug_assert!(collection.get_token_properties_raw(token_id).is_none());2536 debug_assert!(self.collection.get_token_properties_raw(token_id).is_none());2625 TokenProperties::new()2537 TokenProperties::new()2626 },2538 };25392540 self.internal_write_token_properties(2541 token_id,2627 _phantom: PhantomData,2542 PropertyWriterLazyTokenInfo::new(2543 check_token_exist,2544 check_token_owner,2545 get_token_properties,2546 ),2547 properties_updates.map(|p| (p.key, Some(p.value))),2548 log,2549 )2628 }2550 }2629}2551}263025522631#[cfg(feature = "runtime-benchmarks")]2632/// Create a `PropertyWriter` with preloaded `is_collection_admin` and `property_permissions.2553/// A marker structure that enables the writer implementation2633/// Also:2554/// to provide the interface to write properties to **already existing** tokens.2634/// * it will return `true` for the token ownership check.2635/// * it will return empty stored properties without reading them from the storage.2555pub struct ExistingTokenPropertyWriter<T>(PhantomData<T>);2556impl<T: Config> ExistingTokenPropertyWriter<T> {2557 /// Creates a [`PropertyWriter`] for **already existing** tokens.2636pub fn collection_info_loaded_property_writer<T, Handle>(2558 pub fn new<'a, Handle>(2637 collection: &Handle,2559 collection: &'a Handle,2638 is_collection_admin: bool,2560 sender: &'a T::CrossAccountId,2639 property_permissions: PropertiesPermissionMap,2561 ) -> PropertyWriter<'a, Self, T, Handle>2640) -> PropertyWriter<2641 T,2642 Handle,2562 where2563 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2643 NewTokenPropertyWriter,2564 {2565 PropertyWriter {2566 collection,2644 impl FnOnce() -> bool,2567 collection_lazy_info: PropertyWriterLazyCollectionInfo {2645 impl FnOnce() -> PropertiesPermissionMap,2568 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2646 impl Copy + FnOnce(TokenId) -> bool,2569 property_permissions: LazyValue::new(|| {2570 <Pallet<T>>::property_permissions(collection.id)2571 }),2572 },2573 _phantom: PhantomData,2647 impl Copy + FnOnce(TokenId) -> TokenProperties,2574 }2575 }2576}25772648>2578impl<'a, T, Handle> PropertyWriter<'a, ExistingTokenPropertyWriter<T>, T, Handle>2649where2579where2650 T: Config,2580 T: Config,2651 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2581 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2652{2582{2653 PropertyWriter {2583 /// A function to write properties to an **already existing** token.2654 collection,2584 pub fn write_token_properties(2585 &mut self,2655 is_collection_admin: LazyValue::new(move || is_collection_admin),2586 sender: &T::CrossAccountId,2587 token_id: TokenId,2588 properties_updates: impl Iterator<Item = (PropertyKey, Option<PropertyValue>)>,2656 property_permissions: LazyValue::new(move || property_permissions),2589 nesting_budget: &dyn Budget,2590 log: evm_coder::ethereum::Log,2591 ) -> DispatchResult {2592 let check_token_exist = || self.collection.token_exists(token_id);2657 check_token_exist: |_token_id| true,2593 let check_token_owner = || {2594 self.collection2595 .check_token_indirect_owner(token_id, sender, nesting_budget)2658 get_properties: |_token_id| TokenProperties::new(),2596 };2597 let get_token_properties = || {2598 self.collection2599 .get_token_properties_raw(token_id)2600 .unwrap_or_default()2601 };26022603 self.internal_write_token_properties(2604 token_id,2605 PropertyWriterLazyTokenInfo::new(2606 check_token_exist,2607 check_token_owner,2608 get_token_properties,2609 ),2659 _phantom: PhantomData,2610 properties_updates,2611 log,2612 )2660 }2613 }2661}2614}266226152663/// Create a [`PropertyWriter`] for already existing tokens.2616/// A marker structure that enables the writer implementation2617/// to benchmark the token properties writing.2618#[cfg(feature = "runtime-benchmarks")]2619pub struct BenchmarkPropertyWriter<T>(PhantomData<T>);26202621#[cfg(feature = "runtime-benchmarks")]2622impl<T: Config> BenchmarkPropertyWriter<T> {2623 /// Creates a [`PropertyWriter`] for benchmarking tokens properties writing.2664pub fn property_writer_for_existing_token<'a, T, Handle>(2624 pub fn new<'a, Handle>(2665 collection: &'a Handle,2625 collection: &'a Handle,2666 sender: &'a T::CrossAccountId,2626 collection_lazy_info: PropertyWriterLazyCollectionInfo<'a>,2667) -> PropertyWriter<2627 ) -> PropertyWriter<'a, Self, T, Handle>2668 'a,2669 T,2628 where2629 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2670 Handle,2630 {2631 PropertyWriter {2632 collection,2671 ExistingTokenPropertyWriter,2633 collection_lazy_info,2672 impl FnOnce() -> bool + 'a,2634 _phantom: PhantomData,2635 }2636 }26372638 /// Load the [`PropertyWriterLazyCollectionInfo`] from the storage.2639 pub fn load_collection_info<Handle>(2640 collection_handle: &Handle,2641 sender: &T::CrossAccountId,2642 ) -> PropertyWriterLazyCollectionInfo<'static>2643 where2644 Handle: Deref<Target = CollectionHandle<T>>,2673 impl FnOnce() -> PropertiesPermissionMap + 'a,2645 {2646 let is_collection_admin = collection_handle.is_owner_or_admin(sender);2647 let property_permissions = <Pallet<T>>::property_permissions(collection_handle.id);26482649 PropertyWriterLazyCollectionInfo {2650 is_collection_admin: LazyValue::new(move || is_collection_admin),2674 impl Copy + FnOnce(TokenId) -> bool + 'a,2651 property_permissions: LazyValue::new(move || property_permissions),2652 }2653 }26542655 /// Load the [`PropertyWriterLazyTokenInfo`] with token properties from the storage.2656 pub fn load_token_properties<Handle>(2657 collection: &Handle,2658 token_id: TokenId,2659 ) -> PropertyWriterLazyTokenInfo2660 where2661 Handle: CommonCollectionOperations<T>,2662 {2663 let stored_properties = collection2664 .get_token_properties_raw(token_id)2665 .unwrap_or_default();26662667 PropertyWriterLazyTokenInfo {2668 is_token_exist: LazyValue::new(|| true),2675 impl Copy + FnOnce(TokenId) -> TokenProperties + 'a,2669 is_token_owner: LazyValue::new(|| Ok(true)),2670 stored_properties: LazyValue::new(move || stored_properties),2671 }2672 }2673}26742675#[cfg(feature = "runtime-benchmarks")]2676>2676impl<'a, T, Handle> PropertyWriter<'a, BenchmarkPropertyWriter<T>, T, Handle>2677where2677where2678 T: Config,2678 T: Config,2679 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2679 Handle: CommonCollectionOperations<T> + Deref<Target = CollectionHandle<T>>,2680{2680{2681 PropertyWriter {2681 /// A function to benchmark the writing of token properties.2682 collection,2682 pub fn write_token_properties(2683 &mut self,2683 is_collection_admin: LazyValue::new(|| collection.is_owner_or_admin(sender)),2684 token_id: TokenId,2685 properties_updates: impl Iterator<Item = Property>,2684 property_permissions: LazyValue::new(|| <Pallet<T>>::property_permissions(collection.id)),2686 log: evm_coder::ethereum::Log,2685 check_token_exist: |token_id| collection.token_exists(token_id),2687 ) -> DispatchResult {2688 let check_token_exist = || true;2689 let check_token_owner = || Ok(true);2690 let get_token_properties = TokenProperties::new;26912692 self.internal_write_token_properties(2693 token_id,2686 get_properties: |token_id| {2694 PropertyWriterLazyTokenInfo::new(2687 collection2695 check_token_exist,2688 .get_token_properties_raw(token_id)2696 check_token_owner,2697 get_token_properties,2698 ),2689 .unwrap_or_default()2699 properties_updates.map(|p| (p.key, Some(p.value))),2690 },2700 log,2691 _phantom: PhantomData,2701 )2692 }2702 }2693}2703}269427042695/// Computes the weight delta for newly created tokens with properties.2705/// Computes the weight of writing properties to tokens.2696/// * `properties_nums` - The properties num of each created token.2706/// * `properties_nums` - The properties num of each created token.2697/// * `init_token_properties` - The function to obtain the weight from a token's properties num.2707/// * `per_token_weight_weight` - The function to obtain the weight2708/// of writing properties from a token's properties num.2698pub fn init_token_properties_delta<T: Config, I: Fn(u32) -> Weight>(2709pub fn write_token_properties_total_weight<T: Config, I: Fn(u32) -> Weight>(2699 properties_nums: impl Iterator<Item = u32>,2710 properties_nums: impl Iterator<Item = u32>,2700 init_token_properties: I,2711 per_token_weight: I,2701) -> Weight {2712) -> Weight {2702 let mut delta = properties_nums2713 let mut weight = properties_nums2703 .filter_map(|properties_num| {2714 .filter_map(|properties_num| {2704 if properties_num > 0 {2715 if properties_num > 0 {2705 Some(init_token_properties(properties_num))2716 Some(per_token_weight(properties_num))2706 } else {2717 } else {2707 None2718 None2708 }2719 }2709 })2720 })2710 .fold(Weight::zero(), |a, b| a.saturating_add(b));2721 .fold(Weight::zero(), |a, b| a.saturating_add(b));271127222712 // If at least once the `init_token_properties` was called,2723 if !weight.is_zero() {2713 // it means at least one newly created token has properties.2724 // If we are here, it means the token properties were written at least once.2714 // Becuase of that, some common collection data also was loaded and we need to add this weight.2725 // Because of that, some common collection data was also loaded; we must add this weight.2715 // However, these common data was loaded only once which is guaranteed by the `PropertyWriter`.2726 // However, this common data was loaded only once, which is guaranteed by the `PropertyWriter`.2716 if !delta.is_zero() {27272717 delta = delta.saturating_add(<SelfWeightOf<T>>::init_token_properties_common())2728 weight = weight.saturating_add(<SelfWeightOf<T>>::property_writer_load_collection_info());2718 }2729 }271927302720 delta2731 weight2721}2732}272227332723#[cfg(any(feature = "tests", test))]2734#[cfg(any(feature = "tests", test))]2781 /* 15*/ TestCase::new(1, 1, 1, 1, 0),2792 /* 15*/ TestCase::new(1, 1, 1, 1, 0),2782 ];2793 ];278327942784 pub fn check_token_permissions<T, FCA, FTO, FTE>(2795 pub fn check_token_permissions<T: Config>(2785 collection_admin_permitted: bool,2796 collection_admin_permitted: bool,2786 token_owner_permitted: bool,2797 token_owner_permitted: bool,2787 is_collection_admin: &mut LazyValue<bool, FCA>,2798 is_collection_admin: &mut LazyValue<bool>,2788 check_token_ownership: &mut LazyValue<Result<bool, DispatchError>, FTO>,2799 check_token_ownership: &mut LazyValue<Result<bool, DispatchError>>,2789 check_token_existence: &mut LazyValue<bool, FTE>,2800 check_token_existence: &mut LazyValue<bool>,2790 ) -> DispatchResult2801 ) -> DispatchResult {2791 where2792 T: Config,2793 FCA: FnOnce() -> bool,2794 FTO: FnOnce() -> Result<bool, DispatchError>,2795 FTE: FnOnce() -> bool,2796 {2797 crate::check_token_permissions::<T, FCA, FTO, FTE>(2802 crate::check_token_permissions::<T>(2798 collection_admin_permitted,2803 collection_admin_permitted,2799 token_owner_permitted,2804 token_owner_permitted,2800 is_collection_admin,2805 is_collection_admin,pallets/common/src/weights.rsdiffbeforeafterboth3//! Autogenerated weights for pallet_common3//! Autogenerated weights for pallet_common4//!4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! WORST CASE MAP SIZE: `1000000`7//! WORST CASE MAP SIZE: `1000000`8//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`8//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`9//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10249//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024101011// Executed Command:11// Executed Command:12// target/production/unique-collator12// ./target/production/unique-collator13// benchmark13// benchmark14// pallet14// pallet15// --pallet15// --pallet20// *20// *21// --template=.maintain/frame-weight-template.hbs21// --template=.maintain/frame-weight-template.hbs22// --steps=5022// --steps=5023// --repeat=40023// --repeat=8024// --heap-pages=409624// --heap-pages=409625// --output=./pallets/common/src/weights.rs25// --output=./pallets/common/src/weights.rs262634/// Weight functions needed for pallet_common.34/// Weight functions needed for pallet_common.35pub trait WeightInfo {35pub trait WeightInfo {36 fn set_collection_properties(b: u32, ) -> Weight;36 fn set_collection_properties(b: u32, ) -> Weight;37 fn delete_collection_properties(b: u32, ) -> Weight;38 fn check_accesslist() -> Weight;37 fn check_accesslist() -> Weight;39 fn init_token_properties_common() -> Weight;38 fn property_writer_load_collection_info() -> Weight;40}39}414042/// Weights for pallet_common using the Substrate node and recommended hardware.41/// Weights for pallet_common using the Substrate node and recommended hardware.43pub struct SubstrateWeight<T>(PhantomData<T>);42pub struct SubstrateWeight<T>(PhantomData<T>);44impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {43impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {45 /// Storage: Common CollectionProperties (r:1 w:1)44 /// Storage: `Common::CollectionProperties` (r:1 w:1)46 /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)45 /// Proof: `Common::CollectionProperties` (`max_values`: None, `max_size`: Some(40992), added: 43467, mode: `MaxEncodedLen`)47 /// The range of component `b` is `[0, 64]`.46 /// The range of component `b` is `[0, 64]`.48 fn set_collection_properties(b: u32, ) -> Weight {47 fn set_collection_properties(b: u32, ) -> Weight {49 // Proof Size summary in bytes:48 // Proof Size summary in bytes:50 // Measured: `298`49 // Measured: `298`51 // Estimated: `44457`50 // Estimated: `44457`52 // Minimum execution time: 4_987_000 picoseconds.51 // Minimum execution time: 4_560_000 picoseconds.53 Weight::from_parts(5_119_000, 44457)52 Weight::from_parts(28_643_440, 44457)54 // Standard Error: 7_60953 // Standard Error: 28_94155 .saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))54 .saturating_add(Weight::from_parts(18_277_422, 0).saturating_mul(b.into()))56 .saturating_add(T::DbWeight::get().reads(1_u64))55 .saturating_add(T::DbWeight::get().reads(1_u64))57 .saturating_add(T::DbWeight::get().writes(1_u64))56 .saturating_add(T::DbWeight::get().writes(1_u64))58 }57 }59 /// Storage: Common CollectionProperties (r:1 w:1)60 /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)61 /// The range of component `b` is `[0, 64]`.62 fn delete_collection_properties(b: u32, ) -> Weight {63 // Proof Size summary in bytes:64 // Measured: `303 + b * (33030 ±0)`65 // Estimated: `44457`66 // Minimum execution time: 4_923_000 picoseconds.67 Weight::from_parts(5_074_000, 44457)68 // Standard Error: 36_65169 .saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))70 .saturating_add(T::DbWeight::get().reads(1_u64))71 .saturating_add(T::DbWeight::get().writes(1_u64))72 }73 /// Storage: Common Allowlist (r:1 w:0)58 /// Storage: `Common::Allowlist` (r:1 w:0)74 /// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)59 /// Proof: `Common::Allowlist` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)75 fn check_accesslist() -> Weight {60 fn check_accesslist() -> Weight {76 // Proof Size summary in bytes:61 // Proof Size summary in bytes:77 // Measured: `373`62 // Measured: `373`78 // Estimated: `3535`63 // Estimated: `3535`79 // Minimum execution time: 4_271_000 picoseconds.64 // Minimum execution time: 4_290_000 picoseconds.80 Weight::from_parts(4_461_000, 3535)65 Weight::from_parts(4_460_000, 3535)81 .saturating_add(T::DbWeight::get().reads(1_u64))66 .saturating_add(T::DbWeight::get().reads(1_u64))82 }67 }83 /// Storage: Common IsAdmin (r:1 w:0)68 /// Storage: `Common::IsAdmin` (r:1 w:0)84 /// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)69 /// Proof: `Common::IsAdmin` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)85 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)70 /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:0)86 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)71 /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)87 fn init_token_properties_common() -> Weight {72 fn property_writer_load_collection_info() -> Weight {88 // Proof Size summary in bytes:73 // Proof Size summary in bytes:89 // Measured: `326`74 // Measured: `326`90 // Estimated: `20191`75 // Estimated: `20191`91 // Minimum execution time: 5_889_000 picoseconds.76 // Minimum execution time: 6_100_000 picoseconds.92 Weight::from_parts(6_138_000, 20191)77 Weight::from_parts(6_350_000, 20191)93 .saturating_add(T::DbWeight::get().reads(2_u64))78 .saturating_add(T::DbWeight::get().reads(2_u64))94 }79 }95}80}968197// For backwards compatibility and tests82// For backwards compatibility and tests98impl WeightInfo for () {83impl WeightInfo for () {99 /// Storage: Common CollectionProperties (r:1 w:1)84 /// Storage: `Common::CollectionProperties` (r:1 w:1)100 /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)85 /// Proof: `Common::CollectionProperties` (`max_values`: None, `max_size`: Some(40992), added: 43467, mode: `MaxEncodedLen`)101 /// The range of component `b` is `[0, 64]`.86 /// The range of component `b` is `[0, 64]`.102 fn set_collection_properties(b: u32, ) -> Weight {87 fn set_collection_properties(b: u32, ) -> Weight {103 // Proof Size summary in bytes:88 // Proof Size summary in bytes:104 // Measured: `298`89 // Measured: `298`105 // Estimated: `44457`90 // Estimated: `44457`106 // Minimum execution time: 4_987_000 picoseconds.91 // Minimum execution time: 4_560_000 picoseconds.107 Weight::from_parts(5_119_000, 44457)92 Weight::from_parts(28_643_440, 44457)108 // Standard Error: 7_60993 // Standard Error: 28_941109 .saturating_add(Weight::from_parts(5_750_459, 0).saturating_mul(b.into()))94 .saturating_add(Weight::from_parts(18_277_422, 0).saturating_mul(b.into()))110 .saturating_add(RocksDbWeight::get().reads(1_u64))95 .saturating_add(RocksDbWeight::get().reads(1_u64))111 .saturating_add(RocksDbWeight::get().writes(1_u64))96 .saturating_add(RocksDbWeight::get().writes(1_u64))112 }97 }113 /// Storage: Common CollectionProperties (r:1 w:1)114 /// Proof: Common CollectionProperties (max_values: None, max_size: Some(40992), added: 43467, mode: MaxEncodedLen)115 /// The range of component `b` is `[0, 64]`.116 fn delete_collection_properties(b: u32, ) -> Weight {117 // Proof Size summary in bytes:118 // Measured: `303 + b * (33030 ±0)`119 // Estimated: `44457`120 // Minimum execution time: 4_923_000 picoseconds.121 Weight::from_parts(5_074_000, 44457)122 // Standard Error: 36_651123 .saturating_add(Weight::from_parts(23_145_677, 0).saturating_mul(b.into()))124 .saturating_add(RocksDbWeight::get().reads(1_u64))125 .saturating_add(RocksDbWeight::get().writes(1_u64))126 }127 /// Storage: Common Allowlist (r:1 w:0)98 /// Storage: `Common::Allowlist` (r:1 w:0)128 /// Proof: Common Allowlist (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)99 /// Proof: `Common::Allowlist` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)129 fn check_accesslist() -> Weight {100 fn check_accesslist() -> Weight {130 // Proof Size summary in bytes:101 // Proof Size summary in bytes:131 // Measured: `373`102 // Measured: `373`132 // Estimated: `3535`103 // Estimated: `3535`133 // Minimum execution time: 4_271_000 picoseconds.104 // Minimum execution time: 4_290_000 picoseconds.134 Weight::from_parts(4_461_000, 3535)105 Weight::from_parts(4_460_000, 3535)135 .saturating_add(RocksDbWeight::get().reads(1_u64))106 .saturating_add(RocksDbWeight::get().reads(1_u64))136 }107 }137 /// Storage: Common IsAdmin (r:1 w:0)108 /// Storage: `Common::IsAdmin` (r:1 w:0)138 /// Proof: Common IsAdmin (max_values: None, max_size: Some(70), added: 2545, mode: MaxEncodedLen)109 /// Proof: `Common::IsAdmin` (`max_values`: None, `max_size`: Some(70), added: 2545, mode: `MaxEncodedLen`)139 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)110 /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:0)140 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)111 /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)141 fn init_token_properties_common() -> Weight {112 fn property_writer_load_collection_info() -> Weight {142 // Proof Size summary in bytes:113 // Proof Size summary in bytes:143 // Measured: `326`114 // Measured: `326`144 // Estimated: `20191`115 // Estimated: `20191`145 // Minimum execution time: 5_889_000 picoseconds.116 // Minimum execution time: 6_100_000 picoseconds.146 Weight::from_parts(6_138_000, 20191)117 Weight::from_parts(6_350_000, 20191)147 .saturating_add(RocksDbWeight::get().reads(2_u64))118 .saturating_add(RocksDbWeight::get().reads(2_u64))148 }119 }149}120}pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth84}84}85impl<T: Config> budget::Budget for GasCallsBudget<'_, T> {85impl<T: Config> budget::Budget for GasCallsBudget<'_, T> {86 fn consume_custom(&self, calls: u32) -> bool {86 fn consume_custom(&self, calls: u32) -> bool {87 let (gas, overflown) = (calls as u64).overflowing_add(self.gas_per_call);87 let (gas, overflown) = (calls as u64).overflowing_mul(self.gas_per_call);88 if overflown {88 if overflown {89 return false;89 return false;90 }90 }pallets/foreign-assets/src/impl_fungibles.rsdiffbeforeafterboth23use pallet_common::{CollectionHandle, CommonCollectionOperations};23use pallet_common::{CollectionHandle, CommonCollectionOperations};24use pallet_fungible::FungibleHandle;24use pallet_fungible::FungibleHandle;25use sp_runtime::traits::{CheckedAdd, CheckedSub};25use sp_runtime::traits::{CheckedAdd, CheckedSub};26use up_data_structs::budget::Value;26use up_data_structs::budget;272728use super::*;28use super::*;2929327 &collection,327 &collection,328 &account,328 &account,329 amount_data,329 amount_data,330 &Value::new(0),330 &budget::Value::new(0),331 )?;331 )?;332332333 Ok(amount)333 Ok(amount)440 &T::CrossAccountId::from_sub(source.clone()),440 &T::CrossAccountId::from_sub(source.clone()),441 &T::CrossAccountId::from_sub(dest.clone()),441 &T::CrossAccountId::from_sub(dest.clone()),442 amount.into(),442 amount.into(),443 &Value::new(0),443 &budget::Value::new(0),444 )444 )445 .map_err(|e| e.error)?;445 .map_err(|e| e.error)?;446446pallets/fungible/src/common.rsdiffbeforeafterboth17use core::marker::PhantomData;17use core::marker::PhantomData;181819use frame_support::{19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20 dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,21};22use pallet_common::{20use pallet_common::{23 weights::WeightInfo as _, with_weight, CommonCollectionOperations, CommonWeightInfo,21 weights::WeightInfo as _, with_weight, CommonCollectionOperations, CommonWeightInfo,24 RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,22 RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,25};23};26use pallet_structure::Error as StructureError;27use sp_runtime::{ArithmeticError, DispatchError};24use sp_runtime::{ArithmeticError, DispatchError};28use sp_std::{vec, vec::Vec};25use sp_std::{vec, vec::Vec};29use up_data_structs::{26use up_data_structs::{60 <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)57 <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)61 }58 }6263 fn delete_collection_properties(amount: u32) -> Weight {64 <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)65 }665967 fn set_token_properties(_amount: u32) -> Weight {60 fn set_token_properties(_amount: u32) -> Weight {68 // Error61 // Error69 Weight::zero()62 Weight::zero()70 }63 }7172 fn delete_token_properties(_amount: u32) -> Weight {73 // Error74 Weight::zero()75 }766477 fn set_token_property_permissions(_amount: u32) -> Weight {65 fn set_token_property_permissions(_amount: u32) -> Weight {78 // Error66 // Error79 Weight::zero()67 Weight::zero()80 }68 }816982 fn transfer() -> Weight {70 fn transfer() -> Weight {83 <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 271 <SelfWeightOf<T>>::transfer_raw()72 .saturating_add(<PalletCommonWeightOf<T>>::check_accesslist().saturating_mul(2))84 }73 }857486 fn approve() -> Weight {75 fn approve() -> Weight {938294 fn transfer_from() -> Weight {83 fn transfer_from() -> Weight {95 Self::transfer()84 Self::transfer()96 + <SelfWeightOf<T>>::check_allowed_raw()85 .saturating_add(<SelfWeightOf<T>>::check_allowed_raw())97 + <SelfWeightOf<T>>::set_allowance_unchecked_raw()86 .saturating_add(<SelfWeightOf<T>>::set_allowance_unchecked_raw())98 }87 }9988100 fn burn_from() -> Weight {89 fn burn_from() -> Weight {101 <SelfWeightOf<T>>::burn_from()90 <SelfWeightOf<T>>::burn_from()102 }91 }103104 fn burn_recursively_self_raw() -> Weight {105 // Read to get total balance106 Self::burn_item() + T::DbWeight::get().reads(1)107 }108109 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {110 // Fungible tokens can't have children111 Weight::zero()112 }113114 fn token_owner() -> Weight {115 Weight::zero()116 }11792118 fn set_allowance_for_all() -> Weight {93 fn set_allowance_for_all() -> Weight {119 Weight::zero()94 Weight::zero()203 )178 )204 }179 }205206 fn burn_item_recursively(207 &self,208 sender: T::CrossAccountId,209 token: TokenId,210 self_budget: &dyn Budget,211 _breadth_budget: &dyn Budget,212 ) -> DispatchResultWithPostInfo {213 // Should not happen?214 ensure!(215 token == TokenId::default(),216 <Error<T>>::FungibleItemsHaveNoId217 );218 ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);219220 with_weight(221 <Pallet<T>>::burn(self, &sender, <Balance<T>>::get((self.id, &sender))),222 <CommonWeights<T>>::burn_recursively_self_raw(),223 )224 }225180226 fn transfer(181 fn transfer(227 &self,182 &self,pallets/fungible/src/erc.rsdiffbeforeafterboth32use pallet_evm_coder_substrate::{32use pallet_evm_coder_substrate::{33 call, dispatch_to_evm,33 call, dispatch_to_evm,34 execution::{PreDispatch, Result},34 execution::{PreDispatch, Result},35 frontier_contract,35 frontier_contract, SubstrateRecorder,36};36};37use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};37use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};38use sp_core::{Get, U256};38use sp_core::{Get, U256};39use sp_std::vec::Vec;39use sp_std::vec::Vec;40use up_data_structs::CollectionMode;40use up_data_structs::{budget::Budget, CollectionMode};414142use crate::{42use crate::{43 common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, FungibleHandle, Pallet,43 common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, FungibleHandle, Pallet,73 amount: U256,73 amount: U256,74}74}7576fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {77 recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())78}757976#[solidity_interface(name = ERC20, events(ERC20Events), enum(derive(PreDispatch)), enum_attr(weight), expect_selector = 0x942e8b22)]80#[solidity_interface(name = ERC20, events(ERC20Events), enum(derive(PreDispatch)), enum_attr(weight), expect_selector = 0x942e8b22)]77impl<T: Config> FungibleHandle<T> {81impl<T: Config> FungibleHandle<T> {106 let caller = T::CrossAccountId::from_eth(caller);110 let caller = T::CrossAccountId::from_eth(caller);107 let to = T::CrossAccountId::from_eth(to);111 let to = T::CrossAccountId::from_eth(to);108 let amount = amount.try_into().map_err(|_| "amount overflow")?;112 let amount = amount.try_into().map_err(|_| "amount overflow")?;109 let budget = self110 .recorder111 .weight_calls_budget(<StructureWeight<T>>::find_parent());112113113 <Pallet<T>>::transfer(self, &caller, &to, amount, &budget)114 <Pallet<T>>::transfer(self, &caller, &to, amount, &nesting_budget(&self.recorder))114 .map_err(|e| dispatch_to_evm::<T>(e.error))?;115 .map_err(|e| dispatch_to_evm::<T>(e.error))?;115 Ok(true)116 Ok(true)116 }117 }127 let from = T::CrossAccountId::from_eth(from);128 let from = T::CrossAccountId::from_eth(from);128 let to = T::CrossAccountId::from_eth(to);129 let to = T::CrossAccountId::from_eth(to);129 let amount = amount.try_into().map_err(|_| "amount overflow")?;130 let amount = amount.try_into().map_err(|_| "amount overflow")?;130 let budget = self131 .recorder132 .weight_calls_budget(<StructureWeight<T>>::find_parent());133131134 <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)132 <Pallet<T>>::transfer_from(133 self,134 &caller,135 &from,136 &to,137 amount,138 &nesting_budget(&self.recorder),139 )135 .map_err(|e| dispatch_to_evm::<T>(e.error))?;140 .map_err(|e| dispatch_to_evm::<T>(e.error))?;136 Ok(true)141 Ok(true)164 let caller = T::CrossAccountId::from_eth(caller);169 let caller = T::CrossAccountId::from_eth(caller);165 let to = T::CrossAccountId::from_eth(to);170 let to = T::CrossAccountId::from_eth(to);166 let amount = amount.try_into().map_err(|_| "amount overflow")?;171 let amount = amount.try_into().map_err(|_| "amount overflow")?;167 let budget = self172168 .recorder169 .weight_calls_budget(<StructureWeight<T>>::find_parent());170 <Pallet<T>>::create_item(self, &caller, (to, amount), &budget)173 <Pallet<T>>::create_item(self, &caller, (to, amount), &nesting_budget(&self.recorder))171 .map_err(dispatch_to_evm::<T>)?;174 .map_err(dispatch_to_evm::<T>)?;172 Ok(true)175 Ok(true)173 }176 }201 let caller = T::CrossAccountId::from_eth(caller);204 let caller = T::CrossAccountId::from_eth(caller);202 let to = to.into_sub_cross_account::<T>()?;205 let to = to.into_sub_cross_account::<T>()?;203 let amount = amount.try_into().map_err(|_| "amount overflow")?;206 let amount = amount.try_into().map_err(|_| "amount overflow")?;204 let budget = self207205 .recorder206 .weight_calls_budget(<StructureWeight<T>>::find_parent());207 <Pallet<T>>::create_item(self, &caller, (to, amount), &budget)208 <Pallet<T>>::create_item(self, &caller, (to, amount), &nesting_budget(&self.recorder))208 .map_err(dispatch_to_evm::<T>)?;209 .map_err(dispatch_to_evm::<T>)?;209 Ok(true)210 Ok(true)210 }211 }236 let caller = T::CrossAccountId::from_eth(caller);237 let caller = T::CrossAccountId::from_eth(caller);237 let from = T::CrossAccountId::from_eth(from);238 let from = T::CrossAccountId::from_eth(from);238 let amount = amount.try_into().map_err(|_| "amount overflow")?;239 let amount = amount.try_into().map_err(|_| "amount overflow")?;239 let budget = self240 .recorder241 .weight_calls_budget(<StructureWeight<T>>::find_parent());242240243 <Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)241 <Pallet<T>>::burn_from(242 self,243 &caller,244 &from,245 amount,246 &nesting_budget(&self.recorder),247 )244 .map_err(dispatch_to_evm::<T>)?;248 .map_err(dispatch_to_evm::<T>)?;245 Ok(true)249 Ok(true)260 let caller = T::CrossAccountId::from_eth(caller);264 let caller = T::CrossAccountId::from_eth(caller);261 let from = from.into_sub_cross_account::<T>()?;265 let from = from.into_sub_cross_account::<T>()?;262 let amount = amount.try_into().map_err(|_| "amount overflow")?;266 let amount = amount.try_into().map_err(|_| "amount overflow")?;263 let budget = self264 .recorder265 .weight_calls_budget(<StructureWeight<T>>::find_parent());266267267 <Pallet<T>>::burn_from(self, &caller, &from, amount, &budget)268 <Pallet<T>>::burn_from(269 self,270 &caller,271 &from,272 amount,273 &nesting_budget(&self.recorder),274 )268 .map_err(dispatch_to_evm::<T>)?;275 .map_err(dispatch_to_evm::<T>)?;269 Ok(true)276 Ok(true)274 #[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]281 #[weight(<SelfWeightOf<T>>::create_multiple_items_ex(amounts.len() as u32))]275 fn mint_bulk(&mut self, caller: Caller, amounts: Vec<AmountForAddress>) -> Result<bool> {282 fn mint_bulk(&mut self, caller: Caller, amounts: Vec<AmountForAddress>) -> Result<bool> {276 let caller = T::CrossAccountId::from_eth(caller);283 let caller = T::CrossAccountId::from_eth(caller);277 let budget = self278 .recorder279 .weight_calls_budget(<StructureWeight<T>>::find_parent());280 let amounts = amounts284 let amounts = amounts281 .into_iter()285 .into_iter()282 .map(|AmountForAddress { to, amount }| {286 .map(|AmountForAddress { to, amount }| {287 })291 })288 .collect::<Result<_>>()?;292 .collect::<Result<_>>()?;289293290 <Pallet<T>>::create_multiple_items(self, &caller, amounts, &budget)294 <Pallet<T>>::create_multiple_items(self, &caller, amounts, &nesting_budget(&self.recorder))291 .map_err(dispatch_to_evm::<T>)?;295 .map_err(dispatch_to_evm::<T>)?;292 Ok(true)296 Ok(true)293 }297 }297 let caller = T::CrossAccountId::from_eth(caller);301 let caller = T::CrossAccountId::from_eth(caller);298 let to = to.into_sub_cross_account::<T>()?;302 let to = to.into_sub_cross_account::<T>()?;299 let amount = amount.try_into().map_err(|_| "amount overflow")?;303 let amount = amount.try_into().map_err(|_| "amount overflow")?;300 let budget = self301 .recorder302 .weight_calls_budget(<StructureWeight<T>>::find_parent());303304304 <Pallet<T>>::transfer(self, &caller, &to, amount, &budget).map_err(|_| "transfer error")?;305 <Pallet<T>>::transfer(self, &caller, &to, amount, &nesting_budget(&self.recorder))306 .map_err(|_| "transfer error")?;305 Ok(true)307 Ok(true)306 }308 }317 let from = from.into_sub_cross_account::<T>()?;319 let from = from.into_sub_cross_account::<T>()?;318 let to = to.into_sub_cross_account::<T>()?;320 let to = to.into_sub_cross_account::<T>()?;319 let amount = amount.try_into().map_err(|_| "amount overflow")?;321 let amount = amount.try_into().map_err(|_| "amount overflow")?;320 let budget = self321 .recorder322 .weight_calls_budget(<StructureWeight<T>>::find_parent());323322324 <Pallet<T>>::transfer_from(self, &caller, &from, &to, amount, &budget)323 <Pallet<T>>::transfer_from(324 self,325 &caller,326 &from,327 &to,328 amount,329 &nesting_budget(&self.recorder),330 )325 .map_err(|e| dispatch_to_evm::<T>(e.error))?;331 .map_err(|e| dispatch_to_evm::<T>(e.error))?;326 Ok(true)332 Ok(true)pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth18use pallet_common::{18use pallet_common::{19 bench_init,19 bench_init,20 benchmarking::{create_collection_raw, property_key, property_value},20 benchmarking::{create_collection_raw, property_key, property_value},21 CommonCollectionOperations,22};21};23use sp_std::prelude::*;22use sp_std::prelude::*;24use up_data_structs::{23use up_data_structs::{136 Ok(())135 Ok(())137 }136 }138139 #[benchmark]140 fn burn_recursively_self_raw() -> Result<(), BenchmarkError> {141 bench_init! {142 owner: sub; collection: collection(owner);143 sender: cross_from_sub(owner); burner: cross_sub;144 };145 let item = create_max_item(&collection, &sender, burner.clone())?;146147 #[block]148 {149 <Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;150 }151152 Ok(())153 }154155 #[benchmark]156 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(157 b: Linear<0, 200>,158 ) -> Result<(), BenchmarkError> {159 bench_init! {160 owner: sub; collection: collection(owner);161 sender: cross_from_sub(owner); burner: cross_sub;162 };163 let item = create_max_item(&collection, &sender, burner.clone())?;164 for _ in 0..b {165 create_max_item(166 &collection,167 &sender,168 T::CrossTokenAddressMapping::token_to_address(collection.id, item),169 )?;170 }171172 #[block]173 {174 <Pallet<T>>::burn_recursively(&collection, &burner, item, &Unlimited, &Unlimited)?;175 }176177 Ok(())178 }179137180 #[benchmark]138 #[benchmark]181 fn transfer_raw() -> Result<(), BenchmarkError> {139 fn transfer_raw() -> Result<(), BenchmarkError> {266 Ok(())224 Ok(())267 }225 }226227 #[benchmark]228 fn load_token_properties() -> Result<(), BenchmarkError> {229 bench_init! {230 owner: sub; collection: collection(owner);231 owner: cross_from_sub;232 };233234 let item = create_max_item(&collection, &owner, owner.clone())?;235236 #[block]237 {238 pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(&collection, item);239 }240241 Ok(())242 }243244 #[benchmark]245 fn write_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {246 bench_init! {247 owner: sub; collection: collection(owner);248 owner: cross_from_sub;249 };250251 let perms = (0..b)252 .map(|k| PropertyKeyPermission {253 key: property_key(k as usize),254 permission: PropertyPermission {255 mutable: false,256 collection_admin: true,257 token_owner: true,258 },259 })260 .collect::<Vec<_>>();261 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;262 let props = (0..b)263 .map(|k| Property {264 key: property_key(k as usize),265 value: property_value(),266 })267 .collect::<Vec<_>>();268 let item = create_max_item(&collection, &owner, owner.clone())?;269270 let lazy_collection_info =271 pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(&collection, &owner);272273 #[block]274 {275 let mut property_writer =276 pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);277278 property_writer.write_token_properties(279 item,280 props.into_iter(),281 crate::erc::ERC721TokenEvent::TokenChanged {282 token_id: item.into(),283 }284 .to_log(T::ContractAddress::get()),285 )?;286 }287288 Ok(())289 }268290269 #[benchmark]291 #[benchmark]270 fn set_token_property_permissions(292 fn set_token_property_permissions(293 Ok(())315 Ok(())294 }316 }295296 #[benchmark]297 fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {298 bench_init! {299 owner: sub; collection: collection(owner);300 owner: cross_from_sub;301 };302 let perms = (0..b)303 .map(|k| PropertyKeyPermission {304 key: property_key(k as usize),305 permission: PropertyPermission {306 mutable: false,307 collection_admin: true,308 token_owner: true,309 },310 })311 .collect::<Vec<_>>();312 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;313 let props = (0..b)314 .map(|k| Property {315 key: property_key(k as usize),316 value: property_value(),317 })318 .collect::<Vec<_>>();319 let item = create_max_item(&collection, &owner, owner.clone())?;320321 #[block]322 {323 <Pallet<T>>::set_token_properties(324 &collection,325 &owner,326 item,327 props.into_iter(),328 &Unlimited,329 )?;330 }331332 Ok(())333 }334335 // TODO:336 #[benchmark]337 fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {338 // bench_init! {339 // owner: sub; collection: collection(owner);340 // owner: cross_from_sub;341 // };342343 // let perms = (0..b)344 // .map(|k| PropertyKeyPermission {345 // key: property_key(k as usize),346 // permission: PropertyPermission {347 // mutable: false,348 // collection_admin: true,349 // token_owner: true,350 // },351 // })352 // .collect::<Vec<_>>();353 // <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;354 #[block]355 {}356 // let props = (0..b)357 // .map(|k| Property {358 // key: property_key(k as usize),359 // value: property_value(),360 // })361 // .collect::<Vec<_>>();362 // let item = create_max_item(&collection, &owner, owner.clone())?;363364 // let (is_collection_admin, property_permissions) =365 // load_is_admin_and_property_permissions(&collection, &owner);366 // #[block]367 // {368 // let mut property_writer =369 // pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);370371 // property_writer.write_token_properties(372 // item,373 // props.into_iter(),374 // crate::erc::ERC721TokenEvent::TokenChanged {375 // token_id: item.into(),376 // }377 // .to_log(T::ContractAddress::get()),378 // )?;379 // }380381 Ok(())382 }383384 #[benchmark]385 fn delete_token_properties(386 b: Linear<0, MAX_PROPERTIES_PER_ITEM>,387 ) -> Result<(), BenchmarkError> {388 bench_init! {389 owner: sub; collection: collection(owner);390 owner: cross_from_sub;391 };392 let perms = (0..b)393 .map(|k| PropertyKeyPermission {394 key: property_key(k as usize),395 permission: PropertyPermission {396 mutable: true,397 collection_admin: true,398 token_owner: true,399 },400 })401 .collect::<Vec<_>>();402 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;403 let props = (0..b)404 .map(|k| Property {405 key: property_key(k as usize),406 value: property_value(),407 })408 .collect::<Vec<_>>();409 let item = create_max_item(&collection, &owner, owner.clone())?;410 <Pallet<T>>::set_token_properties(411 &collection,412 &owner,413 item,414 props.into_iter(),415 &Unlimited,416 )?;417 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();418419 #[block]420 {421 <Pallet<T>>::delete_token_properties(422 &collection,423 &owner,424 item,425 to_delete.into_iter(),426 &Unlimited,427 )?;428 }429430 Ok(())431 }432433 #[benchmark]434 fn token_owner() -> Result<(), BenchmarkError> {435 bench_init! {436 owner: sub; collection: collection(owner);437 owner: cross_from_sub;438 };439 let item = create_max_item(&collection, &owner, owner.clone())?;440441 #[block]442 {443 collection.token_owner(item).unwrap();444 }445446 Ok(())447 }448317449 #[benchmark]318 #[benchmark]450 fn set_allowance_for_all() -> Result<(), BenchmarkError> {319 fn set_allowance_for_all() -> Result<(), BenchmarkError> {pallets/nonfungible/src/common.rsdiffbeforeafterboth181819use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight};20use pallet_common::{20use pallet_common::{21 init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,21 weights::WeightInfo as _, with_weight, write_token_properties_total_weight,22 CommonWeightInfo, RefungibleExtensions, SelfWeightOf as PalletCommonWeightOf,22 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions,23 SelfWeightOf as PalletCommonWeightOf,23};24};38impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {39impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {39 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {40 fn create_multiple_items_ex(data: &CreateItemExData<T::CrossAccountId>) -> Weight {40 match data {41 match data {41 CreateItemExData::NFT(t) => <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32)42 CreateItemExData::NFT(t) => mint_with_props_weight::<T>(42 .saturating_add(init_token_properties_delta::<T, _>(43 <SelfWeightOf<T>>::create_multiple_items_ex(t.len() as u32),43 t.iter().map(|t| t.properties.len() as u32),44 t.iter().map(|t| t.properties.len() as u32),44 <SelfWeightOf<T>>::init_token_properties,45 )),45 ),46 _ => Weight::zero(),46 _ => Weight::zero(),47 }47 }48 }48 }494950 fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {50 fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {51 mint_with_props_weight::<T>(51 <SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(52 <SelfWeightOf<T>>::create_multiple_items(data.len() as u32),52 init_token_properties_delta::<T, _>(53 data.iter().map(|t| match t {53 data.iter().map(|t| match t {54 up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,54 up_data_structs::CreateItemData::NFT(n) => n.properties.len() as u32,55 _ => 0,55 _ => 0,56 }),56 }),57 <SelfWeightOf<T>>::init_token_properties,57 )58 ),59 )60 }58 }615962 fn burn_item() -> Weight {60 fn burn_item() -> Weight {67 <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)65 <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)68 }66 }6970 fn delete_collection_properties(amount: u32) -> Weight {71 <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)72 }736774 fn set_token_properties(amount: u32) -> Weight {68 fn set_token_properties(amount: u32) -> Weight {69 write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {75 <SelfWeightOf<T>>::set_token_properties(amount)70 <SelfWeightOf<T>>::load_token_properties()71 .saturating_add(<SelfWeightOf<T>>::write_token_properties(amount))72 })76 }73 }777478 fn delete_token_properties(amount: u32) -> Weight {75 fn delete_token_properties(amount: u32) -> Weight {79 <SelfWeightOf<T>>::delete_token_properties(amount)76 Self::set_token_properties(amount)80 }77 }817882 fn set_token_property_permissions(amount: u32) -> Weight {79 fn set_token_property_permissions(amount: u32) -> Weight {83 <SelfWeightOf<T>>::set_token_property_permissions(amount)80 <SelfWeightOf<T>>::set_token_property_permissions(amount)84 }81 }858286 fn transfer() -> Weight {83 fn transfer() -> Weight {87 <SelfWeightOf<T>>::transfer_raw() + <PalletCommonWeightOf<T>>::check_accesslist() * 284 <SelfWeightOf<T>>::transfer_raw()85 .saturating_add(<PalletCommonWeightOf<T>>::check_accesslist().saturating_mul(2))88 }86 }898790 fn approve() -> Weight {88 fn approve() -> Weight {96 }94 }979598 fn transfer_from() -> Weight {96 fn transfer_from() -> Weight {99 Self::transfer() + <SelfWeightOf<T>>::check_allowed_raw()97 Self::transfer().saturating_add(<SelfWeightOf<T>>::check_allowed_raw())100 }98 }10199102 fn burn_from() -> Weight {100 fn burn_from() -> Weight {103 <SelfWeightOf<T>>::burn_from()101 <SelfWeightOf<T>>::burn_from()104 }102 }105106 fn burn_recursively_self_raw() -> Weight {107 <SelfWeightOf<T>>::burn_recursively_self_raw()108 }109110 fn burn_recursively_breadth_raw(amount: u32) -> Weight {111 <SelfWeightOf<T>>::burn_recursively_breadth_plus_self_plus_self_per_each_raw(amount)112 .saturating_sub(Self::burn_recursively_self_raw().saturating_mul(amount as u64 + 1))113 }114115 fn token_owner() -> Weight {116 <SelfWeightOf<T>>::token_owner()117 }118103119 fn set_allowance_for_all() -> Weight {104 fn set_allowance_for_all() -> Weight {120 <SelfWeightOf<T>>::set_allowance_for_all()105 <SelfWeightOf<T>>::set_allowance_for_all()125 }110 }126}111}112113/// Weight of minting tokens with properties114/// * `create_no_data_weight` -- the weight of minting without properties115/// * `token_properties_nums` -- number of properties of each token116#[inline]117pub(crate) fn mint_with_props_weight<T: Config>(118 create_no_data_weight: Weight,119 token_properties_nums: impl Iterator<Item = u32> + Clone,120) -> Weight {121 create_no_data_weight.saturating_add(write_token_properties_total_weight::<T, _>(122 token_properties_nums,123 <SelfWeightOf<T>>::write_token_properties,124 ))125}127126128fn map_create_data<T: Config>(127fn map_create_data<T: Config>(129 data: up_data_structs::CreateItemData,128 data: up_data_structs::CreateItemData,308 }307 }309 }308 }310311 fn burn_item_recursively(312 &self,313 sender: T::CrossAccountId,314 token: TokenId,315 self_budget: &dyn Budget,316 breadth_budget: &dyn Budget,317 ) -> DispatchResultWithPostInfo {318 <Pallet<T>>::burn_recursively(self, &sender, token, self_budget, breadth_budget)319 }320309321 fn transfer(310 fn transfer(322 &self,311 &self,pallets/nonfungible/src/erc.rsdiffbeforeafterboth38use pallet_evm_coder_substrate::{38use pallet_evm_coder_substrate::{39 call, dispatch_to_evm,39 call, dispatch_to_evm,40 execution::{Error, PreDispatch, Result},40 execution::{Error, PreDispatch, Result},41 frontier_contract,41 frontier_contract, SubstrateRecorder,42};42};43use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};43use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};44use sp_core::{Get, U256};44use sp_core::{Get, U256};45use sp_std::{vec, vec::Vec};45use sp_std::{vec, vec::Vec};46use up_data_structs::{46use up_data_structs::{47 CollectionId, CollectionPropertiesVec, Property, PropertyKey, PropertyKeyPermission,47 budget::Budget, CollectionId, CollectionPropertiesVec, Property, PropertyKey,48 PropertyPermission, TokenId,48 PropertyKeyPermission, PropertyPermission, TokenId,49};49};505051use crate::{51use crate::{52 common::CommonWeights, weights::WeightInfo, AccountBalance, Config, CreateItemData,52 common::{mint_with_props_weight, CommonWeights},53 weights::WeightInfo,53 NonfungibleHandle, Pallet, SelfWeightOf, TokenData, TokenProperties, TokensMinted,54 AccountBalance, Config, CreateItemData, NonfungibleHandle, Pallet, SelfWeightOf, TokenData,55 TokenProperties, TokensMinted,78 impl<T: Config> Contract for NonfungibleHandle<T> {...}80 impl<T: Config> Contract for NonfungibleHandle<T> {...}79}81}8283fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {84 recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())85}808681/// @title A contract that allows to set and delete token properties and change token property permissions.87/// @title A contract that allows to set and delete token properties and change token property permissions.82#[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]88#[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]146 /// @param key Property key.152 /// @param key Property key.147 /// @param value Property value.153 /// @param value Property value.148 #[solidity(hide)]154 #[solidity(hide)]149 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]155 #[weight(<CommonWeights<T>>::set_token_properties(1))]150 fn set_property(156 fn set_property(151 &mut self,157 &mut self,152 caller: Caller,158 caller: Caller,161 .map_err(|_| "key too long")?;167 .map_err(|_| "key too long")?;162 let value = value.0.try_into().map_err(|_| "value too long")?;168 let value = value.0.try_into().map_err(|_| "value too long")?;163164 let nesting_budget = self165 .recorder166 .weight_calls_budget(<StructureWeight<T>>::find_parent());167169168 <Pallet<T>>::set_token_property(170 <Pallet<T>>::set_token_property(169 self,171 self,170 &caller,172 &caller,171 TokenId(token_id),173 TokenId(token_id),172 Property { key, value },174 Property { key, value },173 &nesting_budget,175 &nesting_budget(&self.recorder),174 )176 )175 .map_err(dispatch_to_evm::<T>)177 .map_err(dispatch_to_evm::<T>)176 }178 }179 /// @dev Throws error if `msg.sender` has no permission to edit the property.181 /// @dev Throws error if `msg.sender` has no permission to edit the property.180 /// @param tokenId ID of the token.182 /// @param tokenId ID of the token.181 /// @param properties settable properties183 /// @param properties settable properties182 #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]184 #[weight(<CommonWeights<T>>::set_token_properties(properties.len() as u32))]183 fn set_properties(185 fn set_properties(184 &mut self,186 &mut self,185 caller: Caller,187 caller: Caller,189 let caller = T::CrossAccountId::from_eth(caller);191 let caller = T::CrossAccountId::from_eth(caller);190 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;192 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;191192 let nesting_budget = self193 .recorder194 .weight_calls_budget(<StructureWeight<T>>::find_parent());195193196 let properties = properties194 let properties = properties197 .into_iter()195 .into_iter()203 &caller,201 &caller,204 TokenId(token_id),202 TokenId(token_id),205 properties.into_iter(),203 properties.into_iter(),206 &nesting_budget,204 &nesting_budget(&self.recorder),207 )205 )208 .map_err(dispatch_to_evm::<T>)206 .map_err(dispatch_to_evm::<T>)209 }207 }213 /// @param tokenId ID of the token.211 /// @param tokenId ID of the token.214 /// @param key Property key.212 /// @param key Property key.215 #[solidity(hide)]213 #[solidity(hide)]216 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]214 #[weight(<CommonWeights<T>>::delete_token_properties(1))]217 fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {215 fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {218 let caller = T::CrossAccountId::from_eth(caller);216 let caller = T::CrossAccountId::from_eth(caller);219 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;217 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;220 let key = <Vec<u8>>::from(key)218 let key = <Vec<u8>>::from(key)221 .try_into()219 .try_into()222 .map_err(|_| "key too long")?;220 .map_err(|_| "key too long")?;223224 let nesting_budget = self225 .recorder226 .weight_calls_budget(<StructureWeight<T>>::find_parent());227221228 <Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)222 <Pallet<T>>::delete_token_property(223 self,224 &caller,225 TokenId(token_id),226 key,227 &nesting_budget(&self.recorder),228 )229 .map_err(dispatch_to_evm::<T>)229 .map_err(dispatch_to_evm::<T>)230 }230 }231231232 /// @notice Delete token properties value.232 /// @notice Delete token properties value.233 /// @dev Throws error if `msg.sender` has no permission to edit the property.233 /// @dev Throws error if `msg.sender` has no permission to edit the property.234 /// @param tokenId ID of the token.234 /// @param tokenId ID of the token.235 /// @param keys Properties key.235 /// @param keys Properties key.236 #[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]236 #[weight(<CommonWeights<T>>::delete_token_properties(keys.len() as u32))]237 fn delete_properties(237 fn delete_properties(238 &mut self,238 &mut self,239 token_id: U256,239 token_id: U256,247 .map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))247 .map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))248 .collect::<Result<Vec<_>>>()?;248 .collect::<Result<Vec<_>>>()?;249250 let nesting_budget = self251 .recorder252 .weight_calls_budget(<StructureWeight<T>>::find_parent());253249254 <Pallet<T>>::delete_token_properties(250 <Pallet<T>>::delete_token_properties(255 self,251 self,256 &caller,252 &caller,257 TokenId(token_id),253 TokenId(token_id),258 keys.into_iter(),254 keys.into_iter(),259 &nesting_budget,255 &nesting_budget(&self.recorder),260 )256 )261 .map_err(dispatch_to_evm::<T>)257 .map_err(dispatch_to_evm::<T>)262 }258 }481 let from = T::CrossAccountId::from_eth(from);477 let from = T::CrossAccountId::from_eth(from);482 let to = T::CrossAccountId::from_eth(to);478 let to = T::CrossAccountId::from_eth(to);483 let token = token_id.try_into()?;479 let token = token_id.try_into()?;484 let budget = self485 .recorder486 .weight_calls_budget(<StructureWeight<T>>::find_parent());487480488 <Pallet<T>>::transfer_from(self, &caller, &from, &to, token, &budget)481 <Pallet<T>>::transfer_from(482 self,483 &caller,484 &from,485 &to,486 token,487 &nesting_budget(&self.recorder),488 )489 .map_err(|e| dispatch_to_evm::<T>(e.error))?;489 .map_err(|e| dispatch_to_evm::<T>(e.error))?;490 Ok(())490 Ok(())594 let caller = T::CrossAccountId::from_eth(caller);594 let caller = T::CrossAccountId::from_eth(caller);595 let to = T::CrossAccountId::from_eth(to);595 let to = T::CrossAccountId::from_eth(to);596 let token_id: u32 = token_id.try_into()?;596 let token_id: u32 = token_id.try_into()?;597 let budget = self598 .recorder599 .weight_calls_budget(<StructureWeight<T>>::find_parent());600597601 if <TokensMinted<T>>::get(self.id)598 if <TokensMinted<T>>::get(self.id)602 .checked_add(1)599 .checked_add(1)613 properties: BoundedVec::default(),610 properties: BoundedVec::default(),614 owner: to,611 owner: to,615 },612 },616 &budget,613 &nesting_budget(&self.recorder),617 )614 )618 .map_err(dispatch_to_evm::<T>)?;615 .map_err(dispatch_to_evm::<T>)?;619616625 /// @param tokenUri Token URI that would be stored in the NFT properties622 /// @param tokenUri Token URI that would be stored in the NFT properties626 /// @return uint256 The id of the newly minted token623 /// @return uint256 The id of the newly minted token627 #[solidity(rename_selector = "mintWithTokenURI")]624 #[solidity(rename_selector = "mintWithTokenURI")]628 #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]625 #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]629 fn mint_with_token_uri(626 fn mint_with_token_uri(630 &mut self,627 &mut self,631 caller: Caller,628 caller: Caller,647 /// @param tokenId ID of the minted NFT644 /// @param tokenId ID of the minted NFT648 /// @param tokenUri Token URI that would be stored in the NFT properties645 /// @param tokenUri Token URI that would be stored in the NFT properties649 #[solidity(hide, rename_selector = "mintWithTokenURI")]646 #[solidity(hide, rename_selector = "mintWithTokenURI")]650 #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]647 #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]651 fn mint_with_token_uri_check_id(648 fn mint_with_token_uri_check_id(652 &mut self,649 &mut self,653 caller: Caller,650 caller: Caller,664 let caller = T::CrossAccountId::from_eth(caller);661 let caller = T::CrossAccountId::from_eth(caller);665 let to = T::CrossAccountId::from_eth(to);662 let to = T::CrossAccountId::from_eth(to);666 let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;663 let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;667 let budget = self668 .recorder669 .weight_calls_budget(<StructureWeight<T>>::find_parent());670664671 if <TokensMinted<T>>::get(self.id)665 if <TokensMinted<T>>::get(self.id)672 .checked_add(1)666 .checked_add(1)694 properties,688 properties,695 owner: to,689 owner: to,696 },690 },697 &budget,691 &nesting_budget(&self.recorder),698 )692 )699 .map_err(dispatch_to_evm::<T>)?;693 .map_err(dispatch_to_evm::<T>)?;700 Ok(true)694 Ok(true)840 let caller = T::CrossAccountId::from_eth(caller);834 let caller = T::CrossAccountId::from_eth(caller);841 let to = T::CrossAccountId::from_eth(to);835 let to = T::CrossAccountId::from_eth(to);842 let token = token_id.try_into()?;836 let token = token_id.try_into()?;843 let budget = self844 .recorder845 .weight_calls_budget(<StructureWeight<T>>::find_parent());846837847 <Pallet<T>>::transfer(self, &caller, &to, token, &budget)838 <Pallet<T>>::transfer(self, &caller, &to, token, &nesting_budget(&self.recorder))848 .map_err(|e| dispatch_to_evm::<T>(e.error))?;839 .map_err(|e| dispatch_to_evm::<T>(e.error))?;849 Ok(())840 Ok(())850 }841 }864 let caller = T::CrossAccountId::from_eth(caller);855 let caller = T::CrossAccountId::from_eth(caller);865 let to = to.into_sub_cross_account::<T>()?;856 let to = to.into_sub_cross_account::<T>()?;866 let token = token_id.try_into()?;857 let token = token_id.try_into()?;867 let budget = self868 .recorder869 .weight_calls_budget(<StructureWeight<T>>::find_parent());870858871 <Pallet<T>>::transfer(self, &caller, &to, token, &budget)859 <Pallet<T>>::transfer(self, &caller, &to, token, &nesting_budget(&self.recorder))872 .map_err(|e| dispatch_to_evm::<T>(e.error))?;860 .map_err(|e| dispatch_to_evm::<T>(e.error))?;873 Ok(())861 Ok(())874 }862 }891 let from = from.into_sub_cross_account::<T>()?;879 let from = from.into_sub_cross_account::<T>()?;892 let to = to.into_sub_cross_account::<T>()?;880 let to = to.into_sub_cross_account::<T>()?;893 let token_id = token_id.try_into()?;881 let token_id = token_id.try_into()?;894 let budget = self882895 .recorder896 .weight_calls_budget(<StructureWeight<T>>::find_parent());897 Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, &budget)883 Pallet::<T>::transfer_from(884 self,885 &caller,886 &from,887 &to,888 token_id,889 &nesting_budget(&self.recorder),890 )898 .map_err(|e| dispatch_to_evm::<T>(e.error))?;891 .map_err(|e| dispatch_to_evm::<T>(e.error))?;899 Ok(())892 Ok(())911 let caller = T::CrossAccountId::from_eth(caller);904 let caller = T::CrossAccountId::from_eth(caller);912 let from = T::CrossAccountId::from_eth(from);905 let from = T::CrossAccountId::from_eth(from);913 let token = token_id.try_into()?;906 let token = token_id.try_into()?;914 let budget = self915 .recorder916 .weight_calls_budget(<StructureWeight<T>>::find_parent());917907918 <Pallet<T>>::burn_from(self, &caller, &from, token, &budget)908 <Pallet<T>>::burn_from(self, &caller, &from, token, &nesting_budget(&self.recorder))919 .map_err(dispatch_to_evm::<T>)?;909 .map_err(dispatch_to_evm::<T>)?;920 Ok(())910 Ok(())921 }911 }936 let caller = T::CrossAccountId::from_eth(caller);926 let caller = T::CrossAccountId::from_eth(caller);937 let from = from.into_sub_cross_account::<T>()?;927 let from = from.into_sub_cross_account::<T>()?;938 let token = token_id.try_into()?;928 let token = token_id.try_into()?;939 let budget = self940 .recorder941 .weight_calls_budget(<StructureWeight<T>>::find_parent());942929943 <Pallet<T>>::burn_from(self, &caller, &from, token, &budget)930 <Pallet<T>>::burn_from(self, &caller, &from, token, &nesting_budget(&self.recorder))944 .map_err(dispatch_to_evm::<T>)?;931 .map_err(dispatch_to_evm::<T>)?;945 Ok(())932 Ok(())946 }933 }966 let mut expected_index = <TokensMinted<T>>::get(self.id)953 let mut expected_index = <TokensMinted<T>>::get(self.id)967 .checked_add(1)954 .checked_add(1)968 .ok_or("item id overflow")?;955 .ok_or("item id overflow")?;969 let budget = self970 .recorder971 .weight_calls_budget(<StructureWeight<T>>::find_parent());972956973 let total_tokens = token_ids.len();957 let total_tokens = token_ids.len();974 for id in token_ids.into_iter() {958 for id in token_ids.into_iter() {985 })969 })986 .collect();970 .collect();987971988 <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)972 <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))989 .map_err(dispatch_to_evm::<T>)?;973 .map_err(dispatch_to_evm::<T>)?;990 Ok(true)974 Ok(true)991 }975 }992976993 /// @notice Function to mint a token.977 /// @notice Function to mint a token.994 /// @param data Array of pairs of token owner and token's properties for minted token978 /// @param data Array of pairs of token owner and token's properties for minted token995 #[weight(<SelfWeightOf<T>>::create_multiple_items(data.len() as u32) + <SelfWeightOf<T>>::set_token_properties(data.len() as u32))]979 #[weight(980 mint_with_props_weight::<T>(981 <SelfWeightOf<T>>::create_multiple_items_ex(data.len() as u32),982 data.iter().map(|d| d.properties.len() as u32),983 )984 )]996 fn mint_bulk_cross(&mut self, caller: Caller, data: Vec<MintTokenData>) -> Result<bool> {985 fn mint_bulk_cross(&mut self, caller: Caller, data: Vec<MintTokenData>) -> Result<bool> {997 let caller = T::CrossAccountId::from_eth(caller);986 let caller = T::CrossAccountId::from_eth(caller);998 let budget = self999 .recorder1000 .weight_calls_budget(<StructureWeight<T>>::find_parent());10019871002 let mut create_nft_data = Vec::with_capacity(data.len());988 let mut create_nft_data = Vec::with_capacity(data.len());1003 for MintTokenData { owner, properties } in data {989 for MintTokenData { owner, properties } in data {1013 });999 });1014 }1000 }101510011016 <Pallet<T>>::create_multiple_items(self, &caller, create_nft_data, &budget)1002 <Pallet<T>>::create_multiple_items(1003 self,1004 &caller,1005 create_nft_data,1006 &nesting_budget(&self.recorder),1007 )1017 .map_err(dispatch_to_evm::<T>)?;1008 .map_err(dispatch_to_evm::<T>)?;1018 Ok(true)1009 Ok(true)1024 /// @param to The new owner1015 /// @param to The new owner1025 /// @param tokens array of pairs of token ID and token URI for minted tokens1016 /// @param tokens array of pairs of token ID and token URI for minted tokens1026 #[solidity(hide, rename_selector = "mintBulkWithTokenURI")]1017 #[solidity(hide, rename_selector = "mintBulkWithTokenURI")]1027 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]1018 #[weight(1019 mint_with_props_weight::<T>(1020 <SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32),1021 tokens.iter().map(|_| 1),1022 )1023 )]1028 fn mint_bulk_with_token_uri(1024 fn mint_bulk_with_token_uri(1029 &mut self,1025 &mut self,1037 let mut expected_index = <TokensMinted<T>>::get(self.id)1033 let mut expected_index = <TokensMinted<T>>::get(self.id)1038 .checked_add(1)1034 .checked_add(1)1039 .ok_or("item id overflow")?;1035 .ok_or("item id overflow")?;1040 let budget = self1041 .recorder1042 .weight_calls_budget(<StructureWeight<T>>::find_parent());104310361044 let mut data = Vec::with_capacity(tokens.len());1037 let mut data = Vec::with_capacity(tokens.len());1045 for TokenUri { id, uri } in tokens {1038 for TokenUri { id, uri } in tokens {1066 });1059 });1067 }1060 }106810611069 <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)1062 <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))1070 .map_err(dispatch_to_evm::<T>)?;1063 .map_err(dispatch_to_evm::<T>)?;1071 Ok(true)1064 Ok(true)1072 }1065 }1075 /// @param to The new owner crossAccountId1068 /// @param to The new owner crossAccountId1076 /// @param properties Properties of minted token1069 /// @param properties Properties of minted token1077 /// @return uint256 The id of the newly minted token1070 /// @return uint256 The id of the newly minted token1078 #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]1071 #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [properties.len() as u32].into_iter()))]1079 fn mint_cross(1072 fn mint_cross(1080 &mut self,1073 &mut self,1081 caller: Caller,1074 caller: Caller,109710901098 let caller = T::CrossAccountId::from_eth(caller);1091 let caller = T::CrossAccountId::from_eth(caller);10991100 let budget = self1101 .recorder1102 .weight_calls_budget(<StructureWeight<T>>::find_parent());110310921104 <Pallet<T>>::create_item(1093 <Pallet<T>>::create_item(1105 self,1094 self,1108 properties,1097 properties,1109 owner: to,1098 owner: to,1110 },1099 },1111 &budget,1100 &nesting_budget(&self.recorder),1112 )1101 )1113 .map_err(dispatch_to_evm::<T>)?;1102 .map_err(dispatch_to_evm::<T>)?;11141103pallets/nonfungible/src/lib.rsdiffbeforeafterboth109};109};110use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};110use pallet_evm::{account::CrossAccountId, Pallet as PalletEvm};111use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};111use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};112use pallet_structure::{Error as StructureError, Pallet as PalletStructure};112use pallet_structure::Pallet as PalletStructure;113use parity_scale_codec::{Decode, Encode, MaxEncodedLen};113use parity_scale_codec::{Decode, Encode, MaxEncodedLen};114use scale_info::TypeInfo;114use scale_info::TypeInfo;115use sp_core::{Get, H160};115use sp_core::{Get, H160};503 Ok(())503 Ok(())504 }504 }505506 /// Same as [`burn`] but burns all the tokens that are nested in the token first507 ///508 /// - `self_budget`: Limit for searching children in depth.509 /// - `breadth_budget`: Limit of breadth of searching children.510 ///511 /// [`burn`]: struct.Pallet.html#method.burn512 #[transactional]513 pub fn burn_recursively(514 collection: &NonfungibleHandle<T>,515 sender: &T::CrossAccountId,516 token: TokenId,517 self_budget: &dyn Budget,518 breadth_budget: &dyn Budget,519 ) -> DispatchResultWithPostInfo {520 ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);521522 let current_token_account =523 T::CrossTokenAddressMapping::token_to_address(collection.id, token);524525 let mut weight = Weight::zero();526527 // This method is transactional, if user in fact doesn't have permissions to remove token -528 // tokens removed here will be restored after rejected transaction529 for ((collection, token), _) in <TokenChildren<T>>::iter_prefix((collection.id, token)) {530 ensure!(breadth_budget.consume(), <StructureError<T>>::BreadthLimit,);531 let PostDispatchInfo { actual_weight, .. } =532 <PalletStructure<T>>::burn_item_recursively(533 current_token_account.clone(),534 collection,535 token,536 self_budget,537 breadth_budget,538 )?;539 if let Some(actual_weight) = actual_weight {540 weight = weight.saturating_add(actual_weight);541 }542 }543544 Self::burn(collection, sender, token)?;545 DispatchResultWithPostInfo::Ok(PostDispatchInfo {546 actual_weight: Some(weight + <SelfWeightOf<T>>::burn_item()),547 pays_fee: Pays::Yes,548 })549 }550505551 /// A batch operation to add, edit or remove properties for a token.506 /// A batch operation to add, edit or remove properties for a token.552 ///507 ///568 nesting_budget: &dyn Budget,523 nesting_budget: &dyn Budget,569 ) -> DispatchResult {524 ) -> DispatchResult {570 let mut property_writer =525 let mut property_writer =571 pallet_common::property_writer_for_existing_token(collection, sender);526 pallet_common::ExistingTokenPropertyWriter::new(collection, sender);572527573 property_writer.write_token_properties(528 property_writer.write_token_properties(574 sender,529 sender,915870916 // =========871 // =========917872918 let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);873 let mut property_writer = pallet_common::NewTokenPropertyWriter::new(collection, sender);919874920 with_transaction(|| {875 with_transaction(|| {921 for (i, data) in data.iter().enumerate() {876 for (i, data) in data.iter().enumerate() {pallets/nonfungible/src/weights.rsdiffbeforeafterboth3//! Autogenerated weights for pallet_nonfungible3//! Autogenerated weights for pallet_nonfungible4//!4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! WORST CASE MAP SIZE: `1000000`7//! WORST CASE MAP SIZE: `1000000`8//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`8//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`9//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10249//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024101011// Executed Command:11// Executed Command:12// target/production/unique-collator12// ./target/production/unique-collator13// benchmark13// benchmark14// pallet14// pallet15// --pallet15// --pallet20// *20// *21// --template=.maintain/frame-weight-template.hbs21// --template=.maintain/frame-weight-template.hbs22// --steps=5022// --steps=5023// --repeat=40023// --repeat=8024// --heap-pages=409624// --heap-pages=409625// --output=./pallets/nonfungible/src/weights.rs25// --output=./pallets/nonfungible/src/weights.rs262637 fn create_multiple_items(b: u32, ) -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex(b: u32, ) -> Weight;38 fn create_multiple_items_ex(b: u32, ) -> Weight;39 fn burn_item() -> Weight;39 fn burn_item() -> Weight;40 fn burn_recursively_self_raw() -> Weight;41 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight;42 fn transfer_raw() -> Weight;40 fn transfer_raw() -> Weight;43 fn approve() -> Weight;41 fn approve() -> Weight;44 fn approve_from() -> Weight;42 fn approve_from() -> Weight;45 fn check_allowed_raw() -> Weight;43 fn check_allowed_raw() -> Weight;46 fn burn_from() -> Weight;44 fn burn_from() -> Weight;47 fn set_token_property_permissions(b: u32, ) -> Weight;45 fn load_token_properties() -> Weight;48 fn set_token_properties(b: u32, ) -> Weight;46 fn write_token_properties(b: u32, ) -> Weight;49 fn init_token_properties(b: u32, ) -> Weight;47 fn set_token_property_permissions(b: u32, ) -> Weight;50 fn delete_token_properties(b: u32, ) -> Weight;51 fn token_owner() -> Weight;52 fn set_allowance_for_all() -> Weight;48 fn set_allowance_for_all() -> Weight;53 fn allowance_for_all() -> Weight;49 fn allowance_for_all() -> Weight;54 fn repair_item() -> Weight;50 fn repair_item() -> Weight;57/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.53/// Weights for pallet_nonfungible using the Substrate node and recommended hardware.58pub struct SubstrateWeight<T>(PhantomData<T>);54pub struct SubstrateWeight<T>(PhantomData<T>);59impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {55impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {60 /// Storage: Nonfungible TokensMinted (r:1 w:1)56 /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)61 /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)57 /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)62 /// Storage: Nonfungible AccountBalance (r:1 w:1)58 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)63 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)59 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)64 /// Storage: Nonfungible TokenData (r:0 w:1)60 /// Storage: `Nonfungible::TokenData` (r:0 w:1)65 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)61 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)66 /// Storage: Nonfungible Owned (r:0 w:1)62 /// Storage: `Nonfungible::Owned` (r:0 w:1)67 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)63 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)68 fn create_item() -> Weight {64 fn create_item() -> Weight {69 // Proof Size summary in bytes:65 // Proof Size summary in bytes:70 // Measured: `142`66 // Measured: `142`71 // Estimated: `3530`67 // Estimated: `3530`72 // Minimum execution time: 9_726_000 picoseconds.68 // Minimum execution time: 15_410_000 picoseconds.73 Weight::from_parts(10_059_000, 3530)69 Weight::from_parts(15_850_000, 3530)74 .saturating_add(T::DbWeight::get().reads(2_u64))70 .saturating_add(T::DbWeight::get().reads(2_u64))75 .saturating_add(T::DbWeight::get().writes(4_u64))71 .saturating_add(T::DbWeight::get().writes(4_u64))76 }72 }77 /// Storage: Nonfungible TokensMinted (r:1 w:1)73 /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)78 /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)74 /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)79 /// Storage: Nonfungible AccountBalance (r:1 w:1)75 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)80 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)76 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)81 /// Storage: Nonfungible TokenData (r:0 w:200)77 /// Storage: `Nonfungible::TokenData` (r:0 w:200)82 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)78 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)83 /// Storage: Nonfungible Owned (r:0 w:200)79 /// Storage: `Nonfungible::Owned` (r:0 w:200)84 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)80 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)85 /// The range of component `b` is `[0, 200]`.81 /// The range of component `b` is `[0, 200]`.86 fn create_multiple_items(b: u32, ) -> Weight {82 fn create_multiple_items(b: u32, ) -> Weight {87 // Proof Size summary in bytes:83 // Proof Size summary in bytes:88 // Measured: `142`84 // Measured: `142`89 // Estimated: `3530`85 // Estimated: `3530`90 // Minimum execution time: 3_270_000 picoseconds.86 // Minimum execution time: 3_300_000 picoseconds.91 Weight::from_parts(3_693_659, 3530)87 Weight::from_parts(5_992_994, 3530)92 // Standard Error: 25588 // Standard Error: 4_47893 .saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))89 .saturating_add(Weight::from_parts(8_002_092, 0).saturating_mul(b.into()))94 .saturating_add(T::DbWeight::get().reads(2_u64))90 .saturating_add(T::DbWeight::get().reads(2_u64))95 .saturating_add(T::DbWeight::get().writes(2_u64))91 .saturating_add(T::DbWeight::get().writes(2_u64))96 .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))92 .saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(b.into())))97 }93 }98 /// Storage: Nonfungible TokensMinted (r:1 w:1)94 /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)99 /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)95 /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)100 /// Storage: Nonfungible AccountBalance (r:200 w:200)96 /// Storage: `Nonfungible::AccountBalance` (r:200 w:200)101 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)97 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)102 /// Storage: Nonfungible TokenData (r:0 w:200)98 /// Storage: `Nonfungible::TokenData` (r:0 w:200)103 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)99 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)104 /// Storage: Nonfungible Owned (r:0 w:200)100 /// Storage: `Nonfungible::Owned` (r:0 w:200)105 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)101 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)106 /// The range of component `b` is `[0, 200]`.102 /// The range of component `b` is `[0, 200]`.107 fn create_multiple_items_ex(b: u32, ) -> Weight {103 fn create_multiple_items_ex(b: u32, ) -> Weight {108 // Proof Size summary in bytes:104 // Proof Size summary in bytes:109 // Measured: `142`105 // Measured: `142`110 // Estimated: `3481 + b * (2540 ±0)`106 // Estimated: `3481 + b * (2540 ±0)`111 // Minimum execution time: 3_188_000 picoseconds.107 // Minimum execution time: 3_300_000 picoseconds.112 Weight::from_parts(3_307_000, 3481)108 Weight::from_parts(3_980_000, 3481)113 // Standard Error: 567109 // Standard Error: 1_382114 .saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))110 .saturating_add(Weight::from_parts(11_259_286, 0).saturating_mul(b.into()))115 .saturating_add(T::DbWeight::get().reads(1_u64))111 .saturating_add(T::DbWeight::get().reads(1_u64))116 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))112 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))117 .saturating_add(T::DbWeight::get().writes(1_u64))113 .saturating_add(T::DbWeight::get().writes(1_u64))118 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))114 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))119 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))115 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))120 }116 }121 /// Storage: Nonfungible TokenData (r:1 w:1)117 /// Storage: `Nonfungible::TokenData` (r:1 w:1)122 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)118 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)123 /// Storage: Nonfungible TokenChildren (r:1 w:0)119 /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)124 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)120 /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)125 /// Storage: Nonfungible TokensBurnt (r:1 w:1)121 /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)126 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)122 /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)127 /// Storage: Nonfungible AccountBalance (r:1 w:1)123 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)128 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)124 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)129 /// Storage: Nonfungible Allowance (r:1 w:0)125 /// Storage: `Nonfungible::Allowance` (r:1 w:0)130 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)126 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)131 /// Storage: Nonfungible Owned (r:0 w:1)127 /// Storage: `Nonfungible::Owned` (r:0 w:1)132 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)128 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)133 /// Storage: Nonfungible TokenProperties (r:0 w:1)129 /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)134 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)130 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)135 fn burn_item() -> Weight {131 fn burn_item() -> Weight {136 // Proof Size summary in bytes:132 // Proof Size summary in bytes:137 // Measured: `380`133 // Measured: `380`138 // Estimated: `3530`134 // Estimated: `3530`139 // Minimum execution time: 18_062_000 picoseconds.135 // Minimum execution time: 26_360_000 picoseconds.140 Weight::from_parts(18_433_000, 3530)136 Weight::from_parts(26_850_000, 3530)141 .saturating_add(T::DbWeight::get().reads(5_u64))137 .saturating_add(T::DbWeight::get().reads(5_u64))142 .saturating_add(T::DbWeight::get().writes(5_u64))138 .saturating_add(T::DbWeight::get().writes(5_u64))143 }139 }144 /// Storage: Nonfungible TokenChildren (r:1 w:0)145 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)146 /// Storage: Nonfungible TokenData (r:1 w:1)147 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)148 /// Storage: Nonfungible TokensBurnt (r:1 w:1)149 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)150 /// Storage: Nonfungible AccountBalance (r:1 w:1)151 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)152 /// Storage: Nonfungible Allowance (r:1 w:0)153 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)154 /// Storage: Nonfungible Owned (r:0 w:1)155 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)156 /// Storage: Nonfungible TokenProperties (r:0 w:1)157 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)158 fn burn_recursively_self_raw() -> Weight {159 // Proof Size summary in bytes:160 // Measured: `380`161 // Estimated: `3530`162 // Minimum execution time: 22_942_000 picoseconds.163 Weight::from_parts(23_527_000, 3530)164 .saturating_add(T::DbWeight::get().reads(5_u64))165 .saturating_add(T::DbWeight::get().writes(5_u64))166 }167 /// Storage: Nonfungible TokenChildren (r:401 w:200)168 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)169 /// Storage: Common CollectionById (r:1 w:0)170 /// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)171 /// Storage: Nonfungible TokenData (r:201 w:201)172 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)173 /// Storage: Nonfungible TokensBurnt (r:1 w:1)174 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)175 /// Storage: Nonfungible AccountBalance (r:2 w:2)176 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)177 /// Storage: Nonfungible Allowance (r:201 w:0)178 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)179 /// Storage: Nonfungible Owned (r:0 w:201)180 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)181 /// Storage: Nonfungible TokenProperties (r:0 w:201)182 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)183 /// The range of component `b` is `[0, 200]`.184 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {185 // Proof Size summary in bytes:186 // Measured: `1500 + b * (58 ±0)`187 // Estimated: `5874 + b * (5032 ±0)`188 // Minimum execution time: 22_709_000 picoseconds.189 Weight::from_parts(23_287_000, 5874)190 // Standard Error: 89_471191 .saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))192 .saturating_add(T::DbWeight::get().reads(7_u64))193 .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(b.into())))194 .saturating_add(T::DbWeight::get().writes(6_u64))195 .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))196 .saturating_add(Weight::from_parts(0, 5032).saturating_mul(b.into()))197 }198 /// Storage: Nonfungible TokenData (r:1 w:1)140 /// Storage: `Nonfungible::TokenData` (r:1 w:1)199 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)141 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)200 /// Storage: Nonfungible AccountBalance (r:2 w:2)142 /// Storage: `Nonfungible::AccountBalance` (r:2 w:2)201 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)143 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)202 /// Storage: Nonfungible Allowance (r:1 w:0)144 /// Storage: `Nonfungible::Allowance` (r:1 w:0)203 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)145 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)204 /// Storage: Nonfungible Owned (r:0 w:2)146 /// Storage: `Nonfungible::Owned` (r:0 w:2)205 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)147 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)206 fn transfer_raw() -> Weight {148 fn transfer_raw() -> Weight {207 // Proof Size summary in bytes:149 // Proof Size summary in bytes:208 // Measured: `380`150 // Measured: `380`209 // Estimated: `6070`151 // Estimated: `6070`210 // Minimum execution time: 13_652_000 picoseconds.152 // Minimum execution time: 22_710_000 picoseconds.211 Weight::from_parts(13_981_000, 6070)153 Weight::from_parts(23_130_000, 6070)212 .saturating_add(T::DbWeight::get().reads(4_u64))154 .saturating_add(T::DbWeight::get().reads(4_u64))213 .saturating_add(T::DbWeight::get().writes(5_u64))155 .saturating_add(T::DbWeight::get().writes(5_u64))214 }156 }215 /// Storage: Nonfungible TokenData (r:1 w:0)157 /// Storage: `Nonfungible::TokenData` (r:1 w:0)216 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)158 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)217 /// Storage: Nonfungible Allowance (r:1 w:1)159 /// Storage: `Nonfungible::Allowance` (r:1 w:1)218 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)160 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)219 fn approve() -> Weight {161 fn approve() -> Weight {220 // Proof Size summary in bytes:162 // Proof Size summary in bytes:221 // Measured: `326`163 // Measured: `326`222 // Estimated: `3522`164 // Estimated: `3522`223 // Minimum execution time: 7_837_000 picoseconds.165 // Minimum execution time: 11_520_000 picoseconds.224 Weight::from_parts(8_113_000, 3522)166 Weight::from_parts(12_030_000, 3522)225 .saturating_add(T::DbWeight::get().reads(2_u64))167 .saturating_add(T::DbWeight::get().reads(2_u64))226 .saturating_add(T::DbWeight::get().writes(1_u64))168 .saturating_add(T::DbWeight::get().writes(1_u64))227 }169 }228 /// Storage: Nonfungible TokenData (r:1 w:0)170 /// Storage: `Nonfungible::TokenData` (r:1 w:0)229 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)171 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)230 /// Storage: Nonfungible Allowance (r:1 w:1)172 /// Storage: `Nonfungible::Allowance` (r:1 w:1)231 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)173 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)232 fn approve_from() -> Weight {174 fn approve_from() -> Weight {233 // Proof Size summary in bytes:175 // Proof Size summary in bytes:234 // Measured: `313`176 // Measured: `313`235 // Estimated: `3522`177 // Estimated: `3522`236 // Minimum execution time: 7_769_000 picoseconds.178 // Minimum execution time: 11_570_000 picoseconds.237 Weight::from_parts(7_979_000, 3522)179 Weight::from_parts(12_139_000, 3522)238 .saturating_add(T::DbWeight::get().reads(2_u64))180 .saturating_add(T::DbWeight::get().reads(2_u64))239 .saturating_add(T::DbWeight::get().writes(1_u64))181 .saturating_add(T::DbWeight::get().writes(1_u64))240 }182 }241 /// Storage: Nonfungible Allowance (r:1 w:0)183 /// Storage: `Nonfungible::Allowance` (r:1 w:0)242 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)184 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)243 fn check_allowed_raw() -> Weight {185 fn check_allowed_raw() -> Weight {244 // Proof Size summary in bytes:186 // Proof Size summary in bytes:245 // Measured: `362`187 // Measured: `362`246 // Estimated: `3522`188 // Estimated: `3522`247 // Minimum execution time: 4_194_000 picoseconds.189 // Minimum execution time: 4_210_000 picoseconds.248 Weight::from_parts(4_353_000, 3522)190 Weight::from_parts(4_350_000, 3522)249 .saturating_add(T::DbWeight::get().reads(1_u64))191 .saturating_add(T::DbWeight::get().reads(1_u64))250 }192 }251 /// Storage: Nonfungible Allowance (r:1 w:1)193 /// Storage: `Nonfungible::Allowance` (r:1 w:1)252 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)194 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)253 /// Storage: Nonfungible TokenData (r:1 w:1)195 /// Storage: `Nonfungible::TokenData` (r:1 w:1)254 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)196 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)255 /// Storage: Nonfungible TokenChildren (r:1 w:0)197 /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)256 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)198 /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)257 /// Storage: Nonfungible TokensBurnt (r:1 w:1)199 /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)258 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)200 /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)259 /// Storage: Nonfungible AccountBalance (r:1 w:1)201 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)260 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)202 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)261 /// Storage: Nonfungible Owned (r:0 w:1)203 /// Storage: `Nonfungible::Owned` (r:0 w:1)262 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)204 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)263 /// Storage: Nonfungible TokenProperties (r:0 w:1)205 /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)264 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)206 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)265 fn burn_from() -> Weight {207 fn burn_from() -> Weight {266 // Proof Size summary in bytes:208 // Proof Size summary in bytes:267 // Measured: `463`209 // Measured: `463`268 // Estimated: `3530`210 // Estimated: `3530`269 // Minimum execution time: 21_978_000 picoseconds.211 // Minimum execution time: 32_230_000 picoseconds.270 Weight::from_parts(22_519_000, 3530)212 Weight::from_parts(33_210_000, 3530)271 .saturating_add(T::DbWeight::get().reads(5_u64))213 .saturating_add(T::DbWeight::get().reads(5_u64))272 .saturating_add(T::DbWeight::get().writes(6_u64))214 .saturating_add(T::DbWeight::get().writes(6_u64))273 }215 }274 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)275 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)276 /// The range of component `b` is `[0, 64]`.277 fn set_token_property_permissions(b: u32, ) -> Weight {278 // Proof Size summary in bytes:279 // Measured: `314`280 // Estimated: `20191`281 // Minimum execution time: 1_457_000 picoseconds.282 Weight::from_parts(1_563_000, 20191)283 // Standard Error: 14_041284 .saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))285 .saturating_add(T::DbWeight::get().reads(1_u64))286 .saturating_add(T::DbWeight::get().writes(1_u64))287 }288 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)289 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)290 /// Storage: Nonfungible TokenProperties (r:1 w:1)216 /// Storage: `Nonfungible::TokenProperties` (r:1 w:0)291 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)217 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)292 /// Storage: Nonfungible TokenData (r:1 w:0)293 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)294 /// The range of component `b` is `[0, 64]`.295 fn set_token_properties(b: u32, ) -> Weight {218 fn load_token_properties() -> Weight {296 // Proof Size summary in bytes:219 // Proof Size summary in bytes:297 // Measured: `640 + b * (261 ±0)`220 // Measured: `279`298 // Estimated: `36269`221 // Estimated: `36269`299 // Minimum execution time: 963_000 picoseconds.222 // Minimum execution time: 3_180_000 picoseconds.300 Weight::from_parts(1_126_511, 36269)223 Weight::from_parts(3_370_000, 36269)301 // Standard Error: 9_175302 .saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))303 .saturating_add(T::DbWeight::get().reads(3_u64))304 .saturating_add(T::DbWeight::get().writes(1_u64))224 .saturating_add(T::DbWeight::get().reads(1_u64))305 }225 }306 /// Storage: Nonfungible TokenProperties (r:0 w:1)226 /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)307 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)227 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)308 /// The range of component `b` is `[0, 64]`.228 /// The range of component `b` is `[0, 64]`.309 fn init_token_properties(b: u32, ) -> Weight {229 fn write_token_properties(b: u32, ) -> Weight {310 // Proof Size summary in bytes:230 // Proof Size summary in bytes:311 // Measured: `0`231 // Measured: `0`312 // Estimated: `0`232 // Estimated: `0`313 // Minimum execution time: 194_000 picoseconds.233 // Minimum execution time: 440_000 picoseconds.314 Weight::from_parts(222_000, 0)234 Weight::from_parts(3_567_990, 0)315 // Standard Error: 7_295235 // Standard Error: 24_013316 .saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))236 .saturating_add(Weight::from_parts(19_386_123, 0).saturating_mul(b.into()))317 .saturating_add(T::DbWeight::get().writes(1_u64))237 .saturating_add(T::DbWeight::get().writes(1_u64))318 }238 }319 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)239 /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)320 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)240 /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)321 /// Storage: Nonfungible TokenData (r:1 w:0)322 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)323 /// Storage: Nonfungible TokenProperties (r:1 w:1)324 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)325 /// The range of component `b` is `[0, 64]`.241 /// The range of component `b` is `[0, 64]`.326 fn delete_token_properties(b: u32, ) -> Weight {242 fn set_token_property_permissions(b: u32, ) -> Weight {327 // Proof Size summary in bytes:243 // Proof Size summary in bytes:328 // Measured: `699 + b * (33291 ±0)`244 // Measured: `314`329 // Estimated: `36269`245 // Estimated: `20191`330 // Minimum execution time: 992_000 picoseconds.246 // Minimum execution time: 1_460_000 picoseconds.331 Weight::from_parts(1_043_000, 36269)247 Weight::from_parts(1_530_000, 20191)332 // Standard Error: 37_370248 // Standard Error: 124_929333 .saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))249 .saturating_add(Weight::from_parts(28_397_581, 0).saturating_mul(b.into()))334 .saturating_add(T::DbWeight::get().reads(3_u64))250 .saturating_add(T::DbWeight::get().reads(1_u64))335 .saturating_add(T::DbWeight::get().writes(1_u64))251 .saturating_add(T::DbWeight::get().writes(1_u64))336 }252 }337 /// Storage: Nonfungible TokenData (r:1 w:0)338 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)339 fn token_owner() -> Weight {340 // Proof Size summary in bytes:341 // Measured: `326`342 // Estimated: `3522`343 // Minimum execution time: 3_743_000 picoseconds.344 Weight::from_parts(3_908_000, 3522)345 .saturating_add(T::DbWeight::get().reads(1_u64))346 }347 /// Storage: Nonfungible CollectionAllowance (r:0 w:1)253 /// Storage: `Nonfungible::CollectionAllowance` (r:0 w:1)348 /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)254 /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)349 fn set_allowance_for_all() -> Weight {255 fn set_allowance_for_all() -> Weight {350 // Proof Size summary in bytes:256 // Proof Size summary in bytes:351 // Measured: `0`257 // Measured: `0`352 // Estimated: `0`258 // Estimated: `0`353 // Minimum execution time: 4_106_000 picoseconds.259 // Minimum execution time: 6_840_000 picoseconds.354 Weight::from_parts(4_293_000, 0)260 Weight::from_parts(7_160_000, 0)355 .saturating_add(T::DbWeight::get().writes(1_u64))261 .saturating_add(T::DbWeight::get().writes(1_u64))356 }262 }357 /// Storage: Nonfungible CollectionAllowance (r:1 w:0)263 /// Storage: `Nonfungible::CollectionAllowance` (r:1 w:0)358 /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)264 /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)359 fn allowance_for_all() -> Weight {265 fn allowance_for_all() -> Weight {360 // Proof Size summary in bytes:266 // Proof Size summary in bytes:361 // Measured: `142`267 // Measured: `142`362 // Estimated: `3576`268 // Estimated: `3576`363 // Minimum execution time: 2_775_000 picoseconds.269 // Minimum execution time: 3_630_000 picoseconds.364 Weight::from_parts(2_923_000, 3576)270 Weight::from_parts(3_780_000, 3576)365 .saturating_add(T::DbWeight::get().reads(1_u64))271 .saturating_add(T::DbWeight::get().reads(1_u64))366 }272 }367 /// Storage: Nonfungible TokenProperties (r:1 w:1)273 /// Storage: `Nonfungible::TokenProperties` (r:1 w:1)368 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)274 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)369 fn repair_item() -> Weight {275 fn repair_item() -> Weight {370 // Proof Size summary in bytes:276 // Proof Size summary in bytes:371 // Measured: `279`277 // Measured: `279`372 // Estimated: `36269`278 // Estimated: `36269`373 // Minimum execution time: 3_033_000 picoseconds.279 // Minimum execution time: 3_280_000 picoseconds.374 Weight::from_parts(3_174_000, 36269)280 Weight::from_parts(3_480_000, 36269)375 .saturating_add(T::DbWeight::get().reads(1_u64))281 .saturating_add(T::DbWeight::get().reads(1_u64))376 .saturating_add(T::DbWeight::get().writes(1_u64))282 .saturating_add(T::DbWeight::get().writes(1_u64))377 }283 }378}284}379285380// For backwards compatibility and tests286// For backwards compatibility and tests381impl WeightInfo for () {287impl WeightInfo for () {382 /// Storage: Nonfungible TokensMinted (r:1 w:1)288 /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)383 /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)289 /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)384 /// Storage: Nonfungible AccountBalance (r:1 w:1)290 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)385 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)291 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)386 /// Storage: Nonfungible TokenData (r:0 w:1)292 /// Storage: `Nonfungible::TokenData` (r:0 w:1)387 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)293 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)388 /// Storage: Nonfungible Owned (r:0 w:1)294 /// Storage: `Nonfungible::Owned` (r:0 w:1)389 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)295 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)390 fn create_item() -> Weight {296 fn create_item() -> Weight {391 // Proof Size summary in bytes:297 // Proof Size summary in bytes:392 // Measured: `142`298 // Measured: `142`393 // Estimated: `3530`299 // Estimated: `3530`394 // Minimum execution time: 9_726_000 picoseconds.300 // Minimum execution time: 15_410_000 picoseconds.395 Weight::from_parts(10_059_000, 3530)301 Weight::from_parts(15_850_000, 3530)396 .saturating_add(RocksDbWeight::get().reads(2_u64))302 .saturating_add(RocksDbWeight::get().reads(2_u64))397 .saturating_add(RocksDbWeight::get().writes(4_u64))303 .saturating_add(RocksDbWeight::get().writes(4_u64))398 }304 }399 /// Storage: Nonfungible TokensMinted (r:1 w:1)305 /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)400 /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)306 /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)401 /// Storage: Nonfungible AccountBalance (r:1 w:1)307 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)402 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)308 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)403 /// Storage: Nonfungible TokenData (r:0 w:200)309 /// Storage: `Nonfungible::TokenData` (r:0 w:200)404 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)310 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)405 /// Storage: Nonfungible Owned (r:0 w:200)311 /// Storage: `Nonfungible::Owned` (r:0 w:200)406 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)312 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)407 /// The range of component `b` is `[0, 200]`.313 /// The range of component `b` is `[0, 200]`.408 fn create_multiple_items(b: u32, ) -> Weight {314 fn create_multiple_items(b: u32, ) -> Weight {409 // Proof Size summary in bytes:315 // Proof Size summary in bytes:410 // Measured: `142`316 // Measured: `142`411 // Estimated: `3530`317 // Estimated: `3530`412 // Minimum execution time: 3_270_000 picoseconds.318 // Minimum execution time: 3_300_000 picoseconds.413 Weight::from_parts(3_693_659, 3530)319 Weight::from_parts(5_992_994, 3530)414 // Standard Error: 255320 // Standard Error: 4_478415 .saturating_add(Weight::from_parts(3_024_284, 0).saturating_mul(b.into()))321 .saturating_add(Weight::from_parts(8_002_092, 0).saturating_mul(b.into()))416 .saturating_add(RocksDbWeight::get().reads(2_u64))322 .saturating_add(RocksDbWeight::get().reads(2_u64))417 .saturating_add(RocksDbWeight::get().writes(2_u64))323 .saturating_add(RocksDbWeight::get().writes(2_u64))418 .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))324 .saturating_add(RocksDbWeight::get().writes((2_u64).saturating_mul(b.into())))419 }325 }420 /// Storage: Nonfungible TokensMinted (r:1 w:1)326 /// Storage: `Nonfungible::TokensMinted` (r:1 w:1)421 /// Proof: Nonfungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)327 /// Proof: `Nonfungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)422 /// Storage: Nonfungible AccountBalance (r:200 w:200)328 /// Storage: `Nonfungible::AccountBalance` (r:200 w:200)423 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)329 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)424 /// Storage: Nonfungible TokenData (r:0 w:200)330 /// Storage: `Nonfungible::TokenData` (r:0 w:200)425 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)331 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)426 /// Storage: Nonfungible Owned (r:0 w:200)332 /// Storage: `Nonfungible::Owned` (r:0 w:200)427 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)333 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)428 /// The range of component `b` is `[0, 200]`.334 /// The range of component `b` is `[0, 200]`.429 fn create_multiple_items_ex(b: u32, ) -> Weight {335 fn create_multiple_items_ex(b: u32, ) -> Weight {430 // Proof Size summary in bytes:336 // Proof Size summary in bytes:431 // Measured: `142`337 // Measured: `142`432 // Estimated: `3481 + b * (2540 ±0)`338 // Estimated: `3481 + b * (2540 ±0)`433 // Minimum execution time: 3_188_000 picoseconds.339 // Minimum execution time: 3_300_000 picoseconds.434 Weight::from_parts(3_307_000, 3481)340 Weight::from_parts(3_980_000, 3481)435 // Standard Error: 567341 // Standard Error: 1_382436 .saturating_add(Weight::from_parts(4_320_449, 0).saturating_mul(b.into()))342 .saturating_add(Weight::from_parts(11_259_286, 0).saturating_mul(b.into()))437 .saturating_add(RocksDbWeight::get().reads(1_u64))343 .saturating_add(RocksDbWeight::get().reads(1_u64))438 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))344 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))439 .saturating_add(RocksDbWeight::get().writes(1_u64))345 .saturating_add(RocksDbWeight::get().writes(1_u64))440 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))346 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))441 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))347 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))442 }348 }443 /// Storage: Nonfungible TokenData (r:1 w:1)349 /// Storage: `Nonfungible::TokenData` (r:1 w:1)444 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)350 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)445 /// Storage: Nonfungible TokenChildren (r:1 w:0)351 /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)446 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)352 /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)447 /// Storage: Nonfungible TokensBurnt (r:1 w:1)353 /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)448 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)354 /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)449 /// Storage: Nonfungible AccountBalance (r:1 w:1)355 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)450 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)356 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)451 /// Storage: Nonfungible Allowance (r:1 w:0)357 /// Storage: `Nonfungible::Allowance` (r:1 w:0)452 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)358 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)453 /// Storage: Nonfungible Owned (r:0 w:1)359 /// Storage: `Nonfungible::Owned` (r:0 w:1)454 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)360 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)455 /// Storage: Nonfungible TokenProperties (r:0 w:1)361 /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)456 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)362 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)457 fn burn_item() -> Weight {363 fn burn_item() -> Weight {458 // Proof Size summary in bytes:364 // Proof Size summary in bytes:459 // Measured: `380`365 // Measured: `380`460 // Estimated: `3530`366 // Estimated: `3530`461 // Minimum execution time: 18_062_000 picoseconds.367 // Minimum execution time: 26_360_000 picoseconds.462 Weight::from_parts(18_433_000, 3530)368 Weight::from_parts(26_850_000, 3530)463 .saturating_add(RocksDbWeight::get().reads(5_u64))369 .saturating_add(RocksDbWeight::get().reads(5_u64))464 .saturating_add(RocksDbWeight::get().writes(5_u64))370 .saturating_add(RocksDbWeight::get().writes(5_u64))465 }371 }466 /// Storage: Nonfungible TokenChildren (r:1 w:0)467 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)468 /// Storage: Nonfungible TokenData (r:1 w:1)469 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)470 /// Storage: Nonfungible TokensBurnt (r:1 w:1)471 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)472 /// Storage: Nonfungible AccountBalance (r:1 w:1)473 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)474 /// Storage: Nonfungible Allowance (r:1 w:0)475 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)476 /// Storage: Nonfungible Owned (r:0 w:1)477 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)478 /// Storage: Nonfungible TokenProperties (r:0 w:1)479 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)480 fn burn_recursively_self_raw() -> Weight {481 // Proof Size summary in bytes:482 // Measured: `380`483 // Estimated: `3530`484 // Minimum execution time: 22_942_000 picoseconds.485 Weight::from_parts(23_527_000, 3530)486 .saturating_add(RocksDbWeight::get().reads(5_u64))487 .saturating_add(RocksDbWeight::get().writes(5_u64))488 }489 /// Storage: Nonfungible TokenChildren (r:401 w:200)490 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)491 /// Storage: Common CollectionById (r:1 w:0)492 /// Proof: Common CollectionById (max_values: None, max_size: Some(860), added: 3335, mode: MaxEncodedLen)493 /// Storage: Nonfungible TokenData (r:201 w:201)494 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)495 /// Storage: Nonfungible TokensBurnt (r:1 w:1)496 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)497 /// Storage: Nonfungible AccountBalance (r:2 w:2)498 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)499 /// Storage: Nonfungible Allowance (r:201 w:0)500 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)501 /// Storage: Nonfungible Owned (r:0 w:201)502 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)503 /// Storage: Nonfungible TokenProperties (r:0 w:201)504 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)505 /// The range of component `b` is `[0, 200]`.506 fn burn_recursively_breadth_plus_self_plus_self_per_each_raw(b: u32, ) -> Weight {507 // Proof Size summary in bytes:508 // Measured: `1500 + b * (58 ±0)`509 // Estimated: `5874 + b * (5032 ±0)`510 // Minimum execution time: 22_709_000 picoseconds.511 Weight::from_parts(23_287_000, 5874)512 // Standard Error: 89_471513 .saturating_add(Weight::from_parts(63_285_201, 0).saturating_mul(b.into()))514 .saturating_add(RocksDbWeight::get().reads(7_u64))515 .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(b.into())))516 .saturating_add(RocksDbWeight::get().writes(6_u64))517 .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))518 .saturating_add(Weight::from_parts(0, 5032).saturating_mul(b.into()))519 }520 /// Storage: Nonfungible TokenData (r:1 w:1)372 /// Storage: `Nonfungible::TokenData` (r:1 w:1)521 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)373 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)522 /// Storage: Nonfungible AccountBalance (r:2 w:2)374 /// Storage: `Nonfungible::AccountBalance` (r:2 w:2)523 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)375 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)524 /// Storage: Nonfungible Allowance (r:1 w:0)376 /// Storage: `Nonfungible::Allowance` (r:1 w:0)525 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)377 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)526 /// Storage: Nonfungible Owned (r:0 w:2)378 /// Storage: `Nonfungible::Owned` (r:0 w:2)527 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)379 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)528 fn transfer_raw() -> Weight {380 fn transfer_raw() -> Weight {529 // Proof Size summary in bytes:381 // Proof Size summary in bytes:530 // Measured: `380`382 // Measured: `380`531 // Estimated: `6070`383 // Estimated: `6070`532 // Minimum execution time: 13_652_000 picoseconds.384 // Minimum execution time: 22_710_000 picoseconds.533 Weight::from_parts(13_981_000, 6070)385 Weight::from_parts(23_130_000, 6070)534 .saturating_add(RocksDbWeight::get().reads(4_u64))386 .saturating_add(RocksDbWeight::get().reads(4_u64))535 .saturating_add(RocksDbWeight::get().writes(5_u64))387 .saturating_add(RocksDbWeight::get().writes(5_u64))536 }388 }537 /// Storage: Nonfungible TokenData (r:1 w:0)389 /// Storage: `Nonfungible::TokenData` (r:1 w:0)538 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)390 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)539 /// Storage: Nonfungible Allowance (r:1 w:1)391 /// Storage: `Nonfungible::Allowance` (r:1 w:1)540 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)392 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)541 fn approve() -> Weight {393 fn approve() -> Weight {542 // Proof Size summary in bytes:394 // Proof Size summary in bytes:543 // Measured: `326`395 // Measured: `326`544 // Estimated: `3522`396 // Estimated: `3522`545 // Minimum execution time: 7_837_000 picoseconds.397 // Minimum execution time: 11_520_000 picoseconds.546 Weight::from_parts(8_113_000, 3522)398 Weight::from_parts(12_030_000, 3522)547 .saturating_add(RocksDbWeight::get().reads(2_u64))399 .saturating_add(RocksDbWeight::get().reads(2_u64))548 .saturating_add(RocksDbWeight::get().writes(1_u64))400 .saturating_add(RocksDbWeight::get().writes(1_u64))549 }401 }550 /// Storage: Nonfungible TokenData (r:1 w:0)402 /// Storage: `Nonfungible::TokenData` (r:1 w:0)551 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)403 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)552 /// Storage: Nonfungible Allowance (r:1 w:1)404 /// Storage: `Nonfungible::Allowance` (r:1 w:1)553 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)405 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)554 fn approve_from() -> Weight {406 fn approve_from() -> Weight {555 // Proof Size summary in bytes:407 // Proof Size summary in bytes:556 // Measured: `313`408 // Measured: `313`557 // Estimated: `3522`409 // Estimated: `3522`558 // Minimum execution time: 7_769_000 picoseconds.410 // Minimum execution time: 11_570_000 picoseconds.559 Weight::from_parts(7_979_000, 3522)411 Weight::from_parts(12_139_000, 3522)560 .saturating_add(RocksDbWeight::get().reads(2_u64))412 .saturating_add(RocksDbWeight::get().reads(2_u64))561 .saturating_add(RocksDbWeight::get().writes(1_u64))413 .saturating_add(RocksDbWeight::get().writes(1_u64))562 }414 }563 /// Storage: Nonfungible Allowance (r:1 w:0)415 /// Storage: `Nonfungible::Allowance` (r:1 w:0)564 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)416 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)565 fn check_allowed_raw() -> Weight {417 fn check_allowed_raw() -> Weight {566 // Proof Size summary in bytes:418 // Proof Size summary in bytes:567 // Measured: `362`419 // Measured: `362`568 // Estimated: `3522`420 // Estimated: `3522`569 // Minimum execution time: 4_194_000 picoseconds.421 // Minimum execution time: 4_210_000 picoseconds.570 Weight::from_parts(4_353_000, 3522)422 Weight::from_parts(4_350_000, 3522)571 .saturating_add(RocksDbWeight::get().reads(1_u64))423 .saturating_add(RocksDbWeight::get().reads(1_u64))572 }424 }573 /// Storage: Nonfungible Allowance (r:1 w:1)425 /// Storage: `Nonfungible::Allowance` (r:1 w:1)574 /// Proof: Nonfungible Allowance (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)426 /// Proof: `Nonfungible::Allowance` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)575 /// Storage: Nonfungible TokenData (r:1 w:1)427 /// Storage: `Nonfungible::TokenData` (r:1 w:1)576 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)428 /// Proof: `Nonfungible::TokenData` (`max_values`: None, `max_size`: Some(57), added: 2532, mode: `MaxEncodedLen`)577 /// Storage: Nonfungible TokenChildren (r:1 w:0)429 /// Storage: `Nonfungible::TokenChildren` (r:1 w:0)578 /// Proof: Nonfungible TokenChildren (max_values: None, max_size: Some(41), added: 2516, mode: MaxEncodedLen)430 /// Proof: `Nonfungible::TokenChildren` (`max_values`: None, `max_size`: Some(41), added: 2516, mode: `MaxEncodedLen`)579 /// Storage: Nonfungible TokensBurnt (r:1 w:1)431 /// Storage: `Nonfungible::TokensBurnt` (r:1 w:1)580 /// Proof: Nonfungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)432 /// Proof: `Nonfungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)581 /// Storage: Nonfungible AccountBalance (r:1 w:1)433 /// Storage: `Nonfungible::AccountBalance` (r:1 w:1)582 /// Proof: Nonfungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)434 /// Proof: `Nonfungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)583 /// Storage: Nonfungible Owned (r:0 w:1)435 /// Storage: `Nonfungible::Owned` (r:0 w:1)584 /// Proof: Nonfungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)436 /// Proof: `Nonfungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)585 /// Storage: Nonfungible TokenProperties (r:0 w:1)437 /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)586 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)438 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)587 fn burn_from() -> Weight {439 fn burn_from() -> Weight {588 // Proof Size summary in bytes:440 // Proof Size summary in bytes:589 // Measured: `463`441 // Measured: `463`590 // Estimated: `3530`442 // Estimated: `3530`591 // Minimum execution time: 21_978_000 picoseconds.443 // Minimum execution time: 32_230_000 picoseconds.592 Weight::from_parts(22_519_000, 3530)444 Weight::from_parts(33_210_000, 3530)593 .saturating_add(RocksDbWeight::get().reads(5_u64))445 .saturating_add(RocksDbWeight::get().reads(5_u64))594 .saturating_add(RocksDbWeight::get().writes(6_u64))446 .saturating_add(RocksDbWeight::get().writes(6_u64))595 }447 }596 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)597 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)598 /// The range of component `b` is `[0, 64]`.599 fn set_token_property_permissions(b: u32, ) -> Weight {600 // Proof Size summary in bytes:601 // Measured: `314`602 // Estimated: `20191`603 // Minimum execution time: 1_457_000 picoseconds.604 Weight::from_parts(1_563_000, 20191)605 // Standard Error: 14_041606 .saturating_add(Weight::from_parts(8_452_415, 0).saturating_mul(b.into()))607 .saturating_add(RocksDbWeight::get().reads(1_u64))608 .saturating_add(RocksDbWeight::get().writes(1_u64))609 }610 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)611 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)612 /// Storage: Nonfungible TokenProperties (r:1 w:1)448 /// Storage: `Nonfungible::TokenProperties` (r:1 w:0)613 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)449 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)614 /// Storage: Nonfungible TokenData (r:1 w:0)615 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)616 /// The range of component `b` is `[0, 64]`.617 fn set_token_properties(b: u32, ) -> Weight {450 fn load_token_properties() -> Weight {618 // Proof Size summary in bytes:451 // Proof Size summary in bytes:619 // Measured: `640 + b * (261 ±0)`452 // Measured: `279`620 // Estimated: `36269`453 // Estimated: `36269`621 // Minimum execution time: 963_000 picoseconds.454 // Minimum execution time: 3_180_000 picoseconds.622 Weight::from_parts(1_126_511, 36269)455 Weight::from_parts(3_370_000, 36269)623 // Standard Error: 9_175624 .saturating_add(Weight::from_parts(5_096_011, 0).saturating_mul(b.into()))625 .saturating_add(RocksDbWeight::get().reads(3_u64))626 .saturating_add(RocksDbWeight::get().writes(1_u64))456 .saturating_add(RocksDbWeight::get().reads(1_u64))627 }457 }628 /// Storage: Nonfungible TokenProperties (r:0 w:1)458 /// Storage: `Nonfungible::TokenProperties` (r:0 w:1)629 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)459 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)630 /// The range of component `b` is `[0, 64]`.460 /// The range of component `b` is `[0, 64]`.631 fn init_token_properties(b: u32, ) -> Weight {461 fn write_token_properties(b: u32, ) -> Weight {632 // Proof Size summary in bytes:462 // Proof Size summary in bytes:633 // Measured: `0`463 // Measured: `0`634 // Estimated: `0`464 // Estimated: `0`635 // Minimum execution time: 194_000 picoseconds.465 // Minimum execution time: 440_000 picoseconds.636 Weight::from_parts(222_000, 0)466 Weight::from_parts(3_567_990, 0)637 // Standard Error: 7_295467 // Standard Error: 24_013638 .saturating_add(Weight::from_parts(4_499_463, 0).saturating_mul(b.into()))468 .saturating_add(Weight::from_parts(19_386_123, 0).saturating_mul(b.into()))639 .saturating_add(RocksDbWeight::get().writes(1_u64))469 .saturating_add(RocksDbWeight::get().writes(1_u64))640 }470 }641 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)471 /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)642 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)472 /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)643 /// Storage: Nonfungible TokenData (r:1 w:0)644 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)645 /// Storage: Nonfungible TokenProperties (r:1 w:1)646 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)647 /// The range of component `b` is `[0, 64]`.473 /// The range of component `b` is `[0, 64]`.648 fn delete_token_properties(b: u32, ) -> Weight {474 fn set_token_property_permissions(b: u32, ) -> Weight {649 // Proof Size summary in bytes:475 // Proof Size summary in bytes:650 // Measured: `699 + b * (33291 ±0)`476 // Measured: `314`651 // Estimated: `36269`477 // Estimated: `20191`652 // Minimum execution time: 992_000 picoseconds.478 // Minimum execution time: 1_460_000 picoseconds.653 Weight::from_parts(1_043_000, 36269)479 Weight::from_parts(1_530_000, 20191)654 // Standard Error: 37_370480 // Standard Error: 124_929655 .saturating_add(Weight::from_parts(23_672_870, 0).saturating_mul(b.into()))481 .saturating_add(Weight::from_parts(28_397_581, 0).saturating_mul(b.into()))656 .saturating_add(RocksDbWeight::get().reads(3_u64))482 .saturating_add(RocksDbWeight::get().reads(1_u64))657 .saturating_add(RocksDbWeight::get().writes(1_u64))483 .saturating_add(RocksDbWeight::get().writes(1_u64))658 }484 }659 /// Storage: Nonfungible TokenData (r:1 w:0)660 /// Proof: Nonfungible TokenData (max_values: None, max_size: Some(57), added: 2532, mode: MaxEncodedLen)661 fn token_owner() -> Weight {662 // Proof Size summary in bytes:663 // Measured: `326`664 // Estimated: `3522`665 // Minimum execution time: 3_743_000 picoseconds.666 Weight::from_parts(3_908_000, 3522)667 .saturating_add(RocksDbWeight::get().reads(1_u64))668 }669 /// Storage: Nonfungible CollectionAllowance (r:0 w:1)485 /// Storage: `Nonfungible::CollectionAllowance` (r:0 w:1)670 /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)486 /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)671 fn set_allowance_for_all() -> Weight {487 fn set_allowance_for_all() -> Weight {672 // Proof Size summary in bytes:488 // Proof Size summary in bytes:673 // Measured: `0`489 // Measured: `0`674 // Estimated: `0`490 // Estimated: `0`675 // Minimum execution time: 4_106_000 picoseconds.491 // Minimum execution time: 6_840_000 picoseconds.676 Weight::from_parts(4_293_000, 0)492 Weight::from_parts(7_160_000, 0)677 .saturating_add(RocksDbWeight::get().writes(1_u64))493 .saturating_add(RocksDbWeight::get().writes(1_u64))678 }494 }679 /// Storage: Nonfungible CollectionAllowance (r:1 w:0)495 /// Storage: `Nonfungible::CollectionAllowance` (r:1 w:0)680 /// Proof: Nonfungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)496 /// Proof: `Nonfungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)681 fn allowance_for_all() -> Weight {497 fn allowance_for_all() -> Weight {682 // Proof Size summary in bytes:498 // Proof Size summary in bytes:683 // Measured: `142`499 // Measured: `142`684 // Estimated: `3576`500 // Estimated: `3576`685 // Minimum execution time: 2_775_000 picoseconds.501 // Minimum execution time: 3_630_000 picoseconds.686 Weight::from_parts(2_923_000, 3576)502 Weight::from_parts(3_780_000, 3576)687 .saturating_add(RocksDbWeight::get().reads(1_u64))503 .saturating_add(RocksDbWeight::get().reads(1_u64))688 }504 }689 /// Storage: Nonfungible TokenProperties (r:1 w:1)505 /// Storage: `Nonfungible::TokenProperties` (r:1 w:1)690 /// Proof: Nonfungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)506 /// Proof: `Nonfungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)691 fn repair_item() -> Weight {507 fn repair_item() -> Weight {692 // Proof Size summary in bytes:508 // Proof Size summary in bytes:693 // Measured: `279`509 // Measured: `279`694 // Estimated: `36269`510 // Estimated: `36269`695 // Minimum execution time: 3_033_000 picoseconds.511 // Minimum execution time: 3_280_000 picoseconds.696 Weight::from_parts(3_174_000, 36269)512 Weight::from_parts(3_480_000, 36269)697 .saturating_add(RocksDbWeight::get().reads(1_u64))513 .saturating_add(RocksDbWeight::get().reads(1_u64))698 .saturating_add(RocksDbWeight::get().writes(1_u64))514 .saturating_add(RocksDbWeight::get().writes(1_u64))699 }515 }pallets/refungible/src/benchmarking.rsdiffbeforeafterboth20use pallet_common::{20use pallet_common::{21 bench_init,21 bench_init,22 benchmarking::{22 benchmarking::{create_collection_raw, property_key, property_value},23 create_collection_raw, /*load_is_admin_and_property_permissions,*/ property_key,24 property_value,25 },26};23};27use sp_std::prelude::*;24use sp_std::prelude::*;424 Ok(())421 Ok(())425 }422 }423424 #[benchmark]425 fn load_token_properties() -> Result<(), BenchmarkError> {426 bench_init! {427 owner: sub; collection: collection(owner);428 owner: cross_from_sub;429 };430431 let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;432433 #[block]434 {435 pallet_common::BenchmarkPropertyWriter::<T>::load_token_properties(&collection, item);436 }437438 Ok(())439 }440441 #[benchmark]442 fn write_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {443 bench_init! {444 owner: sub; collection: collection(owner);445 owner: cross_from_sub;446 };447448 let perms = (0..b)449 .map(|k| PropertyKeyPermission {450 key: property_key(k as usize),451 permission: PropertyPermission {452 mutable: false,453 collection_admin: true,454 token_owner: true,455 },456 })457 .collect::<Vec<_>>();458 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;459 let props = (0..b)460 .map(|k| Property {461 key: property_key(k as usize),462 value: property_value(),463 })464 .collect::<Vec<_>>();465 let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;466467 let lazy_collection_info =468 pallet_common::BenchmarkPropertyWriter::<T>::load_collection_info(&collection, &owner);469470 #[block]471 {472 let mut property_writer =473 pallet_common::BenchmarkPropertyWriter::new(&collection, lazy_collection_info);474475 property_writer.write_token_properties(476 item,477 props.into_iter(),478 crate::erc::ERC721TokenEvent::TokenChanged {479 token_id: item.into(),480 }481 .to_log(T::ContractAddress::get()),482 )?;483 }484485 Ok(())486 }426487427 #[benchmark]488 #[benchmark]428 fn set_token_property_permissions(489 fn set_token_property_permissions(451 Ok(())512 Ok(())452 }513 }453454 #[benchmark]455 fn set_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {456 bench_init! {457 owner: sub; collection: collection(owner);458 owner: cross_from_sub;459 };460 let perms = (0..b)461 .map(|k| PropertyKeyPermission {462 key: property_key(k as usize),463 permission: PropertyPermission {464 mutable: false,465 collection_admin: true,466 token_owner: true,467 },468 })469 .collect::<Vec<_>>();470 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;471 let props = (0..b)472 .map(|k| Property {473 key: property_key(k as usize),474 value: property_value(),475 })476 .collect::<Vec<_>>();477 let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;478479 #[block]480 {481 <Pallet<T>>::set_token_properties(482 &collection,483 &owner,484 item,485 props.into_iter(),486 &Unlimited,487 )?;488 }489490 Ok(())491 }492493 // TODO:494 #[benchmark]495 fn init_token_properties(b: Linear<0, MAX_PROPERTIES_PER_ITEM>) -> Result<(), BenchmarkError> {496 // bench_init! {497 // owner: sub; collection: collection(owner);498 // owner: cross_from_sub;499 // };500501 // let perms = (0..b)502 // .map(|k| PropertyKeyPermission {503 // key: property_key(k as usize),504 // permission: PropertyPermission {505 // mutable: false,506 // collection_admin: true,507 // token_owner: true,508 // },509 // })510 // .collect::<Vec<_>>();511 // <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;512513 #[block]514 {}515 // let props = (0..b).map(|k| Property {516 // key: property_key(k as usize),517 // value: property_value(),518 // }).collect::<Vec<_>>();519 // let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;520521 // let (is_collection_admin, property_permissions) = load_is_admin_and_property_permissions(&collection, &owner)522 // let mut property_writer = pallet_common::collection_info_loaded_property_writer(523 // &collection,524 // is_collection_admin,525 // property_permissions,526 // );527528 // #[block]529 // {530 // property_writer.write_token_properties(531 // true,532 // item,533 // props.into_iter(),534 // crate::erc::ERC721TokenEvent::TokenChanged {535 // token_id: item.into(),536 // }537 // .to_log(T::ContractAddress::get()),538 // )?;539 // }540541 Ok(())542 }543544 #[benchmark]545 fn delete_token_properties(546 b: Linear<0, MAX_PROPERTIES_PER_ITEM>,547 ) -> Result<(), BenchmarkError> {548 bench_init! {549 owner: sub; collection: collection(owner);550 owner: cross_from_sub;551 };552 let perms = (0..b)553 .map(|k| PropertyKeyPermission {554 key: property_key(k as usize),555 permission: PropertyPermission {556 mutable: true,557 collection_admin: true,558 token_owner: true,559 },560 })561 .collect::<Vec<_>>();562 <Pallet<T>>::set_token_property_permissions(&collection, &owner, perms)?;563 let props = (0..b)564 .map(|k| Property {565 key: property_key(k as usize),566 value: property_value(),567 })568 .collect::<Vec<_>>();569 let item = create_max_item(&collection, &owner, [(owner.clone(), 200)])?;570 <Pallet<T>>::set_token_properties(571 &collection,572 &owner,573 item,574 props.into_iter(),575 &Unlimited,576 )?;577 let to_delete = (0..b).map(|k| property_key(k as usize)).collect::<Vec<_>>();578579 #[block]580 {581 <Pallet<T>>::delete_token_properties(582 &collection,583 &owner,584 item,585 to_delete.into_iter(),586 &Unlimited,587 )?;588 }589590 Ok(())591 }592514593 #[benchmark]515 #[benchmark]594 fn repartition_item() -> Result<(), BenchmarkError> {516 fn repartition_item() -> Result<(), BenchmarkError> {606 Ok(())528 Ok(())607 }529 }608609 #[benchmark]610 fn token_owner() -> Result<(), BenchmarkError> {611 bench_init! {612 owner: sub; collection: collection(owner);613 sender: cross_from_sub(owner); owner: cross_sub;614 };615 let item = create_max_item(&collection, &sender, [(owner, 100)])?;616617 #[block]618 {619 <Pallet<T>>::token_owner(collection.id, item).unwrap();620 }621622 Ok(())623 }624530625 #[benchmark]531 #[benchmark]626 fn set_allowance_for_all() -> Result<(), BenchmarkError> {532 fn set_allowance_for_all() -> Result<(), BenchmarkError> {pallets/refungible/src/common.rsdiffbeforeafterboth17use core::marker::PhantomData;17use core::marker::PhantomData;181819use frame_support::{19use frame_support::{dispatch::DispatchResultWithPostInfo, fail, weights::Weight};20 dispatch::DispatchResultWithPostInfo, ensure, fail, traits::Get, weights::Weight,21};22use pallet_common::{20use pallet_common::{23 init_token_properties_delta, weights::WeightInfo as _, with_weight, CommonCollectionOperations,21 weights::WeightInfo as _, with_weight, write_token_properties_total_weight,24 CommonWeightInfo, RefungibleExtensions,22 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions,25};23};26use pallet_structure::{Error as StructureError, Pallet as PalletStructure};24use pallet_structure::Pallet as PalletStructure;27use sp_runtime::DispatchError;25use sp_runtime::DispatchError;28use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};26use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};29use up_data_structs::{27use up_data_structs::{49pub struct CommonWeights<T: Config>(PhantomData<T>);47pub struct CommonWeights<T: Config>(PhantomData<T>);50impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {48impl<T: Config> CommonWeightInfo<T::CrossAccountId> for CommonWeights<T> {51 fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {49 fn create_multiple_items(data: &[up_data_structs::CreateItemData]) -> Weight {50 mint_with_props_weight::<T>(52 <SelfWeightOf<T>>::create_multiple_items(data.len() as u32).saturating_add(51 <SelfWeightOf<T>>::create_multiple_items(data.len() as u32),53 init_token_properties_delta::<T, _>(54 data.iter().map(|data| match data {52 data.iter().map(|data| match data {55 up_data_structs::CreateItemData::ReFungible(rft_data) => {53 up_data_structs::CreateItemData::ReFungible(rft_data) => {56 rft_data.properties.len() as u3254 rft_data.properties.len() as u3257 }55 }58 _ => 0,56 _ => 0,59 }),57 }),60 <SelfWeightOf<T>>::init_token_properties,58 )61 ),62 )63 }59 }646065 fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {61 fn create_multiple_items_ex(call: &CreateItemExData<T::CrossAccountId>) -> Weight {66 match call {62 match call {67 CreateItemExData::RefungibleMultipleOwners(i) => {63 CreateItemExData::RefungibleMultipleOwners(i) => mint_with_props_weight::<T>(68 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32)64 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(i.users.len() as u32),69 .saturating_add(init_token_properties_delta::<T, _>(70 [i.properties.len() as u32].into_iter(),65 [i.properties.len() as u32].into_iter(),71 <SelfWeightOf<T>>::init_token_properties,66 ),72 ))73 }74 CreateItemExData::RefungibleMultipleItems(i) => {67 CreateItemExData::RefungibleMultipleItems(i) => mint_with_props_weight::<T>(75 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32)68 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(i.len() as u32),76 .saturating_add(init_token_properties_delta::<T, _>(77 i.iter().map(|d| d.properties.len() as u32),69 i.iter().map(|d| d.properties.len() as u32),78 <SelfWeightOf<T>>::init_token_properties,70 ),79 ))80 }81 _ => Weight::zero(),71 _ => Weight::zero(),82 }72 }83 }73 }90 <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)80 <pallet_common::SelfWeightOf<T>>::set_collection_properties(amount)91 }81 }928293 fn delete_collection_properties(amount: u32) -> Weight {83 fn set_token_properties(amount: u32) -> Weight {94 <pallet_common::SelfWeightOf<T>>::delete_collection_properties(amount)95 }9697 fn set_token_properties(amount: u32) -> Weight {98 <SelfWeightOf<T>>::set_token_properties(amount)99 }100101 fn delete_token_properties(amount: u32) -> Weight {84 write_token_properties_total_weight::<T, _>([amount].into_iter(), |amount| {102 <SelfWeightOf<T>>::delete_token_properties(amount)85 <SelfWeightOf<T>>::load_token_properties()86 .saturating_add(<SelfWeightOf<T>>::write_token_properties(amount))103 }87 })88 }10489105 fn set_token_property_permissions(amount: u32) -> Weight {90 fn set_token_property_permissions(amount: u32) -> Weight {106 <SelfWeightOf<T>>::set_token_property_permissions(amount)91 <SelfWeightOf<T>>::set_token_property_permissions(amount)136 <SelfWeightOf<T>>::burn_from()121 <SelfWeightOf<T>>::burn_from()137 }122 }138139 fn burn_recursively_self_raw() -> Weight {140 // Read to get total balance141 Self::burn_item() + T::DbWeight::get().reads(1)142 }143 fn burn_recursively_breadth_raw(_amount: u32) -> Weight {144 // Refungible token can't have children145 Weight::zero()146 }147148 fn token_owner() -> Weight {149 <SelfWeightOf<T>>::token_owner()150 }151123152 fn set_allowance_for_all() -> Weight {124 fn set_allowance_for_all() -> Weight {153 <SelfWeightOf<T>>::set_allowance_for_all()125 <SelfWeightOf<T>>::set_allowance_for_all()158 }130 }159}131}132133/// Weight of minting tokens with properties134/// * `create_no_data_weight` -- the weight of minting without properties135/// * `token_properties_nums` -- number of properties of each token136#[inline]137pub(crate) fn mint_with_props_weight<T: Config>(138 create_no_data_weight: Weight,139 token_properties_nums: impl Iterator<Item = u32> + Clone,140) -> Weight {141 create_no_data_weight.saturating_add(write_token_properties_total_weight::<T, _>(142 token_properties_nums,143 <SelfWeightOf<T>>::write_token_properties,144 ))145}160146161fn map_create_data<T: Config>(147fn map_create_data<T: Config>(162 data: up_data_structs::CreateItemData,148 data: up_data_structs::CreateItemData,265 )251 )266 }252 }267268 fn burn_item_recursively(269 &self,270 sender: T::CrossAccountId,271 token: TokenId,272 self_budget: &dyn Budget,273 _breadth_budget: &dyn Budget,274 ) -> DispatchResultWithPostInfo {275 ensure!(self_budget.consume(), <StructureError<T>>::DepthLimit,);276 with_weight(277 <Pallet<T>>::burn(278 self,279 &sender,280 token,281 <Balance<T>>::get((self.id, token, &sender)),282 ),283 <CommonWeights<T>>::burn_recursively_self_raw(),284 )285 }286253287 fn transfer(254 fn transfer(288 &self,255 &self,pallets/refungible/src/erc.rsdiffbeforeafterboth32use pallet_common::{32use pallet_common::{33 erc::{static_property::key, CollectionCall, CommonEvmHandler},33 erc::{static_property::key, CollectionCall, CommonEvmHandler},34 eth::{self, TokenUri},34 eth::{self, TokenUri},35 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,35 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations, CommonWeightInfo,36 Error as CommonError,36 Error as CommonError,37};37};38use pallet_evm::{account::CrossAccountId, PrecompileHandle};38use pallet_evm::{account::CrossAccountId, PrecompileHandle};39use pallet_evm_coder_substrate::{39use pallet_evm_coder_substrate::{40 call, dispatch_to_evm,40 call, dispatch_to_evm,41 execution::{Error, PreDispatch, Result},41 execution::{Error, PreDispatch, Result},42 frontier_contract,42 frontier_contract, SubstrateRecorder,43};43};44use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};44use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};45use sp_core::{Get, H160, U256};45use sp_core::{Get, H160, U256};46use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};46use sp_std::{collections::btree_map::BTreeMap, vec, vec::Vec};47use up_data_structs::{47use up_data_structs::{48 mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property, PropertyKey,48 budget::Budget, mapping::TokenAddressMapping, CollectionId, CollectionPropertiesVec, Property,49 PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,49 PropertyKey, PropertyKeyPermission, PropertyPermission, TokenId, TokenOwnerError,50};50};515152use crate::{52use crate::{53 common::{mint_with_props_weight, CommonWeights},53 weights::WeightInfo, AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle,54 weights::WeightInfo,54 SelfWeightOf, TokenProperties, TokensMinted, TotalSupply,55 AccountBalance, Balance, Config, CreateItemData, Pallet, RefungibleHandle, SelfWeightOf,56 TokenProperties, TokensMinted, TotalSupply,90 pub properties: Vec<eth::Property>,92 pub properties: Vec<eth::Property>,91}93}9495pub fn nesting_budget<T: Config>(recorder: &SubstrateRecorder<T>) -> impl Budget + '_ {96 recorder.weight_calls_budget(<StructureWeight<T>>::find_parent())97}929893/// @title A contract that allows to set and delete token properties and change token property permissions.99/// @title A contract that allows to set and delete token properties and change token property permissions.94#[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]100#[solidity_interface(name = TokenProperties, events(ERC721TokenEvent), enum(derive(PreDispatch)), enum_attr(weight))]158 /// @param key Property key.164 /// @param key Property key.159 /// @param value Property value.165 /// @param value Property value.160 #[solidity(hide)]166 #[solidity(hide)]161 #[weight(<SelfWeightOf<T>>::set_token_properties(1))]167 #[weight(<CommonWeights<T>>::set_token_properties(1))]162 fn set_property(168 fn set_property(163 &mut self,169 &mut self,164 caller: Caller,170 caller: Caller,173 .map_err(|_| "key too long")?;179 .map_err(|_| "key too long")?;174 let value = value.0.try_into().map_err(|_| "value too long")?;180 let value = value.0.try_into().map_err(|_| "value too long")?;175176 let nesting_budget = self177 .recorder178 .weight_calls_budget(<StructureWeight<T>>::find_parent());179181180 <Pallet<T>>::set_token_property(182 <Pallet<T>>::set_token_property(181 self,183 self,182 &caller,184 &caller,183 TokenId(token_id),185 TokenId(token_id),184 Property { key, value },186 Property { key, value },185 &nesting_budget,187 &nesting_budget(&self.recorder),186 )188 )187 .map_err(dispatch_to_evm::<T>)189 .map_err(dispatch_to_evm::<T>)188 }190 }191 /// @dev Throws error if `msg.sender` has no permission to edit the property.193 /// @dev Throws error if `msg.sender` has no permission to edit the property.192 /// @param tokenId ID of the token.194 /// @param tokenId ID of the token.193 /// @param properties settable properties195 /// @param properties settable properties194 #[weight(<SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]196 #[weight(<CommonWeights<T>>::set_token_properties(properties.len() as u32))]195 fn set_properties(197 fn set_properties(196 &mut self,198 &mut self,197 caller: Caller,199 caller: Caller,201 let caller = T::CrossAccountId::from_eth(caller);203 let caller = T::CrossAccountId::from_eth(caller);202 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;204 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;203204 let nesting_budget = self205 .recorder206 .weight_calls_budget(<StructureWeight<T>>::find_parent());207205208 let properties = properties206 let properties = properties209 .into_iter()207 .into_iter()215 &caller,213 &caller,216 TokenId(token_id),214 TokenId(token_id),217 properties.into_iter(),215 properties.into_iter(),218 &nesting_budget,216 &nesting_budget(&self.recorder),219 )217 )220 .map_err(dispatch_to_evm::<T>)218 .map_err(dispatch_to_evm::<T>)221 }219 }225 /// @param tokenId ID of the token.223 /// @param tokenId ID of the token.226 /// @param key Property key.224 /// @param key Property key.227 #[solidity(hide)]225 #[solidity(hide)]228 #[weight(<SelfWeightOf<T>>::delete_token_properties(1))]226 #[weight(<CommonWeights<T>>::delete_token_properties(1))]229 fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {227 fn delete_property(&mut self, token_id: U256, caller: Caller, key: String) -> Result<()> {230 let caller = T::CrossAccountId::from_eth(caller);228 let caller = T::CrossAccountId::from_eth(caller);231 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;229 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;232 let key = <Vec<u8>>::from(key)230 let key = <Vec<u8>>::from(key)233 .try_into()231 .try_into()234 .map_err(|_| "key too long")?;232 .map_err(|_| "key too long")?;235236 let nesting_budget = self237 .recorder238 .weight_calls_budget(<StructureWeight<T>>::find_parent());239233240 <Pallet<T>>::delete_token_property(self, &caller, TokenId(token_id), key, &nesting_budget)234 <Pallet<T>>::delete_token_property(235 self,236 &caller,237 TokenId(token_id),238 key,239 &nesting_budget(&self.recorder),240 )241 .map_err(dispatch_to_evm::<T>)241 .map_err(dispatch_to_evm::<T>)242 }242 }243243244 /// @notice Delete token properties value.244 /// @notice Delete token properties value.245 /// @dev Throws error if `msg.sender` has no permission to edit the property.245 /// @dev Throws error if `msg.sender` has no permission to edit the property.246 /// @param tokenId ID of the token.246 /// @param tokenId ID of the token.247 /// @param keys Properties key.247 /// @param keys Properties key.248 #[weight(<SelfWeightOf<T>>::delete_token_properties(keys.len() as u32))]248 #[weight(<CommonWeights<T>>::delete_token_properties(keys.len() as u32))]249 fn delete_properties(249 fn delete_properties(250 &mut self,250 &mut self,251 token_id: U256,251 token_id: U256,259 .map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))259 .map(|k| Ok(<Vec<u8>>::from(k).try_into().map_err(|_| "key too long")?))260 .collect::<Result<Vec<_>>>()?;260 .collect::<Result<Vec<_>>>()?;261262 let nesting_budget = self263 .recorder264 .weight_calls_budget(<StructureWeight<T>>::find_parent());265261266 <Pallet<T>>::delete_token_properties(262 <Pallet<T>>::delete_token_properties(267 self,263 self,268 &caller,264 &caller,269 TokenId(token_id),265 TokenId(token_id),270 keys.into_iter(),266 keys.into_iter(),271 &nesting_budget,267 &nesting_budget(&self.recorder),272 )268 )273 .map_err(dispatch_to_evm::<T>)269 .map_err(dispatch_to_evm::<T>)274 }270 }497 let from = T::CrossAccountId::from_eth(from);493 let from = T::CrossAccountId::from_eth(from);498 let to = T::CrossAccountId::from_eth(to);494 let to = T::CrossAccountId::from_eth(to);499 let token = token_id.try_into()?;495 let token = token_id.try_into()?;500 let budget = self501 .recorder502 .weight_calls_budget(<StructureWeight<T>>::find_parent());503496504 let balance = balance(self, token, &from)?;497 let balance = balance(self, token, &from)?;505 ensure_single_owner(self, token, balance)?;498 ensure_single_owner(self, token, balance)?;506499507 <Pallet<T>>::transfer_from(self, &caller, &from, &to, token, balance, &budget)500 <Pallet<T>>::transfer_from(501 self,502 &caller,503 &from,504 &to,505 token,506 balance,507 &nesting_budget(&self.recorder),508 )508 .map_err(dispatch_to_evm::<T>)?;509 .map_err(dispatch_to_evm::<T>)?;509510629 let caller = T::CrossAccountId::from_eth(caller);630 let caller = T::CrossAccountId::from_eth(caller);630 let to = T::CrossAccountId::from_eth(to);631 let to = T::CrossAccountId::from_eth(to);631 let token_id: u32 = token_id.try_into()?;632 let token_id: u32 = token_id.try_into()?;632 let budget = self633 .recorder634 .weight_calls_budget(<StructureWeight<T>>::find_parent());635633636 if <TokensMinted<T>>::get(self.id)634 if <TokensMinted<T>>::get(self.id)637 .checked_add(1)635 .checked_add(1)653 users,651 users,654 properties: CollectionPropertiesVec::default(),652 properties: CollectionPropertiesVec::default(),655 },653 },656 &budget,654 &nesting_budget(&self.recorder),657 )655 )658 .map_err(dispatch_to_evm::<T>)?;656 .map_err(dispatch_to_evm::<T>)?;659657665 /// @param tokenUri Token URI that would be stored in the NFT properties663 /// @param tokenUri Token URI that would be stored in the NFT properties666 /// @return uint256 The id of the newly minted token664 /// @return uint256 The id of the newly minted token667 #[solidity(rename_selector = "mintWithTokenURI")]665 #[solidity(rename_selector = "mintWithTokenURI")]668 #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]666 #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]669 fn mint_with_token_uri(667 fn mint_with_token_uri(670 &mut self,668 &mut self,671 caller: Caller,669 caller: Caller,687 /// @param tokenId ID of the minted RFT685 /// @param tokenId ID of the minted RFT688 /// @param tokenUri Token URI that would be stored in the RFT properties686 /// @param tokenUri Token URI that would be stored in the RFT properties689 #[solidity(hide, rename_selector = "mintWithTokenURI")]687 #[solidity(hide, rename_selector = "mintWithTokenURI")]690 #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(1))]688 #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [1].into_iter()))]691 fn mint_with_token_uri_check_id(689 fn mint_with_token_uri_check_id(692 &mut self,690 &mut self,693 caller: Caller,691 caller: Caller,704 let caller = T::CrossAccountId::from_eth(caller);702 let caller = T::CrossAccountId::from_eth(caller);705 let to = T::CrossAccountId::from_eth(to);703 let to = T::CrossAccountId::from_eth(to);706 let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;704 let token_id: u32 = token_id.try_into().map_err(|_| "amount overflow")?;707 let budget = self708 .recorder709 .weight_calls_budget(<StructureWeight<T>>::find_parent());710705711 if <TokensMinted<T>>::get(self.id)706 if <TokensMinted<T>>::get(self.id)712 .checked_add(1)707 .checked_add(1)736 self,731 self,737 &caller,732 &caller,738 CreateItemData::<T> { users, properties },733 CreateItemData::<T> { users, properties },739 &budget,734 &nesting_budget(&self.recorder),740 )735 )741 .map_err(dispatch_to_evm::<T>)?;736 .map_err(dispatch_to_evm::<T>)?;742 Ok(true)737 Ok(true)865 let caller = T::CrossAccountId::from_eth(caller);860 let caller = T::CrossAccountId::from_eth(caller);866 let to = T::CrossAccountId::from_eth(to);861 let to = T::CrossAccountId::from_eth(to);867 let token = token_id.try_into()?;862 let token = token_id.try_into()?;868 let budget = self869 .recorder870 .weight_calls_budget(<StructureWeight<T>>::find_parent());871863872 let balance = balance(self, token, &caller)?;864 let balance = balance(self, token, &caller)?;873 ensure_single_owner(self, token, balance)?;865 ensure_single_owner(self, token, balance)?;874866875 <Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)867 <Pallet<T>>::transfer(868 self,869 &caller,870 &to,871 token,872 balance,873 &nesting_budget(&self.recorder),874 )876 .map_err(dispatch_to_evm::<T>)?;875 .map_err(dispatch_to_evm::<T>)?;877 Ok(())876 Ok(())893 let caller = T::CrossAccountId::from_eth(caller);892 let caller = T::CrossAccountId::from_eth(caller);894 let to = to.into_sub_cross_account::<T>()?;893 let to = to.into_sub_cross_account::<T>()?;895 let token = token_id.try_into()?;894 let token = token_id.try_into()?;896 let budget = self897 .recorder898 .weight_calls_budget(<StructureWeight<T>>::find_parent());899895900 let balance = balance(self, token, &caller)?;896 let balance = balance(self, token, &caller)?;901 ensure_single_owner(self, token, balance)?;897 ensure_single_owner(self, token, balance)?;902898903 <Pallet<T>>::transfer(self, &caller, &to, token, balance, &budget)899 <Pallet<T>>::transfer(900 self,901 &caller,902 &to,903 token,904 balance,905 &nesting_budget(&self.recorder),906 )904 .map_err(dispatch_to_evm::<T>)?;907 .map_err(dispatch_to_evm::<T>)?;905 Ok(())908 Ok(())923 let from = from.into_sub_cross_account::<T>()?;926 let from = from.into_sub_cross_account::<T>()?;924 let to = to.into_sub_cross_account::<T>()?;927 let to = to.into_sub_cross_account::<T>()?;925 let token_id = token_id.try_into()?;928 let token_id = token_id.try_into()?;926 let budget = self927 .recorder928 .weight_calls_budget(<StructureWeight<T>>::find_parent());929929930 let balance = balance(self, token_id, &from)?;930 let balance = balance(self, token_id, &from)?;931 ensure_single_owner(self, token_id, balance)?;931 ensure_single_owner(self, token_id, balance)?;932932933 Pallet::<T>::transfer_from(self, &caller, &from, &to, token_id, balance, &budget)933 Pallet::<T>::transfer_from(934 self,935 &caller,936 &from,937 &to,938 token_id,939 balance,940 &nesting_budget(&self.recorder),941 )934 .map_err(dispatch_to_evm::<T>)?;942 .map_err(dispatch_to_evm::<T>)?;935 Ok(())943 Ok(())948 let caller = T::CrossAccountId::from_eth(caller);956 let caller = T::CrossAccountId::from_eth(caller);949 let from = T::CrossAccountId::from_eth(from);957 let from = T::CrossAccountId::from_eth(from);950 let token = token_id.try_into()?;958 let token = token_id.try_into()?;951 let budget = self952 .recorder953 .weight_calls_budget(<StructureWeight<T>>::find_parent());954959955 let balance = balance(self, token, &from)?;960 let balance = balance(self, token, &from)?;956 ensure_single_owner(self, token, balance)?;961 ensure_single_owner(self, token, balance)?;957962958 <Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)963 <Pallet<T>>::burn_from(964 self,965 &caller,966 &from,967 token,968 balance,969 &nesting_budget(&self.recorder),970 )959 .map_err(dispatch_to_evm::<T>)?;971 .map_err(dispatch_to_evm::<T>)?;960 Ok(())972 Ok(())977 let caller = T::CrossAccountId::from_eth(caller);989 let caller = T::CrossAccountId::from_eth(caller);978 let from = from.into_sub_cross_account::<T>()?;990 let from = from.into_sub_cross_account::<T>()?;979 let token = token_id.try_into()?;991 let token = token_id.try_into()?;980 let budget = self981 .recorder982 .weight_calls_budget(<StructureWeight<T>>::find_parent());983992984 let balance = balance(self, token, &from)?;993 let balance = balance(self, token, &from)?;985 ensure_single_owner(self, token, balance)?;994 ensure_single_owner(self, token, balance)?;986995987 <Pallet<T>>::burn_from(self, &caller, &from, token, balance, &budget)996 <Pallet<T>>::burn_from(997 self,998 &caller,999 &from,1000 token,1001 balance,1002 &nesting_budget(&self.recorder),1003 )988 .map_err(dispatch_to_evm::<T>)?;1004 .map_err(dispatch_to_evm::<T>)?;989 Ok(())1005 Ok(())1010 let mut expected_index = <TokensMinted<T>>::get(self.id)1026 let mut expected_index = <TokensMinted<T>>::get(self.id)1011 .checked_add(1)1027 .checked_add(1)1012 .ok_or("item id overflow")?;1028 .ok_or("item id overflow")?;1013 let budget = self1014 .recorder1015 .weight_calls_budget(<StructureWeight<T>>::find_parent());101610291017 let total_tokens = token_ids.len();1030 let total_tokens = token_ids.len();1018 for id in token_ids.into_iter() {1031 for id in token_ids.into_iter() {1035 .map(|_| create_item_data.clone())1048 .map(|_| create_item_data.clone())1036 .collect();1049 .collect();103710501038 <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)1051 <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))1039 .map_err(dispatch_to_evm::<T>)?;1052 .map_err(dispatch_to_evm::<T>)?;1040 Ok(true)1053 Ok(true)1041 }1054 }104210551043 /// @notice Function to mint a token.1056 /// @notice Function to mint a token.1044 /// @param tokenProperties Properties of minted token1057 /// @param tokensData Data of minted token(s)1045 #[weight(if token_properties.len() == 1 {1058 #[weight(if tokens_data.len() == 1 {1059 let token_data = tokens_data.first().unwrap();10601046 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_properties.iter().next().unwrap().owners.len() as u32)1061 mint_with_props_weight::<T>(1062 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_owners(token_data.owners.len() as u32),1063 [token_data.properties.len() as u32].into_iter(),1064 )1047 } else {1065 } else {1048 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(token_properties.len() as u32)1066 mint_with_props_weight::<T>(1067 <SelfWeightOf<T>>::create_multiple_items_ex_multiple_items(tokens_data.len() as u32),1049 } + <SelfWeightOf<T>>::set_token_properties(token_properties.len() as u32))]1068 tokens_data.iter().map(|d| d.properties.len() as u32),1069 )1070 })]1050 fn mint_bulk_cross(1071 fn mint_bulk_cross(&mut self, caller: Caller, tokens_data: Vec<MintTokenData>) -> Result<bool> {1051 &mut self,1052 caller: Caller,1053 token_properties: Vec<MintTokenData>,1054 ) -> Result<bool> {1055 let caller = T::CrossAccountId::from_eth(caller);1072 let caller = T::CrossAccountId::from_eth(caller);1056 let budget = self1057 .recorder1058 .weight_calls_budget(<StructureWeight<T>>::find_parent());1059 let has_multiple_tokens = token_properties.len() > 1;1073 let has_multiple_tokens = tokens_data.len() > 1;106010741061 let mut create_rft_data = Vec::with_capacity(token_properties.len());1075 let mut create_rft_data = Vec::with_capacity(tokens_data.len());1062 for MintTokenData { owners, properties } in token_properties {1076 for MintTokenData { owners, properties } in tokens_data {1063 let has_multiple_owners = owners.len() > 1;1077 let has_multiple_owners = owners.len() > 1;1064 if has_multiple_tokens & has_multiple_owners {1078 if has_multiple_tokens & has_multiple_owners {1065 return Err(1079 return Err(1084 });1098 });1085 }1099 }108611001087 <Pallet<T>>::create_multiple_items(self, &caller, create_rft_data, &budget)1101 <Pallet<T>>::create_multiple_items(1102 self,1103 &caller,1104 create_rft_data,1105 &nesting_budget(&self.recorder),1106 )1088 .map_err(dispatch_to_evm::<T>)?;1107 .map_err(dispatch_to_evm::<T>)?;1089 Ok(true)1108 Ok(true)1095 /// @param to The new owner1114 /// @param to The new owner1096 /// @param tokens array of pairs of token ID and token URI for minted tokens1115 /// @param tokens array of pairs of token ID and token URI for minted tokens1097 #[solidity(hide, rename_selector = "mintBulkWithTokenURI")]1116 #[solidity(hide, rename_selector = "mintBulkWithTokenURI")]1098 #[weight(<SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32) + <SelfWeightOf<T>>::set_token_properties(tokens.len() as u32))]1117 #[weight(1118 mint_with_props_weight::<T>(1119 <SelfWeightOf<T>>::create_multiple_items(tokens.len() as u32),1120 tokens.iter().map(|_| 1),1121 )1122 )]1099 fn mint_bulk_with_token_uri(1123 fn mint_bulk_with_token_uri(1100 &mut self,1124 &mut self,1108 let mut expected_index = <TokensMinted<T>>::get(self.id)1132 let mut expected_index = <TokensMinted<T>>::get(self.id)1109 .checked_add(1)1133 .checked_add(1)1110 .ok_or("item id overflow")?;1134 .ok_or("item id overflow")?;1111 let budget = self1112 .recorder1113 .weight_calls_budget(<StructureWeight<T>>::find_parent());111411351115 let mut data = Vec::with_capacity(tokens.len());1136 let mut data = Vec::with_capacity(tokens.len());1116 let users: BoundedBTreeMap<_, _, _> = [(to, 1)]1137 let users: BoundedBTreeMap<_, _, _> = [(to, 1)]1143 data.push(create_item_data);1164 data.push(create_item_data);1144 }1165 }114511661146 <Pallet<T>>::create_multiple_items(self, &caller, data, &budget)1167 <Pallet<T>>::create_multiple_items(self, &caller, data, &nesting_budget(&self.recorder))1147 .map_err(dispatch_to_evm::<T>)?;1168 .map_err(dispatch_to_evm::<T>)?;1148 Ok(true)1169 Ok(true)1149 }1170 }1152 /// @param to The new owner crossAccountId1173 /// @param to The new owner crossAccountId1153 /// @param properties Properties of minted token1174 /// @param properties Properties of minted token1154 /// @return uint256 The id of the newly minted token1175 /// @return uint256 The id of the newly minted token1155 #[weight(<SelfWeightOf<T>>::create_item() + <SelfWeightOf<T>>::set_token_properties(properties.len() as u32))]1176 #[weight(mint_with_props_weight::<T>(<SelfWeightOf<T>>::create_item(), [properties.len() as u32].into_iter()))]1156 fn mint_cross(1177 fn mint_cross(1157 &mut self,1178 &mut self,1158 caller: Caller,1179 caller: Caller,117411951175 let caller = T::CrossAccountId::from_eth(caller);1196 let caller = T::CrossAccountId::from_eth(caller);11761177 let budget = self1178 .recorder1179 .weight_calls_budget(<StructureWeight<T>>::find_parent());118011971181 let users = [(to, 1)]1198 let users = [(to, 1)]1182 .into_iter()1199 .into_iter()1187 self,1204 self,1188 &caller,1205 &caller,1189 CreateItemData::<T> { users, properties },1206 CreateItemData::<T> { users, properties },1190 &budget,1207 &nesting_budget(&self.recorder),1191 )1208 )1192 .map_err(dispatch_to_evm::<T>)?;1209 .map_err(dispatch_to_evm::<T>)?;11931210pallets/refungible/src/erc_token.rsdiffbeforeafterboth37 execution::{PreDispatch, Result},37 execution::{PreDispatch, Result},38 frontier_contract, WithRecorder,38 frontier_contract, WithRecorder,39};39};40use pallet_structure::{weights::WeightInfo as _, SelfWeightOf as StructureWeight};41use sp_core::U256;40use sp_core::U256;42use sp_std::vec::Vec;41use sp_std::vec::Vec;43use up_data_structs::TokenId;42use up_data_structs::TokenId;444345use crate::{44use crate::{46 common::CommonWeights, weights::WeightInfo, Allowance, Balance, Config, Pallet,45 common::CommonWeights, erc::nesting_budget, weights::WeightInfo, Allowance, Balance, Config,47 RefungibleHandle, SelfWeightOf, TotalSupply,46 Pallet, RefungibleHandle, SelfWeightOf, TotalSupply,48};47};4948140 let caller = T::CrossAccountId::from_eth(caller);139 let caller = T::CrossAccountId::from_eth(caller);141 let to = T::CrossAccountId::from_eth(to);140 let to = T::CrossAccountId::from_eth(to);142 let amount = amount.try_into().map_err(|_| "amount overflow")?;141 let amount = amount.try_into().map_err(|_| "amount overflow")?;143 let budget = self144 .recorder145 .weight_calls_budget(<StructureWeight<T>>::find_parent());146142147 <Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)143 <Pallet<T>>::transfer(144 self,145 &caller,146 &to,147 self.1,148 amount,149 &nesting_budget(&self.recorder),150 )148 .map_err(dispatch_to_evm::<T>)?;151 .map_err(dispatch_to_evm::<T>)?;149 Ok(true)152 Ok(true)165 let from = T::CrossAccountId::from_eth(from);168 let from = T::CrossAccountId::from_eth(from);166 let to = T::CrossAccountId::from_eth(to);169 let to = T::CrossAccountId::from_eth(to);167 let amount = amount.try_into().map_err(|_| "amount overflow")?;170 let amount = amount.try_into().map_err(|_| "amount overflow")?;168 let budget = self169 .recorder170 .weight_calls_budget(<StructureWeight<T>>::find_parent());171171172 <Pallet<T>>::transfer_from(self, &caller, &from, &to, self.1, amount, &budget)172 <Pallet<T>>::transfer_from(173 self,174 &caller,175 &from,176 &to,177 self.1,178 amount,179 &nesting_budget(&self.recorder),180 )173 .map_err(dispatch_to_evm::<T>)?;181 .map_err(dispatch_to_evm::<T>)?;174 Ok(true)182 Ok(true)231 let caller = T::CrossAccountId::from_eth(caller);239 let caller = T::CrossAccountId::from_eth(caller);232 let from = T::CrossAccountId::from_eth(from);240 let from = T::CrossAccountId::from_eth(from);233 let amount = amount.try_into().map_err(|_| "amount overflow")?;241 let amount = amount.try_into().map_err(|_| "amount overflow")?;234 let budget = self235 .recorder236 .weight_calls_budget(<StructureWeight<T>>::find_parent());237242238 <Pallet<T>>::burn_from(self, &caller, &from, self.1, amount, &budget)243 <Pallet<T>>::burn_from(244 self,245 &caller,246 &from,247 self.1,248 amount,249 &nesting_budget(&self.recorder),250 )239 .map_err(dispatch_to_evm::<T>)?;251 .map_err(dispatch_to_evm::<T>)?;240 Ok(true)252 Ok(true)254 let caller = T::CrossAccountId::from_eth(caller);266 let caller = T::CrossAccountId::from_eth(caller);255 let from = from.into_sub_cross_account::<T>()?;267 let from = from.into_sub_cross_account::<T>()?;256 let amount = amount.try_into().map_err(|_| "amount overflow")?;268 let amount = amount.try_into().map_err(|_| "amount overflow")?;257 let budget = self258 .recorder259 .weight_calls_budget(<StructureWeight<T>>::find_parent());260269261 <Pallet<T>>::burn_from(self, &caller, &from, self.1, amount, &budget)270 <Pallet<T>>::burn_from(271 self,272 &caller,273 &from,274 self.1,275 amount,276 &nesting_budget(&self.recorder),277 )262 .map_err(dispatch_to_evm::<T>)?;278 .map_err(dispatch_to_evm::<T>)?;263 Ok(true)279 Ok(true)315 let caller = T::CrossAccountId::from_eth(caller);331 let caller = T::CrossAccountId::from_eth(caller);316 let to = to.into_sub_cross_account::<T>()?;332 let to = to.into_sub_cross_account::<T>()?;317 let amount = amount.try_into().map_err(|_| "amount overflow")?;333 let amount = amount.try_into().map_err(|_| "amount overflow")?;318 let budget = self319 .recorder320 .weight_calls_budget(<StructureWeight<T>>::find_parent());321334322 <Pallet<T>>::transfer(self, &caller, &to, self.1, amount, &budget)335 <Pallet<T>>::transfer(336 self,337 &caller,338 &to,339 self.1,340 amount,341 &nesting_budget(&self.recorder),342 )323 .map_err(dispatch_to_evm::<T>)?;343 .map_err(dispatch_to_evm::<T>)?;324 Ok(true)344 Ok(true)340 let from = from.into_sub_cross_account::<T>()?;360 let from = from.into_sub_cross_account::<T>()?;341 let to = to.into_sub_cross_account::<T>()?;361 let to = to.into_sub_cross_account::<T>()?;342 let amount = amount.try_into().map_err(|_| "amount overflow")?;362 let amount = amount.try_into().map_err(|_| "amount overflow")?;343 let budget = self344 .recorder345 .weight_calls_budget(<StructureWeight<T>>::find_parent());346363347 <Pallet<T>>::transfer_from(self, &caller, &from, &to, self.1, amount, &budget)364 <Pallet<T>>::transfer_from(365 self,366 &caller,367 &from,368 &to,369 self.1,370 amount,371 &nesting_budget(&self.recorder),372 )348 .map_err(dispatch_to_evm::<T>)?;373 .map_err(dispatch_to_evm::<T>)?;349 Ok(true)374 Ok(true)pallets/refungible/src/lib.rsdiffbeforeafterboth507 nesting_budget: &dyn Budget,507 nesting_budget: &dyn Budget,508 ) -> DispatchResult {508 ) -> DispatchResult {509 let mut property_writer =509 let mut property_writer =510 pallet_common::property_writer_for_existing_token(collection, sender);510 pallet_common::ExistingTokenPropertyWriter::new(collection, sender);511511512 property_writer.write_token_properties(512 property_writer.write_token_properties(513 sender,513 sender,858858859 // =========859 // =========860860861 let mut property_writer = pallet_common::property_writer_for_new_token(collection, sender);861 let mut property_writer = pallet_common::NewTokenPropertyWriter::new(collection, sender);862862863 with_transaction(|| {863 with_transaction(|| {864 for (i, data) in data.iter().enumerate() {864 for (i, data) in data.iter().enumerate() {pallets/refungible/src/weights.rsdiffbeforeafterboth3//! Autogenerated weights for pallet_refungible3//! Autogenerated weights for pallet_refungible4//!4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2023-09-30, STEPS: `50`, REPEAT: `400`, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2023-10-13, STEPS: `50`, REPEAT: `80`, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! WORST CASE MAP SIZE: `1000000`7//! WORST CASE MAP SIZE: `1000000`8//! HOSTNAME: `bench-host`, CPU: `Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz`8//! HOSTNAME: `hearthstone`, CPU: `AMD Ryzen 9 7950X3D 16-Core Processor`9//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10249//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024101011// Executed Command:11// Executed Command:12// target/production/unique-collator12// ./target/production/unique-collator13// benchmark13// benchmark14// pallet14// pallet15// --pallet15// --pallet20// *20// *21// --template=.maintain/frame-weight-template.hbs21// --template=.maintain/frame-weight-template.hbs22// --steps=5022// --steps=5023// --repeat=40023// --repeat=8024// --heap-pages=409624// --heap-pages=409625// --output=./pallets/refungible/src/weights.rs25// --output=./pallets/refungible/src/weights.rs262650 fn transfer_from_removing() -> Weight;50 fn transfer_from_removing() -> Weight;51 fn transfer_from_creating_removing() -> Weight;51 fn transfer_from_creating_removing() -> Weight;52 fn burn_from() -> Weight;52 fn burn_from() -> Weight;53 fn load_token_properties() -> Weight;54 fn write_token_properties(b: u32, ) -> Weight;53 fn set_token_property_permissions(b: u32, ) -> Weight;55 fn set_token_property_permissions(b: u32, ) -> Weight;54 fn set_token_properties(b: u32, ) -> Weight;55 fn init_token_properties(b: u32, ) -> Weight;56 fn delete_token_properties(b: u32, ) -> Weight;57 fn repartition_item() -> Weight;56 fn repartition_item() -> Weight;58 fn token_owner() -> Weight;59 fn set_allowance_for_all() -> Weight;57 fn set_allowance_for_all() -> Weight;60 fn allowance_for_all() -> Weight;58 fn allowance_for_all() -> Weight;61 fn repair_item() -> Weight;59 fn repair_item() -> Weight;64/// Weights for pallet_refungible using the Substrate node and recommended hardware.62/// Weights for pallet_refungible using the Substrate node and recommended hardware.65pub struct SubstrateWeight<T>(PhantomData<T>);63pub struct SubstrateWeight<T>(PhantomData<T>);66impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {64impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {67 /// Storage: Refungible TokensMinted (r:1 w:1)65 /// Storage: `Refungible::TokensMinted` (r:1 w:1)68 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)66 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)69 /// Storage: Refungible AccountBalance (r:1 w:1)67 /// Storage: `Refungible::AccountBalance` (r:1 w:1)70 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)68 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)71 /// Storage: Refungible Balance (r:0 w:1)69 /// Storage: `Refungible::Balance` (r:0 w:1)72 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)70 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)73 /// Storage: Refungible TotalSupply (r:0 w:1)71 /// Storage: `Refungible::TotalSupply` (r:0 w:1)74 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)72 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)75 /// Storage: Refungible Owned (r:0 w:1)73 /// Storage: `Refungible::Owned` (r:0 w:1)76 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)74 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)77 fn create_item() -> Weight {75 fn create_item() -> Weight {78 // Proof Size summary in bytes:76 // Proof Size summary in bytes:79 // Measured: `4`77 // Measured: `4`80 // Estimated: `3530`78 // Estimated: `3530`81 // Minimum execution time: 11_341_000 picoseconds.79 // Minimum execution time: 19_400_000 picoseconds.82 Weight::from_parts(11_741_000, 3530)80 Weight::from_parts(19_890_000, 3530)83 .saturating_add(T::DbWeight::get().reads(2_u64))81 .saturating_add(T::DbWeight::get().reads(2_u64))84 .saturating_add(T::DbWeight::get().writes(5_u64))82 .saturating_add(T::DbWeight::get().writes(5_u64))85 }83 }86 /// Storage: Refungible TokensMinted (r:1 w:1)84 /// Storage: `Refungible::TokensMinted` (r:1 w:1)87 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)85 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)88 /// Storage: Refungible AccountBalance (r:1 w:1)86 /// Storage: `Refungible::AccountBalance` (r:1 w:1)89 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)87 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)90 /// Storage: Refungible Balance (r:0 w:200)88 /// Storage: `Refungible::Balance` (r:0 w:200)91 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)89 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)92 /// Storage: Refungible TotalSupply (r:0 w:200)90 /// Storage: `Refungible::TotalSupply` (r:0 w:200)93 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)91 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)94 /// Storage: Refungible Owned (r:0 w:200)92 /// Storage: `Refungible::Owned` (r:0 w:200)95 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)93 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)96 /// The range of component `b` is `[0, 200]`.94 /// The range of component `b` is `[0, 200]`.97 fn create_multiple_items(b: u32, ) -> Weight {95 fn create_multiple_items(b: u32, ) -> Weight {98 // Proof Size summary in bytes:96 // Proof Size summary in bytes:99 // Measured: `4`97 // Measured: `4`100 // Estimated: `3530`98 // Estimated: `3530`101 // Minimum execution time: 2_665_000 picoseconds.99 // Minimum execution time: 3_120_000 picoseconds.102 Weight::from_parts(2_791_000, 3530)100 Weight::from_parts(3_310_000, 3530)103 // Standard Error: 996101 // Standard Error: 2_748104 .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))102 .saturating_add(Weight::from_parts(11_489_631, 0).saturating_mul(b.into()))105 .saturating_add(T::DbWeight::get().reads(2_u64))103 .saturating_add(T::DbWeight::get().reads(2_u64))106 .saturating_add(T::DbWeight::get().writes(2_u64))104 .saturating_add(T::DbWeight::get().writes(2_u64))107 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))105 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))108 }106 }109 /// Storage: Refungible TokensMinted (r:1 w:1)107 /// Storage: `Refungible::TokensMinted` (r:1 w:1)110 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)108 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)111 /// Storage: Refungible AccountBalance (r:200 w:200)109 /// Storage: `Refungible::AccountBalance` (r:200 w:200)112 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)110 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)113 /// Storage: Refungible Balance (r:0 w:200)111 /// Storage: `Refungible::Balance` (r:0 w:200)114 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)112 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)115 /// Storage: Refungible TotalSupply (r:0 w:200)113 /// Storage: `Refungible::TotalSupply` (r:0 w:200)116 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)114 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)117 /// Storage: Refungible Owned (r:0 w:200)115 /// Storage: `Refungible::Owned` (r:0 w:200)118 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)116 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)119 /// The range of component `b` is `[0, 200]`.117 /// The range of component `b` is `[0, 200]`.120 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {118 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {121 // Proof Size summary in bytes:119 // Proof Size summary in bytes:122 // Measured: `4`120 // Measured: `4`123 // Estimated: `3481 + b * (2540 ±0)`121 // Estimated: `3481 + b * (2540 ±0)`124 // Minimum execution time: 2_616_000 picoseconds.122 // Minimum execution time: 3_180_000 picoseconds.125 Weight::from_parts(2_726_000, 3481)123 Weight::from_parts(2_015_490, 3481)126 // Standard Error: 665124 // Standard Error: 6_052127 .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))125 .saturating_add(Weight::from_parts(14_837_077, 0).saturating_mul(b.into()))128 .saturating_add(T::DbWeight::get().reads(1_u64))126 .saturating_add(T::DbWeight::get().reads(1_u64))129 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))127 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))130 .saturating_add(T::DbWeight::get().writes(1_u64))128 .saturating_add(T::DbWeight::get().writes(1_u64))131 .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))129 .saturating_add(T::DbWeight::get().writes((4_u64).saturating_mul(b.into())))132 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))130 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))133 }131 }134 /// Storage: Refungible TokensMinted (r:1 w:1)132 /// Storage: `Refungible::TokensMinted` (r:1 w:1)135 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)133 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)136 /// Storage: Refungible AccountBalance (r:200 w:200)134 /// Storage: `Refungible::AccountBalance` (r:200 w:200)137 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)135 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)138 /// Storage: Refungible Balance (r:0 w:200)136 /// Storage: `Refungible::Balance` (r:0 w:200)139 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)137 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)140 /// Storage: Refungible TotalSupply (r:0 w:1)138 /// Storage: `Refungible::TotalSupply` (r:0 w:1)141 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)139 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)142 /// Storage: Refungible Owned (r:0 w:200)140 /// Storage: `Refungible::Owned` (r:0 w:200)143 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)141 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)144 /// The range of component `b` is `[0, 200]`.142 /// The range of component `b` is `[0, 200]`.145 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {143 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {146 // Proof Size summary in bytes:144 // Proof Size summary in bytes:147 // Measured: `4`145 // Measured: `4`148 // Estimated: `3481 + b * (2540 ±0)`146 // Estimated: `3481 + b * (2540 ±0)`149 // Minimum execution time: 3_697_000 picoseconds.147 // Minimum execution time: 5_200_000 picoseconds.150 Weight::from_parts(2_136_481, 3481)148 Weight::from_parts(25_301_631, 3481)151 // Standard Error: 567149 // Standard Error: 6_177152 .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))150 .saturating_add(Weight::from_parts(11_197_931, 0).saturating_mul(b.into()))153 .saturating_add(T::DbWeight::get().reads(1_u64))151 .saturating_add(T::DbWeight::get().reads(1_u64))154 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))152 .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b.into())))155 .saturating_add(T::DbWeight::get().writes(2_u64))153 .saturating_add(T::DbWeight::get().writes(2_u64))156 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))154 .saturating_add(T::DbWeight::get().writes((3_u64).saturating_mul(b.into())))157 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))155 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))158 }156 }159 /// Storage: Refungible Balance (r:3 w:1)157 /// Storage: `Refungible::Balance` (r:3 w:1)160 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)158 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)161 /// Storage: Refungible TotalSupply (r:1 w:1)159 /// Storage: `Refungible::TotalSupply` (r:1 w:1)162 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)160 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)163 /// Storage: Refungible AccountBalance (r:1 w:1)161 /// Storage: `Refungible::AccountBalance` (r:1 w:1)164 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)162 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)165 /// Storage: Refungible Owned (r:0 w:1)163 /// Storage: `Refungible::Owned` (r:0 w:1)166 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)164 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)167 fn burn_item_partial() -> Weight {165 fn burn_item_partial() -> Weight {168 // Proof Size summary in bytes:166 // Proof Size summary in bytes:169 // Measured: `456`167 // Measured: `456`170 // Estimated: `8682`168 // Estimated: `8682`171 // Minimum execution time: 22_859_000 picoseconds.169 // Minimum execution time: 29_540_000 picoseconds.172 Weight::from_parts(23_295_000, 8682)170 Weight::from_parts(30_190_000, 8682)173 .saturating_add(T::DbWeight::get().reads(5_u64))171 .saturating_add(T::DbWeight::get().reads(5_u64))174 .saturating_add(T::DbWeight::get().writes(4_u64))172 .saturating_add(T::DbWeight::get().writes(4_u64))175 }173 }176 /// Storage: Refungible Balance (r:1 w:1)174 /// Storage: `Refungible::Balance` (r:1 w:1)177 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)175 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)178 /// Storage: Refungible TotalSupply (r:1 w:1)176 /// Storage: `Refungible::TotalSupply` (r:1 w:1)179 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)177 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)180 /// Storage: Refungible AccountBalance (r:1 w:1)178 /// Storage: `Refungible::AccountBalance` (r:1 w:1)181 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)179 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)182 /// Storage: Refungible TokensBurnt (r:1 w:1)180 /// Storage: `Refungible::TokensBurnt` (r:1 w:1)183 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)181 /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)184 /// Storage: Refungible Owned (r:0 w:1)182 /// Storage: `Refungible::Owned` (r:0 w:1)185 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)183 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)186 /// Storage: Refungible TokenProperties (r:0 w:1)184 /// Storage: `Refungible::TokenProperties` (r:0 w:1)187 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)185 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)188 fn burn_item_fully() -> Weight {186 fn burn_item_fully() -> Weight {189 // Proof Size summary in bytes:187 // Proof Size summary in bytes:190 // Measured: `341`188 // Measured: `341`191 // Estimated: `3554`189 // Estimated: `3554`192 // Minimum execution time: 21_477_000 picoseconds.190 // Minimum execution time: 30_650_000 picoseconds.193 Weight::from_parts(22_037_000, 3554)191 Weight::from_parts(31_370_000, 3554)194 .saturating_add(T::DbWeight::get().reads(4_u64))192 .saturating_add(T::DbWeight::get().reads(4_u64))195 .saturating_add(T::DbWeight::get().writes(6_u64))193 .saturating_add(T::DbWeight::get().writes(6_u64))196 }194 }197 /// Storage: Refungible Balance (r:2 w:2)195 /// Storage: `Refungible::Balance` (r:2 w:2)198 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)196 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)199 /// Storage: Refungible TotalSupply (r:1 w:0)197 /// Storage: `Refungible::TotalSupply` (r:1 w:0)200 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)198 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)201 fn transfer_normal() -> Weight {199 fn transfer_normal() -> Weight {202 // Proof Size summary in bytes:200 // Proof Size summary in bytes:203 // Measured: `365`201 // Measured: `365`204 // Estimated: `6118`202 // Estimated: `6118`205 // Minimum execution time: 13_714_000 picoseconds.203 // Minimum execution time: 18_530_000 picoseconds.206 Weight::from_parts(14_050_000, 6118)204 Weight::from_parts(19_010_000, 6118)207 .saturating_add(T::DbWeight::get().reads(3_u64))205 .saturating_add(T::DbWeight::get().reads(3_u64))208 .saturating_add(T::DbWeight::get().writes(2_u64))206 .saturating_add(T::DbWeight::get().writes(2_u64))209 }207 }210 /// Storage: Refungible Balance (r:2 w:2)208 /// Storage: `Refungible::Balance` (r:2 w:2)211 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)209 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)212 /// Storage: Refungible AccountBalance (r:1 w:1)210 /// Storage: `Refungible::AccountBalance` (r:1 w:1)213 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)211 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)214 /// Storage: Refungible TotalSupply (r:1 w:0)212 /// Storage: `Refungible::TotalSupply` (r:1 w:0)215 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)213 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)216 /// Storage: Refungible Owned (r:0 w:1)214 /// Storage: `Refungible::Owned` (r:0 w:1)217 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)215 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)218 fn transfer_creating() -> Weight {216 fn transfer_creating() -> Weight {219 // Proof Size summary in bytes:217 // Proof Size summary in bytes:220 // Measured: `341`218 // Measured: `341`221 // Estimated: `6118`219 // Estimated: `6118`222 // Minimum execution time: 15_879_000 picoseconds.220 // Minimum execution time: 24_240_000 picoseconds.223 Weight::from_parts(16_266_000, 6118)221 Weight::from_parts(24_760_000, 6118)224 .saturating_add(T::DbWeight::get().reads(4_u64))222 .saturating_add(T::DbWeight::get().reads(4_u64))225 .saturating_add(T::DbWeight::get().writes(4_u64))223 .saturating_add(T::DbWeight::get().writes(4_u64))226 }224 }227 /// Storage: Refungible Balance (r:2 w:2)225 /// Storage: `Refungible::Balance` (r:2 w:2)228 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)226 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)229 /// Storage: Refungible AccountBalance (r:1 w:1)227 /// Storage: `Refungible::AccountBalance` (r:1 w:1)230 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)228 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)231 /// Storage: Refungible TotalSupply (r:1 w:0)229 /// Storage: `Refungible::TotalSupply` (r:1 w:0)232 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)230 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)233 /// Storage: Refungible Owned (r:0 w:1)231 /// Storage: `Refungible::Owned` (r:0 w:1)234 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)232 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)235 fn transfer_removing() -> Weight {233 fn transfer_removing() -> Weight {236 // Proof Size summary in bytes:234 // Proof Size summary in bytes:237 // Measured: `456`235 // Measured: `456`238 // Estimated: `6118`236 // Estimated: `6118`239 // Minimum execution time: 18_186_000 picoseconds.237 // Minimum execution time: 25_990_000 picoseconds.240 Weight::from_parts(18_682_000, 6118)238 Weight::from_parts(26_650_000, 6118)241 .saturating_add(T::DbWeight::get().reads(4_u64))239 .saturating_add(T::DbWeight::get().reads(4_u64))242 .saturating_add(T::DbWeight::get().writes(4_u64))240 .saturating_add(T::DbWeight::get().writes(4_u64))243 }241 }244 /// Storage: Refungible Balance (r:2 w:2)242 /// Storage: `Refungible::Balance` (r:2 w:2)245 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)243 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)246 /// Storage: Refungible AccountBalance (r:2 w:2)244 /// Storage: `Refungible::AccountBalance` (r:2 w:2)247 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)245 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)248 /// Storage: Refungible TotalSupply (r:1 w:0)246 /// Storage: `Refungible::TotalSupply` (r:1 w:0)249 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)247 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)250 /// Storage: Refungible Owned (r:0 w:2)248 /// Storage: `Refungible::Owned` (r:0 w:2)251 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)249 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)252 fn transfer_creating_removing() -> Weight {250 fn transfer_creating_removing() -> Weight {253 // Proof Size summary in bytes:251 // Proof Size summary in bytes:254 // Measured: `341`252 // Measured: `341`255 // Estimated: `6118`253 // Estimated: `6118`256 // Minimum execution time: 17_943_000 picoseconds.254 // Minimum execution time: 29_550_000 picoseconds.257 Weight::from_parts(18_333_000, 6118)255 Weight::from_parts(30_530_000, 6118)258 .saturating_add(T::DbWeight::get().reads(5_u64))256 .saturating_add(T::DbWeight::get().reads(5_u64))259 .saturating_add(T::DbWeight::get().writes(6_u64))257 .saturating_add(T::DbWeight::get().writes(6_u64))260 }258 }261 /// Storage: Refungible Balance (r:1 w:0)259 /// Storage: `Refungible::Balance` (r:1 w:0)262 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)260 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)263 /// Storage: Refungible Allowance (r:0 w:1)261 /// Storage: `Refungible::Allowance` (r:0 w:1)264 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)262 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)265 fn approve() -> Weight {263 fn approve() -> Weight {266 // Proof Size summary in bytes:264 // Proof Size summary in bytes:267 // Measured: `223`265 // Measured: `223`268 // Estimated: `3554`266 // Estimated: `3554`269 // Minimum execution time: 8_391_000 picoseconds.267 // Minimum execution time: 11_420_000 picoseconds.270 Weight::from_parts(8_637_000, 3554)268 Weight::from_parts(11_810_000, 3554)271 .saturating_add(T::DbWeight::get().reads(1_u64))269 .saturating_add(T::DbWeight::get().reads(1_u64))272 .saturating_add(T::DbWeight::get().writes(1_u64))270 .saturating_add(T::DbWeight::get().writes(1_u64))273 }271 }274 /// Storage: Refungible Balance (r:1 w:0)272 /// Storage: `Refungible::Balance` (r:1 w:0)275 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)273 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)276 /// Storage: Refungible Allowance (r:0 w:1)274 /// Storage: `Refungible::Allowance` (r:0 w:1)277 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)275 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)278 fn approve_from() -> Weight {276 fn approve_from() -> Weight {279 // Proof Size summary in bytes:277 // Proof Size summary in bytes:280 // Measured: `211`278 // Measured: `211`281 // Estimated: `3554`279 // Estimated: `3554`282 // Minimum execution time: 8_519_000 picoseconds.280 // Minimum execution time: 11_610_000 picoseconds.283 Weight::from_parts(8_760_000, 3554)281 Weight::from_parts(11_950_000, 3554)284 .saturating_add(T::DbWeight::get().reads(1_u64))282 .saturating_add(T::DbWeight::get().reads(1_u64))285 .saturating_add(T::DbWeight::get().writes(1_u64))283 .saturating_add(T::DbWeight::get().writes(1_u64))286 }284 }287 /// Storage: Refungible Allowance (r:1 w:1)285 /// Storage: `Refungible::Allowance` (r:1 w:1)288 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)286 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)289 /// Storage: Refungible Balance (r:2 w:2)287 /// Storage: `Refungible::Balance` (r:2 w:2)290 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)288 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)291 /// Storage: Refungible TotalSupply (r:1 w:0)289 /// Storage: `Refungible::TotalSupply` (r:1 w:0)292 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)290 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)293 fn transfer_from_normal() -> Weight {291 fn transfer_from_normal() -> Weight {294 // Proof Size summary in bytes:292 // Proof Size summary in bytes:295 // Measured: `495`293 // Measured: `495`296 // Estimated: `6118`294 // Estimated: `6118`297 // Minimum execution time: 19_554_000 picoseconds.295 // Minimum execution time: 28_510_000 picoseconds.298 Weight::from_parts(20_031_000, 6118)296 Weight::from_parts(29_180_000, 6118)299 .saturating_add(T::DbWeight::get().reads(4_u64))297 .saturating_add(T::DbWeight::get().reads(4_u64))300 .saturating_add(T::DbWeight::get().writes(3_u64))298 .saturating_add(T::DbWeight::get().writes(3_u64))301 }299 }302 /// Storage: Refungible Allowance (r:1 w:1)300 /// Storage: `Refungible::Allowance` (r:1 w:1)303 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)301 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)304 /// Storage: Refungible Balance (r:2 w:2)302 /// Storage: `Refungible::Balance` (r:2 w:2)305 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)303 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)306 /// Storage: Refungible AccountBalance (r:1 w:1)304 /// Storage: `Refungible::AccountBalance` (r:1 w:1)307 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)305 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)308 /// Storage: Refungible TotalSupply (r:1 w:0)306 /// Storage: `Refungible::TotalSupply` (r:1 w:0)309 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)307 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)310 /// Storage: Refungible Owned (r:0 w:1)308 /// Storage: `Refungible::Owned` (r:0 w:1)311 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)309 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)312 fn transfer_from_creating() -> Weight {310 fn transfer_from_creating() -> Weight {313 // Proof Size summary in bytes:311 // Proof Size summary in bytes:314 // Measured: `471`312 // Measured: `471`315 // Estimated: `6118`313 // Estimated: `6118`316 // Minimum execution time: 21_338_000 picoseconds.314 // Minimum execution time: 34_370_000 picoseconds.317 Weight::from_parts(21_803_000, 6118)315 Weight::from_parts(35_270_000, 6118)318 .saturating_add(T::DbWeight::get().reads(5_u64))316 .saturating_add(T::DbWeight::get().reads(5_u64))319 .saturating_add(T::DbWeight::get().writes(5_u64))317 .saturating_add(T::DbWeight::get().writes(5_u64))320 }318 }321 /// Storage: Refungible Allowance (r:1 w:1)319 /// Storage: `Refungible::Allowance` (r:1 w:1)322 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)320 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)323 /// Storage: Refungible Balance (r:2 w:2)321 /// Storage: `Refungible::Balance` (r:2 w:2)324 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)322 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)325 /// Storage: Refungible AccountBalance (r:1 w:1)323 /// Storage: `Refungible::AccountBalance` (r:1 w:1)326 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)324 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)327 /// Storage: Refungible TotalSupply (r:1 w:0)325 /// Storage: `Refungible::TotalSupply` (r:1 w:0)328 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)326 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)329 /// Storage: Refungible Owned (r:0 w:1)327 /// Storage: `Refungible::Owned` (r:0 w:1)330 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)328 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)331 fn transfer_from_removing() -> Weight {329 fn transfer_from_removing() -> Weight {332 // Proof Size summary in bytes:330 // Proof Size summary in bytes:333 // Measured: `586`331 // Measured: `586`334 // Estimated: `6118`332 // Estimated: `6118`335 // Minimum execution time: 24_179_000 picoseconds.333 // Minimum execution time: 36_490_000 picoseconds.336 Weight::from_parts(24_647_000, 6118)334 Weight::from_parts(37_160_000, 6118)337 .saturating_add(T::DbWeight::get().reads(5_u64))335 .saturating_add(T::DbWeight::get().reads(5_u64))338 .saturating_add(T::DbWeight::get().writes(5_u64))336 .saturating_add(T::DbWeight::get().writes(5_u64))339 }337 }340 /// Storage: Refungible Allowance (r:1 w:1)338 /// Storage: `Refungible::Allowance` (r:1 w:1)341 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)339 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)342 /// Storage: Refungible Balance (r:2 w:2)340 /// Storage: `Refungible::Balance` (r:2 w:2)343 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)341 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)344 /// Storage: Refungible AccountBalance (r:2 w:2)342 /// Storage: `Refungible::AccountBalance` (r:2 w:2)345 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)343 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)346 /// Storage: Refungible TotalSupply (r:1 w:0)344 /// Storage: `Refungible::TotalSupply` (r:1 w:0)347 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)345 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)348 /// Storage: Refungible Owned (r:0 w:2)346 /// Storage: `Refungible::Owned` (r:0 w:2)349 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)347 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)350 fn transfer_from_creating_removing() -> Weight {348 fn transfer_from_creating_removing() -> Weight {351 // Proof Size summary in bytes:349 // Proof Size summary in bytes:352 // Measured: `471`350 // Measured: `471`353 // Estimated: `6118`351 // Estimated: `6118`354 // Minimum execution time: 24_008_000 picoseconds.352 // Minimum execution time: 40_080_000 picoseconds.355 Weight::from_parts(24_545_000, 6118)353 Weight::from_parts(48_310_000, 6118)356 .saturating_add(T::DbWeight::get().reads(6_u64))354 .saturating_add(T::DbWeight::get().reads(6_u64))357 .saturating_add(T::DbWeight::get().writes(7_u64))355 .saturating_add(T::DbWeight::get().writes(7_u64))358 }356 }359 /// Storage: Refungible Allowance (r:1 w:1)357 /// Storage: `Refungible::Allowance` (r:1 w:1)360 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)358 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)361 /// Storage: Refungible Balance (r:1 w:1)359 /// Storage: `Refungible::Balance` (r:1 w:1)362 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)360 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)363 /// Storage: Refungible TotalSupply (r:1 w:1)361 /// Storage: `Refungible::TotalSupply` (r:1 w:1)364 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)362 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)365 /// Storage: Refungible AccountBalance (r:1 w:1)363 /// Storage: `Refungible::AccountBalance` (r:1 w:1)366 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)364 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)367 /// Storage: Refungible TokensBurnt (r:1 w:1)365 /// Storage: `Refungible::TokensBurnt` (r:1 w:1)368 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)366 /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)369 /// Storage: Refungible Owned (r:0 w:1)367 /// Storage: `Refungible::Owned` (r:0 w:1)370 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)368 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)371 /// Storage: Refungible TokenProperties (r:0 w:1)369 /// Storage: `Refungible::TokenProperties` (r:0 w:1)372 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)370 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)373 fn burn_from() -> Weight {371 fn burn_from() -> Weight {374 // Proof Size summary in bytes:372 // Proof Size summary in bytes:375 // Measured: `471`373 // Measured: `471`376 // Estimated: `3570`374 // Estimated: `3570`377 // Minimum execution time: 27_907_000 picoseconds.375 // Minimum execution time: 41_100_000 picoseconds.378 Weight::from_parts(28_489_000, 3570)376 Weight::from_parts(42_060_000, 3570)379 .saturating_add(T::DbWeight::get().reads(5_u64))377 .saturating_add(T::DbWeight::get().reads(5_u64))380 .saturating_add(T::DbWeight::get().writes(7_u64))378 .saturating_add(T::DbWeight::get().writes(7_u64))381 }379 }382 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)380 /// Storage: `Refungible::TokenProperties` (r:1 w:0)383 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)381 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)384 /// The range of component `b` is `[0, 64]`.382 fn load_token_properties() -> Weight {385 fn set_token_property_permissions(b: u32, ) -> Weight {386 // Proof Size summary in bytes:383 // Proof Size summary in bytes:387 // Measured: `314`384 // Measured: `120`388 // Estimated: `20191`385 // Estimated: `36269`389 // Minimum execution time: 1_460_000 picoseconds.386 // Minimum execution time: 2_520_000 picoseconds.390 Weight::from_parts(1_564_000, 20191)387 Weight::from_parts(2_670_000, 36269)391 // Standard Error: 14_117392 .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))393 .saturating_add(T::DbWeight::get().reads(1_u64))388 .saturating_add(T::DbWeight::get().reads(1_u64))394 .saturating_add(T::DbWeight::get().writes(1_u64))395 }389 }396 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)390 /// Storage: `Refungible::TokenProperties` (r:0 w:1)397 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)398 /// Storage: Refungible TokenProperties (r:1 w:1)399 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)391 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)400 /// Storage: Refungible TotalSupply (r:1 w:0)401 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)402 /// The range of component `b` is `[0, 64]`.392 /// The range of component `b` is `[0, 64]`.403 fn set_token_properties(b: u32, ) -> Weight {393 fn write_token_properties(b: u32, ) -> Weight {404 // Proof Size summary in bytes:394 // Proof Size summary in bytes:405 // Measured: `502 + b * (261 ±0)`406 // Estimated: `36269`407 // Minimum execution time: 1_012_000 picoseconds.408 Weight::from_parts(1_081_000, 36269)409 // Standard Error: 6_838410 .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))411 .saturating_add(T::DbWeight::get().reads(3_u64))412 .saturating_add(T::DbWeight::get().writes(1_u64))413 }414 /// Storage: Refungible TokenProperties (r:0 w:1)415 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)416 /// The range of component `b` is `[0, 64]`.417 fn init_token_properties(b: u32, ) -> Weight {418 // Proof Size summary in bytes:419 // Measured: `0`395 // Measured: `0`420 // Estimated: `0`396 // Estimated: `0`421 // Minimum execution time: 229_000 picoseconds.397 // Minimum execution time: 490_000 picoseconds.422 Weight::from_parts(253_000, 0)398 Weight::from_parts(3_457_547, 0)423 // Standard Error: 100_218399 // Standard Error: 24_239424 .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))400 .saturating_add(Weight::from_parts(19_382_722, 0).saturating_mul(b.into()))425 .saturating_add(T::DbWeight::get().writes(1_u64))401 .saturating_add(T::DbWeight::get().writes(1_u64))426 }402 }427 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)403 /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)428 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)429 /// Storage: Refungible TotalSupply (r:1 w:0)430 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)404 /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)431 /// Storage: Refungible TokenProperties (r:1 w:1)432 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)433 /// The range of component `b` is `[0, 64]`.405 /// The range of component `b` is `[0, 64]`.434 fn delete_token_properties(b: u32, ) -> Weight {406 fn set_token_property_permissions(b: u32, ) -> Weight {435 // Proof Size summary in bytes:407 // Proof Size summary in bytes:436 // Measured: `561 + b * (33291 ±0)`408 // Measured: `314`437 // Estimated: `36269`409 // Estimated: `20191`438 // Minimum execution time: 1_014_000 picoseconds.410 // Minimum execution time: 1_500_000 picoseconds.439 Weight::from_parts(1_065_000, 36269)411 Weight::from_parts(1_590_000, 20191)440 // Standard Error: 39_536412 // Standard Error: 123_927441 .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))413 .saturating_add(Weight::from_parts(27_355_093, 0).saturating_mul(b.into()))442 .saturating_add(T::DbWeight::get().reads(3_u64))414 .saturating_add(T::DbWeight::get().reads(1_u64))443 .saturating_add(T::DbWeight::get().writes(1_u64))415 .saturating_add(T::DbWeight::get().writes(1_u64))444 }416 }445 /// Storage: Refungible TotalSupply (r:1 w:1)417 /// Storage: `Refungible::TotalSupply` (r:1 w:1)446 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)418 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)447 /// Storage: Refungible Balance (r:1 w:1)419 /// Storage: `Refungible::Balance` (r:1 w:1)448 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)420 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)449 fn repartition_item() -> Weight {421 fn repartition_item() -> Weight {450 // Proof Size summary in bytes:422 // Proof Size summary in bytes:451 // Measured: `288`423 // Measured: `288`452 // Estimated: `3554`424 // Estimated: `3554`453 // Minimum execution time: 10_315_000 picoseconds.425 // Minimum execution time: 14_340_000 picoseconds.454 Weight::from_parts(10_601_000, 3554)426 Weight::from_parts(14_590_000, 3554)455 .saturating_add(T::DbWeight::get().reads(2_u64))427 .saturating_add(T::DbWeight::get().reads(2_u64))456 .saturating_add(T::DbWeight::get().writes(2_u64))428 .saturating_add(T::DbWeight::get().writes(2_u64))457 }429 }458 /// Storage: Refungible Balance (r:2 w:0)430 /// Storage: `Refungible::CollectionAllowance` (r:0 w:1)459 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)460 fn token_owner() -> Weight {461 // Proof Size summary in bytes:462 // Measured: `288`463 // Estimated: `6118`464 // Minimum execution time: 4_898_000 picoseconds.465 Weight::from_parts(5_136_000, 6118)466 .saturating_add(T::DbWeight::get().reads(2_u64))467 }468 /// Storage: Refungible CollectionAllowance (r:0 w:1)469 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)431 /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)470 fn set_allowance_for_all() -> Weight {432 fn set_allowance_for_all() -> Weight {471 // Proof Size summary in bytes:433 // Proof Size summary in bytes:472 // Measured: `0`434 // Measured: `0`473 // Estimated: `0`435 // Estimated: `0`474 // Minimum execution time: 4_146_000 picoseconds.436 // Minimum execution time: 6_390_000 picoseconds.475 Weight::from_parts(4_337_000, 0)437 Weight::from_parts(6_650_000, 0)476 .saturating_add(T::DbWeight::get().writes(1_u64))438 .saturating_add(T::DbWeight::get().writes(1_u64))477 }439 }478 /// Storage: Refungible CollectionAllowance (r:1 w:0)440 /// Storage: `Refungible::CollectionAllowance` (r:1 w:0)479 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)441 /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)480 fn allowance_for_all() -> Weight {442 fn allowance_for_all() -> Weight {481 // Proof Size summary in bytes:443 // Proof Size summary in bytes:482 // Measured: `4`444 // Measured: `4`483 // Estimated: `3576`445 // Estimated: `3576`484 // Minimum execution time: 2_170_000 picoseconds.446 // Minimum execution time: 3_060_000 picoseconds.485 Weight::from_parts(2_301_000, 3576)447 Weight::from_parts(3_210_000, 3576)486 .saturating_add(T::DbWeight::get().reads(1_u64))448 .saturating_add(T::DbWeight::get().reads(1_u64))487 }449 }488 /// Storage: Refungible TokenProperties (r:1 w:1)450 /// Storage: `Refungible::TokenProperties` (r:1 w:1)489 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)451 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)490 fn repair_item() -> Weight {452 fn repair_item() -> Weight {491 // Proof Size summary in bytes:453 // Proof Size summary in bytes:492 // Measured: `120`454 // Measured: `120`493 // Estimated: `36269`455 // Estimated: `36269`494 // Minimum execution time: 2_098_000 picoseconds.456 // Minimum execution time: 2_480_000 picoseconds.495 Weight::from_parts(2_251_000, 36269)457 Weight::from_parts(2_620_000, 36269)496 .saturating_add(T::DbWeight::get().reads(1_u64))458 .saturating_add(T::DbWeight::get().reads(1_u64))497 .saturating_add(T::DbWeight::get().writes(1_u64))459 .saturating_add(T::DbWeight::get().writes(1_u64))498 }460 }499}461}500462501// For backwards compatibility and tests463// For backwards compatibility and tests502impl WeightInfo for () {464impl WeightInfo for () {503 /// Storage: Refungible TokensMinted (r:1 w:1)465 /// Storage: `Refungible::TokensMinted` (r:1 w:1)504 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)466 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)505 /// Storage: Refungible AccountBalance (r:1 w:1)467 /// Storage: `Refungible::AccountBalance` (r:1 w:1)506 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)468 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)507 /// Storage: Refungible Balance (r:0 w:1)469 /// Storage: `Refungible::Balance` (r:0 w:1)508 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)470 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)509 /// Storage: Refungible TotalSupply (r:0 w:1)471 /// Storage: `Refungible::TotalSupply` (r:0 w:1)510 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)472 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)511 /// Storage: Refungible Owned (r:0 w:1)473 /// Storage: `Refungible::Owned` (r:0 w:1)512 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)474 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)513 fn create_item() -> Weight {475 fn create_item() -> Weight {514 // Proof Size summary in bytes:476 // Proof Size summary in bytes:515 // Measured: `4`477 // Measured: `4`516 // Estimated: `3530`478 // Estimated: `3530`517 // Minimum execution time: 11_341_000 picoseconds.479 // Minimum execution time: 19_400_000 picoseconds.518 Weight::from_parts(11_741_000, 3530)480 Weight::from_parts(19_890_000, 3530)519 .saturating_add(RocksDbWeight::get().reads(2_u64))481 .saturating_add(RocksDbWeight::get().reads(2_u64))520 .saturating_add(RocksDbWeight::get().writes(5_u64))482 .saturating_add(RocksDbWeight::get().writes(5_u64))521 }483 }522 /// Storage: Refungible TokensMinted (r:1 w:1)484 /// Storage: `Refungible::TokensMinted` (r:1 w:1)523 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)485 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)524 /// Storage: Refungible AccountBalance (r:1 w:1)486 /// Storage: `Refungible::AccountBalance` (r:1 w:1)525 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)487 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)526 /// Storage: Refungible Balance (r:0 w:200)488 /// Storage: `Refungible::Balance` (r:0 w:200)527 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)489 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)528 /// Storage: Refungible TotalSupply (r:0 w:200)490 /// Storage: `Refungible::TotalSupply` (r:0 w:200)529 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)491 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)530 /// Storage: Refungible Owned (r:0 w:200)492 /// Storage: `Refungible::Owned` (r:0 w:200)531 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)493 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)532 /// The range of component `b` is `[0, 200]`.494 /// The range of component `b` is `[0, 200]`.533 fn create_multiple_items(b: u32, ) -> Weight {495 fn create_multiple_items(b: u32, ) -> Weight {534 // Proof Size summary in bytes:496 // Proof Size summary in bytes:535 // Measured: `4`497 // Measured: `4`536 // Estimated: `3530`498 // Estimated: `3530`537 // Minimum execution time: 2_665_000 picoseconds.499 // Minimum execution time: 3_120_000 picoseconds.538 Weight::from_parts(2_791_000, 3530)500 Weight::from_parts(3_310_000, 3530)539 // Standard Error: 996501 // Standard Error: 2_748540 .saturating_add(Weight::from_parts(4_343_736, 0).saturating_mul(b.into()))502 .saturating_add(Weight::from_parts(11_489_631, 0).saturating_mul(b.into()))541 .saturating_add(RocksDbWeight::get().reads(2_u64))503 .saturating_add(RocksDbWeight::get().reads(2_u64))542 .saturating_add(RocksDbWeight::get().writes(2_u64))504 .saturating_add(RocksDbWeight::get().writes(2_u64))543 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))505 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))544 }506 }545 /// Storage: Refungible TokensMinted (r:1 w:1)507 /// Storage: `Refungible::TokensMinted` (r:1 w:1)546 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)508 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)547 /// Storage: Refungible AccountBalance (r:200 w:200)509 /// Storage: `Refungible::AccountBalance` (r:200 w:200)548 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)510 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)549 /// Storage: Refungible Balance (r:0 w:200)511 /// Storage: `Refungible::Balance` (r:0 w:200)550 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)512 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)551 /// Storage: Refungible TotalSupply (r:0 w:200)513 /// Storage: `Refungible::TotalSupply` (r:0 w:200)552 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)514 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)553 /// Storage: Refungible Owned (r:0 w:200)515 /// Storage: `Refungible::Owned` (r:0 w:200)554 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)516 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)555 /// The range of component `b` is `[0, 200]`.517 /// The range of component `b` is `[0, 200]`.556 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {518 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {557 // Proof Size summary in bytes:519 // Proof Size summary in bytes:558 // Measured: `4`520 // Measured: `4`559 // Estimated: `3481 + b * (2540 ±0)`521 // Estimated: `3481 + b * (2540 ±0)`560 // Minimum execution time: 2_616_000 picoseconds.522 // Minimum execution time: 3_180_000 picoseconds.561 Weight::from_parts(2_726_000, 3481)523 Weight::from_parts(2_015_490, 3481)562 // Standard Error: 665524 // Standard Error: 6_052563 .saturating_add(Weight::from_parts(5_554_066, 0).saturating_mul(b.into()))525 .saturating_add(Weight::from_parts(14_837_077, 0).saturating_mul(b.into()))564 .saturating_add(RocksDbWeight::get().reads(1_u64))526 .saturating_add(RocksDbWeight::get().reads(1_u64))565 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))527 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))566 .saturating_add(RocksDbWeight::get().writes(1_u64))528 .saturating_add(RocksDbWeight::get().writes(1_u64))567 .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))529 .saturating_add(RocksDbWeight::get().writes((4_u64).saturating_mul(b.into())))568 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))530 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))569 }531 }570 /// Storage: Refungible TokensMinted (r:1 w:1)532 /// Storage: `Refungible::TokensMinted` (r:1 w:1)571 /// Proof: Refungible TokensMinted (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)533 /// Proof: `Refungible::TokensMinted` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)572 /// Storage: Refungible AccountBalance (r:200 w:200)534 /// Storage: `Refungible::AccountBalance` (r:200 w:200)573 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)535 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)574 /// Storage: Refungible Balance (r:0 w:200)536 /// Storage: `Refungible::Balance` (r:0 w:200)575 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)537 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)576 /// Storage: Refungible TotalSupply (r:0 w:1)538 /// Storage: `Refungible::TotalSupply` (r:0 w:1)577 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)539 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)578 /// Storage: Refungible Owned (r:0 w:200)540 /// Storage: `Refungible::Owned` (r:0 w:200)579 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)541 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)580 /// The range of component `b` is `[0, 200]`.542 /// The range of component `b` is `[0, 200]`.581 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {543 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {582 // Proof Size summary in bytes:544 // Proof Size summary in bytes:583 // Measured: `4`545 // Measured: `4`584 // Estimated: `3481 + b * (2540 ±0)`546 // Estimated: `3481 + b * (2540 ±0)`585 // Minimum execution time: 3_697_000 picoseconds.547 // Minimum execution time: 5_200_000 picoseconds.586 Weight::from_parts(2_136_481, 3481)548 Weight::from_parts(25_301_631, 3481)587 // Standard Error: 567549 // Standard Error: 6_177588 .saturating_add(Weight::from_parts(4_390_621, 0).saturating_mul(b.into()))550 .saturating_add(Weight::from_parts(11_197_931, 0).saturating_mul(b.into()))589 .saturating_add(RocksDbWeight::get().reads(1_u64))551 .saturating_add(RocksDbWeight::get().reads(1_u64))590 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))552 .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b.into())))591 .saturating_add(RocksDbWeight::get().writes(2_u64))553 .saturating_add(RocksDbWeight::get().writes(2_u64))592 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))554 .saturating_add(RocksDbWeight::get().writes((3_u64).saturating_mul(b.into())))593 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))555 .saturating_add(Weight::from_parts(0, 2540).saturating_mul(b.into()))594 }556 }595 /// Storage: Refungible Balance (r:3 w:1)557 /// Storage: `Refungible::Balance` (r:3 w:1)596 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)558 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)597 /// Storage: Refungible TotalSupply (r:1 w:1)559 /// Storage: `Refungible::TotalSupply` (r:1 w:1)598 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)560 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)599 /// Storage: Refungible AccountBalance (r:1 w:1)561 /// Storage: `Refungible::AccountBalance` (r:1 w:1)600 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)562 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)601 /// Storage: Refungible Owned (r:0 w:1)563 /// Storage: `Refungible::Owned` (r:0 w:1)602 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)564 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)603 fn burn_item_partial() -> Weight {565 fn burn_item_partial() -> Weight {604 // Proof Size summary in bytes:566 // Proof Size summary in bytes:605 // Measured: `456`567 // Measured: `456`606 // Estimated: `8682`568 // Estimated: `8682`607 // Minimum execution time: 22_859_000 picoseconds.569 // Minimum execution time: 29_540_000 picoseconds.608 Weight::from_parts(23_295_000, 8682)570 Weight::from_parts(30_190_000, 8682)609 .saturating_add(RocksDbWeight::get().reads(5_u64))571 .saturating_add(RocksDbWeight::get().reads(5_u64))610 .saturating_add(RocksDbWeight::get().writes(4_u64))572 .saturating_add(RocksDbWeight::get().writes(4_u64))611 }573 }612 /// Storage: Refungible Balance (r:1 w:1)574 /// Storage: `Refungible::Balance` (r:1 w:1)613 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)575 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)614 /// Storage: Refungible TotalSupply (r:1 w:1)576 /// Storage: `Refungible::TotalSupply` (r:1 w:1)615 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)577 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)616 /// Storage: Refungible AccountBalance (r:1 w:1)578 /// Storage: `Refungible::AccountBalance` (r:1 w:1)617 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)579 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)618 /// Storage: Refungible TokensBurnt (r:1 w:1)580 /// Storage: `Refungible::TokensBurnt` (r:1 w:1)619 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)581 /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)620 /// Storage: Refungible Owned (r:0 w:1)582 /// Storage: `Refungible::Owned` (r:0 w:1)621 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)583 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)622 /// Storage: Refungible TokenProperties (r:0 w:1)584 /// Storage: `Refungible::TokenProperties` (r:0 w:1)623 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)585 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)624 fn burn_item_fully() -> Weight {586 fn burn_item_fully() -> Weight {625 // Proof Size summary in bytes:587 // Proof Size summary in bytes:626 // Measured: `341`588 // Measured: `341`627 // Estimated: `3554`589 // Estimated: `3554`628 // Minimum execution time: 21_477_000 picoseconds.590 // Minimum execution time: 30_650_000 picoseconds.629 Weight::from_parts(22_037_000, 3554)591 Weight::from_parts(31_370_000, 3554)630 .saturating_add(RocksDbWeight::get().reads(4_u64))592 .saturating_add(RocksDbWeight::get().reads(4_u64))631 .saturating_add(RocksDbWeight::get().writes(6_u64))593 .saturating_add(RocksDbWeight::get().writes(6_u64))632 }594 }633 /// Storage: Refungible Balance (r:2 w:2)595 /// Storage: `Refungible::Balance` (r:2 w:2)634 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)596 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)635 /// Storage: Refungible TotalSupply (r:1 w:0)597 /// Storage: `Refungible::TotalSupply` (r:1 w:0)636 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)598 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)637 fn transfer_normal() -> Weight {599 fn transfer_normal() -> Weight {638 // Proof Size summary in bytes:600 // Proof Size summary in bytes:639 // Measured: `365`601 // Measured: `365`640 // Estimated: `6118`602 // Estimated: `6118`641 // Minimum execution time: 13_714_000 picoseconds.603 // Minimum execution time: 18_530_000 picoseconds.642 Weight::from_parts(14_050_000, 6118)604 Weight::from_parts(19_010_000, 6118)643 .saturating_add(RocksDbWeight::get().reads(3_u64))605 .saturating_add(RocksDbWeight::get().reads(3_u64))644 .saturating_add(RocksDbWeight::get().writes(2_u64))606 .saturating_add(RocksDbWeight::get().writes(2_u64))645 }607 }646 /// Storage: Refungible Balance (r:2 w:2)608 /// Storage: `Refungible::Balance` (r:2 w:2)647 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)609 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)648 /// Storage: Refungible AccountBalance (r:1 w:1)610 /// Storage: `Refungible::AccountBalance` (r:1 w:1)649 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)611 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)650 /// Storage: Refungible TotalSupply (r:1 w:0)612 /// Storage: `Refungible::TotalSupply` (r:1 w:0)651 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)613 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)652 /// Storage: Refungible Owned (r:0 w:1)614 /// Storage: `Refungible::Owned` (r:0 w:1)653 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)615 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)654 fn transfer_creating() -> Weight {616 fn transfer_creating() -> Weight {655 // Proof Size summary in bytes:617 // Proof Size summary in bytes:656 // Measured: `341`618 // Measured: `341`657 // Estimated: `6118`619 // Estimated: `6118`658 // Minimum execution time: 15_879_000 picoseconds.620 // Minimum execution time: 24_240_000 picoseconds.659 Weight::from_parts(16_266_000, 6118)621 Weight::from_parts(24_760_000, 6118)660 .saturating_add(RocksDbWeight::get().reads(4_u64))622 .saturating_add(RocksDbWeight::get().reads(4_u64))661 .saturating_add(RocksDbWeight::get().writes(4_u64))623 .saturating_add(RocksDbWeight::get().writes(4_u64))662 }624 }663 /// Storage: Refungible Balance (r:2 w:2)625 /// Storage: `Refungible::Balance` (r:2 w:2)664 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)626 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)665 /// Storage: Refungible AccountBalance (r:1 w:1)627 /// Storage: `Refungible::AccountBalance` (r:1 w:1)666 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)628 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)667 /// Storage: Refungible TotalSupply (r:1 w:0)629 /// Storage: `Refungible::TotalSupply` (r:1 w:0)668 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)630 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)669 /// Storage: Refungible Owned (r:0 w:1)631 /// Storage: `Refungible::Owned` (r:0 w:1)670 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)632 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)671 fn transfer_removing() -> Weight {633 fn transfer_removing() -> Weight {672 // Proof Size summary in bytes:634 // Proof Size summary in bytes:673 // Measured: `456`635 // Measured: `456`674 // Estimated: `6118`636 // Estimated: `6118`675 // Minimum execution time: 18_186_000 picoseconds.637 // Minimum execution time: 25_990_000 picoseconds.676 Weight::from_parts(18_682_000, 6118)638 Weight::from_parts(26_650_000, 6118)677 .saturating_add(RocksDbWeight::get().reads(4_u64))639 .saturating_add(RocksDbWeight::get().reads(4_u64))678 .saturating_add(RocksDbWeight::get().writes(4_u64))640 .saturating_add(RocksDbWeight::get().writes(4_u64))679 }641 }680 /// Storage: Refungible Balance (r:2 w:2)642 /// Storage: `Refungible::Balance` (r:2 w:2)681 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)643 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)682 /// Storage: Refungible AccountBalance (r:2 w:2)644 /// Storage: `Refungible::AccountBalance` (r:2 w:2)683 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)645 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)684 /// Storage: Refungible TotalSupply (r:1 w:0)646 /// Storage: `Refungible::TotalSupply` (r:1 w:0)685 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)647 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)686 /// Storage: Refungible Owned (r:0 w:2)648 /// Storage: `Refungible::Owned` (r:0 w:2)687 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)649 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)688 fn transfer_creating_removing() -> Weight {650 fn transfer_creating_removing() -> Weight {689 // Proof Size summary in bytes:651 // Proof Size summary in bytes:690 // Measured: `341`652 // Measured: `341`691 // Estimated: `6118`653 // Estimated: `6118`692 // Minimum execution time: 17_943_000 picoseconds.654 // Minimum execution time: 29_550_000 picoseconds.693 Weight::from_parts(18_333_000, 6118)655 Weight::from_parts(30_530_000, 6118)694 .saturating_add(RocksDbWeight::get().reads(5_u64))656 .saturating_add(RocksDbWeight::get().reads(5_u64))695 .saturating_add(RocksDbWeight::get().writes(6_u64))657 .saturating_add(RocksDbWeight::get().writes(6_u64))696 }658 }697 /// Storage: Refungible Balance (r:1 w:0)659 /// Storage: `Refungible::Balance` (r:1 w:0)698 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)660 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)699 /// Storage: Refungible Allowance (r:0 w:1)661 /// Storage: `Refungible::Allowance` (r:0 w:1)700 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)662 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)701 fn approve() -> Weight {663 fn approve() -> Weight {702 // Proof Size summary in bytes:664 // Proof Size summary in bytes:703 // Measured: `223`665 // Measured: `223`704 // Estimated: `3554`666 // Estimated: `3554`705 // Minimum execution time: 8_391_000 picoseconds.667 // Minimum execution time: 11_420_000 picoseconds.706 Weight::from_parts(8_637_000, 3554)668 Weight::from_parts(11_810_000, 3554)707 .saturating_add(RocksDbWeight::get().reads(1_u64))669 .saturating_add(RocksDbWeight::get().reads(1_u64))708 .saturating_add(RocksDbWeight::get().writes(1_u64))670 .saturating_add(RocksDbWeight::get().writes(1_u64))709 }671 }710 /// Storage: Refungible Balance (r:1 w:0)672 /// Storage: `Refungible::Balance` (r:1 w:0)711 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)673 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)712 /// Storage: Refungible Allowance (r:0 w:1)674 /// Storage: `Refungible::Allowance` (r:0 w:1)713 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)675 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)714 fn approve_from() -> Weight {676 fn approve_from() -> Weight {715 // Proof Size summary in bytes:677 // Proof Size summary in bytes:716 // Measured: `211`678 // Measured: `211`717 // Estimated: `3554`679 // Estimated: `3554`718 // Minimum execution time: 8_519_000 picoseconds.680 // Minimum execution time: 11_610_000 picoseconds.719 Weight::from_parts(8_760_000, 3554)681 Weight::from_parts(11_950_000, 3554)720 .saturating_add(RocksDbWeight::get().reads(1_u64))682 .saturating_add(RocksDbWeight::get().reads(1_u64))721 .saturating_add(RocksDbWeight::get().writes(1_u64))683 .saturating_add(RocksDbWeight::get().writes(1_u64))722 }684 }723 /// Storage: Refungible Allowance (r:1 w:1)685 /// Storage: `Refungible::Allowance` (r:1 w:1)724 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)686 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)725 /// Storage: Refungible Balance (r:2 w:2)687 /// Storage: `Refungible::Balance` (r:2 w:2)726 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)688 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)727 /// Storage: Refungible TotalSupply (r:1 w:0)689 /// Storage: `Refungible::TotalSupply` (r:1 w:0)728 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)690 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)729 fn transfer_from_normal() -> Weight {691 fn transfer_from_normal() -> Weight {730 // Proof Size summary in bytes:692 // Proof Size summary in bytes:731 // Measured: `495`693 // Measured: `495`732 // Estimated: `6118`694 // Estimated: `6118`733 // Minimum execution time: 19_554_000 picoseconds.695 // Minimum execution time: 28_510_000 picoseconds.734 Weight::from_parts(20_031_000, 6118)696 Weight::from_parts(29_180_000, 6118)735 .saturating_add(RocksDbWeight::get().reads(4_u64))697 .saturating_add(RocksDbWeight::get().reads(4_u64))736 .saturating_add(RocksDbWeight::get().writes(3_u64))698 .saturating_add(RocksDbWeight::get().writes(3_u64))737 }699 }738 /// Storage: Refungible Allowance (r:1 w:1)700 /// Storage: `Refungible::Allowance` (r:1 w:1)739 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)701 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)740 /// Storage: Refungible Balance (r:2 w:2)702 /// Storage: `Refungible::Balance` (r:2 w:2)741 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)703 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)742 /// Storage: Refungible AccountBalance (r:1 w:1)704 /// Storage: `Refungible::AccountBalance` (r:1 w:1)743 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)705 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)744 /// Storage: Refungible TotalSupply (r:1 w:0)706 /// Storage: `Refungible::TotalSupply` (r:1 w:0)745 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)707 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)746 /// Storage: Refungible Owned (r:0 w:1)708 /// Storage: `Refungible::Owned` (r:0 w:1)747 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)709 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)748 fn transfer_from_creating() -> Weight {710 fn transfer_from_creating() -> Weight {749 // Proof Size summary in bytes:711 // Proof Size summary in bytes:750 // Measured: `471`712 // Measured: `471`751 // Estimated: `6118`713 // Estimated: `6118`752 // Minimum execution time: 21_338_000 picoseconds.714 // Minimum execution time: 34_370_000 picoseconds.753 Weight::from_parts(21_803_000, 6118)715 Weight::from_parts(35_270_000, 6118)754 .saturating_add(RocksDbWeight::get().reads(5_u64))716 .saturating_add(RocksDbWeight::get().reads(5_u64))755 .saturating_add(RocksDbWeight::get().writes(5_u64))717 .saturating_add(RocksDbWeight::get().writes(5_u64))756 }718 }757 /// Storage: Refungible Allowance (r:1 w:1)719 /// Storage: `Refungible::Allowance` (r:1 w:1)758 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)720 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)759 /// Storage: Refungible Balance (r:2 w:2)721 /// Storage: `Refungible::Balance` (r:2 w:2)760 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)722 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)761 /// Storage: Refungible AccountBalance (r:1 w:1)723 /// Storage: `Refungible::AccountBalance` (r:1 w:1)762 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)724 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)763 /// Storage: Refungible TotalSupply (r:1 w:0)725 /// Storage: `Refungible::TotalSupply` (r:1 w:0)764 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)726 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)765 /// Storage: Refungible Owned (r:0 w:1)727 /// Storage: `Refungible::Owned` (r:0 w:1)766 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)728 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)767 fn transfer_from_removing() -> Weight {729 fn transfer_from_removing() -> Weight {768 // Proof Size summary in bytes:730 // Proof Size summary in bytes:769 // Measured: `586`731 // Measured: `586`770 // Estimated: `6118`732 // Estimated: `6118`771 // Minimum execution time: 24_179_000 picoseconds.733 // Minimum execution time: 36_490_000 picoseconds.772 Weight::from_parts(24_647_000, 6118)734 Weight::from_parts(37_160_000, 6118)773 .saturating_add(RocksDbWeight::get().reads(5_u64))735 .saturating_add(RocksDbWeight::get().reads(5_u64))774 .saturating_add(RocksDbWeight::get().writes(5_u64))736 .saturating_add(RocksDbWeight::get().writes(5_u64))775 }737 }776 /// Storage: Refungible Allowance (r:1 w:1)738 /// Storage: `Refungible::Allowance` (r:1 w:1)777 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)739 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)778 /// Storage: Refungible Balance (r:2 w:2)740 /// Storage: `Refungible::Balance` (r:2 w:2)779 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)741 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)780 /// Storage: Refungible AccountBalance (r:2 w:2)742 /// Storage: `Refungible::AccountBalance` (r:2 w:2)781 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)743 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)782 /// Storage: Refungible TotalSupply (r:1 w:0)744 /// Storage: `Refungible::TotalSupply` (r:1 w:0)783 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)745 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)784 /// Storage: Refungible Owned (r:0 w:2)746 /// Storage: `Refungible::Owned` (r:0 w:2)785 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)747 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)786 fn transfer_from_creating_removing() -> Weight {748 fn transfer_from_creating_removing() -> Weight {787 // Proof Size summary in bytes:749 // Proof Size summary in bytes:788 // Measured: `471`750 // Measured: `471`789 // Estimated: `6118`751 // Estimated: `6118`790 // Minimum execution time: 24_008_000 picoseconds.752 // Minimum execution time: 40_080_000 picoseconds.791 Weight::from_parts(24_545_000, 6118)753 Weight::from_parts(48_310_000, 6118)792 .saturating_add(RocksDbWeight::get().reads(6_u64))754 .saturating_add(RocksDbWeight::get().reads(6_u64))793 .saturating_add(RocksDbWeight::get().writes(7_u64))755 .saturating_add(RocksDbWeight::get().writes(7_u64))794 }756 }795 /// Storage: Refungible Allowance (r:1 w:1)757 /// Storage: `Refungible::Allowance` (r:1 w:1)796 /// Proof: Refungible Allowance (max_values: None, max_size: Some(105), added: 2580, mode: MaxEncodedLen)758 /// Proof: `Refungible::Allowance` (`max_values`: None, `max_size`: Some(105), added: 2580, mode: `MaxEncodedLen`)797 /// Storage: Refungible Balance (r:1 w:1)759 /// Storage: `Refungible::Balance` (r:1 w:1)798 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)760 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)799 /// Storage: Refungible TotalSupply (r:1 w:1)761 /// Storage: `Refungible::TotalSupply` (r:1 w:1)800 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)762 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)801 /// Storage: Refungible AccountBalance (r:1 w:1)763 /// Storage: `Refungible::AccountBalance` (r:1 w:1)802 /// Proof: Refungible AccountBalance (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)764 /// Proof: `Refungible::AccountBalance` (`max_values`: None, `max_size`: Some(65), added: 2540, mode: `MaxEncodedLen`)803 /// Storage: Refungible TokensBurnt (r:1 w:1)765 /// Storage: `Refungible::TokensBurnt` (r:1 w:1)804 /// Proof: Refungible TokensBurnt (max_values: None, max_size: Some(16), added: 2491, mode: MaxEncodedLen)766 /// Proof: `Refungible::TokensBurnt` (`max_values`: None, `max_size`: Some(16), added: 2491, mode: `MaxEncodedLen`)805 /// Storage: Refungible Owned (r:0 w:1)767 /// Storage: `Refungible::Owned` (r:0 w:1)806 /// Proof: Refungible Owned (max_values: None, max_size: Some(74), added: 2549, mode: MaxEncodedLen)768 /// Proof: `Refungible::Owned` (`max_values`: None, `max_size`: Some(74), added: 2549, mode: `MaxEncodedLen`)807 /// Storage: Refungible TokenProperties (r:0 w:1)769 /// Storage: `Refungible::TokenProperties` (r:0 w:1)808 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)770 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)809 fn burn_from() -> Weight {771 fn burn_from() -> Weight {810 // Proof Size summary in bytes:772 // Proof Size summary in bytes:811 // Measured: `471`773 // Measured: `471`812 // Estimated: `3570`774 // Estimated: `3570`813 // Minimum execution time: 27_907_000 picoseconds.775 // Minimum execution time: 41_100_000 picoseconds.814 Weight::from_parts(28_489_000, 3570)776 Weight::from_parts(42_060_000, 3570)815 .saturating_add(RocksDbWeight::get().reads(5_u64))777 .saturating_add(RocksDbWeight::get().reads(5_u64))816 .saturating_add(RocksDbWeight::get().writes(7_u64))778 .saturating_add(RocksDbWeight::get().writes(7_u64))817 }779 }818 /// Storage: Common CollectionPropertyPermissions (r:1 w:1)780 /// Storage: `Refungible::TokenProperties` (r:1 w:0)819 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)781 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)820 /// The range of component `b` is `[0, 64]`.782 fn load_token_properties() -> Weight {821 fn set_token_property_permissions(b: u32, ) -> Weight {822 // Proof Size summary in bytes:783 // Proof Size summary in bytes:823 // Measured: `314`784 // Measured: `120`824 // Estimated: `20191`785 // Estimated: `36269`825 // Minimum execution time: 1_460_000 picoseconds.786 // Minimum execution time: 2_520_000 picoseconds.826 Weight::from_parts(1_564_000, 20191)787 Weight::from_parts(2_670_000, 36269)827 // Standard Error: 14_117828 .saturating_add(Weight::from_parts(8_196_214, 0).saturating_mul(b.into()))829 .saturating_add(RocksDbWeight::get().reads(1_u64))788 .saturating_add(RocksDbWeight::get().reads(1_u64))830 .saturating_add(RocksDbWeight::get().writes(1_u64))831 }789 }832 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)790 /// Storage: `Refungible::TokenProperties` (r:0 w:1)833 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)834 /// Storage: Refungible TokenProperties (r:1 w:1)835 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)791 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)836 /// Storage: Refungible TotalSupply (r:1 w:0)837 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)838 /// The range of component `b` is `[0, 64]`.792 /// The range of component `b` is `[0, 64]`.839 fn set_token_properties(b: u32, ) -> Weight {793 fn write_token_properties(b: u32, ) -> Weight {840 // Proof Size summary in bytes:794 // Proof Size summary in bytes:841 // Measured: `502 + b * (261 ±0)`842 // Estimated: `36269`843 // Minimum execution time: 1_012_000 picoseconds.844 Weight::from_parts(1_081_000, 36269)845 // Standard Error: 6_838846 .saturating_add(Weight::from_parts(5_801_181, 0).saturating_mul(b.into()))847 .saturating_add(RocksDbWeight::get().reads(3_u64))848 .saturating_add(RocksDbWeight::get().writes(1_u64))849 }850 /// Storage: Refungible TokenProperties (r:0 w:1)851 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)852 /// The range of component `b` is `[0, 64]`.853 fn init_token_properties(b: u32, ) -> Weight {854 // Proof Size summary in bytes:855 // Measured: `0`795 // Measured: `0`856 // Estimated: `0`796 // Estimated: `0`857 // Minimum execution time: 229_000 picoseconds.797 // Minimum execution time: 490_000 picoseconds.858 Weight::from_parts(253_000, 0)798 Weight::from_parts(3_457_547, 0)859 // Standard Error: 100_218799 // Standard Error: 24_239860 .saturating_add(Weight::from_parts(12_632_221, 0).saturating_mul(b.into()))800 .saturating_add(Weight::from_parts(19_382_722, 0).saturating_mul(b.into()))861 .saturating_add(RocksDbWeight::get().writes(1_u64))801 .saturating_add(RocksDbWeight::get().writes(1_u64))862 }802 }863 /// Storage: Common CollectionPropertyPermissions (r:1 w:0)803 /// Storage: `Common::CollectionPropertyPermissions` (r:1 w:1)864 /// Proof: Common CollectionPropertyPermissions (max_values: None, max_size: Some(16726), added: 19201, mode: MaxEncodedLen)865 /// Storage: Refungible TotalSupply (r:1 w:0)866 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)804 /// Proof: `Common::CollectionPropertyPermissions` (`max_values`: None, `max_size`: Some(16726), added: 19201, mode: `MaxEncodedLen`)867 /// Storage: Refungible TokenProperties (r:1 w:1)868 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)869 /// The range of component `b` is `[0, 64]`.805 /// The range of component `b` is `[0, 64]`.870 fn delete_token_properties(b: u32, ) -> Weight {806 fn set_token_property_permissions(b: u32, ) -> Weight {871 // Proof Size summary in bytes:807 // Proof Size summary in bytes:872 // Measured: `561 + b * (33291 ±0)`808 // Measured: `314`873 // Estimated: `36269`809 // Estimated: `20191`874 // Minimum execution time: 1_014_000 picoseconds.810 // Minimum execution time: 1_500_000 picoseconds.875 Weight::from_parts(1_065_000, 36269)811 Weight::from_parts(1_590_000, 20191)876 // Standard Error: 39_536812 // Standard Error: 123_927877 .saturating_add(Weight::from_parts(24_125_838, 0).saturating_mul(b.into()))813 .saturating_add(Weight::from_parts(27_355_093, 0).saturating_mul(b.into()))878 .saturating_add(RocksDbWeight::get().reads(3_u64))814 .saturating_add(RocksDbWeight::get().reads(1_u64))879 .saturating_add(RocksDbWeight::get().writes(1_u64))815 .saturating_add(RocksDbWeight::get().writes(1_u64))880 }816 }881 /// Storage: Refungible TotalSupply (r:1 w:1)817 /// Storage: `Refungible::TotalSupply` (r:1 w:1)882 /// Proof: Refungible TotalSupply (max_values: None, max_size: Some(40), added: 2515, mode: MaxEncodedLen)818 /// Proof: `Refungible::TotalSupply` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)883 /// Storage: Refungible Balance (r:1 w:1)819 /// Storage: `Refungible::Balance` (r:1 w:1)884 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)820 /// Proof: `Refungible::Balance` (`max_values`: None, `max_size`: Some(89), added: 2564, mode: `MaxEncodedLen`)885 fn repartition_item() -> Weight {821 fn repartition_item() -> Weight {886 // Proof Size summary in bytes:822 // Proof Size summary in bytes:887 // Measured: `288`823 // Measured: `288`888 // Estimated: `3554`824 // Estimated: `3554`889 // Minimum execution time: 10_315_000 picoseconds.825 // Minimum execution time: 14_340_000 picoseconds.890 Weight::from_parts(10_601_000, 3554)826 Weight::from_parts(14_590_000, 3554)891 .saturating_add(RocksDbWeight::get().reads(2_u64))827 .saturating_add(RocksDbWeight::get().reads(2_u64))892 .saturating_add(RocksDbWeight::get().writes(2_u64))828 .saturating_add(RocksDbWeight::get().writes(2_u64))893 }894 /// Storage: Refungible Balance (r:2 w:0)895 /// Proof: Refungible Balance (max_values: None, max_size: Some(89), added: 2564, mode: MaxEncodedLen)896 fn token_owner() -> Weight {897 // Proof Size summary in bytes:898 // Measured: `288`899 // Estimated: `6118`900 // Minimum execution time: 4_898_000 picoseconds.901 Weight::from_parts(5_136_000, 6118)902 .saturating_add(RocksDbWeight::get().reads(2_u64))903 }829 }904 /// Storage: Refungible CollectionAllowance (r:0 w:1)830 /// Storage: `Refungible::CollectionAllowance` (r:0 w:1)905 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)831 /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)906 fn set_allowance_for_all() -> Weight {832 fn set_allowance_for_all() -> Weight {907 // Proof Size summary in bytes:833 // Proof Size summary in bytes:908 // Measured: `0`834 // Measured: `0`909 // Estimated: `0`835 // Estimated: `0`910 // Minimum execution time: 4_146_000 picoseconds.836 // Minimum execution time: 6_390_000 picoseconds.911 Weight::from_parts(4_337_000, 0)837 Weight::from_parts(6_650_000, 0)912 .saturating_add(RocksDbWeight::get().writes(1_u64))838 .saturating_add(RocksDbWeight::get().writes(1_u64))913 }839 }914 /// Storage: Refungible CollectionAllowance (r:1 w:0)840 /// Storage: `Refungible::CollectionAllowance` (r:1 w:0)915 /// Proof: Refungible CollectionAllowance (max_values: None, max_size: Some(111), added: 2586, mode: MaxEncodedLen)841 /// Proof: `Refungible::CollectionAllowance` (`max_values`: None, `max_size`: Some(111), added: 2586, mode: `MaxEncodedLen`)916 fn allowance_for_all() -> Weight {842 fn allowance_for_all() -> Weight {917 // Proof Size summary in bytes:843 // Proof Size summary in bytes:918 // Measured: `4`844 // Measured: `4`919 // Estimated: `3576`845 // Estimated: `3576`920 // Minimum execution time: 2_170_000 picoseconds.846 // Minimum execution time: 3_060_000 picoseconds.921 Weight::from_parts(2_301_000, 3576)847 Weight::from_parts(3_210_000, 3576)922 .saturating_add(RocksDbWeight::get().reads(1_u64))848 .saturating_add(RocksDbWeight::get().reads(1_u64))923 }849 }924 /// Storage: Refungible TokenProperties (r:1 w:1)850 /// Storage: `Refungible::TokenProperties` (r:1 w:1)925 /// Proof: Refungible TokenProperties (max_values: None, max_size: Some(32804), added: 35279, mode: MaxEncodedLen)851 /// Proof: `Refungible::TokenProperties` (`max_values`: None, `max_size`: Some(32804), added: 35279, mode: `MaxEncodedLen`)926 fn repair_item() -> Weight {852 fn repair_item() -> Weight {927 // Proof Size summary in bytes:853 // Proof Size summary in bytes:928 // Measured: `120`854 // Measured: `120`929 // Estimated: `36269`855 // Estimated: `36269`930 // Minimum execution time: 2_098_000 picoseconds.856 // Minimum execution time: 2_480_000 picoseconds.931 Weight::from_parts(2_251_000, 36269)857 Weight::from_parts(2_620_000, 36269)932 .saturating_add(RocksDbWeight::get().reads(1_u64))858 .saturating_add(RocksDbWeight::get().reads(1_u64))933 .saturating_add(RocksDbWeight::get().writes(1_u64))859 .saturating_add(RocksDbWeight::get().writes(1_u64))934 }860 }pallets/structure/src/lib.rsdiffbeforeafterboth54#![cfg_attr(not(feature = "std"), no_std)]54#![cfg_attr(not(feature = "std"), no_std)]555556use frame_support::{56use frame_support::{dispatch::DispatchResult, fail, pallet_prelude::*};57 dispatch::{DispatchResult, DispatchResultWithPostInfo},58 fail,59 pallet_prelude::*,60};61use pallet_common::{57use pallet_common::{62 dispatch::CollectionDispatch, erc::CrossAccountId, eth::is_collection,58 dispatch::CollectionDispatch, erc::CrossAccountId, eth::is_collection,269 Err(<Error<T>>::DepthLimit.into())265 Err(<Error<T>>::DepthLimit.into())270 }266 }271272 /// Burn token and all of it's nested tokens273 ///274 /// - `self_budget`: Limit for searching children in depth.275 /// - `breadth_budget`: Limit of breadth of searching children.276 pub fn burn_item_recursively(277 from: T::CrossAccountId,278 collection: CollectionId,279 token: TokenId,280 self_budget: &dyn Budget,281 breadth_budget: &dyn Budget,282 ) -> DispatchResultWithPostInfo {283 let dispatch = T::CollectionDispatch::dispatch(collection)?;284 let dispatch = dispatch.as_dyn();285 dispatch.burn_item_recursively(from, token, self_budget, breadth_budget)286 }287267288 /// Check if `token` indirectly owned by `user`268 /// Check if `token` indirectly owned by `user`289 ///269 ///pallets/unique/Cargo.tomldiffbeforeafterboth31 'parity-scale-codec/std',31 'parity-scale-codec/std',32 'sp-runtime/std',32 'sp-runtime/std',33 'sp-std/std',33 'sp-std/std',34 'up-common/std',34 'up-data-structs/std',35 'up-data-structs/std',36 'pallet-structure/std',35]37]36stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]38stubgen = ["evm-coder/stubgen", "pallet-common/stubgen"]37try-runtime = ["frame-support/try-runtime"]39try-runtime = ["frame-support/try-runtime"]53pallet-evm-coder-substrate = { workspace = true }55pallet-evm-coder-substrate = { workspace = true }54pallet-nonfungible = { workspace = true }56pallet-nonfungible = { workspace = true }55pallet-refungible = { workspace = true }57pallet-refungible = { workspace = true }58pallet-structure = { workspace = true }56scale-info = { workspace = true }59scale-info = { workspace = true }57sp-core = { workspace = true }60sp-core = { workspace = true }58sp-io = { workspace = true }61sp-io = { workspace = true }59sp-runtime = { workspace = true }62sp-runtime = { workspace = true }60sp-std = { workspace = true }63sp-std = { workspace = true }64up-common = { workspace = true }61up-data-structs = { workspace = true }65up-data-structs = { workspace = true }6266pallets/unique/src/lib.rsdiffbeforeafterboth848485#[frame_support::pallet]85#[frame_support::pallet]86pub mod pallet {86pub mod pallet {87 use frame_support::{dispatch::DispatchResult, ensure, fail, storage::Key, BoundedVec};87 use frame_support::{88 dispatch::{DispatchErrorWithPostInfo, DispatchResult, PostDispatchInfo},89 ensure, fail,90 storage::Key,91 BoundedVec,92 };88 use frame_system::{ensure_root, ensure_signed};93 use frame_system::{ensure_root, ensure_signed};89 use pallet_common::{94 use pallet_common::{90 dispatch::{dispatch_tx, CollectionDispatch},95 dispatch::{dispatch_tx, CollectionDispatch},91 CollectionHandle, CommonWeightInfo, Pallet as PalletCommon, RefungibleExtensionsWeightInfo,96 CollectionHandle, CommonWeightInfo, Pallet as PalletCommon, RefungibleExtensionsWeightInfo,92 };97 };93 use pallet_evm::account::CrossAccountId;98 use pallet_evm::account::CrossAccountId;99 use pallet_structure::weights::WeightInfo as StructureWeightInfo;94 use scale_info::TypeInfo;100 use scale_info::TypeInfo;95 use sp_std::{vec, vec::Vec};101 use sp_std::{vec, vec::Vec};96 use up_data_structs::{102 use up_data_structs::{105111106 use super::*;112 use super::*;107113108 /// A maximum number of levels of depth in the token nesting tree.109 pub const NESTING_BUDGET: u32 = 5;110111 /// Errors for the common Unique transactions.114 /// Errors for the common Unique transactions.112 #[pallet::error]115 #[pallet::error]113 pub enum Error<T> {116 pub enum Error<T> {128 /// Weight information for common pallet operations.131 /// Weight information for common pallet operations.129 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;132 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;130133134 type StructureWeightInfo: StructureWeightInfo;135131 /// Weight info information for extra refungible pallet operations.136 /// Weight info information for extra refungible pallet operations.132 type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;137 type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;133 }138 }264 impl<T: Config> Pallet<T> {269 impl<T: Config> Pallet<T> {265 /// A maximum number of levels of depth in the token nesting tree.270 /// A maximum number of levels of depth in the token nesting tree.266 fn nesting_budget() -> u32 {271 fn nesting_budget() -> u32 {267 NESTING_BUDGET272 5268 }273 }269274270 /// Maximal length of a collection name.275 /// Maximal length of a collection name.666 /// * `owner`: Address of the initial owner of the item.671 /// * `owner`: Address of the initial owner of the item.667 /// * `data`: Token data describing the item to store on chain.672 /// * `data`: Token data describing the item to store on chain.668 #[pallet::call_index(11)]673 #[pallet::call_index(11)]669 #[pallet::weight(T::CommonWeightInfo::create_item(data))]674 #[pallet::weight(T::CommonWeightInfo::create_item(data) + <Pallet<T>>::nesting_budget_predispatch_weight())]670 pub fn create_item(675 pub fn create_item(671 origin: OriginFor<T>,676 origin: OriginFor<T>,672 collection_id: CollectionId,677 collection_id: CollectionId,673 owner: T::CrossAccountId,678 owner: T::CrossAccountId,674 data: CreateItemData,679 data: CreateItemData,675 ) -> DispatchResultWithPostInfo {680 ) -> DispatchResultWithPostInfo {676 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);681 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);677 let budget = budget::Value::new(NESTING_BUDGET);682 let budget = Self::structure_nesting_budget();678683679 dispatch_tx::<T, _>(collection_id, |d| {684 Self::refund_nesting_budget(685 dispatch_tx::<T, _>(collection_id, |d| {680 d.create_item(sender, owner, data, &budget)686 d.create_item(sender, owner, data, &budget)681 })687 }),688 budget,689 )682 }690 }683691684 /// Create multiple items within a collection.692 /// Create multiple items within a collection.700 /// * `owner`: Address of the initial owner of the tokens.708 /// * `owner`: Address of the initial owner of the tokens.701 /// * `items_data`: Vector of data describing each item to be created.709 /// * `items_data`: Vector of data describing each item to be created.702 #[pallet::call_index(12)]710 #[pallet::call_index(12)]703 #[pallet::weight(T::CommonWeightInfo::create_multiple_items(items_data))]711 #[pallet::weight(T::CommonWeightInfo::create_multiple_items(items_data) + <Pallet<T>>::nesting_budget_predispatch_weight())]704 pub fn create_multiple_items(712 pub fn create_multiple_items(705 origin: OriginFor<T>,713 origin: OriginFor<T>,706 collection_id: CollectionId,714 collection_id: CollectionId,709 ) -> DispatchResultWithPostInfo {717 ) -> DispatchResultWithPostInfo {710 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);718 ensure!(!items_data.is_empty(), Error::<T>::EmptyArgument);711 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);719 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);712 let budget = budget::Value::new(NESTING_BUDGET);720 let budget = Self::structure_nesting_budget();713721714 dispatch_tx::<T, _>(collection_id, |d| {722 Self::refund_nesting_budget(723 dispatch_tx::<T, _>(collection_id, |d| {715 d.create_multiple_items(sender, owner, items_data, &budget)724 d.create_multiple_items(sender, owner, items_data, &budget)716 })725 }),726 budget,727 )717 }728 }718729719 /// Add or change collection properties.730 /// Add or change collection properties.791 /// * `properties`: Vector of key-value pairs stored as the token's metadata.802 /// * `properties`: Vector of key-value pairs stored as the token's metadata.792 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.803 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.793 #[pallet::call_index(15)]804 #[pallet::call_index(15)]794 #[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32))]805 #[pallet::weight(T::CommonWeightInfo::set_token_properties(properties.len() as u32) + <Pallet<T>>::nesting_budget_predispatch_weight())]795 pub fn set_token_properties(806 pub fn set_token_properties(796 origin: OriginFor<T>,807 origin: OriginFor<T>,797 collection_id: CollectionId,808 collection_id: CollectionId,801 ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);812 ensure!(!properties.is_empty(), Error::<T>::EmptyArgument);802813803 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);814 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);804 let budget = budget::Value::new(NESTING_BUDGET);815 let budget = Self::structure_nesting_budget();805816806 dispatch_tx::<T, _>(collection_id, |d| {817 Self::refund_nesting_budget(818 dispatch_tx::<T, _>(collection_id, |d| {807 d.set_token_properties(sender, token_id, properties, &budget)819 d.set_token_properties(sender, token_id, properties, &budget)808 })820 }),821 budget,822 )809 }823 }810824811 /// Delete specified token properties. Currently properties only work with NFTs.825 /// Delete specified token properties. Currently properties only work with NFTs.824 /// * `property_keys`: Vector of keys of the properties to be deleted.838 /// * `property_keys`: Vector of keys of the properties to be deleted.825 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.839 /// Keys support Latin letters, `-`, `_`, and `.` as symbols.826 #[pallet::call_index(16)]840 #[pallet::call_index(16)]827 #[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32))]841 #[pallet::weight(T::CommonWeightInfo::delete_token_properties(property_keys.len() as u32) + <Pallet<T>>::nesting_budget_predispatch_weight())]828 pub fn delete_token_properties(842 pub fn delete_token_properties(829 origin: OriginFor<T>,843 origin: OriginFor<T>,830 collection_id: CollectionId,844 collection_id: CollectionId,834 ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);848 ensure!(!property_keys.is_empty(), Error::<T>::EmptyArgument);835849836 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);850 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);837 let budget = budget::Value::new(NESTING_BUDGET);851 let budget = Self::structure_nesting_budget();838852839 dispatch_tx::<T, _>(collection_id, |d| {853 Self::refund_nesting_budget(854 dispatch_tx::<T, _>(collection_id, |d| {840 d.delete_token_properties(sender, token_id, property_keys, &budget)855 d.delete_token_properties(sender, token_id, property_keys, &budget)841 })856 }),857 budget,858 )842 }859 }843860844 /// Add or change token property permissions of a collection.861 /// Add or change token property permissions of a collection.888 /// * `collection_id`: ID of the collection to which the tokens would belong.905 /// * `collection_id`: ID of the collection to which the tokens would belong.889 /// * `data`: Explicit item creation data.906 /// * `data`: Explicit item creation data.890 #[pallet::call_index(18)]907 #[pallet::call_index(18)]891 #[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(data))]908 #[pallet::weight(T::CommonWeightInfo::create_multiple_items_ex(data) + <Pallet<T>>::nesting_budget_predispatch_weight())]892 pub fn create_multiple_items_ex(909 pub fn create_multiple_items_ex(893 origin: OriginFor<T>,910 origin: OriginFor<T>,894 collection_id: CollectionId,911 collection_id: CollectionId,895 data: CreateItemExData<T::CrossAccountId>,912 data: CreateItemExData<T::CrossAccountId>,896 ) -> DispatchResultWithPostInfo {913 ) -> DispatchResultWithPostInfo {897 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);914 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);898 let budget = budget::Value::new(NESTING_BUDGET);915 let budget = Self::structure_nesting_budget();899916900 dispatch_tx::<T, _>(collection_id, |d| {917 Self::refund_nesting_budget(918 dispatch_tx::<T, _>(collection_id, |d| {901 d.create_multiple_items_ex(sender, data, &budget)919 d.create_multiple_items_ex(sender, data, &budget)902 })920 }),921 budget,922 )903 }923 }904924905 /// Completely allow or disallow transfers for a particular collection.925 /// Completely allow or disallow transfers for a particular collection.995 /// * Fungible Mode: The desired number of pieces to burn.1015 /// * Fungible Mode: The desired number of pieces to burn.996 /// * Re-Fungible Mode: The desired number of pieces to burn.1016 /// * Re-Fungible Mode: The desired number of pieces to burn.997 #[pallet::call_index(21)]1017 #[pallet::call_index(21)]998 #[pallet::weight(T::CommonWeightInfo::burn_from())]1018 #[pallet::weight(T::CommonWeightInfo::burn_from() + <Pallet<T>>::nesting_budget_predispatch_weight())]999 pub fn burn_from(1019 pub fn burn_from(1000 origin: OriginFor<T>,1020 origin: OriginFor<T>,1001 collection_id: CollectionId,1021 collection_id: CollectionId,1004 value: u128,1024 value: u128,1005 ) -> DispatchResultWithPostInfo {1025 ) -> DispatchResultWithPostInfo {1006 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1026 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1007 let budget = budget::Value::new(NESTING_BUDGET);1027 let budget = Self::structure_nesting_budget();100810281009 dispatch_tx::<T, _>(collection_id, |d| {1029 Self::refund_nesting_budget(1030 dispatch_tx::<T, _>(collection_id, |d| {1010 d.burn_from(sender, from, item_id, value, &budget)1031 d.burn_from(sender, from, item_id, value, &budget)1011 })1032 }),1033 budget,1034 )1012 }1035 }101310361014 /// Change ownership of the token.1037 /// Change ownership of the token.1033 /// * Fungible Mode: The desired number of pieces to transfer.1056 /// * Fungible Mode: The desired number of pieces to transfer.1034 /// * Re-Fungible Mode: The desired number of pieces to transfer.1057 /// * Re-Fungible Mode: The desired number of pieces to transfer.1035 #[pallet::call_index(22)]1058 #[pallet::call_index(22)]1036 #[pallet::weight(T::CommonWeightInfo::transfer())]1059 #[pallet::weight(T::CommonWeightInfo::transfer() + <Pallet<T>>::nesting_budget_predispatch_weight())]1037 pub fn transfer(1060 pub fn transfer(1038 origin: OriginFor<T>,1061 origin: OriginFor<T>,1039 recipient: T::CrossAccountId,1062 recipient: T::CrossAccountId,1042 value: u128,1065 value: u128,1043 ) -> DispatchResultWithPostInfo {1066 ) -> DispatchResultWithPostInfo {1044 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1067 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1045 let budget = budget::Value::new(NESTING_BUDGET);1068 let budget = Self::structure_nesting_budget();104610691047 dispatch_tx::<T, _>(collection_id, |d| {1070 Self::refund_nesting_budget(1071 dispatch_tx::<T, _>(collection_id, |d| {1048 d.transfer(sender, recipient, item_id, value, &budget)1072 d.transfer(sender, recipient, item_id, value, &budget)1049 })1073 }),1074 budget,1075 )1050 }1076 }105110771052 /// Allow a non-permissioned address to transfer or burn an item.1078 /// Allow a non-permissioned address to transfer or burn an item.1138 /// * Fungible Mode: The desired number of pieces to transfer.1164 /// * Fungible Mode: The desired number of pieces to transfer.1139 /// * Re-Fungible Mode: The desired number of pieces to transfer.1165 /// * Re-Fungible Mode: The desired number of pieces to transfer.1140 #[pallet::call_index(25)]1166 #[pallet::call_index(25)]1141 #[pallet::weight(T::CommonWeightInfo::transfer_from())]1167 #[pallet::weight(T::CommonWeightInfo::transfer_from() + <Pallet<T>>::nesting_budget_predispatch_weight())]1142 pub fn transfer_from(1168 pub fn transfer_from(1143 origin: OriginFor<T>,1169 origin: OriginFor<T>,1144 from: T::CrossAccountId,1170 from: T::CrossAccountId,1148 value: u128,1174 value: u128,1149 ) -> DispatchResultWithPostInfo {1175 ) -> DispatchResultWithPostInfo {1150 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1176 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);1151 let budget = budget::Value::new(NESTING_BUDGET);1177 let budget = Self::structure_nesting_budget();115211781153 dispatch_tx::<T, _>(collection_id, |d| {1179 Self::refund_nesting_budget(1180 dispatch_tx::<T, _>(collection_id, |d| {1154 d.transfer_from(sender, from, recipient, item_id, value, &budget)1181 d.transfer_from(sender, from, recipient, item_id, value, &budget)1155 })1182 }),1183 budget,1184 )1156 }1185 }115711861158 /// Set specific limits of a collection. Empty, or None fields mean chain default.1187 /// Set specific limits of a collection. Empty, or None fields mean chain default.1347 let _ = <RefungibleApproveBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);1376 let _ = <RefungibleApproveBasket<T>>::clear_prefix((collection_id,), u32::MAX, None);134813771349 Ok(())1378 Ok(())1379 }13801381 fn structure_nesting_budget() -> budget::Value {1382 budget::Value::new(Self::nesting_budget())1383 }13841385 fn nesting_budget_predispatch_weight() -> Weight {1386 T::StructureWeightInfo::find_parent().saturating_mul(Self::nesting_budget() as u64)1387 }13881389 pub fn refund_nesting_budget(1390 mut result: DispatchResultWithPostInfo,1391 budget: budget::Value,1392 ) -> DispatchResultWithPostInfo {1393 let refund_amount = budget.refund_amount();1394 let consumed = Self::nesting_budget() - refund_amount;13951396 match &mut result {1397 Ok(PostDispatchInfo {1398 actual_weight: Some(weight),1399 ..1400 })1401 | Err(DispatchErrorWithPostInfo {1402 post_info: PostDispatchInfo {1403 actual_weight: Some(weight),1404 ..1405 },1406 ..1407 }) => {1408 *weight += T::StructureWeightInfo::find_parent().saturating_mul(consumed as u64)1409 }1410 _ => {}1411 }14121413 result1350 }1414 }1351 }1415 }1352}1416}primitives/common/src/constants.rsdiffbeforeafterbothno syntactic changes
primitives/data-structs/src/budget.rsdiffbeforeafterboth1use core::cell::Cell;1use sp_std::cell::Cell;223pub trait Budget {3pub trait Budget {4 /// Returns true while not exceeded4 /// Returns true while not exceeded22 pub fn new(v: u32) -> Self {22 pub fn new(v: u32) -> Self {23 Self(Cell::new(v))23 Self(Cell::new(v))24 }24 }25 pub fn refund(self) -> u32 {25 pub fn refund_amount(self) -> u32 {26 self.0.get()26 self.0.get()27 }27 }28}28}runtime/common/config/pallets/mod.rsdiffbeforeafterboth116impl pallet_unique::Config for Runtime {116impl pallet_unique::Config for Runtime {117 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;117 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;118 type CommonWeightInfo = CommonWeights<Self>;118 type CommonWeightInfo = CommonWeights<Self>;119 type StructureWeightInfo = pallet_structure::weights::SubstrateWeight<Self>;119 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;120 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;120}121}121122runtime/common/runtime_apis.rsdiffbeforeafterboth84 }84 }858586 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {86 fn topmost_token_owner(collection: CollectionId, token: TokenId) -> Result<Option<CrossAccountId>, DispatchError> {87 let budget = up_data_structs::budget::Value::new(10);87 let budget = budget::Value::new(10);888889 <pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)89 <pallet_structure::Pallet<Runtime>>::find_topmost_owner(collection, token, &budget)90 }90 }runtime/common/weights/mod.rsdiffbeforeafterboth98 dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))98 dispatch_weight::<T>() + max_weight_of!(set_token_properties(amount))99 }99 }100101 fn delete_token_properties(amount: u32) -> Weight {102 dispatch_weight::<T>() + max_weight_of!(delete_token_properties(amount))103 }104100105 fn set_token_property_permissions(amount: u32) -> Weight {101 fn set_token_property_permissions(amount: u32) -> Weight {106 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))102 dispatch_weight::<T>() + max_weight_of!(set_token_property_permissions(amount))126 dispatch_weight::<T>() + max_weight_of!(burn_from())122 dispatch_weight::<T>() + max_weight_of!(burn_from())127 }123 }128129 fn burn_recursively_self_raw() -> Weight {130 max_weight_of!(burn_recursively_self_raw())131 }132133 fn burn_recursively_breadth_raw(amount: u32) -> Weight {134 max_weight_of!(burn_recursively_breadth_raw(amount))135 }136137 fn token_owner() -> Weight {138 max_weight_of!(token_owner())139 }140124141 fn set_allowance_for_all() -> Weight {125 fn set_allowance_for_all() -> Weight {142 max_weight_of!(set_allowance_for_all())126 dispatch_weight::<T>() + max_weight_of!(set_allowance_for_all())143 }127 }144128145 fn force_repair_item() -> Weight {129 fn force_repair_item() -> Weight {146 max_weight_of!(force_repair_item())130 dispatch_weight::<T>() + max_weight_of!(force_repair_item())147 }131 }148}132}149133runtime/tests/src/lib.rsdiffbeforeafterboth292 type WeightInfo = ();292 type WeightInfo = ();293 type CommonWeightInfo = CommonWeights<Self>;293 type CommonWeightInfo = CommonWeights<Self>;294 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;294 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;295 type StructureWeightInfo = pallet_structure::weights::SubstrateWeight<Self>;295}296}296297297// Build genesis storage according to the mock runtime.298// Build genesis storage according to the mock runtime.runtime/tests/src/tests.rsdiffbeforeafterboth262426242625 use super::*;2625 use super::*;262626262627 fn test<FTE: FnOnce() -> bool>(2627 fn test(2628 i: usize,2628 i: usize,2629 test_case: &pallet_common::tests::TestCase,2629 test_case: &pallet_common::tests::TestCase,2630 check_token_existence: &mut LazyValue<bool, FTE>,2630 check_token_existence: &mut LazyValue<bool>,2631 ) {2631 ) {2632 let collection_admin = test_case.collection_admin;2632 let collection_admin = test_case.collection_admin;2633 let mut is_collection_admin = LazyValue::new(|| test_case.is_collection_admin);2633 let mut is_collection_admin = LazyValue::new(|| test_case.is_collection_admin);2634 let token_owner = test_case.token_owner;2634 let token_owner = test_case.token_owner;2635 let mut is_token_owner = LazyValue::new(|| Ok(test_case.is_token_owner));2635 let mut is_token_owner = LazyValue::new(|| Ok(test_case.is_token_owner));2636 let is_no_permission = test_case.no_permission;2636 let is_no_permission = test_case.no_permission;263726372638 let result = pallet_common::tests::check_token_permissions::<Test, _, _, FTE>(2638 let result = pallet_common::tests::check_token_permissions::<Test>(2639 collection_admin,2639 collection_admin,2640 token_owner,2640 token_owner,2641 &mut is_collection_admin,2641 &mut is_collection_admin,tests/src/eth/nativeFungible.test.tsdiffbeforeafterboth33 const collectionAddress = helper.ethAddress.fromCollectionId(0);33 const collectionAddress = helper.ethAddress.fromCollectionId(0);34 const contract = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);34 const contract = await helper.ethNativeContract.collection(collectionAddress, 'ft', owner);353536 await expect(contract.methods.approve(spender, 100).call({from: owner})).to.be.rejectedWith('Approve not supported');36 await expect(contract.methods.approve(spender, 100).call({from: owner})).to.be.rejectedWith('approve not supported');37 });37 });383839 itEth('balanceOf()', async ({helper}) => {39 itEth('balanceOf()', async ({helper}) => {tests/src/util/playgrounds/unique.tsdiffbeforeafterboth311931193120 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {3120 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {3121 const api = this.helper.getApi();3121 const api = this.helper.getApi();3122 const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON();3122 const props = (await api.query.nonfungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;312331233124 return (props! as any).consumedSpace;3124 return props?.consumedSpace ?? 0;3125 }3125 }312631263127 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {3127 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId) {322432243225 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {3225 async getTokenPropertiesConsumedSpace(tokenId: number): Promise<number> {3226 const api = this.helper.getApi();3226 const api = this.helper.getApi();3227 const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON();3227 const props = (await api.query.refungible.tokenProperties(this.collectionId, tokenId)).toJSON() as any;322832283229 return (props! as any).consumedSpace;3229 return props?.consumedSpace ?? 0;3230 }3230 }323132313232 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {3232 async transferToken(signer: TSigner, tokenId: number, addressObj: ICrossAccountId, amount = 1n) {