-
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.
write happy path tests for automation23 registrar registerUpkeep() (#…
…12474) * write happy path tests for automation23 registrar registerUpkeep() * regerate wrappers * rename UpkeepMock --> MockUpkeep
- Loading branch information
1 parent
cdb85e4
commit bfd9ad1
Showing
8 changed files
with
246 additions
and
8 deletions.
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
contracts/src/v0.8/automation/dev/interfaces/v2_3/IAutomationRegistryMaster2_3.sol
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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.0; | ||
|
||
contract MockUpkeep { | ||
bool public shouldCheckRevert; | ||
bool public shouldPerformRevert; | ||
bool public checkResult = true; | ||
bytes public performData; | ||
uint256 public checkGasToBurn; | ||
uint256 public performGasToBurn; | ||
|
||
event UpkeepPerformedWith(bytes upkeepData); | ||
error CheckRevert(); | ||
error PerformRevert(); | ||
|
||
function setShouldCheckRevert(bool value) public { | ||
shouldCheckRevert = value; | ||
} | ||
|
||
function setShouldPerformRevert(bool value) public { | ||
shouldPerformRevert = value; | ||
} | ||
|
||
function setCheckResult(bool value) public { | ||
checkResult = value; | ||
} | ||
|
||
function setPerformData(bytes calldata data) public { | ||
performData = data; | ||
} | ||
|
||
function setCheckGasToBurn(uint256 value) public { | ||
checkGasToBurn = value; | ||
} | ||
|
||
function setPerformGasToBurn(uint256 value) public { | ||
performGasToBurn = value; | ||
} | ||
|
||
function checkUpkeep(bytes calldata) external view returns (bool callable, bytes memory executedata) { | ||
if (shouldCheckRevert) revert CheckRevert(); | ||
uint256 startGas = gasleft(); | ||
while (startGas - gasleft() < checkGasToBurn) {} // burn gas | ||
return (checkResult, performData); | ||
} | ||
|
||
function performUpkeep(bytes calldata data) external { | ||
if (shouldPerformRevert) revert PerformRevert(); | ||
uint256 startGas = gasleft(); | ||
while (startGas - gasleft() < performGasToBurn) {} // burn gas | ||
emit UpkeepPerformedWith(data); | ||
} | ||
} |
28 changes: 26 additions & 2 deletions
28
...erated/automation_registry_logic_b_wrapper_2_3/automation_registry_logic_b_wrapper_2_3.go
Large diffs are not rendered by default.
Oops, something went wrong.
26 changes: 25 additions & 1 deletion
26
...ated/i_automation_registry_master_wrapper_2_3/i_automation_registry_master_wrapper_2_3.go
Large diffs are not rendered by default.
Oops, something went wrong.
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