Skip to content

Commit

Permalink
Pallet uniques: Mint with extra deposit (#753)
Browse files Browse the repository at this point in the history
 Add create collection with extra deposit limit
 Add update extra deposit limit for existing collections
 Add mint with extra deposit
 Unreserve the extra deposit on burning an item and transfer it to item owner
 Unreserve all extra deposits on destroying a collection and transfer them to item owners
 Repatriate the total extra deposit when the ownership of collection changes
 Benchmark nodle-uniques-pallet
 Relocate Uniques to SubstrateUniques pallet on runtime upgrade
  • Loading branch information
Hounsette authored Jul 11, 2023
1 parent 011d189 commit 2ef7c21
Show file tree
Hide file tree
Showing 28 changed files with 3,706 additions and 971 deletions.
20 changes: 20 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 26 additions & 26 deletions pallets/allocations/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//! Autogenerated weights for pallet_allocations
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-29, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `chain-bench-2aa7e463`, CPU: `AMD EPYC 7B13`
//! DATE: 2023-07-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `chain-bench-2a6c49ba`, CPU: `AMD EPYC 7B13`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
Expand Down Expand Up @@ -72,10 +72,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
/// The range of component `b` is `[1, 500]`.
fn allocate(b: u32, ) -> Weight {
// Minimum execution time: 181_830 nanoseconds.
Weight::from_parts(64_532_663_u64, 0)
// Standard Error: 13_909
.saturating_add(Weight::from_parts(65_969_287_u64, 0).saturating_mul(b as u64))
// Minimum execution time: 180_370 nanoseconds.
Weight::from_parts(64_125_680_u64, 0)
// Standard Error: 13_436
.saturating_add(Weight::from_parts(64_728_017_u64, 0).saturating_mul(b as u64))
.saturating_add(T::DbWeight::get().reads(8_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(b as u64)))
.saturating_add(T::DbWeight::get().writes(6_u64))
Expand All @@ -98,8 +98,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Allocations NextSessionQuota (r:0 w:1)
// Proof: Allocations NextSessionQuota (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn calc_quota() -> Weight {
// Minimum execution time: 22_380 nanoseconds.
Weight::from_parts(22_910_000_u64, 0)
// Minimum execution time: 22_280 nanoseconds.
Weight::from_parts(23_030_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
Expand All @@ -120,8 +120,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Allocations SessionQuota (r:0 w:1)
// Proof: Allocations SessionQuota (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn renew_quota() -> Weight {
// Minimum execution time: 18_090 nanoseconds.
Weight::from_parts(18_650_000_u64, 0)
// Minimum execution time: 18_060 nanoseconds.
Weight::from_parts(18_640_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(5_u64))
}
Expand All @@ -148,8 +148,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Allocations NextSessionQuota (r:0 w:1)
// Proof: Allocations NextSessionQuota (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn checked_update_session_quota() -> Weight {
// Minimum execution time: 37_171 nanoseconds.
Weight::from_parts(38_530_000_u64, 0)
// Minimum execution time: 37_240 nanoseconds.
Weight::from_parts(38_420_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(9_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
Expand All @@ -162,8 +162,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Allocations SessionQuotaRenewSchedule (r:0 w:1)
// Proof: Allocations SessionQuotaRenewSchedule (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn set_curve_starting_block() -> Weight {
// Minimum execution time: 10_560 nanoseconds.
Weight::from_parts(10_950_000_u64, 0)
// Minimum execution time: 10_670 nanoseconds.
Weight::from_parts(10_900_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
Expand All @@ -186,10 +186,10 @@ impl WeightInfo for () {
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
/// The range of component `b` is `[1, 500]`.
fn allocate(b: u32, ) -> Weight {
// Minimum execution time: 181_830 nanoseconds.
Weight::from_parts(64_532_663_u64, 0)
// Standard Error: 13_909
.saturating_add(Weight::from_parts(65_969_287_u64, 0).saturating_mul(b as u64))
// Minimum execution time: 180_370 nanoseconds.
Weight::from_parts(64_125_680_u64, 0)
// Standard Error: 13_436
.saturating_add(Weight::from_parts(64_728_017_u64, 0).saturating_mul(b as u64))
.saturating_add(RocksDbWeight::get().reads(8_u64))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(b as u64)))
.saturating_add(RocksDbWeight::get().writes(6_u64))
Expand All @@ -212,8 +212,8 @@ impl WeightInfo for () {
// Storage: Allocations NextSessionQuota (r:0 w:1)
// Proof: Allocations NextSessionQuota (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn calc_quota() -> Weight {
// Minimum execution time: 22_380 nanoseconds.
Weight::from_parts(22_910_000_u64, 0)
// Minimum execution time: 22_280 nanoseconds.
Weight::from_parts(23_030_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
Expand All @@ -234,8 +234,8 @@ impl WeightInfo for () {
// Storage: Allocations SessionQuota (r:0 w:1)
// Proof: Allocations SessionQuota (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn renew_quota() -> Weight {
// Minimum execution time: 18_090 nanoseconds.
Weight::from_parts(18_650_000_u64, 0)
// Minimum execution time: 18_060 nanoseconds.
Weight::from_parts(18_640_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(5_u64))
}
Expand All @@ -262,8 +262,8 @@ impl WeightInfo for () {
// Storage: Allocations NextSessionQuota (r:0 w:1)
// Proof: Allocations NextSessionQuota (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen)
fn checked_update_session_quota() -> Weight {
// Minimum execution time: 37_171 nanoseconds.
Weight::from_parts(38_530_000_u64, 0)
// Minimum execution time: 37_240 nanoseconds.
Weight::from_parts(38_420_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(9_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
Expand All @@ -276,8 +276,8 @@ impl WeightInfo for () {
// Storage: Allocations SessionQuotaRenewSchedule (r:0 w:1)
// Proof: Allocations SessionQuotaRenewSchedule (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn set_curve_starting_block() -> Weight {
// Minimum execution time: 10_560 nanoseconds.
Weight::from_parts(10_950_000_u64, 0)
// Minimum execution time: 10_670 nanoseconds.
Weight::from_parts(10_900_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
Expand Down
36 changes: 18 additions & 18 deletions pallets/grants/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//! Autogenerated weights for pallet_grants
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-29, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `chain-bench-2aa7e463`, CPU: `AMD EPYC 7B13`
//! DATE: 2023-07-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `chain-bench-2a6c49ba`, CPU: `AMD EPYC 7B13`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
Expand Down Expand Up @@ -76,8 +76,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Freezes (r:1 w:0)
// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn add_vesting_schedule() -> Weight {
// Minimum execution time: 136_920 nanoseconds.
Weight::from_parts(139_940_000_u64, 0)
// Minimum execution time: 132_770 nanoseconds.
Weight::from_parts(135_120_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(11_u64))
.saturating_add(T::DbWeight::get().writes(6_u64))
}
Expand All @@ -100,8 +100,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Events (r:1 w:1)
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
fn claim() -> Weight {
// Minimum execution time: 63_020 nanoseconds.
Weight::from_parts(64_090_000_u64, 0)
// Minimum execution time: 62_090 nanoseconds.
Weight::from_parts(63_390_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(9_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand Down Expand Up @@ -130,8 +130,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Vesting CounterForVestingSchedules (r:1 w:1)
// Proof: Vesting CounterForVestingSchedules (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn cancel_all_vesting_schedules() -> Weight {
// Minimum execution time: 186_680 nanoseconds.
Weight::from_parts(190_229_000_u64, 0)
// Minimum execution time: 184_010 nanoseconds.
Weight::from_parts(187_570_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(13_u64))
.saturating_add(T::DbWeight::get().writes(7_u64))
}
Expand All @@ -146,8 +146,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Vesting Renounced (r:0 w:1)
// Proof: Vesting Renounced (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn renounce() -> Weight {
// Minimum execution time: 17_530 nanoseconds.
Weight::from_parts(18_170_000_u64, 0)
// Minimum execution time: 17_470 nanoseconds.
Weight::from_parts(18_120_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
}
Expand Down Expand Up @@ -175,8 +175,8 @@ impl WeightInfo for () {
// Storage: Balances Freezes (r:1 w:0)
// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn add_vesting_schedule() -> Weight {
// Minimum execution time: 136_920 nanoseconds.
Weight::from_parts(139_940_000_u64, 0)
// Minimum execution time: 132_770 nanoseconds.
Weight::from_parts(135_120_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(11_u64))
.saturating_add(RocksDbWeight::get().writes(6_u64))
}
Expand All @@ -199,8 +199,8 @@ impl WeightInfo for () {
// Storage: System Events (r:1 w:1)
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
fn claim() -> Weight {
// Minimum execution time: 63_020 nanoseconds.
Weight::from_parts(64_090_000_u64, 0)
// Minimum execution time: 62_090 nanoseconds.
Weight::from_parts(63_390_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(9_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand Down Expand Up @@ -229,8 +229,8 @@ impl WeightInfo for () {
// Storage: Vesting CounterForVestingSchedules (r:1 w:1)
// Proof: Vesting CounterForVestingSchedules (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
fn cancel_all_vesting_schedules() -> Weight {
// Minimum execution time: 186_680 nanoseconds.
Weight::from_parts(190_229_000_u64, 0)
// Minimum execution time: 184_010 nanoseconds.
Weight::from_parts(187_570_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(13_u64))
.saturating_add(RocksDbWeight::get().writes(7_u64))
}
Expand All @@ -245,8 +245,8 @@ impl WeightInfo for () {
// Storage: Vesting Renounced (r:0 w:1)
// Proof: Vesting Renounced (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
fn renounce() -> Weight {
// Minimum execution time: 17_530 nanoseconds.
Weight::from_parts(18_170_000_u64, 0)
// Minimum execution time: 17_470 nanoseconds.
Weight::from_parts(18_120_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
}
Expand Down
20 changes: 10 additions & 10 deletions pallets/reserve/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
//! Autogenerated weights for pallet_reserve
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-29, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `chain-bench-2aa7e463`, CPU: `AMD EPYC 7B13`
//! DATE: 2023-07-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `chain-bench-2a6c49ba`, CPU: `AMD EPYC 7B13`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
Expand Down Expand Up @@ -66,8 +66,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Events (r:1 w:1)
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
fn tip() -> Weight {
// Minimum execution time: 80_790 nanoseconds.
Weight::from_parts(82_780_000_u64, 0)
// Minimum execution time: 79_920 nanoseconds.
Weight::from_parts(81_710_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -84,8 +84,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Events (r:1 w:1)
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
fn spend() -> Weight {
// Minimum execution time: 92_200 nanoseconds.
Weight::from_parts(95_300_000_u64, 0)
// Minimum execution time: 90_430 nanoseconds.
Weight::from_parts(91_690_000_u64, 0)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -105,8 +105,8 @@ impl WeightInfo for () {
// Storage: System Events (r:1 w:1)
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
fn tip() -> Weight {
// Minimum execution time: 80_790 nanoseconds.
Weight::from_parts(82_780_000_u64, 0)
// Minimum execution time: 79_920 nanoseconds.
Weight::from_parts(81_710_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand All @@ -123,8 +123,8 @@ impl WeightInfo for () {
// Storage: System Events (r:1 w:1)
// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured)
fn spend() -> Weight {
// Minimum execution time: 92_200 nanoseconds.
Weight::from_parts(95_300_000_u64, 0)
// Minimum execution time: 90_430 nanoseconds.
Weight::from_parts(91_690_000_u64, 0)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand Down
49 changes: 49 additions & 0 deletions pallets/uniques/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[package]
name = "pallet-nodle-uniques"
version = "2.1.0"
authors = ["Nodle <[email protected]>"]
edition = "2021"

[features]
default = ["std"]
std = [
"codec/std",
"serde",
"scale-info/std",
"frame-support/std",
"frame-benchmarking/std",
"frame-system/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"pallet-uniques/std",
"pallet-balances/std",
]
try-runtime = [
"frame-support/try-runtime",
"pallet-uniques/try-runtime"
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
serde = { version = "1.0.152", optional = true, features = ["derive"] }
scale-info = { version = "2.0.1", default-features = false, features = [
"derive",
] }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "polkadot-v0.9.42" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
pallet-uniques = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
support = { path = "../../support" }
[dev-dependencies]
sp-core = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.42" }
Loading

0 comments on commit 2ef7c21

Please sign in to comment.