Price Oracle
The Price Oracle contract is a vital component of the Mimic protocol, responsible for providing price data to support various operations and calculations within the decentralized ecosystem. It acts as an oracle, fetching and storing price information from external sources, which can be accessed by other contracts or components within the Mimic protocol.
The contract code of the Price Oracle can be found here.
Functionality
The Price Oracle contract provides the following key functions:
Get on-chain price
This function can be used to fetch the price for a token (base
) expressed in a second token (quote
).
The standard implementation provided by Mimic utilizes Chainlink's feeds to retrieve on-chain prices. However, users have the flexibility to integrate their preferred implementation that adheres to this interface. It's important to note that the price result should be expressed with the appropriate number of decimals. This ensures that when performing a fixed-point multiplication with a base
amount, the resulting value is expressed in the decimals of the quote
token.
Get off-chain price
This function allows fetching the price for a token (base
) expressed in a second token (quote
) by relying on external data that must be signed by a trusted party. In case the required price is unavailable in the provided external data, the function falls back to using the on-chain getter.
Configuration
It also provides the following configuration:
Feeds
This function allows users to whitelist different feeds they trust to fetch on-chain prices. The sender must be allowed by the Authorizer to perform this action.
Signers
This function enables users to whitelist different signers they trust to provide off-chain prices. The sender must be allowed by the Authorizer to execute this function.
Security Considerations
As with other components in the Mimic architecture, the Price Oracle contract does not enforce any specific permissions layout. It provides users with the flexibility to configure permissions according to their specific requirements and preferences.
When utilizing the Price Oracle, users have the responsibility to determine who is authorized to configure critical information, such as on-chain price feeds and off-chain trusted price signers. It is crucial to carefully evaluate and select trusted sources for price feeds and signers. Mimic does not impose any specific feeds or signers, allowing users to choose the ones they deem reliable.
Last updated