mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 03:31:05 +00:00
Weights to u64 + Balances Weights (#5446)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -260,7 +260,7 @@ use sp_runtime::{Percent, ModuleId, RuntimeDebug,
|
||||
}
|
||||
};
|
||||
use frame_support::{decl_error, decl_module, decl_storage, decl_event, ensure, dispatch::DispatchResult};
|
||||
use frame_support::weights::{SimpleDispatchInfo, Weight, WeighData};
|
||||
use frame_support::weights::{SimpleDispatchInfo, Weight, MINIMUM_WEIGHT};
|
||||
use frame_support::traits::{
|
||||
Currency, ReservableCurrency, Randomness, Get, ChangeMembers, BalanceStatus,
|
||||
ExistenceRequirement::AllowDeath, EnsureOrigin
|
||||
@@ -527,7 +527,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + B + C + logM + logB + X)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
|
||||
pub fn bid(origin, value: BalanceOf<T, I>) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
ensure!(!<SuspendedCandidates<T, I>>::contains_key(&who), Error::<T, I>::Suspended);
|
||||
@@ -566,7 +566,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(B + X)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000_000)]
|
||||
pub fn unbid(origin, pos: u32) -> DispatchResult {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -636,7 +636,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + B + C + logM + logB + X)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
|
||||
pub fn vouch(origin, who: T::AccountId, value: BalanceOf<T, I>, tip: BalanceOf<T, I>) -> DispatchResult {
|
||||
let voucher = ensure_signed(origin)?;
|
||||
// Check user is not suspended.
|
||||
@@ -677,7 +677,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(B)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000_000)]
|
||||
pub fn unvouch(origin, pos: u32) -> DispatchResult {
|
||||
let voucher = ensure_signed(origin)?;
|
||||
ensure!(Self::vouching(&voucher) == Some(VouchingStatus::Vouching), Error::<T, I>::NotVouching);
|
||||
@@ -715,7 +715,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + logM + C)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(30_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
|
||||
pub fn vote(origin, candidate: <T::Lookup as StaticLookup>::Source, approve: bool) {
|
||||
let voter = ensure_signed(origin)?;
|
||||
let candidate = T::Lookup::lookup(candidate)?;
|
||||
@@ -746,7 +746,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + logM)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000_000)]
|
||||
pub fn defender_vote(origin, approve: bool) {
|
||||
let voter = ensure_signed(origin)?;
|
||||
let members = <Members<T, I>>::get();
|
||||
@@ -778,7 +778,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + logM + P + X)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(30_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
|
||||
pub fn payout(origin) {
|
||||
let who = ensure_signed(origin)?;
|
||||
|
||||
@@ -820,7 +820,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(10_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
fn found(origin, founder: T::AccountId, max_members: u32, rules: Vec<u8>) {
|
||||
T::FounderSetOrigin::ensure_origin(origin)?;
|
||||
ensure!(!<Head<T, I>>::exists(), Error::<T, I>::AlreadyFounded);
|
||||
@@ -847,7 +847,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(20_000_000)]
|
||||
fn unfound(origin) {
|
||||
let founder = ensure_signed(origin)?;
|
||||
ensure!(Founder::<T, I>::get() == Some(founder.clone()), Error::<T, I>::NotFounder);
|
||||
@@ -889,7 +889,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + logM + B)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(30_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(30_000_000)]
|
||||
fn judge_suspended_member(origin, who: T::AccountId, forgive: bool) {
|
||||
T::SuspensionJudgementOrigin::ensure_origin(origin)?;
|
||||
ensure!(<SuspendedMembers<T, I>>::contains_key(&who), Error::<T, I>::NotSuspended);
|
||||
@@ -960,7 +960,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(M + logM + B + X)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(50_000_000)]
|
||||
fn judge_suspended_candidate(origin, who: T::AccountId, judgement: Judgement) {
|
||||
T::SuspensionJudgementOrigin::ensure_origin(origin)?;
|
||||
if let Some((value, kind)) = <SuspendedCandidates<T, I>>::get(&who) {
|
||||
@@ -1020,7 +1020,7 @@ decl_module! {
|
||||
///
|
||||
/// Total Complexity: O(1)
|
||||
/// # </weight>
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(10_000)]
|
||||
#[weight = SimpleDispatchInfo::FixedNormal(MINIMUM_WEIGHT)]
|
||||
fn set_max_members(origin, max: u32) {
|
||||
ensure_root(origin)?;
|
||||
ensure!(max > 1, Error::<T, I>::MaxMembers);
|
||||
@@ -1046,7 +1046,7 @@ decl_module! {
|
||||
Self::rotate_challenge(&mut members);
|
||||
}
|
||||
|
||||
SimpleDispatchInfo::default().weigh_data(())
|
||||
MINIMUM_WEIGHT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user