Skip to main content
This page brings together every pattern covered in the EVM integration guides into a single, deployable contract. It is not a minimal example — it is a reference implementation you can use as a foundation for a real protocol. Read through it in full before adapting it. Every decision is intentional and annotated.

What This Contract Demonstrates


The Contract


Adapting This Contract

This reference implementation is intentionally complete. When adapting it for your protocol, consider the following: Remove what you don’t need. Not every protocol needs a cache, a guardian, and fallback logic simultaneously. Start from this reference and strip out the patterns that don’t apply to your use case. A simpler contract with fewer moving parts is always preferable if it meets your requirements. Review all constants for your risk profile. DEFAULT_MAX_AGE, EMERGING_MAX_AGE, MAX_DEVIATION_BPS, and CACHE_TTL are starting points, not universal values. Set them based on your protocol’s actual risk tolerance and the observed update cadence of the assets you’re consuming. Replace the guardian pattern with your governance system. The single-address guardian is the simplest possible access control pattern. Production protocols typically use a timelock, multisig, or full governance contract for parameter updates. Swap guardian for whatever access control model your protocol already uses. Implement secondary oracle logic in getVerifiedPriceWithFallback. The fallback function has a clearly marked placeholder for a secondary oracle call. If your protocol requires maximum uptime, integrate a secondary source — Chainlink, Pyth, or a TWAP — at that point. Add your protocol logic. This contract has no deposit, borrow, swap, or settlement logic — those are yours to build on top of these price reading foundations.

Deployment Checklist

Before deploying to mainnet:
1

Verify oracle address

Confirm 0xA9F17344689C2c2328F94464998db1d3e35B80dC against the Contract Addresses reference page and Basescan.
2

Verify all asset IDs

Hash each symbol string independently and compare against the Supported Assets table. Run the Foundry test pattern from Working with Asset IDs.
3

Review risk parameters

Confirm DEFAULT_MAX_AGE, EMERGING_MAX_AGE, MAX_DEVIATION_BPS, and CACHE_TTL are appropriate for your protocol’s risk tolerance.
4

Replace guardian address

Set the guardian constructor argument to your protocol’s multisig or governance contract — not a development wallet.
5

Run a full test suite

Test all price read paths including stale prices, missing assets, deviation breaches, and cache TTL expiry. Use Foundry’s vm.warp to simulate time-based scenarios.
6

Benchmark gas costs

Run Foundry’s gas reporter against your adapted contract under realistic conditions before committing to the architecture.
7

Deploy to Base Sepolia first

Test against the live testnet oracle — not just mocks — before mainnet deployment.

Next Steps

Core Concepts

Understand the oracle mechanics behind the price data your contracts consume.

MCP Server

Integrate IFÁ Labs price feeds into AI agents and developer tools via MCP.