-
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.
auto-10161: implement without zksync forwarder interface change (#14037)
* add changeset * add some basic foundry tests * add zksync module and interfaces * update * update * add tests * fix lint * add more tests * update * test * format * add a zksync interface * update * update * add overhead funcs * update * update * update * update * update * clean up 1 * clean up 2
- Loading branch information
1 parent
d50feb0
commit 9c240b6
Showing
17 changed files
with
8,463 additions
and
67 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
'@chainlink/contracts': patch | ||
--- | ||
|
||
implement an auto registry for zksync with no forwarder interface change |
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
58 changes: 58 additions & 0 deletions
58
contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts
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,58 @@ | ||
/** | ||
* @description this script generates a master interface for interacting with the automation registry | ||
* @notice run this script with pnpm ts-node ./scripts/generate-zksync-automation-master-interface-v2_3.ts | ||
*/ | ||
import { ZKSyncAutomationRegistry2_3__factory as Registry } from '../typechain/factories/ZKSyncAutomationRegistry2_3__factory' | ||
import { ZKSyncAutomationRegistryLogicA2_3__factory as RegistryLogicA } from '../typechain/factories/ZKSyncAutomationRegistryLogicA2_3__factory' | ||
import { ZKSyncAutomationRegistryLogicB2_3__factory as RegistryLogicB } from '../typechain/factories/ZKSyncAutomationRegistryLogicB2_3__factory' | ||
import { ZKSyncAutomationRegistryLogicC2_3__factory as RegistryLogicC } from '../typechain/factories/ZKSyncAutomationRegistryLogicC2_3__factory' | ||
import { utils } from 'ethers' | ||
import fs from 'fs' | ||
import { exec } from 'child_process' | ||
|
||
const dest = 'src/v0.8/automation/interfaces/zksync' | ||
const srcDest = `${dest}/IZKSyncAutomationRegistryMaster2_3.sol` | ||
const tmpDest = `${dest}/tmp.txt` | ||
|
||
const combinedABI = [] | ||
const abiSet = new Set() | ||
const abis = [ | ||
Registry.abi, | ||
RegistryLogicA.abi, | ||
RegistryLogicB.abi, | ||
RegistryLogicC.abi, | ||
] | ||
|
||
for (const abi of abis) { | ||
for (const entry of abi) { | ||
const id = utils.id(JSON.stringify(entry)) | ||
if (!abiSet.has(id)) { | ||
abiSet.add(id) | ||
if ( | ||
entry.type === 'function' && | ||
(entry.name === 'checkUpkeep' || | ||
entry.name === 'checkCallback' || | ||
entry.name === 'simulatePerformUpkeep') | ||
) { | ||
entry.stateMutability = 'view' // override stateMutability for check / callback / simulate functions | ||
} | ||
combinedABI.push(entry) | ||
} | ||
} | ||
} | ||
|
||
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} IZKSyncAutomationRegistryMaster2_3; | ||
echo "// solhint-disable \n// abi-checksum: ${checksum}" | cat - ${srcDest} > ${tmpDest} && mv ${tmpDest} ${srcDest}; | ||
pnpm prettier --write ${srcDest}; | ||
` | ||
|
||
exec(cmd) | ||
|
||
console.log( | ||
'generated new master interface for zksync automation registry v2_3', | ||
) |
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
8 changes: 8 additions & 0 deletions
8
contracts/src/v0.8/automation/interfaces/zksync/IGasBoundCaller.sol
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,8 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.19; | ||
|
||
address constant GAS_BOUND_CALLER = address(0xc706EC7dfA5D4Dc87f29f859094165E8290530f5); | ||
|
||
interface IGasBoundCaller { | ||
function gasBoundCall(address _to, uint256 _maxTotalGas, bytes calldata _data) external payable; | ||
} |
10 changes: 10 additions & 0 deletions
10
contracts/src/v0.8/automation/interfaces/zksync/ISystemContext.sol
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,10 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.19; | ||
|
||
ISystemContext constant SYSTEM_CONTEXT_CONTRACT = ISystemContext(address(0x800b)); | ||
|
||
interface ISystemContext { | ||
function gasPrice() external view returns (uint256); | ||
function gasPerPubdataByte() external view returns (uint256 gasPerPubdataByte); | ||
function getCurrentPubdataSpent() external view returns (uint256 currentPubdataSpent); | ||
} |
Oops, something went wrong.