Token Price Oracle
ITokenPriceOracle will be the interface that any smart contract that wants to be a price provider should inherit and comply with to be a part of the architecture.
This interface's idea is to describe the basic behavior we expect from an oracle:
canSupportPair
To be able to answer if the oracle can support a given pair of tokens.isPairAlreadySupported
To be able to answer if the oracle is already supporting the given pair of tokens.addSupportForPairIfNeeded
Being able to add support to a given pair of tokens if neededaddOrModifySupportForPair
Being able to add or modify (update) the support for a given pair of tokensquote
Being able to (if the pair is already supported) a quote between a given pair of tokens.
Adding support / supporting
Some oracle price providers might need to do some prep before being able to support the quote for a given pair of tokens. One example would be the Uniswap oracle that needs to increase the observations cardinality before being able to provide a quote for that pair. Another one, would be Chainlink oracle that needs to find a plan before being able to provide a quote.
Each provider can add support in it’s own way, but generally it only needs to be added once. It is worth mentioning that under some rare circumstances, support might be lost. Like if Chainlink stops support a specific price feed.
Last updated