# Chainlink Oracle Adapter

## Overview

The ChainlinkOracleAdapter contract is an implementation of the IBasePriceOracle interface and it uses Chainlink's feed registry to retrieve prices of assets. The contract takes in the address of the feed registry and the addresses of wrapped native assets (e.g. WETH and WBTC) as input in its constructor.

## Getting the price

The contract has a `getPrice` function that retrieves the price of a particular asset. It first checks if the asset is supported by calling the `supportsAsset` function. It then retrieves the feed for the asset from the feed registry and checks if the price update is within the allowed staleness period (i.e. 24 hours). If the price update is within the allowed staleness period, it retrieves the latest price from the feed and returns it. If the price update is outside the allowed staleness period, it throws an error.

## Supported assets

The contract has a `supportsAsset` function that checks if a particular asset is supported by the oracle. It first checks if the quote asset is either WETH or ETH and not disabled. It then checks if the base asset is equal to WBTC and converts it to BTC if it is. It then retrieves the feed for the base asset and quote asset from the feed registry and checks if the feed exists. If the feed exists, it returns true, indicating that the asset is supported by the oracle.

The contract also has a `setAssetStatus` function that enables or disables a particular asset. This function can only be called by the contract owner and it checks if the asset is supported by calling the `supportsAsset` function. If the asset is supported, it updates the disabled assets mapping with the new status of the asset.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lombard.fi/developers/chainlink-oracle-adapter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
