Fixes in Assets Pallet (#9059)

* upper bound witness with refund

* simple test

* track approvals

* dont allow approvals when asset is frozen

* destroy returns approval deposit

* update `NonTransfer` proxies

* cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_assets --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/assets/src/weights.rs --template=./.maintain/frame-weight-template.hbs

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Shawn Tabrizi
2021-06-12 15:59:56 +01:00
committed by GitHub
parent 5dec6e5c81
commit 517fd6149a
4 changed files with 194 additions and 83 deletions
+2
View File
@@ -268,6 +268,8 @@ impl InstanceFilter<Call> for ProxyType {
ProxyType::NonTransfer => !matches!(
c,
Call::Balances(..) |
Call::Assets(..) |
Call::Uniques(..) |
Call::Vesting(pallet_vesting::Call::vested_transfer(..)) |
Call::Indices(pallet_indices::Call::transfer(..))
),
+42 -9
View File
@@ -468,6 +468,10 @@ pub mod pallet {
///
/// Emits `Destroyed` event when successful.
///
/// NOTE: It can be helpful to first freeze an asset before destroying it so that you
/// can provide accurate witness information and prevent users from manipulating state
/// in a way that can make it harder to destroy.
///
/// Weight: `O(c + p + a)` where:
/// - `c = (witness.accounts - witness.sufficients)`
/// - `s = witness.sufficients`
@@ -481,7 +485,7 @@ pub mod pallet {
origin: OriginFor<T>,
#[pallet::compact] id: T::AssetId,
witness: DestroyWitness,
) -> DispatchResult {
) -> DispatchResultWithPostInfo {
let maybe_check_owner = match T::ForceOrigin::try_origin(origin) {
Ok(_) => None,
Err(origin) => Some(ensure_signed(origin)?),
@@ -491,9 +495,9 @@ pub mod pallet {
if let Some(check_owner) = maybe_check_owner {
ensure!(details.owner == check_owner, Error::<T, I>::NoPermission);
}
ensure!(details.accounts == witness.accounts, Error::<T, I>::BadWitness);
ensure!(details.sufficients == witness.sufficients, Error::<T, I>::BadWitness);
ensure!(details.approvals == witness.approvals, Error::<T, I>::BadWitness);
ensure!(details.accounts <= witness.accounts, Error::<T, I>::BadWitness);
ensure!(details.sufficients <= witness.sufficients, Error::<T, I>::BadWitness);
ensure!(details.approvals <= witness.approvals, Error::<T, I>::BadWitness);
for (who, v) in Account::<T, I>::drain_prefix(id) {
Self::dead_account(id, &who, &mut details, v.sufficient);
@@ -507,11 +511,18 @@ pub mod pallet {
details.deposit.saturating_add(metadata.deposit),
);
Approvals::<T, I>::remove_prefix((&id,));
for ((owner, _), approval) in Approvals::<T, I>::drain_prefix((&id,)) {
T::Currency::unreserve(&owner, approval.deposit);
}
Self::deposit_event(Event::Destroyed(id));
// NOTE: could use postinfo to reflect the actual number of accounts/sufficient/approvals
Ok(())
Ok(
Some(T::WeightInfo::destroy(
details.accounts.saturating_sub(details.sufficients),
details.sufficients,
details.approvals,
)).into()
)
})
}
@@ -1134,8 +1145,18 @@ pub mod pallet {
let owner = ensure_signed(origin)?;
let delegate = T::Lookup::lookup(delegate)?;
let mut d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(!d.is_frozen, Error::<T, I>::Frozen);
Approvals::<T, I>::try_mutate((id, &owner, &delegate), |maybe_approved| -> DispatchResult {
let mut approved = maybe_approved.take().unwrap_or_default();
let mut approved = match maybe_approved.take() {
// an approval already exists and is being updated
Some(a) => a,
// a new approval is created
None => {
d.approvals.saturating_inc();
Default::default()
}
};
let deposit_required = T::ApprovalDeposit::get();
if approved.deposit < deposit_required {
T::Currency::reserve(&owner, deposit_required - approved.deposit)?;
@@ -1145,6 +1166,7 @@ pub mod pallet {
*maybe_approved = Some(approved);
Ok(())
})?;
Asset::<T, I>::insert(id, d);
Self::deposit_event(Event::ApprovedTransfer(id, owner, delegate, amount));
Ok(())
@@ -1171,9 +1193,13 @@ pub mod pallet {
) -> DispatchResult {
let owner = ensure_signed(origin)?;
let delegate = T::Lookup::lookup(delegate)?;
let mut d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
let approval = Approvals::<T, I>::take((id, &owner, &delegate)).ok_or(Error::<T, I>::Unknown)?;
T::Currency::unreserve(&owner, approval.deposit);
d.approvals.saturating_dec();
Asset::<T, I>::insert(id, d);
Self::deposit_event(Event::ApprovalCancelled(id, owner, delegate));
Ok(())
}
@@ -1198,11 +1224,11 @@ pub mod pallet {
owner: <T::Lookup as StaticLookup>::Source,
delegate: <T::Lookup as StaticLookup>::Source,
) -> DispatchResult {
let mut d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
T::ForceOrigin::try_origin(origin)
.map(|_| ())
.or_else(|origin| -> DispatchResult {
let origin = ensure_signed(origin)?;
let d = Asset::<T, I>::get(id).ok_or(Error::<T, I>::Unknown)?;
ensure!(&origin == &d.admin, Error::<T, I>::NoPermission);
Ok(())
})?;
@@ -1212,6 +1238,8 @@ pub mod pallet {
let approval = Approvals::<T, I>::take((id, &owner, &delegate)).ok_or(Error::<T, I>::Unknown)?;
T::Currency::unreserve(&owner, approval.deposit);
d.approvals.saturating_dec();
Asset::<T, I>::insert(id, d);
Self::deposit_event(Event::ApprovalCancelled(id, owner, delegate));
Ok(())
@@ -1263,6 +1291,11 @@ pub mod pallet {
if remaining.is_zero() {
T::Currency::unreserve(&owner, approved.deposit);
Asset::<T, I>::mutate(id, |maybe_details| {
if let Some(details) = maybe_details {
details.approvals.saturating_dec();
}
});
} else {
approved.amount = remaining;
*maybe_approved = Some(approved);
+75 -1
View File
@@ -37,19 +37,47 @@ fn basic_minting_should_work() {
#[test]
fn approval_lifecycle_works() {
new_test_ext().execute_with(|| {
// can't approve non-existent token
assert_noop!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50), Error::<Test>::Unknown);
// so we create it :)
assert_ok!(Assets::force_create(Origin::root(), 0, 1, true, 1));
assert_ok!(Assets::mint(Origin::signed(1), 0, 1, 100));
Balances::make_free_balance_be(&1, 1);
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
assert_eq!(Balances::reserved_balance(&1), 1);
assert_ok!(Assets::transfer_approved(Origin::signed(2), 0, 1, 3, 40));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
assert_ok!(Assets::cancel_approval(Origin::signed(1), 0, 2));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 0);
assert_eq!(Assets::balance(0, 1), 60);
assert_eq!(Assets::balance(0, 3), 40);
assert_eq!(Balances::reserved_balance(&1), 0);
});
}
#[test]
fn transfer_approved_all_funds() {
new_test_ext().execute_with(|| {
// can't approve non-existent token
assert_noop!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50), Error::<Test>::Unknown);
// so we create it :)
assert_ok!(Assets::force_create(Origin::root(), 0, 1, true, 1));
assert_ok!(Assets::mint(Origin::signed(1), 0, 1, 100));
Balances::make_free_balance_be(&1, 1);
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
assert_eq!(Balances::reserved_balance(&1), 1);
// transfer the full amount, which should trigger auto-cleanup
assert_ok!(Assets::transfer_approved(Origin::signed(2), 0, 1, 3, 50));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 0);
assert_eq!(Assets::balance(0, 1), 50);
assert_eq!(Assets::balance(0, 3), 50);
assert_eq!(Balances::reserved_balance(&1), 0);
});
}
#[test]
fn approval_deposits_work() {
new_test_ext().execute_with(|| {
@@ -102,10 +130,13 @@ fn cancel_approval_works() {
assert_ok!(Assets::mint(Origin::signed(1), 0, 1, 100));
Balances::make_free_balance_be(&1, 1);
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
assert_noop!(Assets::cancel_approval(Origin::signed(1), 1, 2), Error::<Test>::Unknown);
assert_noop!(Assets::cancel_approval(Origin::signed(2), 0, 2), Error::<Test>::Unknown);
assert_noop!(Assets::cancel_approval(Origin::signed(1), 0, 3), Error::<Test>::Unknown);
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
assert_ok!(Assets::cancel_approval(Origin::signed(1), 0, 2));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 0);
assert_noop!(Assets::cancel_approval(Origin::signed(1), 0, 2), Error::<Test>::Unknown);
});
}
@@ -117,12 +148,15 @@ fn force_cancel_approval_works() {
assert_ok!(Assets::mint(Origin::signed(1), 0, 1, 100));
Balances::make_free_balance_be(&1, 1);
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
let e = Error::<Test>::NoPermission;
assert_noop!(Assets::force_cancel_approval(Origin::signed(2), 0, 1, 2), e);
assert_noop!(Assets::force_cancel_approval(Origin::signed(1), 1, 1, 2), Error::<Test>::Unknown);
assert_noop!(Assets::force_cancel_approval(Origin::signed(1), 0, 2, 2), Error::<Test>::Unknown);
assert_noop!(Assets::force_cancel_approval(Origin::signed(1), 0, 1, 3), Error::<Test>::Unknown);
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 1);
assert_ok!(Assets::force_cancel_approval(Origin::signed(1), 0, 1, 2));
assert_eq!(Asset::<Test>::get(0).unwrap().approvals, 0);
assert_noop!(Assets::force_cancel_approval(Origin::signed(1), 0, 1, 2), Error::<Test>::Unknown);
});
}
@@ -180,9 +214,35 @@ fn destroy_with_bad_witness_should_not_work() {
new_test_ext().execute_with(|| {
Balances::make_free_balance_be(&1, 100);
assert_ok!(Assets::force_create(Origin::root(), 0, 1, true, 1));
let w = Asset::<Test>::get(0).unwrap().destroy_witness();
let mut w = Asset::<Test>::get(0).unwrap().destroy_witness();
assert_ok!(Assets::mint(Origin::signed(1), 0, 10, 100));
// witness too low
assert_noop!(Assets::destroy(Origin::signed(1), 0, w), Error::<Test>::BadWitness);
// witness too high is okay though
w.accounts += 2;
w.sufficients += 2;
assert_ok!(Assets::destroy(Origin::signed(1), 0, w));
});
}
#[test]
fn destroy_should_refund_approvals() {
new_test_ext().execute_with(|| {
Balances::make_free_balance_be(&1, 100);
assert_ok!(Assets::force_create(Origin::root(), 0, 1, true, 1));
assert_ok!(Assets::mint(Origin::signed(1), 0, 10, 100));
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50));
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 3, 50));
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 4, 50));
assert_eq!(Balances::reserved_balance(&1), 3);
let w = Asset::<Test>::get(0).unwrap().destroy_witness();
assert_ok!(Assets::destroy(Origin::signed(1), 0, w));
assert_eq!(Balances::reserved_balance(&1), 0);
// all approvals are removed
assert!(Approvals::<Test>::iter().count().is_zero())
});
}
@@ -306,6 +366,20 @@ fn transferring_frozen_asset_should_not_work() {
});
}
#[test]
fn approve_transfer_frozen_asset_should_not_work() {
new_test_ext().execute_with(|| {
Balances::make_free_balance_be(&1, 100);
assert_ok!(Assets::force_create(Origin::root(), 0, 1, true, 1));
assert_ok!(Assets::mint(Origin::signed(1), 0, 1, 100));
assert_eq!(Assets::balance(0, 1), 100);
assert_ok!(Assets::freeze_asset(Origin::signed(1), 0));
assert_noop!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50), Error::<Test>::Frozen);
assert_ok!(Assets::thaw_asset(Origin::signed(1), 0));
assert_ok!(Assets::approve_transfer(Origin::signed(1), 0, 2, 50));
});
}
#[test]
fn origin_guards_should_work() {
new_test_ext().execute_with(|| {
+75 -73
View File
@@ -18,7 +18,7 @@
//! Autogenerated weights for pallet_assets
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-03-08, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-06-10, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
// Executed Command:
@@ -73,267 +73,269 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn create() -> Weight {
(48_305_000 as Weight)
(52_735_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 {
(23_827_000 as Weight)
(26_570_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 38_000
.saturating_add((24_232_000 as Weight).saturating_mul(c as Weight))
// Standard Error: 38_000
.saturating_add((30_467_000 as Weight).saturating_mul(s as Weight))
// Standard Error: 383_000
.saturating_add((2_343_000 as Weight).saturating_mul(a as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
// Standard Error: 93_000
.saturating_add((31_110_000 as Weight).saturating_mul(c as Weight))
// Standard Error: 93_000
.saturating_add((38_908_000 as Weight).saturating_mul(s as Weight))
// Standard Error: 935_000
.saturating_add((42_765_000 as Weight).saturating_mul(a as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
}
fn mint() -> Weight {
(46_433_000 as Weight)
(58_399_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn burn() -> Weight {
(46_000_000 as Weight)
(65_917_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn transfer() -> Weight {
(70_793_000 as Weight)
(100_407_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn transfer_keep_alive() -> Weight {
(57_453_000 as Weight)
(84_243_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn force_transfer() -> Weight {
(70_968_000 as Weight)
(100_407_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn freeze() -> Weight {
(34_290_000 as Weight)
(37_831_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn thaw() -> Weight {
(34_419_000 as Weight)
(37_660_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn freeze_asset() -> Weight {
(24_373_000 as Weight)
(27_175_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn thaw_asset() -> Weight {
(24_096_000 as Weight)
(26_884_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 {
(28_566_000 as Weight)
(31_877_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_team() -> Weight {
(25_297_000 as Weight)
(27_947_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_metadata(_n: u32, s: u32, ) -> Weight {
(53_367_000 as Weight)
(57_993_000 as Weight)
// Standard Error: 0
.saturating_add((8_000 as Weight).saturating_mul(s as Weight))
.saturating_add((12_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn clear_metadata() -> Weight {
(51_721_000 as Weight)
(57_820_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
(27_117_000 as Weight)
(30_830_000 as Weight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(s as Weight))
.saturating_add((7_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_clear_metadata() -> Weight {
(51_598_000 as Weight)
(57_292_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_asset_status() -> Weight {
(23_366_000 as Weight)
(26_750_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn approve_transfer() -> Weight {
(47_906_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
(65_598_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn transfer_approved() -> Weight {
(90_338_000 as Weight)
(131_312_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
fn cancel_approval() -> Weight {
(48_591_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
(66_904_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn force_cancel_approval() -> Weight {
(54_879_000 as Weight)
(67_525_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn create() -> Weight {
(48_305_000 as Weight)
(52_735_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn force_create() -> Weight {
(23_827_000 as Weight)
(26_570_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 38_000
.saturating_add((24_232_000 as Weight).saturating_mul(c as Weight))
// Standard Error: 38_000
.saturating_add((30_467_000 as Weight).saturating_mul(s as Weight))
// Standard Error: 383_000
.saturating_add((2_343_000 as Weight).saturating_mul(a as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
// Standard Error: 93_000
.saturating_add((31_110_000 as Weight).saturating_mul(c as Weight))
// Standard Error: 93_000
.saturating_add((38_908_000 as Weight).saturating_mul(s as Weight))
// Standard Error: 935_000
.saturating_add((42_765_000 as Weight).saturating_mul(a as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
}
fn mint() -> Weight {
(46_433_000 as Weight)
(58_399_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn burn() -> Weight {
(46_000_000 as Weight)
(65_917_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn transfer() -> Weight {
(70_793_000 as Weight)
(100_407_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
fn transfer_keep_alive() -> Weight {
(57_453_000 as Weight)
(84_243_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
fn force_transfer() -> Weight {
(70_968_000 as Weight)
(100_407_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
fn freeze() -> Weight {
(34_290_000 as Weight)
(37_831_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn thaw() -> Weight {
(34_419_000 as Weight)
(37_660_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn freeze_asset() -> Weight {
(24_373_000 as Weight)
(27_175_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn thaw_asset() -> Weight {
(24_096_000 as Weight)
(26_884_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn transfer_ownership() -> Weight {
(28_566_000 as Weight)
(31_877_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn set_team() -> Weight {
(25_297_000 as Weight)
(27_947_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn set_metadata(_n: u32, s: u32, ) -> Weight {
(53_367_000 as Weight)
(57_993_000 as Weight)
// Standard Error: 0
.saturating_add((8_000 as Weight).saturating_mul(s as Weight))
.saturating_add((12_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn clear_metadata() -> Weight {
(51_721_000 as Weight)
(57_820_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
(27_117_000 as Weight)
(30_830_000 as Weight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(s as Weight))
.saturating_add((7_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn force_clear_metadata() -> Weight {
(51_598_000 as Weight)
(57_292_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn force_asset_status() -> Weight {
(23_366_000 as Weight)
(26_750_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
fn approve_transfer() -> Weight {
(47_906_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
(65_598_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn transfer_approved() -> Weight {
(90_338_000 as Weight)
(131_312_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
fn cancel_approval() -> Weight {
(48_591_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
(66_904_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
fn force_cancel_approval() -> Weight {
(54_879_000 as Weight)
(67_525_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
}