chainlink
Installation
SKILL.md
Chainlink
Chainlink provides decentralized oracle infrastructure: price feeds for DeFi pricing, VRF for provably fair randomness, Automation for scheduled/conditional on-chain execution, and CCIP for cross-chain messaging and token transfers.
What You Probably Got Wrong
latestRoundData()returnsint256, notuint256— Price can be negative (e.g., oil futures in 2020). Always checkanswer > 0before casting.- Decimals vary per feed — ETH/USD has 8 decimals, ETH/BTC has 18 decimals, USDC/USD has 8. Always call
decimals()or hardcode per known feed. Never assume 8. - VRF v2 is deprecated — use VRF v2.5 — VRF v2.5 supports both LINK and native payment, uses
requestRandomWords()with a struct parameter, and has a different coordinator interface. Most LLM training data references VRF v2. - Staleness is not optional — A price feed can return a stale answer if the oracle network stops updating. You must check
updatedAtagainst a heartbeat threshold. Feeds without staleness checks have caused protocol-draining exploits. roundIdcan be zero on L2s — On Arbitrum/Optimism sequencer feeds, round semantics differ. Do not rely onroundIdfor ordering on L2 feeds.- CCIP is not Chainlink VRF — They are separate products. CCIP handles cross-chain messaging; VRF handles randomness. Different contracts, different billing.
- Automation renamed from Keepers — The product is now called Chainlink Automation, not Keepers. The interface names changed:
KeeperCompatibleInterfaceis nowAutomationCompatibleInterface.
Price Feeds
AggregatorV3Interface
The core interface for reading Chainlink price data on-chain.