#price #astroport #pair #token #assets #contracts #pool

astroport-oracle

Astroport price oracle contract which works with Astroport pair contracts

2 stable releases

2.1.2 Mar 26, 2024
2.1.1 Jul 20, 2023

#20 in #astroport

Download history 5/week @ 2024-02-15 7/week @ 2024-02-22 1/week @ 2024-02-29 3/week @ 2024-03-07 4/week @ 2024-03-14 98/week @ 2024-03-21 32/week @ 2024-03-28 7/week @ 2024-04-04

137 downloads per month

GPL-3.0-only

225KB
5K SLoC

Astroport Oracle

This demo oracle contract calculates a 1 day TWAP for a xy=k Astroport pool.


InstantiateMsg

Initializes the oracle and checks that the target asset pair type is x*y=k.

{
  "factory_contract": "terra...",
  "asset_infos": [
    {
      "token": {
        "contract_addr": "terra..."
      }
    },
    {
      "native_token": {
        "denom": "uusd"
      }
    }
  ]
}

ExecuteMsg

update

Updates the local TWAP value and the target pair's cumulative prices.

{
  "update": {}
}

QueryMsg

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

consult

Multiplies a token amount (token that's present in the target pool for the TWAP) by the latest TWAP value for that token.

{
  "consult": {
    "token": {
      "native_token": {
        "denom": "uluna"
      }
    },
    "amount": "1000000"
  }
}

Dependencies

~4.5–6MB
~134K SLoC