difftreelog
decoupling of unique and refungible pallets
in: master
16 files changed
.gitignorediffbeforeafterboth--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,7 @@
/.idea/
/.cargo/
+/.vscode/
tests/.vscode
cumulus-parachain/
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6608,7 +6608,6 @@
"pallet-evm",
"pallet-evm-coder-substrate",
"pallet-nonfungible",
- "pallet-refungible",
"parity-scale-codec 3.1.5",
"scale-info",
"serde",
pallets/common/src/lib.rsdiffbeforeafterboth--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -1258,6 +1258,10 @@
}
}
+pub trait RefungibleExtensionsWeightInfo {
+ fn repartition() -> Weight;
+}
+
pub trait CommonCollectionOperations<T: Config> {
fn create_item(
&self,
@@ -1384,6 +1388,19 @@
spender: T::CrossAccountId,
token: TokenId,
) -> u128;
+ fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>>;
+}
+
+pub trait RefungibleExtensions<T>
+where
+ T: Config,
+{
+ fn repartition(
+ &self,
+ owner: &T::CrossAccountId,
+ token: TokenId,
+ amount: u128,
+ ) -> DispatchResultWithPostInfo;
}
// Flexible enough for implementing CommonCollectionOperations
pallets/fungible/src/common.rsdiffbeforeafterboth--- a/pallets/fungible/src/common.rs
+++ b/pallets/fungible/src/common.rs
@@ -18,7 +18,7 @@
use frame_support::{dispatch::DispatchResultWithPostInfo, ensure, fail, weights::Weight, traits::Get};
use up_data_structs::{TokenId, CollectionId, CreateItemExData, budget::Budget, CreateItemData};
-use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
+use pallet_common::{CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight};
use pallet_structure::Error as StructureError;
use sp_runtime::ArithmeticError;
use sp_std::{vec::Vec, vec};
@@ -399,4 +399,8 @@
}
<Allowance<T>>::get((self.id, sender, spender))
}
+
+ fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {
+ None
+ }
}
pallets/nonfungible/src/common.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/common.rs
+++ b/pallets/nonfungible/src/common.rs
@@ -22,7 +22,8 @@
PropertyKeyPermission, PropertyValue,
};
use pallet_common::{
- CommonCollectionOperations, CommonWeightInfo, with_weight, weights::WeightInfo as _,
+ CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight,
+ weights::WeightInfo as _,
};
use sp_runtime::DispatchError;
use sp_std::vec::Vec;
@@ -467,4 +468,8 @@
0
}
}
+
+ fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {
+ None
+ }
}
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -203,4 +203,12 @@
let item = create_max_item(&collection, &owner, [(sender.clone(), 200)])?;
<Pallet<T>>::set_allowance(&collection, &sender, &burner, item, 200)?;
}: {<Pallet<T>>::burn_from(&collection, &burner, &sender, item, 200, &Unlimited)?}
+
+ repartition_item {
+ bench_init!{
+ owner: sub; collection: collection(owner);
+ sender: cross_from_sub(owner); owner: cross_sub;
+ };
+ let item = create_max_item(&collection, &sender, [(owner.clone(), 100)])?;
+ }: {<Pallet<T>>::repartition(&collection, &owner, item, 200)?}
}
pallets/refungible/src/common.rsdiffbeforeafterboth--- a/pallets/refungible/src/common.rs
+++ b/pallets/refungible/src/common.rs
@@ -22,9 +22,9 @@
CollectionId, TokenId, CreateItemExData, CreateRefungibleExData, budget::Budget, Property,
PropertyKey, PropertyValue, PropertyKeyPermission, CreateItemData,
};
-use pallet_common::{CommonCollectionOperations, CommonWeightInfo, with_weight};
+use pallet_common::{CommonCollectionOperations, CommonWeightInfo, RefungibleExtensions, with_weight};
use pallet_structure::Error as StructureError;
-use sp_runtime::DispatchError;
+use sp_runtime::{DispatchError};
use sp_std::{vec::Vec, vec};
use crate::{
@@ -405,4 +405,22 @@
) -> u128 {
<Allowance<T>>::get((self.id, token, sender, spender))
}
+
+ fn refungible_extensions(&self) -> Option<&dyn RefungibleExtensions<T>> {
+ Some(self)
+ }
+}
+
+impl<T: Config> RefungibleExtensions<T> for RefungibleHandle<T> {
+ fn repartition(
+ &self,
+ owner: &T::CrossAccountId,
+ token: TokenId,
+ amount: u128,
+ ) -> DispatchResultWithPostInfo {
+ with_weight(
+ <Pallet<T>>::repartition(self, owner, token, amount),
+ <SelfWeightOf<T>>::repartition_item(),
+ )
+ }
}
pallets/refungible/src/lib.rsdiffbeforeafterboth--- a/pallets/refungible/src/lib.rs
+++ b/pallets/refungible/src/lib.rs
@@ -688,8 +688,8 @@
}
pub fn repartition(
+ collection: &RefungibleHandle<T>,
owner: &T::CrossAccountId,
- collection: &RefungibleHandle<T>,
token: TokenId,
amount: u128,
) -> DispatchResult {
pallets/refungible/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-06-15, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-refungible15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/refungible/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn transfer_from_normal() -> Weight;48 fn transfer_from_creating() -> Weight;49 fn transfer_from_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;51 fn burn_from() -> Weight;52}5354/// Weights for pallet_refungible using the Substrate node and recommended hardware.55pub struct SubstrateWeight<T>(PhantomData<T>);56impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {57 // Storage: Refungible TokensMinted (r:1 w:1)58 // Storage: Refungible AccountBalance (r:1 w:1)59 // Storage: Refungible Balance (r:0 w:1)60 // Storage: Refungible TotalSupply (r:0 w:1)61 // Storage: Refungible TokenData (r:0 w:1)62 // Storage: Refungible Owned (r:0 w:1)63 fn create_item() -> Weight {64 (21_321_000 as Weight)65 .saturating_add(T::DbWeight::get().reads(2 as Weight))66 .saturating_add(T::DbWeight::get().writes(6 as Weight))67 }68 // Storage: Refungible TokensMinted (r:1 w:1)69 // Storage: Refungible AccountBalance (r:1 w:1)70 // Storage: Refungible Balance (r:0 w:4)71 // Storage: Refungible TotalSupply (r:0 w:4)72 // Storage: Refungible TokenData (r:0 w:4)73 // Storage: Refungible Owned (r:0 w:4)74 fn create_multiple_items(b: u32, ) -> Weight {75 (16_313_000 as Weight)76 // Standard Error: 4_00077 .saturating_add((5_464_000 as Weight).saturating_mul(b as Weight))78 .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((4 as Weight).saturating_mul(b as Weight)))81 }82 // Storage: Refungible TokensMinted (r:1 w:1)83 // Storage: Refungible AccountBalance (r:4 w:4)84 // Storage: Refungible Balance (r:0 w:4)85 // Storage: Refungible TotalSupply (r:0 w:4)86 // Storage: Refungible TokenData (r:0 w:4)87 // Storage: Refungible Owned (r:0 w:4)88 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {89 (15_631_000 as Weight)90 // Standard Error: 5_00091 .saturating_add((8_141_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).saturating_mul(b as Weight)))94 .saturating_add(T::DbWeight::get().writes(1 as Weight))95 .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))96 }97 // Storage: Refungible TokensMinted (r:1 w:1)98 // Storage: Refungible TotalSupply (r:0 w:1)99 // Storage: Refungible TokenData (r:0 w:1)100 // Storage: Refungible AccountBalance (r:4 w:4)101 // Storage: Refungible Balance (r:0 w:4)102 // Storage: Refungible Owned (r:0 w:4)103 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {104 (11_191_000 as Weight)105 // Standard Error: 4_000106 .saturating_add((6_321_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).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).saturating_mul(b as Weight)))111 }112 // Storage: Refungible TotalSupply (r:1 w:1)113 // Storage: Refungible Balance (r:1 w:1)114 // Storage: Refungible AccountBalance (r:1 w:1)115 // Storage: Refungible Owned (r:0 w:1)116 fn burn_item_partial() -> Weight {117 (24_421_000 as Weight)118 .saturating_add(T::DbWeight::get().reads(3 as Weight))119 .saturating_add(T::DbWeight::get().writes(4 as Weight))120 }121 // Storage: Refungible TotalSupply (r:1 w:1)122 // Storage: Refungible Balance (r:1 w:1)123 // Storage: Refungible AccountBalance (r:1 w:1)124 // Storage: Refungible TokensBurnt (r:1 w:1)125 // Storage: Refungible TokenData (r:0 w:1)126 // Storage: Refungible Owned (r:0 w:1)127 fn burn_item_fully() -> Weight {128 (32_900_000 as Weight)129 .saturating_add(T::DbWeight::get().reads(4 as Weight))130 .saturating_add(T::DbWeight::get().writes(6 as Weight))131 }132 // Storage: Refungible Balance (r:2 w:2)133 fn transfer_normal() -> Weight {134 (20_215_000 as Weight)135 .saturating_add(T::DbWeight::get().reads(2 as Weight))136 .saturating_add(T::DbWeight::get().writes(2 as Weight))137 }138 // Storage: Refungible Balance (r:2 w:2)139 // Storage: Refungible AccountBalance (r:1 w:1)140 // Storage: Refungible Owned (r:0 w:1)141 fn transfer_creating() -> Weight {142 (24_809_000 as Weight)143 .saturating_add(T::DbWeight::get().reads(3 as Weight))144 .saturating_add(T::DbWeight::get().writes(4 as Weight))145 }146 // Storage: Refungible Balance (r:2 w:2)147 // Storage: Refungible AccountBalance (r:1 w:1)148 // Storage: Refungible Owned (r:0 w:1)149 fn transfer_removing() -> Weight {150 (26_704_000 as Weight)151 .saturating_add(T::DbWeight::get().reads(3 as Weight))152 .saturating_add(T::DbWeight::get().writes(4 as Weight))153 }154 // Storage: Refungible Balance (r:2 w:2)155 // Storage: Refungible AccountBalance (r:2 w:2)156 // Storage: Refungible Owned (r:0 w:2)157 fn transfer_creating_removing() -> Weight {158 (28_728_000 as Weight)159 .saturating_add(T::DbWeight::get().reads(4 as Weight))160 .saturating_add(T::DbWeight::get().writes(6 as Weight))161 }162 // Storage: Refungible Balance (r:1 w:0)163 // Storage: Refungible Allowance (r:0 w:1)164 fn approve() -> Weight {165 (16_107_000 as Weight)166 .saturating_add(T::DbWeight::get().reads(1 as Weight))167 .saturating_add(T::DbWeight::get().writes(1 as Weight))168 }169 // Storage: Refungible Allowance (r:1 w:1)170 // Storage: Refungible Balance (r:2 w:2)171 fn transfer_from_normal() -> Weight {172 (28_765_000 as Weight)173 .saturating_add(T::DbWeight::get().reads(3 as Weight))174 .saturating_add(T::DbWeight::get().writes(3 as Weight))175 }176 // Storage: Refungible Allowance (r:1 w:1)177 // Storage: Refungible Balance (r:2 w:2)178 // Storage: Refungible AccountBalance (r:1 w:1)179 // Storage: Refungible Owned (r:0 w:1)180 fn transfer_from_creating() -> Weight {181 (32_788_000 as Weight)182 .saturating_add(T::DbWeight::get().reads(4 as Weight))183 .saturating_add(T::DbWeight::get().writes(5 as Weight))184 }185 // Storage: Refungible Allowance (r:1 w:1)186 // Storage: Refungible Balance (r:2 w:2)187 // Storage: Refungible AccountBalance (r:1 w:1)188 // Storage: Refungible Owned (r:0 w:1)189 fn transfer_from_removing() -> Weight {190 (34_523_000 as Weight)191 .saturating_add(T::DbWeight::get().reads(4 as Weight))192 .saturating_add(T::DbWeight::get().writes(5 as Weight))193 }194 // Storage: Refungible Allowance (r:1 w:1)195 // Storage: Refungible Balance (r:2 w:2)196 // Storage: Refungible AccountBalance (r:2 w:2)197 // Storage: Refungible Owned (r:0 w:2)198 fn transfer_from_creating_removing() -> Weight {199 (36_749_000 as Weight)200 .saturating_add(T::DbWeight::get().reads(5 as Weight))201 .saturating_add(T::DbWeight::get().writes(7 as Weight))202 }203 // Storage: Refungible Allowance (r:1 w:1)204 // Storage: Refungible TotalSupply (r:1 w:1)205 // Storage: Refungible Balance (r:1 w:1)206 // Storage: Refungible AccountBalance (r:1 w:1)207 // Storage: Refungible TokensBurnt (r:1 w:1)208 // Storage: Refungible TokenData (r:0 w:1)209 // Storage: Refungible Owned (r:0 w:1)210 fn burn_from() -> Weight {211 (42_259_000 as Weight)212 .saturating_add(T::DbWeight::get().reads(5 as Weight))213 .saturating_add(T::DbWeight::get().writes(7 as Weight))214 }215}216217// For backwards compatibility and tests218impl WeightInfo for () {219 // Storage: Refungible TokensMinted (r:1 w:1)220 // Storage: Refungible AccountBalance (r:1 w:1)221 // Storage: Refungible Balance (r:0 w:1)222 // Storage: Refungible TotalSupply (r:0 w:1)223 // Storage: Refungible TokenData (r:0 w:1)224 // Storage: Refungible Owned (r:0 w:1)225 fn create_item() -> Weight {226 (21_321_000 as Weight)227 .saturating_add(RocksDbWeight::get().reads(2 as Weight))228 .saturating_add(RocksDbWeight::get().writes(6 as Weight))229 }230 // Storage: Refungible TokensMinted (r:1 w:1)231 // Storage: Refungible AccountBalance (r:1 w:1)232 // Storage: Refungible Balance (r:0 w:4)233 // Storage: Refungible TotalSupply (r:0 w:4)234 // Storage: Refungible TokenData (r:0 w:4)235 // Storage: Refungible Owned (r:0 w:4)236 fn create_multiple_items(b: u32, ) -> Weight {237 (16_313_000 as Weight)238 // Standard Error: 4_000239 .saturating_add((5_464_000 as Weight).saturating_mul(b as Weight))240 .saturating_add(RocksDbWeight::get().reads(2 as Weight))241 .saturating_add(RocksDbWeight::get().writes(2 as Weight))242 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))243 }244 // Storage: Refungible TokensMinted (r:1 w:1)245 // Storage: Refungible AccountBalance (r:4 w:4)246 // Storage: Refungible Balance (r:0 w:4)247 // Storage: Refungible TotalSupply (r:0 w:4)248 // Storage: Refungible TokenData (r:0 w:4)249 // Storage: Refungible Owned (r:0 w:4)250 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {251 (15_631_000 as Weight)252 // Standard Error: 5_000253 .saturating_add((8_141_000 as Weight).saturating_mul(b as Weight))254 .saturating_add(RocksDbWeight::get().reads(1 as Weight))255 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))256 .saturating_add(RocksDbWeight::get().writes(1 as Weight))257 .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))258 }259 // Storage: Refungible TokensMinted (r:1 w:1)260 // Storage: Refungible TotalSupply (r:0 w:1)261 // Storage: Refungible TokenData (r:0 w:1)262 // Storage: Refungible AccountBalance (r:4 w:4)263 // Storage: Refungible Balance (r:0 w:4)264 // Storage: Refungible Owned (r:0 w:4)265 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {266 (11_191_000 as Weight)267 // Standard Error: 4_000268 .saturating_add((6_321_000 as Weight).saturating_mul(b as Weight))269 .saturating_add(RocksDbWeight::get().reads(1 as Weight))270 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))271 .saturating_add(RocksDbWeight::get().writes(3 as Weight))272 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))273 }274 // Storage: Refungible TotalSupply (r:1 w:1)275 // Storage: Refungible Balance (r:1 w:1)276 // Storage: Refungible AccountBalance (r:1 w:1)277 // Storage: Refungible Owned (r:0 w:1)278 fn burn_item_partial() -> Weight {279 (24_421_000 as Weight)280 .saturating_add(RocksDbWeight::get().reads(3 as Weight))281 .saturating_add(RocksDbWeight::get().writes(4 as Weight))282 }283 // Storage: Refungible TotalSupply (r:1 w:1)284 // Storage: Refungible Balance (r:1 w:1)285 // Storage: Refungible AccountBalance (r:1 w:1)286 // Storage: Refungible TokensBurnt (r:1 w:1)287 // Storage: Refungible TokenData (r:0 w:1)288 // Storage: Refungible Owned (r:0 w:1)289 fn burn_item_fully() -> Weight {290 (32_900_000 as Weight)291 .saturating_add(RocksDbWeight::get().reads(4 as Weight))292 .saturating_add(RocksDbWeight::get().writes(6 as Weight))293 }294 // Storage: Refungible Balance (r:2 w:2)295 fn transfer_normal() -> Weight {296 (20_215_000 as Weight)297 .saturating_add(RocksDbWeight::get().reads(2 as Weight))298 .saturating_add(RocksDbWeight::get().writes(2 as Weight))299 }300 // Storage: Refungible Balance (r:2 w:2)301 // Storage: Refungible AccountBalance (r:1 w:1)302 // Storage: Refungible Owned (r:0 w:1)303 fn transfer_creating() -> Weight {304 (24_809_000 as Weight)305 .saturating_add(RocksDbWeight::get().reads(3 as Weight))306 .saturating_add(RocksDbWeight::get().writes(4 as Weight))307 }308 // Storage: Refungible Balance (r:2 w:2)309 // Storage: Refungible AccountBalance (r:1 w:1)310 // Storage: Refungible Owned (r:0 w:1)311 fn transfer_removing() -> Weight {312 (26_704_000 as Weight)313 .saturating_add(RocksDbWeight::get().reads(3 as Weight))314 .saturating_add(RocksDbWeight::get().writes(4 as Weight))315 }316 // Storage: Refungible Balance (r:2 w:2)317 // Storage: Refungible AccountBalance (r:2 w:2)318 // Storage: Refungible Owned (r:0 w:2)319 fn transfer_creating_removing() -> Weight {320 (28_728_000 as Weight)321 .saturating_add(RocksDbWeight::get().reads(4 as Weight))322 .saturating_add(RocksDbWeight::get().writes(6 as Weight))323 }324 // Storage: Refungible Balance (r:1 w:0)325 // Storage: Refungible Allowance (r:0 w:1)326 fn approve() -> Weight {327 (16_107_000 as Weight)328 .saturating_add(RocksDbWeight::get().reads(1 as Weight))329 .saturating_add(RocksDbWeight::get().writes(1 as Weight))330 }331 // Storage: Refungible Allowance (r:1 w:1)332 // Storage: Refungible Balance (r:2 w:2)333 fn transfer_from_normal() -> Weight {334 (28_765_000 as Weight)335 .saturating_add(RocksDbWeight::get().reads(3 as Weight))336 .saturating_add(RocksDbWeight::get().writes(3 as Weight))337 }338 // Storage: Refungible Allowance (r:1 w:1)339 // Storage: Refungible Balance (r:2 w:2)340 // Storage: Refungible AccountBalance (r:1 w:1)341 // Storage: Refungible Owned (r:0 w:1)342 fn transfer_from_creating() -> Weight {343 (32_788_000 as Weight)344 .saturating_add(RocksDbWeight::get().reads(4 as Weight))345 .saturating_add(RocksDbWeight::get().writes(5 as Weight))346 }347 // Storage: Refungible Allowance (r:1 w:1)348 // Storage: Refungible Balance (r:2 w:2)349 // Storage: Refungible AccountBalance (r:1 w:1)350 // Storage: Refungible Owned (r:0 w:1)351 fn transfer_from_removing() -> Weight {352 (34_523_000 as Weight)353 .saturating_add(RocksDbWeight::get().reads(4 as Weight))354 .saturating_add(RocksDbWeight::get().writes(5 as Weight))355 }356 // Storage: Refungible Allowance (r:1 w:1)357 // Storage: Refungible Balance (r:2 w:2)358 // Storage: Refungible AccountBalance (r:2 w:2)359 // Storage: Refungible Owned (r:0 w:2)360 fn transfer_from_creating_removing() -> Weight {361 (36_749_000 as Weight)362 .saturating_add(RocksDbWeight::get().reads(5 as Weight))363 .saturating_add(RocksDbWeight::get().writes(7 as Weight))364 }365 // Storage: Refungible Allowance (r:1 w:1)366 // Storage: Refungible TotalSupply (r:1 w:1)367 // Storage: Refungible Balance (r:1 w:1)368 // Storage: Refungible AccountBalance (r:1 w:1)369 // Storage: Refungible TokensBurnt (r:1 w:1)370 // Storage: Refungible TokenData (r:0 w:1)371 // Storage: Refungible Owned (r:0 w:1)372 fn burn_from() -> Weight {373 (42_259_000 as Weight)374 .saturating_add(RocksDbWeight::get().reads(5 as Weight))375 .saturating_add(RocksDbWeight::get().writes(7 as Weight))376 }377}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_refungible4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-06-27, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-refungible15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/refungible/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(clippy::unnecessary_cast)]3031use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};32use sp_std::marker::PhantomData;3334/// Weight functions needed for pallet_refungible.35pub trait WeightInfo {36 fn create_item() -> Weight;37 fn create_multiple_items(b: u32, ) -> Weight;38 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight;39 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight;40 fn burn_item_partial() -> Weight;41 fn burn_item_fully() -> Weight;42 fn transfer_normal() -> Weight;43 fn transfer_creating() -> Weight;44 fn transfer_removing() -> Weight;45 fn transfer_creating_removing() -> Weight;46 fn approve() -> Weight;47 fn transfer_from_normal() -> Weight;48 fn transfer_from_creating() -> Weight;49 fn transfer_from_removing() -> Weight;50 fn transfer_from_creating_removing() -> Weight;51 fn burn_from() -> Weight;52 fn repartition_item() -> Weight;53}5455/// Weights for pallet_refungible using the Substrate node and recommended hardware.56pub struct SubstrateWeight<T>(PhantomData<T>);57impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {58 // Storage: Refungible TokensMinted (r:1 w:1)59 // Storage: Refungible AccountBalance (r:1 w:1)60 // Storage: Refungible Balance (r:0 w:1)61 // Storage: Refungible TotalSupply (r:0 w:1)62 // Storage: Refungible TokenData (r:0 w:1)63 // Storage: Refungible Owned (r:0 w:1)64 fn create_item() -> Weight {65 (17_553_000 as Weight)66 .saturating_add(T::DbWeight::get().reads(2 as Weight))67 .saturating_add(T::DbWeight::get().writes(6 as Weight))68 }69 // Storage: Refungible TokensMinted (r:1 w:1)70 // Storage: Refungible AccountBalance (r:1 w:1)71 // Storage: Refungible Balance (r:0 w:4)72 // Storage: Refungible TotalSupply (r:0 w:4)73 // Storage: Refungible TokenData (r:0 w:4)74 // Storage: Refungible Owned (r:0 w:4)75 fn create_multiple_items(b: u32, ) -> Weight {76 (10_654_000 as Weight)77 // Standard Error: 1_00078 .saturating_add((5_114_000 as Weight).saturating_mul(b as Weight))79 .saturating_add(T::DbWeight::get().reads(2 as Weight))80 .saturating_add(T::DbWeight::get().writes(2 as Weight))81 .saturating_add(T::DbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))82 }83 // Storage: Refungible TokensMinted (r:1 w:1)84 // Storage: Refungible AccountBalance (r:4 w:4)85 // Storage: Refungible Balance (r:0 w:4)86 // Storage: Refungible TotalSupply (r:0 w:4)87 // Storage: Refungible TokenData (r:0 w:4)88 // Storage: Refungible Owned (r:0 w:4)89 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {90 (3_587_000 as Weight)91 // Standard Error: 2_00092 .saturating_add((7_931_000 as Weight).saturating_mul(b as Weight))93 .saturating_add(T::DbWeight::get().reads(1 as Weight))94 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))95 .saturating_add(T::DbWeight::get().writes(1 as Weight))96 .saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))97 }98 // Storage: Refungible TokensMinted (r:1 w:1)99 // Storage: Refungible TotalSupply (r:0 w:1)100 // Storage: Refungible TokenData (r:0 w:1)101 // Storage: Refungible AccountBalance (r:4 w:4)102 // Storage: Refungible Balance (r:0 w:4)103 // Storage: Refungible Owned (r:0 w:4)104 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {105 (1_980_000 as Weight)106 // Standard Error: 2_000107 .saturating_add((6_305_000 as Weight).saturating_mul(b as Weight))108 .saturating_add(T::DbWeight::get().reads(1 as Weight))109 .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))110 .saturating_add(T::DbWeight::get().writes(3 as Weight))111 .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))112 }113 // Storage: Refungible TotalSupply (r:1 w:1)114 // Storage: Refungible Balance (r:1 w:1)115 // Storage: Refungible AccountBalance (r:1 w:1)116 // Storage: Refungible Owned (r:0 w:1)117 fn burn_item_partial() -> Weight {118 (21_010_000 as Weight)119 .saturating_add(T::DbWeight::get().reads(3 as Weight))120 .saturating_add(T::DbWeight::get().writes(4 as Weight))121 }122 // Storage: Refungible TotalSupply (r:1 w:1)123 // Storage: Refungible Balance (r:1 w:1)124 // Storage: Refungible AccountBalance (r:1 w:1)125 // Storage: Refungible TokensBurnt (r:1 w:1)126 // Storage: Refungible TokenData (r:0 w:1)127 // Storage: Refungible Owned (r:0 w:1)128 fn burn_item_fully() -> Weight {129 (28_413_000 as Weight)130 .saturating_add(T::DbWeight::get().reads(4 as Weight))131 .saturating_add(T::DbWeight::get().writes(6 as Weight))132 }133 // Storage: Refungible Balance (r:2 w:2)134 fn transfer_normal() -> Weight {135 (17_513_000 as Weight)136 .saturating_add(T::DbWeight::get().reads(2 as Weight))137 .saturating_add(T::DbWeight::get().writes(2 as Weight))138 }139 // Storage: Refungible Balance (r:2 w:2)140 // Storage: Refungible AccountBalance (r:1 w:1)141 // Storage: Refungible Owned (r:0 w:1)142 fn transfer_creating() -> Weight {143 (20_469_000 as Weight)144 .saturating_add(T::DbWeight::get().reads(3 as Weight))145 .saturating_add(T::DbWeight::get().writes(4 as Weight))146 }147 // Storage: Refungible Balance (r:2 w:2)148 // Storage: Refungible AccountBalance (r:1 w:1)149 // Storage: Refungible Owned (r:0 w:1)150 fn transfer_removing() -> Weight {151 (22_472_000 as Weight)152 .saturating_add(T::DbWeight::get().reads(3 as Weight))153 .saturating_add(T::DbWeight::get().writes(4 as Weight))154 }155 // Storage: Refungible Balance (r:2 w:2)156 // Storage: Refungible AccountBalance (r:2 w:2)157 // Storage: Refungible Owned (r:0 w:2)158 fn transfer_creating_removing() -> Weight {159 (24_866_000 as Weight)160 .saturating_add(T::DbWeight::get().reads(4 as Weight))161 .saturating_add(T::DbWeight::get().writes(6 as Weight))162 }163 // Storage: Refungible Balance (r:1 w:0)164 // Storage: Refungible Allowance (r:0 w:1)165 fn approve() -> Weight {166 (13_475_000 as Weight)167 .saturating_add(T::DbWeight::get().reads(1 as Weight))168 .saturating_add(T::DbWeight::get().writes(1 as Weight))169 }170 // Storage: Refungible Allowance (r:1 w:1)171 // Storage: Refungible Balance (r:2 w:2)172 fn transfer_from_normal() -> Weight {173 (24_707_000 as Weight)174 .saturating_add(T::DbWeight::get().reads(3 as Weight))175 .saturating_add(T::DbWeight::get().writes(3 as Weight))176 }177 // Storage: Refungible Allowance (r:1 w:1)178 // Storage: Refungible Balance (r:2 w:2)179 // Storage: Refungible AccountBalance (r:1 w:1)180 // Storage: Refungible Owned (r:0 w:1)181 fn transfer_from_creating() -> Weight {182 (27_812_000 as Weight)183 .saturating_add(T::DbWeight::get().reads(4 as Weight))184 .saturating_add(T::DbWeight::get().writes(5 as Weight))185 }186 // Storage: Refungible Allowance (r:1 w:1)187 // Storage: Refungible Balance (r:2 w:2)188 // Storage: Refungible AccountBalance (r:1 w:1)189 // Storage: Refungible Owned (r:0 w:1)190 fn transfer_from_removing() -> Weight {191 (29_966_000 as Weight)192 .saturating_add(T::DbWeight::get().reads(4 as Weight))193 .saturating_add(T::DbWeight::get().writes(5 as Weight))194 }195 // Storage: Refungible Allowance (r:1 w:1)196 // Storage: Refungible Balance (r:2 w:2)197 // Storage: Refungible AccountBalance (r:2 w:2)198 // Storage: Refungible Owned (r:0 w:2)199 fn transfer_from_creating_removing() -> Weight {200 (31_660_000 as Weight)201 .saturating_add(T::DbWeight::get().reads(5 as Weight))202 .saturating_add(T::DbWeight::get().writes(7 as Weight))203 }204 // Storage: Refungible Allowance (r:1 w:1)205 // Storage: Refungible TotalSupply (r:1 w:1)206 // Storage: Refungible Balance (r:1 w:1)207 // Storage: Refungible AccountBalance (r:1 w:1)208 // Storage: Refungible TokensBurnt (r:1 w:1)209 // Storage: Refungible TokenData (r:0 w:1)210 // Storage: Refungible Owned (r:0 w:1)211 fn burn_from() -> Weight {212 (36_248_000 as Weight)213 .saturating_add(T::DbWeight::get().reads(5 as Weight))214 .saturating_add(T::DbWeight::get().writes(7 as Weight))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 }223}224225// For backwards compatibility and tests226impl WeightInfo for () {227 // Storage: Refungible TokensMinted (r:1 w:1)228 // Storage: Refungible AccountBalance (r:1 w:1)229 // Storage: Refungible Balance (r:0 w:1)230 // Storage: Refungible TotalSupply (r:0 w:1)231 // Storage: Refungible TokenData (r:0 w:1)232 // Storage: Refungible Owned (r:0 w:1)233 fn create_item() -> Weight {234 (17_553_000 as Weight)235 .saturating_add(RocksDbWeight::get().reads(2 as Weight))236 .saturating_add(RocksDbWeight::get().writes(6 as Weight))237 }238 // Storage: Refungible TokensMinted (r:1 w:1)239 // Storage: Refungible AccountBalance (r:1 w:1)240 // Storage: Refungible Balance (r:0 w:4)241 // Storage: Refungible TotalSupply (r:0 w:4)242 // Storage: Refungible TokenData (r:0 w:4)243 // Storage: Refungible Owned (r:0 w:4)244 fn create_multiple_items(b: u32, ) -> Weight {245 (10_654_000 as Weight)246 // Standard Error: 1_000247 .saturating_add((5_114_000 as Weight).saturating_mul(b as Weight))248 .saturating_add(RocksDbWeight::get().reads(2 as Weight))249 .saturating_add(RocksDbWeight::get().writes(2 as Weight))250 .saturating_add(RocksDbWeight::get().writes((4 as Weight).saturating_mul(b as Weight)))251 }252 // Storage: Refungible TokensMinted (r:1 w:1)253 // Storage: Refungible AccountBalance (r:4 w:4)254 // Storage: Refungible Balance (r:0 w:4)255 // Storage: Refungible TotalSupply (r:0 w:4)256 // Storage: Refungible TokenData (r:0 w:4)257 // Storage: Refungible Owned (r:0 w:4)258 fn create_multiple_items_ex_multiple_items(b: u32, ) -> Weight {259 (3_587_000 as Weight)260 // Standard Error: 2_000261 .saturating_add((7_931_000 as Weight).saturating_mul(b as Weight))262 .saturating_add(RocksDbWeight::get().reads(1 as Weight))263 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))264 .saturating_add(RocksDbWeight::get().writes(1 as Weight))265 .saturating_add(RocksDbWeight::get().writes((5 as Weight).saturating_mul(b as Weight)))266 }267 // Storage: Refungible TokensMinted (r:1 w:1)268 // Storage: Refungible TotalSupply (r:0 w:1)269 // Storage: Refungible TokenData (r:0 w:1)270 // Storage: Refungible AccountBalance (r:4 w:4)271 // Storage: Refungible Balance (r:0 w:4)272 // Storage: Refungible Owned (r:0 w:4)273 fn create_multiple_items_ex_multiple_owners(b: u32, ) -> Weight {274 (1_980_000 as Weight)275 // Standard Error: 2_000276 .saturating_add((6_305_000 as Weight).saturating_mul(b as Weight))277 .saturating_add(RocksDbWeight::get().reads(1 as Weight))278 .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(b as Weight)))279 .saturating_add(RocksDbWeight::get().writes(3 as Weight))280 .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))281 }282 // Storage: Refungible TotalSupply (r:1 w:1)283 // Storage: Refungible Balance (r:1 w:1)284 // Storage: Refungible AccountBalance (r:1 w:1)285 // Storage: Refungible Owned (r:0 w:1)286 fn burn_item_partial() -> Weight {287 (21_010_000 as Weight)288 .saturating_add(RocksDbWeight::get().reads(3 as Weight))289 .saturating_add(RocksDbWeight::get().writes(4 as Weight))290 }291 // Storage: Refungible TotalSupply (r:1 w:1)292 // Storage: Refungible Balance (r:1 w:1)293 // Storage: Refungible AccountBalance (r:1 w:1)294 // Storage: Refungible TokensBurnt (r:1 w:1)295 // Storage: Refungible TokenData (r:0 w:1)296 // Storage: Refungible Owned (r:0 w:1)297 fn burn_item_fully() -> Weight {298 (28_413_000 as Weight)299 .saturating_add(RocksDbWeight::get().reads(4 as Weight))300 .saturating_add(RocksDbWeight::get().writes(6 as Weight))301 }302 // Storage: Refungible Balance (r:2 w:2)303 fn transfer_normal() -> Weight {304 (17_513_000 as Weight)305 .saturating_add(RocksDbWeight::get().reads(2 as Weight))306 .saturating_add(RocksDbWeight::get().writes(2 as Weight))307 }308 // Storage: Refungible Balance (r:2 w:2)309 // Storage: Refungible AccountBalance (r:1 w:1)310 // Storage: Refungible Owned (r:0 w:1)311 fn transfer_creating() -> Weight {312 (20_469_000 as Weight)313 .saturating_add(RocksDbWeight::get().reads(3 as Weight))314 .saturating_add(RocksDbWeight::get().writes(4 as Weight))315 }316 // Storage: Refungible Balance (r:2 w:2)317 // Storage: Refungible AccountBalance (r:1 w:1)318 // Storage: Refungible Owned (r:0 w:1)319 fn transfer_removing() -> Weight {320 (22_472_000 as Weight)321 .saturating_add(RocksDbWeight::get().reads(3 as Weight))322 .saturating_add(RocksDbWeight::get().writes(4 as Weight))323 }324 // Storage: Refungible Balance (r:2 w:2)325 // Storage: Refungible AccountBalance (r:2 w:2)326 // Storage: Refungible Owned (r:0 w:2)327 fn transfer_creating_removing() -> Weight {328 (24_866_000 as Weight)329 .saturating_add(RocksDbWeight::get().reads(4 as Weight))330 .saturating_add(RocksDbWeight::get().writes(6 as Weight))331 }332 // Storage: Refungible Balance (r:1 w:0)333 // Storage: Refungible Allowance (r:0 w:1)334 fn approve() -> Weight {335 (13_475_000 as Weight)336 .saturating_add(RocksDbWeight::get().reads(1 as Weight))337 .saturating_add(RocksDbWeight::get().writes(1 as Weight))338 }339 // Storage: Refungible Allowance (r:1 w:1)340 // Storage: Refungible Balance (r:2 w:2)341 fn transfer_from_normal() -> Weight {342 (24_707_000 as Weight)343 .saturating_add(RocksDbWeight::get().reads(3 as Weight))344 .saturating_add(RocksDbWeight::get().writes(3 as Weight))345 }346 // Storage: Refungible Allowance (r:1 w:1)347 // Storage: Refungible Balance (r:2 w:2)348 // Storage: Refungible AccountBalance (r:1 w:1)349 // Storage: Refungible Owned (r:0 w:1)350 fn transfer_from_creating() -> Weight {351 (27_812_000 as Weight)352 .saturating_add(RocksDbWeight::get().reads(4 as Weight))353 .saturating_add(RocksDbWeight::get().writes(5 as Weight))354 }355 // Storage: Refungible Allowance (r:1 w:1)356 // Storage: Refungible Balance (r:2 w:2)357 // Storage: Refungible AccountBalance (r:1 w:1)358 // Storage: Refungible Owned (r:0 w:1)359 fn transfer_from_removing() -> Weight {360 (29_966_000 as Weight)361 .saturating_add(RocksDbWeight::get().reads(4 as Weight))362 .saturating_add(RocksDbWeight::get().writes(5 as Weight))363 }364 // Storage: Refungible Allowance (r:1 w:1)365 // Storage: Refungible Balance (r:2 w:2)366 // Storage: Refungible AccountBalance (r:2 w:2)367 // Storage: Refungible Owned (r:0 w:2)368 fn transfer_from_creating_removing() -> Weight {369 (31_660_000 as Weight)370 .saturating_add(RocksDbWeight::get().reads(5 as Weight))371 .saturating_add(RocksDbWeight::get().writes(7 as Weight))372 }373 // Storage: Refungible Allowance (r:1 w:1)374 // Storage: Refungible TotalSupply (r:1 w:1)375 // Storage: Refungible Balance (r:1 w:1)376 // Storage: Refungible AccountBalance (r:1 w:1)377 // Storage: Refungible TokensBurnt (r:1 w:1)378 // Storage: Refungible TokenData (r:0 w:1)379 // Storage: Refungible Owned (r:0 w:1)380 fn burn_from() -> Weight {381 (36_248_000 as Weight)382 .saturating_add(RocksDbWeight::get().reads(5 as Weight))383 .saturating_add(RocksDbWeight::get().writes(7 as Weight))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 }392}pallets/unique/Cargo.tomldiffbeforeafterboth--- a/pallets/unique/Cargo.toml
+++ b/pallets/unique/Cargo.toml
@@ -103,4 +103,3 @@
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
pallet-evm-coder-substrate = { default-features = false, path = '../../pallets/evm-coder-substrate' }
pallet-nonfungible = { default-features = false, path = '../../pallets/nonfungible' }
-pallet-refungible = { default-features = false, path = '../../pallets/refungible' }
pallets/unique/src/lib.rsdiffbeforeafterboth--- a/pallets/unique/src/lib.rs
+++ b/pallets/unique/src/lib.rs
@@ -45,9 +45,8 @@
use pallet_evm::account::CrossAccountId;
use pallet_common::{
CollectionHandle, Pallet as PalletCommon, CommonWeightInfo, dispatch::dispatch_tx,
- dispatch::CollectionDispatch,
+ dispatch::CollectionDispatch, RefungibleExtensionsWeightInfo,
};
-use pallet_refungible::{Pallet as PalletRefungible, RefungibleHandle};
pub mod eth;
#[cfg(feature = "runtime-benchmarks")]
@@ -71,14 +70,13 @@
}
}
-pub trait Config:
- system::Config + pallet_common::Config + pallet_refungible::Config + Sized + TypeInfo
-{
+pub trait Config: system::Config + pallet_common::Config + Sized + TypeInfo {
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
type CommonWeightInfo: CommonWeightInfo<Self::CrossAccountId>;
+ type RefungibleExtensionsWeightInfo: RefungibleExtensionsWeightInfo;
}
decl_event! {
@@ -904,23 +902,22 @@
target_collection.save()
}
- #[weight = <SelfWeightOf<T>>::set_collection_limits()]
+ #[weight = T::RefungibleExtensionsWeightInfo::repartition()]
#[transactional]
pub fn repartition(
origin,
collection_id: CollectionId,
token: TokenId,
amount: u128,
- ) -> DispatchResult {
+ ) -> DispatchResultWithPostInfo {
let sender = T::CrossAccountId::from_sub(ensure_signed(origin)?);
- let target_collection = <CollectionHandle<T>>::try_get(collection_id)?;
- target_collection.check_is_internal()?;
- let refungible_collection = match target_collection.mode {
- CollectionMode::ReFungible => RefungibleHandle::cast(target_collection),
- _ => fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection),
- };
- <PalletRefungible<T>>::repartition(&sender, &refungible_collection, token, amount)?;
- Ok(())
+ dispatch_tx::<T, _>(collection_id, |d| {
+ if let Some(refungible_extensions) = d.refungible_extensions() {
+ refungible_extensions.repartition(&sender, token, amount)
+ } else {
+ fail!(<Error<T>>::RepartitionCalledOnNonRefungibleCollection)
+ }
+ })
}
}
}
pallets/unique/src/weights.rsdiffbeforeafterboth--- a/pallets/unique/src/weights.rs
+++ b/pallets/unique/src/weights.rs
@@ -3,7 +3,7 @@
//! Autogenerated weights for pallet_unique
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2022-06-15, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2022-06-28, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024
// Executed Command:
@@ -57,7 +57,7 @@
// Storage: Common CollectionProperties (r:0 w:1)
// Storage: Common CollectionById (r:0 w:1)
fn create_collection() -> Weight {
- (39_427_000 as Weight)
+ (53_511_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
@@ -69,27 +69,27 @@
// Storage: Common AdminAmount (r:0 w:1)
// Storage: Common CollectionProperties (r:0 w:1)
fn destroy_collection() -> Weight {
- (48_339_000 as Weight)
+ (69_481_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
// Storage: Common CollectionById (r:1 w:0)
// Storage: Common Allowlist (r:0 w:1)
fn add_to_allow_list() -> Weight {
- (17_379_000 as Weight)
+ (22_892_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:0)
// Storage: Common Allowlist (r:0 w:1)
fn remove_from_allow_list() -> Weight {
- (17_490_000 as Weight)
+ (22_973_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn change_collection_owner() -> Weight {
- (17_701_000 as Weight)
+ (22_392_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -97,7 +97,7 @@
// Storage: Common IsAdmin (r:1 w:1)
// Storage: Common AdminAmount (r:1 w:1)
fn add_collection_admin() -> Weight {
- (23_301_000 as Weight)
+ (30_298_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
@@ -105,37 +105,37 @@
// Storage: Common IsAdmin (r:1 w:1)
// Storage: Common AdminAmount (r:1 w:1)
fn remove_collection_admin() -> Weight {
- (24_859_000 as Weight)
+ (32_842_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn set_collection_sponsor() -> Weight {
- (17_795_000 as Weight)
+ (22_613_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn confirm_sponsorship() -> Weight {
- (17_297_000 as Weight)
+ (22_462_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn remove_collection_sponsor() -> Weight {
- (17_079_000 as Weight)
+ (21_730_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn set_transfers_enabled_flag() -> Weight {
- (9_734_000 as Weight)
+ (10_941_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn set_collection_limits() -> Weight {
- (17_998_000 as Weight)
+ (22_363_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -150,7 +150,7 @@
// Storage: Common CollectionProperties (r:0 w:1)
// Storage: Common CollectionById (r:0 w:1)
fn create_collection() -> Weight {
- (39_427_000 as Weight)
+ (53_511_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
@@ -162,27 +162,27 @@
// Storage: Common AdminAmount (r:0 w:1)
// Storage: Common CollectionProperties (r:0 w:1)
fn destroy_collection() -> Weight {
- (48_339_000 as Weight)
+ (69_481_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
}
// Storage: Common CollectionById (r:1 w:0)
// Storage: Common Allowlist (r:0 w:1)
fn add_to_allow_list() -> Weight {
- (17_379_000 as Weight)
+ (22_892_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:0)
// Storage: Common Allowlist (r:0 w:1)
fn remove_from_allow_list() -> Weight {
- (17_490_000 as Weight)
+ (22_973_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn change_collection_owner() -> Weight {
- (17_701_000 as Weight)
+ (22_392_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -190,7 +190,7 @@
// Storage: Common IsAdmin (r:1 w:1)
// Storage: Common AdminAmount (r:1 w:1)
fn add_collection_admin() -> Weight {
- (23_301_000 as Weight)
+ (30_298_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
@@ -198,37 +198,37 @@
// Storage: Common IsAdmin (r:1 w:1)
// Storage: Common AdminAmount (r:1 w:1)
fn remove_collection_admin() -> Weight {
- (24_859_000 as Weight)
+ (32_842_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn set_collection_sponsor() -> Weight {
- (17_795_000 as Weight)
+ (22_613_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn confirm_sponsorship() -> Weight {
- (17_297_000 as Weight)
+ (22_462_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn remove_collection_sponsor() -> Weight {
- (17_079_000 as Weight)
+ (21_730_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn set_transfers_enabled_flag() -> Weight {
- (9_734_000 as Weight)
+ (10_941_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
// Storage: Common CollectionById (r:1 w:1)
fn set_collection_limits() -> Weight {
- (17_998_000 as Weight)
+ (22_363_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
runtime/common/src/weights.rsdiffbeforeafterboth--- a/runtime/common/src/weights.rs
+++ b/runtime/common/src/weights.rs
@@ -16,11 +16,13 @@
use core::marker::PhantomData;
use frame_support::{weights::Weight};
-use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight};
+use pallet_common::{CommonWeightInfo, dispatch::dispatch_weight, RefungibleExtensionsWeightInfo};
use pallet_fungible::{Config as FungibleConfig, common::CommonWeights as FungibleWeights};
use pallet_nonfungible::{Config as NonfungibleConfig, common::CommonWeights as NonfungibleWeights};
-use pallet_refungible::{Config as RefungibleConfig, common::CommonWeights as RefungibleWeights};
+use pallet_refungible::{
+ Config as RefungibleConfig, weights::WeightInfo, common::CommonWeights as RefungibleWeights,
+};
use up_data_structs::{CreateItemExData, CreateItemData};
macro_rules! max_weight_of {
@@ -98,3 +100,12 @@
max_weight_of!(burn_recursively_breadth_raw(amount))
}
}
+
+impl<T> RefungibleExtensionsWeightInfo for CommonWeights<T>
+where
+ T: FungibleConfig + NonfungibleConfig + RefungibleConfig,
+{
+ fn repartition() -> Weight {
+ dispatch_weight::<T>() + <<T as RefungibleConfig>::WeightInfo>::repartition_item()
+ }
+}
runtime/opal/src/lib.rsdiffbeforeafterboth--- a/runtime/opal/src/lib.rs
+++ b/runtime/opal/src/lib.rs
@@ -925,6 +925,7 @@
type Event = Event;
type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
type CommonWeightInfo = CommonWeights<Self>;
+ type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
}
parameter_types! {
runtime/tests/src/lib.rsdiffbeforeafterboth--- a/runtime/tests/src/lib.rs
+++ b/runtime/tests/src/lib.rs
@@ -255,6 +255,7 @@
type Event = ();
type WeightInfo = ();
type CommonWeightInfo = CommonWeights<Self>;
+ type RefungibleExtensionsWeightInfo = CommonWeights<Self>;
}
// Build genesis storage according to the mock runtime.
runtime/tests/src/tests.rsdiffbeforeafterboth--- a/runtime/tests/src/tests.rs
+++ b/runtime/tests/src/tests.rs
@@ -21,7 +21,7 @@
CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, TokenId,
MAX_TOKEN_OWNERSHIP, CreateCollectionData, CollectionMode, AccessMode, CollectionPermissions,
PropertyKeyPermission, PropertyPermission, Property, CollectionPropertiesVec,
- CollectionPropertiesPermissionsVec, TokenChild,
+ CollectionPropertiesPermissionsVec,
};
use frame_support::{assert_noop, assert_ok, assert_err};
use sp_std::convert::TryInto;