Smart Contracts
AFXO oracle contracts are deployed on Avalanche C-Chain as our canonical root (source of truth). Celo and Base coming next, followed by Arbitrum and Solana. All contracts implement the AggregatorV3 interface for easy integration.
AggregatorV3 Interface
Our oracles implement the standard AggregatorV3 interface, making integration straightforward for existing DeFi protocols.
// SPDX-License-Identifier: MIT
interface IAFXOOracle {
function latestRoundData() external view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function getRoundData(uint80 _roundId) external view returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
// AFXO Extensions
function getConfidence() external view returns (uint8);
function getSourceCount() external view returns (uint8);
}Avalanche C-Chain
LiveChain ID: 43114Contract addresses will be published upon mainnet deployment. Currently in final testing.
Avalanche Fuji Testnet
TestnetChain ID: 43113Chain Roadmap
CeloNext
Chain ID: 42220
BasePlanned
Chain ID: 8453
ArbitrumPlanned
Chain ID: 42161
SolanaFuture
Non-EVM
Integration Example
Example Solidity code for consuming AFXO oracle data:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@afxo/contracts/interfaces/IAFXOOracle.sol";
contract MyDeFiProtocol {
IAFXOOracle public kesOracle;
constructor(address _kesOracle) {
kesOracle = IAFXOOracle(_kesOracle);
}
function getKESPrice() external view returns (int256) {
(
,
int256 price,
,
uint256 updatedAt,
) = kesOracle.latestRoundData();
// Check data freshness (e.g., within 1 hour)
require(block.timestamp - updatedAt < 3600, "Stale data");
// Check confidence (optional but recommended)
require(kesOracle.getConfidence() >= 70, "Low confidence");
return price;
}
}Security Considerations
- • Always verify data freshness before using oracle values
- • Check confidence scores for critical operations
- • Implement circuit breakers for extreme price movements
- • Consider using multiple oracle sources for high-value operations
- • Our contracts are audited — see our security page