-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor deploy and init scripts into a single script
this removed a few extra manual steps (env var copying and setting)
- Loading branch information
Showing
6 changed files
with
90 additions
and
158 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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,80 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.17; | ||
|
||
import "lib/forge-std/src/console.sol"; | ||
import "lib/forge-std/src/Script.sol"; | ||
|
||
import {LibDeployInit} from "./DeployInitHelpers.sol"; | ||
|
||
import "../src/L1EscrowProxy.sol"; | ||
import "../src/L1EscrowImpl.sol"; | ||
import "../src/NativeConverterProxy.sol"; | ||
import "../src/NativeConverterImpl.sol"; | ||
import "../src/ZkMinterBurnerProxy.sol"; | ||
import "../src/ZkMinterBurnerImpl.sol"; | ||
|
||
contract DeployInit is Script { | ||
uint256 l1ForkId = vm.createFork(vm.envString("L1_RPC_URL")); | ||
uint256 l2ForkId = vm.createFork(vm.envString("L2_RPC_URL")); | ||
|
||
address bridge = vm.envAddress("ADDRESS_LXLY_BRIDGE"); | ||
uint32 l1NetworkId = uint32(vm.envUint("L1_NETWORK_ID")); | ||
uint32 l2NetworkId = uint32(vm.envUint("L2_NETWORK_ID")); | ||
|
||
address l1Usdc = vm.envAddress("ADDRESS_L1_USDC"); | ||
address l2Usdc = vm.envAddress("ADDRESS_L2_USDC"); // ATTN: needs to be deployed beforehand zkUsdc | ||
address l2WrappedUsdc = vm.envAddress("ADDRESS_L2_WUSDC"); | ||
|
||
address admin = vm.envAddress("ADDRESS_PROXY_ADMIN"); | ||
address owner = vm.envAddress("ADDRESS_OWNER"); | ||
|
||
function run() external { | ||
// deploy L1 contract | ||
vm.selectFork(l1ForkId); | ||
vm.startBroadcast(vm.envUint("DEPLOYER_PRIVATE_KEY")); | ||
address l1EscrowProxy = LibDeployInit.deployL1Contracts(admin); | ||
vm.stopBroadcast(); | ||
|
||
// deploy L2 contracts | ||
vm.selectFork(l2ForkId); | ||
vm.startBroadcast(vm.envUint("DEPLOYER_PRIVATE_KEY")); | ||
( | ||
address minterBurnerProxy, | ||
address nativeConverterProxy | ||
) = LibDeployInit.deployL2Contracts(admin); | ||
vm.stopBroadcast(); | ||
|
||
// init L1 contract | ||
vm.selectFork(l1ForkId); | ||
vm.startBroadcast(vm.envUint("DEPLOYER_PRIVATE_KEY")); | ||
L1EscrowImpl l1Escrow = LibDeployInit.initL1Contracts( | ||
l2NetworkId, | ||
bridge, | ||
l1EscrowProxy, | ||
minterBurnerProxy, | ||
l1Usdc | ||
); | ||
vm.stopBroadcast(); | ||
|
||
// init L2 contracts | ||
vm.selectFork(l2ForkId); | ||
vm.startBroadcast(vm.envUint("DEPLOYER_PRIVATE_KEY")); | ||
( | ||
ZkMinterBurnerImpl minterBurner, | ||
NativeConverterImpl nativeConverter | ||
) = LibDeployInit.initL2Contracts( | ||
l1NetworkId, | ||
bridge, | ||
l1EscrowProxy, | ||
minterBurnerProxy, | ||
nativeConverterProxy, | ||
l2Usdc, | ||
l2WrappedUsdc | ||
); | ||
vm.stopBroadcast(); | ||
|
||
console.log("L1_ESCROW_PROXY=%s", address(l1Escrow)); | ||
console.log("ZK_MINTER_BURNER_PROXY=%s", address(minterBurner)); | ||
console.log("NATIVE_CONVERTER_PROXY=%s", address(nativeConverter)); | ||
} | ||
} |
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