core
core copied to clipboard
Fetch Real-Time Asset Prices Using On-Chain Data
Description
Replace reliance on centralized APIs (CoinGecko, CoinMarketCap) with on-chain data sources for real-time asset prices. This improves decentralization, reliability, and data accuracy.
Approach
- Use on-chain oracles (e.g., Chainlink, Tellor, Pyth).
- Query DEX price feeds (Uniswap V3 TWAP, Sushiswap, Curve, Balancer).
- Ensure data validation and handle potential failures.
Requirements
- Fetch real-time prices for major assets.
- Support additional assets easily.
- Ensure accuracy and reliability.
Data to Collect:
-
provider,asset_id,price,price_change_24_hours(or calculated based on history),date?
Ideas
pub trait PriceChainProvider {
fn get_chain_prices(&self, chains: Vec<Chain>) -> Result<Vec<AssetPrice>, Error>;
}
pub trait PriceChainAssetsProvider {
fn get_asset_prices(&self, chain: Chain, asset_ids: Vec<AssetId>) -> Result<Vec<AssetPrice>, Error>;
}