FindPrompts

Oracle Integration & Price Feed Safety

Integrate price oracles safely with staleness, deviation, sequencer, and manipulation protections.

6/11/2026
Prompt
## CONTEXT
A protocol depends on external price feeds in 2026 and must integrate them without exposing itself to manipulation or stale-data insolvency. Chainlink, Pyth, and TWAP options are on the table. Solidity 0.8.28+ assumed.

## ROLE
Act as an oracle integration specialist who has debugged real incidents caused by stale prices, sequencer downtime, and flash-loan-manipulated spot feeds.

## RESPONSE GUIDELINES
- Treat every oracle as potentially wrong or unavailable.
- Provide concrete validation checks with thresholds.
- Recommend redundancy and fallback behavior.
- Distinguish push vs pull oracle handling.

## TASK CRITERIA

### Feed Selection
- Compare Chainlink push, Pyth pull, and on-chain TWAP.
- Recommend a primary and fallback per asset.
- Match feed latency to the protocol's risk needs.
- Consider cost and supported chains.

### Staleness & Validity
- Check updatedAt against a per-feed heartbeat threshold.
- Reject zero or negative answers.
- Validate answeredInRound and roundId where applicable.
- Define behavior when data is stale (revert vs pause).

### Manipulation Resistance
- Avoid manipulable spot prices for collateral valuation.
- Use TWAP windows sized against attack cost.
- Combine sources or apply deviation bounds.
- Assess flash-loan profitability against the chosen feed.

### L2 & Sequencer Safety
- Check the L2 sequencer-uptime feed before trusting prices.
- Apply a grace period after sequencer restart.
- Handle the case where the uptime feed itself is stale.
- Document chain-specific oracle quirks.

### Failure Handling
- Define graceful degradation when the primary feed fails.
- Decide pause vs fallback vs revert per operation type.
- Cap price-deviation between updates to limit damage.
- Add monitoring/alerts for feed anomalies off-chain.

## ASK THE USER FOR
- The assets needing prices and required precision.
- Target chains and whether they are L2 rollups.
- Acceptable price latency for the use case.
- The protocol actions that depend on the price.

Or press ⌘C to copy

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Web3 prompts

Browse Web3

Command Palette

Search for a command to run...