Skip to content

Commit

Permalink
Automation logic C contract (#12497)
Browse files Browse the repository at this point in the history
* add logic C to automation contracts

* update wrappers

* add changeset
  • Loading branch information
RyanRHall authored Mar 19, 2024
1 parent 745f8ec commit 3ca3494
Show file tree
Hide file tree
Showing 14 changed files with 837 additions and 2,178 deletions.
5 changes: 5 additions & 0 deletions .changeset/gentle-cups-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

added logic C contract to automation 2.3
5 changes: 5 additions & 0 deletions contracts/.changeset/fluffy-peaches-provide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts": patch
---

added logic C contract to automation 2.3
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import { AutomationRegistry2_3__factory as Registry } from '../typechain/factories/AutomationRegistry2_3__factory'
import { AutomationRegistryLogicA2_3__factory as RegistryLogicA } from '../typechain/factories/AutomationRegistryLogicA2_3__factory'
import { AutomationRegistryLogicB2_3__factory as RegistryLogicB } from '../typechain/factories/AutomationRegistryLogicB2_3__factory'
import { AutomationRegistryLogicC2_3__factory as RegistryLogicC } from '../typechain/factories/AutomationRegistryLogicC2_3__factory'
import { utils } from 'ethers'
import fs from 'fs'
import { exec } from 'child_process'
Expand All @@ -15,7 +16,12 @@ const tmpDest = `${dest}/tmp.txt`

const combinedABI = []
const abiSet = new Set()
const abis = [Registry.abi, RegistryLogicA.abi, RegistryLogicB.abi]
const abis = [
Registry.abi,
RegistryLogicA.abi,
RegistryLogicB.abi,
RegistryLogicC.abi,
]

for (const abi of abis) {
for (const entry of abi) {
Expand Down

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions contracts/src/v0.8/automation/dev/test/BaseTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {AutomationForwarderLogic} from "../../AutomationForwarderLogic.sol";
import {AutomationRegistry2_3} from "../v2_3/AutomationRegistry2_3.sol";
import {AutomationRegistryLogicA2_3} from "../v2_3/AutomationRegistryLogicA2_3.sol";
import {AutomationRegistryLogicB2_3} from "../v2_3/AutomationRegistryLogicB2_3.sol";
import {AutomationRegistryLogicC2_3} from "../v2_3/AutomationRegistryLogicC2_3.sol";
import {IAutomationRegistryMaster2_3, AutomationRegistryBase2_3} from "../interfaces/v2_3/IAutomationRegistryMaster2_3.sol";
import {AutomationRegistrar2_3} from "../v2_3/AutomationRegistrar2_3.sol";
import {ChainModuleBase} from "../../chains/ChainModuleBase.sol";
Expand Down Expand Up @@ -97,17 +98,17 @@ contract BaseTest is Test {
*/
function deployRegistry() internal returns (IAutomationRegistryMaster2_3) {
AutomationForwarderLogic forwarderLogic = new AutomationForwarderLogic();
AutomationRegistryLogicB2_3 logicB2_3 = new AutomationRegistryLogicB2_3(
AutomationRegistryLogicC2_3 logicC2_3 = new AutomationRegistryLogicC2_3(
address(linkToken),
address(LINK_USD_FEED),
address(NATIVE_USD_FEED),
address(FAST_GAS_FEED),
address(forwarderLogic),
ZERO_ADDRESS
);
AutomationRegistryLogicB2_3 logicB2_3 = new AutomationRegistryLogicB2_3(logicC2_3);
AutomationRegistryLogicA2_3 logicA2_3 = new AutomationRegistryLogicA2_3(logicB2_3);
return
IAutomationRegistryMaster2_3(address(new AutomationRegistry2_3(AutomationRegistryLogicB2_3(address(logicA2_3))))); // wow this line is hilarious
return IAutomationRegistryMaster2_3(address(new AutomationRegistry2_3(logicA2_3)));
}

/**
Expand Down
20 changes: 11 additions & 9 deletions contracts/src/v0.8/automation/dev/v2_3/AutomationRegistry2_3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ pragma solidity 0.8.19;
import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol";
import {Address} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol";
import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol";
import {AutomationRegistryLogicB2_3} from "./AutomationRegistryLogicB2_3.sol";
import {AutomationRegistryLogicA2_3} from "./AutomationRegistryLogicA2_3.sol";
import {AutomationRegistryLogicC2_3} from "./AutomationRegistryLogicC2_3.sol";
import {Chainable} from "../../Chainable.sol";
import {IERC677Receiver} from "../../../shared/interfaces/IERC677Receiver.sol";
import {OCR2Abstract} from "../../../shared/ocr2/OCR2Abstract.sol";
Expand Down Expand Up @@ -44,18 +45,19 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain
string public constant override typeAndVersion = "AutomationRegistry 2.3.0";

/**
* @param logicA the address of the first logic contract, but cast as logicB in order to call logicB functions (via fallback)
* @param logicA the address of the first logic contract
* @dev we cast the contract to logicC in order to call logicC functions (via fallback)
*/
constructor(
AutomationRegistryLogicB2_3 logicA
AutomationRegistryLogicA2_3 logicA
)
AutomationRegistryBase2_3(
logicA.getLinkAddress(),
logicA.getLinkUSDFeedAddress(),
logicA.getNativeUSDFeedAddress(),
logicA.getFastGasFeedAddress(),
logicA.getAutomationForwarderLogic(),
logicA.getAllowedReadOnlyAddress()
AutomationRegistryLogicC2_3(address(logicA)).getLinkAddress(),
AutomationRegistryLogicC2_3(address(logicA)).getLinkUSDFeedAddress(),
AutomationRegistryLogicC2_3(address(logicA)).getNativeUSDFeedAddress(),
AutomationRegistryLogicC2_3(address(logicA)).getFastGasFeedAddress(),
AutomationRegistryLogicC2_3(address(logicA)).getAutomationForwarderLogic(),
AutomationRegistryLogicC2_3(address(logicA)).getAllowedReadOnlyAddress()
)
Chainable(address(logicA))
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity 0.8.19;
import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol";
import {Address} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol";
import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol";
import {AutomationRegistryLogicC2_3} from "./AutomationRegistryLogicC2_3.sol";
import {AutomationRegistryLogicB2_3} from "./AutomationRegistryLogicB2_3.sol";
import {Chainable} from "../../Chainable.sol";
import {AutomationForwarder} from "../../AutomationForwarder.sol";
Expand All @@ -22,17 +23,18 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable {

/**
* @param logicB the address of the second logic contract
* @dev we cast the contract to logicC in order to call logicC functions (via fallback)
*/
constructor(
AutomationRegistryLogicB2_3 logicB
)
AutomationRegistryBase2_3(
logicB.getLinkAddress(),
logicB.getLinkUSDFeedAddress(),
logicB.getNativeUSDFeedAddress(),
logicB.getFastGasFeedAddress(),
logicB.getAutomationForwarderLogic(),
logicB.getAllowedReadOnlyAddress()
AutomationRegistryLogicC2_3(address(logicB)).getLinkAddress(),
AutomationRegistryLogicC2_3(address(logicB)).getLinkUSDFeedAddress(),
AutomationRegistryLogicC2_3(address(logicB)).getNativeUSDFeedAddress(),
AutomationRegistryLogicC2_3(address(logicB)).getFastGasFeedAddress(),
AutomationRegistryLogicC2_3(address(logicB)).getAutomationForwarderLogic(),
AutomationRegistryLogicC2_3(address(logicB)).getAllowedReadOnlyAddress()
)
Chainable(address(logicB))
{}
Expand Down
Loading

0 comments on commit 3ca3494

Please sign in to comment.