Switchboard EVM Feeds Skill
Purpose
Integrate Switchboard on-demand feeds into EVM contracts and bots:
Fetch verifiable update payloads off-chain
Submit updates on-chain via the Switchboard contract (pay required fee)
Read verified feed results and enforce freshness/deviation constraints
Support “cranking” patterns to emulate push/heartbeat feeds
Dependencies
Use exact pins from the SDK Version Matrix.
@switchboard-xyz/common@5.8.5@switchboard-xyz/on-demand-solidity@1.1.0ethers@6.13.1
Preconditions
OperatorPolicyexists (chainId, RPC allowlist, contract allowlist, spend limits).
Inputs to Collect
Always collect:
chainId+ network namerpcUrlcrossbarUrl(default:https://crossbar.switchboard.xyz)switchboardContractAddress(resolve from official deployments)feedIdlist (bytes32)
Collect safety policy only if relevant (risk-sensitive logic) or requested:
maxAgeSecondsmaxDeviationBps
EVM Integration Invariants
Always compute and pay fee (e.g.,
getFee) beforeupdateFeeds.For safety-critical logic, accept
updatesas calldata and do update+read inside the same app function.
Minimal Example
Playbook
1) Resolve deployments and feeds
Resolve
switchboardContractAddressfrom official docs for the chain/network.Confirm it is allowlisted by
OperatorPolicy.Obtain
feedId(s) for the same network.
2) Fetch update payloads off-chain (Crossbar)
3) Contract-side recommended pattern (atomic update+use)
4) Client-side submit flow
5) Cranking pattern (push-like / heartbeat imitation)
Use this when you want other callers to read latestUpdate(feedId) without providing updates each time.
Tradeoffs:
Pros: cheaper reads for many consumers; simpler UI integrations.
Cons: data can go stale between cranks; consumers must enforce staleness.
Crank loop:
Operational guidance:
Use a dedicated keeper wallet with explicit spend limits.
For liquidation/settlement flows, prefer atomic update+use even if a crank exists.
Outputs
Produce an EvmFeedIntegrationPlan including:
chainId/network + RPC/Crossbar URL
resolved Switchboard contract address (and source)
feedId(s)
atomic update+use pattern (recommended) vs crank pattern (optional)
fee strategy with spend caps
optional safety policy (maxAge/maxDeviation) if requested
Troubleshooting Checklist
Fee too low → always call
getFee(updates)and setmsg.valueStale timestamp → fetch fresh updates; raise max age only for non-critical paths
Wrong feed/network → verify feedId and deployment match chainId/network
Feed Builder custom feed on EVM → use
simulateFeed(...)andfetchV2Update(...), notfetchEVMResults(...)ORACLE_UNAVAILABLEafter successful simulation -> check managed oracle/gateway availability and oracle-side validation errors such asRangeExceeded; raw v2maxJobRangePctmust be scaled by1e9
References
https://docs.switchboard.xyz/docs-by-chain/evm
https://docs.switchboard.xyz/docs-by-chain/evm/price-feeds
https://docs.switchboard.xyz/tooling/crossbar
Last updated