mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 01:15:47 +00:00
Salary pallet (#13378)
* More drafting * Paymaster pallet * Fix build * More tests * Rename * Rename * Renaming * Revert old changes * Multi-phase payouts to avoid bank-runs * Tests * Tests * Allow payment to be targeted elsewhere * Proper ssync payment failure handling * Test for repayment * Docs * Impl RankedMembers for RankedCollective * Implement Pay for Pot (i.e. basic account). * Benchmarks * Weights * Introduce Salary benchmark into node * Fix warning * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_salary * Update primitives/arithmetic/src/traits.rs Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> * Update frame/salary/src/lib.rs Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> * Update lib.rs * Update frame/salary/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Docs * Update frame/salary/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/salary/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Fix * Fixes * Fixes * Move some salary traits stuff to a shared location * Fix * Update frame/salary/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update frame/salary/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Mul floor * Fix warnings * Fix test * Docs --------- Co-authored-by: command-bot <> Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
use codec::{Decode, Encode, FullCodec, MaxEncodedLen};
|
||||
use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero};
|
||||
use sp_core::RuntimeDebug;
|
||||
use sp_runtime::{ArithmeticError, DispatchError, TokenError};
|
||||
use sp_runtime::{traits::Convert, ArithmeticError, DispatchError, TokenError};
|
||||
use sp_std::fmt::Debug;
|
||||
|
||||
/// One of a number of consequences of withdrawing a fungible from an account.
|
||||
@@ -225,3 +225,18 @@ impl<CollectionId, ItemId> Locker<CollectionId, ItemId> for () {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieve the salary for a member of a particular rank.
|
||||
pub trait GetSalary<Rank, AccountId, Balance> {
|
||||
/// Retrieve the salary for a given rank. The account ID is also supplied in case this changes
|
||||
/// things.
|
||||
fn get_salary(rank: Rank, who: &AccountId) -> Balance;
|
||||
}
|
||||
|
||||
/// Adapter for a rank-to-salary `Convert` implementation into a `GetSalary` implementation.
|
||||
pub struct ConvertRank<C>(sp_std::marker::PhantomData<C>);
|
||||
impl<A, R, B, C: Convert<R, B>> GetSalary<R, A, B> for ConvertRank<C> {
|
||||
fn get_salary(rank: R, _: &A) -> B {
|
||||
C::convert(rank)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user