
Get Your First Price (On-Chain)
Method 1: Using Remix IDE (Recommended for Beginners)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IIfaPriceFeed {
struct PriceFeed {
int256 price;
int8 decimal;
uint256 lastUpdateTime;
}
function getAssetInfo(bytes32 assetId) external view returns (PriceFeed memory assetInfo, bool exists);
}
contract PriceReader {
IIfaPriceFeed public constant feed = IIfaPriceFeed(0xA9F17344689C2c2328F94464998db1d3e35B80dC); // Base Mainnet
// Example: USDT/USD asset ID
bytes32 public constant USDT_ASSET_ID = 0x6ca0cef6107263f3b09a51448617b659278cff744f0e702c24a2f88c91e65a0d;
function getUSDTPrice() external view returns (int256 price, int8 decimal, uint256 timestamp, bool exists) {
(IIfaPriceFeed.PriceFeed memory info, bool _exists) = feed.getAssetInfo(USDT_ASSET_ID);
return (info.price, info.decimal, info.lastUpdateTime, _exists);
}
}Method 2: Directly on Basescan (No Coding Needed)
Common Asset IDs (Mainnet & Testnet)
Asset
Asset ID
Last updated
Was this helpful?

