
Error Code Reference
The IFÁ Labs price oracle contract uses custom errors (Solidity ≥0.8.4) for gas-efficient reverts. These provide clear, onchain-readable messages when calls fail. Below are the errors you may encounter and their meanings.
Custom Errors
AssetNotSupported(bytes32 assetId)
0x... (view on explorer)
exists = false from getAssetInfo
Verify asset ID against supported list. Request new asset if needed.
InvalidAssetIndexLength(uint256 len0, uint256 len1)
-
Batch functions receive mismatched array lengths
Ensure input arrays (_assetIndexes0 and _assetIndexes1) are equal length.
InvalidAssetOrDirectionLength(...)
-
getPairsbyId receives mismatched arrays/directions
Match lengths of assets and direction arrays.
PriceStale() or custom staleness revert
-
Your protocol's check (not contract-native)
Increase staleness tolerance or implement fallback.
ExcessivePegDeviation()
-
Your deviation check fails
Monitor for genuine off-peg events or adjust threshold.
Standard Revert Cases (No Custom Error)
Out of Gas → Transaction runs out of gas (rare on view calls). Increase gas limit or optimize batch size.
Division by Zero → Attempted derived pair with zero-priced asset (prevented post-audit).
Invalid Calldata → Malformed input to batch functions.
Debugging Tips
On Basescan:
Go to the contract → "Read Contract" tab.
If a call fails, the error name/selector appears directly.
In Hardhat/Foundry:
Use
vm.expectRevertin tests to match custom errors.Decode revert data with ethers:
ethers.utils.parseRevertReason(data).
Offchain:
Catch errors in try/catch and log
error.message— custom errors show full signature.
All critical edge cases (zero prices, self-pairing, etc.) are prevented by post-audit fixes — you should only see expected, safe reverts.
Next: Price Appears Stale — diagnosing and handling delayed updates.
Last updated
Was this helpful?

