vesting
The Vesting contract is responsible for distributing the MARS token to Mars contributors.
Links
- Contract address:
- Testnet address:
- Contract repo: https://github.com/mars-protocol/periphery/tree/main/contracts/vesting
- Video walkthrough: https://youtu.be/VeRMEtyLxyk
- Audits: https://github.com/mars-protocol/mars-audits/tree/main/periphery
InstantiateMsg
Instantiates the Vesting contract. Takes in a contract owner and an unlock_schedule
for token unlocking. Schedule is the same for all users.
Params | Type | Description |
---|---|---|
owner | String | The contract's owner |
unlock_schedule | Schedule | Schedule for token unlocking; this schedule is the same for all users |
Schedule
Params | Type | Description |
---|---|---|
start_time | u64 | Time when vesting/unlocking starts |
cliff | u64 | Time before with no token is to be vested/unlocked |
duration | u64 | Duration 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.
Params | Type | Description |
---|---|---|
user | String | User address receiving vested tokens |
vest_schedule | Schedule | Schedule for token unlocking; this schedule is the same for all users |
terminate_position
Terminates a vesting position, and collects all unvested tokens.
Params | Type | Description |
---|---|---|
user | String | User address being terminated |
withdraw
Withdraws vested and unlocked MARS tokens.
transfer_ownership
Transfers the contract's ownership to another account.
QueryMsg
config
Returns the contract's configuration parameters.
ConfigResponse
Params | Type | Description |
---|---|---|
owner | String | The contract's owner |
unlock_schedule | Schedule | Schedule 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.
Params | Type | Description |
---|---|---|
user | String | Address of the user |
VotingPowerResponse
Params | Type | Description |
---|---|---|
user | String | Address of the user |
voting_power | Uint128 | The 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.
Params | Type | Description |
---|---|---|
start_after | Option<String> | A Mars account address to start after |
limit | Option<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.
Params | Type | Description |
---|---|---|
user | String | Address of the user |
PositionResponse
Params | Type | Description |
---|---|---|
user | String | Address of the user |
total | Uint128 | Total amount of MARS tokens allocated to this recipient |
vested | Uint128 | Amount of tokens that have been vested, according to the vesting schedule |
unlocked | Uint128 | Amount of tokens that have been unlocked, according to the unlocking schedule |
withdrawn | Uint128 | Amount of tokens that have already been withdrawn |
withdrawable | Uint128 | Amount of tokens that can be withdrawn now, defined as the smaller of vested and unlocked amounts, minus the amount already withdrawn |
vest_schedule | Schedule | The 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.
Params | Type | Description |
---|---|---|
start_after | Option<String> | A Mars account address to start after |
limit | Option<u32> | The amount of addresses to list |
Vec<PositionResponse>
positions
returns a vector of the PositionResponse
struct defined above.