⌛Vesting
Contract in charge with distributing ASTRO to Generator LP stakers
1. Overview
The Vesting contract performs the ASTRO token distribution to LPs that stake their tokens in the Generator. Vesting can be set up to have several different schedules, each with its own start and end dates as well as with a specific amount of tokens to give out per block.
The Vesting contract code can be found here.
2. Variables & Functions
Constants
CONFIG
Stores the contract config at the given key
VESTING_INFO
This is a mapping of addresses and vesting schedules targeted at each address
OWNERSHIP_PROPOSAL
Contains a proposal to change contract ownership
MAX_LIMIT
Max amount of vesting schedules to query and return at once
DEFAULT_LIMIT
Default amount of vesting schedules to query and return at once
CONTRACT_NAME
Contract name
CONTRACT_VERSION
Contract version
Structs
InstantiateMsg
This struct holds parameters used to instantiate the Vesting contract
owner
- Address allowed to change contract parameterstoken_addr
- The address of the token that's being vested
VestingAccount
This structure stores vesting information for a specific address that is getting tokens
address
- The address that is getting tokensschedules
- The vesting schedules targeted at theaddress
VestingInfo
This structure stores parameters for a batch of vesting schedules
schedules
- Vesting schedulesreleased_amount
- The total amount of ASTRO already claimed
VestingSchedule
This structure stores parameters for a specific vesting schedule
start_point
- The start date for the vesting scheduleend_point
- The end point for the vesting schedule
VestingSchedulePoint
This structure stores the parameters used to create a vesting schedule
time
- The start time for the vesting scheduleamount
- The amount of tokens being vested
ConfigResponse
This structure describes a custom struct used to return the contract configuration
owner
- Address allowed to set contract parameterstoken_addr
- The address of the token being vested
VestingAccountResponse
This structure describes a custom struct used to return vesting data about a specific vesting target
address
- The address that's vesting tokensinfo
- Vesting information
VestingAccountsResponse
This structure describes a custom struct used to return vesting data for multiple vesting targets
vesting_accounts
- A list of accounts that are vesting tokens
Config
This structure stores the main parameters for the Vesting contract
owner
- Address that's allowed to change contract parameterstoken_addr
- The address of the ASTRO token
Functions
instantiate
(deps: DepsMut
, _env: Env
, _info: MessageInfo
, msg: InstantiateMsg)
->
StdResult<Response>
Instantiate the Vesting contract
execute
(deps: DepsMut
, env: Env
, info: MessageInfo
, msg: ExecuteMsg)
->
Result<Response
, ContractError>
Execute a function from the contract
receive_cw20
(deps: DepsMut
, env: Env
, info: MessageInfo
, cw20_msg: Cw20ReceiveMsg)
->
Result<Response
, ContractError>
Receives a message of type [Cw20ReceiveMsg
] and processes it depending on the received template
register_vesting_accounts
(deps: DepsMut
, _env: Env
, vesting_accounts: Vec<VestingAccount>
, cw20_amount: Uint128)
->
Result<Response
, ContractError>
Create new vesting schedules
claim
(deps: DepsMut
, env: Env
, info: MessageInfo
, recipient: Option<String>
, amount: Option<Uint128>)
->
Result<Response
, ContractError>
Claims vested tokens and transfers them to the vesting recipient
query
(deps: Deps
, env: Env
, msg: QueryMsg)
->
StdResult<Binary>
Exposes all the queries available in the contract
query_config
(deps: Deps)
->
StdResult<ConfigResponse>
Returns the Vesting contract configuration
query_timestamp
(env: Env)
->
StdResult<u64>
Return the current block timestamp (in seconds)
query_vesting_account
(deps: Deps
, address: String)
->
StdResult<VestingAccountResponse>
Returns the vesting data for a specific vesting recipient
query_vesting_accounts
(deps: Deps
, start_after: Option<String>
, limit: Option<u32>
, order_by: Option<OrderBy>)
->
StdResult<VestingAccountsResponse>
Returns a list of vesting schedules
query_vesting_available_amount
(deps: Deps
, env: Env
, address: String)
->
StdResult<Uint128>
Returns the available amount of vested and yet to be claimed tokens for a specific vesting recipient
migrate
(_deps: DepsMut
, _env: Env
, _msg: MigrateMsg)
->
StdResult<Response>
Used for contract migration
3. Risks
Misconfiguration of vesting schedules, resulting in the wrong addresses getting tokens.
A bug that may allow an unauthorized account to drain unvested rewards.
A bug that may prevent new vesting schedules from being created after all previous schedules were finalized.
Last updated
Was this helpful?