Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: remove weth bridge deploy #6

Open
wants to merge 1 commit into
base: internal
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ The L2 counterpart of the L1 ERC20 bridge.
- `withdraw` - initiate a withdrawal by burning funds on the contract and sending a corresponding message to L1.
- `finalizeDeposit` - finalize the deposit and mint funds on L2.

##### L1WethBridge
##### L1WethBridge (Removed)

The custom bridge exclusively handles transfers of WETH tokens between the two domains. It is designed to streamline and
enhance the user experience for bridging WETH tokens by minimizing the number of transactions required and reducing
Expand All @@ -220,7 +220,7 @@ it is wrapped back into WETH and delivered to the L2 recipient.

Thus, the deposit is made in one transaction, and the user receives L2 WETH that can be unwrapped to ETH.

##### L2WethBridge
##### L2WethBridge (Removed)

The L2 counterpart of the L1 WETH bridge.

Expand Down
4 changes: 1 addition & 3 deletions ethereum/contracts/zksync/DiamondInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ contract DiamondInit is Base {
bool _zkPorterIsAvailable,
bytes32 _l2BootloaderBytecodeHash,
bytes32 _l2DefaultAccountBytecodeHash,
uint256 _priorityTxMaxGasLimit,
address _gasTokenAddress
uint256 _priorityTxMaxGasLimit
) external reentrancyGuardInitializer returns (bytes32) {
require(address(_verifier) != address(0), "vt");
require(_governor != address(0), "vy");

s.verifier = _verifier;
s.governor = _governor;
s.gasTokenAddress = _gasTokenAddress;

// We need to initialize the state hash because it is used in the commitment of the next block
IExecutor.StoredBlockInfo memory storedBlockZero = IExecutor.StoredBlockInfo(
Expand Down
6 changes: 1 addition & 5 deletions ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@
"test": "CONTRACT_TESTS=1 yarn hardhat test test/unit_tests/*.spec.ts --network hardhat",
"test:fork": "CONTRACT_TESTS=1 TEST_CONTRACTS_FORK=1 yarn run hardhat test test/unit_tests/*.fork.ts --network hardhat",
"deploy-no-build": "ts-node scripts/deploy.ts",
"deploy-weth-bridges": "ts-node scripts/deploy-weth-bridges.ts",
"initialize-weth-bridges": "ts-node scripts/initialize-weth-bridges.ts",
"initialize-l2-weth-token": "ts-node scripts/initialize-l2-weth-token.ts",
"allow-list-manager": "ts-node scripts/allow-list-manager.ts",
"deploy-erc20": "ts-node scripts/deploy-erc20.ts",
"token-info": "ts-node scripts/token-info.ts",
Expand All @@ -69,8 +66,7 @@
"upgrade-2": "ts-node scripts/upgrades/upgrade-2.ts",
"upgrade-3": "ts-node scripts/upgrades/upgrade-3.ts",
"upgrade-4": "ts-node scripts/upgrades/upgrade-4.ts",
"upgrade-5": "ts-node scripts/upgrades/upgrade-5.ts",
"upgrade-6": "ts-node scripts/upgrades/upgrade-6.ts"
"upgrade-5": "ts-node scripts/upgrades/upgrade-5.ts"
},
"dependencies": {
"dotenv": "^16.0.3"
Expand Down
60 changes: 0 additions & 60 deletions ethereum/scripts/deploy-weth-bridges.ts

This file was deleted.

4 changes: 1 addition & 3 deletions ethereum/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,8 @@ async function main() {
nonce++;
}
await deployer.deployAllowList(create2Salt, { gasPrice, nonce });
await deployer.deployWethToken(create2Salt, { gasPrice, nonce: nonce + 1 });
await deployer.deployZkSyncContract(create2Salt, gasPrice, nonce + 2);
await deployer.deployZkSyncContract(create2Salt, gasPrice, nonce + 1);
await deployer.deployBridgeContracts(create2Salt, gasPrice); // Do not pass nonce, since it was increment after deploying zkSync contracts
await deployer.deployWethBridgeContracts(create2Salt, gasPrice);
await deployer.deployValidatorTimelock(create2Salt, { gasPrice });
});

