Skip to content
AtlasOracle

SingularAggregator

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

SingularAggregator contract interface SDK:
https://drive.google.com/file/d/1R7Cu7mNOpT9-792xvhthV8bbI_VixFzj/view?usp=drive_link

Functions

NameDescriptionCompatibility
latestAnswerReturns the latest aggregated price.Chainlink Aggregator V2
latestTimestampReturns the block timestamp of the most recent successful update.Chainlink Aggregator V2
latestRoundReturns the latest round: "1" if the aggregator has been fed a price, "0" if it has never been fed.Chainlink Aggregator V2
getAnswerReturns the current price only when the round is "1", matching what latestRound() returns.Chainlink Aggregator V2
getTimestampReturns the current on-chain timestamp only when the round is "1", matching what latestRound() returns.Chainlink Aggregator V2
latestRoundDataReturns price-related data for the latest price round.Chainlink Aggregator V3
getRoundDataReturns price-related data for the specified price round.Chainlink Aggregator V3
decimalsReturns the price precision.Chainlink Aggregator V3
descriptionReturns a human-readable description of this aggregator.Chainlink Aggregator V3
versionReturns the version number of the aggregator implementation.Chainlink Aggregator V3
isAuthorizedCallerChecks whether an address is whitelisted as an authorized caller.

1. latestAnswer

Returns the latest aggregated price.

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

function latestAnswer() external view returns (int256 answer)

Parameters

(none)

Return values

  • answer: Price with 18 decimal precision, represented as int256.

2. latestTimestamp

Returns the block timestamp of the most recent successful update.

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

function latestTimestamp() external view returns (uint256 onchainTimestamp)

Parameters

(none)

Return values

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

3. latestRound

Returns a synthetic latest round ID.

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

function latestRound() external view returns (uint256 latestRound)

Parameters

(none)

Return values

  • latestRound: Returns "1" if a price has been fed, "0" if never fed. This keeps compatibility with DeFi protocols that check whether roundId is non-zero.

4. getAnswer

Returns the price for a given round ID. Because this aggregator keeps only the latest state in a single storage slot, historical data is not available. We return the current price only when roundId is "1", matching latestRound().

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

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 price has not been initialized.

5. getTimestamp

Returns the timestamp for a given round ID. Because this aggregator keeps only the latest state in a single storage slot, historical data is not available. We return the current on-chain timestamp only when roundId is "1", matching the synthetic value from latestRound().

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

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

Parameters

  • roundId: Round ID to query.

Return values

  • onchainTimestamp: On-chain timestamp for that roundId; returns 0 if roundId is not 1 or the price has not been initialized.

6. latestRoundData

Returns data for the latest price round from a single-slot feed.

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

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

Parameters

(none)

Return values

  • roundId: Round ID (1 if data has been fed, otherwise 0).
  • answer: Latest aggregated price in storage.
  • startedAt: Off-chain aggregation timestamp.
  • updatedAt: On-chain transaction timestamp.
  • answeredInRound: Same as roundId (1 if data has been fed, otherwise 0).

7. getRoundData

Returns data for the specified price round.

Note: Executes only if the calling contract has been pre-whitelisted by the protocol. You must supply the contract address that initiates the query to obtain read access.

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: Round ID (1 if data exists, otherwise 0).
  • answer: Latest aggregated price in storage.
  • startedAt: Off-chain aggregation timestamp.
  • updatedAt: On-chain transaction timestamp.
  • answeredInRound: Same as round (1 if data has been fed, otherwise 0).

8. decimals

Returns the precision used to represent the price.

function decimals() external view returns (uint8 decimals)

Parameters

(none)

Return values

  • decimals: Fixed precision for the price feed (typically 18).

9. description

Returns a human-readable description of this aggregator.

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

Parameters

(none)

Return values

  • description: Human-readable description of this aggregator.

10. version

Returns the version number of the aggregator implementation.

function version() external view returns (uint256 version)

Parameters

(none)

Return values

  • version: Version number.

11. isAuthorizedCaller

Checks whether a contract address is whitelisted as an authorized caller.

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

Parameters

  • account: Contract address to query.

Return values

  • isAuthorizedCaller: true if that contract address is on the whitelist.