git.delta.rocks / unique-network / refs/commits / 9ca985e04f6a

difftreelog

decoupling of unique and refungible pallets

Grigoriy Simonov2022-06-28parent: #af3427e.patch.diff
in: master

16 files changed

modified.gitignorediffbeforeafterboth
1212
13/.idea/13/.idea/
14/.cargo/14/.cargo/
15/.vscode/
1516
16tests/.vscode17tests/.vscode
17cumulus-parachain/18cumulus-parachain/
modifiedCargo.lockdiffbeforeafterboth
6608 "pallet-evm",6608 "pallet-evm",
6609 "pallet-evm-coder-substrate",6609 "pallet-evm-coder-substrate",
6610 "pallet-nonfungible",6610 "pallet-nonfungible",
6611 "pallet-refungible",
6612 "parity-scale-codec 3.1.5",6611 "parity-scale-codec 3.1.5",
6613 "scale-info",6612 "scale-info",
6614 "serde",6613 "serde",
modifiedpallets/common/src/lib.rsdiffbeforeafterboth
1258 }1258 }
1259}1259}
1260
1261pub trait RefungibleExtensionsWeightInfo {
1262 fn repartition() -> Weight;
1263}
12601264
1261pub trait CommonCollectionOperations<T: Config> {1265pub trait CommonCollectionOperations<T: Config> {
1262 fn create_item(1266 fn create_item(
1384 spender: T::CrossAccountId,1388 spender: T::CrossAccountId,
1385 token: TokenId,1389 token: TokenId,
1386 ) -> u128;1390 ) -> u128;
1391 fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>>;
1387}1392}
1393
1394pub trait RefungibleExtensions<T>
1395where
1396 T: Config,
1397{
1398 fn repartition(
1399 &self,
1400 owner: &T::CrossAccountId,
1401 token: TokenId,
1402 amount: u128,
1403 ) -> DispatchResultWithPostInfo;
1404}
13881405
1389// Flexible enough for implementing CommonCollectionOperations1406// Flexible enough for implementing CommonCollectionOperations
1390pub fn with_weight(res: DispatchResult, weight: Weight) -> DispatchResultWithPostInfo {1407pub fn with_weight(res: DispatchResult, weight: Weight) -> DispatchResultWithPostInfo {
modifiedpallets/fungible/src/common.rsdiffbeforeafterboth
1818
19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};19use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};
20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};20use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};
21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};21use pallet_common::{CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight};
22use pallet_structure::Error as StructureError;22use pallet_structure::Error as StructureError;
23use sp_runtime::ArithmeticError;23use sp_runtime::ArithmeticError;
24use sp_std::{vec::Vec, vec};24use sp_std::{vec::Vec, vec};
400 <Allowance<T>>::get((self.id, sender, spender))400 <Allowance<T>>::get((self.id, sender, spender))
401 }401 }
402
403 fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {
404 None
405 }
402}406}
403407
modifiedpallets/nonfungible/src/common.rsdiffbeforeafterboth
22 PropertyKeyPermission, PropertyValue,22 PropertyKeyPermission, PropertyValue,
23};23};
24use pallet_common::{24use pallet_common::{
25 CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,25 CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
26 weights::WeightInfo as _,
26};27};
27use sp_runtime::DispatchError;28use sp_runtime::DispatchError;
468 }469 }
469 }470 }
471
472 fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {
473 None
474 }
470}475}
471476
modifiedpallets/refungible/src/benchmarking.rsdiffbeforeafterboth
204 <Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;204 <Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;
205 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200, &Unlimited)?}205 }: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200, &Unlimited)?}
206
207 repartition_item {
208 bench_init!{
209 owner: sub; collection: collection(owner);
210 sender: cross_from_sub(owner); owner: cross_sub;
211 };
212 let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
213 }: {<Pallet<T>>::repartition(&collection, &owner, item, 200)?}
206}214}
207215
modifiedpallets/refungible/src/common.rsdiffbeforeafterboth
22 CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,22 CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,
23 PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,23 PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,
24};24};
25use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};25use pallet_common::{CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight};
26use pallet_structure::Error as StructureError;26use pallet_structure::Error as StructureError;
27use sp_runtime::DispatchError;27use sp_runtime::{DispatchError};
28use sp_std::{vec::Vec, vec};28use sp_std::{vec::Vec, vec};
2929
30use crate::{30use crate::{
406 <Allowance<T>>::get((self.id, token, sender, spender))406 <Allowance<T>>::get((self.id, token, sender, spender))
407 }407 }
408
409 fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {
410 Some(self)
411 }
408}412}
413
414impl<T: Config> RefungibleExtensions<T> for RefungibleHandle<T> {
415 fn repartition(
416 &self,
417 owner: &T::CrossAccountId,
418 token: TokenId,
419 amount: u128,
420 ) -> DispatchResultWithPostInfo {
421 with_weight(
422 <Pallet<T>>::repartition(self, owner, token, amount),
423 <SelfWeightOf<T>>::repartition_item(),
424 )
425 }
426}
409427
modifiedpallets/refungible/src/lib.rsdiffbeforeafterboth
688 }688 }
689689
690 pub fn repartition(690 pub fn repartition(
691 owner: &T::CrossAccountId,691 collection: &RefungibleHandle<T>,
692 collection: &RefungibleHandle<T>,692 owner: &T::CrossAccountId,
693 token: TokenId,693 token: TokenId,
694 amount: u128,694 amount: u128,
695 ) -> DispatchResult {695 ) -> DispatchResult {
modifiedpallets/refungible/src/weights.rsdiffbeforeafterboth
3//! Autogenerated weights for pallet_refungible3//! Autogenerated weights for pallet_refungible
4//!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-dev
6//! DATE: 2022-06-15, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2022-06-27, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10247//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
88
9// Executed Command:9// Executed Command:
49 fn transfer_from_removing() -> Weight;49 fn transfer_from_removing() -> Weight;
50 fn transfer_from_creating_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;
51 fn burn_from() -> Weight;51 fn burn_from() -> Weight;
52 fn repartition_item() -> Weight;
52}53}
5354
54/// Weights for pallet_refungible using the Substrate node and recommended hardware.55/// Weights for pallet_refungible using the Substrate node and recommended hardware.
61 // Storage: Refungible TokenData (r:0 w:1)62 // Storage: Refungible TokenData (r:0 w:1)
62 // Storage: Refungible Owned (r:0 w:1)63 // Storage: Refungible Owned (r:0 w:1)
63 fn create_item() -> Weight {64 fn create_item() -> Weight {
64 (21_321_000 as Weight)65 (17_553_000 as Weight)
65 .saturating_add(T::DbWeight::get().reads(2 as Weight))66 .saturating_add(T::DbWeight::get().reads(2 as Weight))
66 .saturating_add(T::DbWeight::get().writes(6 as Weight))67 .saturating_add(T::DbWeight::get().writes(6 as Weight))
67 }68 }
72 // Storage: Refungible TokenData (r:0 w:4)73 // Storage: Refungible TokenData (r:0 w:4)
73 // Storage: Refungible Owned (r:0 w:4)74 // Storage: Refungible Owned (r:0 w:4)
74 fn create_multiple_items(b: u32, ) -> Weight {75 fn create_multiple_items(b: u32, ) -> Weight {
75 (16_313_000 as Weight)76 (10_654_000 as Weight)
76 // Standard Error: 4_00077 // Standard Error: 1_000
77 .saturating_add((5_464_000 as Weight).saturating_mul(b as Weight))78 .saturating_add((5_114_000 as Weight).saturating_mul(b as Weight))
78 .saturating_add(T::DbWeight::get().reads(2 as Weight))79 .saturating_add(T::DbWeight::get().reads(2 as Weight))
79 .saturating_add(T::DbWeight::get().writes(2 as Weight))80 .saturating_add(T::DbWeight::get().writes(2 as Weight))
80 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))81 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
86 // Storage: Refungible TokenData (r:0 w:4)87 // Storage: Refungible TokenData (r:0 w:4)
87 // Storage: Refungible Owned (r:0 w:4)88 // Storage: Refungible Owned (r:0 w:4)
88 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {89 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
89 (15_631_000 as Weight)90 (3_587_000 as Weight)
90 // Standard Error: 5_00091 // Standard Error: 2_000
91 .saturating_add((8_141_000 as Weight).saturating_mul(b as Weight))92 .saturating_add((7_931_000 as Weight).saturating_mul(b as Weight))
92 .saturating_add(T::DbWeight::get().reads(1 as Weight))93 .saturating_add(T::DbWeight::get().reads(1 as Weight))
93 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))94 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
94 .saturating_add(T::DbWeight::get().writes(1 as Weight))95 .saturating_add(T::DbWeight::get().writes(1 as Weight))
101 // Storage: Refungible Balance (r:0 w:4)102 // Storage: Refungible Balance (r:0 w:4)
102 // Storage: Refungible Owned (r:0 w:4)103 // Storage: Refungible Owned (r:0 w:4)
103 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {104 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
104 (11_191_000 as Weight)105 (1_980_000 as Weight)
105 // Standard Error: 4_000106 // Standard Error: 2_000
106 .saturating_add((6_321_000 as Weight).saturating_mul(b as Weight))107 .saturating_add((6_305_000 as Weight).saturating_mul(b as Weight))
107 .saturating_add(T::DbWeight::get().reads(1 as Weight))108 .saturating_add(T::DbWeight::get().reads(1 as Weight))
108 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))109 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
109 .saturating_add(T::DbWeight::get().writes(3 as Weight))110 .saturating_add(T::DbWeight::get().writes(3 as Weight))
114 // Storage: Refungible AccountBalance (r:1 w:1)115 // Storage: Refungible AccountBalance (r:1 w:1)
115 // Storage: Refungible Owned (r:0 w:1)116 // Storage: Refungible Owned (r:0 w:1)
116 fn burn_item_partial() -> Weight {117 fn burn_item_partial() -> Weight {
117 (24_421_000 as Weight)118 (21_010_000 as Weight)
118 .saturating_add(T::DbWeight::get().reads(3 as Weight))119 .saturating_add(T::DbWeight::get().reads(3 as Weight))
119 .saturating_add(T::DbWeight::get().writes(4 as Weight))120 .saturating_add(T::DbWeight::get().writes(4 as Weight))
120 }121 }
125 // Storage: Refungible TokenData (r:0 w:1)126 // Storage: Refungible TokenData (r:0 w:1)
126 // Storage: Refungible Owned (r:0 w:1)127 // Storage: Refungible Owned (r:0 w:1)
127 fn burn_item_fully() -> Weight {128 fn burn_item_fully() -> Weight {
128 (32_900_000 as Weight)129 (28_413_000 as Weight)
129 .saturating_add(T::DbWeight::get().reads(4 as Weight))130 .saturating_add(T::DbWeight::get().reads(4 as Weight))
130 .saturating_add(T::DbWeight::get().writes(6 as Weight))131 .saturating_add(T::DbWeight::get().writes(6 as Weight))
131 }132 }
132 // Storage: Refungible Balance (r:2 w:2)133 // Storage: Refungible Balance (r:2 w:2)
133 fn transfer_normal() -> Weight {134 fn transfer_normal() -> Weight {
134 (20_215_000 as Weight)135 (17_513_000 as Weight)
135 .saturating_add(T::DbWeight::get().reads(2 as Weight))136 .saturating_add(T::DbWeight::get().reads(2 as Weight))
136 .saturating_add(T::DbWeight::get().writes(2 as Weight))137 .saturating_add(T::DbWeight::get().writes(2 as Weight))
137 }138 }
138 // Storage: Refungible Balance (r:2 w:2)139 // Storage: Refungible Balance (r:2 w:2)
139 // Storage: Refungible AccountBalance (r:1 w:1)140 // Storage: Refungible AccountBalance (r:1 w:1)
140 // Storage: Refungible Owned (r:0 w:1)141 // Storage: Refungible Owned (r:0 w:1)
141 fn transfer_creating() -> Weight {142 fn transfer_creating() -> Weight {
142 (24_809_000 as Weight)143 (20_469_000 as Weight)
143 .saturating_add(T::DbWeight::get().reads(3 as Weight))144 .saturating_add(T::DbWeight::get().reads(3 as Weight))
144 .saturating_add(T::DbWeight::get().writes(4 as Weight))145 .saturating_add(T::DbWeight::get().writes(4 as Weight))
145 }146 }
146 // Storage: Refungible Balance (r:2 w:2)147 // Storage: Refungible Balance (r:2 w:2)
147 // Storage: Refungible AccountBalance (r:1 w:1)148 // Storage: Refungible AccountBalance (r:1 w:1)
148 // Storage: Refungible Owned (r:0 w:1)149 // Storage: Refungible Owned (r:0 w:1)
149 fn transfer_removing() -> Weight {150 fn transfer_removing() -> Weight {
150 (26_704_000 as Weight)151 (22_472_000 as Weight)
151 .saturating_add(T::DbWeight::get().reads(3 as Weight))152 .saturating_add(T::DbWeight::get().reads(3 as Weight))
152 .saturating_add(T::DbWeight::get().writes(4 as Weight))153 .saturating_add(T::DbWeight::get().writes(4 as Weight))
153 }154 }
154 // Storage: Refungible Balance (r:2 w:2)155 // Storage: Refungible Balance (r:2 w:2)
155 // Storage: Refungible AccountBalance (r:2 w:2)156 // Storage: Refungible AccountBalance (r:2 w:2)
156 // Storage: Refungible Owned (r:0 w:2)157 // Storage: Refungible Owned (r:0 w:2)
157 fn transfer_creating_removing() -> Weight {158 fn transfer_creating_removing() -> Weight {
158 (28_728_000 as Weight)159 (24_866_000 as Weight)
159 .saturating_add(T::DbWeight::get().reads(4 as Weight))160 .saturating_add(T::DbWeight::get().reads(4 as Weight))
160 .saturating_add(T::DbWeight::get().writes(6 as Weight))161 .saturating_add(T::DbWeight::get().writes(6 as Weight))
161 }162 }
162 // Storage: Refungible Balance (r:1 w:0)163 // Storage: Refungible Balance (r:1 w:0)
163 // Storage: Refungible Allowance (r:0 w:1)164 // Storage: Refungible Allowance (r:0 w:1)
164 fn approve() -> Weight {165 fn approve() -> Weight {
165 (16_107_000 as Weight)166 (13_475_000 as Weight)
166 .saturating_add(T::DbWeight::get().reads(1 as Weight))167 .saturating_add(T::DbWeight::get().reads(1 as Weight))
167 .saturating_add(T::DbWeight::get().writes(1 as Weight))168 .saturating_add(T::DbWeight::get().writes(1 as Weight))
168 }169 }
169 // Storage: Refungible Allowance (r:1 w:1)170 // Storage: Refungible Allowance (r:1 w:1)
170 // Storage: Refungible Balance (r:2 w:2)171 // Storage: Refungible Balance (r:2 w:2)
171 fn transfer_from_normal() -> Weight {172 fn transfer_from_normal() -> Weight {
172 (28_765_000 as Weight)173 (24_707_000 as Weight)
173 .saturating_add(T::DbWeight::get().reads(3 as Weight))174 .saturating_add(T::DbWeight::get().reads(3 as Weight))
174 .saturating_add(T::DbWeight::get().writes(3 as Weight))175 .saturating_add(T::DbWeight::get().writes(3 as Weight))
175 }176 }
178 // Storage: Refungible AccountBalance (r:1 w:1)179 // Storage: Refungible AccountBalance (r:1 w:1)
179 // Storage: Refungible Owned (r:0 w:1)180 // Storage: Refungible Owned (r:0 w:1)
180 fn transfer_from_creating() -> Weight {181 fn transfer_from_creating() -> Weight {
181 (32_788_000 as Weight)182 (27_812_000 as Weight)
182 .saturating_add(T::DbWeight::get().reads(4 as Weight))183 .saturating_add(T::DbWeight::get().reads(4 as Weight))
183 .saturating_add(T::DbWeight::get().writes(5 as Weight))184 .saturating_add(T::DbWeight::get().writes(5 as Weight))
184 }185 }
187 // Storage: Refungible AccountBalance (r:1 w:1)188 // Storage: Refungible AccountBalance (r:1 w:1)
188 // Storage: Refungible Owned (r:0 w:1)189 // Storage: Refungible Owned (r:0 w:1)
189 fn transfer_from_removing() -> Weight {190 fn transfer_from_removing() -> Weight {
190 (34_523_000 as Weight)191 (29_966_000 as Weight)
191 .saturating_add(T::DbWeight::get().reads(4 as Weight))192 .saturating_add(T::DbWeight::get().reads(4 as Weight))
192 .saturating_add(T::DbWeight::get().writes(5 as Weight))193 .saturating_add(T::DbWeight::get().writes(5 as Weight))
193 }194 }
196 // Storage: Refungible AccountBalance (r:2 w:2)197 // Storage: Refungible AccountBalance (r:2 w:2)
197 // Storage: Refungible Owned (r:0 w:2)198 // Storage: Refungible Owned (r:0 w:2)
198 fn transfer_from_creating_removing() -> Weight {199 fn transfer_from_creating_removing() -> Weight {
199 (36_749_000 as Weight)200 (31_660_000 as Weight)
200 .saturating_add(T::DbWeight::get().reads(5 as Weight))201 .saturating_add(T::DbWeight::get().reads(5 as Weight))
201 .saturating_add(T::DbWeight::get().writes(7 as Weight))202 .saturating_add(T::DbWeight::get().writes(7 as Weight))
202 }203 }
208 // Storage: Refungible TokenData (r:0 w:1)209 // Storage: Refungible TokenData (r:0 w:1)
209 // Storage: Refungible Owned (r:0 w:1)210 // Storage: Refungible Owned (r:0 w:1)
210 fn burn_from() -> Weight {211 fn burn_from() -> Weight {
211 (42_259_000 as Weight)212 (36_248_000 as Weight)
212 .saturating_add(T::DbWeight::get().reads(5 as Weight))213 .saturating_add(T::DbWeight::get().reads(5 as Weight))
213 .saturating_add(T::DbWeight::get().writes(7 as Weight))214 .saturating_add(T::DbWeight::get().writes(7 as Weight))
214 }215 }
216 // Storage: Refungible TotalSupply (r:1 w:1)
217 // Storage: Refungible Balance (r:1 w:1)
218 fn repartition_item() -> Weight {
219 (8_226_000 as Weight)
220 .saturating_add(T::DbWeight::get().reads(2 as Weight))
221 .saturating_add(T::DbWeight::get().writes(2 as Weight))
222 }
215}223}
216224
217// For backwards compatibility and tests225// For backwards compatibility and tests
223 // Storage: Refungible TokenData (r:0 w:1)231 // Storage: Refungible TokenData (r:0 w:1)
224 // Storage: Refungible Owned (r:0 w:1)232 // Storage: Refungible Owned (r:0 w:1)
225 fn create_item() -> Weight {233 fn create_item() -> Weight {
226 (21_321_000 as Weight)234 (17_553_000 as Weight)
227 .saturating_add(RocksDbWeight::get().reads(2 as Weight))235 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
228 .saturating_add(RocksDbWeight::get().writes(6 as Weight))236 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
229 }237 }
234 // Storage: Refungible TokenData (r:0 w:4)242 // Storage: Refungible TokenData (r:0 w:4)
235 // Storage: Refungible Owned (r:0 w:4)243 // Storage: Refungible Owned (r:0 w:4)
236 fn create_multiple_items(b: u32, ) -> Weight {244 fn create_multiple_items(b: u32, ) -> Weight {
237 (16_313_000 as Weight)245 (10_654_000 as Weight)
238 // Standard Error: 4_000246 // Standard Error: 1_000
239 .saturating_add((5_464_000 as Weight).saturating_mul(b as Weight))247 .saturating_add((5_114_000 as Weight).saturating_mul(b as Weight))
240 .saturating_add(RocksDbWeight::get().reads(2 as Weight))248 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
241 .saturating_add(RocksDbWeight::get().writes(2 as Weight))249 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
242 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))250 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))
248 // Storage: Refungible TokenData (r:0 w:4)256 // Storage: Refungible TokenData (r:0 w:4)
249 // Storage: Refungible Owned (r:0 w:4)257 // Storage: Refungible Owned (r:0 w:4)
250 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {258 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {
251 (15_631_000 as Weight)259 (3_587_000 as Weight)
252 // Standard Error: 5_000260 // Standard Error: 2_000
253 .saturating_add((8_141_000 as Weight).saturating_mul(b as Weight))261 .saturating_add((7_931_000 as Weight).saturating_mul(b as Weight))
254 .saturating_add(RocksDbWeight::get().reads(1 as Weight))262 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
255 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))263 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
256 .saturating_add(RocksDbWeight::get().writes(1 as Weight))264 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
263 // Storage: Refungible Balance (r:0 w:4)271 // Storage: Refungible Balance (r:0 w:4)
264 // Storage: Refungible Owned (r:0 w:4)272 // Storage: Refungible Owned (r:0 w:4)
265 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {273 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {
266 (11_191_000 as Weight)274 (1_980_000 as Weight)
267 // Standard Error: 4_000275 // Standard Error: 2_000
268 .saturating_add((6_321_000 as Weight).saturating_mul(b as Weight))276 .saturating_add((6_305_000 as Weight).saturating_mul(b as Weight))
269 .saturating_add(RocksDbWeight::get().reads(1 as Weight))277 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
270 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))278 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))
271 .saturating_add(RocksDbWeight::get().writes(3 as Weight))279 .saturating_add(RocksDbWeight::get().writes(3 as Weight))
276 // Storage: Refungible AccountBalance (r:1 w:1)284 // Storage: Refungible AccountBalance (r:1 w:1)
277 // Storage: Refungible Owned (r:0 w:1)285 // Storage: Refungible Owned (r:0 w:1)
278 fn burn_item_partial() -> Weight {286 fn burn_item_partial() -> Weight {
279 (24_421_000 as Weight)287 (21_010_000 as Weight)
280 .saturating_add(RocksDbWeight::get().reads(3 as Weight))288 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
281 .saturating_add(RocksDbWeight::get().writes(4 as Weight))289 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
282 }290 }
287 // Storage: Refungible TokenData (r:0 w:1)295 // Storage: Refungible TokenData (r:0 w:1)
288 // Storage: Refungible Owned (r:0 w:1)296 // Storage: Refungible Owned (r:0 w:1)
289 fn burn_item_fully() -> Weight {297 fn burn_item_fully() -> Weight {
290 (32_900_000 as Weight)298 (28_413_000 as Weight)
291 .saturating_add(RocksDbWeight::get().reads(4 as Weight))299 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
292 .saturating_add(RocksDbWeight::get().writes(6 as Weight))300 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
293 }301 }
294 // Storage: Refungible Balance (r:2 w:2)302 // Storage: Refungible Balance (r:2 w:2)
295 fn transfer_normal() -> Weight {303 fn transfer_normal() -> Weight {
296 (20_215_000 as Weight)304 (17_513_000 as Weight)
297 .saturating_add(RocksDbWeight::get().reads(2 as Weight))305 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
298 .saturating_add(RocksDbWeight::get().writes(2 as Weight))306 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
299 }307 }
300 // Storage: Refungible Balance (r:2 w:2)308 // Storage: Refungible Balance (r:2 w:2)
301 // Storage: Refungible AccountBalance (r:1 w:1)309 // Storage: Refungible AccountBalance (r:1 w:1)
302 // Storage: Refungible Owned (r:0 w:1)310 // Storage: Refungible Owned (r:0 w:1)
303 fn transfer_creating() -> Weight {311 fn transfer_creating() -> Weight {
304 (24_809_000 as Weight)312 (20_469_000 as Weight)
305 .saturating_add(RocksDbWeight::get().reads(3 as Weight))313 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
306 .saturating_add(RocksDbWeight::get().writes(4 as Weight))314 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
307 }315 }
308 // Storage: Refungible Balance (r:2 w:2)316 // Storage: Refungible Balance (r:2 w:2)
309 // Storage: Refungible AccountBalance (r:1 w:1)317 // Storage: Refungible AccountBalance (r:1 w:1)
310 // Storage: Refungible Owned (r:0 w:1)318 // Storage: Refungible Owned (r:0 w:1)
311 fn transfer_removing() -> Weight {319 fn transfer_removing() -> Weight {
312 (26_704_000 as Weight)320 (22_472_000 as Weight)
313 .saturating_add(RocksDbWeight::get().reads(3 as Weight))321 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
314 .saturating_add(RocksDbWeight::get().writes(4 as Weight))322 .saturating_add(RocksDbWeight::get().writes(4 as Weight))
315 }323 }
316 // Storage: Refungible Balance (r:2 w:2)324 // Storage: Refungible Balance (r:2 w:2)
317 // Storage: Refungible AccountBalance (r:2 w:2)325 // Storage: Refungible AccountBalance (r:2 w:2)
318 // Storage: Refungible Owned (r:0 w:2)326 // Storage: Refungible Owned (r:0 w:2)
319 fn transfer_creating_removing() -> Weight {327 fn transfer_creating_removing() -> Weight {
320 (28_728_000 as Weight)328 (24_866_000 as Weight)
321 .saturating_add(RocksDbWeight::get().reads(4 as Weight))329 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
322 .saturating_add(RocksDbWeight::get().writes(6 as Weight))330 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
323 }331 }
324 // Storage: Refungible Balance (r:1 w:0)332 // Storage: Refungible Balance (r:1 w:0)
325 // Storage: Refungible Allowance (r:0 w:1)333 // Storage: Refungible Allowance (r:0 w:1)
326 fn approve() -> Weight {334 fn approve() -> Weight {
327 (16_107_000 as Weight)335 (13_475_000 as Weight)
328 .saturating_add(RocksDbWeight::get().reads(1 as Weight))336 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
329 .saturating_add(RocksDbWeight::get().writes(1 as Weight))337 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
330 }338 }
331 // Storage: Refungible Allowance (r:1 w:1)339 // Storage: Refungible Allowance (r:1 w:1)
332 // Storage: Refungible Balance (r:2 w:2)340 // Storage: Refungible Balance (r:2 w:2)
333 fn transfer_from_normal() -> Weight {341 fn transfer_from_normal() -> Weight {
334 (28_765_000 as Weight)342 (24_707_000 as Weight)
335 .saturating_add(RocksDbWeight::get().reads(3 as Weight))343 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
336 .saturating_add(RocksDbWeight::get().writes(3 as Weight))344 .saturating_add(RocksDbWeight::get().writes(3 as Weight))
337 }345 }
340 // Storage: Refungible AccountBalance (r:1 w:1)348 // Storage: Refungible AccountBalance (r:1 w:1)
341 // Storage: Refungible Owned (r:0 w:1)349 // Storage: Refungible Owned (r:0 w:1)
342 fn transfer_from_creating() -> Weight {350 fn transfer_from_creating() -> Weight {
343 (32_788_000 as Weight)351 (27_812_000 as Weight)
344 .saturating_add(RocksDbWeight::get().reads(4 as Weight))352 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
345 .saturating_add(RocksDbWeight::get().writes(5 as Weight))353 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
346 }354 }
349 // Storage: Refungible AccountBalance (r:1 w:1)357 // Storage: Refungible AccountBalance (r:1 w:1)
350 // Storage: Refungible Owned (r:0 w:1)358 // Storage: Refungible Owned (r:0 w:1)
351 fn transfer_from_removing() -> Weight {359 fn transfer_from_removing() -> Weight {
352 (34_523_000 as Weight)360 (29_966_000 as Weight)
353 .saturating_add(RocksDbWeight::get().reads(4 as Weight))361 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
354 .saturating_add(RocksDbWeight::get().writes(5 as Weight))362 .saturating_add(RocksDbWeight::get().writes(5 as Weight))
355 }363 }
358 // Storage: Refungible AccountBalance (r:2 w:2)366 // Storage: Refungible AccountBalance (r:2 w:2)
359 // Storage: Refungible Owned (r:0 w:2)367 // Storage: Refungible Owned (r:0 w:2)
360 fn transfer_from_creating_removing() -> Weight {368 fn transfer_from_creating_removing() -> Weight {
361 (36_749_000 as Weight)369 (31_660_000 as Weight)
362 .saturating_add(RocksDbWeight::get().reads(5 as Weight))370 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
363 .saturating_add(RocksDbWeight::get().writes(7 as Weight))371 .saturating_add(RocksDbWeight::get().writes(7 as Weight))
364 }372 }
370 // Storage: Refungible TokenData (r:0 w:1)378 // Storage: Refungible TokenData (r:0 w:1)
371 // Storage: Refungible Owned (r:0 w:1)379 // Storage: Refungible Owned (r:0 w:1)
372 fn burn_from() -> Weight {380 fn burn_from() -> Weight {
373 (42_259_000 as Weight)381 (36_248_000 as Weight)
374 .saturating_add(RocksDbWeight::get().reads(5 as Weight))382 .saturating_add(RocksDbWeight::get().reads(5 as Weight))
375 .saturating_add(RocksDbWeight::get().writes(7 as Weight))383 .saturating_add(RocksDbWeight::get().writes(7 as Weight))
376 }384 }
385 // Storage: Refungible TotalSupply (r:1 w:1)
386 // Storage: Refungible Balance (r:1 w:1)
387 fn repartition_item() -> Weight {
388 (8_226_000 as Weight)
389 .saturating_add(RocksDbWeight::get().reads(2 as Weight))
390 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
391 }
377}392}
378393
modifiedpallets/unique/Cargo.tomldiffbeforeafterboth
103evm-coder = { default-features = false, path = '../../crates/evm-coder' }103evm-coder = { default-features = false, path = '../../crates/evm-coder' }
104pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }104pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
105pallet-nonfungible = { default-features = false, path = '../../pallets/nonfungible' }105pallet-nonfungible = { default-features = false, path = '../../pallets/nonfungible' }
106pallet-refungible = { default-features = false, path = '../../pallets/refungible' }
107106
modifiedpallets/unique/src/lib.rsdiffbeforeafterboth
45use pallet_evm::account::CrossAccountId;45use pallet_evm::account::CrossAccountId;
46use pallet_common::{46use pallet_common::{
47 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,47 CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,
48 dispatch::CollectionDispatch,48 dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,
49};49};
50use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};
51pub mod eth;50pub mod eth;
5251
53#[cfg(feature = "runtime-benchmarks")]52#[cfg(feature = "runtime-benchmarks")]
72}71}
7372
74pub trait Config:73pub trait Config: system::Config + pallet_common::Config + Sized + TypeInfo {
75 system::Config + pallet_common::Config + pallet_refungible::Config + Sized + TypeInfo
76{
77 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;74 type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
7875
79 /// Weight information for extrinsics in this pallet.76 /// Weight information for extrinsics in this pallet.
80 type WeightInfo: WeightInfo;77 type WeightInfo: WeightInfo;
81 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;78 type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;
79 type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;
82}80}
8381
84decl_event! {82decl_event! {
904 target_collection.save()902 target_collection.save()
905 }903 }
906904
907 #[weight = <SelfWeightOf<T>>::set_collection_limits()]905 #[weight = T::RefungibleExtensionsWeightInfo::repartition()]
908 #[transactional]906 #[transactional]
909 pub fn repartition(907 pub fn repartition(
910 origin,908 origin,
911 collection_id: CollectionId,909 collection_id: CollectionId,
912 token: TokenId,910 token: TokenId,
913 amount: u128,911 amount: u128,
914 ) -> DispatchResult {912 ) -> DispatchResultWithPostInfo {
915 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);913 let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
916 let target_collection = <CollectionHandle<T>>::try_get(collection_id)?;914 dispatch_tx::<T, _>(collection_id, |d| {
917 target_collection.check_is_internal()?;
918 let refungible_collection = match target_collection.mode {915 if let Some(refungible_extensions) = d.refungible_extensions() {
919 CollectionMode::ReFungible => RefungibleHandle::cast(target_collection),916 refungible_extensions.repartition(&sender, token, amount)
917 } else {
920 _ => fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection),918 fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection)
921 };919 }
922 <PalletRefungible<T>>::repartition(&sender, &refungible_collection, token, amount)?;920 })
923 Ok(())
924 }921 }
925 }922 }
926}923}
modifiedpallets/unique/src/weights.rsdiffbeforeafterboth
3//! Autogenerated weights for pallet_unique3//! Autogenerated weights for pallet_unique
4//!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-dev
6//! DATE: 2022-06-15, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`6//! DATE: 2022-06-28, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 10247//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
88
9// Executed Command:9// Executed Command:
57 // Storage: Common CollectionProperties (r:0 w:1)57 // Storage: Common CollectionProperties (r:0 w:1)
58 // Storage: Common CollectionById (r:0 w:1)58 // Storage: Common CollectionById (r:0 w:1)
59 fn create_collection() -> Weight {59 fn create_collection() -> Weight {
60 (39_427_000 as Weight)60 (53_511_000 as Weight)
61 .saturating_add(T::DbWeight::get().reads(4 as Weight))61 .saturating_add(T::DbWeight::get().reads(4 as Weight))
62 .saturating_add(T::DbWeight::get().writes(6 as Weight))62 .saturating_add(T::DbWeight::get().writes(6 as Weight))
63 }63 }
69 // Storage: Common AdminAmount (r:0 w:1)69 // Storage: Common AdminAmount (r:0 w:1)
70 // Storage: Common CollectionProperties (r:0 w:1)70 // Storage: Common CollectionProperties (r:0 w:1)
71 fn destroy_collection() -> Weight {71 fn destroy_collection() -> Weight {
72 (48_339_000 as Weight)72 (69_481_000 as Weight)
73 .saturating_add(T::DbWeight::get().reads(3 as Weight))73 .saturating_add(T::DbWeight::get().reads(3 as Weight))
74 .saturating_add(T::DbWeight::get().writes(6 as Weight))74 .saturating_add(T::DbWeight::get().writes(6 as Weight))
75 }75 }
76 // Storage: Common CollectionById (r:1 w:0)76 // Storage: Common CollectionById (r:1 w:0)
77 // Storage: Common Allowlist (r:0 w:1)77 // Storage: Common Allowlist (r:0 w:1)
78 fn add_to_allow_list() -> Weight {78 fn add_to_allow_list() -> Weight {
79 (17_379_000 as Weight)79 (22_892_000 as Weight)
80 .saturating_add(T::DbWeight::get().reads(1 as Weight))80 .saturating_add(T::DbWeight::get().reads(1 as Weight))
81 .saturating_add(T::DbWeight::get().writes(1 as Weight))81 .saturating_add(T::DbWeight::get().writes(1 as Weight))
82 }82 }
83 // Storage: Common CollectionById (r:1 w:0)83 // Storage: Common CollectionById (r:1 w:0)
84 // Storage: Common Allowlist (r:0 w:1)84 // Storage: Common Allowlist (r:0 w:1)
85 fn remove_from_allow_list() -> Weight {85 fn remove_from_allow_list() -> Weight {
86 (17_490_000 as Weight)86 (22_973_000 as Weight)
87 .saturating_add(T::DbWeight::get().reads(1 as Weight))87 .saturating_add(T::DbWeight::get().reads(1 as Weight))
88 .saturating_add(T::DbWeight::get().writes(1 as Weight))88 .saturating_add(T::DbWeight::get().writes(1 as Weight))
89 }89 }
90 // Storage: Common CollectionById (r:1 w:1)90 // Storage: Common CollectionById (r:1 w:1)
91 fn change_collection_owner() -> Weight {91 fn change_collection_owner() -> Weight {
92 (17_701_000 as Weight)92 (22_392_000 as Weight)
93 .saturating_add(T::DbWeight::get().reads(1 as Weight))93 .saturating_add(T::DbWeight::get().reads(1 as Weight))
94 .saturating_add(T::DbWeight::get().writes(1 as Weight))94 .saturating_add(T::DbWeight::get().writes(1 as Weight))
95 }95 }
96 // Storage: Common CollectionById (r:1 w:0)96 // Storage: Common CollectionById (r:1 w:0)
97 // Storage: Common IsAdmin (r:1 w:1)97 // Storage: Common IsAdmin (r:1 w:1)
98 // Storage: Common AdminAmount (r:1 w:1)98 // Storage: Common AdminAmount (r:1 w:1)
99 fn add_collection_admin() -> Weight {99 fn add_collection_admin() -> Weight {
100 (23_301_000 as Weight)100 (30_298_000 as Weight)
101 .saturating_add(T::DbWeight::get().reads(3 as Weight))101 .saturating_add(T::DbWeight::get().reads(3 as Weight))
102 .saturating_add(T::DbWeight::get().writes(2 as Weight))102 .saturating_add(T::DbWeight::get().writes(2 as Weight))
103 }103 }
104 // Storage: Common CollectionById (r:1 w:0)104 // Storage: Common CollectionById (r:1 w:0)
105 // Storage: Common IsAdmin (r:1 w:1)105 // Storage: Common IsAdmin (r:1 w:1)
106 // Storage: Common AdminAmount (r:1 w:1)106 // Storage: Common AdminAmount (r:1 w:1)
107 fn remove_collection_admin() -> Weight {107 fn remove_collection_admin() -> Weight {
108 (24_859_000 as Weight)108 (32_842_000 as Weight)
109 .saturating_add(T::DbWeight::get().reads(3 as Weight))109 .saturating_add(T::DbWeight::get().reads(3 as Weight))
110 .saturating_add(T::DbWeight::get().writes(2 as Weight))110 .saturating_add(T::DbWeight::get().writes(2 as Weight))
111 }111 }
112 // Storage: Common CollectionById (r:1 w:1)112 // Storage: Common CollectionById (r:1 w:1)
113 fn set_collection_sponsor() -> Weight {113 fn set_collection_sponsor() -> Weight {
114 (17_795_000 as Weight)114 (22_613_000 as Weight)
115 .saturating_add(T::DbWeight::get().reads(1 as Weight))115 .saturating_add(T::DbWeight::get().reads(1 as Weight))
116 .saturating_add(T::DbWeight::get().writes(1 as Weight))116 .saturating_add(T::DbWeight::get().writes(1 as Weight))
117 }117 }
118 // Storage: Common CollectionById (r:1 w:1)118 // Storage: Common CollectionById (r:1 w:1)
119 fn confirm_sponsorship() -> Weight {119 fn confirm_sponsorship() -> Weight {
120 (17_297_000 as Weight)120 (22_462_000 as Weight)
121 .saturating_add(T::DbWeight::get().reads(1 as Weight))121 .saturating_add(T::DbWeight::get().reads(1 as Weight))
122 .saturating_add(T::DbWeight::get().writes(1 as Weight))122 .saturating_add(T::DbWeight::get().writes(1 as Weight))
123 }123 }
124 // Storage: Common CollectionById (r:1 w:1)124 // Storage: Common CollectionById (r:1 w:1)
125 fn remove_collection_sponsor() -> Weight {125 fn remove_collection_sponsor() -> Weight {
126 (17_079_000 as Weight)126 (21_730_000 as Weight)
127 .saturating_add(T::DbWeight::get().reads(1 as Weight))127 .saturating_add(T::DbWeight::get().reads(1 as Weight))
128 .saturating_add(T::DbWeight::get().writes(1 as Weight))128 .saturating_add(T::DbWeight::get().writes(1 as Weight))
129 }129 }
130 // Storage: Common CollectionById (r:1 w:1)130 // Storage: Common CollectionById (r:1 w:1)
131 fn set_transfers_enabled_flag() -> Weight {131 fn set_transfers_enabled_flag() -> Weight {
132 (9_734_000 as Weight)132 (10_941_000 as Weight)
133 .saturating_add(T::DbWeight::get().reads(1 as Weight))133 .saturating_add(T::DbWeight::get().reads(1 as Weight))
134 .saturating_add(T::DbWeight::get().writes(1 as Weight))134 .saturating_add(T::DbWeight::get().writes(1 as Weight))
135 }135 }
136 // Storage: Common CollectionById (r:1 w:1)136 // Storage: Common CollectionById (r:1 w:1)
137 fn set_collection_limits() -> Weight {137 fn set_collection_limits() -> Weight {
138 (17_998_000 as Weight)138 (22_363_000 as Weight)
139 .saturating_add(T::DbWeight::get().reads(1 as Weight))139 .saturating_add(T::DbWeight::get().reads(1 as Weight))
140 .saturating_add(T::DbWeight::get().writes(1 as Weight))140 .saturating_add(T::DbWeight::get().writes(1 as Weight))
141 }141 }
150 // Storage: Common CollectionProperties (r:0 w:1)150 // Storage: Common CollectionProperties (r:0 w:1)
151 // Storage: Common CollectionById (r:0 w:1)151 // Storage: Common CollectionById (r:0 w:1)
152 fn create_collection() -> Weight {152 fn create_collection() -> Weight {
153 (39_427_000 as Weight)153 (53_511_000 as Weight)
154 .saturating_add(RocksDbWeight::get().reads(4 as Weight))154 .saturating_add(RocksDbWeight::get().reads(4 as Weight))
155 .saturating_add(RocksDbWeight::get().writes(6 as Weight))155 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
156 }156 }
162 // Storage: Common AdminAmount (r:0 w:1)162 // Storage: Common AdminAmount (r:0 w:1)
163 // Storage: Common CollectionProperties (r:0 w:1)163 // Storage: Common CollectionProperties (r:0 w:1)
164 fn destroy_collection() -> Weight {164 fn destroy_collection() -> Weight {
165 (48_339_000 as Weight)165 (69_481_000 as Weight)
166 .saturating_add(RocksDbWeight::get().reads(3 as Weight))166 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
167 .saturating_add(RocksDbWeight::get().writes(6 as Weight))167 .saturating_add(RocksDbWeight::get().writes(6 as Weight))
168 }168 }
169 // Storage: Common CollectionById (r:1 w:0)169 // Storage: Common CollectionById (r:1 w:0)
170 // Storage: Common Allowlist (r:0 w:1)170 // Storage: Common Allowlist (r:0 w:1)
171 fn add_to_allow_list() -> Weight {171 fn add_to_allow_list() -> Weight {
172 (17_379_000 as Weight)172 (22_892_000 as Weight)
173 .saturating_add(RocksDbWeight::get().reads(1 as Weight))173 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
174 .saturating_add(RocksDbWeight::get().writes(1 as Weight))174 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
175 }175 }
176 // Storage: Common CollectionById (r:1 w:0)176 // Storage: Common CollectionById (r:1 w:0)
177 // Storage: Common Allowlist (r:0 w:1)177 // Storage: Common Allowlist (r:0 w:1)
178 fn remove_from_allow_list() -> Weight {178 fn remove_from_allow_list() -> Weight {
179 (17_490_000 as Weight)179 (22_973_000 as Weight)
180 .saturating_add(RocksDbWeight::get().reads(1 as Weight))180 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
181 .saturating_add(RocksDbWeight::get().writes(1 as Weight))181 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
182 }182 }
183 // Storage: Common CollectionById (r:1 w:1)183 // Storage: Common CollectionById (r:1 w:1)
184 fn change_collection_owner() -> Weight {184 fn change_collection_owner() -> Weight {
185 (17_701_000 as Weight)185 (22_392_000 as Weight)
186 .saturating_add(RocksDbWeight::get().reads(1 as Weight))186 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
187 .saturating_add(RocksDbWeight::get().writes(1 as Weight))187 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
188 }188 }
189 // Storage: Common CollectionById (r:1 w:0)189 // Storage: Common CollectionById (r:1 w:0)
190 // Storage: Common IsAdmin (r:1 w:1)190 // Storage: Common IsAdmin (r:1 w:1)
191 // Storage: Common AdminAmount (r:1 w:1)191 // Storage: Common AdminAmount (r:1 w:1)
192 fn add_collection_admin() -> Weight {192 fn add_collection_admin() -> Weight {
193 (23_301_000 as Weight)193 (30_298_000 as Weight)
194 .saturating_add(RocksDbWeight::get().reads(3 as Weight))194 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
195 .saturating_add(RocksDbWeight::get().writes(2 as Weight))195 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
196 }196 }
197 // Storage: Common CollectionById (r:1 w:0)197 // Storage: Common CollectionById (r:1 w:0)
198 // Storage: Common IsAdmin (r:1 w:1)198 // Storage: Common IsAdmin (r:1 w:1)
199 // Storage: Common AdminAmount (r:1 w:1)199 // Storage: Common AdminAmount (r:1 w:1)
200 fn remove_collection_admin() -> Weight {200 fn remove_collection_admin() -> Weight {
201 (24_859_000 as Weight)201 (32_842_000 as Weight)
202 .saturating_add(RocksDbWeight::get().reads(3 as Weight))202 .saturating_add(RocksDbWeight::get().reads(3 as Weight))
203 .saturating_add(RocksDbWeight::get().writes(2 as Weight))203 .saturating_add(RocksDbWeight::get().writes(2 as Weight))
204 }204 }
205 // Storage: Common CollectionById (r:1 w:1)205 // Storage: Common CollectionById (r:1 w:1)
206 fn set_collection_sponsor() -> Weight {206 fn set_collection_sponsor() -> Weight {
207 (17_795_000 as Weight)207 (22_613_000 as Weight)
208 .saturating_add(RocksDbWeight::get().reads(1 as Weight))208 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
209 .saturating_add(RocksDbWeight::get().writes(1 as Weight))209 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
210 }210 }
211 // Storage: Common CollectionById (r:1 w:1)211 // Storage: Common CollectionById (r:1 w:1)
212 fn confirm_sponsorship() -> Weight {212 fn confirm_sponsorship() -> Weight {
213 (17_297_000 as Weight)213 (22_462_000 as Weight)
214 .saturating_add(RocksDbWeight::get().reads(1 as Weight))214 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
215 .saturating_add(RocksDbWeight::get().writes(1 as Weight))215 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
216 }216 }
217 // Storage: Common CollectionById (r:1 w:1)217 // Storage: Common CollectionById (r:1 w:1)
218 fn remove_collection_sponsor() -> Weight {218 fn remove_collection_sponsor() -> Weight {
219 (17_079_000 as Weight)219 (21_730_000 as Weight)
220 .saturating_add(RocksDbWeight::get().reads(1 as Weight))220 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
221 .saturating_add(RocksDbWeight::get().writes(1 as Weight))221 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
222 }222 }
223 // Storage: Common CollectionById (r:1 w:1)223 // Storage: Common CollectionById (r:1 w:1)
224 fn set_transfers_enabled_flag() -> Weight {224 fn set_transfers_enabled_flag() -> Weight {
225 (9_734_000 as Weight)225 (10_941_000 as Weight)
226 .saturating_add(RocksDbWeight::get().reads(1 as Weight))226 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
227 .saturating_add(RocksDbWeight::get().writes(1 as Weight))227 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
228 }228 }
229 // Storage: Common CollectionById (r:1 w:1)229 // Storage: Common CollectionById (r:1 w:1)
230 fn set_collection_limits() -> Weight {230 fn set_collection_limits() -> Weight {
231 (17_998_000 as Weight)231 (22_363_000 as Weight)
232 .saturating_add(RocksDbWeight::get().reads(1 as Weight))232 .saturating_add(RocksDbWeight::get().reads(1 as Weight))
233 .saturating_add(RocksDbWeight::get().writes(1 as Weight))233 .saturating_add(RocksDbWeight::get().writes(1 as Weight))
234 }234 }
modifiedruntime/common/src/weights.rsdiffbeforeafterboth
1616
17use core::marker::PhantomData;17use core::marker::PhantomData;
18use frame_support::{weights::Weight};18use frame_support::{weights::Weight};
19use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight};19use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight, RefungibleExtensionsWeightInfo};
2020
21use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};21use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};
22use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};22use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};
23use pallet_refungible::{Config as RefungibleConfig, common::CommonWeights as RefungibleWeights};23use pallet_refungible::{
24 Config as RefungibleConfig, weights::WeightInfo, common::CommonWeights as RefungibleWeights,
25};
24use up_data_structs::{CreateItemExData, CreateItemData};26use up_data_structs::{CreateItemExData, CreateItemData};
2527
99 }101 }
100}102}
103
104impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>
105where
106 T: FungibleConfig + NonfungibleConfig + RefungibleConfig,
107{
108 fn repartition() -> Weight {
109 dispatch_weight::<T>() + <<T as RefungibleConfig>::WeightInfo>::repartition_item()
110 }
111}
101112
modifiedruntime/opal/src/lib.rsdiffbeforeafterboth
925 type Event = Event;925 type Event = Event;
926 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;926 type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
927 type CommonWeightInfo = CommonWeights<Self>;927 type CommonWeightInfo = CommonWeights<Self>;
928 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
928}929}
929930
930parameter_types! {931parameter_types! {
modifiedruntime/tests/src/lib.rsdiffbeforeafterboth
255 type Event = ();255 type Event = ();
256 type WeightInfo = ();256 type WeightInfo = ();
257 type CommonWeightInfo = CommonWeights<Self>;257 type CommonWeightInfo = CommonWeights<Self>;
258 type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
258}259}
259260
260// Build genesis storage according to the mock runtime.261// Build genesis storage according to the mock runtime.
modifiedruntime/tests/src/tests.rsdiffbeforeafterboth
21 CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, TokenId,21 CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, TokenId,
22 MAX_TOKEN_OWNERSHIP, CreateCollectionData, CollectionMode, AccessMode, CollectionPermissions,22 MAX_TOKEN_OWNERSHIP, CreateCollectionData, CollectionMode, AccessMode, CollectionPermissions,
23 PropertyKeyPermission, PropertyPermission, Property, CollectionPropertiesVec,23 PropertyKeyPermission, PropertyPermission, Property, CollectionPropertiesVec,
24 CollectionPropertiesPermissionsVec, TokenChild,24 CollectionPropertiesPermissionsVec,
25};25};
26use frame_support::{assert_noop, assert_ok, assert_err};26use frame_support::{assert_noop, assert_ok, assert_err};
27use sp_std::convert::TryInto;27use sp_std::convert::TryInto;