Integrate the Push Mode
Atlas Oracle's Push mode publishes prices via on-chain smart contracts. Authorized reporters update the on-chain price based on external triggers — typically a heartbeat or a price-deviation threshold. Consumers read the latest price directly from the contract, with a purely on-chain integration path.
Under Push mode we provide two contract types:
- SingleFeed — a single-asset oracle. One contract serves one feed. Its main advantage is full compatibility with the Chainlink
AggregatorV2V3interface. - MultiFeed — a multi-asset price registry. One contract returns the latest prices for many feeds, optimized for consistency and gas efficiency.
Each contract instance can be configured in one of two access modes:
- Whitelist mode — only addresses on the authorized-caller whitelist may read prices, plus regular EOAs that have not been delegated via ERC-7702. Suitable when you want to control which protocols consume your feed.
- Open-read mode — anyone can read prices without restriction. Suitable for fully public price feeds.
Open-source interfaces
Solidity interfaces and the FeedCodec decoder library are open-sourced under MIT at oracle-atlas/push-oracle-interfaces.
1. SingleFeed
SingleFeed is fully compatible with the Chainlink AggregatorV2V3 interface.
Contract example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ISingleFeed} from "push-oracle-interfaces/src/ISingleFeed.sol";
contract SingleFeedConsumer {
/// Maximum acceptable price age, in seconds.
uint256 public constant MAX_AGE = 1 hours;
/// The SingleFeed proxy address deployed by Atlas Oracle for your asset pair.
ISingleFeed public immutable singleFeed;
error FeedNeverUpdated();
error StalePrice();
constructor(address singleFeedAddr) {
singleFeed = ISingleFeed(singleFeedAddr);
}
/**
* Reads the latest price with safety checks.
*
* NOTE: When the feed is in whitelist mode, only addresses on the
* authorized-caller whitelist (and regular EOAs that have not been
* delegated via ERC-7702) can read. Provide your contract address
* to the protocol to be whitelisted.
*/
function getPrice() external view returns (int256 price) {
(, int256 answer, , uint256 updatedAt, ) = singleFeed.latestRoundData();
if (answer == 0) revert FeedNeverUpdated();
if (block.timestamp - updatedAt > MAX_AGE) revert StalePrice();
return answer;
}
}Contract interface:
https://github.com/oracle-atlas/push-oracle-interfaces/blob/main/src/ISingleFeed.sol
Contract interface reference: View Documentation
2. MultiFeed
MultiFeed stores many asset prices in a single contract, each identified by a 4-byte feedId. It offers two read styles:
- Decoded —
fetch/fetchBatchreturn a friendlyPriceSnapshotstruct. - Compact —
fetchCompact/fetchCompactBatchreturn the raw packedbytes32word from astaticcallfor maximum gas efficiency. We recommend using FeedCodec in your consumer contract to decode the packed data.
Contract example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IMultiFeed} from "push-oracle-interfaces/src/IMultiFeed.sol";
import {FeedCodec} from "push-oracle-interfaces/src/libraries/FeedCodec.sol";
contract MultiFeedConsumer {
using FeedCodec for bytes32;
/// Maximum acceptable price age, in seconds.
uint256 public constant MAX_AGE = 1 hours;
/// The MultiFeed proxy address deployed by Atlas Oracle.
IMultiFeed public immutable multiFeed;
error FeedNeverUpdated();
error StalePrice();
constructor(address multiFeedAddr) {
multiFeed = IMultiFeed(multiFeedAddr);
}
/**
* Reads a price via the decoded path.
*
* NOTE: When the feed is in whitelist mode, only addresses on the
* authorized-caller whitelist (and regular EOAs that have not been
* delegated via ERC-7702) can read. Provide your contract address
* to the protocol to be whitelisted.
*/
function getPrice(bytes4 feedId) external view returns (uint80 price) {
IMultiFeed.PriceSnapshot memory snap = multiFeed.fetch(feedId);
if (snap.onchainTs == 0) revert FeedNeverUpdated();
if (block.timestamp - snap.onchainTs > MAX_AGE) revert StalePrice();
return snap.price;
}
/**
* Reads a price via the compact path. Cheapest read, decoded locally
* with FeedCodec.
*
* Same access rules as `getPrice` apply.
*/
function getPriceCompact(bytes4 feedId) external view returns (uint80 price) {
bytes32 packed = multiFeed.fetchCompact(feedId);
if (packed.isEmpty()) revert FeedNeverUpdated();
(uint80 p, , uint48 onchainTs) = packed.decode();
if (block.timestamp - onchainTs > MAX_AGE) revert StalePrice();
return p;
}
}Contract interface:
https://github.com/oracle-atlas/push-oracle-interfaces/blob/main/src/IMultiFeed.sol
Codec library:
https://github.com/oracle-atlas/push-oracle-interfaces/blob/main/src/libraries/FeedCodec.sol
Contract interface reference: View Documentation