Skip to content

Commit

Permalink
Auto 8378 create copy of 2 1 contracts and test suits (#11853)
Browse files Browse the repository at this point in the history
* create automation v2.2 contracts

* update licenses

* adjust solhit rules

* update native compilation step

* fix foundry tests and AutomationRegistry file name

* fix failing foundry test

* update nate compile all

* fix import path bug

* replace automation registry contract

* fix typo
  • Loading branch information
RyanRHall authored Jan 23, 2024
1 parent 5057899 commit 737d349
Show file tree
Hide file tree
Showing 24 changed files with 10,115 additions and 34 deletions.
1 change: 1 addition & 0 deletions contracts/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"func-named-parameters": "off",
"immutable-vars-naming": "off",
"no-inline-assembly": "off",
"contract-name-camelcase": "off",
"no-unused-import": "error",
"func-visibility": [
"error",
Expand Down
17 changes: 16 additions & 1 deletion contracts/.solhintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
./src/v0.8/automation/v1_3
./src/v0.8/automation/v2_0
./src/v0.8/automation/v2_1
./src/v0.8/automation/interfaces/v2_1/
./src/v0.8/automation/interfaces/MigratableKeeperRegistryInterface.sol
./src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol
./src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol
./src/v0.8/automation/upkeeps/EthBalanceMonitor.sol
./src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol
./src/v0.8/automation/upkeeps/CronUpkeepFactory.sol
./src/v0.8/automation/upkeeps/CronUpkeepDelegate.sol
./src/v0.8/automation/upkeeps/CronUpkeep.sol
./src/v0.8/automation/libraries/internal/Cron.sol
./src/v0.8/automation/AutomationForwarder.sol
./src/v0.8/automation/AutomationForwarderLogic.sol


# Ignore tests / test helpers (for now)
./src/v0.8/automation/mocks
./src/v0.8/automation/testhelpers

Expand All @@ -22,4 +37,4 @@

# Always ignore vendor
./src/v0.8/vendor
./node_modules/
./node_modules/
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"prepublishOnly": "pnpm compile && ./scripts/prepublish_generate_abi_folder",
"publish-beta": "pnpm publish --tag beta",
"publish-prod": "npm dist-tag add @chainlink/[email protected] latest",
"solhint": "solhint --max-warnings 83 \"./src/v0.8/**/*.sol\""
"solhint": "solhint --max-warnings 33 \"./src/v0.8/**/*.sol\""
},
"files": [
"src/v0.8",
Expand Down
12 changes: 6 additions & 6 deletions contracts/scripts/generate-automation-master-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* @description this script generates a master interface for interacting with the automation registry
* @notice run this script with pnpm ts-node ./scripts/generate-automation-master-interface.ts
*/
import { KeeperRegistry2_1__factory as KeeperRegistry } from '../typechain/factories/KeeperRegistry2_1__factory'
import { KeeperRegistryLogicA2_1__factory as KeeperRegistryLogicA } from '../typechain/factories/KeeperRegistryLogicA2_1__factory'
import { KeeperRegistryLogicB2_1__factory as KeeperRegistryLogicB } from '../typechain/factories/KeeperRegistryLogicB2_1__factory'
import { KeeperRegistry2_2__factory as KeeperRegistry } from '../typechain/factories/KeeperRegistry2_2__factory'
import { KeeperRegistryLogicA2_2__factory as KeeperRegistryLogicA } from '../typechain/factories/KeeperRegistryLogicA2_2__factory'
import { KeeperRegistryLogicB2_2__factory as KeeperRegistryLogicB } from '../typechain/factories/KeeperRegistryLogicB2_2__factory'
import { utils } from 'ethers'
import fs from 'fs'
import { exec } from 'child_process'

const dest = 'src/v0.8/automation/interfaces/v2_1'
const srcDest = `${dest}/IKeeperRegistryMaster.sol`
const dest = 'src/v0.8/automation/dev/interfaces/v2_2'
const srcDest = `${dest}/IAutomationRegistryMaster.sol`
const tmpDest = `${dest}/tmp.txt`

const combinedABI = []
Expand Down Expand Up @@ -44,7 +44,7 @@ const checksum = utils.id(abis.join(''))
fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI))

const cmd = `
cat ${tmpDest} | pnpm abi-to-sol --solidity-version ^0.8.4 --license MIT > ${srcDest} IKeeperRegistryMaster;
cat ${tmpDest} | pnpm abi-to-sol --solidity-version ^0.8.4 --license MIT > ${srcDest} IAutomationRegistryMaster;
echo "// abi-checksum: ${checksum}" | cat - ${srcDest} > ${tmpDest} && mv ${tmpDest} ${srcDest};
pnpm prettier --write ${srcDest};
`
Expand Down
12 changes: 10 additions & 2 deletions contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,18 @@ compileContract automation/v2_1/AutomationRegistrar2_1.sol
compileContract automation/v2_1/KeeperRegistry2_1.sol
compileContract automation/v2_1/KeeperRegistryLogicA2_1.sol
compileContract automation/v2_1/KeeperRegistryLogicB2_1.sol
compileContract automation/v2_1/AutomationUtils2_1.sol
compileContract automation/interfaces/v2_1/IKeeperRegistryMaster.sol

compileContract automation/dev/v2_2/AutomationRegistrar2_2.sol
compileContract automation/dev/v2_2/AutomationRegistry2_2.sol
compileContract automation/dev/v2_2/AutomationRegistryLogicA2_2.sol
compileContract automation/dev/v2_2/AutomationRegistryLogicB2_2.sol
compileContract automation/dev/v2_2/AutomationUtils2_2.sol
compileContract automation/dev/interfaces/v2_2/IAutomationRegistryMaster.sol

compileContract automation/interfaces/ILogAutomation.sol
compileContract automation/v2_1/AutomationUtils2_1.sol
compileContract automation/v2_1/AutomationForwarderLogic.sol
compileContract automation/AutomationForwarderLogic.sol
compileContract automation/testhelpers/LogTriggeredStreamsLookup.sol
compileContract automation/testhelpers/DummyProtocol.sol

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;

import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol";
import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol";

uint256 constant PERFORM_GAS_CUSHION = 5_000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.16;

import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol";
import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol";
import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol";
import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol";

contract AutomationForwarderLogic is ITypeAndVersion {
IAutomationRegistryConsumer private s_registry;
Expand Down
Loading

0 comments on commit 737d349

Please sign in to comment.