Oracle
Overview
The Bank contract allows for the use of custom Price Providers (also known as Oracles) to provide price information for collateral tokens in different markets. This feature enables flexible and accurate price feeds tailored to specific assets and market conditions.
Supported Oracles
Soneium Mainnet
Chainlink
ASTR/USDC
0xd8cf9e97A5A695D778548F20317cBb8ac742EAcF
ETH/USDC
0xeF28882E99D08F19d6Bd2A6C3677b989DdDE02C2
LINK/USDC
0x8B7201C096c52D617Aef8c93111D20623Aa6D7d2
USDC/LINK
0xE4C355CFB514755845DcD8780eEF57924b3c280f
USDC/ETH
0x398b39819c133D40A5F09b82efAa5F62159F6C19
USDC/ASTR
0x26BD767fC3bd1DE7be92bfD31AD41D361C1B0560
ASTR/ETH
0x70cAFdABe3a39644450d12fd30A37C84440b2023
ETH/ASTR
0x2d57521A2aBd60f9d9E0BD76fd3dBBE75c982206
Pyth
ASTR/USDC
0xF6401B78c514Ab49Cc28fAd71fe958889Df449Da
ETH/USDC
0xe5dfA038EeaD1c0C717b112AF72994cf271369e8
USDC/ETH
0x2e59F5C6A69B7Cc3C00d5918E1Eabd550A126D16
USDC/ASTR
0x94fdbde6030Ae150d83a19aEf28E3680bf7cEfdA
ASTR/ETH
0xc63C1A77414D5e0F9dFD19cfE30aF31FF75681d1
ETH/ASTR
0xf47A07422a0300fefeBE8c3442C8A8D7bf0aE5dd
Soneium Minato Testnet
Chainlink
ASTR/USDC
0x0878EAe664c025bA9973aefAb95c08472caE52Bd
ETH/USDC
0x92C87643c91CA8C1B3C1dC36f797Bf9856CBae79
LINK/USDC
0x12F91388568b21fC26A1c18f9a9996aDF08C0E6c
USDC/LINK
0x9644EeF4428CA5d1Da41EE8AE6473E9ddE97fd69
USDC/ETH
0xD3C18CE12bEC4D668b824089601f6ccAC6377Ba2
USDC/ASTR
0xFCc2b860Cb0844cafAdE640DD3424aDeC2e2e11C
ASTR/ETH
0x301477d93Da128ad8543F00CF84f3262a9B8A0A0
ETH/ASTR
0xB4Ff6D357CCc62bD37BeC22F0350219F00a5555b
Pyth
ASTR/USDC
0x2E435d5129709ACD69Eb32fffB196941cE82C09e
ETH/USDC
0x7fb8456a5482f1736EA3F77Ab64da356a17f5b45
USDC/ETH
0x4B6b6963328f33ca93Acad164E627A60A6938F5a
USDC/ASTR
0xB023666b82EAe12b99A4b9aAf320B5bfe34153C2
ASTR/ETH
0xa97cb0eD84F1Cf4a07bFD4f43Cfb6045674c6E99
ETH/ASTR
0x07f6693C8Cf6c5d019d328572dB89Fa063804bE0
PriceProvider Interface
Custom Price Providers must implement the IPriceProvider
interface:
Key Functions
isPriceProvider()
: Validates that the contract is a legitimate Price Provider.getCollateralTokenPrice()
: Returns the current price of the collateral token denominated in the loan token.
Creating a Custom Price Provider
To create a custom Price Provider:
Implement the
IPriceProvider
interface.Define your price fetching logic in the
getCollateralTokenPrice()
function.Ensure
isPriceProvider()
returnstrue
.
Example:
Using a Custom Price Provider
Deploy your custom Price Provider contract.
When creating a new market, include the address of your Price Provider in the
marketConfigs.oracle
field:
Important Notes
Unlike IRMs, Price Providers do not need to be registered with the Bank contract before use.
Ensure your Price Provider returns prices in the correct denomination (collateral token price in terms of the loan token).
The Bank contract will call the Price Provider's
getCollateralTokenPrice()
function during various operations, including liquidations, so make sure it's gas-efficient and always returns a valid price.For production use, consider implementing additional security measures such as:
Price update frequency limits
Multiple data sources for price information
Deviation checks to prevent sudden large price changes
Test your Price Provider thoroughly before deployment to avoid potential issues in live markets.
In the example above, the price is set manually. In a real-world scenario, you would typically fetch this data from reliable external sources.
Security Considerations
Ensure that only authorized entities can update the price in your Price Provider.
Consider implementing circuit breakers or pause mechanisms for emergency situations.
Regularly audit and monitor your Price Provider to ensure it's functioning correctly.
By following these guidelines, you can create and integrate custom Price Providers to provide accurate and reliable price data for various assets within the Bank ecosystem. This flexibility allows for the creation of markets with different collateral types while ensuring proper valuation for lending and liquidation purposes.
Last updated