Closed ueco-jb closed 2 years ago
That is not necessarily true.
We expect time weighted average price over say last 1 hour, to avoid attacks on the spot price by someone with lots of liquidity. (This is a common DeFi attack vector).
Time weighted average is not the inverse.
mean(2, 3, 4) is not mean(1/2, 1/3, 1/4)
If you want to implement this as a fallback for the demo contract, that could be okay. I would rather not, as we do want tests to ensure we check one side of the pair consistently.
Time weighted average is not the inverse.
Okay, since that's the key factor here then case is closed.
Currently oracle's query implementation returns only value that is set for given pair of denoms, for example:
...then do the query:
which means that selling 1
ATOM
you get 1.1MOTA
.But same query will result
NoInfo
, if you reverse sell/buy denoms:where in reality it could return
1/rate
, here: 0.9.