circle-info
This is the first version of our Documentation, it will be improved and extended soon.
Page cover

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

Error Name
Selector (bytes4)
When It Occurs
Recommended Action

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

  1. On Basescan:

    • Go to the contract → "Read Contract" tab.

    • If a call fails, the error name/selector appears directly.

  2. In Hardhat/Foundry:

    • Use vm.expectRevert in tests to match custom errors.

    • Decode revert data with ethers: ethers.utils.parseRevertReason(data).

  3. 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?