Vesting
Last updated
Last updated
This module was highly inspired by the
The vesting
module provides functionality for creating and managing vesting accounts within the blockchain. Vesting
accounts are special accounts that release tokens over a specified period, ensuring a controlled distribution of tokens.
This module allows token holders to create new vesting accounts, split existing vesting accounts, and manage the vesting
process through a set of defined messages and events.
The MsgCreateVestingAccount
message allows any token holder to create a new continuous vesting account and transfer
tokens to it.
The MsgSplitVestingAccount
message enables existing vesting accounts to split their locked tokens into a new vesting
account,
preserving the total number of tokens, vesting times, and token release speed.
Creates a new continuous vesting account and sends token from the creator account.
MsgCreateVestingAccount
can be submitted by any token holder via aMsgCreateVestingAccount
transaction.
Params:
FromAddress
Vesting pool owner address
ToAddress
New continuous vesting account address
Amount
Amount to lock in vesting account
StartTime
Vesting start time - unix
EndTime
Vesting end time - unix
State modifications:
Validates if FromAddress
has enough tokens.
Creates a new continuous vesting account with address equal to ToAddress and time params according to provided data
Sends tokens from FromAddress
account to ToAddress
Split tokens that are locked in vesting to a new vesting account. Total number of tokens in vesting, vesting times and token release speed are preserved. This mechanism can also be called as a "vesting cession".
The MsgSplitVestingAccount
can be submitted by any vesting account via a MsgSplitVestingAccount
transaction.
Params:
FromAddress
Vesting pool owner address
ToAddress
New continuous vesting account address
Amount
Amount of locked vesting to split
StartTime
Vesting start time - unix
EndTime
Vesting end time - unix
State modifications:
Validates if FromAddress
has enough locked tokens in the vesting
Validates if the start time
of the new vesting account is after the start time of the original vesting account
Validates if the end time
of the new vesting account is after the end time of the original vesting account
Creates new continuous vesting account
with address equal to ToAddress
and time parameters set to:
start time
is set to the provided start time
end time
is set to the provided end time
Sends locked vesting from FromAddress account to ToAddress
The x/vesting
module provides CLI commands to interact with it:
create-vesting-account [to-address] [amount] [start-time] [end-time]
split-vesting-account [to-address] [amount] [start-time] [end-time]
Users must provide:
Valid to-address
.
amount
of coins (e.g. 1000uempe
).
start-time
and end-time
as UNIX timestamps.
Example:
This creates a vesting account starting at UNIX time 1672531200
and ending at 1704067200
.
EventNewVestingAccount
address
{new_vesting_account_address}
message
action
/chain4energy.c4echain.vesting.MsgCreateVestingAccount
message
sender
{sender_address}
transfer
recipient
{module_account}
transfer
sender
{creator}
transfer
amount
{amount}
EventVestingSplit
source
{from_account_address}
EventVestingSplit
destination
{to_account_address}
EventNewVestingAccount
address
{new_vesting_account_address}
message
action
/chain4energy.c4echain.vesting.MsgSplitVestingAccount
message
sender
{sender_address}
transfer
recipient
{module_account}
transfer
sender
{creator}
transfer
amount
{amount}