use super::{super::misc::WithdrawReasons, Currency};
use crate::{dispatch::DispatchResult, traits::misc::Get};
pub type LockIdentifier = [u8; 8];
pub trait LockableCurrency<AccountId>: Currency<AccountId> {
type Moment;
type MaxLocks: Get<u32>;
fn set_lock(
id: LockIdentifier,
who: &AccountId,
amount: Self::Balance,
reasons: WithdrawReasons,
);
fn extend_lock(
id: LockIdentifier,
who: &AccountId,
amount: Self::Balance,
reasons: WithdrawReasons,
);
fn remove_lock(id: LockIdentifier, who: &AccountId);
}
pub trait VestingSchedule<AccountId> {
type Moment;
type Currency: Currency<AccountId>;
fn vesting_balance(who: &AccountId)
-> Option<<Self::Currency as Currency<AccountId>>::Balance>;
fn add_vesting_schedule(
who: &AccountId,
locked: <Self::Currency as Currency<AccountId>>::Balance,
per_block: <Self::Currency as Currency<AccountId>>::Balance,
starting_block: Self::Moment,
) -> DispatchResult;
fn can_add_vesting_schedule(
who: &AccountId,
locked: <Self::Currency as Currency<AccountId>>::Balance,
per_block: <Self::Currency as Currency<AccountId>>::Balance,
starting_block: Self::Moment,
) -> DispatchResult;
fn remove_vesting_schedule(who: &AccountId, schedule_index: u32) -> DispatchResult;
}