@aztec/cli 4.0.0-nightly.20260116 → 4.0.0-nightly.20260118
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,11 +23,11 @@ export declare function generateL1Account(): {
|
|
|
23
23
|
privateKey: `0x${string}`;
|
|
24
24
|
address: `0x${string}`;
|
|
25
25
|
};
|
|
26
|
-
export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress,
|
|
26
|
+
export declare function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, withdrawerAddress, stakingAssetHandlerAddress, proofParams, blsSecretKey, log, debugLogger }: StakingAssetHandlerCommandArgs & LoggerArgs & {
|
|
27
27
|
blsSecretKey: bigint;
|
|
28
28
|
attesterAddress: EthAddress;
|
|
29
|
+
withdrawerAddress: EthAddress;
|
|
29
30
|
proofParams: Buffer;
|
|
30
|
-
merkleProof: string[];
|
|
31
31
|
}): Promise<void>;
|
|
32
32
|
export declare function addL1ValidatorViaRollup({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, withdrawerAddress, blsSecretKey, moveWithLatestRollup, rollupAddress, log, debugLogger }: RollupCommandArgs & LoggerArgs & {
|
|
33
33
|
blsSecretKey: bigint;
|
|
@@ -42,4 +42,4 @@ export declare function fastForwardEpochs({ rpcUrls, chainId, rollupAddress, num
|
|
|
42
42
|
numEpochs: bigint;
|
|
43
43
|
}): Promise<void>;
|
|
44
44
|
export declare function debugRollup({ rpcUrls, chainId, rollupAddress, log }: RollupCommandArgs & LoggerArgs): Promise<void>;
|
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBkYXRlX2wxX3ZhbGlkYXRvcnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbWRzL2wxL3VwZGF0ZV9sMV92YW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EVBQ1QsR0FBRyxFQUNILFdBQVcsRUFDWixFQUFFLGlCQUFpQixHQUFHLFVBQVUsR0FBRztJQUFFLFNBQVMsRUFBRSxNQUFNLENBQUE7Q0FBRSxpQkF5QnhEO0FBRUQsd0JBQXNCLFdBQVcsQ0FBQyxFQUFFLE9BQU8sRUFBRSxPQUFPLEVBQUUsYUFBYSxFQUFFLEdBQUcsRUFBRSxFQUFFLGlCQUFpQixHQUFHLFVBQVUsaUJBd0J6RyJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"update_l1_validators.d.ts","sourceRoot":"","sources":["../../../src/cmds/l1/update_l1_validators.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQ3D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,UAAU,CAAC;IAC1B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,EAAE,UAAU,CAAC;CACxC;AAED,MAAM,WAA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AE,SAAS,EAAE,MAAM,CAAA;CAAE,iBAyBxD;AAED,wBAAsB,WAAW,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,EAAE,iBAAiB,GAAG,UAAU,iBAwBzG"}
|
|
@@ -5,11 +5,10 @@ import { GSEContract, RollupContract } from '@aztec/ethereum/contracts';
|
|
|
5
5
|
import { createL1TxUtilsFromViemWallet } from '@aztec/ethereum/l1-tx-utils';
|
|
6
6
|
import { EthCheatCodes } from '@aztec/ethereum/test';
|
|
7
7
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
8
|
-
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
8
|
+
import { RollupAbi, StakingAssetHandlerAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
9
9
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
10
|
-
import { encodeFunctionData, formatEther, getContract } from 'viem';
|
|
10
|
+
import { encodeFunctionData, formatEther, getContract, maxUint256 } from 'viem';
|
|
11
11
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
12
|
-
import { addLeadingHex } from '../../utils/aztec.js';
|
|
13
12
|
export function generateL1Account() {
|
|
14
13
|
const privateKey = generatePrivateKey();
|
|
15
14
|
const account = privateKeyToAccount(privateKey);
|
|
@@ -19,7 +18,7 @@ export function generateL1Account() {
|
|
|
19
18
|
address: account.address
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress,
|
|
21
|
+
export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, attesterAddress, withdrawerAddress, stakingAssetHandlerAddress, proofParams, blsSecretKey, log, debugLogger }) {
|
|
23
22
|
const dualLog = makeDualLog(log, debugLogger);
|
|
24
23
|
const account = getAccount(privateKey, mnemonic);
|
|
25
24
|
const chain = createEthereumChain(rpcUrls, chainId);
|
|
@@ -43,24 +42,60 @@ export async function addL1Validator({ rpcUrls, chainId, privateKey, mnemonic, a
|
|
|
43
42
|
logger: debugLogger
|
|
44
43
|
});
|
|
45
44
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
// Step 1: Claim STK tokens from the faucet
|
|
46
|
+
dualLog(`Claiming STK tokens from faucet`);
|
|
47
|
+
const { receipt: claimReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
48
48
|
to: stakingAssetHandlerAddress.toString(),
|
|
49
49
|
data: encodeFunctionData({
|
|
50
50
|
abi: StakingAssetHandlerAbi,
|
|
51
|
-
functionName: '
|
|
51
|
+
functionName: 'claim',
|
|
52
|
+
args: [
|
|
53
|
+
proofParamsObj.toViem()
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
abi: StakingAssetHandlerAbi
|
|
57
|
+
});
|
|
58
|
+
dualLog(`Claim transaction hash: ${claimReceipt.transactionHash}`);
|
|
59
|
+
await l1Client.waitForTransactionReceipt({
|
|
60
|
+
hash: claimReceipt.transactionHash
|
|
61
|
+
});
|
|
62
|
+
// Step 2: Approve the rollup to spend STK tokens
|
|
63
|
+
const stakingAssetAddress = await stakingAssetHandler.read.STAKING_ASSET();
|
|
64
|
+
dualLog(`Approving rollup to spend STK tokens`);
|
|
65
|
+
const { receipt: approveReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
66
|
+
to: stakingAssetAddress,
|
|
67
|
+
data: encodeFunctionData({
|
|
68
|
+
abi: TestERC20Abi,
|
|
69
|
+
functionName: 'approve',
|
|
70
|
+
args: [
|
|
71
|
+
rollupAddress,
|
|
72
|
+
maxUint256
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
abi: TestERC20Abi
|
|
76
|
+
});
|
|
77
|
+
await l1Client.waitForTransactionReceipt({
|
|
78
|
+
hash: approveReceipt.transactionHash
|
|
79
|
+
});
|
|
80
|
+
// Step 3: Deposit into the rollup to register as a validator
|
|
81
|
+
dualLog(`Depositing into rollup to register validator`);
|
|
82
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
83
|
+
to: rollupAddress,
|
|
84
|
+
data: encodeFunctionData({
|
|
85
|
+
abi: RollupAbi,
|
|
86
|
+
functionName: 'deposit',
|
|
52
87
|
args: [
|
|
53
88
|
attesterAddress.toString(),
|
|
54
|
-
|
|
55
|
-
proofParamsObj.toViem(),
|
|
89
|
+
withdrawerAddress.toString(),
|
|
56
90
|
registrationTuple.publicKeyInG1,
|
|
57
91
|
registrationTuple.publicKeyInG2,
|
|
58
|
-
registrationTuple.proofOfPossession
|
|
92
|
+
registrationTuple.proofOfPossession,
|
|
93
|
+
false
|
|
59
94
|
]
|
|
60
95
|
}),
|
|
61
|
-
abi:
|
|
96
|
+
abi: RollupAbi
|
|
62
97
|
});
|
|
63
|
-
dualLog(`
|
|
98
|
+
dualLog(`Deposit transaction hash: ${receipt.transactionHash}`);
|
|
64
99
|
await l1Client.waitForTransactionReceipt({
|
|
65
100
|
hash: receipt.transactionHash
|
|
66
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/cli",
|
|
3
|
-
"version": "4.0.0-nightly.
|
|
3
|
+
"version": "4.0.0-nightly.20260118",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./contracts": "./dest/cmds/contracts/index.js",
|
|
@@ -77,23 +77,23 @@
|
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@aztec/accounts": "4.0.0-nightly.
|
|
81
|
-
"@aztec/archiver": "4.0.0-nightly.
|
|
82
|
-
"@aztec/aztec.js": "4.0.0-nightly.
|
|
83
|
-
"@aztec/constants": "4.0.0-nightly.
|
|
84
|
-
"@aztec/entrypoints": "4.0.0-nightly.
|
|
85
|
-
"@aztec/ethereum": "4.0.0-nightly.
|
|
86
|
-
"@aztec/foundation": "4.0.0-nightly.
|
|
87
|
-
"@aztec/l1-artifacts": "4.0.0-nightly.
|
|
88
|
-
"@aztec/node-keystore": "4.0.0-nightly.
|
|
89
|
-
"@aztec/node-lib": "4.0.0-nightly.
|
|
90
|
-
"@aztec/p2p": "4.0.0-nightly.
|
|
91
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
92
|
-
"@aztec/sequencer-client": "4.0.0-nightly.
|
|
93
|
-
"@aztec/slasher": "4.0.0-nightly.
|
|
94
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
95
|
-
"@aztec/test-wallet": "4.0.0-nightly.
|
|
96
|
-
"@aztec/world-state": "4.0.0-nightly.
|
|
80
|
+
"@aztec/accounts": "4.0.0-nightly.20260118",
|
|
81
|
+
"@aztec/archiver": "4.0.0-nightly.20260118",
|
|
82
|
+
"@aztec/aztec.js": "4.0.0-nightly.20260118",
|
|
83
|
+
"@aztec/constants": "4.0.0-nightly.20260118",
|
|
84
|
+
"@aztec/entrypoints": "4.0.0-nightly.20260118",
|
|
85
|
+
"@aztec/ethereum": "4.0.0-nightly.20260118",
|
|
86
|
+
"@aztec/foundation": "4.0.0-nightly.20260118",
|
|
87
|
+
"@aztec/l1-artifacts": "4.0.0-nightly.20260118",
|
|
88
|
+
"@aztec/node-keystore": "4.0.0-nightly.20260118",
|
|
89
|
+
"@aztec/node-lib": "4.0.0-nightly.20260118",
|
|
90
|
+
"@aztec/p2p": "4.0.0-nightly.20260118",
|
|
91
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260118",
|
|
92
|
+
"@aztec/sequencer-client": "4.0.0-nightly.20260118",
|
|
93
|
+
"@aztec/slasher": "4.0.0-nightly.20260118",
|
|
94
|
+
"@aztec/stdlib": "4.0.0-nightly.20260118",
|
|
95
|
+
"@aztec/test-wallet": "4.0.0-nightly.20260118",
|
|
96
|
+
"@aztec/world-state": "4.0.0-nightly.20260118",
|
|
97
97
|
"@ethersproject/wallet": "^5.8.0",
|
|
98
98
|
"@iarna/toml": "^2.2.5",
|
|
99
99
|
"@libp2p/peer-id-factory": "^3.0.4",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
108
108
|
},
|
|
109
109
|
"devDependencies": {
|
|
110
|
-
"@aztec/aztec-node": "4.0.0-nightly.
|
|
111
|
-
"@aztec/kv-store": "4.0.0-nightly.
|
|
112
|
-
"@aztec/telemetry-client": "4.0.0-nightly.
|
|
110
|
+
"@aztec/aztec-node": "4.0.0-nightly.20260118",
|
|
111
|
+
"@aztec/kv-store": "4.0.0-nightly.20260118",
|
|
112
|
+
"@aztec/telemetry-client": "4.0.0-nightly.20260118",
|
|
113
113
|
"@jest/globals": "^30.0.0",
|
|
114
114
|
"@types/jest": "^30.0.0",
|
|
115
115
|
"@types/lodash.chunk": "^4.2.9",
|
|
@@ -126,15 +126,15 @@
|
|
|
126
126
|
"typescript": "^5.3.3"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
|
-
"@aztec/accounts": "4.0.0-nightly.
|
|
130
|
-
"@aztec/bb-prover": "4.0.0-nightly.
|
|
131
|
-
"@aztec/ethereum": "4.0.0-nightly.
|
|
132
|
-
"@aztec/l1-artifacts": "4.0.0-nightly.
|
|
133
|
-
"@aztec/noir-contracts.js": "4.0.0-nightly.
|
|
134
|
-
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.
|
|
135
|
-
"@aztec/noir-test-contracts.js": "4.0.0-nightly.
|
|
136
|
-
"@aztec/protocol-contracts": "4.0.0-nightly.
|
|
137
|
-
"@aztec/stdlib": "4.0.0-nightly.
|
|
129
|
+
"@aztec/accounts": "4.0.0-nightly.20260118",
|
|
130
|
+
"@aztec/bb-prover": "4.0.0-nightly.20260118",
|
|
131
|
+
"@aztec/ethereum": "4.0.0-nightly.20260118",
|
|
132
|
+
"@aztec/l1-artifacts": "4.0.0-nightly.20260118",
|
|
133
|
+
"@aztec/noir-contracts.js": "4.0.0-nightly.20260118",
|
|
134
|
+
"@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260118",
|
|
135
|
+
"@aztec/noir-test-contracts.js": "4.0.0-nightly.20260118",
|
|
136
|
+
"@aztec/protocol-contracts": "4.0.0-nightly.20260118",
|
|
137
|
+
"@aztec/stdlib": "4.0.0-nightly.20260118"
|
|
138
138
|
},
|
|
139
139
|
"files": [
|
|
140
140
|
"dest",
|
|
@@ -7,14 +7,12 @@ import { EthCheatCodes } from '@aztec/ethereum/test';
|
|
|
7
7
|
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
8
|
import type { LogFn, Logger } from '@aztec/foundation/log';
|
|
9
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
10
|
-
import { RollupAbi, StakingAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
10
|
+
import { RollupAbi, StakingAssetHandlerAbi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
11
11
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
12
12
|
|
|
13
|
-
import { encodeFunctionData, formatEther, getContract } from 'viem';
|
|
13
|
+
import { encodeFunctionData, formatEther, getContract, maxUint256 } from 'viem';
|
|
14
14
|
import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
|
|
15
15
|
|
|
16
|
-
import { addLeadingHex } from '../../utils/aztec.js';
|
|
17
|
-
|
|
18
16
|
export interface RollupCommandArgs {
|
|
19
17
|
rpcUrls: string[];
|
|
20
18
|
chainId: number;
|
|
@@ -53,8 +51,8 @@ export async function addL1Validator({
|
|
|
53
51
|
privateKey,
|
|
54
52
|
mnemonic,
|
|
55
53
|
attesterAddress,
|
|
54
|
+
withdrawerAddress,
|
|
56
55
|
stakingAssetHandlerAddress,
|
|
57
|
-
merkleProof,
|
|
58
56
|
proofParams,
|
|
59
57
|
blsSecretKey,
|
|
60
58
|
log,
|
|
@@ -63,8 +61,8 @@ export async function addL1Validator({
|
|
|
63
61
|
LoggerArgs & {
|
|
64
62
|
blsSecretKey: bigint; // scalar field element of BN254
|
|
65
63
|
attesterAddress: EthAddress;
|
|
64
|
+
withdrawerAddress: EthAddress;
|
|
66
65
|
proofParams: Buffer;
|
|
67
|
-
merkleProof: string[];
|
|
68
66
|
}) {
|
|
69
67
|
const dualLog = makeDualLog(log, debugLogger);
|
|
70
68
|
const account = getAccount(privateKey, mnemonic);
|
|
@@ -87,33 +85,61 @@ export async function addL1Validator({
|
|
|
87
85
|
});
|
|
88
86
|
|
|
89
87
|
const gseAddress = await rollup.read.getGSE();
|
|
90
|
-
|
|
91
88
|
const gse = new GSEContract(l1Client, gseAddress);
|
|
92
|
-
|
|
93
89
|
const registrationTuple = await gse.makeRegistrationTuple(blsSecretKey);
|
|
94
90
|
|
|
95
91
|
const l1TxUtils = createL1TxUtilsFromViemWallet(l1Client, { logger: debugLogger });
|
|
96
92
|
const proofParamsObj = ZkPassportProofParams.fromBuffer(proofParams);
|
|
97
|
-
const merkleProofArray = merkleProof.map(proof => addLeadingHex(proof));
|
|
98
93
|
|
|
99
|
-
|
|
94
|
+
// Step 1: Claim STK tokens from the faucet
|
|
95
|
+
dualLog(`Claiming STK tokens from faucet`);
|
|
96
|
+
const { receipt: claimReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
100
97
|
to: stakingAssetHandlerAddress.toString(),
|
|
101
98
|
data: encodeFunctionData({
|
|
102
99
|
abi: StakingAssetHandlerAbi,
|
|
103
|
-
functionName: '
|
|
100
|
+
functionName: 'claim',
|
|
101
|
+
args: [proofParamsObj.toViem()],
|
|
102
|
+
}),
|
|
103
|
+
abi: StakingAssetHandlerAbi,
|
|
104
|
+
});
|
|
105
|
+
dualLog(`Claim transaction hash: ${claimReceipt.transactionHash}`);
|
|
106
|
+
await l1Client.waitForTransactionReceipt({ hash: claimReceipt.transactionHash });
|
|
107
|
+
|
|
108
|
+
// Step 2: Approve the rollup to spend STK tokens
|
|
109
|
+
const stakingAssetAddress = await stakingAssetHandler.read.STAKING_ASSET();
|
|
110
|
+
dualLog(`Approving rollup to spend STK tokens`);
|
|
111
|
+
const { receipt: approveReceipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
112
|
+
to: stakingAssetAddress,
|
|
113
|
+
data: encodeFunctionData({
|
|
114
|
+
abi: TestERC20Abi,
|
|
115
|
+
functionName: 'approve',
|
|
116
|
+
args: [rollupAddress, maxUint256],
|
|
117
|
+
}),
|
|
118
|
+
abi: TestERC20Abi,
|
|
119
|
+
});
|
|
120
|
+
await l1Client.waitForTransactionReceipt({ hash: approveReceipt.transactionHash });
|
|
121
|
+
|
|
122
|
+
// Step 3: Deposit into the rollup to register as a validator
|
|
123
|
+
dualLog(`Depositing into rollup to register validator`);
|
|
124
|
+
const { receipt } = await l1TxUtils.sendAndMonitorTransaction({
|
|
125
|
+
to: rollupAddress,
|
|
126
|
+
data: encodeFunctionData({
|
|
127
|
+
abi: RollupAbi,
|
|
128
|
+
functionName: 'deposit',
|
|
104
129
|
args: [
|
|
105
130
|
attesterAddress.toString(),
|
|
106
|
-
|
|
107
|
-
proofParamsObj.toViem(),
|
|
131
|
+
withdrawerAddress.toString(),
|
|
108
132
|
registrationTuple.publicKeyInG1,
|
|
109
133
|
registrationTuple.publicKeyInG2,
|
|
110
134
|
registrationTuple.proofOfPossession,
|
|
135
|
+
false, // moveWithLatestRollup
|
|
111
136
|
],
|
|
112
137
|
}),
|
|
113
|
-
abi:
|
|
138
|
+
abi: RollupAbi,
|
|
114
139
|
});
|
|
115
|
-
dualLog(`
|
|
140
|
+
dualLog(`Deposit transaction hash: ${receipt.transactionHash}`);
|
|
116
141
|
await l1Client.waitForTransactionReceipt({ hash: receipt.transactionHash });
|
|
142
|
+
|
|
117
143
|
if (isAnvilTestChain(chainId)) {
|
|
118
144
|
dualLog(`Funding validator on L1`);
|
|
119
145
|
const cheatCodes = new EthCheatCodes(rpcUrls, new DateProvider(), debugLogger);
|