Skip to content

Commit

Permalink
adding test for v23 (#13644)
Browse files Browse the repository at this point in the history
* try adding test for v23

* rebase and polish

* address comments
  • Loading branch information
shileiwill authored Jun 21, 2024
1 parent c9f6816 commit 2ed4478
Show file tree
Hide file tree
Showing 20 changed files with 2,139 additions and 40 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-avocados-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

add test for v23 #added
5 changes: 5 additions & 0 deletions contracts/.changeset/green-pigs-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts": patch
---

add test for v23 #added
3 changes: 3 additions & 0 deletions contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ compileContract automation/v2_3/AutomationRegistryLogicB2_3.sol
compileContract automation/v2_3/AutomationRegistryLogicC2_3.sol
compileContract automation/v2_3/AutomationUtils2_3.sol
compileContract automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol

compileContract automation/testhelpers/MockETHUSDAggregator.sol
compileContract automation/test/v2_3/WETH9.sol
53 changes: 53 additions & 0 deletions contracts/src/v0.8/automation/testhelpers/MockETHUSDAggregator.sol
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;
}
}
Loading

0 comments on commit 2ed4478

Please sign in to comment.