Skip to content

Helpers ​

Git Source

Inherits:Variables, Events, OracleError

Functions ​

constructor ​

solidity
constructor(CLXStockOracleConstructorParams memory p_) Constants(p_);

_requireNotPaused ​

solidity
function _requireNotPaused() internal view;

_getPrice ​

Current-session price. Debt inverts extended-hours clamp vs collateral. isRaw_: skip pause / band / staleness; return 0 if CL/multiplier invalid.

solidity
function _getPrice(bool isOperate_, bool isDebt_, bool isRaw_)
    internal
    view
    returns (uint256 price_, uint256 liveMultiplier_);

_getPriceWrite ​

Write path: MH cursor, in-band multiplier sync, optional RTH store / fallback event.

solidity
function _getPriceWrite(bool isOperate_, bool isDebt_) internal returns (uint256 price_);

_regularHoursSyncTime ​

Seal only once regularEnd + REGULAR_HOURS_ANCHOR_BUFFER has passed: a close print can land in the window until then, and sealing first would lock in an earlier round. Before that, store a hint.

solidity
function _regularHoursSyncTime(uint256 sessionType_, uint32 regularEnd_) internal view returns (uint32);

_getPriceForSession ​

Session price. persistRoundId_ = 0 & regularHoursNotFoundFallback_ = true when RTH clamp skipped.

solidity
function _getPriceForSession(
    bool isOperate_,
    bool isDebt_,
    uint256 sessionType_,
    uint32 regularStart_,
    uint32 regularEnd_,
    bool isRaw_
)
    internal
    view
    returns (uint256 price_, uint256 liveMultiplier_, uint80 persistRoundId_, bool regularHoursNotFoundFallback_);

_revertIfStalePrice ​

Op Regular/Extended: heartbeat-fresh. Else (liq / Holiday/Unknown / MH window failure): 5d extended.

solidity
function _revertIfStalePrice(uint256 updatedAt_, bool isOperate_, uint256 sessionType_, bool mhWindowFailure_)
    internal
    view;

_isRegularWindowTrusted ​

MH window metadata ok to use for clamp (non-empty, well-formed, regularEnd < 5d old). Does not look up Chainlink — that is _findLatestRegularHoursRound.

solidity
function _isRegularWindowTrusted(uint32 regularStart_, uint32 regularEnd_) internal view returns (bool);

_clampExtendedHoursPrice ​

Resolve RTH CL answer + clamp. found_=false if no CL round in the RTH time window.

solidity
function _clampExtendedHoursPrice(
    uint256 price_,
    uint256 liveMultiplier_,
    bool isOperate_,
    bool isDebt_,
    uint32 regularStart_,
    uint32 regularEnd_
) internal view returns (bool found_, uint80 resolvedRoundId_, uint256 clamped_);

_storeRegularHoursReference ​

syncTime_ from _regularHoursSyncTime: regularEnd seals the round, anything else is a hint.

solidity
function _storeRegularHoursReference(uint80 roundId_, uint32 syncTime_) internal;

_mayRollRegularHoursReference ​

Rate limit on gap-reference rolls: without it, a split that CL prints as several quick rounds can be walked past the gap guard by re-anchoring onto an intermediate print (one in-band hop covers a 2:1). Same-round stores only refresh the marker; gov / class ≥ 3 rolls skip this gate. A blocked roll is skipped silently — pricing itself is never affected.

solidity
function _mayRollRegularHoursReference(uint80 newRoundId_, uint256 sessionType_, uint32 regularStart_)
    internal
    view
    returns (bool);

_resolveRegularHoursReference ​

RTH answer for regularEnd_: the stored round if sealed for it, else search.

solidity
function _resolveRegularHoursReference(uint32 regularStart_, uint32 regularEnd_)
    internal
    view
    returns (bool found_, uint80 roundId_, uint256 answer_);

_findLatestRegularHoursRound ​

Walk CL history for the latest round in [regularStart_, regularEnd_ + buffer]. Once the window is past, the start widens by MIN_CHAINLINK_HEARTBEAT so quiet sessions still anchor. See EDGE_CASES.md.

