Skip to main content

ChainlinkOracleFactory

Git Source

Inherits: BaseOracleFactory

Title: ChainlinkOracleFactory

Author: OlympusDAO

forge-lint: disable-start(mixed-case-function,mixed-case-variable)

Factory contract for deploying ChainlinkOracle clones for base/quote token pairs

Uses ClonesWithImmutableArgs for gas-efficient oracle deployment

State Variables

ORACLE_IMPLEMENTATION

Reference implementation for cloning

ChainlinkOracleCloneable public immutable ORACLE_IMPLEMENTATION

Functions

constructor

Constructs a new ChainlinkOracleFactory

Reverts if priceCache_ is not a valid IPriceCache policy for this Kernel.

constructor(Kernel kernel_, address priceCache_) BaseOracleFactory(kernel_, priceCache_);

Parameters

NameTypeDescription
kernel_KernelThe Kernel address
priceCache_addressThe price cache policy address

_getOracleImplementation

Returns the Chainlink oracle implementation address for cloning

function _getOracleImplementation() internal view override returns (address);

Returns

NameTypeDescription
<none>addressThe address of the ChainlinkOracleCloneable implementation

_encodeOracleData

Encodes oracle-specific data for cloning

Generates oracle name and encodes immutable args.

function _encodeOracleData(address baseToken_, address quoteToken_, uint48 maxAge_, bytes calldata)
internal
view
override
returns (bytes memory);

Parameters

NameTypeDescription
baseToken_addressThe base token address
quoteToken_addressThe quote token address
maxAge_uint48The maximum age (in seconds) of cached prices used by the oracle
<none>bytes

Returns

NameTypeDescription
<none>bytesbytes The encoded bytes for cloning