Expand Down
45 changes: 0 additions & 45 deletions ethereum/scripts/initialize-bridges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {

import * as fs from 'fs';
import * as path from 'path';
import { WETH9, WETH9Factory } from '../typechain';

const provider = web3Provider();
const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`);
Expand Down Expand Up @@ -52,16 +51,6 @@ const L2_STANDARD_ERC20_PROXY_FACTORY_BYTECODE = readBytecode(
const L2_ERC20_BRIDGE_INTERFACE = readInterface(l2BridgeArtifactsPath, 'L2ERC20Bridge');
const DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT = getNumberFromEnv('CONTRACTS_DEPLOY_L2_BRIDGE_COUNTERPART_GAS_LIMIT');

async function approveSpendingGasToken(weth9: WETH9, wallet: Wallet, spender: string, amount: ethers.BigNumber) {
weth9 = weth9.connect(wallet);
const approveTx = await weth9.approve(spender, amount, {
gasLimit: 210000,
});
await approveTx.wait()
let allowance = await weth9.allowance(wallet.address, spender);
console.log(`Wallet ${wallet.address} allowance for spender ${spender}: ${ethers.utils.formatEther(allowance)}`);
}

async function main() {
const program = new Command();

Expand All @@ -87,41 +76,7 @@ async function main() {
verbose: true
});

// mint weth token, with weth admin wallet
const deploy2Wallet = cmd.privateKey
? new Wallet(cmd.privateKey, provider)
: Wallet.fromMnemonic(
process.env.MNEMONIC ? process.env.MNEMONIC : ethTestConfig.mnemonic,
"m/44'/60'/0'/0/1"
).connect(provider);

const zkSync = deployer.zkSyncContract(deployWallet);

const wethTokenAddress = deployer.addresses.WethToken;
console.log(wethTokenAddress);

let weth9 = WETH9Factory.connect(wethTokenAddress, deploy2Wallet)
// mint for deployer wallet
const tx = await weth9.mint(deployWallet.address, ethers.utils.parseEther('10000000000'), {
gasLimit: 210000,
});
await tx.wait()
const weth9Balance = await weth9.balanceOf(deployWallet.address);
console.log(`[deployer]weth9 Balance: ${ethers.utils.formatEther(weth9Balance)}`)

// mint for deployer2 wallet
const tx2 = await weth9.mint(deploy2Wallet.address, ethers.utils.parseEther('10000000000'), {
gasLimit: 210000,
});
await tx2.wait()
const weth9Balance2 = await weth9.balanceOf(deploy2Wallet.address);
console.log(`[deployer2]weth9 Balance: ${ethers.utils.formatEther(weth9Balance2)}`)

// approve bridge for spending with the deployer wallet
await approveSpendingGasToken(weth9, deployWallet, zkSync.address, ethers.constants.MaxUint256);
await approveSpendingGasToken(weth9, deploy2Wallet, zkSync.address, ethers.constants.MaxUint256);


const gasPrice = cmd.gasPrice ? parseUnits(cmd.gasPrice, 'gwei') : await provider.getGasPrice();
console.log(`Using gas price: ${formatUnits(gasPrice, 'gwei')} gwei`);

Expand Down
3 changes: 1 addition & 2 deletions ethereum/scripts/initialize-l1-allow-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ async function main() {
await allowListContract.setBatchAccessMode(
[
deployer.addresses.ZkSync.DiamondProxy,
deployer.addresses.Bridges.ERC20BridgeProxy,
deployer.addresses.Bridges.WethBridgeProxy
deployer.addresses.Bridges.ERC20BridgeProxy
],
[AccessMode.Public, AccessMode.Public, AccessMode.Public],
{ nonce }
Expand Down
183 changes: 0 additions & 183 deletions ethereum/scripts/initialize-l2-weth-token.ts

This file was deleted.

Loading