Skip to main content
logo

vesting

The Vesting contract is responsible for distributing the MARS token to Mars contributors.

InstantiateMsg

Instantiates the Vesting contract. Takes in a contract owner and an unlock_schedule for token unlocking. Schedule is the same for all users.

json
msg.rs
Copy

_8
{
_8
"owner": "...",
_8
"unlock_schedule": {
_8
"start_time": 123,
_8
"cliff": 123,
_8
"duration": 123
_8
}
_8
}

ParamsTypeDescription
ownerStringThe contract's owner
unlock_scheduleScheduleSchedule for token unlocking; this schedule is the same for all users

Schedule

json
msg.rs
Copy

_5
{
_5
"start_time": 123,
_5
"cliff": 123,
_5
"duration": 123
_5
}

ParamsTypeDescription
start_timeu64Time when vesting/unlocking starts
cliffu64Time before with no token is to be vested/unlocked
durationu64Duration of the vesting/unlocking process. At time start_time + duration, the tokens are vested/unlocked in full

ExecuteMsg

create_position

Creates a new vesting position for a user.

json
msg.rs
Copy

_10
{
_10
"create_position": {
_10
"user" "mars...",
_10
"vest_schedule": {
_10
"start_time": 123,
_10
"cliff": 123,
_10
"duration": 123
_10
}
_10
}
_10
}

ParamsTypeDescription
userStringUser address receiving vested tokens
vest_scheduleScheduleSchedule for token unlocking; this schedule is the same for all users

terminate_position

Terminates a vesting position, and collects all unvested tokens.

json
msg.rs
Copy

_5
{
_5
"terminate_position": {
_5
"user": "..."
_5
}
_5
}

ParamsTypeDescription
userStringUser address being terminated

withdraw

Withdraws vested and unlocked MARS tokens.

json
msg.rs
Copy

_3
{
_3
"withdraw": {}
_3
}

transfer_ownership

Transfers the contract's ownership to another account.

json
msg.rs
Copy

_3
{
_3
"transfer_ownership": {}
_3
}

QueryMsg

config

Returns the contract's configuration parameters.

json
msg.rs
Copy

_3
{
_3
"config": {}
_3
}

ConfigResponse

json
msg.rs
Copy

_8
{
_8
"owner": "...",
_8
"unlock_schedule": {
_8
"start_time": 123,
_8
"cliff": 123,
_8
"duration": 123
_8
}
_8
}

ParamsTypeDescription
ownerStringThe contract's owner
unlock_scheduleScheduleSchedule for token unlocking; this schedule is the same for all users

voting_power

Returns the amount of MARS tokens of a vesting recipient currently locked in the contract.

json
msg.rs
Copy

_5
{
_5
"voting_power": {
_5
"user": "mars..."
_5
}
_5
}

ParamsTypeDescription
userStringAddress of the user

VotingPowerResponse

json
msg.rs
Copy

_4
{
_4
"user": "mars...",
_4
"voting_power": 123
_4
}

ParamsTypeDescription
userStringAddress of the user
voting_powerUint128The user's current voting power, i.e. the amount of MARS tokens locked in vesting contract

voting_powers

Enumerates all vesting recipients and returns their current voting power.

json
msg.rs
Copy

_6
{
_6
"voting_powers": {
_6
"start_after": "mars...",
_6
"limit": 123
_6
}
_6
}

ParamsTypeDescription
start_afterOption<String>A Mars account address to start after
limitOption<u32>The amount of addresses to list

Vec<VotingPowerResponse>

voting_powers returns a vector of the VotingPowerResponse struct defined above.

position

Returns details of a recipient's vesting position. Note: This query depends on block time, therefore it may not work with time travel queries. In such cases, use WASM raw query instead.

json
msg.rs
Copy

_5
{
_5
"position": {
_5
"user": "mars..."
_5
}
_5
}

ParamsTypeDescription
userStringAddress of the user

PositionResponse

json
msg.rs
Copy

_13
{
_13
"user": "mars...",
_13
"total": 123,
_13
"vested": 123,
_13
"unlocked": 123,
_13
"withdrawn": 123,
_13
"withdrawable": 123,
_13
"vest_schedule": {
_13
"start_time": 123,
_13
"cliff": 123,
_13
"duration": 123
_13
}
_13
}

ParamsTypeDescription
userStringAddress of the user
totalUint128Total amount of MARS tokens allocated to this recipient
vestedUint128Amount of tokens that have been vested, according to the vesting schedule
unlockedUint128Amount of tokens that have been unlocked, according to the unlocking schedule
withdrawnUint128Amount of tokens that have already been withdrawn
withdrawableUint128Amount of tokens that can be withdrawn now, defined as the smaller of vested and unlocked amounts, minus the amount already withdrawn
vest_scheduleScheduleThe vesting position's vesting schedule

positions

Enumerates all vesting positions. Note: This query depends on block time, therefore it may not work with time travel queries. In such cases, use WASM raw query instead.

json
msg.rs
Copy

_6
{
_6
"positions": {
_6
"start_after": "mars...",
_6
"limit": 123,
_6
}
_6
}

ParamsTypeDescription
start_afterOption<String>A Mars account address to start after
limitOption<u32>The amount of addresses to list

Vec<PositionResponse>

positions returns a vector of the PositionResponse struct defined above.