Module Deep DivesRisk and Pricing Layer
ChainlinkOracleAdapter
Effective price selection with explicit mode and reason-code output.
What It Does
ChainlinkOracleAdapter normalizes feed health into deterministic execution output:
priceE18OracleModereasonCode
Execution modules consume this output so feed hygiene logic is not duplicated in hook or manager paths.
Core Responsibilities
- validate primary feed answer freshness and bounds
- optionally validate fallback feed and deviation thresholds
- optionally gate by L2 sequencer status + grace period
- return explicit mode transitions and reason codes
minAnswer and maxAnswer are shared 18-decimal price bounds applied after each feed is normalized. Zero independently disables either bound. Before replacing an existing adapter configured with nonzero raw-feed bounds, review the intended economic limits and configure their 18-decimal equivalents on the replacement.
Decision Output
Reason Codes
0:NONE1:STALE_CHAINLINK2:INVALID_CHAINLINK_ANSWER3:OUT_OF_BOUNDS_CHAINLINK4:CHAINLINK_FEED_DEVIATION5:SEQUENCER_DOWN6:SEQUENCER_GRACE_PERIOD7:FALLBACK_UNAVAILABLE8:GLOBAL_PAUSED
Code 4 means current Chainlink feed prices disagree beyond the configured deviation limit.
Validation Notes
- if both feeds are configured,
redeemOnlyDeviationBpsmust be>= maxDeviationBpswhen both are non-zero. - when fallback is disabled,
fallbackMaxAgemust be zero; when configured, it must be non-zero. - a sequencer grace period is only valid with a sequencer feed configured.