Skip to content

Commit

Permalink
finalize address
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavBreadless committed Jun 11, 2024
1 parent 394f651 commit e087eb7
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 72 deletions.
2 changes: 1 addition & 1 deletion gas-bound-caller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Since `GasBoundCaller` would be the contract that calls the `_to` contract, the

It should be deployed via a built-in CREATE2 factory on each individual chain.

TODO(EVM-585)
The current address on both sepolia testnet and mainnet for zkSync Era is `0xc706EC7dfA5D4Dc87f29f859094165E8290530f5`.
2 changes: 1 addition & 1 deletion gas-bound-caller/canonical-bytecodes/GasBoundCaller

Large diffs are not rendered by default.

33 changes: 16 additions & 17 deletions gas-bound-caller/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,15 @@
import "@matterlabs/hardhat-zksync-chai-matchers";
import "@matterlabs/hardhat-zksync-node";
import "@matterlabs/hardhat-zksync-solc";
import "@matterlabs/hardhat-zksync-verify";
import "@nomiclabs/hardhat-ethers";
import "hardhat-typechain";

// This version of system contracts requires a pre release of the compiler
const COMPILER_VERSION = "1.5.0";
const PRE_RELEASE_VERSION = "prerelease-a167aa3-code4rena";
function getZksolcUrl(): string {
// @ts-ignore
const platform = { darwin: "macosx", linux: "linux", win32: "windows" }[process.platform];
// @ts-ignore
const toolchain = { linux: "-musl", win32: "-gnu", darwin: "" }[process.platform];
const arch = process.arch === "x64" ? "amd64" : process.arch;
const ext = process.platform === "win32" ? ".exe" : "";

return `https://github.com/matter-labs/era-compiler-solidity/releases/download/${PRE_RELEASE_VERSION}/zksolc-${platform}-${arch}${toolchain}-v${COMPILER_VERSION}${ext}`;
}

console.log(`Using zksolc from ${getZksolcUrl()}`);

export default {
zksolc: {
version: "1.5.0",
compilerSource: "binary",
settings: {
compilerPath: getZksolcUrl(),
isSystem: true,
},
},
Expand Down Expand Up @@ -55,6 +40,20 @@ export default {
ethNetwork: "localhost",
zksync: true,
},
zkSyncTestnet: {
url: "https://sepolia.era.zksync.dev",
ethNetwork: "sepolia",
zksync: true,
// contract verification endpoint
verifyURL: "https://explorer.sepolia.era.zksync.dev/contract_verification",
},
zkSyncMainnet: {
url: "https://mainnet.era.zksync.io",
ethNetwork: "mainnet",
zksync: true,
// contract verification endpoint
verifyURL: "https://zksync2-mainnet-explorer.zksync.io/contract_verification",
},
},
paths: {
sources: "./contracts",
Expand Down
3 changes: 3 additions & 0 deletions gas-bound-caller/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"devDependencies": {
"@matterlabs/hardhat-zksync-chai-matchers": "^0.1.4",
"@matterlabs/hardhat-zksync-node": "^0.0.1-beta.7",
"@matterlabs/hardhat-zksync-verify": "0.6.1",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@typechain/ethers-v5": "^2.0.0",
Expand Down Expand Up @@ -54,6 +55,8 @@
"clean": "yarn clean:bootloader && yarn clean:system-contracts",
"test": "yarn build && hardhat test --network zkSyncTestNode",
"test-node": "hardhat node-zksync --tag v0.0.1-vm1.5.0",
"check-canonical-bytecode": "ts-node ./scripts/check-canonical-bytecode.ts",
"verify": "hardhat run scripts/verify.ts",
"deploy-on-hyperchain": "ts-node ./scripts/deploy-on-hyperchain.ts",
"deploy-on-localhost": "hardhat deploy --network localhost"
}
Expand Down
31 changes: 31 additions & 0 deletions gas-bound-caller/scripts/verify.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// hardhat import should be the first import in the file
import * as hardhat from "hardhat";

const EXPECTED_ADDRESS = '0xc706EC7dfA5D4Dc87f29f859094165E8290530f5';

Check failure on line 4 in gas-bound-caller/scripts/verify.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `'0xc706EC7dfA5D4Dc87f29f859094165E8290530f5'` with `"0xc706EC7dfA5D4Dc87f29f859094165E8290530f5"`

Check failure on line 4 in gas-bound-caller/scripts/verify.ts

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote

Check failure on line 4 in gas-bound-caller/scripts/verify.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `'0xc706EC7dfA5D4Dc87f29f859094165E8290530f5'` with `"0xc706EC7dfA5D4Dc87f29f859094165E8290530f5"`

Check failure on line 4 in gas-bound-caller/scripts/verify.ts

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote

Check failure on line 4 in gas-bound-caller/scripts/verify.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `'0xc706EC7dfA5D4Dc87f29f859094165E8290530f5'` with `"0xc706EC7dfA5D4Dc87f29f859094165E8290530f5"`

Check failure on line 4 in gas-bound-caller/scripts/verify.ts

View workflow job for this annotation

GitHub Actions / lint

Strings must use doublequote

// eslint-disable-next-line @typescript-eslint/no-explicit-any
function verifyPromise(address: string, constructorArguments?: Array<any>, libraries?: object): Promise<any> {
return new Promise((resolve, reject) => {
hardhat
.run("verify:verify", { address, constructorArguments, libraries })
.then(() => resolve(`Successfully verified ${address}`))
.catch((e) => reject(`Failed to verify ${address}\nError: ${e.message}`));
});
}

async function main() {
if (process.env.CHAIN_ETH_NETWORK == "localhost") {
console.log("Skip contract verification on localhost");
return;
}

const message = await verifyPromise(EXPECTED_ADDRESS);
console.log(message.status == "fulfilled" ? message.value : message.reason);
}

main()
.then(() => process.exit(0))
.catch((err) => {
console.error("Error:", err.message || err);
process.exit(1);
});
Loading

0 comments on commit e087eb7

Please sign in to comment.