@aztec/ethereum 3.0.0-nightly.20250930 → 3.0.0-nightly.20251002
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.
- package/dest/config.js +2 -2
- package/dest/contracts/fee_asset_handler.d.ts +2 -2
- package/dest/contracts/governance_proposer.d.ts +1 -2
- package/dest/contracts/governance_proposer.d.ts.map +1 -1
- package/dest/contracts/governance_proposer.js +1 -2
- package/dest/contracts/multicall.d.ts +0 -2
- package/dest/contracts/multicall.d.ts.map +1 -1
- package/dest/contracts/multicall.js +2 -4
- package/dest/contracts/rollup.d.ts +2 -2
- package/dest/deploy_l1_contracts.d.ts +11 -1
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +174 -54
- package/dest/l1_artifacts.d.ts +1978 -0
- package/dest/l1_artifacts.d.ts.map +1 -1
- package/dest/l1_artifacts.js +6 -1
- package/dest/l1_contract_addresses.d.ts +5 -1
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +2 -1
- package/dest/l1_tx_utils/factory.d.ts.map +1 -1
- package/dest/l1_tx_utils/factory.js +2 -2
- package/dest/l1_tx_utils/l1_tx_utils.d.ts +14 -26
- package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils.js +140 -136
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +4 -11
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -1
- package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +10 -70
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +1 -1
- package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils/types.d.ts +15 -2
- package/dest/l1_tx_utils/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/config.ts +2 -2
- package/src/contracts/governance_proposer.ts +3 -4
- package/src/contracts/multicall.ts +4 -4
- package/src/deploy_l1_contracts.ts +161 -51
- package/src/l1_artifacts.ts +8 -0
- package/src/l1_contract_addresses.ts +3 -1
- package/src/l1_tx_utils/factory.ts +2 -2
- package/src/l1_tx_utils/l1_tx_utils.ts +159 -157
- package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +8 -99
- package/src/l1_tx_utils/readonly_l1_tx_utils.ts +1 -1
- package/src/l1_tx_utils/types.ts +16 -2
package/dest/config.js
CHANGED
|
@@ -146,8 +146,8 @@ const TestnetEntryQueueConfig = {
|
|
|
146
146
|
maxQueueFlushSize: 32n
|
|
147
147
|
};
|
|
148
148
|
const StagingIgnitionEntryQueueConfig = {
|
|
149
|
-
bootstrapValidatorSetSize:
|
|
150
|
-
bootstrapFlushSize:
|
|
149
|
+
bootstrapValidatorSetSize: 48n,
|
|
150
|
+
bootstrapFlushSize: 48n,
|
|
151
151
|
normalFlushSizeMin: 1n,
|
|
152
152
|
normalFlushSizeQuotient: 2048n,
|
|
153
153
|
maxQueueFlushSize: 24n
|
|
@@ -9,11 +9,11 @@ export declare class FeeAssetHandlerContract {
|
|
|
9
9
|
getMintAmount(): Promise<bigint>;
|
|
10
10
|
mint(recipient: Hex | EthAddress): Promise<{
|
|
11
11
|
receipt: import("viem").TransactionReceipt;
|
|
12
|
-
|
|
12
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
13
13
|
}>;
|
|
14
14
|
setMintAmount(amount: bigint): Promise<{
|
|
15
15
|
receipt: import("viem").TransactionReceipt;
|
|
16
|
-
|
|
16
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
17
17
|
}>;
|
|
18
18
|
}
|
|
19
19
|
//# sourceMappingURL=fee_asset_handler.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
2
|
import { type Hex, type TransactionReceipt, type TypedDataDefinition } from 'viem';
|
|
3
|
-
import type {
|
|
3
|
+
import type { L1TxRequest, L1TxUtils } from '../l1_tx_utils/index.js';
|
|
4
4
|
import type { ViemClient } from '../types.js';
|
|
5
5
|
import { type IEmpireBase } from './empire_base.js';
|
|
6
6
|
export declare class GovernanceProposerContract implements IEmpireBase {
|
|
@@ -24,7 +24,6 @@ export declare class GovernanceProposerContract implements IEmpireBase {
|
|
|
24
24
|
createSignalRequestWithSignature(payload: Hex, slot: bigint, chainId: number, signerAddress: Hex, signer: (msg: TypedDataDefinition) => Promise<Hex>): Promise<L1TxRequest>;
|
|
25
25
|
submitRoundWinner(round: bigint, l1TxUtils: L1TxUtils): Promise<{
|
|
26
26
|
receipt: TransactionReceipt;
|
|
27
|
-
gasPrice: GasPrice;
|
|
28
27
|
proposalId: bigint;
|
|
29
28
|
}>;
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"governance_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/governance_proposer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"governance_proposer.d.ts","sourceRoot":"","sources":["../../src/contracts/governance_proposer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAA8D,MAAM,kBAAkB,CAAC;AAGhH,qBAAa,0BAA2B,YAAW,WAAW;aAI1C,MAA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await l1TxUtils.sendAndMonitorTransaction({
|
|
78
78
|
to: this.address.toString(),
|
|
79
79
|
data: encodeFunctionData({
|
|
80
80
|
abi: this.proposer.abi,
|
|
@@ -87,7 +87,6 @@ export class GovernanceProposerContract {
|
|
|
87
87
|
const proposalId = extractProposalIdFromLogs(receipt.logs);
|
|
88
88
|
return {
|
|
89
89
|
receipt,
|
|
90
|
-
gasPrice,
|
|
91
90
|
proposalId
|
|
92
91
|
};
|
|
93
92
|
}
|
|
@@ -9,12 +9,10 @@ export declare class Multicall3 {
|
|
|
9
9
|
revertOnFailure?: boolean;
|
|
10
10
|
}): Promise<FormattedViemError | {
|
|
11
11
|
receipt: import("viem").TransactionReceipt;
|
|
12
|
-
gasPrice: import("../l1_tx_utils/types.js").GasPrice;
|
|
13
12
|
stats: import("../l1_tx_utils/types.js").TransactionStats | undefined;
|
|
14
13
|
errorMsg?: undefined;
|
|
15
14
|
} | {
|
|
16
15
|
receipt: import("viem").TransactionReceipt;
|
|
17
|
-
gasPrice: import("../l1_tx_utils/types.js").GasPrice;
|
|
18
16
|
errorMsg: string | undefined;
|
|
19
17
|
stats?: undefined;
|
|
20
18
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../src/contracts/multicall.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAqC,KAAK,GAAG,EAAqC,MAAM,MAAM,CAAC;AAEtG,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,oBAAoB,EAAG,4CAAqD,CAAC;AAE1F,qBAAa,UAAU;WACR,OAAO,CAClB,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,WAAW,GAAG,SAAS,EAClC,UAAU,EAAE,YAAY,GAAG,SAAS,EACpC,aAAa,EAAE,GAAG,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAO
|
|
1
|
+
{"version":3,"file":"multicall.d.ts","sourceRoot":"","sources":["../../src/contracts/multicall.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAqC,KAAK,GAAG,EAAqC,MAAM,MAAM,CAAC;AAEtG,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAmB,MAAM,aAAa,CAAC;AAGlE,eAAO,MAAM,oBAAoB,EAAG,4CAAqD,CAAC;AAE1F,qBAAa,UAAU;WACR,OAAO,CAClB,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,WAAW,GAAG,SAAS,EAClC,UAAU,EAAE,YAAY,GAAG,SAAS,EACpC,aAAa,EAAE,GAAG,EAClB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAA;KAAO;;;;;;;;;CAuG3C;AAED,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,MAAM,iBA+BxF"}
|
|
@@ -21,7 +21,7 @@ export class Multicall3 {
|
|
|
21
21
|
};
|
|
22
22
|
const encodedForwarderData = encodeFunctionData(forwarderFunctionData);
|
|
23
23
|
try {
|
|
24
|
-
const { receipt,
|
|
24
|
+
const { receipt, state } = await l1TxUtils.sendAndMonitorTransaction({
|
|
25
25
|
to: MULTI_CALL_3_ADDRESS,
|
|
26
26
|
data: encodedForwarderData
|
|
27
27
|
}, gasConfig, blobConfig);
|
|
@@ -29,7 +29,6 @@ export class Multicall3 {
|
|
|
29
29
|
const stats = await l1TxUtils.getTransactionStats(receipt.transactionHash);
|
|
30
30
|
return {
|
|
31
31
|
receipt,
|
|
32
|
-
gasPrice,
|
|
33
32
|
stats
|
|
34
33
|
};
|
|
35
34
|
} else {
|
|
@@ -42,7 +41,7 @@ export class Multicall3 {
|
|
|
42
41
|
};
|
|
43
42
|
let errorMsg;
|
|
44
43
|
if (blobConfig) {
|
|
45
|
-
const maxFeePerBlobGas = blobConfig.maxFeePerBlobGas ?? gasPrice.maxFeePerBlobGas;
|
|
44
|
+
const maxFeePerBlobGas = blobConfig.maxFeePerBlobGas ?? state.gasPrice.maxFeePerBlobGas;
|
|
46
45
|
if (maxFeePerBlobGas === undefined) {
|
|
47
46
|
errorMsg = 'maxFeePerBlobGas is required to get the error message';
|
|
48
47
|
} else {
|
|
@@ -69,7 +68,6 @@ export class Multicall3 {
|
|
|
69
68
|
}
|
|
70
69
|
return {
|
|
71
70
|
receipt,
|
|
72
|
-
gasPrice,
|
|
73
71
|
errorMsg
|
|
74
72
|
};
|
|
75
73
|
}
|
|
@@ -240,11 +240,11 @@ export declare class RollupContract {
|
|
|
240
240
|
}>;
|
|
241
241
|
setupEpoch(l1TxUtils: L1TxUtils): Promise<{
|
|
242
242
|
receipt: import("viem").TransactionReceipt;
|
|
243
|
-
|
|
243
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
244
244
|
}>;
|
|
245
245
|
vote(l1TxUtils: L1TxUtils, proposalId: bigint): Promise<{
|
|
246
246
|
receipt: import("viem").TransactionReceipt;
|
|
247
|
-
|
|
247
|
+
state: import("../l1_tx_utils/types.js").L1TxState;
|
|
248
248
|
}>;
|
|
249
249
|
listenToSlasherChanged(callback: (args: {
|
|
250
250
|
oldSlasher: `0x${string}`;
|
|
@@ -92,6 +92,8 @@ export interface DeployL1ContractsArgs extends Omit<L1ContractsConfig, keyof L1T
|
|
|
92
92
|
realVerifier: boolean;
|
|
93
93
|
/** The zk passport args */
|
|
94
94
|
zkPassportArgs?: ZKPassportArgs;
|
|
95
|
+
/** If provided, use this token for BOTH fee and staking assets (skip deployments) */
|
|
96
|
+
existingTokenAddress?: EthAddress;
|
|
95
97
|
}
|
|
96
98
|
export interface ZKPassportArgs {
|
|
97
99
|
/** Whether to use the mock zk passport verifier */
|
|
@@ -101,6 +103,12 @@ export interface ZKPassportArgs {
|
|
|
101
103
|
/** The scope of the zk passport (personhood, etc) */
|
|
102
104
|
zkPassportScope?: string;
|
|
103
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Validates that the provided address points to a contract that resembles an ERC20 token.
|
|
108
|
+
* Checks for contract code and attempts common ERC20 view calls.
|
|
109
|
+
* Throws an error if validation fails.
|
|
110
|
+
*/
|
|
111
|
+
export declare function validateExistingErc20TokenAddress(l1Client: ExtendedViemWalletClient, tokenAddress: EthAddress, logger: Logger): Promise<void>;
|
|
104
112
|
export declare const deploySharedContracts: (l1Client: ExtendedViemWalletClient, deployer: L1Deployer, args: DeployL1ContractsArgs, logger: Logger) => Promise<{
|
|
105
113
|
feeAssetAddress: EthAddress;
|
|
106
114
|
feeAssetHandlerAddress: EthAddress | undefined;
|
|
@@ -135,7 +143,9 @@ export declare const deployRollup: (extendedClient: ExtendedViemWalletClient, de
|
|
|
135
143
|
rollup: RollupContract;
|
|
136
144
|
slashFactoryAddress: EthAddress;
|
|
137
145
|
}>;
|
|
138
|
-
export declare const handoverToGovernance: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, registryAddress: EthAddress, gseAddress: EthAddress, coinIssuerAddress: EthAddress, feeAssetAddress: EthAddress, governanceAddress: EthAddress, logger: Logger, acceleratedTestDeployments: boolean | undefined) => Promise<
|
|
146
|
+
export declare const handoverToGovernance: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, registryAddress: EthAddress, gseAddress: EthAddress, coinIssuerAddress: EthAddress, feeAssetAddress: EthAddress, governanceAddress: EthAddress, logger: Logger, acceleratedTestDeployments: boolean | undefined, useExternalToken?: boolean) => Promise<{
|
|
147
|
+
dateGatedRelayerAddress: EthAddress;
|
|
148
|
+
}>;
|
|
139
149
|
export declare const addMultipleValidators: (extendedClient: ExtendedViemWalletClient, deployer: L1Deployer, gseAddress: Hex, rollupAddress: Hex, stakingAssetAddress: Hex, validators: Operator[], acceleratedTestDeployments: boolean | undefined, logger: Logger) => Promise<void>;
|
|
140
150
|
/**
|
|
141
151
|
* Initialize the fee asset handler and make it a minter on the fee asset.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../src/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EACL,KAAK,KAAK,EACV,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,iBAAiB,EAUvB,MAAM,MAAM,CAAC;AAKd,OAAO,EACL,KAAK,iBAAiB,EAMvB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,cAAc,EAAwB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"deploy_l1_contracts.d.ts","sourceRoot":"","sources":["../src/deploy_l1_contracts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,C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SAAS,OAAO,EAAE,CAAC,EACrC,QAAQ,EAAE,GAAG,EACb,IAAI,GAAE,SAAS,OAAO,EAAO,EAC7B,IAAI,GAAE;IACJ,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACjC,GACL,OAAO,CAAC;IACT,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,GAAG,GAAG,SAAS,CAAC;IACxB,iBAAiB,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAC/C,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC,CAkJD;AAED,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,CAAC,GAAG,GAAG,SAAS,OAAO,EAAE,CAAC,EACrC,QAAQ,EAAE,GAAG,EACb,IAAI,EAAE,SAAS,OAAO,EAAE,EACxB,IAAI,EAAE,GAAG;;;;EAeV"}
|
|
@@ -16,27 +16,121 @@ import { GSEContract } from './contracts/gse.js';
|
|
|
16
16
|
import { deployMulticall3 } from './contracts/multicall.js';
|
|
17
17
|
import { RegistryContract } from './contracts/registry.js';
|
|
18
18
|
import { RollupContract, SlashingProposerType } from './contracts/rollup.js';
|
|
19
|
-
import { CoinIssuerArtifact, FeeAssetArtifact, FeeAssetHandlerArtifact, GSEArtifact, GovernanceArtifact, GovernanceProposerArtifact, MultiAdderArtifact, RegisterNewRollupVersionPayloadArtifact, RegistryArtifact, RollupArtifact, SlashFactoryArtifact, StakingAssetArtifact, StakingAssetHandlerArtifact, l1ArtifactsVerifiers, mockVerifiers } from './l1_artifacts.js';
|
|
19
|
+
import { CoinIssuerArtifact, DateGatedRelayerArtifact, FeeAssetArtifact, FeeAssetHandlerArtifact, GSEArtifact, GovernanceArtifact, GovernanceProposerArtifact, MultiAdderArtifact, RegisterNewRollupVersionPayloadArtifact, RegistryArtifact, RollupArtifact, SlashFactoryArtifact, StakingAssetArtifact, StakingAssetHandlerArtifact, l1ArtifactsVerifiers, mockVerifiers } from './l1_artifacts.js';
|
|
20
20
|
import { createL1TxUtilsFromViemWallet, getL1TxUtilsConfigEnvVars } from './l1_tx_utils/index.js';
|
|
21
21
|
import { formatViemError } from './utils.js';
|
|
22
22
|
import { ZK_PASSPORT_DOMAIN, ZK_PASSPORT_SCOPE, ZK_PASSPORT_VERIFIER_ADDRESS } from './zkPassportVerifierAddress.js';
|
|
23
23
|
export const DEPLOYER_ADDRESS = '0x4e59b44847b379578588920cA78FbF26c0B4956C';
|
|
24
|
+
// Minimal ERC20 ABI for validation purposes. We only read view methods.
|
|
25
|
+
const ERC20_VALIDATION_ABI = [
|
|
26
|
+
{
|
|
27
|
+
type: 'function',
|
|
28
|
+
name: 'totalSupply',
|
|
29
|
+
stateMutability: 'view',
|
|
30
|
+
inputs: [],
|
|
31
|
+
outputs: [
|
|
32
|
+
{
|
|
33
|
+
name: '',
|
|
34
|
+
type: 'uint256'
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'function',
|
|
40
|
+
name: 'name',
|
|
41
|
+
stateMutability: 'view',
|
|
42
|
+
inputs: [],
|
|
43
|
+
outputs: [
|
|
44
|
+
{
|
|
45
|
+
name: '',
|
|
46
|
+
type: 'string'
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'function',
|
|
52
|
+
name: 'symbol',
|
|
53
|
+
stateMutability: 'view',
|
|
54
|
+
inputs: [],
|
|
55
|
+
outputs: [
|
|
56
|
+
{
|
|
57
|
+
name: '',
|
|
58
|
+
type: 'string'
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
type: 'function',
|
|
64
|
+
name: 'decimals',
|
|
65
|
+
stateMutability: 'view',
|
|
66
|
+
inputs: [],
|
|
67
|
+
outputs: [
|
|
68
|
+
{
|
|
69
|
+
name: '',
|
|
70
|
+
type: 'uint8'
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* Validates that the provided address points to a contract that resembles an ERC20 token.
|
|
77
|
+
* Checks for contract code and attempts common ERC20 view calls.
|
|
78
|
+
* Throws an error if validation fails.
|
|
79
|
+
*/ export async function validateExistingErc20TokenAddress(l1Client, tokenAddress, logger) {
|
|
80
|
+
const addressString = tokenAddress.toString();
|
|
81
|
+
// Ensure there is contract code at the address
|
|
82
|
+
const code = await l1Client.getCode({
|
|
83
|
+
address: addressString
|
|
84
|
+
});
|
|
85
|
+
if (!code || code === '0x') {
|
|
86
|
+
throw new Error(`No contract code found at provided token address ${addressString}`);
|
|
87
|
+
}
|
|
88
|
+
const contract = getContract({
|
|
89
|
+
address: getAddress(addressString),
|
|
90
|
+
abi: ERC20_VALIDATION_ABI,
|
|
91
|
+
client: l1Client
|
|
92
|
+
});
|
|
93
|
+
// Validate all required ERC20 methods in parallel
|
|
94
|
+
const checks = [
|
|
95
|
+
contract.read.totalSupply().then((total)=>typeof total === 'bigint'),
|
|
96
|
+
contract.read.name().then(()=>true),
|
|
97
|
+
contract.read.symbol().then(()=>true),
|
|
98
|
+
contract.read.decimals().then((dec)=>typeof dec === 'number' || typeof dec === 'bigint')
|
|
99
|
+
];
|
|
100
|
+
const results = await Promise.allSettled(checks);
|
|
101
|
+
const failedChecks = results.filter((result)=>result.status === 'rejected' || result.value !== true);
|
|
102
|
+
if (failedChecks.length > 0) {
|
|
103
|
+
throw new Error(`Address ${addressString} does not appear to implement ERC20 view methods`);
|
|
104
|
+
}
|
|
105
|
+
logger.verbose(`Validated existing token at ${addressString} appears to be ERC20-compatible`);
|
|
106
|
+
}
|
|
24
107
|
export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
25
108
|
const networkName = getActiveNetworkName();
|
|
26
109
|
logger.info(`Deploying shared contracts for network configuration: ${networkName}`);
|
|
27
110
|
const txHashes = [];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
l1Client.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
111
|
+
let feeAssetAddress;
|
|
112
|
+
let stakingAssetAddress;
|
|
113
|
+
if (args.existingTokenAddress) {
|
|
114
|
+
await validateExistingErc20TokenAddress(l1Client, args.existingTokenAddress, logger);
|
|
115
|
+
feeAssetAddress = args.existingTokenAddress;
|
|
116
|
+
stakingAssetAddress = args.existingTokenAddress;
|
|
117
|
+
logger.verbose(`Using existing token for fee and staking assets at ${args.existingTokenAddress}`);
|
|
118
|
+
} else {
|
|
119
|
+
const deployedFee = await deployer.deploy(FeeAssetArtifact, [
|
|
120
|
+
'FeeJuice',
|
|
121
|
+
'FEE',
|
|
122
|
+
l1Client.account.address
|
|
123
|
+
]);
|
|
124
|
+
feeAssetAddress = deployedFee.address;
|
|
125
|
+
logger.verbose(`Deployed Fee Asset at ${feeAssetAddress}`);
|
|
126
|
+
const deployedStaking = await deployer.deploy(StakingAssetArtifact, [
|
|
127
|
+
'Staking',
|
|
128
|
+
'STK',
|
|
129
|
+
l1Client.account.address
|
|
130
|
+
]);
|
|
131
|
+
stakingAssetAddress = deployedStaking.address;
|
|
132
|
+
logger.verbose(`Deployed Staking Asset at ${stakingAssetAddress}`);
|
|
133
|
+
}
|
|
40
134
|
const gseAddress = (await deployer.deploy(GSEArtifact, [
|
|
41
135
|
l1Client.account.address,
|
|
42
136
|
stakingAssetAddress.toString(),
|
|
@@ -110,8 +204,8 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
110
204
|
let feeAssetHandlerAddress = undefined;
|
|
111
205
|
let stakingAssetHandlerAddress = undefined;
|
|
112
206
|
let zkPassportVerifierAddress = undefined;
|
|
113
|
-
// Only if not on mainnet will we deploy the handlers
|
|
114
|
-
if (l1Client.chain.id !== 1) {
|
|
207
|
+
// Only if not on mainnet will we deploy the handlers, and only when we control the token
|
|
208
|
+
if (l1Client.chain.id !== 1 && !args.existingTokenAddress) {
|
|
115
209
|
/* -------------------------------------------------------------------------- */ /* CHEAT CODES START HERE */ /* -------------------------------------------------------------------------- */ feeAssetHandlerAddress = (await deployer.deploy(FeeAssetHandlerArtifact, [
|
|
116
210
|
l1Client.account.address,
|
|
117
211
|
feeAssetAddress.toString(),
|
|
@@ -188,20 +282,24 @@ export const deploySharedContracts = async (l1Client, deployer, args, logger)=>{
|
|
|
188
282
|
logger.verbose(`Deployed shared contracts`);
|
|
189
283
|
const registry = new RegistryContract(l1Client, registryAddress);
|
|
190
284
|
/* -------------------------------------------------------------------------- */ /* FUND REWARD DISTRIBUTOR START */ /* -------------------------------------------------------------------------- */ const rewardDistributorAddress = await registry.getRewardDistributor();
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
285
|
+
if (!args.existingTokenAddress) {
|
|
286
|
+
const blockReward = getRewardConfig(networkName).blockReward;
|
|
287
|
+
const funding = blockReward * 200000n;
|
|
288
|
+
const { txHash: fundRewardDistributorTxHash } = await deployer.sendTransaction({
|
|
289
|
+
to: feeAssetAddress.toString(),
|
|
290
|
+
data: encodeFunctionData({
|
|
291
|
+
abi: FeeAssetArtifact.contractAbi,
|
|
292
|
+
functionName: 'mint',
|
|
293
|
+
args: [
|
|
294
|
+
rewardDistributorAddress.toString(),
|
|
295
|
+
funding
|
|
296
|
+
]
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
logger.verbose(`Funded reward distributor with ${funding} fee asset in ${fundRewardDistributorTxHash}`);
|
|
300
|
+
} else {
|
|
301
|
+
logger.verbose(`Skipping reward distributor funding as existing token is provided`);
|
|
302
|
+
}
|
|
205
303
|
/* -------------------------------------------------------------------------- */ /* FUND REWARD DISTRIBUTOR STOP */ /* -------------------------------------------------------------------------- */ return {
|
|
206
304
|
feeAssetAddress,
|
|
207
305
|
feeAssetHandlerAddress,
|
|
@@ -358,21 +456,26 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
358
456
|
await deployer.waitForDeployments();
|
|
359
457
|
logger.verbose(`All core contracts have been deployed`);
|
|
360
458
|
if (args.feeJuicePortalInitialBalance && args.feeJuicePortalInitialBalance > 0n) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
to
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
args
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
459
|
+
// Skip funding when using an external token, as we likely don't have mint permissions
|
|
460
|
+
if (!('existingTokenAddress' in args) || !args.existingTokenAddress) {
|
|
461
|
+
const feeJuicePortalAddress = await rollupContract.getFeeJuicePortal();
|
|
462
|
+
// In fast mode, use the L1TxUtils to send transactions with nonce management
|
|
463
|
+
const { txHash: mintTxHash } = await deployer.sendTransaction({
|
|
464
|
+
to: addresses.feeJuiceAddress.toString(),
|
|
465
|
+
data: encodeFunctionData({
|
|
466
|
+
abi: FeeAssetArtifact.contractAbi,
|
|
467
|
+
functionName: 'mint',
|
|
468
|
+
args: [
|
|
469
|
+
feeJuicePortalAddress.toString(),
|
|
470
|
+
args.feeJuicePortalInitialBalance
|
|
471
|
+
]
|
|
472
|
+
})
|
|
473
|
+
});
|
|
474
|
+
logger.verbose(`Funding fee juice portal with ${args.feeJuicePortalInitialBalance} fee juice in ${mintTxHash} (accelerated test deployments)`);
|
|
475
|
+
txHashes.push(mintTxHash);
|
|
476
|
+
} else {
|
|
477
|
+
logger.verbose('Skipping fee juice portal funding due to external token usage');
|
|
478
|
+
}
|
|
376
479
|
}
|
|
377
480
|
const slashFactoryAddress = (await deployer.deploy(SlashFactoryArtifact, [
|
|
378
481
|
rollupAddress.toString()
|
|
@@ -476,7 +579,7 @@ function slasherFlavorToSolidityEnum(flavor) {
|
|
|
476
579
|
slashFactoryAddress
|
|
477
580
|
};
|
|
478
581
|
};
|
|
479
|
-
export const handoverToGovernance = async (extendedClient, deployer, registryAddress, gseAddress, coinIssuerAddress, feeAssetAddress, governanceAddress, logger, acceleratedTestDeployments)=>{
|
|
582
|
+
export const handoverToGovernance = async (extendedClient, deployer, registryAddress, gseAddress, coinIssuerAddress, feeAssetAddress, governanceAddress, logger, acceleratedTestDeployments, useExternalToken = false)=>{
|
|
480
583
|
// We need to call a function on the registry to set the various contract addresses.
|
|
481
584
|
const registryContract = getContract({
|
|
482
585
|
address: getAddress(registryAddress.toString()),
|
|
@@ -531,7 +634,7 @@ export const handoverToGovernance = async (extendedClient, deployer, registryAdd
|
|
|
531
634
|
logger.verbose(`Transferring the ownership of the gse contract at ${gseAddress} to the Governance ${governanceAddress} in tx ${transferOwnershipTxHash}`);
|
|
532
635
|
txHashes.push(transferOwnershipTxHash);
|
|
533
636
|
}
|
|
534
|
-
if (acceleratedTestDeployments || await feeAsset.read.owner() !== coinIssuerAddress.toString()) {
|
|
637
|
+
if (!useExternalToken && (acceleratedTestDeployments || await feeAsset.read.owner() !== coinIssuerAddress.toString())) {
|
|
535
638
|
const { txHash } = await deployer.sendTransaction({
|
|
536
639
|
to: feeAssetAddress.toString(),
|
|
537
640
|
data: encodeFunctionData({
|
|
@@ -557,20 +660,27 @@ export const handoverToGovernance = async (extendedClient, deployer, registryAdd
|
|
|
557
660
|
});
|
|
558
661
|
logger.verbose(`Accept ownership of fee asset in ${acceptTokenOwnershipTxHash}`);
|
|
559
662
|
txHashes.push(acceptTokenOwnershipTxHash);
|
|
663
|
+
} else if (useExternalToken) {
|
|
664
|
+
logger.verbose('Skipping fee asset ownership transfer due to external token usage');
|
|
560
665
|
}
|
|
666
|
+
// Either deploy or at least predict the address of the date gated relayer
|
|
667
|
+
const dateGatedRelayer = await deployer.deploy(DateGatedRelayerArtifact, [
|
|
668
|
+
governanceAddress.toString(),
|
|
669
|
+
1798761600n
|
|
670
|
+
]);
|
|
561
671
|
// If the owner is not the Governance contract, transfer ownership to the Governance contract
|
|
562
|
-
if (acceleratedTestDeployments || await coinIssuerContract.read.owner()
|
|
672
|
+
if (acceleratedTestDeployments || await coinIssuerContract.read.owner() === deployer.client.account.address) {
|
|
563
673
|
const { txHash: transferOwnershipTxHash } = await deployer.sendTransaction({
|
|
564
674
|
to: coinIssuerContract.address,
|
|
565
675
|
data: encodeFunctionData({
|
|
566
676
|
abi: CoinIssuerArtifact.contractAbi,
|
|
567
677
|
functionName: 'transferOwnership',
|
|
568
678
|
args: [
|
|
569
|
-
getAddress(
|
|
679
|
+
getAddress(dateGatedRelayer.address.toString())
|
|
570
680
|
]
|
|
571
681
|
})
|
|
572
682
|
});
|
|
573
|
-
logger.verbose(`Transferring the ownership of the coin issuer contract at ${coinIssuerAddress} to the
|
|
683
|
+
logger.verbose(`Transferring the ownership of the coin issuer contract at ${coinIssuerAddress} to the DateGatedRelayer ${dateGatedRelayer.address} in tx ${transferOwnershipTxHash}`);
|
|
574
684
|
txHashes.push(transferOwnershipTxHash);
|
|
575
685
|
}
|
|
576
686
|
// Wait for all actions to be mined
|
|
@@ -578,6 +688,9 @@ export const handoverToGovernance = async (extendedClient, deployer, registryAdd
|
|
|
578
688
|
await Promise.all(txHashes.map((txHash)=>extendedClient.waitForTransactionReceipt({
|
|
579
689
|
hash: txHash
|
|
580
690
|
})));
|
|
691
|
+
return {
|
|
692
|
+
dateGatedRelayerAddress: dateGatedRelayer.address
|
|
693
|
+
};
|
|
581
694
|
};
|
|
582
695
|
/*
|
|
583
696
|
* Adds multiple validators to the rollup
|
|
@@ -738,6 +851,9 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
738
851
|
*/ export const deployL1Contracts = async (rpcUrls, account, chain, logger, args, txUtilsConfig = getL1TxUtilsConfigEnvVars(), createVerificationJson = false)=>{
|
|
739
852
|
logger.info(`Deploying L1 contracts with config: ${jsonStringify(args)}`);
|
|
740
853
|
validateConfig(args);
|
|
854
|
+
if (args.initialValidators && args.initialValidators.length > 0 && args.existingTokenAddress) {
|
|
855
|
+
throw new Error('Cannot deploy with both initialValidators and existingTokenAddress. ' + 'Initial validator funding requires minting tokens, which is not possible with an external token.');
|
|
856
|
+
}
|
|
741
857
|
const l1Client = createExtendedL1Client(rpcUrls, account, chain);
|
|
742
858
|
// Deploy multicall3 if it does not exist in this network
|
|
743
859
|
await deployMulticall3(l1Client, logger);
|
|
@@ -775,7 +891,7 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
775
891
|
logger.verbose('Waiting for rollup and slash factory to be deployed');
|
|
776
892
|
await deployer.waitForDeployments();
|
|
777
893
|
// Now that the rollup has been deployed and added to the registry, transfer ownership to governance
|
|
778
|
-
await handoverToGovernance(l1Client, deployer, registryAddress, gseAddress, coinIssuerAddress, feeAssetAddress, governanceAddress, logger, args.acceleratedTestDeployments);
|
|
894
|
+
const { dateGatedRelayerAddress } = await handoverToGovernance(l1Client, deployer, registryAddress, gseAddress, coinIssuerAddress, feeAssetAddress, governanceAddress, logger, args.acceleratedTestDeployments, !!args.existingTokenAddress);
|
|
779
895
|
logger.info(`Handing over to governance complete`);
|
|
780
896
|
logger.verbose(`All transactions for L1 deployment have been mined`);
|
|
781
897
|
const l1Contracts = await RegistryContract.collectAddresses(l1Client, registryAddress, 'canonical');
|
|
@@ -1009,7 +1125,8 @@ export const cheat_initializeFeeAssetHandler = async (extendedClient, deployer,
|
|
|
1009
1125
|
feeAssetHandlerAddress,
|
|
1010
1126
|
stakingAssetHandlerAddress,
|
|
1011
1127
|
zkPassportVerifierAddress,
|
|
1012
|
-
coinIssuerAddress
|
|
1128
|
+
coinIssuerAddress,
|
|
1129
|
+
dateGatedRelayerAddress
|
|
1013
1130
|
}
|
|
1014
1131
|
};
|
|
1015
1132
|
};
|
|
@@ -1105,10 +1222,13 @@ export class L1Deployer {
|
|
|
1105
1222
|
});
|
|
1106
1223
|
}
|
|
1107
1224
|
sendTransaction(tx, options) {
|
|
1108
|
-
return this.l1TxUtils.sendTransaction(tx, options)
|
|
1225
|
+
return this.l1TxUtils.sendTransaction(tx, options).then(({ txHash, state })=>({
|
|
1226
|
+
txHash,
|
|
1227
|
+
gasLimit: state.gasLimit,
|
|
1228
|
+
gasPrice: state.gasPrice
|
|
1229
|
+
}));
|
|
1109
1230
|
}
|
|
1110
1231
|
}
|
|
1111
|
-
// docs:start:deployL1Contract
|
|
1112
1232
|
/**
|
|
1113
1233
|
* Helper function to deploy ETH contracts.
|
|
1114
1234
|
* @param walletClient - A viem WalletClient.
|
|
@@ -1289,4 +1409,4 @@ export function getExpectedAddress(abi, bytecode, args, salt) {
|
|
|
1289
1409
|
paddedSalt,
|
|
1290
1410
|
calldata
|
|
1291
1411
|
};
|
|
1292
|
-
}
|
|
1412
|
+
}
|