mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 23:51:05 +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:
@@ -98,7 +98,7 @@ use frame_support::traits::{
|
||||
use sp_runtime::{Permill, ModuleId, Percent, RuntimeDebug, traits::{
|
||||
Zero, StaticLookup, AccountIdConversion, Saturating, Hash, BadOrigin
|
||||
}};
|
||||
use frame_support::weights::{Weight, MINIMUM_WEIGHT, SimpleDispatchInfo};
|
||||
use frame_support::weights::{Weight, MINIMUM_WEIGHT, DispatchClass};
|
||||
use frame_support::traits::{Contains, EnsureOrigin};
|
||||
use codec::{Encode, Decode};
|
||||
use frame_system::{self as system, ensure_signed, ensure_root};
|
||||
@@ -327,7 +327,7 @@ decl_module! {
|
||||
/// - Limited storage reads.
|
||||
/// - One DB change, one extra DB entry.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(500_000_000)]
|
||||
#[weight = 500_000_000]
|
||||
fn propose_spend(
|
||||
origin,
|
||||
#[compact] value: BalanceOf<T>,
|
||||
@@ -354,7 +354,7 @@ decl_module! {
|
||||
/// - Limited storage reads.
|
||||
/// - One DB clear.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(100_000_000)]
|
||||
#[weight = (100_000_000, DispatchClass::Operational)]
|
||||
fn reject_proposal(origin, #[compact] proposal_id: ProposalIndex) {
|
||||
T::RejectOrigin::try_origin(origin)
|
||||
.map(|_| ())
|
||||
@@ -376,7 +376,7 @@ decl_module! {
|
||||
/// - Limited storage reads.
|
||||
/// - One DB change.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedOperational(100_000_000)]
|
||||
#[weight = (100_000_000, DispatchClass::Operational)]
|
||||
fn approve_proposal(origin, #[compact] proposal_id: ProposalIndex) {
|
||||
T::ApproveOrigin::try_origin(origin)
|
||||
.map(|_| ())
|
||||
@@ -405,7 +405,7 @@ decl_module! {
|
||||
/// - One storage mutation (codec `O(R)`).
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(100_000_000)]
|
||||
#[weight = 100_000_000]
|
||||
fn report_awesome(origin, reason: Vec<u8>, who: T::AccountId) {
|
||||
let finder = ensure_signed(origin)?;
|
||||
|
||||
@@ -447,7 +447,7 @@ decl_module! {
|
||||
/// - Two storage removals (one read, codec `O(T)`).
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
|
||||
#[weight = 50_000_000]
|
||||
fn retract_tip(origin, hash: T::Hash) {
|
||||
let who = ensure_signed(origin)?;
|
||||
let tip = Tips::<T>::get(&hash).ok_or(Error::<T>::UnknownTip)?;
|
||||
@@ -479,7 +479,7 @@ decl_module! {
|
||||
/// - Two storage insertions (codecs `O(R)`, `O(T)`), one read `O(1)`.
|
||||
/// - One event.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(150_000_000)]
|
||||
#[weight = 150_000_000]
|
||||
fn tip_new(origin, reason: Vec<u8>, who: T::AccountId, tip_value: BalanceOf<T>) {
|
||||
let tipper = ensure_signed(origin)?;
|
||||
ensure!(T::Tippers::contains(&tipper), BadOrigin);
|
||||
@@ -513,7 +513,7 @@ decl_module! {
|
||||
/// - One storage mutation (codec `O(T)`), one storage read `O(1)`.
|
||||
/// - Up to one event.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
|
||||
#[weight = 50_000_000]
|
||||
fn tip(origin, hash: T::Hash, tip_value: BalanceOf<T>) {
|
||||
let tipper = ensure_signed(origin)?;
|
||||
ensure!(T::Tippers::contains(&tipper), BadOrigin);
|
||||
@@ -539,7 +539,7 @@ decl_module! {
|
||||
/// - One storage retrieval (codec `O(T)`) and two removals.
|
||||
/// - Up to three balance operations.
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
|
||||
#[weight = 50_000_000]
|
||||
fn close_tip(origin, hash: T::Hash) {
|
||||
ensure_signed(origin)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user