Files
no_five/contracts/interfaces/IOracleAdapter.sol

71 lines
2.0 KiB
Solidity
Raw Normal View History

2025-11-20 15:35:25 -08:00
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/**
* @title IOracleAdapter
* @notice Interface for oracle adapter
* @dev Standardizes pricing from multiple oracle sources
*/
interface IOracleAdapter {
enum OracleSource {
AAVE,
CHAINLINK,
UNISWAP_TWAP,
FALLBACK
}
/**
* @notice Price data structure
* @param price Price (scaled by 1e8 for USD pairs)
* @param source Oracle source used
* @param timestamp Timestamp of price update
* @param confidence Confidence score (0-1e18, where 1e18 = 100%)
*/
struct PriceData {
uint256 price;
OracleSource source;
uint256 timestamp;
uint256 confidence;
}
/**
* @notice Get latest price for an asset
* @param asset Asset address
* @return priceData Price data structure
*/
function getPrice(address asset) external view returns (PriceData memory priceData);
/**
* @notice Get latest price with max age requirement
* @param asset Asset address
* @param maxAge Maximum age of price in seconds
* @return priceData Price data structure
*/
function getPriceWithMaxAge(
address asset,
uint256 maxAge
) external view returns (PriceData memory priceData);
/**
* @notice Get aggregated price from multiple sources
* @param asset Asset address
* @return price Aggregated price (scaled by 1e8)
* @return confidence Weighted confidence score
*/
function getAggregatedPrice(address asset) external view returns (uint256 price, uint256 confidence);
/**
* @notice Convert amount from one asset to another using prices
* @param fromAsset Source asset
* @param fromAmount Amount in source asset
* @param toAsset Destination asset
* @return toAmount Amount in destination asset
*/
function convertAmount(
address fromAsset,
uint256 fromAmount,
address toAsset
) external view returns (uint256 toAmount);
}