Skip to main content

Chainlink Price Feed (Solidity)

Read token prices from Chainlink price feeds in a Solidity contract. Read token prices from Chainlink price feeds in a Solidity contract.

Explanation

Chainlink price feeds provide on-chain price data updated by a decentralized oracle network. latestRoundData returns the most recent price. The decimals() call tells you the precision — ETH/USD uses 8 decimals, so 2000000000000 = $20,000.

Code


Canonical knowledge ID: code-example:chainlink-price-feed-solidity