Trait VestedPayout
pub trait VestedPayout<AccountId, Balance> {
type BlockNumber;
// Required method
fn vested_transfer(
source: &AccountId,
dest: &AccountId,
amount: Balance,
duration: Self::BlockNumber,
start_at: Option<Self::BlockNumber>,
) -> Result<(), DispatchError>;
}Expand description
Transfer amount from source to dest and apply a linear vesting schedule that completes
within at most duration blocks starting from the current block.
The per-block unlock rate is rounded up so that vesting never exceeds duration blocks.
The implementor handles per-block unlock computation, block-number provider selection, and the actual fund transfer internally. Callers only specify the total amount and duration.
Unlike VestedTransfer, this trait is agnostic to both
the old Currency trait and the new
fungible::Mutate trait. The implementor (e.g. pallet_vesting)
chooses which currency mechanism to use internally, and callers do not need to provide
per_block or starting_block — only the total amount and vesting duration.
Required Associated Types§
type BlockNumber
type BlockNumber
The block number type used to express vesting duration.
Required Methods§
fn vested_transfer(
source: &AccountId,
dest: &AccountId,
amount: Balance,
duration: Self::BlockNumber,
start_at: Option<Self::BlockNumber>,
) -> Result<(), DispatchError>
fn vested_transfer( source: &AccountId, dest: &AccountId, amount: Balance, duration: Self::BlockNumber, start_at: Option<Self::BlockNumber>, ) -> Result<(), DispatchError>
Transfer amount from source to dest, locked under a linear vesting schedule
that completes within at most duration blocks.
If start_at is Some, the vesting schedule begins at that block number;
otherwise it begins at the current block.
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.