mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 10:51:10 +00:00
Migrate away from SimpleDispatchInfo (#5686)
* Migrate away from SimpleDispatchInfo * Fix imports * Better doc * Update lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -164,7 +164,7 @@ use sp_std::prelude::*;
|
||||
use sp_std::{cmp, result, fmt::Debug};
|
||||
use frame_support::{
|
||||
decl_event, decl_module, decl_storage, ensure, decl_error,
|
||||
weights::{SimpleDispatchInfo, MINIMUM_WEIGHT},
|
||||
weights::MINIMUM_WEIGHT,
|
||||
traits::{
|
||||
Currency, ExistenceRequirement, Imbalance, LockIdentifier, LockableCurrency, ReservableCurrency,
|
||||
SignedImbalance, WithdrawReason, WithdrawReasons, TryDrop, BalanceStatus,
|
||||
@@ -361,14 +361,14 @@ decl_module! {
|
||||
fn deposit_event() = default;
|
||||
|
||||
/// Create a new kind of asset.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn create(origin, options: AssetOptions<T::Balance, T::AccountId>) -> DispatchResult {
|
||||
let origin = ensure_signed(origin)?;
|
||||
Self::create_asset(None, Some(origin), options)
|
||||
}
|
||||
|
||||
/// Transfer some liquid free balance to another account.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
pub fn transfer(origin, #[compact] asset_id: T::AssetId, to: T::AccountId, #[compact] amount: T::Balance) {
|
||||
let origin = ensure_signed(origin)?;
|
||||
ensure!(!amount.is_zero(), Error::<T>::ZeroAmount);
|
||||
@@ -378,7 +378,7 @@ decl_module! {
|
||||
/// Updates permission for a given `asset_id` and an account.
|
||||
///
|
||||
/// The `origin` must have `update` permission.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn update_permission(
|
||||
origin,
|
||||
#[compact] asset_id: T::AssetId,
|
||||
@@ -401,7 +401,7 @@ decl_module! {
|
||||
|
||||
/// Mints an asset, increases its total issuance.
|
||||
/// The origin must have `mint` permissions.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn mint(origin, #[compact] asset_id: T::AssetId, to: T::AccountId, amount: T::Balance) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::mint_free(&asset_id, &who, &to, &amount)?;
|
||||
@@ -411,7 +411,7 @@ decl_module! {
|
||||
|
||||
/// Burns an asset, decreases its total issuance.
|
||||
/// The `origin` must have `burn` permissions.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn burn(origin, #[compact] asset_id: T::AssetId, to: T::AccountId, amount: T::Balance) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
Self::burn_free(&asset_id, &who, &to, &amount)?;
|
||||
@@ -421,7 +421,7 @@ decl_module! {
|
||||
|
||||
/// Can be used to create reserved tokens.
|
||||
/// Requires Root call.
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
#[weight = MINIMUM_WEIGHT]
|
||||
fn create_reserved(
|
||||
origin,
|
||||
asset_id: T::AssetId,
|
||||
|
||||
Reference in New Issue
Block a user