3 stable releases

2.2.0 Sep 27, 2024
2.1.0 Jun 20, 2024
1.1.0 Jul 20, 2023

#8 in #astro

Download history 88/week @ 2024-07-24 71/week @ 2024-07-31 80/week @ 2024-08-07 217/week @ 2024-08-14 228/week @ 2024-08-21 176/week @ 2024-08-28 114/week @ 2024-09-04 50/week @ 2024-09-11 63/week @ 2024-09-18 215/week @ 2024-09-25 92/week @ 2024-10-02 106/week @ 2024-10-09 85/week @ 2024-10-16 68/week @ 2024-10-23 79/week @ 2024-10-30 81/week @ 2024-11-06

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

GPL-3.0-only

225KB
5K SLoC

Astroport xASTRO Staking

This staking contract allows ASTRO holders to stake their tokens in exchange for xASTRO. The amount of ASTRO they can claim later increases as accrued fees in the Maker contract get swapped to ASTRO which is then sent to stakers.


InstantiateMsg

Initializes the contract with the token code ID used by ASTRO and the ASTRO token address.

{
  "token_code_id": 123,
  "deposit_token_addr": "terra..."
}

ExecuteMsg

receive

CW20 receive msg.

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

Enter

Deposits ASTRO in the xASTRO staking contract.

Execute this message by calling the ASTRO token contract and use a message like this:

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

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

{
  "enter": {}
}

leave

Burns xASTRO and unstakes underlying ASTRO (initial staked amount + accrued ASTRO since staking).

Execute this message by calling the xASTRO token contract and use a message like this:

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

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

{
  "leave": {}
}

QueryMsg

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

config

Returns the ASTRO and xASTRO addresses.

{
  "config": {}
}

get_total_shares

Returns the total amount of xASTRO tokens.

{
  "get_total_shares": {}
}

get_total_deposit

Returns the total amount of ASTRO deposits in the staking contract.

{
  "get_total_deposit": {}
}

Dependencies

~17MB
~375K SLoC