Oracles
Solvency oracle
The Silo protocol uses the Solvency oracle to calculate Liquidation Threshold (LT) to check if the borrower is solvent or insolvent. The Solvency oracle is optional; if not set, the price of 1 will be assumed.
ISiloConfig.ConfigData memory configData0 = _siloConfig.getConfig(silo0);
// solvency oracle for silo0
address solvencyOracle = configData0.solvencyOracle;
maxLTV oracle
The Silo protocol uses the Max Loan-To-Value (maxLTV) oracle to calculate LTV to check if the borrower can borrow a given amount of an asset. maxLTV oracle is optional. If not set, it defaults to the Solvency oracle. If neither the Solvency nor the maxLTV oracle is set, the price of 1 will be assumed.
ISiloConfig.ConfigData memory configData0 = _siloConfig.getConfig(silo0);
// max LTV oracle for silo0
address maxLtvOracle = configData0.maxLtvOracle;
Quote() function
There are three cases for solvency oracles.
1- Both oracles are set: solvencyOracle in silo0 != 0 and solvencyOracle in silo1 != 0.
2- One oracle is set: solvencyOracle in silo0 == 0 or solvencyOracle in silo1 == 0
3- No oracles are set: solvencyOracle in silo0 == 0 and solvencyOracle in silo1 == 0
Both oracles are set
Both oracles must return the price using the same quote token. We don’t have any specific restrictions on quote() function decimals, except that both oracles must have the exact decimals for quote(). For example, the quote token is a dollar and solvencyOracle0.quote(1 USDC) = 1 * 10^18; solvencyOracle1.quote(1 USDT) = 1 * 10^18. It is also possible to have solvencyOracle0.quote(1 USDC) = 1 * 10^36 and solvencyOracle1.quote(1 USDT) = 1 * 10^36. Price0/Price1 must be the same as the market price of these assets. Both of these cases have the same ratio of Price0/Price1. However, larger values for decimals are preferred to improve precision in LTV calculations.
One oracle is set
Oracle must return the token's price in the exact decimals of the other token that will not use an oracle. In this case, the Other token price is represented by its token amounts.
No oracle is set (rare case)
It is the case of equal-price assets with the exact decimals. Prices for both assets are set in token amounts.