Trait frame_support::traits::tokens::currency::MultiTokenVestingLocks
source · pub trait MultiTokenVestingLocks<AccountId> {
type Moment;
type Currency: MultiTokenCurrency<AccountId>;
// Required methods
fn unlock_tokens(
who: &AccountId,
token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId,
unlock_amount: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance
) -> Result<(Self::Moment, <Self::Currency as MultiTokenCurrency<AccountId>>::Balance), DispatchError>;
fn unlock_tokens_by_vesting_index(
who: &AccountId,
token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId,
vesting_index: u32,
unlock_some_amount_or_all: Option<<Self::Currency as MultiTokenCurrency<AccountId>>::Balance>
) -> Result<(<Self::Currency as MultiTokenCurrency<AccountId>>::Balance, Self::Moment, <Self::Currency as MultiTokenCurrency<AccountId>>::Balance), DispatchError>;
fn lock_tokens(
who: &AccountId,
token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId,
lock_amount: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance,
starting_block: Option<Self::Moment>,
ending_block_as_balance: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance
) -> DispatchResult;
}
Required Associated Types§
sourcetype Currency: MultiTokenCurrency<AccountId>
type Currency: MultiTokenCurrency<AccountId>
The currency that this schedule applies to.
Required Methods§
sourcefn unlock_tokens(
who: &AccountId,
token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId,
unlock_amount: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance
) -> Result<(Self::Moment, <Self::Currency as MultiTokenCurrency<AccountId>>::Balance), DispatchError>
fn unlock_tokens( who: &AccountId, token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId, unlock_amount: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance ) -> Result<(Self::Moment, <Self::Currency as MultiTokenCurrency<AccountId>>::Balance), DispatchError>
Finds a vesting schedule with locked_at value greater than unlock_amount Removes that old vesting schedule, adds a new one with new_locked and new_per_block reflecting old locked_at - unlock_amount, to be unlocked by old ending block. This does not transfer funds
sourcefn unlock_tokens_by_vesting_index(
who: &AccountId,
token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId,
vesting_index: u32,
unlock_some_amount_or_all: Option<<Self::Currency as MultiTokenCurrency<AccountId>>::Balance>
) -> Result<(<Self::Currency as MultiTokenCurrency<AccountId>>::Balance, Self::Moment, <Self::Currency as MultiTokenCurrency<AccountId>>::Balance), DispatchError>
fn unlock_tokens_by_vesting_index( who: &AccountId, token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId, vesting_index: u32, unlock_some_amount_or_all: Option<<Self::Currency as MultiTokenCurrency<AccountId>>::Balance> ) -> Result<(<Self::Currency as MultiTokenCurrency<AccountId>>::Balance, Self::Moment, <Self::Currency as MultiTokenCurrency<AccountId>>::Balance), DispatchError>
Finds the vesting schedule with the provided index Removes that old vesting schedule, adds a new one with new_locked and new_per_block reflecting old locked_at - unlock_amount, to be unlocked by old ending block. This does not transfer funds
sourcefn lock_tokens(
who: &AccountId,
token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId,
lock_amount: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance,
starting_block: Option<Self::Moment>,
ending_block_as_balance: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance
) -> DispatchResult
fn lock_tokens( who: &AccountId, token_id: <Self::Currency as MultiTokenCurrency<AccountId>>::CurrencyId, lock_amount: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance, starting_block: Option<Self::Moment>, ending_block_as_balance: <Self::Currency as MultiTokenCurrency<AccountId>>::Balance ) -> DispatchResult
Constructs a vesting schedule based on the given data starting from now And places it into the appropriate (who, token_id) storage This does not transfer funds