MockV3Aggregator.sol API
API Methods
latestAnswer()
⚠️ DeprecatedlatestTimestamp()
⚠️ DeprecatedlatestRound()
⚠️ DeprecatedgetAnswer(uint256 roundId)
⚠️ DeprecatedgetTimestamp(uint256 roundId)
⚠️ Deprecated
[MockV3Aggregator].decimals()
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()
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()
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)
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.answeredInRound
(uint80): ⚠️ Deprecated - Previously used when answers could take multiple rounds to be computed.
[MockV3Aggregator].latestRoundData()
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.answeredInRound
(uint80): ⚠️ Deprecated - Previously used when answers could take multiple rounds to be computed.
[MockV3Aggregator].updateAnswer(int256 _answer)
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)
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.answeredInRound
(uint80): ⚠️ Deprecated - Previously used when answers could take multiple rounds to be computed.
[MockV3Aggregator].aggregator()
Returns the address of the current MockOffchainAggregator.sol
contract.
Return values:
aggregator
(address): The address of the currentMockOffchainAggregator.sol
contract.
[MockV3Aggregator].proposedAggregator()
Returns the address of the proposed MockOffchainAggregator.sol
contract. It is address(0)
by default.
Return values:
proposedAggregator
(address): The address of the proposedMockOffchainAggregator.sol
contract.
[MockV3Aggregator].proposeAggregator(AggregatorV2V3Interface _aggregator)
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 theMockOffchainAggregator.sol
contract to propose.
[MockV3Aggregator].confirmAggregator(address _aggregator)
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 newMockOffchainAggregator.sol
contract.
[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.
Last updated