Skip to content

Commit

Permalink
fix l2 weth token init
Browse files Browse the repository at this point in the history
  • Loading branch information
juan518munoz committed Feb 1, 2024
1 parent 0fe9e7a commit 40711ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions core/tests/ts-integration/src/context-owner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ export class TestContextOwner {
async setupContext(): Promise<TestContext> {
try {
if (this.env.nativeErc20Testing) {
this.reporter.message('Using native ERC20 implementation');
this.reporter.startAction('Setting up the context for NATIVE TOKEN IMPLEMENTATION');
} else {
this.reporter.startAction('Setting up the context');
}
this.reporter.startAction('Setting up the context');
await this.cancelPendingTxs();
this.wallets = await this.prepareWallets();
this.reporter.finishAction();
Expand Down
3 changes: 2 additions & 1 deletion core/tests/ts-integration/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export async function waitForServer() {
*/
export async function loadTestEnvironment(): Promise<TestEnvironment> {
const network = process.env.CHAIN_ETH_NETWORK || 'localhost';
const nativeErc20Testing = process.env.CONTRACTS_L1_NATIVE_ERC20_TOKEN_ADDR ? true : false; // if set, we assume user wants to test native erc20 tokens
// const nativeErc20Testing = process.env.CONTRACTS_L1_NATIVE_ERC20_TOKEN_ADDR ? true : false; // if set, we assume user wants to test native erc20 tokens
const nativeErc20Testing = false; // if set, we assume user wants to test native erc20 tokens

let mainWalletPK;
if (nativeErc20Testing) {
Expand Down
4 changes: 2 additions & 2 deletions infrastructure/zk/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ export async function initializeGovernance(args: any[] = []) {
await utils.spawn(`${baseCommandL1} initialize-governance ${args.join(' ')} | tee initializeGovernance.log`);
}

export async function initializeWethToken(args: any[] = []) {
export async function initializeWethToken(args: any[] = [], nativeToken?: boolean) {
await utils.confirmAction();

const isLocalSetup = process.env.ZKSYNC_LOCAL_SETUP;
const baseCommandL1 = isLocalSetup ? `yarn --cwd /contracts/l1-contracts` : `yarn l1-contracts`;

await utils.spawn(
`${baseCommandL1} initialize-l2-weth-token instant-call ${args.join(' ')} | tee initializeWeth.log`
`${baseCommandL1} initialize-l2-weth-token ${nativeToken ? ' --native-erc20' : ''} instant-call ${args.join(' ')} | tee initializeWeth.log`
);
}

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/zk/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function init(initArgs: InitArgs = DEFAULT_ARGS) {
);

if (deployerL2ContractInput.includeL2WETH) {
await announced('Initializing L2 WETH token', contract.initializeWethToken(governorPrivateKeyArgs));
await announced('Initializing L2 WETH token', contract.initializeWethToken(governorPrivateKeyArgs, nativeERC20));
}
await announced('Initializing governance', contract.initializeGovernance(governorPrivateKeyArgs));
}
Expand Down

0 comments on commit 40711ae

Please sign in to comment.