Oracle
Overview
This Oracle contract calculates a 1 day TWAP for a xy=k Astroport pool.
Links
- Contract Repo: https://github.com/astroport-fi/astroport-core/tree/main/contracts/periphery/oracle
- contract.rs: https://github.com/astroport-fi/astroport-core/blob/main/contracts/periphery/oracle/src/contract.rs
- oracle.rs: https://github.com/astroport-fi/astroport-core/blob/main/packages/astroport/src/oracle.rs
- Tests: https://github.com/astroport-fi/astroport-core/tree/main/contracts/periphery/oracle/tests
InstantiateMsg
Instantiates the Oracle contract.
Params | Type | Description |
---|---|---|
factory_contract | String | The factory contract address |
asset_infos | Vec<AssetInfo> | The assets that have a pool for which this contract provides price feeds |
ExecuteMsg
update
Updates the local TWAP value and the target pair's cumulative prices.
QueryMsg
consult
Multiplies a token amount (token that's present in the target pool for the TWAP) by the latest TWAP value for that token.
Params | Type | Description |
---|---|---|
token | AssetInfo | The asset for which to compute a new TWAP value |
amount | Uint128 | The amount of tokens for which to compute the token price |
Returns a vector that contains objects of type (AssetInfo
, Uint256
)