Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 1 addition & 21 deletions public/samples/DataFeeds/MVR/MVRDataConsumer.sol
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

// NOTE: The required interfaces will soon be available in the Chainlink package for you to import.

interface IBundleAggregatorProxy {
/**
* @notice Returns the latest bundle data
* @return bundle The latest bundle as raw bytes
*/
function latestBundle() external view returns (bytes memory);

/**
* @notice Returns the timestamp of the latest bundle
* @return timestamp The timestamp of the latest bundle
*/
function latestBundleTimestamp() external view returns (uint256);

/**
* @notice Returns the decimals for each field in the bundle
* @return decimalsArray Array of decimals for each value in the bundle
*/
function bundleDecimals() external view returns (uint8[] memory);
}
import {IBundleAggregatorProxy} from "@chainlink/contracts/src/v0.8/data-feeds/interfaces/IBundleAggregatorProxy.sol";

/**
* @notice This struct defines the exact data structure of the MVR feed
Expand Down
22 changes: 9 additions & 13 deletions src/content/data-feeds/mvr-feeds/guides/evm-solidity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,21 @@ struct Data {

Your consumer contract must replicate this structure in the **exact same order** and with the same data types to decode the feed data correctly.

### 2. Set Up the BundleAggregatorProxy
### 2. Import the IBundleAggregatorProxy Interface

Your contract will need a reference to the [`IBundleAggregatorProxy`](/data-feeds/mvr-feeds/api-reference#ibundleaggregatorproxy) interface so it can:
Your contract will need to interact with the MVR feed's proxy contract. The [`IBundleAggregatorProxy`](/data-feeds/mvr-feeds/api-reference#ibundleaggregatorproxy) interface provides the necessary functions:

- Retrieve the raw bytes via [`latestBundle()`](/data-feeds/mvr-feeds/api-reference#latestbundle).
- Retrieve decimals via [`bundleDecimals()`](/data-feeds/mvr-feeds/api-reference#bundledecimals) if the feed includes numeric fields.
- Check the timestamp of the last update via [`latestBundleTimestamp()`](/data-feeds/mvr-feeds/api-reference#latestbundletimestamp).
- [`latestBundle()`](/data-feeds/mvr-feeds/api-reference#latestbundle): Retrieves the raw data bundle.
- [`bundleDecimals()`](/data-feeds/mvr-feeds/api-reference#bundledecimals): Retrieves the decimal places for numeric fields.
- [`latestBundleTimestamp()`](/data-feeds/mvr-feeds/api-reference#latestbundletimestamp): Retrieves the timestamp of the last update.

```solidity
interface IBundleAggregatorProxy {
function latestBundle() external view returns (bytes memory);
function bundleDecimals() external view returns (uint8[] memory);
function latestBundleTimestamp() external view returns (uint256);
Import it directly from the `@chainlink/contracts` library:

// Additional inherited functions omitted for brevity
}
```solidity
import {IBundleAggregatorProxy} from "@chainlink/contracts/src/v0.8/data-feeds/interfaces/IBundleAggregatorProxy.sol";
```

You will set the correct proxy address in your consumer contract.
You will then use this interface to create an instance of the proxy in your consumer contract.

### 3. Validate Data Staleness

Expand Down
Loading