Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SettlementOracle

Git Source

Title: SettlementOracle

Pure theoretical oracle for option settlement.

Uses historical Chainlink round data to look up prices at expiry, eliminating the settlement window and preventing lookback MEV.

Note: security-contact: contact@plether.com

Constants

CAP

uint256 public immutable CAP

SEQUENCER_UPTIME_FEED

AggregatorV3Interface public immutable SEQUENCER_UPTIME_FEED

SEQUENCER_GRACE_PERIOD

uint256 public constant SEQUENCER_GRACE_PERIOD = 1 hours

ORACLE_TIMEOUT

uint256 public constant ORACLE_TIMEOUT = 24 hours

State Variables

components

Component[] public components

Functions

constructor

constructor(
    address[] memory _feeds,
    uint256[] memory _quantities,
    uint256[] memory _basePrices,
    uint256 _cap,
    address _sequencerUptimeFeed
) ;

getSettlementPrices

Returns the pure theoretical settlement prices at a given expiry timestamp.

function getSettlementPrices(
    uint256 expiry,
    uint80[] calldata roundHints
) external view returns (uint256 bearPrice, uint256 bullPrice);

Parameters

NameTypeDescription
expiryuint256The timestamp at which to look up prices.
roundHintsuint80[]Caller-provided Chainlink round IDs (one per component) active at expiry.

Returns

NameTypeDescription
bearPriceuint256min(BasketPrice, CAP) in 8 decimals
bullPriceuint256CAP - bearPrice in 8 decimals

Errors

SettlementOracle__InvalidPrice

error SettlementOracle__InvalidPrice(address feed);

SettlementOracle__LengthMismatch

error SettlementOracle__LengthMismatch();

SettlementOracle__WrongHintCount

error SettlementOracle__WrongHintCount();

SettlementOracle__InvalidBasePrice

error SettlementOracle__InvalidBasePrice();

SettlementOracle__InvalidWeights

error SettlementOracle__InvalidWeights();

Structs

Component

struct Component {
    AggregatorV3Interface feed;
    uint256 quantity;
    uint256 basePrice;
}