ChronicleAdapter
Inherits: IChronicleAdapter
Title: ChronicleAdapter
Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Modified from Chronicle (https://github.com/chronicleprotocol)
Diamond facet that reads Chronicle oracle feeds through their per-feed oracle contracts with per-feed staleness configuration and WAD-normalized answers.
Stateless delegator — all logic and storage live in ChronicleAdapterLib. Consumers inherit this
contract and add AccessControl + an initializer. Chronicle feeds are Schnorr-signed and toll-gated:
the deployed adapter contract must be kissed by the oracle operator before reads will succeed.
Notes:
- lattice-version: 0.1.0
- lattice-source: Chronicle
Functions
getFeed
Returns a feed's configuration.
function getFeed(bytes32 key) external view virtual override returns (address chronicle, uint48 maxStaleness);Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes32 | The feed identifier. |
Returns
| Name | Type | Description |
|---|---|---|
| chronicle | address | The Chronicle oracle contract address. |
| maxStaleness | uint48 | Maximum age (seconds) before a value is stale. |
latestAnswer
Returns the latest price for key, normalized to 18 decimals (WAD). Selector matches
IPriceOracleReader.latestAnswer. Reverts on stale / future-age / zero value.
function latestAnswer(bytes32 key) external view virtual override returns (int256 answerWad);Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes32 | The feed identifier. |
Returns
| Name | Type | Description |
|---|---|---|
| answerWad | int256 | The latest price scaled to 1e18. |
readWithAge
Returns the validated raw Chronicle value and the timestamp it was last written on-chain.
Provider-native reader (mirrors IChronicle.readWithAge); keeps this adapter's ERC-165 id
distinct from other adapters that share the latestAnswer selector.
function readWithAge(bytes32 key) external view virtual override returns (uint256 value, uint256 age);Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes32 | The feed identifier. |
Returns
| Name | Type | Description |
|---|---|---|
| value | uint256 | The oracle value (already 18 decimals, WAD). |
| age | uint256 | The Unix timestamp at which the value was last written on-chain. |
registerFeed
Registers a Chronicle feed under key. Caller must hold DEFAULT_ADMIN_ROLE.
function registerFeed(bytes32 key, address chronicle, uint48 maxStaleness) external virtual override;Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes32 | The arbitrary feed identifier. |
| chronicle | address | The Chronicle oracle contract address (non-zero). |
| maxStaleness | uint48 | Maximum age (seconds); must be non-zero. |
unregisterFeed
Removes a registered feed. Caller must hold DEFAULT_ADMIN_ROLE.
function unregisterFeed(bytes32 key) external virtual override;Parameters
| Name | Type | Description |
|---|---|---|
| key | bytes32 | The feed identifier to remove. |
exportSelectors
ERC-8153 selector export: this facet's cuttable selectors, tightly packed (4 bytes each).
Excludes exportSelectors() itself (0x0ef22643) - it is never cut into a diamond. Order matches
forge inspect ChronicleAdapter methodIdentifiers (alphabetical by signature); kept in exact parity by
ExportSelectorsParityTest. Chunks:
getFeed(bytes32) 0x280aebcf
latestAnswer(bytes32) 0x084d4783
readWithAge(bytes32) 0xbccd5e4d
registerFeed(bytes32,address,uint48) 0x915d3063
unregisterFeed(bytes32) 0x2a589908
function exportSelectors() external pure virtual returns (bytes memory selectors);Returns
| Name | Type | Description |
|---|---|---|
| selectors | bytes |