Skip to main content

Vesting

Overview​

The Vesting contract progressively unlocks ASTRO that can then be distributed to LP stakers via the Generator contract.

InstantiateMsg​

Initializes the contract with the address of the ASTRO token.

json
vesting.rs
Copy

_4
{
_4
"owner": "...",
_4
"token_addr": "..."
_4
}

ParamsTypeDescription
ownerStringAddress allowed to change contract parameters
token_addrStringThe address of the token that's being vested

ExecuteMsg​

claim​

Transfer vested tokens from all vesting schedules that have the same VestingContractAddress (address that's vesting tokens).

json
vesting.rs
Copy

_6
{
_6
"claim": {
_6
"recipient": "...",
_6
"amount": "1000000"
_6
}
_6
}

ParamsTypeDescription
recipientOption<String>The address that receives the vested tokens
amountOption<Uint128>The amount of tokens to claim

receive​

CW20 receive msg.

json
router.rs
Copy

_7
{
_7
"receive": {
_7
"sender": "terra...",
_7
"amount": "123",
_7
"msg": "<base64_encoded_json_string>"
_7
}
_7
}

ParamsTypeDescription
receiveCw20ReceiveMsgCW20 receive message

register_vesting_accounts​

Creates vesting schedules for the ASTRO token. Each vesting token should have the Generator contract address as the VestingContractAddress. Also, each schedule will unlock tokens at a different rate according to its time duration.

NOTE

You should execute this message inside the ASTRO token contract.

json
Copy

_7
{
_7
"send": {
_7
"contract": "VestingContractAddress",
_7
"amount": "999",
_7
"msg": "base64-encodedStringOfWithdrawMsg"
_7
}
_7
}

ParamsTypeDescription
sendCw20ExecuteMsgCW20 receive message

In send.msg, you may encode this JSON string into base64 encoding.

json
vesting.rs
Copy

_26
{
_26
"register_vesting_accounts": {
_26
"vesting_accounts": [
_26
{
_26
"vesting_account": {
_26
"address": "...",
_26
"schedules": [
_26
{
_26
"vesting_schedule": {
_26
"start_point": {
_26
"time": 12345,
_26
"amount": "1000000"
_26
},
_26
"end_point": {
_26
"time": 12345,
_26
"amount": "1000000"
_26
}
_26
}
_26
}
_26
]
_26
}
_26
},
_26
etc...
_26
]
_26
}
_26
}

ParamsTypeDescription
vesting_accountsVec<VestingAccount>Vesting account to register

VestingAccount​

This structure stores vesting information for a specific address that is getting tokens.

json
vesting.rs
Copy

_19
{
_19
"vesting_account": {
_19
"address": "...",
_19
"schedules": [
_19
{
_19
"vesting_schedule": {
_19
"start_point": {
_19
"time": 12345,
_19
"amount": "1000000"
_19
},
_19
"end_point": {
_19
"time": 12345,
_19
"amount": "1000000"
_19
}
_19
}
_19
}
_19
]
_19
}
_19
}

ParamsTypeDescription
addressStringThe address that is getting tokens
schedulesVec<VestingSchedule>The vesting schedules targeted at the address

VestingSchedule​

This structure stores parameters for a specific vesting schedule.

json
vesting.rs
Copy

_12
{
_12
"vesting_schedule": {
_12
"start_point": {
_12
"time": 12345,
_12
"amount": "1000000"
_12
},
_12
"end_point": {
_12
"time": 12345,
_12
"amount": "1000000"
_12
}
_12
}
_12
}

ParamsTypeDescription
start_pointVestingSchedulePointThe start date for the vesting schedule
end_pointOption<VestingSchedulePoint>The end point for the vesting schedule

VestingSchedulePoint​

This structure stores the parameters used to create a vesting schedule.

json
vesting.rs
Copy

_6
{
_6
"vesting_schedule_point": {
_6
"time": 12345,
_6
"amount": "1000000"
_6
}
_6
}

ParamsTypeDescription
timeu64The start time for the vesting schedule
amountUint128The amount of tokens being vested

QueryMsg​

config​

Queries the vesting token contract address (the ASTRO token address).

json
vesting.rs
Copy

_3
{
_3
"config": {}
_3
}

ConfigResponse​

This structure describes a custom struct used to return the contract configuration.

json
vesting.rs
Copy

_4
{
_4
"owner": "...",
_4
"token_addr": "..."
_4
}

ParamsTypeDescription
ownerAddrAddress allowed to set contract parameters
token_addrAddrThe address of the token being vested

vesting_account​

Queries all vesting schedules with their details for a specific vesting recipient.

json
vesting.rs
Copy

_5
{
_5
"vesting_account": {
_5
"address": "..."
_5
}
_5
}

ParamsTypeDescription
addressStringVesting account address

VestingAccountResponse​

This structure describes a custom struct used to return vesting data about a specific vesting target.

json
vesting.rs
Copy

_18
{
_18
"address": "...",
_18
"info": {
_18
"schedules": [
_18
{
_18
"start_point": {
_18
"time": 12345,
_18
"amount": "1000000"
_18
},
_18
"end_point": {
_18
"time": 12345,
_18
"amount": "1000000"
_18
}
_18
}
_18
],
_18
"released_amount": "1234567"
_18
}
_18
}

ParamsTypeDescription
addressAddrThe address that's vesting tokens
infoVestingInfoVesting information

VestingInfo​

json
vesting.rs
Copy

_17
{
_17
"vesting_info": {
_17
"schedules": [
_17
{
_17
"start_point": {
_17
"time": 12345,
_17
"amount": "1000000"
_17
},
_17
"end_point": {
_17
"time": 12345,
_17
"amount": "1000000"
_17
}
_17
}
_17
],
_17
"released_amount": "1234567"
_17
}
_17
}

ParamsTypeDescription
schedulesVec<VestingSchedule>The vesting schedules
released_amountUint128The total amount of ASTRO already claimed

vesting_accounts​

Queries all vesting schedules with their details for all vesting recipient. Given fields are optional.

json
vesting.rs
Copy

_9
{
_9
"vesting_accounts": {
_9
"start_after": "...",
_9
"limit": 10,
_9
"order_by": {
_9
"desc": {}
_9
}
_9
}
_9
}

ParamsTypeDescription
start_afterOption<String>Vesting account address to start after
limitOption<u32>Amount of addresses to list
order_byOption<OrderBy>Order by ascending or descending

Returns VestingAccountsResponse

OrderBy​

This enum describes the types of sorting that can be applied to some piece of data.

vesting.rs
Copy

_5
#[cw_serde]
_5
pub enum OrderBy {
_5
Asc,
_5
Desc,
_5
}

VariantsDescription
AscOrder by ascending
DescOrder by decending

available_amount​

Queries the claimable amount (vested but not yet claimed) of ASTRO tokens that a vesting target can claim.

json
vesting.rs
Copy

_5
{
_5
"available_amount": {
_5
"address": "..."
_5
}
_5
}

ParamsTypeDescription
addressStringVesting account address

Returns Uint128

timestamp​

Queries the current timestamp.

json
vesting.rs
Copy

_3
{
_3
"timestamp": {}
_3
}

Returns u64