mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -133,6 +133,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use frame_support::{Parameter, decl_module, decl_event, decl_storage, decl_error, ensure};
|
||||
use frame_support::weights::{SimpleDispatchInfo, MINIMUM_WEIGHT};
|
||||
use sp_runtime::traits::{Member, AtLeast32Bit, Zero, StaticLookup};
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
use sp_runtime::traits::One;
|
||||
@@ -157,7 +158,7 @@ decl_module! {
|
||||
/// Issue a new class of fungible assets. There are, and will only ever be, `total`
|
||||
/// such assets and they'll all belong to the `origin` initially. It will have an
|
||||
/// identifier `AssetId` instance: this will be specified in the `Issued` event.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
fn issue(origin, #[compact] total: T::Balance) {
|
||||
let origin = ensure_signed(origin)?;
|
||||
|
||||
@@ -171,7 +172,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Move some assets from one holder to another.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
fn transfer(origin,
|
||||
#[compact] id: T::AssetId,
|
||||
target: <T::Lookup as StaticLookup>::Source,
|
||||
@@ -190,7 +191,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
/// Destroy any assets of `id` owned by `origin`.
|
||||
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
fn destroy(origin, #[compact] id: T::AssetId) {
|
||||
let origin = ensure_signed(origin)?;
|
||||
let balance = <Balances<T>>::take((id, &origin));
|
||||
@@ -292,6 +293,7 @@ mod tests {
|
||||
type Event = ();
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type MaximumBlockWeight = MaximumBlockWeight;
|
||||
type DbWeight = ();
|
||||
type AvailableBlockRatio = AvailableBlockRatio;
|
||||
type MaximumBlockLength = MaximumBlockLength;
|
||||
type Version = ();
|
||||
|
||||
Reference in New Issue
Block a user