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§
Sourcetype Currency: InspectHold<AccountId> + MutateHold<AccountId> + BalancedHold<AccountId>
type Currency: InspectHold<AccountId> + MutateHold<AccountId> + BalancedHold<AccountId>
The currency that this schedule applies to.
Required Methods§
Sourcefn vesting_balance(
who: &AccountId,
reason: Reason,
) -> Option<<Self::Currency as Inspect<AccountId>>::Balance>
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
Sourcefn total_scheduled_amount(
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>
Get the amount that was scheduled, regardless if it was already vested or not
Sourcefn vest(
who: AccountId,
reason: Reason,
) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError>
fn vest( who: AccountId, reason: Reason, ) -> Result<<Self::Currency as Inspect<AccountId>>::Balance, DispatchError>
Release the vested amount of the given account.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn remove_vesting_schedule(
who: &AccountId,
schedule_index: u32,
reason: Reason,
) -> DispatchResult
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.
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.