30-Decimal Precision System
Precision Architecture
The IFA Oracle implements a sophisticated 30-decimal precision system for maximum financial accuracy:Why 30 Decimals?
- Micro-transactions: Supports fractional cent transactions without rounding errors
- High-value Operations: Maintains precision for large institutional transactions
- Cross-rate Accuracy: Prevents compounding errors in multi-hop calculations
- DeFi Compatibility: Enables precise collateralization ratios and liquidation thresholds
Precision Examples
Gas Optimization
Function Gas Costs (Ethereum Mainnet)
| Function | Single Call | Batch (10 assets) | Optimization |
|---|---|---|---|
getAssetInfo() | ~2,500 gas | N/A | Minimal reads |
getAssetsInfo() | N/A | ~17,500 gas | 30% batch savings |
getPairById() | ~5,000 gas | N/A | In-memory calculation |
getPairsbyIdForward() | N/A | ~35,000 gas | 25% batch savings |
submitPriceFeed() (1 asset) | ~45,000 gas | N/A | Storage update |
submitPriceFeed() (10 assets) | N/A | ~310,000 gas | 31% batch savings |
Optimization Strategies
For Relayers:Performance Characteristics
Update Frequency
- Target Frequency: 60-second intervals for major assets
- Maximum Staleness: Configurable per integration (typically 300 seconds)
- Emergency Updates: Sub-minute updates during high volatility
- Network Adaptation: Frequency adjusts based on network congestion
Calculation Performance
Scaling Considerations
- Read Operations: Linear scaling with number of assets
- Batch Operations: Sub-linear scaling due to fixed costs amortization
- Storage Growth: O(n) where n = number of supported assets
- Network Impact: Minimal - primarily read-heavy workload
Precision Trade-offs
Benefits
✅ Maximum Accuracy: Eliminates rounding errors in financial calculations✅ Composability: Enables accurate multi-hop exchange rate calculations
✅ Future-proof: Supports micro-payments and high-value transactions
✅ DeFi Integration: Perfect precision for lending, AMM, and derivatives protocols
Considerations
⚠️ Gas Cost: Slightly higher gas costs for arithmetic operations⚠️ Integration Complexity: Requires careful decimal handling in consumer contracts
⚠️ Display Formatting: UI layers need appropriate decimal place handling