difftreelog
feat custom collection creation price
in: master
3 files changed
pallets/nft/src/lib.rsdiffbeforeafterboth435 /// Weight information for extrinsics in this pallet.435 /// Weight information for extrinsics in this pallet.436 type WeightInfo: WeightInfo;436 type WeightInfo: WeightInfo;437438 type CollectionCreationPrice: Get<BalanceOf<Self>>;437}439}438440439#[cfg(feature = "runtime-benchmarks")]441#[cfg(feature = "runtime-benchmarks")]2535 > {2537 > {2536 let tip = self.0;2538 let tip = self.0;253725392538 // Set fee based on call type. Creating collection costs 1 Unique.2539 // All other transactions have traditional fees so far2540 // let fee = match call.is_sub_type() {2541 // Some(Call::create_collection(..)) => <BalanceOf<T>>::from(1_000_000_000),2542 // _ => Self::traditional_fee(len, info, tip), // Flat fee model, use only for testing purposes2543 // // _ => <BalanceOf<T>>::from(100)2544 // };2545 let fee = Self::traditional_fee(len, info, tip);2540 let fee = match call.is_sub_type() {2541 Some(Call::create_collection(..)) => T::CollectionCreationPrice::get(),2542 _ => Self::traditional_fee(len, info, tip),2543 };254625442547 // Only mess with balances if fee is not zero.2545 // Only mess with balances if fee is not zero.2548 if fee.is_zero() {2546 if fee.is_zero() {pallets/nft/src/mock.rsdiffbeforeafterboth--- a/pallets/nft/src/mock.rs
+++ b/pallets/nft/src/mock.rs
@@ -133,9 +133,14 @@
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
}
+parameter_types! {
+ pub const CollectionCreationPrice: u64 = 1_000_000_000_000;
+}
+
impl pallet_template::Config for Test {
type Event = ();
type WeightInfo = ();
+ type CollectionCreationPrice = CollectionCreationPrice;
}
// Build genesis storage according to the mock runtime.
runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -510,6 +510,7 @@
parameter_types! {
pub const MinVestedTransfer: Balance = 10 * UNIQUE;
+ pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
}
impl pallet_vesting::Config for Runtime {
@@ -524,6 +525,7 @@
impl pallet_nft::Config for Runtime {
type Event = Event;
type WeightInfo = nft_weights::WeightInfo;
+ type CollectionCreationPrice = CollectionCreationPrice;
}
construct_runtime!(