mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 02:17:58 +00:00
Introduce VestingCurrency trait (#4257)
* Introduce `VestingCurrency` trait * Return error if account already has vesting schedule
This commit is contained in:
committed by
Gavin Wood
parent
bd4f1fc54b
commit
40f6d05a4c
@@ -602,6 +602,29 @@ pub trait LockableCurrency<AccountId>: Currency<AccountId> {
|
||||
);
|
||||
}
|
||||
|
||||
/// A currency whose accounts can have balances which vest over time.
|
||||
pub trait VestingCurrency<AccountId>: Currency<AccountId> {
|
||||
/// The quantity used to denote time; usually just a `BlockNumber`.
|
||||
type Moment;
|
||||
|
||||
/// Get the amount that is currently being vested and cannot be transferred out of this account.
|
||||
fn vesting_balance(who: &AccountId) -> Self::Balance;
|
||||
|
||||
/// Adds a vesting schedule to a given account.
|
||||
///
|
||||
/// If there already exists a vesting schedule for the given account, an `Err` is returned
|
||||
/// and nothing is updated.
|
||||
fn add_vesting_schedule(
|
||||
who: &AccountId,
|
||||
locked: Self::Balance,
|
||||
per_block: Self::Balance,
|
||||
starting_block: Self::Moment,
|
||||
) -> result::Result<(), &'static str>;
|
||||
|
||||
/// Remove a vesting schedule for a given account.
|
||||
fn remove_vesting_schedule(who: &AccountId);
|
||||
}
|
||||
|
||||
bitmask! {
|
||||
/// Reasons for moving funds out of an account.
|
||||
#[derive(Encode, Decode)]
|
||||
|
||||
Reference in New Issue
Block a user