Complete function reference for the main IfaPriceFeed contract
IfaPriceFeed
contract is the core implementation of the IFA Oracle Price Feed System. It stores asset price data and provides exchange rate calculations between any two supported assets.
IfaPriceFeed
src/IfaPriceFeed.sol
IIfaPriceFeed
interfaceMAX_DECIMAL
: Maximum positive decimal scaling (30)MAX_DECIMAL_NEGATIVE
: Maximum negative decimal scaling (-30)MAX_DECIMAL_NEGATIVE
for consistent precision.
assetPrices
: Maps asset IDs to their price dataverifier
: Address authorized to update price dataowner
: Contract owner with administrative privileges_assetIndex
: Asset identifier (keccak256 hash of asset symbol)assetInfo
: Complete PriceFeed struct containing:
decimal
: Price decimal precisionlastUpdateTime
: Last update timestampprice
: Current price valueroundId
: Current round identifierexist
: Boolean indicating whether the asset exists_assetIndexes
: Array of asset identifiersassetsInfo
: Array of PriceFeed structs (same order as input)exists
: Array of existence flags (same order as input)_assetIndex0
: First asset identifier_assetIndex1
: Second asset identifier_direction
: Calculation direction (Forward or Backward)pairInfo
: DerivedPair struct containing:
decimal
: Always -30
for maximum precisionlastUpdateTime
: Minimum of both asset update timesderivedPrice
: Calculated exchange rateroundDifference
: Absolute difference between round IDs_assetIndexes0
: Array of first asset identifiers_assetsIndexes1
: Array of second asset identifierspairsInfo
: Array of DerivedPair structs (forward direction)_assetIndexes0
: Array of first asset identifiers_assetsIndexes1
: Array of second asset identifierspairsInfo
: Array of DerivedPair structs (backward direction)_assetIndexes0
: Array of first asset identifiers_assetsIndexes1
: Array of second asset identifiers_direction
: Array of directions (one per pair)pairsInfo
: Array of DerivedPair structs with mixed directions_assetIndex
: Asset identifierassetInfo
: Complete PriceFeed struct with new data_verifier
: Address of the new verifier contractFunction | Owner | Verifier | Anyone |
---|---|---|---|
getAssetInfo | ✅ | ✅ | ✅ |
getAssetsInfo | ✅ | ✅ | ✅ |
getPairbyId | ✅ | ✅ | ✅ |
getPairsbyIdForward | ✅ | ✅ | ✅ |
getPairsbyIdBackward | ✅ | ✅ | ✅ |
getPairsbyId | ✅ | ✅ | ✅ |
setAssetInfo | ❌ | ✅ | ❌ |
setVerifier | ✅ | ❌ | ❌ |
decimal
field)
Output Precision: Always 30 decimal places for derived pairs
Calculation: Uses Solidity’s built-in arithmetic (overflow protection)
exist = false