Canary Continuos Oracle
Superstate Oracle
function calculateRealtimePrice(
uint256 targetTimestamp,
int192 earlierRoundDataPrice,
uint256 earlierRoundDataTimestamp,
int192 laterRoundDataPrice,
uint256 laterRoundDataTimestamp
) external pure returns (int256 answer) {
uint256 timeSinceLastPrice = targetTimestamp - laterRoundDataTimestamp;
uint256 timeBetweenPrices = laterRoundDataTimestamp - earlierRoundDataTimestamp;
int192 priceDelta;
if (laterRoundDataPrice >= earlierRoundDataPrice) {
priceDelta = laterRoundDataPrice - earlierRoundDataPrice;
} else {
priceDelta = earlierRoundDataPrice - laterRoundDataPrice;
}
uint256 extrapolatedChange = (uint256(int256(priceDelta)) * timeSinceLastPrice) / timeBetweenPrices;
if (laterRoundDataPrice >= earlierRoundDataPrice) {
// Price is increasing or flat
answer = int256(laterRoundDataPrice) + int256(extrapolatedChange);
} else {
// Price is decreasing
answer = int256(laterRoundDataPrice) - int256(extrapolatedChange);
}Ondo USDY Range Oracle
Daily Fixed Interest Rate Model
Example: T-bill Interest Rate
Key Features
Range Oracle Risks for Fixed Daily Interest Rate Model
Last updated