This demo oracle contract calculates a 1 day TWAP for a xy=k Astroport pool.
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"
}
}
]
}
Updates the local TWAP value and the target pair's cumulative prices.
{
"update": {}
}
All query messages are described below. A custom struct is defined for each query response.
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"
}
}