Skip to content
AtlasOracle

Single-Feed Contract ​

A high-performance oracle optimized for a single asset pair, with full wire-level compatibility with the Chainlink AggregatorV2 and AggregatorV3 interfaces.

Single-Feed contract interface:
ISingleFeed.sol

Read-access policy

Each feed instance runs in one of two modes — whitelist (only addresses on the authorized-caller list, plus regular EOAs that have not been delegated via ERC-7702, may read) or open-read (any caller may read). Functions marked onlyReadAccess below are subject to this policy; all other functions are always callable. Use isOpenRead and isAuthorizedCaller to query the current state.

Functions

NameDescriptionCompatibilityModifier
latestAnswerReturns the latest aggregated price.Chainlink Aggregator V2onlyReadAccess
latestTimestampBlock timestamp of the most recent successful update.Chainlink Aggregator V2onlyReadAccess
latestRoundSynthetic latest round id: 1 if updated, 0 otherwise.Chainlink Aggregator V2onlyReadAccess
getAnswerCurrent price only when the round is 1.Chainlink Aggregator V2onlyReadAccess
getTimestampCurrent on-chain timestamp only when the round is 1.Chainlink Aggregator V2onlyReadAccess
latestRoundDataPrice-related data for the latest price round.Chainlink Aggregator V3onlyReadAccess
getRoundDataPrice-related data for the specified price round.Chainlink Aggregator V3onlyReadAccess
decimalsReturns the price precision.Chainlink Aggregator V3—
descriptionHuman-readable description of this feed.Chainlink Aggregator V3—
versionVersion number of the feed implementation.Chainlink Aggregator V3—
contractTypeContract type identifier.——
isAuthorizedCallerChecks whether an address is whitelisted.——
isOpenReadReturns whether open-read mode is active.——

1. latestAnswer ​

Returns the latest aggregated price.

solidity
function latestAnswer() external view returns (int256 answer)

Parameters

(none)

Return values

  • answer: The aggregated price, cast to int256.

2. latestTimestamp ​

Returns the block timestamp of the most recent successful update.

solidity
function latestTimestamp() external view returns (uint256 onchainTimestamp)

Parameters

(none)

Return values

  • onchainTimestamp: The timestamp when the price was written on-chain.

3. latestRound ​

Returns a synthetic latest round id.

solidity
function latestRound() external view returns (uint256 roundId)

Parameters

(none)

Return values

  • roundId: 1 if the feed has been updated, 0 otherwise. This synthetic value ensures compliance with DeFi protocols that check for a non-zero round id before consuming a feed.

4. getAnswer ​

Returns the price for a given round id. Because this oracle stores only the latest state in a single storage slot, historical data is unavailable. The current price is returned only when roundId == 1, matching the synthetic value from latestRound().

solidity
function getAnswer(uint256 roundId) external view returns (int256 answer)

Parameters

  • roundId: Round id to query.

Return values

  • answer: Price for that round; returns 0 if roundId is not 1 or the feed has never been updated.

5. getTimestamp ​

Returns the timestamp for a given round id. Because this oracle stores only the latest state in a single storage slot, historical data is unavailable. The current on-chain timestamp is returned only when roundId == 1, matching the synthetic value from latestRound().

solidity
function getTimestamp(uint256 roundId) external view returns (uint256 onchainTimestamp)

Parameters

  • roundId: Round id to query.

Return values

  • onchainTimestamp: On-chain timestamp for that round; returns 0 if roundId is not 1 or the feed has never been updated.

6. latestRoundData ​

Returns the data for the latest price round. As this oracle stores only the latest state, historical rounds are unavailable; if the feed has never been updated, all zeros are returned.

solidity
function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)

Parameters

(none)

Return values

  • roundId: Synthetic round id (1 if updated, 0 otherwise).
  • answer: The latest aggregated price.
  • startedAt: Off-chain aggregation timestamp.
  • updatedAt: On-chain update timestamp.
  • answeredInRound: Same as roundId.

7. getRoundData ​

Returns the data for the specified price round. As this oracle stores only the latest state, historical rounds are unavailable; if _roundId is not 1 or the feed has never been updated, all zeros are returned.

solidity
function getRoundData(uint80 _roundId) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)

Parameters

  • _roundId: Round id to fetch (in this stateless model, only 1 is supported).

Return values

  • roundId: Synthetic round id (1 if updated, 0 otherwise).
  • answer: The latest aggregated price.
  • startedAt: Off-chain aggregation timestamp.
  • updatedAt: On-chain update timestamp.
  • answeredInRound: Same as roundId.

8. decimals ​

Returns the precision used to represent the price.

solidity
function decimals() external view returns (uint8 precision)

Parameters

(none)

Return values

  • precision: Decimal precision of the price feed.

9. description ​

Returns a human-readable description of this feed.

solidity
function description() external view returns (string memory desc)

Parameters

(none)

Return values

  • desc: A string identifier.

10. version ​

Returns the version number of the current implementation.

solidity
function version() external view returns (uint256 versionNumber)

Parameters

(none)

Return values

  • versionNumber: A monotonically increasing version identifier.

11. contractType ​

Returns the contract type identifier, used to distinguish feed implementations within the project.

solidity
function contractType() external view returns (uint256 typeId)

Parameters

(none)

Return values

  • typeId: Type id (1 for Single-Feed).

12. isAuthorizedCaller ​

Checks whether an address is whitelisted as an authorized caller for price reads when open-read mode is disabled.

solidity
function isAuthorizedCaller(address account) external view returns (bool whitelisted)

Parameters

  • account: Address to query.

Return values

  • whitelisted: true if the account is on the authorized-caller whitelist.

13. isOpenRead ​

Returns whether open-read mode is currently active. When true, any caller can read prices; when false, only whitelisted callers and regular EOAs (that have not been delegated via ERC-7702) are permitted.

solidity
function isOpenRead() external view returns (bool enabled)

Parameters

(none)

Return values

  • enabled: true if open-read mode is active.

Stateless / latest-only model

Single-Feed stores only the latest state in a single storage slot, so historical rounds are unavailable. latestRound() returns a synthetic 1 once the feed has been updated (and 0 before that) to satisfy DeFi protocols that require a non-zero round id. getAnswer / getTimestamp / getRoundData return valid data only for roundId == 1.