Trait ReleaseSchedule

Source
pub trait ReleaseSchedule<AccountId, Reason> {
    type Moment;
    type Currency: InspectHold<AccountId> + MutateHold<AccountId> + BalancedHold<AccountId>;

    // Required methods
    fn vesting_balance(
        who: &AccountId,
        reason: Reason,
    ) -> Option<<Self::Currency as Inspect<AccountId>>::Balance>;
    fn total_scheduled_amount(
        who: &AccountId,
        reason: Reason,
    ) -> Option<<Self::Currency as Inspect<AccountId>>::Balance>;
    fn vest(
        who: AccountId,
        reason: Reason,
    ) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError>;
    fn add_release_schedule(
        who: &AccountId,
        locked: <Self::Currency as Inspect<AccountId>>::Balance,
        per_block: <Self::Currency as Inspect<AccountId>>::Balance,
        starting_block: Self::Moment,
        reason: Reason,
    ) -> DispatchResult;
    fn set_release_schedule(
        who: &AccountId,
        locked: <Self::Currency as Inspect<AccountId>>::Balance,
        per_block: <Self::Currency as Inspect<AccountId>>::Balance,
        starting_block: Self::Moment,
        reason: Reason,
    ) -> DispatchResult;
    fn can_add_release_schedule(
        who: &AccountId,
        locked: <Self::Currency as Inspect<AccountId>>::Balance,
        per_block: <Self::Currency as Inspect<AccountId>>::Balance,
        starting_block: Self::Moment,
        reason: Reason,
    ) -> DispatchResult;
    fn remove_vesting_schedule(
        who: &AccountId,
        schedule_index: u32,
        reason: Reason,
    ) -> DispatchResult;
    fn remove_all_vesting_schedules(
        who: &AccountId,
        reason: Reason,
    ) -> DispatchResult;
}
Expand description

A release schedule over a fungible. This allows a particular fungible to have release limits applied to it.

Required Associated Types§

Source

type Moment

The quantity used to denote time; usually just a BlockNumber.

Source

type Currency: InspectHold<AccountId> + MutateHold<AccountId> + BalancedHold<AccountId>

The currency that this schedule applies to.

Required Methods§

Source

fn vesting_balance( who: &AccountId, reason: Reason, ) -> Option<<Self::Currency as Inspect<AccountId>>::Balance>

Get the amount that is possible to vest (i.e release) at the current block

Source

fn total_scheduled_amount( who: &AccountId, reason: Reason, ) -> Option<<Self::Currency as Inspect<AccountId>>::Balance>

Get the amount that was scheduled, regardless if it was already vested or not

Source

fn vest( who: AccountId, reason: Reason, ) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError>

Release the vested amount of the given account.

Source

fn add_release_schedule( who: &AccountId, locked: <Self::Currency as Inspect<AccountId>>::Balance, per_block: <Self::Currency as Inspect<AccountId>>::Balance, starting_block: Self::Moment, reason: Reason, ) -> DispatchResult

Adds a release schedule to a given account.

If the account has MaxVestingSchedules, an Error is returned and nothing is updated.

Is a no-op if the amount to be vested is zero.

NOTE: This doesn’t alter the free balance of the account.

Source

fn set_release_schedule( who: &AccountId, locked: <Self::Currency as Inspect<AccountId>>::Balance, per_block: <Self::Currency as Inspect<AccountId>>::Balance, starting_block: Self::Moment, reason: Reason, ) -> DispatchResult

Set a release schedule to a given account, without locking any funds.

If the account has MaxVestingSchedules, an Error is returned and nothing is updated.

Is a no-op if the amount to be vested is zero.

NOTE: This doesn’t alter the free balance of the account.

Source

fn can_add_release_schedule( who: &AccountId, locked: <Self::Currency as Inspect<AccountId>>::Balance, per_block: <Self::Currency as Inspect<AccountId>>::Balance, starting_block: Self::Moment, reason: Reason, ) -> DispatchResult

Checks if add_release_schedule would work against who.

Source

fn remove_vesting_schedule( who: &AccountId, schedule_index: u32, reason: Reason, ) -> DispatchResult

Remove a release schedule for a given account.

NOTE: This doesn’t alter the free balance of the account.

Source

fn remove_all_vesting_schedules( who: &AccountId, reason: Reason, ) -> DispatchResult

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§