pub type Vesting = Pallet<Runtime>;
Aliased Type§
struct Vesting(/* private fields */);
Implementations
Source§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
Sourcepub fn vest(origin: <T as Config>::RuntimeOrigin) -> Result<(), DispatchError>
pub fn vest(origin: <T as Config>::RuntimeOrigin) -> Result<(), DispatchError>
Unlock any vested funds of the sender account.
The dispatch origin for this call must be Signed and the sender must have funds still locked under this pallet.
Emits either VestingCompleted
or VestingUpdated
.
§Complexity
O(1)
.
Sourcepub fn vest_other(
origin: <T as Config>::RuntimeOrigin,
target: <<T as Config>::Lookup as StaticLookup>::Source,
) -> Result<(), DispatchError>
pub fn vest_other( origin: <T as Config>::RuntimeOrigin, target: <<T as Config>::Lookup as StaticLookup>::Source, ) -> Result<(), DispatchError>
Unlock any vested funds of a target
account.
The dispatch origin for this call must be Signed.
target
: The account whose vested funds should be unlocked. Must have funds still locked under this pallet.
Emits either VestingCompleted
or VestingUpdated
.
§Complexity
O(1)
.
Sourcepub fn vested_transfer(
origin: <T as Config>::RuntimeOrigin,
target: <<T as Config>::Lookup as StaticLookup>::Source,
schedule: VestingInfo<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>,
) -> Result<(), DispatchError>
pub fn vested_transfer( origin: <T as Config>::RuntimeOrigin, target: <<T as Config>::Lookup as StaticLookup>::Source, schedule: VestingInfo<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>, ) -> Result<(), DispatchError>
Create a vested transfer.
The dispatch origin for this call must be Signed.
target
: The account receiving the vested funds.schedule
: The vesting schedule attached to the transfer.
Emits VestingCreated
.
NOTE: This will unlock all schedules through the current block.
§Complexity
O(1)
.
Sourcepub fn force_vested_transfer(
origin: <T as Config>::RuntimeOrigin,
source: <<T as Config>::Lookup as StaticLookup>::Source,
target: <<T as Config>::Lookup as StaticLookup>::Source,
schedule: VestingInfo<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>,
) -> Result<(), DispatchError>
pub fn force_vested_transfer( origin: <T as Config>::RuntimeOrigin, source: <<T as Config>::Lookup as StaticLookup>::Source, target: <<T as Config>::Lookup as StaticLookup>::Source, schedule: VestingInfo<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>, ) -> Result<(), DispatchError>
Force a vested transfer.
The dispatch origin for this call must be Root.
source
: The account whose funds should be transferred.target
: The account that should be transferred the vested funds.schedule
: The vesting schedule attached to the transfer.
Emits VestingCreated
.
NOTE: This will unlock all schedules through the current block.
§Complexity
O(1)
.
Sourcepub fn merge_schedules(
origin: <T as Config>::RuntimeOrigin,
schedule1_index: u32,
schedule2_index: u32,
) -> Result<(), DispatchError>
pub fn merge_schedules( origin: <T as Config>::RuntimeOrigin, schedule1_index: u32, schedule2_index: u32, ) -> Result<(), DispatchError>
Merge two vesting schedules together, creating a new vesting schedule that unlocks over the highest possible start and end blocks. If both schedules have already started the current block will be used as the schedule start; with the caveat that if one schedule is finished by the current block, the other will be treated as the new merged schedule, unmodified.
NOTE: If schedule1_index == schedule2_index
this is a no-op.
NOTE: This will unlock all schedules through the current block prior to merging.
NOTE: If both schedules have ended by the current block, no new schedule will be created
and both will be removed.
Merged schedule attributes:
starting_block
:MAX(schedule1.starting_block, scheduled2.starting_block, current_block)
.ending_block
:MAX(schedule1.ending_block, schedule2.ending_block)
.locked
:schedule1.locked_at(current_block) + schedule2.locked_at(current_block)
.
The dispatch origin for this call must be Signed.
schedule1_index
: index of the first schedule to merge.schedule2_index
: index of the second schedule to merge.
Sourcepub fn force_remove_vesting_schedule(
origin: <T as Config>::RuntimeOrigin,
target: <<T as Config>::Lookup as StaticLookup>::Source,
schedule_index: u32,
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn force_remove_vesting_schedule( origin: <T as Config>::RuntimeOrigin, target: <<T as Config>::Lookup as StaticLookup>::Source, schedule_index: u32, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Force remove a vesting schedule
The dispatch origin for this call must be Root.
target
: An account that has a vesting scheduleschedule_index
: The vesting schedule index that should be removed
Trait Implementations
Source§impl<T> BeforeAllRuntimeMigrations for Pallet<T>where
T: Config,
impl<T> BeforeAllRuntimeMigrations for Pallet<T>where
T: Config,
Source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
Source§impl<T> Benchmarking for Pallet<T>
impl<T> Benchmarking for Pallet<T>
Source§fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>
fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>
Source§fn run_benchmark(
extrinsic: &[u8],
c: &[(BenchmarkParameter, u32)],
whitelist: &[TrackedStorageKey],
verify: bool,
internal_repeats: u32,
) -> Result<Vec<BenchmarkResult>, BenchmarkError>
fn run_benchmark( extrinsic: &[u8], c: &[(BenchmarkParameter, u32)], whitelist: &[TrackedStorageKey], verify: bool, internal_repeats: u32, ) -> Result<Vec<BenchmarkResult>, BenchmarkError>
Source§impl<T> DispatchViewFunction for Pallet<T>where
T: Config,
impl<T> DispatchViewFunction for Pallet<T>where
T: Config,
fn dispatch_view_function<O>(
id: &ViewFunctionId,
input: &mut &[u8],
output: &mut O,
) -> Result<(), ViewFunctionDispatchError>where
O: Output,
Source§impl<T> GetStorageVersion for Pallet<T>where
T: Config,
impl<T> GetStorageVersion for Pallet<T>where
T: Config,
Source§fn in_code_storage_version() -> <Pallet<T> as GetStorageVersion>::InCodeStorageVersion
fn in_code_storage_version() -> <Pallet<T> as GetStorageVersion>::InCodeStorageVersion
storage_version
attribute, or
NoStorageVersionSet
if the attribute is missing.Source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
Source§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
instead. Read moreSource§impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn integrity_test()
fn integrity_test()
Source§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
Source§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
Source§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
). Read moreSource§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read moreSource§fn try_state(_n: BlockNumber) -> Result<(), DispatchError>
fn try_state(_n: BlockNumber) -> Result<(), DispatchError>
Source§fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
Source§fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
Source§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
Source§impl<T> IntegrityTest for Pallet<T>where
T: Config,
impl<T> IntegrityTest for Pallet<T>where
T: Config,
Source§impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn on_finalize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
)
fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )
Hooks::on_finalize
.Source§impl<T> OnGenesis for Pallet<T>where
T: Config,
impl<T> OnGenesis for Pallet<T>where
T: Config,
Source§fn on_genesis()
fn on_genesis()
Source§impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn on_initialize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Weight
fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Weight
Hooks::on_initialize
.Source§impl<T> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Source§fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
Hooks::pre_upgrade
.Source§fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError>
fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError>
Hooks::post_upgrade
.Source§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read moreSource§impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
Source§fn module_name() -> &'static str
fn module_name() -> &'static str
Source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Source§impl<T> PalletsInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletsInfoAccess for Pallet<T>where
T: Config,
Source§impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
fn storage_info() -> Vec<StorageInfo>
Source§impl<T> TryDecodeEntireStorage for Pallet<T>where
T: Config,
impl<T> TryDecodeEntireStorage for Pallet<T>where
T: Config,
Source§fn try_decode_entire_state() -> Result<usize, Vec<TryDecodeEntireStorageError>>
fn try_decode_entire_state() -> Result<usize, Vec<TryDecodeEntireStorageError>>
Ok(bytes_decoded)
if success.Source§impl<T> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> VestedTransfer<<T as Config>::AccountId> for Pallet<T>
impl<T> VestedTransfer<<T as Config>::AccountId> for Pallet<T>
An implementation that allows the Vesting Pallet to handle a vested transfer on behalf of another Pallet.
Source§type Moment = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
type Moment = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
BlockNumber
.Source§fn vested_transfer(
source: &<T as Config>::AccountId,
target: &<T as Config>::AccountId,
locked: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
per_block: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
starting_block: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Result<(), DispatchError>
fn vested_transfer( source: &<T as Config>::AccountId, target: &<T as Config>::AccountId, locked: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, per_block: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, starting_block: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Result<(), DispatchError>
source
to target
with the given schedule:
- locked
: The amount to be transferred and for the vesting schedule to apply to.
- per_block
: The amount to be unlocked each block. (linear vesting)
- starting_block
: The block where the vesting should start. This block can be in the past
or future, and should adjust when the tokens become available to the user. Read moreSource§impl<T> VestingSchedule<<T as Config>::AccountId> for Pallet<T>
impl<T> VestingSchedule<<T as Config>::AccountId> for Pallet<T>
Source§fn vesting_balance(
who: &<T as Config>::AccountId,
) -> Option<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>
fn vesting_balance( who: &<T as Config>::AccountId, ) -> Option<<<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>
Get the amount that is currently being vested and cannot be transferred out of this account.
Source§fn add_vesting_schedule(
who: &<T as Config>::AccountId,
locked: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
per_block: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
starting_block: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Result<(), DispatchError>
fn add_vesting_schedule( who: &<T as Config>::AccountId, locked: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, per_block: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, starting_block: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Result<(), DispatchError>
Adds a vesting schedule to a given account.
If the account has MaxVestingSchedules
, an Error is returned and nothing
is updated.
On success, a linearly reducing amount of funds will be locked. In order to realise any
reduction of the lock over time as it diminishes, the account owner must use vest
or
vest_other
.
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_vesting_schedule(
who: &<T as Config>::AccountId,
locked: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
per_block: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
starting_block: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Result<(), DispatchError>
fn can_add_vesting_schedule( who: &<T as Config>::AccountId, locked: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, per_block: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, starting_block: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Result<(), DispatchError>
Ensure we can call add_vesting_schedule
without error. This should always
be called prior to add_vesting_schedule
.
Source§fn remove_vesting_schedule(
who: &<T as Config>::AccountId,
schedule_index: u32,
) -> Result<(), DispatchError>
fn remove_vesting_schedule( who: &<T as Config>::AccountId, schedule_index: u32, ) -> Result<(), DispatchError>
Remove a vesting schedule for a given account.
Source§impl<T> WhitelistedStorageKeys for Pallet<T>where
T: Config,
impl<T> WhitelistedStorageKeys for Pallet<T>where
T: Config,
Source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.