Skip to content

Commit

Permalink
wip: fix rebasing conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvisKrop committed Aug 31, 2023
1 parent 0a9775b commit fd1f3b0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/tasks/local_verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ task("local-verify", "Verifies that the local deployment files correspond to the
for (const contract of Object.keys(deployedContracts)) {
const deployment = await hre.deployments.get(contract);
const onChainCode = await hre.ethers.provider.getCode(deployment.address);
const onchainBytecodeHash = hre.ethers.utils.keccak256(onChainCode);
const onchainBytecodeHash = hre.ethers.keccak256(onChainCode);
// TODO: compile contract in realtime and compare the compiled bytecode with onchain bytecode
const localBytecodeHash = hre.ethers.utils.keccak256(deployment.deployedBytecode!);
const localBytecodeHash = hre.ethers.keccak256(deployment.deployedBytecode!);
const verifySuccess = onchainBytecodeHash === localBytecodeHash ? "\x1b[32mSUCCESS\x1b[0m" : "\x1b[31mFAILURE\x1b[0m";
console.log(`Verification status for ${contract}: ${verifySuccess}`);
}
Expand Down
1 change: 0 additions & 1 deletion src/tasks/zk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "hardhat-deploy";
import { TASK_DEPLOY } from "hardhat-deploy";
import { TASK_VERIFY_VERIFY } from "@matterlabs/hardhat-zksync-verify/dist/src/constants";
import "@nomiclabs/hardhat-ethers";
import { TASK_TEST_SETUP_TEST_ENVIRONMENT } from "hardhat/builtin-tasks/task-names";
import { subtask } from "hardhat/config";

Expand Down
12 changes: 6 additions & 6 deletions src/utils/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { SafeProxyFactory } from "../../typechain-types";

export const calculateProxyAddress = async (factory: SafeProxyFactory, singleton: string, inititalizer: string, nonce: number | string) => {
const salt = ethers.solidityPackedKeccak256(["bytes32", "uint256"], [ethers.solidityPackedKeccak256(["bytes"], [inititalizer]), nonce]);
const factoryAddress = await factory.getAddress();

if (hre.network.zksync) {
const proxyCreationCode = (await hre.artifacts.readArtifact("SafeProxy")).deployedBytecode;
const bytecodehash = zk.utils.hashBytecode(proxyCreationCode);
const input = new ethers.utils.AbiCoder().encode(["address"], [singleton]);
return zk.utils.create2Address(factory.address, bytecodehash, salt, input);
const input = new ethers.AbiCoder().encode(["address"], [singleton]);
return zk.utils.create2Address(factoryAddress, bytecodehash, salt, input);
}

const factoryAddress = await factory.getAddress();
const deploymentCode = ethers.solidityPacked(["bytes", "uint256"], [await factory.proxyCreationCode(), singleton]);
return ethers.getCreate2Address(factoryAddress, salt, ethers.keccak256(deploymentCode));
};
Expand All @@ -40,15 +40,15 @@ export const calculateChainSpecificProxyAddress = async (
["bytes32", "uint256", "uint256"],
[ethers.solidityPackedKeccak256(["bytes"], [inititalizer]), nonce, chainId],
);
const factoryAddress = await factory.getAddress();

if (hre.network.zksync) {
const proxyCreationCode = (await hre.artifacts.readArtifact("SafeProxy")).deployedBytecode;
const bytecodehash = zk.utils.hashBytecode(proxyCreationCode);
const input = new ethers.utils.AbiCoder().encode(["address"], [singleton]);
return zk.utils.create2Address(factory.address, bytecodehash, salt, input);
const input = new ethers.AbiCoder().encode(["address"], [singleton]);
return zk.utils.create2Address(factoryAddress, bytecodehash, salt, input);
}

const factoryAddress = await factory.getAddress();
const deploymentCode = ethers.solidityPacked(["bytes", "uint256"], [await factory.proxyCreationCode(), singleton]);
return ethers.getCreate2Address(factoryAddress, salt, ethers.keccak256(deploymentCode));
};
2 changes: 1 addition & 1 deletion test/utils/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import hre, { deployments, waffle } from "hardhat";
import hre, { deployments } from "hardhat";
import { Contract, Signer, ethers } from "ethers";
import { AddressZero } from "@ethersproject/constants";
import solc from "solc";
Expand Down
Empty file removed yarn.lock
Empty file.

0 comments on commit fd1f3b0

Please sign in to comment.