> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# Chainlink

> How to read a Chainlink price feed in a Solidity smart contract on Polygon.

<Note title="Content disclaimer">
  Please view the third-party content disclaimer [here](https://github.com/0xPolygon/polygon-docs/blob/main/CONTENT_DISCLAIMER.md).
</Note>

[Chainlink](https://chain.link/) lets your contracts access external data through a decentralized oracle network. The most common use case on Polygon is reading price feeds directly from Chainlink Data Feeds.

## Prerequisites

* A Solidity contract deployed or ready to deploy on Polygon PoS or Amoy testnet.
* The Chainlink `AggregatorV3Interface` imported from `@chainlink/contracts`.

## Read a price feed

The contract below reads the latest POL/USD price on the Amoy testnet. To use a different price pair, replace the feed address with [any address from the Chainlink Polygon feed list](https://docs.chain.link/docs/matic-addresses#config).

```solidity theme={null}
pragma solidity ^0.8.26;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract PriceConsumerV3 {
    AggregatorV3Interface internal priceFeed;

    /**
     * Network: Amoy Testnet
     * Aggregator: POL/USD
     * Address: 0x001382149eBa3441043c1c66972b4772963f5D43
     */
    constructor() public {
        priceFeed = AggregatorV3Interface(0x001382149eBa3441043c1c66972b4772963f5D43);
    }

    /**
     * Returns the latest price
     */
    function getLatestPrice() public view returns (int) {
        (
            uint80 roundID,
            int price,
            uint startedAt,
            uint timeStamp,
            uint80 answeredInRound
        ) = priceFeed.latestRoundData();
        return price;
    }
}
```

## Next steps

* Browse all available Polygon feed addresses in the [Chainlink documentation](https://docs.chain.link/docs/matic-addresses#config).
* For more advanced usage, see the [Chainlink data feeds docs](https://docs.chain.link/docs/using-chainlink-reference-contracts).
