# ChainlinkOracleAdapter.sol

### ChainlinkOracleAdapter

Adapted from the official implementation.&#x20;

#### feedRegistry

```solidity
contract IFeedRegistry feedRegistry
```

The feed registry

*Chainlink feed registry contract. See <https://docs.chain.link/docs/data-feeds/feed-registry/>*

#### MAX\_ACCEPTABLE\_STALENESS

```solidity
uint256 MAX_ACCEPTABLE_STALENESS
```

The maximum time allowed after the price update has happened. If the price was updated in more seconds than the maximum time, `getPrice` function returns zero.

#### weth

```solidity
address weth
```

The address of the wrapped native asset.

#### wbtc

```solidity
address wbtc
```

The address of the wrapped asset.

#### disabledAssets

```solidity
mapping(address => bool) disabledAssets
```

Assets which are temporarily stopped.

#### constructor

```solidity
constructor(address _feedRegistry, address _weth, address _wbtc) public
```

Constructor that sets the Chainlink feed registry and wrapped native contract.

**Parameters**

| Name           | Type    | Description                                        |
| -------------- | ------- | -------------------------------------------------- |
| \_feedRegistry | address | The Chainlink Feed Registry implementation.        |
| \_weth         | address | The address of the wrapped native asset e.g. WETH. |
| \_wbtc         | address | The address of the wrapped native asset e.g. WBTC. |

#### setAssetStatus

```solidity
function setAssetStatus(address baseAsset, bool isEnabled) external
```

Function that disables and enables particular assets.

**Parameters**

| Name      | Type    | Description                               |
| --------- | ------- | ----------------------------------------- |
| baseAsset | address | The asset which will be disabled/enabled. |
| isEnabled | bool    | False if the asset should be disabled.    |

#### supportsAsset

```solidity
function supportsAsset(address _baseAsset, address _quoteAsset) external view returns (bool)
```

Checks if a token is supported.

*Only the native token is supported as a quote.*

**Parameters**

| Name         | Type    | Description                          |
| ------------ | ------- | ------------------------------------ |
| \_baseAsset  | address | The asset for whose price is needed. |
| \_quoteAsset | address | The price denomination               |

**Return Values**

| Name | Type | Description                             |
| ---- | ---- | --------------------------------------- |
| \[0] | bool | Whether the oracle supports this asset. |

#### getPrice

```solidity
function getPrice(address _baseAsset, address _quoteAsset) external view returns (bool, uint256)
```

Returns the price of an asset denominated in the base asset.

*Does not throw an error on failure but returns success = false.*

**Return Values**

| Name | Type    | Description                                        |
| ---- | ------- | -------------------------------------------------- |
| \[0] | bool    | whether the call succeeded and the returned price. |
| \[1] | uint256 |                                                    |
