Vesting

The Vesting ADO allows the vesting of tokens for one recipient which is fixed upon instantiation. The tokens can be set to release in one batch (All at once) or multiple batches which is specified by is_multi_batch_enabled upon instantiation.

A new batch can be created using the CreateBatch message which will create a batch with the funds that are sent along with the message. This message contains parameters that define the lockup period and vesting parameters. All time-related parameters are done using seconds.

Ownership of the ADO should be transferred after creating the vesting batch to the user who is vesting. For example, if party A wants to vest tokens for user B, they would create a custom batch with the vesting properties specified like lockup duration, release unit ect... (These cannot be changed by anyone once created). Then after the batch/batches have been created, they would transfer ownership of the contract to user B who can claim the tokens when the time comes.

Ado_type: vesting

InstantiateMsg

pub struct InstantiateMsg {
    pub recipient: Recipient,
    pub is_multi_batch_enabled: bool,
    pub denom: String,
    pub kernel_address: String,
    pub owner: Option<String>
}

Duration

Can be either a block height or block time in seconds.

pub enum Duration {
    Height(u64),
    Time(u64),
}

ExecuteMsg

CreateBatch

Creates a new batch with the funds sent along with the message.

Only available to the contract owner or an operator of the contract.

The attached funds should be a single native fund.

Denom of attached funds should be the same as the one specified upon instantiation.

Each batch has an Id which starts at 1 and increments by 1 for each new batch.

pub enum ExecuteMsg {
   CreateBatch {
        lockup_duration: Option<u64>,
        release_unit: u64,
        release_amount: WithdrawalType,
    }
  }

WithdrawalType

pub enum WithdrawalType {
    Amount(Uint128),
    Percentage(Decimal),
}

There are two main withdrawal types:

  • Amount: Withdraw a flat amount from the vault/strategy.

  • Percentage: Withdraw a percentage of funds found in the vault/strategy.

Claim

Claim the number of batches specified starting from the beginning. If not specified then the max amount will be claimed.

Only available to the contract owner.

pub enum ExecuteMsg {
    Claim {
        number_of_claims: Option<u64>,
        batch_id: u64,
    }
}

ClaimAll

Claims tokens from all batches using a paginated approach. If up_to_time is specified then it will only claim up to a specific time, otherwise it will claim to the most recent release.

Only available to the contract owner.

pub enum ExecuteMsg {
     ClaimAll {
        up_to_time: Option<u64>,
        limit: Option<u32>,
    },
 }

Base Executes

The rest of the execute messages can be found in the ADO Base section.

QueryMsg

Config

Queries the configuration of the contract.

pub enum QueryMsg {
     #[returns(Config)]
     Config {}
     }

ConfigResponse

Returns a config struct.

pub struct Config {
    pub recipient: Recipient,
    pub is_multi_batch_enabled: bool,
    pub denom: String,
}

Batch

Queries batch information for the batch with the specified Id.

pub enum QueryMsg {
       #[returns(BatchResponse)]
       Batch {
        id: u64,
    }
}

BatchResponse

pub struct BatchResponse {
    pub id: u64,
    pub amount: Uint128,
    pub amount_claimed: Uint128,
    pub amount_available_to_claim: Uint128,
    pub number_of_available_claims: Uint128,
    pub lockup_end: u64,
    pub release_unit: u64,
    pub release_amount: WithdrawalType,
    pub last_claimed_release_time: u64,
}

Batches

Queries multiple batches for their batch information with pagination.

pub enum QueryMsg {
      #[returns(Vec<BatchResponse>)]
      Batches {
        start_after: Option<u64>,
        limit: Option<u32>,
    }
  }

Returns a Vec<BatchResponse>.

Base Queries

The rest of the query messages can be found in the ADO Base section.

Last updated

Additional Resources

GithubWebsite