mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 13:27:57 +00:00
FRAME: inherited call weight syntax (#13932)
* First approach on pallet::call_weight Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Use attr on pallet::call instead Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Ui tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Rename to weight(prefix = ...)) Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Simplify to #[pallet::call(weight(T))] Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Add stray token error Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Cleanup Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Migrate remaining pallets Using script from https://github.com/ggwpez/substrate-scripts/blob/e1b5ea5b5b4018867f3e869fce6f448b4ba9d71f/frame-code-migration/src/call_weight.rs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Try to add some docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Revert "Migrate remaining pallets" Lets do this as a follow-up, I dont want to bloat this small MR. This reverts commit 331d4b42d72de1dacaed714d69166fa1bc9c92dd. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Renames Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Review fixes Co-authored-by: Sam Johnson <sam@durosoft.com> Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Test weights Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update UI tests Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/support/procedural/src/pallet/parse/mod.rs Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com> * Remove old code Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update docs Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Muharem Ismailov <ismailov.m.h@gmail.com>
This commit is contained in:
committed by
GitHub
parent
6e5141fc23
commit
b5201fa0ec
@@ -568,7 +568,7 @@ pub mod pallet {
|
||||
CallbackFailed,
|
||||
}
|
||||
|
||||
#[pallet::call]
|
||||
#[pallet::call(weight(<T as Config<I>>::WeightInfo))]
|
||||
impl<T: Config<I>, I: 'static> Pallet<T, I> {
|
||||
/// Issue a new class of fungible assets from a public origin.
|
||||
///
|
||||
@@ -590,7 +590,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(0)]
|
||||
#[pallet::weight(T::WeightInfo::create())]
|
||||
pub fn create(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -654,7 +653,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(1)]
|
||||
#[pallet::weight(T::WeightInfo::force_create())]
|
||||
pub fn force_create(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -680,7 +678,6 @@ pub mod pallet {
|
||||
///
|
||||
/// The asset class must be frozen before calling `start_destroy`.
|
||||
#[pallet::call_index(2)]
|
||||
#[pallet::weight(T::WeightInfo::start_destroy())]
|
||||
pub fn start_destroy(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
|
||||
let maybe_check_owner = match T::ForceOrigin::try_origin(origin) {
|
||||
Ok(_) => None,
|
||||
@@ -749,7 +746,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Each successful call emits the `Event::Destroyed` event.
|
||||
#[pallet::call_index(5)]
|
||||
#[pallet::weight(T::WeightInfo::finish_destroy())]
|
||||
pub fn finish_destroy(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
|
||||
let _ = ensure_signed(origin)?;
|
||||
let id: T::AssetId = id.into();
|
||||
@@ -769,7 +765,6 @@ pub mod pallet {
|
||||
/// Weight: `O(1)`
|
||||
/// Modes: Pre-existing balance of `beneficiary`; Account pre-existence of `beneficiary`.
|
||||
#[pallet::call_index(6)]
|
||||
#[pallet::weight(T::WeightInfo::mint())]
|
||||
pub fn mint(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -799,7 +794,6 @@ pub mod pallet {
|
||||
/// Weight: `O(1)`
|
||||
/// Modes: Post-existence of `who`; Pre & post Zombie-status of `who`.
|
||||
#[pallet::call_index(7)]
|
||||
#[pallet::weight(T::WeightInfo::burn())]
|
||||
pub fn burn(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -834,7 +828,6 @@ pub mod pallet {
|
||||
/// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
|
||||
/// `target`.
|
||||
#[pallet::call_index(8)]
|
||||
#[pallet::weight(T::WeightInfo::transfer())]
|
||||
pub fn transfer(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -868,7 +861,6 @@ pub mod pallet {
|
||||
/// Modes: Pre-existence of `target`; Post-existence of sender; Account pre-existence of
|
||||
/// `target`.
|
||||
#[pallet::call_index(9)]
|
||||
#[pallet::weight(T::WeightInfo::transfer_keep_alive())]
|
||||
pub fn transfer_keep_alive(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -903,7 +895,6 @@ pub mod pallet {
|
||||
/// Modes: Pre-existence of `dest`; Post-existence of `source`; Account pre-existence of
|
||||
/// `dest`.
|
||||
#[pallet::call_index(10)]
|
||||
#[pallet::weight(T::WeightInfo::force_transfer())]
|
||||
pub fn force_transfer(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -931,7 +922,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(11)]
|
||||
#[pallet::weight(T::WeightInfo::freeze())]
|
||||
pub fn freeze(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -968,7 +958,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(12)]
|
||||
#[pallet::weight(T::WeightInfo::thaw())]
|
||||
pub fn thaw(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1004,7 +993,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(13)]
|
||||
#[pallet::weight(T::WeightInfo::freeze_asset())]
|
||||
pub fn freeze_asset(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
|
||||
let origin = ensure_signed(origin)?;
|
||||
let id: T::AssetId = id.into();
|
||||
@@ -1031,7 +1019,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(14)]
|
||||
#[pallet::weight(T::WeightInfo::thaw_asset())]
|
||||
pub fn thaw_asset(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
|
||||
let origin = ensure_signed(origin)?;
|
||||
let id: T::AssetId = id.into();
|
||||
@@ -1059,7 +1046,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(15)]
|
||||
#[pallet::weight(T::WeightInfo::transfer_ownership())]
|
||||
pub fn transfer_ownership(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1103,7 +1089,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(16)]
|
||||
#[pallet::weight(T::WeightInfo::set_team())]
|
||||
pub fn set_team(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1173,7 +1158,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(18)]
|
||||
#[pallet::weight(T::WeightInfo::clear_metadata())]
|
||||
pub fn clear_metadata(origin: OriginFor<T>, id: T::AssetIdParameter) -> DispatchResult {
|
||||
let origin = ensure_signed(origin)?;
|
||||
let id: T::AssetId = id.into();
|
||||
@@ -1257,7 +1241,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(20)]
|
||||
#[pallet::weight(T::WeightInfo::force_clear_metadata())]
|
||||
pub fn force_clear_metadata(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1297,7 +1280,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(21)]
|
||||
#[pallet::weight(T::WeightInfo::force_asset_status())]
|
||||
pub fn force_asset_status(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1354,7 +1336,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(22)]
|
||||
#[pallet::weight(T::WeightInfo::approve_transfer())]
|
||||
pub fn approve_transfer(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1381,7 +1362,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(23)]
|
||||
#[pallet::weight(T::WeightInfo::cancel_approval())]
|
||||
pub fn cancel_approval(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1418,7 +1398,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(24)]
|
||||
#[pallet::weight(T::WeightInfo::force_cancel_approval())]
|
||||
pub fn force_cancel_approval(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1468,7 +1447,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Weight: `O(1)`
|
||||
#[pallet::call_index(25)]
|
||||
#[pallet::weight(T::WeightInfo::transfer_approved())]
|
||||
pub fn transfer_approved(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
@@ -1531,7 +1509,6 @@ pub mod pallet {
|
||||
///
|
||||
/// Emits `AssetMinBalanceChanged` event when successful.
|
||||
#[pallet::call_index(28)]
|
||||
#[pallet::weight(T::WeightInfo::set_min_balance())]
|
||||
pub fn set_min_balance(
|
||||
origin: OriginFor<T>,
|
||||
id: T::AssetIdParameter,
|
||||
|
||||
Reference in New Issue
Block a user