Smart Contract Oracle Design: Build the Consumer Boundary
Design feed acceptance, request lifecycles, failure handling and tests around the actions your smart contract actually performs.
FOUNDATIONS / TOPIC GUIDE
Design the contract-side rules that turn an external report into an accepted input—not an unchecked assumption.
A smart contract oracle can provide a report, a delivery mechanism and a verification process. The consuming application must still decide whether that report is appropriate for a particular action. Feed identity, measurement units, observation time and status all belong in the consumer policy.
Begin by identifying the consequence of an incorrect input. A display, a collateral calculation and an irreversible settlement have different requirements. Write the acceptable conditions in plain language before implementing checks.
A maintained feed exposes published state. A supplied update requires verification and acceptance within a transaction workflow. An asynchronous request creates a period during which the relevant application state can change. These are design differences, not merely alternative syntax.
For delayed answers, bind the response to a stored request and define pending, expired, cancelled and fulfilled states. For a configured feed, prevent reports for another asset from satisfying the same operation. Our architecture reference describes the general patterns.
Construct cases for the wrong feed, an invalid timestamp, old data, an unsupported scale and a duplicate response. Add cases where a configuration changes while a request is pending. A successful parser test alone does not demonstrate that the application accepts the right information.
Specify degraded operation by action. Pausing new exposure and allowing an action that reduces exposure can be different decisions. Neither a universal pause nor an automatic fallback is a substitute for reviewing the actual consequence.
The oracle's acceptance process and the application's business rules solve different problems. Document which guarantees the provider supplies and which checks your contract adds. Continue to Ethereum Oracle or Solana Oracle for the network-specific boundary, and use DeFi Oracles to examine financial application behavior.