#vesting #amount #token #time #astroport #address #astro

astroport-vesting

Astroport Vesting Contract holds tokens and releases them to the beneficiary over time

3 stable releases

1.4.0 Jun 20, 2024
1.3.2 Mar 26, 2024
1.3.1 Jul 20, 2023

#5 in #vesting

Download history 71/week @ 2024-07-28 75/week @ 2024-08-04 154/week @ 2024-08-11 256/week @ 2024-08-18 234/week @ 2024-08-25 136/week @ 2024-09-01 30/week @ 2024-09-08 45/week @ 2024-09-15 89/week @ 2024-09-22 61/week @ 2024-09-29 92/week @ 2024-10-06 94/week @ 2024-10-13 79/week @ 2024-10-20 73/week @ 2024-10-27 107/week @ 2024-11-03 16/week @ 2024-11-10

276 downloads per month
Used in 6 crates (3 directly)

GPL-3.0-only

240KB
5K SLoC

Astroport Generator Vesting

The Generator 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.

{
  "token_addr": "terra..."
}

receive

CW20 receive msg.

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

RegisterVestingAccounts

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.

Execute this message by calling the ASTRO token contract address.

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

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

{
  "RegisterVestingAccounts": {
    "vesting_accounts": [
      {
        "address": "terra...",
        "schedules": {
          "start_point": {
            "time": "1634125119000000000",
            "amount": "123"
          },
          "end_point": {
            "time": "1664125119000000000",
            "amount": "123"
          }
        }
      }
    ]
  }
}

claim

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

{
  "claim": {
    "recipient": "terra...",
    "amount": "123"
  }
}

withdraw_from_active_schedule

Withdraw tokens from active vesting schedule.
Withdraw is possible if there is only one active vesting schedule. Active schedule's remaining amount must be greater than withdraw amount. This endpoint terminates current active schedule (updates end_point) and creates a new one with remaining amount minus withdrawn amount.

{
  "withdraw_from_active_schedule": {
    "account": "terra...",
    "recipient": "terra...",
    "withdraw_amount": "123"
  }
}

QueryMsg

All query messages are described below. A custom struct is defined for each query response.

config

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

{
  "config": {}
}

vesting_account

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

{
  "vesting_account": {
    "address": "terra..."
  }
}

vesting_accounts

Returns a paginated list of vesting schedules in chronological order. Given fields are optional.

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

available amount

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

{
  "available_amount": {
    "address": "terra..."
  }
}

Dependencies

~4.5–6.5MB
~138K SLoC