mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 12:51:02 +00:00
Add Uniques to Westmint and Statemint (#493)
* Add uniques to westmint and statemint * update cargo * Update Cargo.lock * Update lib.rs * fix merge * Apply suggestions from code review Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * fix build Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: joepetrowski <joe@parity.io>
This commit is contained in:
@@ -327,14 +327,20 @@ impl InstanceFilter<Call> for ProxyType {
|
||||
fn filter(&self, c: &Call) -> bool {
|
||||
match self {
|
||||
ProxyType::Any => true,
|
||||
ProxyType::NonTransfer => !matches!(c, Call::Balances(..) | Call::Assets(..)),
|
||||
ProxyType::NonTransfer => !matches!(
|
||||
c,
|
||||
Call::Balances(..) | Call::Assets(..) | Call::Uniques(..)
|
||||
),
|
||||
ProxyType::CancelProxy => matches!(
|
||||
c,
|
||||
Call::Proxy(pallet_proxy::Call::reject_announcement(..))
|
||||
| Call::Utility(..) | Call::Multisig(..)
|
||||
),
|
||||
ProxyType::Assets => {
|
||||
matches!(c, Call::Assets(..) | Call::Utility(..) | Call::Multisig(..))
|
||||
matches!(
|
||||
c,
|
||||
Call::Assets(..) | Call::Utility(..) | Call::Multisig(..) | Call::Uniques(..)
|
||||
)
|
||||
}
|
||||
ProxyType::AssetOwner => matches!(
|
||||
c,
|
||||
@@ -344,6 +350,16 @@ impl InstanceFilter<Call> for ProxyType {
|
||||
| Call::Assets(pallet_assets::Call::set_team(..))
|
||||
| Call::Assets(pallet_assets::Call::set_metadata(..))
|
||||
| Call::Assets(pallet_assets::Call::clear_metadata(..))
|
||||
| Call::Uniques(pallet_uniques::Call::create(..))
|
||||
| Call::Uniques(pallet_uniques::Call::destroy(..))
|
||||
| Call::Uniques(pallet_uniques::Call::transfer_ownership(..))
|
||||
| Call::Uniques(pallet_uniques::Call::set_team(..))
|
||||
| Call::Uniques(pallet_uniques::Call::set_metadata(..))
|
||||
| Call::Uniques(pallet_uniques::Call::set_attribute(..))
|
||||
| Call::Uniques(pallet_uniques::Call::set_class_metadata(..))
|
||||
| Call::Uniques(pallet_uniques::Call::clear_metadata(..))
|
||||
| Call::Uniques(pallet_uniques::Call::clear_attribute(..))
|
||||
| Call::Uniques(pallet_uniques::Call::clear_class_metadata(..))
|
||||
| Call::Utility(..) | Call::Multisig(..)
|
||||
),
|
||||
ProxyType::AssetManager => matches!(
|
||||
@@ -354,6 +370,12 @@ impl InstanceFilter<Call> for ProxyType {
|
||||
| Call::Assets(pallet_assets::Call::thaw(..))
|
||||
| Call::Assets(pallet_assets::Call::freeze_asset(..))
|
||||
| Call::Assets(pallet_assets::Call::thaw_asset(..))
|
||||
| Call::Uniques(pallet_uniques::Call::mint(..))
|
||||
| Call::Uniques(pallet_uniques::Call::burn(..))
|
||||
| Call::Uniques(pallet_uniques::Call::freeze(..))
|
||||
| Call::Uniques(pallet_uniques::Call::thaw(..))
|
||||
| Call::Uniques(pallet_uniques::Call::freeze_class(..))
|
||||
| Call::Uniques(pallet_uniques::Call::thaw_class(..))
|
||||
| Call::Utility(..) | Call::Multisig(..)
|
||||
),
|
||||
ProxyType::Collator => matches!(
|
||||
@@ -603,6 +625,34 @@ impl pallet_collator_selection::Config for Runtime {
|
||||
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ClassDeposit: Balance = UNITS; // 1 UNIT deposit to create asset class
|
||||
pub const InstanceDeposit: Balance = UNITS / 100; // 1/100 UNIT deposit to create asset instance
|
||||
pub const KeyLimit: u32 = 32; // Max 32 bytes per key
|
||||
pub const ValueLimit: u32 = 64; // Max 64 bytes per value
|
||||
pub const UniquesMetadataDepositBase: Balance = deposit(1, 129);
|
||||
pub const AttributeDepositBase: Balance = deposit(1, 0);
|
||||
pub const DepositPerByte: Balance = deposit(0, 1);
|
||||
pub const UniquesStringLimit: u32 = 128;
|
||||
}
|
||||
|
||||
impl pallet_uniques::Config for Runtime {
|
||||
type Event = Event;
|
||||
type ClassId = u32;
|
||||
type InstanceId = u32;
|
||||
type Currency = Balances;
|
||||
type ForceOrigin = AssetsForceOrigin;
|
||||
type ClassDeposit = ClassDeposit;
|
||||
type InstanceDeposit = InstanceDeposit;
|
||||
type MetadataDepositBase = UniquesMetadataDepositBase;
|
||||
type AttributeDepositBase = AttributeDepositBase;
|
||||
type DepositPerByte = DepositPerByte;
|
||||
type StringLimit = UniquesStringLimit;
|
||||
type KeyLimit = KeyLimit;
|
||||
type ValueLimit = ValueLimit;
|
||||
type WeightInfo = weights::pallet_uniques::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
// Create the runtime by composing the FRAME pallets that were previously configured.
|
||||
construct_runtime!(
|
||||
pub enum Runtime where
|
||||
@@ -643,6 +693,7 @@ construct_runtime!(
|
||||
|
||||
// The main stage. To include pallet-assets-freezer and pallet-uniques.
|
||||
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50,
|
||||
Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 51,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -5,4 +5,5 @@ pub mod pallet_collator_selection;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_session;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_uniques;
|
||||
pub mod pallet_utility;
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Cumulus is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Cumulus is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Autogenerated weights for pallet_uniques
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
||||
//! DATE: 2021-06-02, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
// ./target/release/polkadot-collator
|
||||
// benchmark
|
||||
// --chain=statemine-dev
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --pallet=pallet_uniques
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --header=./file_header.txt
|
||||
// --output=./polkadot-parachains/statemine-runtime/src/weights/
|
||||
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for pallet_uniques.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> pallet_uniques::WeightInfo for WeightInfo<T> {
|
||||
fn create() -> Weight {
|
||||
(42_199_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_create() -> Weight {
|
||||
(21_030_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn destroy(n: u32, m: u32, a: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((16_814_000 as Weight).saturating_mul(n as Weight))
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((1_026_000 as Weight).saturating_mul(m as Weight))
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((952_000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
|
||||
}
|
||||
fn mint() -> Weight {
|
||||
(57_236_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn burn() -> Weight {
|
||||
(58_129_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn transfer() -> Weight {
|
||||
(42_980_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn redeposit(i: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
// Standard Error: 11_000
|
||||
.saturating_add((26_921_000 as Weight).saturating_mul(i as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
|
||||
}
|
||||
fn freeze() -> Weight {
|
||||
(30_427_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn thaw() -> Weight {
|
||||
(29_789_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn freeze_class() -> Weight {
|
||||
(21_380_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn thaw_class() -> Weight {
|
||||
(21_430_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn transfer_ownership() -> Weight {
|
||||
(49_331_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_team() -> Weight {
|
||||
(22_305_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_asset_status() -> Weight {
|
||||
(21_965_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_attribute() -> Weight {
|
||||
(70_386_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn clear_attribute() -> Weight {
|
||||
(63_932_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_metadata() -> Weight {
|
||||
(53_647_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn clear_metadata() -> Weight {
|
||||
(52_353_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_class_metadata() -> Weight {
|
||||
(51_900_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn clear_class_metadata() -> Weight {
|
||||
(46_929_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn approve_transfer() -> Weight {
|
||||
(32_693_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn cancel_approval() -> Weight {
|
||||
(32_418_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user