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

Zksync [DO-NOT-MERGE] #15

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
add hardhat task for bytecode hash, and redeploy to topaz
  • Loading branch information
vmaark committed Dec 16, 2024
commit f7825b5e84012f5455ad2ee30ccff4f72cfac76f
4 changes: 2 additions & 2 deletions deploy/deploy.ts
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {

console.log("UniswapV2Factory deployed to:", factory.address);

const wethAddress = "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
const routerConstructorArguments = [factory.address, wethAddress];
const wMagic = "0x095ded714d42cBD5fb2E84A0FfbFb140E38dC9E1";
const routerConstructorArguments = [factory.address, wMagic];
const magicSwapV2Router = await deploy('MagicSwapV2Router', {
from: deployer,
args: routerConstructorArguments,
98 changes: 29 additions & 69 deletions deployments/treasureTopaz/MagicSwapV2Router.json

Large diffs are not rendered by default.

134 changes: 27 additions & 107 deletions deployments/treasureTopaz/NftVaultFactory.json

Large diffs are not rendered by default.

94 changes: 27 additions & 67 deletions deployments/treasureTopaz/StakingContractMainnet.json

Large diffs are not rendered by default.

164 changes: 42 additions & 122 deletions deployments/treasureTopaz/UniswapV2Factory.json

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@ import "@treasure-dev/hardhat-kms";
import "@matterlabs/hardhat-zksync";
import "@matterlabs/hardhat-zksync-verify";
import "@nomicfoundation/hardhat-foundry";
import { HardhatUserConfig } from "hardhat/config";
import { HardhatUserConfig, task } from "hardhat/config";
import { getUniswapV2BytecodeHash } from "./scripts/getUniswapV2BytecodeHash";


const devKmsKey = process.env.DEV_KMS_RESOURCE_ID;
@@ -52,7 +53,7 @@ const config: HardhatUserConfig = {
},
},
zksolc: {
version: "latest",
version: "1.5.4",
settings: {
// find all available options in the official documentation
// https://docs.zksync.io/build/tooling/hardhat/hardhat-zksync-solc#configuration
@@ -66,4 +67,12 @@ const config: HardhatUserConfig = {
},
};

task(
"uniswap-bytecode-hash",
"Prints the bytecode hash of UniswapV2Pair contract",
async function (taskArguments, hre, runSuper) {
console.log("uniswapV2 bytecode hash", await getUniswapV2BytecodeHash(hre));
}
);

export default config;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
"license": "ISC",
"dependencies": {
"@matterlabs/hardhat-zksync": "^1.1.0",
"@matterlabs/hardhat-zksync-verify": "^1.6.0",
"@matterlabs/zksync-contracts": "^0.6.1",
"@nomicfoundation/hardhat-foundry": "^1.1.2",
"@nomicfoundation/hardhat-verify": "^2.0.9",
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions scripts/getUniswapV2BytecodeHash.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import hre from "hardhat";
import { utils } from "zksync-ethers";
import { hexlify } from "ethers";
export const getUniswapV2BytecodeHash = async () => {
import { HardhatRuntimeEnvironment } from "hardhat/types";

export const getUniswapV2BytecodeHash = async (hre: HardhatRuntimeEnvironment) => {
const artifact = await hre.artifacts.readArtifact("UniswapV2Pair");
const bytecodeHash = utils.hashBytecode(artifact.bytecode);
const hexString = hexlify(bytecodeHash);

console.log("bytecodeHash", hexString);

return bytecodeHash;
}


getUniswapV2BytecodeHash();
return hexString;
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -14,6 +14,6 @@
"./scripts",
"./deploy",
"./test",
"typechain/**/*"
"typechain/**/*"
]
}