Chainlink Local - Documentation
  • 💻Getting Started
    • Chainlink Local - Documentation
    • Architecture
  • 📖API Reference
    • API Reference
    • CCIPLocalSimulator.sol API
    • CCIPLocalSimulatorFork.sol API
    • CCIPLocalSimulatorFork.js API
    • MockV3Aggregator.sol API
    • MockOffchainAggregator.sol API
  • Guides
    • CCIPLocalSimulator.sol - usage with Foundry, Hardhat & Remix IDE
    • CCIPLocalSimulatorFork.sol - usage with Foundry
    • CCIPLocalSimulatorFork.js - usage with Hardhat
  • 🧑‍💻Learn more
    • Examples
    • Contribute to Chainlink Local
Powered by GitBook
On this page
  • API Methods
  • [MockV3Aggregator].decimals()
  • [MockV3Aggregator].description()
  • [MockV3Aggregator].version()
  • [MockV3Aggregator].getRoundData(uint80 _roundId)
  • [MockV3Aggregator].latestRoundData()
  • [MockV3Aggregator].updateAnswer(int256 _answer)
  • [MockV3Aggregator].updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt)
  • [MockV3Aggregator].aggregator()
  • [MockV3Aggregator].proposedAggregator()
  • [MockV3Aggregator].proposeAggregator(AggregatorV2V3Interface _aggregator)
  • [MockV3Aggregator].confirmAggregator(address _aggregator)
  • [MockV3Aggregator].latestAnswer() - Deprecated
  • [MockV3Aggregator].latestTimestamp() - Deprecated
  • [MockV3Aggregator].latestRound() - Deprecated
  • [MockV3Aggregator].getAnswer(uint256 roundId) - Deprecated
  • [MockV3Aggregator].getTimestamp(uint256 roundId) - Deprecated
  1. API Reference

MockV3Aggregator.sol API

PreviousCCIPLocalSimulatorFork.js APINextMockOffchainAggregator.sol API

Last updated 11 months ago

API Methods

  • Deprecated

  • Deprecated

  • Deprecated

  • Deprecated

  • Deprecated

[MockV3Aggregator].decimals()

function decimals() external view returns(uint8);

Return the number of digits of precision for the stored answer. Answers are stored in fixed-point format.

Return values:

  • decimalPlaces (uint8): The number of digits of precision for the stored answer.


[MockV3Aggregator].description()

function description() external pure returns(string memory);

Return a description for this data feed. Usually this is an asset pair for a price feed. In mocks it is hard-coded to: "src/data-feeds/MockV3Aggregator.sol".

Return values:

  • description (string): The description for this data feed.


[MockV3Aggregator].version()

function version() public pure returns(uint256);

Returns the contract version. This is different from the typeAndVersion for the aggregator. In mocks it is hard-coded to 0.

Return values:

  • version (uint256): The contract version.


[MockV3Aggregator].getRoundData(uint80 _roundId)

function getRoundData(uint80 _roundId) external view returns(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

Get the full information for a specific aggregator round including the answer and update timestamps. Use this to get the full historical data for a round.

Parameters:

  • _roundId (uint80): The round ID.

Return values:

  • roundId (uint80): The round ID.

  • answer (iint256): The answer for this round.

  • startedAt (uint256): Timestamp of when the round started.

  • updatedAt (uint256): Timestamp of when the round was updated.


[MockV3Aggregator].latestRoundData()

 function latestRoundData() external view returns(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

Get the full information for the most recent round including the answer and update timestamps.

Return values:

  • roundId (uint80): The round ID.

  • answer (iint256): The answer for this round.

  • startedAt (uint256): Timestamp of when the round started.

  • updatedAt (uint256): Timestamp of when the round was updated.


[MockV3Aggregator].updateAnswer(int256 _answer)

function updateAnswer(int256 _answer) public;

Sets the new answer that the mock contract will return. Starts the new round automatically. Bumps the roundId by one. Sets the startedAt, updatedAt and answeredInRound values to block.timestamp. To update all of these values, use the updateRoundData function.

Parameters:

  • _answer (int256): The new answer for the next round.


[MockV3Aggregator].updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt)

function updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt) public;

Sets new details of the specific round that the mock contract will return.

Parameters:

  • roundId (uint80): The round ID.

  • answer (iint256): The answer for this round.

  • startedAt (uint256): Timestamp of when the round started.

  • updatedAt (uint256): Timestamp of when the round was updated.


[MockV3Aggregator].aggregator()

function aggregator() public view returns(address);

Returns the address of the current MockOffchainAggregator.sol contract.

Return values:

  • aggregator (address): The address of the current MockOffchainAggregator.sol contract.


[MockV3Aggregator].proposedAggregator()

function proposedAggregator() public view returns(address);

Returns the address of the proposed MockOffchainAggregator.sol contract. It is address(0) by default.

Return values:

  • proposedAggregator (address): The address of the proposed MockOffchainAggregator.sol contract.


[MockV3Aggregator].proposeAggregator(AggregatorV2V3Interface _aggregator)

function proposedAggregator(AggregatorV2V3Interface _aggregator) public;

Proposes the new MockOffchainAggregator.sol contract. Used as a first step in changing the underlying MockOffchainAggregator.sol contract. The second step is to call the confirmAggregator() function.

Parameters:

  • _aggregator (address): The address of the MockOffchainAggregator.sol contract to propose.


[MockV3Aggregator].confirmAggregator(address _aggregator)

function confirmAggregator(address _aggregator) public;

Sets the proposed MockOffchainAggregator.sol contract as the current aggregator. The proposedAggregator becomes address(0). Reverts if _aggregator is not equal to proposedAggregator.

Parameters:

  • _aggregator (address): The address of the new MockOffchainAggregator.sol contract.


function latestAnswer() external view returns(int256);

function latestTimestamp() external view returns(uint256);

function latestRound() external view returns(uint256);

function getAnswer(uint256 roundId) external view returns(int256);

function getTimestamp(uint256 roundId) external view returns(uint256);

answeredInRound(uint80): Deprecated - Previously used when answers could take multiple rounds to be computed.

answeredInRound(uint80): Deprecated - Previously used when answers could take multiple rounds to be computed.

answeredInRound(uint80): Deprecated - Previously used when answers could take multiple rounds to be computed.

[MockV3Aggregator].latestAnswer() - Deprecated

Deprecated - Do not use this function.

[MockV3Aggregator].latestTimestamp() - Deprecated

Deprecated - Do not use this function.

[MockV3Aggregator].latestRound() - Deprecated

Deprecated - Do not use this function.

[MockV3Aggregator].getAnswer(uint256 roundId) - Deprecated

Deprecated - Do not use this function.

[MockV3Aggregator].getTimestamp(uint256 roundId) - Deprecated

Deprecated - Do not use this function.

📖
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
⚠️
decimals()
description()
version()
getRoundData(uint80 _roundId)
latestRoundData()
updateAnswer(int256 _answer)
updateRoundData(uint80 _roundId, int256 _answer, uint256 _timestamp, uint256 _startedAt)
aggregator()
proposedAggregator()
proposeAggregator(AggregatorV2V3Interface _aggregator)
confirmAggregator(address _aggregator)
latestAnswer()
latestTimestamp()
latestRound()
getAnswer(uint256 roundId)
getTimestamp(uint256 roundId)