Skip to content

Commit

Permalink
Add script to deploy zksync contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
byshape committed Sep 2, 2024
1 parent 30cb5aa commit bdcef94
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"coverage:html": "bash scripts/coverage.sh",
"doc": "forge doc --build --out documentation",
"gasreport": "FOUNDRY_PROFILE=default forge test -vvv --gas-report",
"lint": "solhint --max-warnings 0 \"contracts/**/*.sol\" \"test/**/*.sol\"",
"lint": "solhint --max-warnings 0 \"contracts/**/*.sol\" \"test/**/*.sol\" \"script/**/*.sol\"",
"lint:fix": "solhint --max-warnings 0 \"contracts/**/*.sol\" \"test/**/*.sol\" --fix",
"test": "FOUNDRY_PROFILE=default forge snapshot --no-match-test \"testFuzz_*\"",
"test:lite": "FOUNDRY_PROFILE=lite forge test -vvv",
Expand Down
2 changes: 1 addition & 1 deletion script/DeployEscrowFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract DeployEscrowFactory is Script {
address public constant ACCESS_TOKEN = 0xACCe550000159e70908C0499a1119D04e7039C28; // All chains
ICreate3Deployer public constant CREATE3_DEPLOYER = ICreate3Deployer(0x65B3Db8bAeF0215A1F9B14c506D2a3078b2C84AE); // All chains

mapping(uint256 => address) public FEE_TOKEN;
mapping(uint256 => address) public FEE_TOKEN; // solhint-disable-line var-name-mixedcase

function run() external {
FEE_TOKEN[1] = 0x6B175474E89094C44Da98b954EedeAC495271d0F; // Mainnet (DAI)
Expand Down
39 changes: 39 additions & 0 deletions script/DeployEscrowFactoryZkSync.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.8.23;

import { Script } from "forge-std/Script.sol";
import { IERC20 } from "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

import { EscrowFactoryZkSync } from "contracts/zkSync/EscrowFactoryZkSync.sol";

// solhint-disable no-console
import { console } from "forge-std/console.sol";

contract DeployEscrowFactoryZkSync is Script {
uint32 public constant RESCUE_DELAY = 691200; // 8 days
address public constant LOP = 0x6fd4383cB451173D5f9304F041C7BCBf27d561fF;
IERC20 public constant ACCESS_TOKEN = IERC20(0xC2c4fE863EC835D7DdbFE91Fe33cf1C7Df45Fa7C);
IERC20 public constant FEE_TOKEN = IERC20(0x4B9eb6c0b6ea15176BBF62841C6B2A8a398cb656); // DAI

function run() external {
address deployer = vm.envAddress("DEPLOYER_ADDRESS");
address feeBankOwner = deployer;

vm.startBroadcast();
EscrowFactoryZkSync escrowFactory = new EscrowFactoryZkSync(
LOP,
FEE_TOKEN,
ACCESS_TOKEN,
feeBankOwner,
RESCUE_DELAY,
RESCUE_DELAY
);
vm.stopBroadcast();

console.log("Escrow Factory deployed at: ", address(escrowFactory));
console.log("EscrowSrcZkSync deployed at: ", escrowFactory.ESCROW_SRC_IMPLEMENTATION());
console.log("EscrowSrcZkSync deployed at: ", escrowFactory.ESCROW_DST_IMPLEMENTATION());
}
}
// solhint-enable no-console
7 changes: 6 additions & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ chains["gnosis"]="$GNOSIS_RPC_URL"
chains["arbitrum"]="$ARBITRUM_RPC_URL"
chains["optimism"]="$OPTIMISM_RPC_URL"
chains["base"]="$BASE_RPC_URL"
chains["zksync"]="$ZKSYNC_RPC_URL"

rpc_url="${chains["$1"]}"
if [ -z "$rpc_url" ]; then
Expand All @@ -38,4 +39,8 @@ else
exit 1
fi

forge script script/DeployEscrowFactory.s.sol --fork-url $rpc_url --keystore $keystore --broadcast -vvvv
if [ "$1" = "zksync" ]; then
forge script script/DeployEscrowFactoryZkSync.s.sol --zksync --fork-url $rpc_url --keystore $keystore --broadcast -vvvv
else
forge script script/DeployEscrowFactory.s.sol --fork-url $rpc_url --keystore $keystore --broadcast -vvvv
fi

0 comments on commit bdcef94

Please sign in to comment.