From 95a7b0c09b891ca4d015156e27b39b430ea41bfa Mon Sep 17 00:00:00 2001 From: invocamanman Date: Wed, 18 Oct 2023 14:58:26 +0200 Subject: [PATCH] first deployment done --- deployment/v2/4_createRollup.ts | 1 + deployment/v2/verifyContracts.js | 49 +++++++++++++++++++++++++++----- hardhat.config.ts | 11 +++++++ package.json | 3 +- 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/deployment/v2/4_createRollup.ts b/deployment/v2/4_createRollup.ts index b151202ef..9a7e32e52 100644 --- a/deployment/v2/4_createRollup.ts +++ b/deployment/v2/4_createRollup.ts @@ -178,6 +178,7 @@ async function main() { deployOutput.genesis = genesis.root; deployOutput.newZKEVMAddress = newZKEVMAddress; + deployOutput.verifierAddress = verifierContract.target; fs.writeFileSync(pathOutputJson, JSON.stringify(deployOutput, null, 1)); } diff --git a/deployment/v2/verifyContracts.js b/deployment/v2/verifyContracts.js index b5428112a..57367a6d8 100644 --- a/deployment/v2/verifyContracts.js +++ b/deployment/v2/verifyContracts.js @@ -21,14 +21,12 @@ async function main() { const polTokenSymbol = "POL"; const polTokenInitialBalance = ethers.parseEther("20000000"); - const polTokenFactory = await ethers.getContractFactory("ERC20PermitMock", deployer); - try { // verify governance await hre.run( 'verify:verify', { - address: deployOutputParameters.maticTokenAddress, + address: deployOutputParameters.polTokenAddress, constructorArguments: [ polTokenName, polTokenSymbol, @@ -122,18 +120,55 @@ async function main() { await hre.run( 'verify:verify', { + contract: "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy", address: deployOutputParameters.polygonZkEVMBridgeAddress, + constructorArguments: [ + await upgrades.erc1967.getImplementationAddress(deployOutputParameters.polygonZkEVMBridgeAddress), + await upgrades.erc1967.getAdminAddress(deployOutputParameters.polygonZkEVMBridgeAddress), + "0x" + ] }, ); } catch (error) { - expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + //expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); } - // verify zkEVM address - try { + + try { + await hre.run( + 'verify:verify', + { + address: deployOutputParameters.polygonZkEVMBridgeAddress, + }, + ); + } catch (error) { + //expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + } + + try { await hre.run( 'verify:verify', { + contract: "contracts/v2/lib/PolygonTransparentProxy.sol:PolygonTransparentProxy", + address: deployOutputParameters.newZKEVMAddress, + constructorArguments: [ + await upgrades.erc1967.getImplementationAddress(deployOutputParameters.newZKEVMAddress), + await upgrades.erc1967.getAdminAddress(deployOutputParameters.newZKEVMAddress), + "0x" + ] + }, + ); + } catch (error) { + //expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + } + + + // verify zkEVM address + try { + await hre.run( + 'verify:verify', + { + contract: "contracts/v2/consensus/zkEVM/PolygonZkEVMV2.sol:PolygonZkEVMV2", address: deployOutputParameters.newZKEVMAddress, constructorArguments: [ deployOutputParameters.polygonZkEVMGlobalExitRootAddress, @@ -144,7 +179,7 @@ async function main() { }, ); } catch (error) { - expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + //expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); } } diff --git a/hardhat.config.ts b/hardhat.config.ts index cd2011147..b96b9293d 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -115,6 +115,17 @@ const config: HardhatUserConfig = { evmVersion: "shanghai", }, // try yul optimizer }, + // Should have the same optimizations than the RollupManager to verify + "contracts/v2/lib/PolygonTransparentProxy.sol": { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 10, + }, + evmVersion: "shanghai", + }, // try yul optimizer + }, }, }, networks: { diff --git a/package.json b/package.json index 348a38610..a7cf93486 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "deploy:v2:localhost": "rm -f .openzeppelin/unknown-31337.json && npx ts-node deployment/v2/1_createGenesis.ts --test && npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network localhost && npx hardhat run deployment/v2/3_deployContracts.ts --network localhost && npx hardhat run deployment/v2/4_createRollup.ts --network localhost", "deploy:testnet:v2:localhost": "rm -f deployment/v2/deploy_ongoing.json && npm run prepare:testnet:ZkEVM:localhost && npm run deploy:v2:localhost", "deploy:v2:goerli": "npx ts-node deployment/v2/1_createGenesis.ts && npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network goerli && npx hardhat run deployment/v2/3_deployContracts.ts --network goerli && npx hardhat run deployment/v2/4_createRollup.ts --network goerli", - "deploy:testnet:v2:goerli": "rm -f deployment/v2/deploy_ongoing.json && npm run prepare:testnet:ZkEVM:goerli && npm run deploy:v2:goerli" + "deploy:testnet:v2:goerli": "rm -f deployment/v2/deploy_ongoing.json && npm run prepare:testnet:ZkEVM:goerli && npm run deploy:v2:goerli", + "verify:v2:goerli": "npx hardhat run deployment/v2/verifyContracts.js --network goerli" } }