Skip to main content

Class: EvmChainlinkLayer

Defined in: evm-client/src/settlement-layer.ts:571

EVM's oracle settlement layer, priced off Chainlink Data Feeds: the config binds an asset pair to one feed per leg plus a staleness bound and a resolution style, and that whole binding determines the layer's address.

Chainlink feeds are push-based, so there is nothing to post before an exercise and no per-exercise oracle input — buildMetadata is empty and the layer reads latestRoundData itself. Freshness is the config's problem instead, which is what the two *MaxStalenessSecs bounds are for.

One contract exists per configuration, placed by ChainlinkSettlementFactory — permissionless, and get-or-create, so createConfig is safe to submit for a configuration that already has a layer.

feeds resolves each asset to its feed; it defaults to the table for the chain (see CHAINLINK_FEEDS) and a caller settling a pair that isn't listed passes its own.

Implements​

Constructors​

Constructor​

new EvmChainlinkLayer(
client,
factoryAddress,
chainId,
feeds?): EvmChainlinkLayer;

Defined in: evm-client/src/settlement-layer.ts:588

Parameters​

ParameterTypeDescription
client{ }a viem public client on the chain the factory is deployed to.
factoryAddressstringthe deployed ChainlinkSettlementFactory (see EvmConfig.chainlinkSettlementFactoryAddress).
chainIdnumberwhich chain's default feed table to use.
feedsReadonlyMap<Bytes32, `0x${string}`>the asset → feed table, overriding those defaults.

Returns​

EvmChainlinkLayer

Properties​

factoryAddress​

readonly factoryAddress: `0x${string}`;

Defined in: evm-client/src/settlement-layer.ts:577

The deployed ChainlinkSettlementFactory every derivation below goes through.


type​

type: SettlementKey<EvmLayer> = "oracle";

Defined in: evm-client/src/settlement-layer.ts:574

This layer's type key — matches the on-chain discriminator and the registry key.

Implementation of​

OvercastSettlementLayer.type

Methods​

buildMetadata()?​

optional buildMetadata(_option): Promise<Metadata>;

Defined in: evm-client/src/settlement-layer.ts:627

A push-based feed needs no per-exercise input: the layer reads it itself.

Parameters​

ParameterType
_optionMarketOption

Returns​

Promise<Metadata>

Implementation of​

OvercastSettlementLayer.buildMetadata

configId()​

configId(config): Promise<Bytes32>;

Defined in: evm-client/src/settlement-layer.ts:638

The address the factory places the layer for config at, whether or not it has been deployed yet — so it can be pinned into an offer's details.settlementLayer before (or without) the layer existing.

Memoized per configuration, so a process derives each asset pair once.

Parameters​

ParameterType
configOracleSettlementConfig

Returns​

Promise<Bytes32>

Implementation of​

OvercastSettlementLayer.configId

createConfig()​

createConfig(config): Promise<TransactionRequest & object>;

Defined in: evm-client/src/settlement-layer.ts:611

Build the transaction that deploys the layer for config.

Get-or-create rather than create-or-revert: a configuration that already has a layer hands the existing one back, because a deployed layer is byte-identical to the one this call would have produced. So this needs no existence pre-check, and submitting it twice costs gas but changes nothing.

The submitter gains no authority over the result — the configuration determines the address, the init code determines the behaviour, and whoever paid the gas is not recorded anywhere.

Parameters​

ParameterType
configOracleSettlementConfig

Returns​

Promise<TransactionRequest & object>

Implementation of​

OvercastSettlementLayer.createConfig

defaultConfig()​

defaultConfig(details): Promise<OracleSettlementConfig>;

Defined in: evm-client/src/settlement-layer.ts:671

Derive the configuration the option settles under from its two asset legs and their registered feeds, under DEFAULT_CHAINLINK_PARAMETERS — configId turns it into the layer address an offer commits to, and createConfig into the transaction that deploys that address.

Both legs must be present and both must have a feed: an option whose assets cannot be priced has no oracle layer, so a missing one is a caller error.

Parameters​

ParameterType
detailsPartial<OptionDetails>

Returns​

Promise<OracleSettlementConfig>

Implementation of​

OvercastSettlementLayer.defaultConfig

feedFor()​

feedFor(asset, role): `0x${string}`;

Defined in: evm-client/src/settlement-layer.ts:779

The registered Chainlink feed for an asset, or a caller error if none. This is the proxy the layer calls latestRoundData on at exercise.

Parameters​

ParameterType
assetBytes32
role"collateral" | "settlement"

Returns​

`0x${string}`


isDeployed()​

isDeployed(config): Promise<boolean>;

Defined in: evm-client/src/settlement-layer.ts:653

Whether the layer for config has been deployed yet.

Parameters​

ParameterType
configOracleSettlementConfig

Returns​

Promise<boolean>


read()​

read(id): Promise<OracleSettlementConfig>;

Defined in: evm-client/src/settlement-layer.ts:701

Read the layer contract at id and decode its configuration.

Same two checks as EvmPhysicalLayer.read, and the same one is load-bearing: layerType() is self-attested and only a diagnostic, while the address re-deriving is what proves the code at id is this factory's Chainlink layer for the configuration it reports. So a layer deployed by a different factory (an older deployment, or a fork's) is rejected here even though it answers every getter.

Parameters​

ParameterType
idBytes32

Returns​

Promise<OracleSettlementConfig>

Implementation of​

OvercastSettlementLayer.read