Skip to content

Commit

Permalink
try adding test for v23
Browse files Browse the repository at this point in the history
  • Loading branch information
shileiwill committed Jun 21, 2024
1 parent 10ddafa commit 70d2482
Show file tree
Hide file tree
Showing 16 changed files with 6,178 additions and 1,070 deletions.
5 changes: 4 additions & 1 deletion contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ OPTIMIZE_RUNS=1000000

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )"
python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt
python3 -m pip install --require-hashes --break-system-packages -r "$SCRIPTPATH"/requirements.txt

solc-select install $SOLC_VERSION
solc-select use $SOLC_VERSION
Expand Down 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 70d2482

Please sign in to comment.