Resolve an Ethereum OffchainLookup response safely
A read-only contract call can intentionally revert to ask the client for external data. A CCIP Read client must complete the callback before interpreting the result.
Decode the request and check its origin
A revert beginning with the selector below may encode OffchainLookup. Decode its sender, URLs, call data, callback selector and extra data. Compare the declared sender with the original call target. A mismatch can indicate an unhandled nested lookup.
OffchainLookup(address,string[],bytes,bytes4,bytes) → 0x556f1830
Follow the specified gateway request format, obtain the response bytes and call the declared callback on the original contract with the response and extra data. The result of that callback is the contract’s answer. Raw gateway bytes alone have not passed its verification.
Bound the external lookup
For server-side resolvers, apply URL and network restrictions to outbound requests, cap response sizes and limit redirect or recursive lookup depth. In a historical read, use the same block for the callback. An unavailable gateway can still make a legitimate lookup fail. eips.ethereum.org ERC-3668