Skip to main content

Vesting

Overview​

The Vesting contract unlocks a token for registered accounts along time-based schedules. Astroport used it to fund ASTRO emissions: the Generator, and later Incentives, had vesting accounts and claimed ASTRO from them to pay LP stakers.

NOTE

ASTRO emissions are zero under long-term support. Every schedule registered in the Terra and Neutron Vesting contracts ended in 2024.

The vested token is set at instantiate as an AssetInfo: ASTRO (IBC) on Terra and ASTRO (tokenfactory) on Neutron.

InstantiateMsg​

json
vesting.rs
Copy

_8
{
_8
"owner": "neutron1ffus553eet978k024lmssw0czsxwr97mggyv85lpcsdkft8v9ufsz3sa07",
_8
"vesting_token": {
_8
"native_token": {
_8
"denom": "factory/neutron1ffus553eet978k024lmssw0czsxwr97mggyv85lpcsdkft8v9ufsz3sa07/astro"
_8
}
_8
}
_8
}

ParamsTypeDescription
ownerStringAddress allowed to register vesting accounts and change the owner
vesting_tokenAssetInfoThe token being vested

ExecuteMsg​

claim​

Sends the sender's unlocked tokens, across all of its schedules, to recipient (default: the sender). Without amount, everything available is sent; with it, amount must not exceed what's available.

json
vesting.rs
Copy

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

ParamsTypeDescription
recipientOption<String>The address that receives the tokens. Defaults to the sender
amountOption<Uint128>The amount to claim. Defaults to everything available

register_vesting_accounts​

Owner only. Registers vesting schedules for one or more accounts. The tokens for every schedule must be paid in the same call: for a native vesting token, attach exactly the sum of the schedules' amounts; for a CW20 vesting token, use the CW20 receive hook below.

json
vesting.rs
Copy

_21
{
_21
"register_vesting_accounts": {
_21
"vesting_accounts": [
_21
{
_21
"address": "neutron1...",
_21
"schedules": [
_21
{
_21
"start_point": {
_21
"time": 1798416000,
_21
"amount": "0"
_21
},
_21
"end_point": {
_21
"time": 1830038400,
_21
"amount": "1000000000"
_21
}
_21
}
_21
]
_21
}
_21
]
_21
}
_21
}

ParamsTypeDescription
addressStringThe account receiving the tokens
schedulesVec<VestingSchedule>The account's schedules
start_pointVestingSchedulePointTime (seconds) and amount unlocked at the start. Without an end_point, the whole amount unlocks at time
end_pointOption<VestingSchedulePoint>Time and total amount unlocked at the end. Between the two points, tokens unlock linearly

receive​

CW20 receive hook, for a CW20 vesting token. Send the tokens from the owner with a CW20 send whose msg is the base64 of a register_vesting_accounts message (same fields as above).


_7
{
_7
"send": {
_7
"contract": "<vesting contract>",
_7
"amount": "1000000000",
_7
"msg": "<base64 of {\"register_vesting_accounts\":{\"vesting_accounts\":[...]}}>"
_7
}
_7
}

withdraw_from_active_schedule​

Owner only. Takes withdraw_amount of the still-locked tokens out of an account's only active schedule and sends them to recipient (default: the owner). The schedule restarts from now with what's left. Fails if the account has no active schedule or more than one.


_7
{
_7
"withdraw_from_active_schedule": {
_7
"account": "neutron1...",
_7
"recipient": "neutron1...",
_7
"withdraw_amount": "1000000"
_7
}
_7
}

propose_new_owner, drop_ownership_proposal, claim_ownership​

Two-step ownership transfer. The owner proposes a new owner with an expiry in seconds, or drops the proposal; the proposed owner claims ownership.


_6
{
_6
"propose_new_owner": {
_6
"owner": "neutron1...",
_6
"expires_in": 86400
_6
}
_6
}

QueryMsg​

config​

Returns the owner and the vesting token.

json
vesting.rs
Copy

_8
{
_8
"owner": "neutron1ffus553eet978k024lmssw0czsxwr97mggyv85lpcsdkft8v9ufsz3sa07",
_8
"vesting_token": {
_8
"native_token": {
_8
"denom": "factory/neutron1ffus553eet978k024lmssw0czsxwr97mggyv85lpcsdkft8v9ufsz3sa07/astro"
_8
}
_8
}
_8
}

Query with {"config":{}}. The example is the live Neutron response.

vesting_account​

Returns an account's schedules and how much it has already claimed.

json
vesting.rs
Copy

_5
{
_5
"vesting_account": {
_5
"address": "neutron173fd8wpfzyqnfnpwq2zhtgdstujrjz2wkprkjfr6gqg4gknctjyq6m3tch"
_5
}
_5
}

ParamsTypeDescription
addressAddrThe account
info.schedulesVec<VestingSchedule>Its schedules
info.released_amountUint128The total already claimed

vesting_accounts​

Returns several accounts, paginated. order_by is "asc" or "desc".


_7
{
_7
"vesting_accounts": {
_7
"start_after": null,
_7
"limit": 10,
_7
"order_by": "asc"
_7
}
_7
}

The response is {"vesting_accounts": [<VestingAccountResponse>, ...]}.

available_amount​

Returns the amount an account can claim right now, as a Uint128.


_5
{
_5
"available_amount": {
_5
"address": "neutron173fd8wpfzyqnfnpwq2zhtgdstujrjz2wkprkjfr6gqg4gknctjyq6m3tch"
_5
}
_5
}

timestamp​

Returns the current block time in seconds, as a u64.


_3
{
_3
"timestamp": {}
_3
}