-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* try adding test for v23 * rebase and polish * address comments
- Loading branch information
1 parent
c9f6816
commit 2ed4478
Showing
20 changed files
with
2,139 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
add test for v23 #added |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@chainlink/contracts": patch | ||
--- | ||
|
||
add test for v23 #added |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
contracts/src/v0.8/automation/testhelpers/MockETHUSDAggregator.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.19; | ||
|
||
import "../../shared/interfaces/AggregatorV3Interface.sol"; | ||
|
||
contract MockETHUSDAggregator is AggregatorV3Interface { | ||
int256 public answer; | ||
uint256 private blockTimestampDeduction = 0; | ||
|
||
constructor(int256 _answer) { | ||
answer = _answer; | ||
} | ||
|
||
function decimals() external pure override returns (uint8) { | ||
return 8; | ||
} | ||
|
||
function description() external pure override returns (string memory) { | ||
return "MockETHUSDAggregator"; | ||
} | ||
|
||
function version() external pure override returns (uint256) { | ||
return 1; | ||
} | ||
|
||
function getRoundData( | ||
uint80 /*_roundId*/ | ||
) | ||
external | ||
view | ||
override | ||
returns (uint80 roundId, int256 ans, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) | ||
{ | ||
return (1, answer, getDeductedBlockTimestamp(), getDeductedBlockTimestamp(), 1); | ||
} | ||
|
||
function latestRoundData() | ||
external | ||
view | ||
override | ||
returns (uint80 roundId, int256 ans, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) | ||
{ | ||
return (1, answer, getDeductedBlockTimestamp(), getDeductedBlockTimestamp(), 1); | ||
} | ||
|
||
function getDeductedBlockTimestamp() internal view returns (uint256) { | ||
return block.timestamp - blockTimestampDeduction; | ||
} | ||
|
||
function setBlockTimestampDeduction(uint256 _blockTimestampDeduction) external { | ||
blockTimestampDeduction = _blockTimestampDeduction; | ||
} | ||
} |
Oops, something went wrong.