astroport-oracle

Crates.ioastroport-oracle
lib.rsastroport-oracle
version2.1.2
sourcesrc
created_at2023-07-20 17:10:39.978124
updated_at2024-03-26 12:53:36.89025
descriptionAstroport price oracle contract which works with Astroport pair contracts
homepagehttps://astroport.fi
repositoryhttps://github.com/astroport-fi/astroport
max_upload_size
id921563
size83,015
Timofey (epanchee)

documentation

README

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"
  }
}
Commit count: 1186

cargo fmt