Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 51144df

Browse files
committed
Make all functions view and virtual to allow them to overriden more freely
1 parent 36660f0 commit 51144df

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

contracts/Api3PartialAggregatorV2V3Interface.sol

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ contract Api3PartialAggregatorV2V3Interface is AggregatorV2V3Interface {
3333
/// @dev AggregatorV2V3Interface users are already responsible with
3434
/// validating the values that they receive (e.g., revert if the spot price
3535
/// of an asset is negative). Therefore, this contract omits validation.
36-
function latestAnswer() external view override returns (int256 value) {
36+
function latestAnswer()
37+
external
38+
view
39+
virtual
40+
override
41+
returns (int256 value)
42+
{
3743
(value, ) = IProxy(api3Proxy).read();
3844
}
3945

@@ -46,42 +52,51 @@ contract Api3PartialAggregatorV2V3Interface is AggregatorV2V3Interface {
4652
function latestTimestamp()
4753
external
4854
view
55+
virtual
4956
override
5057
returns (uint256 timestamp)
5158
{
5259
(, timestamp) = IProxy(api3Proxy).read();
5360
}
5461

5562
/// @dev API3 feeds are updated asynchronously and not in rounds.
56-
function latestRound() external pure override returns (uint256) {
63+
function latestRound() external view virtual override returns (uint256) {
5764
revert FunctionIsNotSupported();
5865
}
5966

6067
/// @dev Functions that use the round ID as an argument are not supported.
61-
function getAnswer(uint256) external pure override returns (int256) {
68+
function getAnswer(
69+
uint256
70+
) external view virtual override returns (int256) {
6271
revert FunctionIsNotSupported();
6372
}
6473

6574
/// @dev Functions that use the round ID as an argument are not supported.
66-
function getTimestamp(uint256) external pure returns (uint256) {
75+
function getTimestamp(uint256) external view virtual returns (uint256) {
6776
revert FunctionIsNotSupported();
6877
}
6978

7079
/// @dev API3 feeds always use 18 decimals.
71-
function decimals() external pure override returns (uint8) {
80+
function decimals() external view virtual override returns (uint8) {
7281
return 18;
7382
}
7483

7584
/// @dev The deterministic proxy address acts as the description, and this
7685
/// is left empty to save gas on contract deployment.
77-
function description() external pure override returns (string memory) {
86+
function description()
87+
external
88+
view
89+
virtual
90+
override
91+
returns (string memory)
92+
{
7893
return "";
7994
}
8095

8196
/// @dev A unique version is chosen to easily check if an unverified
8297
/// contract that acts as a Chainlink feed is an
8398
/// Api3PartialAggregatorV2V3Interface.
84-
function version() external pure override returns (uint256) {
99+
function version() external view virtual override returns (uint256) {
85100
return 4913;
86101
}
87102

@@ -90,7 +105,8 @@ contract Api3PartialAggregatorV2V3Interface is AggregatorV2V3Interface {
90105
uint80
91106
)
92107
external
93-
pure
108+
view
109+
virtual
94110
override
95111
returns (uint80, int256, uint256, uint256, uint80)
96112
{
@@ -103,6 +119,7 @@ contract Api3PartialAggregatorV2V3Interface is AggregatorV2V3Interface {
103119
function latestRoundData()
104120
external
105121
view
122+
virtual
106123
override
107124
returns (
108125
uint80 roundId,

0 commit comments

Comments
 (0)