solidity
function _findLatestRegularHoursRound(
    uint32 regularStart_,
    uint32 regularEnd_,
    uint80 hintRoundId_,
    uint32 hintSyncedAt_
) internal view returns (bool found_, uint80 roundId_, uint256 answer_);

Parameters

NameTypeDescription
regularStart_uint32
regularEnd_uint32
hintRoundId_uint800 = start from latest.
hintSyncedAt_uint32Sync age, or 0 → age by round updatedAt. Stale hints start from latest.

_isPreWindowAnchorTrusted ​

Rejects a pre-window anchor only if the feed provably missed a print it owed (print + heartbeat) during trading hours. A missed deadline in HOLIDAY or UNKNOWN proves nothing. See EDGE_CASES.md.

solidity
function _isPreWindowAnchorTrusted(uint80 roundId_, uint256 updatedAt_) internal view returns (bool);

_getRegularHoursRoundCursor ​

Fresh hint if age-ok; else latest. hintSyncedAt_ != 0 ages by sync, else by CL updatedAt.

solidity
function _getRegularHoursRoundCursor(uint80 hintRoundId_, uint32 hintSyncedAt_)
    internal
    view
    returns (bool found_, uint80 roundIdCursor_, uint256 answerAtCursor_, uint256 updatedAt_);

_walkBackToLatestInWindow ​

From after windowEnd_, walk back to first updatedAt <= windowEnd_ (latest in-window candidate). Stops on read failure or updatedAt == 0 (post-tip phantom rounds some CL feeds return as success).

solidity
function _walkBackToLatestInWindow(
    uint80 roundIdCursor_,
    uint256 answerAtCursor_,
    uint256 updatedAt_,
    uint256 windowStart_,
    uint256 windowEnd_
) internal view returns (bool found_, uint80 roundId_, uint256 answer_, uint256 foundUpdatedAt_);

_walkForwardToLatestInWindow ​

From at/before windowEnd_, walk forward; keep last in [windowStart_, windowEnd_]. Stops on read failure or updatedAt == 0 (post-tip phantom rounds some CL feeds return as success).

solidity
function _walkForwardToLatestInWindow(
    uint80 roundIdCursor_,
    uint256 answerAtCursor_,
    uint256 updatedAt_,
    uint256 windowStart_,
    uint256 windowEnd_
) internal view returns (bool found_, uint80 roundId_, uint256 answer_, uint256 foundUpdatedAt_);

_syncAcceptedMultiplier ​

solidity
function _syncAcceptedMultiplier(uint256 live_) internal;

_tryReadChainlinkRound ​

roundId_ == 0 → latest. Revert → success false. Answer ≤ 0 → answer_ == 0. updatedAt == 0 is returned as-is: callers decide (walkers treat it as tip/gap, live price path surfaces it as StalePrice).

solidity
function _tryReadChainlinkRound(uint80 roundId_) internal view returns (bool, uint80, uint256, uint256);

_readLatestPrice ​

CL × live multiplier × RATE_MULTIPLIER. Raw soft-fails to zeros; else InvalidPrice.

solidity
function _readLatestPrice(bool isRaw_)
    internal
    view
    returns (uint256 price_, uint256 multiplier_, uint256 updatedAt_, uint80 roundId_);

_revertIfScheduledMultiplierOutsideBand ​

Pending schedule within SCHEDULED_MULTIPLIER_FREEZE_BUFFER and outside absolute MAX% vs live.

solidity
function _revertIfScheduledMultiplierOutsideBand(uint256 live_) internal view;

_freshAnchorReferenceAnswer ​

Anchor-round answer as gap reference; 0 = unset / unreadable / too old.

solidity
function _freshAnchorReferenceAnswer() internal view returns (uint256 answer_);

_isPriceGapOutside ​

Strictly outside −down% / +up% of reference_.

solidity
function _isPriceGapOutside(uint256 reference_, uint256 value_) internal view returns (bool);

_isLiveMultiplierOutsideBand ​

Outside time-accrued band of _acceptedMultiplier. MAX% == 0 → freeze (live != accepted). Accrues absolute maxDiff = accepted * MAX% * elapsed / (PERIOD * 1e4) (not floored percent).

solidity
function _isLiveMultiplierOutsideBand(uint256 live_) internal view returns (bool);