Skip to content

API ReferenceValidationFunction

checkOraclePriceFreshness()

function checkOraclePriceFreshness(ctx, params): Promise<ValidationIssue[]>;

Checks whether an oracle price update is fresh enough for the protocol.

getMaxLOCPriceUpdateSecondsAgo returns the contract’s max staleness window already reduced by the UX buffer that accounts for block confirmation delay, so it is the effective freshness window. The buffer must not be subtracted again here: doing so collapses the window to zero on deployments sitting at the contract’s 60s floor (e.g. mainnet) and rejects every freshly fetched price as stale.

Freshness is measured against the latest block’s timestamp — the same clock the contract checks — not the local machine clock, so a skewed device clock cannot trigger a spurious staleness error.

Parameters

ParameterType
ctxSDKContext
paramsOracleCheckParams

Returns

Promise<ValidationIssue[]>