Oracle

Cetus’s concentrated liquidity pool can also be used as an oracle to give external developers or platforms the access to the pool’s liquidity data and historical price. This is a new choice for DeFi ecosystem in addition to those traditional oracles that are based on off-chain data. The price and data offered by Cetus-based oracle is a result that is naturally determined by actual buyers and sellers in the market.

The historical data will be stored as an array of observations. The pool will track a single observation and keep overwriting it as new blocks are confirmed. The transaction fees paid by users can determine how far into the past the historical data can be accessed.

With the price and historical data to be stored in the pool smart contract, both the risk of logical errors and oracle integration cost are reduced dramatically. It also makes it much more difficult for any attempted oracle price manipulation.

Each time observe is called the caller must specify an array containing any number of seconds ago, denoting the times to return observations from. Note that each of the given times must be more recent or as old as the oldest stored observation. time observe is called, the caller must specify an array containing any number of seconds ago, denoting the times to return observations from. Note that each of the given times must be more recent (or as old as) the oldest stored observation.

Last updated