From 431f2262b4d1b0f2d548d1b3d97968e44b3fbf0b Mon Sep 17 00:00:00 2001 From: invocamanman Date: Fri, 15 Dec 2023 17:45:38 +0100 Subject: [PATCH] update deployment v1tov2 --- deployment/v1ToV2/1_createGenesis.ts | 492 ++++++++++++++ .../v1ToV2/2_deployPolygonZKEVMDeployer.ts | 93 +++ deployment/v1ToV2/3_deployContracts.ts | 607 ++++++++++++++++++ deployment/v1ToV2/4_createRollup.ts | 307 +++++++++ deployment/v1ToV2/README.md | 54 ++ .../v1ToV2/deploy_parameters.json.example | 27 + deployment/v1ToV2/prepareTestnet.ts | 132 ++++ docker/scripts/v1ToV2/deploy-docker.sh | 14 + docker/scripts/v1ToV2/deploy-dockerv2.sh | 14 + .../v1ToV2/deploy_parameters_docker.json | 29 + docker/scripts/v1ToV2/genesis.json | 98 +++ docker/scripts/v1ToV2/hardhat.example.paris | 258 ++++++++ docker/scripts/v2/deploy-docker.sh | 2 + package.json | 5 + 14 files changed, 2132 insertions(+) create mode 100644 deployment/v1ToV2/1_createGenesis.ts create mode 100644 deployment/v1ToV2/2_deployPolygonZKEVMDeployer.ts create mode 100644 deployment/v1ToV2/3_deployContracts.ts create mode 100644 deployment/v1ToV2/4_createRollup.ts create mode 100644 deployment/v1ToV2/README.md create mode 100644 deployment/v1ToV2/deploy_parameters.json.example create mode 100644 deployment/v1ToV2/prepareTestnet.ts create mode 100755 docker/scripts/v1ToV2/deploy-docker.sh create mode 100755 docker/scripts/v1ToV2/deploy-dockerv2.sh create mode 100644 docker/scripts/v1ToV2/deploy_parameters_docker.json create mode 100644 docker/scripts/v1ToV2/genesis.json create mode 100644 docker/scripts/v1ToV2/hardhat.example.paris diff --git a/deployment/v1ToV2/1_createGenesis.ts b/deployment/v1ToV2/1_createGenesis.ts new file mode 100644 index 000000000..8668b626c --- /dev/null +++ b/deployment/v1ToV2/1_createGenesis.ts @@ -0,0 +1,492 @@ +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if, import/no-dynamic-require */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved, no-restricted-syntax */ +import {expect} from "chai"; +import path = require("path"); +import fs = require("fs"); + +import * as dotenv from "dotenv"; +dotenv.config({path: path.resolve(__dirname, "../../.env")}); +import yargs from "yargs/yargs"; + +const argv = yargs(process.argv.slice(2)) + .options({ + test: {type: "boolean", default: false}, + input: {type: "string", default: "./deploy_parameters.json"}, + out: {type: "string", default: "./genesis.json"}, + }) + .parse() as any; + +const DEFAULT_MNEMONIC = "test test test test test test test test test test test junk"; +process.env.HARDHAT_NETWORK = "hardhat"; +process.env.MNEMONIC = argv.test ? DEFAULT_MNEMONIC : process.env.MNEMONIC; +import {ethers, upgrades} from "hardhat"; +import {MemDB, ZkEVMDB, getPoseidon, smtUtils} from "@0xpolygonhermez/zkevm-commonjs"; + +import {deployPolygonZkEVMDeployer, create2Deployment, getCreate2Address} from "../helpers/deployment-helpers"; +import {ProxyAdmin} from "../../typechain-types"; +import {Addressable} from "ethers"; + +import "../helpers/utils"; + +const deployParameters = require(argv.input); +const pathOutputJson = path.join(__dirname, argv.out); + +/* + * bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; + */ +const _ADMIN_SLOT = "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103" as any; +const _IMPLEMENTATION_SLOT = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc" as any; + +// Genesis mainnet address: +const mainnetZkEVMDeployerAddress = "0xCB19eDdE626906eB1EE52357a27F62dd519608C2"; +const mainnetZkEVMTimelockAddress = "0xBBa0935Fa93Eb23de7990b47F0D96a8f75766d13"; +const mainnetProxyAdminAddress = "0x0F99738B2Fc14D77308337f3e2596b63aE7BCC4A"; +const mainnetZkEVMBridgeImplementationAddress = "0x5ac4182A1dd41AeEf465E40B82fd326BF66AB82C"; +const mainnetZkEVMBridgeProxyAddress = "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe"; +const mainnetGlobalExitRootL2ImplementationAddress = "0x0200143Fa295EE4dffEF22eE2616c2E008D81688"; + +const keylessDeployerMainnet = "0x9d90066e7478496e2284E54c3548106bb4F90E50"; +const deployerMainnet = "0x4c1665d6651ecEfa59B9B3041951608468b18891"; + +const mainnetMultisig = "0x4c1665d6651ecEfa59B9B3041951608468b18891"; +const mainnetInitialZkEVMDeployerOwner = "0x4c1665d6651ecEfa59B9B3041951608468b18891"; +const mainnetMinDelayTimelock = 864000; + +const globalExitRootL2Address = "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa"; +const zkevmAddressL2 = ethers.ZeroAddress; + +async function main() { + // Constant variables + const attemptsDeployProxy = 20; + const balanceBrige = BigInt("0xffffffffffffffffffffffffffffffff"); // 128 bits + + let timelockAdminAddress; + let initialZkEVMDeployerOwner; + let salt; + let minDelayTimelock; + + let bridgeImplementationAddress; + let finalBridgeImplAddress; + + let proxyBridgeAddress; + let finalBridgeProxyAddress; + + let proxyAdminAddress; + let finalProxyAdminAddress; + + let finalTimelockContractAdress; + + let finalzkEVMDeployerAdress; + + const finalGlobalExitRootL2ProxyAddress = globalExitRootL2Address; + + let finalGlobalExitRootL2ImplAddress; + + let finalKeylessDeployer; + let finalDeployer; + + const genesis = []; + + // Check if it's mainnet deployment + const isMainnet = deployParameters["isMainnet"] === true ? true : false; + + if (isMainnet === true) { + timelockAdminAddress = mainnetMultisig; + minDelayTimelock = mainnetMinDelayTimelock; + salt = "0x0000000000000000000000000000000000000000000000000000000000000000"; // salt mock + initialZkEVMDeployerOwner = mainnetInitialZkEVMDeployerOwner; + + finalzkEVMDeployerAdress = mainnetZkEVMDeployerAddress; + finalTimelockContractAdress = mainnetZkEVMTimelockAddress; + finalProxyAdminAddress = mainnetProxyAdminAddress; + finalBridgeImplAddress = mainnetZkEVMBridgeImplementationAddress; + finalBridgeProxyAddress = mainnetZkEVMBridgeProxyAddress; + finalGlobalExitRootL2ImplAddress = mainnetGlobalExitRootL2ImplementationAddress; + finalKeylessDeployer = keylessDeployerMainnet; + finalDeployer = deployerMainnet; + } else { + // load deploy parameters + const mandatoryDeploymentParameters = [ + "timelockAdminAddress", + "minDelayTimelock", + "salt", + "initialZkEVMDeployerOwner", + ]; + + for (const parameterName of mandatoryDeploymentParameters) { + if (deployParameters[parameterName] === undefined || deployParameters[parameterName] === "") { + throw new Error(`Missing parameter: ${parameterName}`); + } + } + ({timelockAdminAddress, minDelayTimelock, salt, initialZkEVMDeployerOwner} = deployParameters); + } + + // Load deployer + await ethers.provider.send("hardhat_impersonateAccount", [initialZkEVMDeployerOwner]); + await ethers.provider.send("hardhat_setBalance", [initialZkEVMDeployerOwner, "0xffffffffffffffff"]); // 18 ethers aprox + const deployer = await ethers.getSigner(initialZkEVMDeployerOwner); + + // Deploy PolygonZkEVMDeployer if is not deployed already + const [zkEVMDeployerContract, keylessDeployer] = await deployPolygonZkEVMDeployer( + initialZkEVMDeployerOwner, + deployer + ); + if (isMainnet === false) { + finalDeployer = deployer.address; + finalKeylessDeployer = keylessDeployer; + finalzkEVMDeployerAdress = zkEVMDeployerContract.target; + } + /* + * Deploy Bridge + * Deploy admin --> implementation --> proxy + */ + + // Deploy proxy admin: + const proxyAdminFactory = await ethers.getContractFactory( + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol:ProxyAdmin", + deployer + ); + const deployTransactionAdmin = (await proxyAdminFactory.getDeployTransaction()).data; + const dataCallAdmin = proxyAdminFactory.interface.encodeFunctionData("transferOwnership", [deployer.address]); + [proxyAdminAddress] = await create2Deployment( + zkEVMDeployerContract, + salt, + deployTransactionAdmin, + dataCallAdmin, + deployer, + null + ); + + if (isMainnet === false) { + finalProxyAdminAddress = proxyAdminAddress; + } + + // Deploy implementation PolygonZkEVMBridge + const polygonZkEVMBridgeFactory = await ethers.getContractFactory("PolygonZkEVMBridgeV2", deployer); + const deployTransactionBridge = (await polygonZkEVMBridgeFactory.getDeployTransaction()).data; + // Mandatory to override the gasLimit since the estimation with create are mess up D: + const overrideGasLimit = BigInt(5500000); + [bridgeImplementationAddress] = await create2Deployment( + zkEVMDeployerContract, + salt, + deployTransactionBridge, + null, + deployer, + overrideGasLimit + ); + + if (isMainnet === false) { + finalBridgeImplAddress = bridgeImplementationAddress; + } + // Do not initialize the bridge! + + /* + * deploy proxy + * Do not initialize directly the proxy since we want to deploy the same code on L2 and this will alter the bytecode deployed of the proxy + */ + const transparentProxyFactory = await ethers.getContractFactory( + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy", + deployer + ); + const initializeEmptyDataProxy = "0x"; + const deployTransactionProxy = ( + await transparentProxyFactory.getDeployTransaction( + bridgeImplementationAddress as string, // must have bytecode + proxyAdminAddress as string, + initializeEmptyDataProxy + ) + ).data; + + [proxyBridgeAddress] = await create2Deployment( + zkEVMDeployerContract, + salt, + deployTransactionProxy, + null, + deployer, + null + ); + + if (isMainnet === false) { + finalBridgeProxyAddress = proxyBridgeAddress; + } + + // Import OZ manifest the deployed contracts, its enough to import just the proyx, the rest are imported automatically ( admin/impl) + await upgrades.forceImport(proxyBridgeAddress as string, polygonZkEVMBridgeFactory, "transparent" as any); + + /* + *Deployment Global exit root manager + */ + const PolygonZkEVMGlobalExitRootL2Factory = await ethers.getContractFactory( + "PolygonZkEVMGlobalExitRootL2", + deployer + ); + let polygonZkEVMGlobalExitRootL2; + for (let i = 0; i < attemptsDeployProxy; i++) { + try { + polygonZkEVMGlobalExitRootL2 = await upgrades.deployProxy(PolygonZkEVMGlobalExitRootL2Factory, [], { + initializer: false, + constructorArgs: [finalBridgeProxyAddress], + unsafeAllow: ["constructor", "state-variable-immutable"], + }); + break; + } catch (error: any) { + console.log(`attempt ${i}`); + console.log("upgrades.deployProxy of polygonZkEVMGlobalExitRootL2 ", error.message); + } + + // reach limits of attempts + if (i + 1 === attemptsDeployProxy) { + throw new Error("polygonZkEVMGlobalExitRootL2 contract has not been deployed"); + } + } + + // Assert admin address + expect(await upgrades.erc1967.getAdminAddress(polygonZkEVMGlobalExitRootL2?.target as string)).to.be.equal( + proxyAdminAddress + ); + expect(await upgrades.erc1967.getAdminAddress(proxyBridgeAddress as string)).to.be.equal(proxyAdminAddress); + + const timelockContractFactory = await ethers.getContractFactory("PolygonZkEVMTimelock", deployer); + const timelockContract = await timelockContractFactory.deploy( + minDelayTimelock, + [timelockAdminAddress], + [timelockAdminAddress], + timelockAdminAddress, + zkevmAddressL2 + ); + await timelockContract.waitForDeployment(); + if (isMainnet === false) { + finalTimelockContractAdress = timelockContract.target; + } + + // Transfer ownership of the proxyAdmin to timelock + const proxyAdminInstance = proxyAdminFactory.attach(proxyAdminAddress as string) as ProxyAdmin; + await (await proxyAdminInstance.connect(deployer).transferOwnership(finalTimelockContractAdress as string)).wait(); + + // Recreate genesis with the current information: + + // ZKEVMDeployer + const zkEVMDeployerInfo = await getAddressInfo(zkEVMDeployerContract.target); + genesis.push({ + contractName: "PolygonZkEVMDeployer", + balance: "0", + nonce: zkEVMDeployerInfo.nonce.toString(), + address: finalzkEVMDeployerAdress, + bytecode: zkEVMDeployerInfo.bytecode, + storage: zkEVMDeployerInfo.storage, + }); + + // Proxy Admin + const proxyAdminInfo = await getAddressInfo(proxyAdminAddress as string); + genesis.push({ + contractName: "ProxyAdmin", + balance: "0", + nonce: proxyAdminInfo.nonce.toString(), + address: finalProxyAdminAddress, + bytecode: proxyAdminInfo.bytecode, + storage: proxyAdminInfo.storage, + }); + + // Bridge implementation + const bridgeImplementationInfo = await getAddressInfo(bridgeImplementationAddress as string); + genesis.push({ + contractName: "PolygonZkEVMBridge implementation", + balance: "0", + nonce: bridgeImplementationInfo.nonce.toString(), + address: finalBridgeImplAddress, + bytecode: bridgeImplementationInfo.bytecode, + // storage: bridgeImplementationInfo.storage, implementation do not have storage + }); + + // Bridge proxy + const bridgeProxyInfo = await getAddressInfo(proxyBridgeAddress as string); + // Override admin and implementation slots: + bridgeProxyInfo.storage[_ADMIN_SLOT] = ethers.zeroPadValue(finalProxyAdminAddress as string, 32); + bridgeProxyInfo.storage[_IMPLEMENTATION_SLOT] = ethers.zeroPadValue(finalBridgeImplAddress as string, 32); + + genesis.push({ + contractName: "PolygonZkEVMBridge proxy", + balance: balanceBrige, + nonce: bridgeProxyInfo.nonce.toString(), + address: finalBridgeProxyAddress, + bytecode: bridgeProxyInfo.bytecode, + storage: bridgeProxyInfo.storage, + }); + + // polygonZkEVMGlobalExitRootL2 implementation + const implGlobalExitRootL2 = await upgrades.erc1967.getImplementationAddress( + polygonZkEVMGlobalExitRootL2?.target as string + ); + const implGlobalExitRootL2Info = await getAddressInfo(implGlobalExitRootL2); + + if (isMainnet === false) { + finalGlobalExitRootL2ImplAddress = implGlobalExitRootL2; + } + + genesis.push({ + contractName: "PolygonZkEVMGlobalExitRootL2 implementation", + balance: "0", + nonce: implGlobalExitRootL2Info.nonce.toString(), + address: finalGlobalExitRootL2ImplAddress, + bytecode: implGlobalExitRootL2Info.bytecode, + // storage: implGlobalExitRootL2Info.storage, , implementation do not have storage + }); + + // polygonZkEVMGlobalExitRootL2 proxy + const proxyGlobalExitRootL2Info = await getAddressInfo(polygonZkEVMGlobalExitRootL2?.target as string); + + proxyGlobalExitRootL2Info.storage[_ADMIN_SLOT] = ethers.zeroPadValue(finalProxyAdminAddress as string, 32); + proxyGlobalExitRootL2Info.storage[_IMPLEMENTATION_SLOT] = ethers.zeroPadValue( + finalGlobalExitRootL2ImplAddress as string, + 32 + ); + + genesis.push({ + contractName: "PolygonZkEVMGlobalExitRootL2 proxy", + balance: "0", + nonce: proxyGlobalExitRootL2Info.nonce.toString(), + address: finalGlobalExitRootL2ProxyAddress, + bytecode: proxyGlobalExitRootL2Info.bytecode, + storage: proxyGlobalExitRootL2Info.storage, + }); + + // Timelock + const timelockInfo = await getAddressInfo(timelockContract.target); + + /* + * Since roles are used, most storage are writted in peusdoRandom storage slots + * bytes32 public constant TIMELOCK_ADMIN_ROLE = keccak256("TIMELOCK_ADMIN_ROLE"); + * bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE"); + * bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE"); + * bytes32 public constant CANCELLER_ROLE = keccak256("CANCELLER_ROLE"); + */ + const timelockRolesHash = [ + ethers.id("TIMELOCK_ADMIN_ROLE"), + ethers.id("PROPOSER_ROLE"), + ethers.id("EXECUTOR_ROLE"), + ethers.id("CANCELLER_ROLE"), + ]; + + for (let i = 0; i < timelockRolesHash.length; i++) { + const rolesMappingStoragePositionStruct = 0; + const storagePosition = ethers.solidityPackedKeccak256( + ["uint256", "uint256"], + [timelockRolesHash[i], rolesMappingStoragePositionStruct] + ); + + // check timelock address manager, and timelock address itself + const addressArray = [timelockAdminAddress, timelockContract.target]; + for (let j = 0; j < addressArray.length; j++) { + const storagePositionRole = ethers.solidityPackedKeccak256( + ["uint256", "uint256"], + [addressArray[j], storagePosition] + ); + const valueRole = await ethers.provider.getStorage(timelockContract.target, storagePositionRole); + if (valueRole !== "0x0000000000000000000000000000000000000000000000000000000000000000") { + timelockInfo.storage[storagePositionRole] = valueRole; + } + } + const roleAdminSlot = ethers.zeroPadValue(ethers.toQuantity(ethers.toBigInt(storagePosition) + 1n), 32); + const valueRoleAdminSlot = await ethers.provider.getStorage(timelockContract.target, roleAdminSlot); + if (valueRoleAdminSlot !== "0x0000000000000000000000000000000000000000000000000000000000000000") { + timelockInfo.storage[roleAdminSlot] = valueRoleAdminSlot; + } + } + + genesis.push({ + contractName: "PolygonZkEVMTimelock", + balance: "0", + nonce: timelockInfo.nonce.toString(), + address: finalTimelockContractAdress, + bytecode: timelockInfo.bytecode, + storage: timelockInfo.storage, + }); + + // Put nonces on deployers + + // Keyless deployer + genesis.push({ + accountName: "keyless Deployer", + balance: "0", + nonce: "1", + address: finalKeylessDeployer, + }); + + // deployer + const deployerInfo = await getAddressInfo(deployer.address); + genesis.push({ + accountName: "deployer", + balance: "0", + nonce: deployerInfo.nonce.toString(), + address: finalDeployer, + }); + + if (argv.test) { + // Add tester account with ether + genesis[genesis.length - 1].balance = "100000000000000000000000"; + } + + // calculate root + const poseidon = await getPoseidon(); + const {F} = poseidon; + const db = new MemDB(F); + const genesisRoot = [F.zero, F.zero, F.zero, F.zero]; + const accHashInput = [F.zero, F.zero, F.zero, F.zero]; + const defaultChainId = 1000; + + const zkEVMDB = await ZkEVMDB.newZkEVM( + db, + poseidon, + genesisRoot, + accHashInput, + genesis, + null, + null, + defaultChainId + ); + + fs.writeFileSync( + pathOutputJson, + JSON.stringify( + { + root: smtUtils.h4toString(zkEVMDB.stateRoot), + genesis, + }, + null, + 1 + ) + ); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); + +async function getAddressInfo(address: string | Addressable) { + const nonce = await ethers.provider.getTransactionCount(address); + const bytecode = await ethers.provider.getCode(address); + + const storage = {} as { + [key: string]: number | string; + }; + + for (let i = 0; i < 200; i++) { + const storageValue = await ethers.provider.getStorage(address, i); + if (storageValue !== "0x0000000000000000000000000000000000000000000000000000000000000000") { + storage[ethers.toBeHex(i, 32)] = storageValue; + } + } + + const valueAdminSlot = await ethers.provider.getStorage(address, _ADMIN_SLOT); + if (valueAdminSlot !== "0x0000000000000000000000000000000000000000000000000000000000000000") { + storage[_ADMIN_SLOT] = valueAdminSlot; + } + const valuImplementationSlot = await ethers.provider.getStorage(address, _IMPLEMENTATION_SLOT); + if (valuImplementationSlot !== "0x0000000000000000000000000000000000000000000000000000000000000000") { + storage[_IMPLEMENTATION_SLOT] = valuImplementationSlot; + } + + return {nonce, bytecode, storage}; +} diff --git a/deployment/v1ToV2/2_deployPolygonZKEVMDeployer.ts b/deployment/v1ToV2/2_deployPolygonZKEVMDeployer.ts new file mode 100644 index 000000000..620f82b71 --- /dev/null +++ b/deployment/v1ToV2/2_deployPolygonZKEVMDeployer.ts @@ -0,0 +1,93 @@ +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ +import {expect} from "chai"; +import path = require("path"); +import fs = require("fs"); + +import * as dotenv from "dotenv"; +dotenv.config({path: path.resolve(__dirname, "../../.env")}); +import {ethers, upgrades} from "hardhat"; +import {HardhatEthersSigner} from "@nomicfoundation/hardhat-ethers/signers"; + +import {deployPolygonZkEVMDeployer} from "../helpers/deployment-helpers"; +import "../helpers/utils"; + +const pathDeployParameters = path.join(__dirname, "./deploy_parameters.json"); +const deployParameters = require("./deploy_parameters.json"); + +async function main() { + // Load provider + let currentProvider = ethers.provider; + if (deployParameters.multiplierGas || deployParameters.maxFeePerGas) { + if (process.env.HARDHAT_NETWORK !== "hardhat") { + currentProvider = ethers.getDefaultProvider( + `https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}` + ) as any; + if (deployParameters.maxPriorityFeePerGas && deployParameters.maxFeePerGas) { + console.log( + `Hardcoded gas used: MaxPriority${deployParameters.maxPriorityFeePerGas} gwei, MaxFee${deployParameters.maxFeePerGas} gwei` + ); + const FEE_DATA = new ethers.FeeData( + null, + ethers.parseUnits(deployParameters.maxFeePerGas, "gwei"), + ethers.parseUnits(deployParameters.maxPriorityFeePerGas, "gwei") + ); + + currentProvider.getFeeData = async () => FEE_DATA; + } else { + console.log("Multiplier gas used: ", deployParameters.multiplierGas); + async function overrideFeeData() { + const feedata = await ethers.provider.getFeeData(); + return new ethers.FeeData( + null, + ((feedata.maxFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n, + ((feedata.maxPriorityFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n + ); + } + currentProvider.getFeeData = overrideFeeData; + } + } + } + + // Load deployer + let deployer; + if (deployParameters.deployerPvtKey) { + deployer = new ethers.Wallet(deployParameters.deployerPvtKey, currentProvider); + } else if (process.env.MNEMONIC) { + deployer = ethers.HDNodeWallet.fromMnemonic( + ethers.Mnemonic.fromPhrase(process.env.MNEMONIC), + "m/44'/60'/0'/0/0" + ).connect(currentProvider); + } else { + [deployer] = await ethers.getSigners(); + } + + // Load initialZkEVMDeployerOwner + const {initialZkEVMDeployerOwner} = deployParameters; + + if (initialZkEVMDeployerOwner === undefined || initialZkEVMDeployerOwner === "") { + throw new Error("Missing parameter: initialZkEVMDeployerOwner"); + } + + // Deploy PolygonZkEVMDeployer if is not deployed already using keyless deployment + const [zkEVMDeployerContract, keylessDeployer] = await deployPolygonZkEVMDeployer( + initialZkEVMDeployerOwner, + deployer as HardhatEthersSigner + ); + + if (keylessDeployer === ethers.ZeroAddress) { + console.log("#######################\n"); + console.log("polygonZkEVMDeployer already deployed on: ", zkEVMDeployerContract.target); + } else { + console.log("#######################\n"); + console.log("polygonZkEVMDeployer deployed on: ", zkEVMDeployerContract.target); + } + + deployParameters.zkEVMDeployerAddress = zkEVMDeployerContract.target; + fs.writeFileSync(pathDeployParameters, JSON.stringify(deployParameters, null, 1)); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/deployment/v1ToV2/3_deployContracts.ts b/deployment/v1ToV2/3_deployContracts.ts new file mode 100644 index 000000000..1d946bef6 --- /dev/null +++ b/deployment/v1ToV2/3_deployContracts.ts @@ -0,0 +1,607 @@ +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ +import {expect} from "chai"; +import path = require("path"); +import fs = require("fs"); + +import * as dotenv from "dotenv"; +dotenv.config({path: path.resolve(__dirname, "../../.env")}); +import {ethers, upgrades} from "hardhat"; + +const {create2Deployment} = require("../helpers/deployment-helpers"); + +const pathOutputJson = path.join(__dirname, "./deploy_output.json"); +const pathOngoingDeploymentJson = path.join(__dirname, "./deploy_ongoing.json"); + +const deployParameters = require("./deploy_parameters.json"); + +const pathOZUpgradability = path.join(__dirname, `../../.openzeppelin/${process.env.HARDHAT_NETWORK}.json`); +const genesis = require("./genesis.json"); + +import { + PolygonZkEVMBridgeV2, + PolygonZkEVMDeployer, + PolygonZkEVMGlobalExitRootV2, + PolygonZkEVMTimelock, + ProxyAdmin, +} from "../../typechain-types"; +import "../helpers/utils"; + +const DEFAULT_ADMIN_ROLE = ethers.ZeroHash; +const ADD_ROLLUP_TYPE_ROLE = ethers.id("ADD_ROLLUP_TYPE_ROLE"); +const OBSOLETE_ROLLUP_TYPE_ROLE = ethers.id("OBSOLETE_ROLLUP_TYPE_ROLE"); +const CREATE_ROLLUP_ROLE = ethers.id("CREATE_ROLLUP_ROLE"); +const ADD_EXISTING_ROLLUP_ROLE = ethers.id("ADD_EXISTING_ROLLUP_ROLE"); +const UPDATE_ROLLUP_ROLE = ethers.id("UPDATE_ROLLUP_ROLE"); +const TRUSTED_AGGREGATOR_ROLE = ethers.id("TRUSTED_AGGREGATOR_ROLE"); +const TRUSTED_AGGREGATOR_ROLE_ADMIN = ethers.id("TRUSTED_AGGREGATOR_ROLE_ADMIN"); +const TWEAK_PARAMETERS_ROLE = ethers.id("TWEAK_PARAMETERS_ROLE"); +const SET_FEE_ROLE = ethers.id("SET_FEE_ROLE"); +const STOP_EMERGENCY_ROLE = ethers.id("STOP_EMERGENCY_ROLE"); +const EMERGENCY_COUNCIL_ROLE = ethers.id("EMERGENCY_COUNCIL_ROLE"); +const EMERGENCY_COUNCIL_ADMIN = ethers.id("EMERGENCY_COUNCIL_ADMIN"); + +async function main() { + // Check that there's no previous OZ deployment + if (fs.existsSync(pathOZUpgradability)) { + throw new Error( + `There's upgradability information from previous deployments, it's mandatory to erase them before start a new one, path: ${pathOZUpgradability}` + ); + } + + // Check if there's an ongoing deployment + let ongoingDeployment = {} as any; + if (fs.existsSync(pathOngoingDeploymentJson)) { + console.log("WARNING: using ongoing deployment"); + ongoingDeployment = require(pathOngoingDeploymentJson); + } + + // Constant variables + const networkIDMainnet = 0; + + // Gas token variables are 0 in mainnet, since native token it's ether + const gasTokenAddressMainnet = ethers.ZeroAddress; + const gasTokenNetworkMainnet = 0n; + const attemptsDeployProxy = 20; + const gasTokenMetadata = "0x"; + + /* + * Check deploy parameters + * Check that every necessary parameter is fullfilled + */ + const mandatoryDeploymentParameters = [ + "timelockAdminAddress", + "minDelayTimelock", + "salt", + "admin", + "trustedAggregator", + "trustedAggregatorTimeout", + "pendingStateTimeout", + "emergencyCouncilAddress", + "zkEVMDeployerAddress", + "polTokenAddress", + "realVerifier", + "trustedSequencerURL", + "networkName", + "description", + "trustedSequencer", + "chainID", + "adminZkEVM", + "forkID", + "version", + ]; + + for (const parameterName of mandatoryDeploymentParameters) { + if (deployParameters[parameterName] === undefined || deployParameters[parameterName] === "") { + throw new Error(`Missing parameter: ${parameterName}`); + } + } + + const { + timelockAdminAddress, + minDelayTimelock, + salt, + admin, + trustedAggregator, + trustedAggregatorTimeout, + pendingStateTimeout, + emergencyCouncilAddress, + zkEVMDeployerAddress, + polTokenAddress, + realVerifier, + trustedSequencerURL, + networkName, + description, + trustedSequencer, + chainID, + adminZkEVM, + forkID, + version, + } = deployParameters; + + // Load provider + let currentProvider = ethers.provider; + if (deployParameters.multiplierGas || deployParameters.maxFeePerGas) { + if (process.env.HARDHAT_NETWORK !== "hardhat") { + currentProvider = ethers.getDefaultProvider( + `https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}` + ) as any; + if (deployParameters.maxPriorityFeePerGas && deployParameters.maxFeePerGas) { + console.log( + `Hardcoded gas used: MaxPriority${deployParameters.maxPriorityFeePerGas} gwei, MaxFee${deployParameters.maxFeePerGas} gwei` + ); + const FEE_DATA = new ethers.FeeData( + null, + ethers.parseUnits(deployParameters.maxFeePerGas, "gwei"), + ethers.parseUnits(deployParameters.maxPriorityFeePerGas, "gwei") + ); + + currentProvider.getFeeData = async () => FEE_DATA; + } else { + console.log("Multiplier gas used: ", deployParameters.multiplierGas); + async function overrideFeeData() { + const feedata = await ethers.provider.getFeeData(); + return new ethers.FeeData( + null, + ((feedata.maxFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n, + ((feedata.maxPriorityFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n + ); + } + currentProvider.getFeeData = overrideFeeData; + } + } + } + + // Load deployer + let deployer; + if (deployParameters.deployerPvtKey) { + deployer = new ethers.Wallet(deployParameters.deployerPvtKey, currentProvider); + } else if (process.env.MNEMONIC) { + deployer = ethers.HDNodeWallet.fromMnemonic( + ethers.Mnemonic.fromPhrase(process.env.MNEMONIC), + "m/44'/60'/0'/0/0" + ).connect(currentProvider); + } else { + [deployer] = await ethers.getSigners(); + } + + // Load zkEVM deployer + const PolgonZKEVMDeployerFactory = await ethers.getContractFactory("PolygonZkEVMDeployer", deployer); + const zkEVMDeployerContract = PolgonZKEVMDeployerFactory.attach(zkEVMDeployerAddress) as PolygonZkEVMDeployer; + + // check deployer is the owner of the deployer + if ((await deployer.provider?.getCode(zkEVMDeployerContract.target)) === "0x") { + throw new Error("zkEVM deployer contract is not deployed"); + } + expect(deployer.address).to.be.equal(await zkEVMDeployerContract.owner()); + + // deploy veriferi + let verifierContract; + if (realVerifier === true) { + const VerifierRollup = await ethers.getContractFactory("FflonkVerifier", deployer); + verifierContract = await VerifierRollup.deploy(); + await verifierContract.waitForDeployment(); + } else { + const VerifierRollupHelperFactory = await ethers.getContractFactory("VerifierRollupHelperMock", deployer); + verifierContract = await VerifierRollupHelperFactory.deploy(); + await verifierContract.waitForDeployment(); + } + console.log("#######################\n"); + console.log("Verifier deployed to:", verifierContract.target); + + /* + * Deploy Bridge + * Deploy admin --> implementation --> proxy + */ + + // Deploy proxy admin: + const proxyAdminFactory = await ethers.getContractFactory( + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol:ProxyAdmin", + deployer + ); + const deployTransactionAdmin = (await proxyAdminFactory.getDeployTransaction()).data; + const dataCallAdmin = proxyAdminFactory.interface.encodeFunctionData("transferOwnership", [deployer.address]); + const [proxyAdminAddress, isProxyAdminDeployed] = await create2Deployment( + zkEVMDeployerContract, + salt, + deployTransactionAdmin, + dataCallAdmin, + deployer + ); + + if (isProxyAdminDeployed) { + console.log("#######################\n"); + console.log("Proxy admin deployed to:", proxyAdminAddress); + } else { + console.log("#######################\n"); + console.log("Proxy admin was already deployed to:", proxyAdminAddress); + } + + const proxyAdminInstance = proxyAdminFactory.attach(proxyAdminAddress) as ProxyAdmin; + const proxyAdminOwner = await proxyAdminInstance.owner(); + if (proxyAdminOwner !== deployer.address) { + throw new Error( + `Proxy admin was deployed, but the owner is not the deployer, deployer address: ${deployer.address}, proxyAdmin: ${proxyAdminOwner}` + ); + } + + // Deploy implementation PolygonZkEVMBridge + const polygonZkEVMBridgeFactory = await ethers.getContractFactory("PolygonZkEVMBridgeV2", deployer); + const deployTransactionBridge = (await polygonZkEVMBridgeFactory.getDeployTransaction()).data; + const dataCallNull = null; + // Mandatory to override the gasLimit since the estimation with create are mess up D: + const overrideGasLimit = 5500000n; + const [bridgeImplementationAddress, isBridgeImplDeployed] = await create2Deployment( + zkEVMDeployerContract, + salt, + deployTransactionBridge, + dataCallNull, + deployer, + overrideGasLimit + ); + + if (isBridgeImplDeployed) { + console.log("#######################\n"); + console.log("bridge impl deployed to:", bridgeImplementationAddress); + } else { + console.log("#######################\n"); + console.log("bridge impl was already deployed to:", bridgeImplementationAddress); + } + + let precalculateGlobalExitRootAddress; + let precalculateZkevmAddress; + let timelockContract; + + const timelockContractFactory = await ethers.getContractFactory("PolygonZkEVMTimelock", deployer); + + // Check if the contract is already deployed + if ( + ongoingDeployment.polygonZkEVMGlobalExitRoot && + ongoingDeployment.polygonZkEVMContract && + ongoingDeployment.polygonTimelock + ) { + precalculateGlobalExitRootAddress = ongoingDeployment.polygonZkEVMGlobalExitRoot; + precalculateZkevmAddress = ongoingDeployment.polygonZkEVMContract; + timelockContract = timelockContractFactory.attach(ongoingDeployment.polygonTimelock) as PolygonZkEVMTimelock; + } else { + // If both are not deployed, it's better to deploy them both again + delete ongoingDeployment.polygonZkEVMGlobalExitRoot; + delete ongoingDeployment.polygonZkEVMContract; + delete ongoingDeployment.polygonTimelock; + fs.writeFileSync(pathOngoingDeploymentJson, JSON.stringify(ongoingDeployment, null, 1)); + + // Nonce globalExitRoot: currentNonce + 1 (deploy bridge proxy) + 1(impl globalExitRoot) + // + 1 (deployTimelock) = +3 + const nonceProxyGlobalExitRoot = Number(await ethers.provider.getTransactionCount(deployer.address)) + 3; + // nonceProxyRollupManager :Nonce globalExitRoot + 1 (proxy globalExitRoot) + 1 (impl zkEVM) = +2 + const nonceProxyZkevm = nonceProxyGlobalExitRoot + 2; + + // Contracts are not deployed, normal deployment + precalculateGlobalExitRootAddress = ethers.getCreateAddress({ + from: deployer.address, + nonce: nonceProxyGlobalExitRoot, + }); + precalculateZkevmAddress = ethers.getCreateAddress({from: deployer.address, nonce: nonceProxyZkevm}); + + // deploy timelock + console.log("\n#######################"); + console.log("##### Deployment TimelockContract #####"); + console.log("#######################"); + console.log("minDelayTimelock:", minDelayTimelock); + console.log("timelockAdminAddress:", timelockAdminAddress); + console.log("Rollup Manager:", precalculateZkevmAddress); + timelockContract = await timelockContractFactory.deploy( + minDelayTimelock, + [timelockAdminAddress], + [timelockAdminAddress], + timelockAdminAddress, + precalculateZkevmAddress + ); + await timelockContract.waitForDeployment(); + console.log("#######################\n"); + console.log("Polygon timelockContract deployed to:", timelockContract.target); + } + + console.log("\n#######################"); + console.log("##### Checks TimelockContract #####"); + console.log("#######################"); + //console.log("minDelayTimelock:", await timelockContract.getMinDelay()); + console.log("polygonZkEVM:", await timelockContract.polygonZkEVM()); + + /* + * deploy proxy + * Do not initialize directly the proxy since we want to deploy the same code on L2 and this will alter the bytecode deployed of the proxy + */ + const transparentProxyFactory = await ethers.getContractFactory( + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol:TransparentUpgradeableProxy", + deployer + ); + const initializeEmptyDataProxy = "0x"; + const deployTransactionProxy = ( + await transparentProxyFactory.getDeployTransaction( + bridgeImplementationAddress, + proxyAdminAddress, + initializeEmptyDataProxy + ) + ).data; + + const dataCallProxy = polygonZkEVMBridgeFactory.interface.encodeFunctionData("initialize", [ + networkIDMainnet, + gasTokenAddressMainnet, + gasTokenNetworkMainnet, + precalculateGlobalExitRootAddress, + precalculateZkevmAddress, + gasTokenMetadata, + ]); + + const [proxyBridgeAddress, isBridgeProxyDeployed] = await create2Deployment( + zkEVMDeployerContract, + salt, + deployTransactionProxy, + dataCallProxy, + deployer + ); + const polygonZkEVMBridgeContract = polygonZkEVMBridgeFactory.attach(proxyBridgeAddress) as PolygonZkEVMBridgeV2; + + if (isBridgeProxyDeployed) { + console.log("#######################\n"); + console.log("PolygonZkEVMBridge deployed to:", polygonZkEVMBridgeContract.target); + } else { + console.log("#######################\n"); + console.log("PolygonZkEVMBridge was already deployed to:", polygonZkEVMBridgeContract.target); + + // If it was already deployed, check that the initialized calldata matches the actual deployment + expect(precalculateGlobalExitRootAddress).to.be.equal(await polygonZkEVMBridgeContract.globalExitRootManager()); + expect(precalculateZkevmAddress).to.be.equal(await polygonZkEVMBridgeContract.polygonRollupManager()); + } + + console.log("\n#######################"); + console.log("##### Checks PolygonZkEVMBridge #####"); + console.log("#######################"); + console.log("PolygonZkEVMGlobalExitRootAddress:", await polygonZkEVMBridgeContract.globalExitRootManager()); + console.log("networkID:", await polygonZkEVMBridgeContract.networkID()); + console.log("zkEVMaddress:", await polygonZkEVMBridgeContract.polygonRollupManager()); + + // Import OZ manifest the deployed contracts, its enough to import just the proxy, the rest are imported automatically (admin/impl) + await upgrades.forceImport(proxyBridgeAddress, polygonZkEVMBridgeFactory, "transparent" as any); + + /* + *Deployment Global exit root manager + */ + let polygonZkEVMGlobalExitRoot; + const PolygonZkEVMGlobalExitRootFactory = await ethers.getContractFactory("PolygonZkEVMGlobalExitRootV2", deployer); + if (!ongoingDeployment.polygonZkEVMGlobalExitRoot) { + for (let i = 0; i < attemptsDeployProxy; i++) { + try { + polygonZkEVMGlobalExitRoot = await upgrades.deployProxy(PolygonZkEVMGlobalExitRootFactory, [], { + initializer: false, + constructorArgs: [precalculateZkevmAddress, proxyBridgeAddress], + unsafeAllow: ["constructor", "state-variable-immutable"], + }); + break; + } catch (error: any) { + console.log(`attempt ${i}`); + console.log("upgrades.deployProxy of polygonZkEVMGlobalExitRoot ", error.message); + } + + // reach limits of attempts + if (i + 1 === attemptsDeployProxy) { + throw new Error("polygonZkEVMGlobalExitRoot contract has not been deployed"); + } + } + + expect(precalculateGlobalExitRootAddress).to.be.equal(polygonZkEVMGlobalExitRoot?.target); + + console.log("#######################\n"); + console.log("polygonZkEVMGlobalExitRoot deployed to:", polygonZkEVMGlobalExitRoot?.target); + + // save an ongoing deployment + ongoingDeployment.polygonZkEVMGlobalExitRoot = polygonZkEVMGlobalExitRoot?.target; + fs.writeFileSync(pathOngoingDeploymentJson, JSON.stringify(ongoingDeployment, null, 1)); + } else { + // sanity check + expect(precalculateGlobalExitRootAddress).to.be.equal(ongoingDeployment.polygonZkEVMGlobalExitRoot); + + // Expect the precalculate address matches de onogin deployment + polygonZkEVMGlobalExitRoot = PolygonZkEVMGlobalExitRootFactory.attach( + ongoingDeployment.polygonZkEVMGlobalExitRoot + ) as PolygonZkEVMGlobalExitRootV2; + + console.log("#######################\n"); + console.log("polygonZkEVMGlobalExitRoot already deployed on: ", ongoingDeployment.polygonZkEVMGlobalExitRoot); + + // Import OZ manifest the deployed contracts, its enough to import just the proyx, the rest are imported automatically (admin/impl) + await upgrades.forceImport( + ongoingDeployment.polygonZkEVMGlobalExitRoot, + PolygonZkEVMGlobalExitRootFactory, + "transparent" as any + ); + + // Check against current deployment + expect(polygonZkEVMBridgeContract.target).to.be.equal(await polygonZkEVMGlobalExitRoot.bridgeAddress()); + expect(precalculateZkevmAddress).to.be.equal(await polygonZkEVMGlobalExitRoot.rollupManager()); + } + + // deploy zkEVM + console.log("\n#######################"); + console.log("##### Deployment Polygon ZK-EVM #####"); + console.log("#######################"); + console.log("deployer:", deployer.address); + console.log("PolygonZkEVMGlobalExitRootAddress:", polygonZkEVMGlobalExitRoot?.target); + console.log("polTokenAddress:", polTokenAddress); + console.log("verifierAddress:", verifierContract.target); + console.log("polygonZkEVMBridgeContract:", polygonZkEVMBridgeContract.target); + + console.log("trustedAggregator:", trustedAggregator); + console.log("pendingStateTimeout:", pendingStateTimeout); + console.log("trustedAggregatorTimeout:", trustedAggregatorTimeout); + console.log("admin:", adminZkEVM); + console.log("chainID:", chainID); + console.log("trustedSequencer:", trustedSequencer); + + console.log("genesisRoot:", genesis.root); + console.log("trustedSequencerURL:", trustedSequencerURL); + console.log("networkName:", networkName); + console.log("forkID:", forkID); + console.log("emergencyCouncilAddress:", emergencyCouncilAddress); + + const PolygonZkEVMFactory = await ethers.getContractFactory("PolygonZkEVM", deployer); + + let polygonZkEVMContract: any; + let deploymentBlockNumber; + + if (!ongoingDeployment.polygonZkEVMContract) { + for (let i = 0; i < attemptsDeployProxy; i++) { + try { + polygonZkEVMContract = await upgrades.deployProxy( + PolygonZkEVMFactory, + [ + { + admin: adminZkEVM, + trustedSequencer: trustedSequencer, + pendingStateTimeout: pendingStateTimeout, + trustedAggregator: trustedAggregator, + trustedAggregatorTimeout: trustedAggregatorTimeout, + }, + genesis.root, + trustedSequencerURL, + networkName, + version, + ], + { + constructorArgs: [ + polygonZkEVMGlobalExitRoot?.target, + polTokenAddress, + verifierContract.target, + polygonZkEVMBridgeContract.target, + chainID, + forkID, + ], + unsafeAllow: ["constructor", "state-variable-immutable"], + } + ); + + break; + } catch (error: any) { + console.log(`attempt ${i}`); + console.log("upgrades.deployProxy of polygonZkEVMContract ", error.message); + } + + // reach limits of attempts + if (i + 1 === attemptsDeployProxy) { + throw new Error("PolygonZkEVM contract has not been deployed"); + } + } + + expect(precalculateZkevmAddress).to.be.equal(polygonZkEVMContract?.target); + + console.log("#######################\n"); + console.log("polygonZkEVMContract deployed to:", polygonZkEVMContract?.target); + + // save an ongoing deployment + ongoingDeployment.polygonZkEVMContract = polygonZkEVMContract?.target; + fs.writeFileSync(pathOngoingDeploymentJson, JSON.stringify(ongoingDeployment, null, 1)); + deploymentBlockNumber = (await polygonZkEVMContract?.deploymentTransaction().wait()).blockNumber; + } else { + // Expect the precalculate address matches de onogin deployment, sanity check + expect(precalculateZkevmAddress).to.be.equal(ongoingDeployment.polygonZkEVMContract); + polygonZkEVMContract = PolygonZkEVMFactory.attach(ongoingDeployment.polygonZkEVMContract); + + console.log("#######################\n"); + console.log("polygonZkEVMContract already deployed on: ", ongoingDeployment.polygonZkEVMContract); + + // Import OZ manifest the deployed contracts, its enough to import just the proyx, the rest are imported automatically ( admin/impl) + await upgrades.forceImport(ongoingDeployment.polygonZkEVMContract, PolygonZkEVMFactory, "transparent" as any); + + deploymentBlockNumber = 0; + } + + console.log("\n#######################"); + console.log("##### Checks PolygonZkEVM #####"); + console.log("#######################"); + console.log("PolygonZkEVMGlobalExitRootAddress:", await polygonZkEVMContract.globalExitRootManager()); + console.log("polTokenAddres:", await polygonZkEVMContract.matic()); + console.log("verifierAddress:", await polygonZkEVMContract.rollupVerifier()); + console.log("polygonZkEVMBridgeContract:", await polygonZkEVMContract.bridgeAddress()); + + console.log("admin:", await polygonZkEVMContract.admin()); + console.log("chainID:", await polygonZkEVMContract.chainID()); + console.log("trustedSequencer:", await polygonZkEVMContract.trustedSequencer()); + console.log("pendingStateTimeout:", await polygonZkEVMContract.pendingStateTimeout()); + console.log("trustedAggregator:", await polygonZkEVMContract.trustedAggregator()); + console.log("trustedAggregatorTimeout:", await polygonZkEVMContract.trustedAggregatorTimeout()); + + console.log("genesiRoot:", await polygonZkEVMContract.batchNumToStateRoot(0)); + console.log("trustedSequencerURL:", await polygonZkEVMContract.trustedSequencerURL()); + console.log("networkName:", await polygonZkEVMContract.networkName()); + console.log("owner:", await polygonZkEVMContract.owner()); + console.log("forkID:", await polygonZkEVMContract.forkID()); + + // Assert admin address + expect(await upgrades.erc1967.getAdminAddress(precalculateZkevmAddress)).to.be.equal(proxyAdminAddress); + expect(await upgrades.erc1967.getAdminAddress(precalculateGlobalExitRootAddress)).to.be.equal(proxyAdminAddress); + expect(await upgrades.erc1967.getAdminAddress(proxyBridgeAddress)).to.be.equal(proxyAdminAddress); + + // Update current system to rollup manager + + const PolygonZkEVMV2ExistentFactory = await ethers.getContractFactory("PolygonZkEVMV2Existent"); + + const newPolygonZkEVMContract = (await upgrades.deployProxy(PolygonZkEVMV2ExistentFactory, [], { + initializer: false, + constructorArgs: [ + polygonZkEVMGlobalExitRoot?.target, + polTokenAddress, + polygonZkEVMBridgeContract.target, + polygonZkEVMContract.target, + ], + unsafeAllow: ["constructor", "state-variable-immutable"], + })) as any; + + const PolygonRollupManagerFactory = await ethers.getContractFactory("PolygonRollupManager"); + const txRollupManager = await upgrades.upgradeProxy(polygonZkEVMContract.target, PolygonRollupManagerFactory, { + constructorArgs: [polygonZkEVMGlobalExitRoot?.target, polTokenAddress, polygonZkEVMBridgeContract.target], + unsafeAllow: ["constructor", "state-variable-immutable"], + unsafeAllowRenames: false, + call: { + fn: "initialize", + args: [ + trustedAggregator, + pendingStateTimeout, + trustedAggregatorTimeout, + admin, + timelockAdminAddress, + emergencyCouncilAddress, + newPolygonZkEVMContract.target, + verifierContract.target, + ], + }, + }); + await txRollupManager.waitForDeployment(); + + // Transfer ownership of the proxyAdmin to timelock + await (await proxyAdminInstance.transferOwnership(timelockContract.target)).wait(); + + const outputJson = { + polygonRollupManager: polygonZkEVMContract.target, + polygonZkEVMBridgeAddress: polygonZkEVMBridgeContract.target, + polygonZkEVMGlobalExitRootAddress: polygonZkEVMGlobalExitRoot?.target, + polTokenAddress, + zkEVMDeployerContract: zkEVMDeployerContract.target, + deployerAddress: deployer.address, + timelockContractAddress: timelockContract.target, + deploymentBlockNumber, + admin, + trustedAggregator, + proxyAdminAddress, + salt, + }; + fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); + + // Remove ongoing deployment + fs.unlinkSync(pathOngoingDeploymentJson); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/deployment/v1ToV2/4_createRollup.ts b/deployment/v1ToV2/4_createRollup.ts new file mode 100644 index 000000000..dbc830ca5 --- /dev/null +++ b/deployment/v1ToV2/4_createRollup.ts @@ -0,0 +1,307 @@ +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ +import {expect} from "chai"; +import path = require("path"); +import fs = require("fs"); + +import * as dotenv from "dotenv"; +dotenv.config({path: path.resolve(__dirname, "../../.env")}); +import {ethers, upgrades} from "hardhat"; +import {HardhatEthersSigner} from "@nomicfoundation/hardhat-ethers/signers"; +const {create2Deployment} = require("../helpers/deployment-helpers"); + +const pathGenesis = path.join(__dirname, "./genesis.json"); + +const createRollupParameters = require("./create_rollup_parameters.json"); +const genesis = require("./genesis.json"); +const deployOutput = require("./deploy_output.json"); +import "../helpers/utils"; + +const pathOutputJson = path.join(__dirname, "./create_rollup_output.json"); + +import {PolygonRollupManager, PolygonZkEVMV2, PolygonZkEVMBridgeV2} from "../../typechain-types"; + +async function main() { + const attemptsDeployProxy = 20; + + const outputJson = {} as any; + + /* + * Check deploy parameters + * Check that every necessary parameter is fullfilled + */ + const mandatoryDeploymentParameters = [ + "realVerifier", + "trustedSequencerURL", + "networkName", + "description", + "trustedSequencer", + "chainID", + "adminZkEVM", + "forkID", + "consensusContract", + ]; + + for (const parameterName of mandatoryDeploymentParameters) { + if (createRollupParameters[parameterName] === undefined || createRollupParameters[parameterName] === "") { + throw new Error(`Missing parameter: ${parameterName}`); + } + } + + const { + realVerifier, + trustedSequencerURL, + networkName, + description, + trustedSequencer, + chainID, + adminZkEVM, + forkID, + consensusContract, + } = createRollupParameters; + + const supportedConensus = [ + "PolygonZkEVMEtrog", + "PolygonZkEVMV2", + "PolygonDataComittee", + "PolygonDataComitteeEtrog", + ]; + + if (!supportedConensus.includes(consensusContract)) { + throw new Error(`Consensus contract not supported, supported contracts are: ${supportedConensus}`); + } + + // Load provider + let currentProvider = ethers.provider; + if (createRollupParameters.multiplierGas || createRollupParameters.maxFeePerGas) { + if (process.env.HARDHAT_NETWORK !== "hardhat") { + currentProvider = ethers.getDefaultProvider( + `https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}` + ) as any; + if (createRollupParameters.maxPriorityFeePerGas && createRollupParameters.maxFeePerGas) { + console.log( + `Hardcoded gas used: MaxPriority${createRollupParameters.maxPriorityFeePerGas} gwei, MaxFee${createRollupParameters.maxFeePerGas} gwei` + ); + const FEE_DATA = new ethers.FeeData( + null, + ethers.parseUnits(createRollupParameters.maxFeePerGas, "gwei"), + ethers.parseUnits(createRollupParameters.maxPriorityFeePerGas, "gwei") + ); + + currentProvider.getFeeData = async () => FEE_DATA; + } else { + console.log("Multiplier gas used: ", createRollupParameters.multiplierGas); + async function overrideFeeData() { + const feedata = await ethers.provider.getFeeData(); + return new ethers.FeeData( + null, + ((feedata.maxFeePerGas as bigint) * BigInt(createRollupParameters.multiplierGas)) / 1000n, + ((feedata.maxPriorityFeePerGas as bigint) * BigInt(createRollupParameters.multiplierGas)) / + 1000n + ); + } + currentProvider.getFeeData = overrideFeeData; + } + } + } + + // Load deployer + let deployer; + if (createRollupParameters.deployerPvtKey) { + deployer = new ethers.Wallet(createRollupParameters.deployerPvtKey, currentProvider); + } else if (process.env.MNEMONIC) { + deployer = ethers.HDNodeWallet.fromMnemonic( + ethers.Mnemonic.fromPhrase(process.env.MNEMONIC), + "m/44'/60'/0'/0/0" + ).connect(currentProvider); + } else { + [deployer] = await ethers.getSigners(); + } + + // Load Rollup manager + const PolgonRollupManagerFactory = await ethers.getContractFactory("PolygonRollupManager", deployer); + const rollupManagerContract = PolgonRollupManagerFactory.attach( + deployOutput.polygonRollupManager + ) as PolygonRollupManager; + + let verifierContract; + if (realVerifier === true) { + const VerifierRollup = await ethers.getContractFactory("FflonkVerifier", deployer); + verifierContract = await VerifierRollup.deploy(); + await verifierContract.waitForDeployment(); + } else { + const VerifierRollupHelperFactory = await ethers.getContractFactory("VerifierRollupHelperMock", deployer); + verifierContract = await VerifierRollupHelperFactory.deploy(); + await verifierContract.waitForDeployment(); + } + console.log("#######################\n"); + console.log("Verifier deployed to:", verifierContract.target); + + // Since it's a mock deployment deployer has all the rights + const ADD_ROLLUP_TYPE_ROLE = ethers.id("ADD_ROLLUP_TYPE_ROLE"); + const CREATE_ROLLUP_ROLE = ethers.id("CREATE_ROLLUP_ROLE"); + + // Check role: + if ((await rollupManagerContract.hasRole(ADD_ROLLUP_TYPE_ROLE, deployer.address)) == false) + await rollupManagerContract.grantRole(ADD_ROLLUP_TYPE_ROLE, deployer.address); + + if ((await rollupManagerContract.hasRole(CREATE_ROLLUP_ROLE, deployer.address)) == false) + await rollupManagerContract.grantRole(CREATE_ROLLUP_ROLE, deployer.address); + + // Create consensus implementation + const PolygonconsensusFactory = (await ethers.getContractFactory(consensusContract, deployer)) as any; + let PolygonconsensusContract; + + PolygonconsensusContract = await PolygonconsensusFactory.deploy( + deployOutput.polygonZkEVMGlobalExitRootAddress, + deployOutput.polTokenAddress, + deployOutput.polygonZkEVMBridgeAddress, + deployOutput.polygonRollupManager + ); + await PolygonconsensusContract.waitForDeployment(); + + if (consensusContract.includes("DataComittee")) { + // deploy data commitee + const PolygonDataComittee = (await ethers.getContractFactory("CDKDataCommittee", deployer)) as any; + let polygonDataComitteeContract; + + for (let i = 0; i < attemptsDeployProxy; i++) { + try { + polygonDataComitteeContract = await upgrades.deployProxy(PolygonDataComittee, []); + break; + } catch (error: any) { + console.log(`attempt ${i}`); + console.log("upgrades.deployProxy of polygonDataComitteeContract ", error.message); + } + // reach limits of attempts + if (i + 1 === attemptsDeployProxy) { + throw new Error("polygonDataComitteeContract contract has not been deployed"); + } + } + // add data commitee to the consensus contract + if ((await PolygonconsensusContract.admin()) == deployer.address) { + await (await PolygonconsensusContract.setDataCommittee(polygonDataComitteeContract?.target)).wait(); + } + + outputJson.polygonDataComitteeContract = polygonDataComitteeContract?.target; + } + + // Add a new rollup type with timelock + const rollupCompatibilityID = 0; + await ( + await rollupManagerContract.addNewRollupType( + PolygonconsensusContract.target, + verifierContract.target, + forkID, + rollupCompatibilityID, + genesis.root, + description + ) + ).wait(); + + console.log("#######################\n"); + console.log("Added new Rollup Type deployed"); + const newRollupTypeID = await rollupManagerContract.rollupTypeCount(); + + let gasTokenAddress, gasTokenNetwork, gasTokenMetadata; + + if ( + createRollupParameters.gasTokenAddress && + createRollupParameters.gasTokenAddress != "" && + createRollupParameters.gasTokenAddress != ethers.ZeroAddress + ) { + // Get bridge instance + const bridgeFactory = await ethers.getContractFactory("PolygonZkEVMBridgeV2", deployer); + const polygonZkEVMBridgeContract = bridgeFactory.attach( + deployOutput.polygonZkEVMBridgeAddress + ) as PolygonZkEVMBridgeV2; + + // Get token metadata + gasTokenMetadata = await polygonZkEVMBridgeContract.getTokenMetadata(createRollupParameters.gasTokenAddress); + + const wrappedData = await polygonZkEVMBridgeContract.wrappedTokenToTokenInfo( + createRollupParameters.gasTokenAddress + ); + if (wrappedData.originNetwork != 0n) { + // Wrapped token + gasTokenAddress = wrappedData.originTokenAddress; + gasTokenNetwork = wrappedData.originNetwork; + } else { + // Mainnet token + gasTokenAddress = createRollupParameters.gasTokenAddress; + gasTokenNetwork = 0n; + } + } else { + gasTokenAddress = ethers.ZeroAddress; + gasTokenNetwork = 0; + gasTokenMetadata = "0x"; + } + + const newZKEVMAddress = ethers.getCreateAddress({ + from: rollupManagerContract.target as string, + nonce: await currentProvider.getTransactionCount(rollupManagerContract.target), + }); + + // Create new rollup + const txDeployRollup = await rollupManagerContract.createNewRollup( + newRollupTypeID, + chainID, + adminZkEVM, + trustedSequencer, + gasTokenAddress, + trustedSequencerURL, + networkName + ); + + const receipt = (await txDeployRollup.wait()) as any; + const blockDeploymentRollup = await receipt?.getBlock(); + const timestampReceipt = blockDeploymentRollup.timestamp; + const rollupID = await rollupManagerContract.chainIDToRollupID(chainID); + + console.log("#######################\n"); + console.log("Created new Rollup:", newZKEVMAddress); + + // Assert admin address + expect(await upgrades.erc1967.getAdminAddress(newZKEVMAddress)).to.be.equal(rollupManagerContract.target); + expect(await upgrades.erc1967.getImplementationAddress(newZKEVMAddress)).to.be.equal( + PolygonconsensusContract.target + ); + + // Search added global exit root on the logs + let globalExitRoot; + for (const log of receipt?.logs) { + if (log.address == newZKEVMAddress) { + const parsedLog = PolygonconsensusFactory.interface.parseLog(log); + if (parsedLog != null && parsedLog.name == "InitialSequenceBatches") { + globalExitRoot = parsedLog.args.lastGlobalExitRoot; + } + } + } + + // Add the first batch of the created rollup + const newZKEVMContract = (await PolygonconsensusFactory.attach(newZKEVMAddress)) as PolygonZkEVMV2; + const batchData = { + transactions: await newZKEVMContract.generateInitializeTransaction( + rollupID, + gasTokenAddress, + gasTokenNetwork, + gasTokenMetadata as any + ), + globalExitRoot: globalExitRoot, + timestamp: timestampReceipt, + sequencer: trustedSequencer, + }; + + outputJson.firstBatchData = batchData; + outputJson.genesis = genesis.root; + outputJson.createRollupBlock = blockDeploymentRollup.number; + outputJson.rollupAddress = newZKEVMAddress; + outputJson.verifierAddress = verifierContract.target; + + fs.writeFileSync(pathOutputJson, JSON.stringify(outputJson, null, 1)); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/deployment/v1ToV2/README.md b/deployment/v1ToV2/README.md new file mode 100644 index 000000000..0f8a9a5f7 --- /dev/null +++ b/deployment/v1ToV2/README.md @@ -0,0 +1,54 @@ +## Important note + +This is just a test deployment to test the upgradability between previous and new systems from the node prespective + +## Requirements + +- node version: 14.x +- npm version: 7.x + +## Usage + +``` +cd deployment +cp deploy_parameters.json.example deploy_parameters.json +``` + +Fill created `deploy_parameters.json` with appropiate parameters. +See below for more information about the `deploy_parameters.json` + +``` +deploy:testnet:v1ToV2:localhost +``` + +## deploy-parameters.json + +- `timelockAdminAddress`: address, Timelock owner address, able to send start an upgradability process via timelock +- `minDelayTimelock`: number, Minimum timelock delay, +- `salt`: bytes32, Salt used in `PolygonZkEVMDeployer` to deploy deterministic contracts, such as the PolygonZkEVMBridge +- `initialZkEVMDeployerOwner`: address, Initial owner of the `PolygonZkEVMDeployer` +- `admin`:address, Admin address, can adjust RollupManager parameters or stop the emergency state +- `trustedAggregator`:address, Trusted aggregator address +- `trustedAggregatorTimeout`: uint64, If a sequence is not verified in this timeout everyone can verify it +- `pendingStateTimeout`: uint64, Once a pending state exceeds this timeout it can be consolidated +- `emergencyCouncilAddress`:address, Emergency council addres +- `polTokenAddress`: address, Matic token address, only if deploy on testnet can be left blank and will fullfilled by the scripts. +- `zkEVMDeployerAddress`: address, Address of the `PolygonZkEVMDeployer`. Can be left blank, will be fullfilled automatically with the `deploy:deployer:ZkEVM:goerli` script. + +- `realVerifier`: bool, Indicates whether deploy a real verifier or not for the new created +- `trustedSequencerURL`: string, trustedSequencer URL +- `networkName`: string, networkName +- `description`:string, Description of the new rollup type +- `trustedSequencer`: address, trusted sequencer addresss +- `chainID`: uint64, chainID of the new rollup +- `adminZkEVM`:address, Admin address, can adjust Rollup parameters +- `forkID`: uint64, Fork ID of the new rollup, indicates the prover (zkROM/executor) version +- `consensusContract`: string, Consensus contract name of the new rollup deployed, current options are: "PolygonZkEVMEtrog","PolygonZkEVMV2","PolygonDataComittee", "PolygonDataComitteeEtrog", +- `gasTokenAddress`:address, Gas token address, empty or address(0) for ether + +### Optional Parameters + +- `deployerPvtKey`: string, pvtKey of the deployer, overrides the address in `MNEMONIC` of `.env` if exist +- `maxFeePerGas`:string, Set `maxFeePerGas`, must define aswell `maxPriorityFeePerGas` to use it +- `maxPriorityFeePerGas`:string, Set `maxPriorityFeePerGas`, must define aswell `maxFeePerGas` to use it +- `multiplierGas`: number, Gas multiplier with 3 decimals. If `maxFeePerGas` and `maxPriorityFeePerGas` are set, this will not take effect diff --git a/deployment/v1ToV2/deploy_parameters.json.example b/deployment/v1ToV2/deploy_parameters.json.example new file mode 100644 index 000000000..a60f53a9f --- /dev/null +++ b/deployment/v1ToV2/deploy_parameters.json.example @@ -0,0 +1,27 @@ +{ + "timelockAdminAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "minDelayTimelock": 3600, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "initialZkEVMDeployerOwner" :"0xaddress", + "admin":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "trustedAggregator":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "trustedAggregatorTimeout": 604799, + "pendingStateTimeout": 604799, + "emergencyCouncilAddress": "0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "polTokenAddress":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "zkEVMDeployerAddress":"", + "realVerifier": false, + "trustedSequencerURL": "http://zkevm-json-rpc:8123", + "networkName": "zkevm", + "description":"0.0.1", + "trustedSequencer":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "chainID": 1001, + "adminZkEVM":"0x617b3a3528F9cDd6630fd3301B9c8911F7Bf063D", + "forkID": 1, + "consensusContract": "PolygonZkEVMEtrog", + "gasTokenAddress":"", + "deployerPvtKey": "", + "maxFeePerGas":"", + "maxPriorityFeePerGas":"", + "multiplierGas": "", +} diff --git a/deployment/v1ToV2/prepareTestnet.ts b/deployment/v1ToV2/prepareTestnet.ts new file mode 100644 index 000000000..cc117098a --- /dev/null +++ b/deployment/v1ToV2/prepareTestnet.ts @@ -0,0 +1,132 @@ +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if, no-restricted-syntax */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ + +/* eslint-disable no-await-in-loop, no-use-before-define, no-lonely-if */ +/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved */ +import {expect} from "chai"; +import path = require("path"); +import fs = require("fs"); + +import * as dotenv from "dotenv"; +dotenv.config({path: path.resolve(__dirname, "../.env")}); +import {ethers} from "hardhat"; + +import yargs from "yargs/yargs"; + +const argv = yargs(process.argv.slice(2)) + .options({ + input: {type: "string", default: "./deploy_parameters.json"}, + }) + .parse() as any; + +const pathDeployParameters = path.join(__dirname, argv.input); +const deployParameters = require(argv.input); + +async function main() { + // Load provider + let currentProvider = ethers.provider; + if (deployParameters.multiplierGas || deployParameters.maxFeePerGas) { + if (process.env.HARDHAT_NETWORK !== "hardhat") { + currentProvider = ethers.getDefaultProvider( + `https://${process.env.HARDHAT_NETWORK}.infura.io/v3/${process.env.INFURA_PROJECT_ID}` + ) as any; + if (deployParameters.maxPriorityFeePerGas && deployParameters.maxFeePerGas) { + console.log( + `Hardcoded gas used: MaxPriority${deployParameters.maxPriorityFeePerGas} gwei, MaxFee${deployParameters.maxFeePerGas} gwei` + ); + const FEE_DATA = new ethers.FeeData( + null, + ethers.parseUnits(deployParameters.maxFeePerGas, "gwei"), + ethers.parseUnits(deployParameters.maxPriorityFeePerGas, "gwei") + ); + + currentProvider.getFeeData = async () => FEE_DATA; + } else { + console.log("Multiplier gas used: ", deployParameters.multiplierGas); + async function overrideFeeData() { + const feedata = await ethers.provider.getFeeData(); + return new ethers.FeeData( + null, + ((feedata.maxFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n, + ((feedata.maxPriorityFeePerGas as bigint) * BigInt(deployParameters.multiplierGas)) / 1000n + ); + } + currentProvider.getFeeData = overrideFeeData; + } + } + } + + // Load deployer + let deployer; + if (deployParameters.deployerPvtKey) { + deployer = new ethers.Wallet(deployParameters.deployerPvtKey, currentProvider); + } else if (process.env.MNEMONIC) { + deployer = ethers.HDNodeWallet.fromMnemonic( + ethers.Mnemonic.fromPhrase(process.env.MNEMONIC), + "m/44'/60'/0'/0/0" + ).connect(currentProvider); + } else { + [deployer] = await ethers.getSigners(); + } + + // Check trusted address from deploy parameters + const mandatoryDeploymentParameters = ["trustedAggregator", "trustedSequencer"]; + + for (const parameterName of mandatoryDeploymentParameters) { + if (deployParameters[parameterName] === undefined || deployParameters[parameterName] === "") { + throw new Error(`Missing parameter: ${parameterName}`); + } + } + + const {trustedAggregator, trustedSequencer} = deployParameters; + + /* + *Deployment pol + */ + const polTokenName = "Pol Token"; + const polTokenSymbol = "POL"; + const polTokenInitialBalance = ethers.parseEther("20000000"); + + const polTokenFactory = await ethers.getContractFactory("ERC20PermitMock", deployer); + const polTokenContract = await polTokenFactory.deploy( + polTokenName, + polTokenSymbol, + deployer.address, + polTokenInitialBalance + ); + await polTokenContract.waitForDeployment(); + + console.log("#######################\n"); + console.log("pol deployed to:", polTokenContract.target); + + // fund sequencer account with tokens and ether if it have less than 0.1 ether. + const balanceEther = await ethers.provider.getBalance(trustedSequencer); + const minEtherBalance = ethers.parseEther("0.1"); + if (balanceEther < minEtherBalance) { + const params = { + to: trustedSequencer, + value: minEtherBalance, + }; + await deployer.sendTransaction(params); + } + const tokensBalance = ethers.parseEther("100000"); + await (await polTokenContract.transfer(trustedSequencer, tokensBalance)).wait(); + + // fund aggregator account with ether if it have less than 0.1 ether. + const balanceEtherAggr = await ethers.provider.getBalance(trustedAggregator); + if (balanceEtherAggr < minEtherBalance) { + const params = { + to: trustedAggregator, + value: minEtherBalance, + }; + await deployer.sendTransaction(params); + } + + deployParameters.polTokenAddress = polTokenContract.target; + fs.writeFileSync(pathDeployParameters, JSON.stringify(deployParameters, null, 1)); +} + +main().catch((e) => { + console.error(e); + process.exit(1); +}); diff --git a/docker/scripts/v1ToV2/deploy-docker.sh b/docker/scripts/v1ToV2/deploy-docker.sh new file mode 100755 index 000000000..09e41b5d3 --- /dev/null +++ b/docker/scripts/v1ToV2/deploy-docker.sh @@ -0,0 +1,14 @@ +#!/bin/bash +sudo rm -rf docker/gethData/geth_data +DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml up -d geth +sleep 5 +node docker/scripts/fund-accounts.js +cp docker/scripts/v1ToV2/deploy_parameters_docker.json deployment/v1ToV2/deploy_parameters.json +npm run deploy:testnet:v1ToV2:localhost +mkdir docker/deploymentOutput +mv deployment/v1ToV2/deploy_output.json docker/deploymentOutput +mv deployment/v1ToV2/genesis.json docker/deploymentOutput +DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml down +sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth . +# Let it readable for the multiplatform build coming later! +sudo chmod -R go+rxw docker/gethData diff --git a/docker/scripts/v1ToV2/deploy-dockerv2.sh b/docker/scripts/v1ToV2/deploy-dockerv2.sh new file mode 100755 index 000000000..839ede133 --- /dev/null +++ b/docker/scripts/v1ToV2/deploy-dockerv2.sh @@ -0,0 +1,14 @@ +#!/bin/bash +sudo rm -rf docker/gethData/geth_data +DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml up -d geth +sleep 5 +node docker/scripts/fund-accounts.js +cp docker/scripts/v1ToV2/deploy_parameters_docker.json deployment/v1ToV2/deploy_parameters.json +npm run deploy:testnet:v1ToV2:localhost +mkdir docker/deploymentOutput +mv deployment/v1ToV2/deploy_output.json docker/deploymentOutput +mv deployment/v1ToV2/genesis.json docker/deploymentOutput +DEV_PERIOD=1 docker compose -f docker/docker-compose.geth.yml down +sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth . +# Let it readable for the multiplatform build coming later! +sudo chmod -R go+rxw docker/gethData \ No newline at end of file diff --git a/docker/scripts/v1ToV2/deploy_parameters_docker.json b/docker/scripts/v1ToV2/deploy_parameters_docker.json new file mode 100644 index 000000000..5697169cd --- /dev/null +++ b/docker/scripts/v1ToV2/deploy_parameters_docker.json @@ -0,0 +1,29 @@ +{ + "timelockAdminAddress": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "minDelayTimelock": 3600, + "salt": "0x0000000000000000000000000000000000000000000000000000000000000000", + "initialZkEVMDeployerOwner": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "admin": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "trustedAggregator": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", + "trustedAggregatorTimeout": 604799, + "pendingStateTimeout": 604799, + "emergencyCouncilAddress": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "realVerifier": false, + "trustedSequencerURL": "http://zkevm-json-rpc:8123", + "networkName": "zkevm", + "description": "0.0.1", + "version":"0.0.1", + "trustedSequencer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "chainID": 1001, + "adminZkEVM": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", + "forkID": 5, + "consensusContract": "PolygonZkEVMEtrog", + "polTokenAddress": "", + "zkEVMDeployerAddress": "", + "gasTokenAddress": "", + "gasTokenNetwork": 0, + "deployerPvtKey": "", + "maxFeePerGas": "", + "maxPriorityFeePerGas": "", + "multiplierGas": "" +} \ No newline at end of file diff --git a/docker/scripts/v1ToV2/genesis.json b/docker/scripts/v1ToV2/genesis.json new file mode 100644 index 000000000..959cd157b --- /dev/null +++ b/docker/scripts/v1ToV2/genesis.json @@ -0,0 +1,98 @@ +{ + "root": "0x40bdab77c40f497be8a427027b336f7a51a0692c3fb20ff36519bc5a79dc60fd", + "genesis": [ + { + "contractName": "PolygonZkEVMDeployer", + "balance": "0", + "nonce": "4", + "address": "0xFbD07134824dDEa24E4ae414c18ecbFa98169A24", + "bytecode": "0x60806040526004361061006e575f3560e01c8063715018a61161004c578063715018a6146100e25780638da5cb5b146100f6578063e11ae6cb1461011f578063f2fde38b14610132575f80fd5b80632b79805a146100725780634a94d487146100875780636d07dbf81461009a575b5f80fd5b610085610080366004610908565b610151565b005b6100856100953660046109a2565b6101c2565b3480156100a5575f80fd5b506100b96100b43660046109f5565b610203565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100ed575f80fd5b50610085610215565b348015610101575f80fd5b505f5473ffffffffffffffffffffffffffffffffffffffff166100b9565b61008561012d366004610a15565b610228565b34801561013d575f80fd5b5061008561014c366004610a61565b61028e565b61015961034a565b5f6101658585856103ca565b90506101718183610527565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101ca61034a565b6101d583838361056a565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b905f90a1505050565b5f61020e8383610598565b9392505050565b61021d61034a565b6102265f6105a4565b565b61023061034a565b5f61023c8484846103ca565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b61029661034a565b73ffffffffffffffffffffffffffffffffffffffff811661033e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610347816105a4565b50565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610226576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610335565b5f83471015610435576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610335565b81515f0361049f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610335565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff811661020e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610335565b606061020e83835f6040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250610618565b6060610590848484604051806060016040528060298152602001610b0860299139610618565b949350505050565b5f61020e83833061072d565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106aa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610335565b5f808673ffffffffffffffffffffffffffffffffffffffff1685876040516106d29190610a9c565b5f6040518083038185875af1925050503d805f811461070c576040519150601f19603f3d011682016040523d82523d5f602084013e610711565b606091505b509150915061072287838387610756565b979650505050505050565b5f604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156107eb5782515f036107e45773ffffffffffffffffffffffffffffffffffffffff85163b6107e4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610335565b5081610590565b61059083838151156108005781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103359190610ab7565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f82601f830112610870575f80fd5b813567ffffffffffffffff8082111561088b5761088b610834565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108d1576108d1610834565b816040528381528660208588010111156108e9575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f805f806080858703121561091b575f80fd5b8435935060208501359250604085013567ffffffffffffffff80821115610940575f80fd5b61094c88838901610861565b93506060870135915080821115610961575f80fd5b5061096e87828801610861565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff8116811461099d575f80fd5b919050565b5f805f606084860312156109b4575f80fd5b6109bd8461097a565b9250602084013567ffffffffffffffff8111156109d8575f80fd5b6109e486828701610861565b925050604084013590509250925092565b5f8060408385031215610a06575f80fd5b50508035926020909101359150565b5f805f60608486031215610a27575f80fd5b8335925060208401359150604084013567ffffffffffffffff811115610a4b575f80fd5b610a5786828701610861565b9150509250925092565b5f60208284031215610a71575f80fd5b61020e8261097a565b5f5b83811015610a94578181015183820152602001610a7c565b50505f910152565b5f8251610aad818460208701610a7a565b9190910192915050565b602081525f8251806020840152610ad5816040850160208701610a7a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220330b94dc698c4d290bf55c23f13b473cde6a6bae0030cb902de18af54e35839f64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266" + } + }, + { + "contractName": "ProxyAdmin", + "balance": "0", + "nonce": "1", + "address": "0xfADB60b5059e31614e02083fF6C021a24C31c891", + "bytecode": "0x608060405260043610610079575f3560e01c80639623609d1161004c5780639623609d1461012357806399a88ec414610136578063f2fde38b14610155578063f3b7dead14610174575f80fd5b8063204e1c7a1461007d578063715018a6146100c55780637eff275e146100db5780638da5cb5b146100fa575b5f80fd5b348015610088575f80fd5b5061009c6100973660046105e8565b610193565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d0575f80fd5b506100d9610244565b005b3480156100e6575f80fd5b506100d96100f536600461060a565b610257565b348015610105575f80fd5b505f5473ffffffffffffffffffffffffffffffffffffffff1661009c565b6100d961013136600461066e565b6102e0565b348015610141575f80fd5b506100d961015036600461060a565b610371565b348015610160575f80fd5b506100d961016f3660046105e8565b6103cd565b34801561017f575f80fd5b5061009c61018e3660046105e8565b610489565b5f805f8373ffffffffffffffffffffffffffffffffffffffff166040516101dd907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b5f60405180830381855afa9150503d805f8114610215576040519150601f19603f3d011682016040523d82523d5f602084013e61021a565b606091505b509150915081610228575f80fd5b8080602001905181019061023c919061075b565b949350505050565b61024c6104d3565b6102555f610553565b565b61025f6104d3565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b5f604051808303815f87803b1580156102c6575f80fd5b505af11580156102d8573d5f803e3d5ffd5b505050505050565b6102e86104d3565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061033e9086908690600401610776565b5f604051808303818588803b158015610355575f80fd5b505af1158015610367573d5f803e3d5ffd5b5050505050505050565b6103796104d3565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102af565b6103d56104d3565b73ffffffffffffffffffffffffffffffffffffffff811661047d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61048681610553565b50565b5f805f8373ffffffffffffffffffffffffffffffffffffffff166040516101dd907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b5f5473ffffffffffffffffffffffffffffffffffffffff163314610255576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610474565b5f805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff81168114610486575f80fd5b5f602082840312156105f8575f80fd5b8135610603816105c7565b9392505050565b5f806040838503121561061b575f80fd5b8235610626816105c7565b91506020830135610636816105c7565b809150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f805f60608486031215610680575f80fd5b833561068b816105c7565b9250602084013561069b816105c7565b9150604084013567ffffffffffffffff808211156106b7575f80fd5b818601915086601f8301126106ca575f80fd5b8135818111156106dc576106dc610641565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561072257610722610641565b8160405282815289602084870101111561073a575f80fd5b826020860160208301375f6020848301015280955050505050509250925092565b5f6020828403121561076b575f80fd5b8151610603816105c7565b73ffffffffffffffffffffffffffffffffffffffff831681525f602060408184015283518060408501525f5b818110156107be578581018301518582016060015282016107a2565b505f6060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea26469706673582212203083a4ccc2e42eed60bd19037f2efa77ed086dc7a5403f75bebb995dcba2221c64736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f" + } + }, + { + "contractName": "PolygonZkEVMBridge implementation", + "balance": "0", + "nonce": "1", + "address": "0x7Cd6d5063c7782d34E2b1b03ED89ecf4A1412148", + "bytecode": "0x608060405260043610620001d3575f3560e01c80638ed7e3f211620000fa578063cd5865791162000092578063dbc16976116200006a578063dbc169761462000685578063ee25560b146200069c578063f5efcd7914620006cb578063fb57083414620006ef575f80fd5b8063cd5865791462000620578063d02103ca1462000637578063d3476afe1462000661575f80fd5b8063bab161bf11620000d2578063bab161bf146200057a578063be5831c7146200059d578063cc46163214620005d8578063ccaa2d1114620005fc575f80fd5b80638ed7e3f21462000511578063aaa13cc21462000532578063b8b284d01462000556575f80fd5b80633cbc795b116200016e5780635ca1e16511620001465780635ca1e165146200048757806379e2cf97146200049e57806381b1c17414620004b557806383f2440314620004ed575f80fd5b80633cbc795b14620003285780633e19704314620003745780634b2f336d1462000466575f80fd5b8063240ff37811620001ae578063240ff378146200025d5780632dfdf0b51462000274578063318aee3d146200029a5780633c351e101462000307575f80fd5b806315064c9614620001d75780632072f6c5146200020757806322e95f2c1462000220575b5f80fd5b348015620001e3575f80fd5b50606854620001f29060ff1681565b60405190151581526020015b60405180910390f35b34801562000213575f80fd5b506200021e62000713565b005b3480156200022c575f80fd5b50620002446200023e36600462003723565b62000764565b6040516001600160a01b039091168152602001620001fe565b6200021e6200026e366004620037b3565b620007f9565b34801562000280575f80fd5b506200028b60535481565b604051908152602001620001fe565b348015620002a6575f80fd5b50620002e2620002b836600462003832565b606b6020525f908152604090205463ffffffff81169064010000000090046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b03909116602083015201620001fe565b34801562000313575f80fd5b50606d5462000244906001600160a01b031681565b34801562000334575f80fd5b50606d546200035e9074010000000000000000000000000000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001620001fe565b34801562000380575f80fd5b506200028b6200039236600462003866565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d82015260518101839052607181018290525f90609101604051602081830303815290604052805190602001209050979650505050505050565b34801562000472575f80fd5b50606e5462000244906001600160a01b031681565b34801562000493575f80fd5b506200028b62000862565b348015620004aa575f80fd5b506200021e62000947565b348015620004c1575f80fd5b5062000244620004d3366004620038eb565b606a6020525f90815260409020546001600160a01b031681565b348015620004f9575f80fd5b506200028b6200050b36600462003915565b62000981565b3480156200051d575f80fd5b50606c5462000244906001600160a01b031681565b3480156200053e575f80fd5b50620002446200055036600462003956565b62000a64565b34801562000562575f80fd5b506200021e6200057436600462003a03565b62000bf4565b34801562000586575f80fd5b506068546200035e90610100900463ffffffff1681565b348015620005a9575f80fd5b506068546200035e90790100000000000000000000000000000000000000000000000000900463ffffffff1681565b348015620005e4575f80fd5b50620001f2620005f636600462003a8b565b62000cc9565b34801562000608575f80fd5b506200021e6200061a36600462003ac1565b62000d58565b6200021e6200063136600462003bb5565b6200144d565b34801562000643575f80fd5b5060685462000244906501000000000090046001600160a01b031681565b3480156200066d575f80fd5b506200021e6200067f36600462003c51565b62001a03565b34801562000691575f80fd5b506200021e62001dd7565b348015620006a8575f80fd5b506200028b620006ba366004620038eb565b60696020525f908152604090205481565b348015620006d7575f80fd5b506200021e620006e936600462003ac1565b62001e26565b348015620006fb575f80fd5b50620001f26200070d36600462003cc5565b620021aa565b606c546001600160a01b0316331462000758576040517fb9b3a2c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000762620021c5565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091205f908152606a90915220546001600160a01b03165b92915050565b3415801590620008135750606e546001600160a01b031615155b156200084b576040517f6f625c4000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200085b85853486868662002258565b5050505050565b6053545f90819081805b60208110156200093e578083901c600116600103620008cf57603381602081106200089b576200089b62003d0f565b01546040805160208101929092528101859052606001604051602081830303815290604052805190602001209350620008fc565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b60408051602081018490529081018390526060016040516020818303038152906040528051906020012091508080620009359062003d69565b9150506200086c565b50919392505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000762576200076262002340565b5f83815b602081101562000a5b57600163ffffffff8516821c81169003620009f757848160208110620009b857620009b862003d0f565b602002013582604051602001620009d9929190918252602082015260400190565b60405160208183030381529060405280519060200120915062000a46565b8185826020811062000a0d5762000a0d62003d0f565b602002013560405160200162000a2d929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062000a528162003d69565b91505062000985565b50949350505050565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201525f9081906038016040516020818303038152906040528051906020012090505f60ff60f81b30836040518060200162000af890620036e9565b601f1982820381018352601f90910116604081905262000b25908d908d908d908d908d9060200162003dcc565b60408051601f198184030181529082905262000b45929160200162003e30565b6040516020818303038152906040528051906020012060405160200162000bce94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b60408051808303601f1901815291905280516020909101209a9950505050505050505050565b606e546001600160a01b031662000c37576040517fdde3cda700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606e546040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018690526001600160a01b0390911690639dc29fac906044015f604051808303815f87803b15801562000c9a575f80fd5b505af115801562000cad573d5f803e3d5ffd5b5050505062000cc186868686868662002258565b505050505050565b6068545f908190610100900463ffffffff1615801562000cef575063ffffffff83166001145b1562000d03575063ffffffff831662000d2f565b62000d1a64010000000063ffffffff851662003e62565b62000d2c9063ffffffff861662003e7c565b90505b600881901c5f90815260696020526040902054600160ff9092169190911b908116149392505050565b60685460ff161562000d96576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff868116610100909204161462000de0576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000ee78c8c8c8c8c62000ee15f8e8e8e8e8e8e8e60405162000e0592919062003e92565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d82015260518101839052607181018290525f90609101604051602081830303815290604052805190602001209050979650505050505050565b62002409565b6001600160a01b0386166200105657606e546001600160a01b031662000fd4575f6001600160a01b03851684825b6040519080825280601f01601f19166020018201604052801562000f40576020820181803683370190505b5060405162000f50919062003ece565b5f6040518083038185875af1925050503d805f811462000f8c576040519150601f19603f3d011682016040523d82523d5f602084013e62000f91565b606091505b505090508062000fcd576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50620013e3565b606e546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015260248201869052909116906340c10f19906044015f604051808303815f87803b15801562001039575f80fd5b505af11580156200104c573d5f803e3d5ffd5b50505050620013e3565b606d546001600160a01b038781169116148015620010965750606d5463ffffffff8881167401000000000000000000000000000000000000000090920416145b15620010af575f6001600160a01b038516848262000f15565b60685463ffffffff610100909104811690881603620010e457620010de6001600160a01b0387168585620025e1565b620013e3565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201525f9060380160408051601f1981840301815291815281516020928301205f818152606a9093529120549091506001600160a01b03168062001367575f80806200118b8688018862003fa1565b9250925092505f85848484604051620011a490620036e9565b620011b2939291906200404a565b8190604051809103905ff5905080158015620011d0573d5f803e3d5ffd5b506040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b038c81166004830152602482018c9052919250908216906340c10f19906044015f604051808303815f87803b15801562001236575f80fd5b505af115801562001249573d5f803e3d5ffd5b5050505080606a5f8881526020019081526020015f205f6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060405180604001604052808e63ffffffff1681526020018d6001600160a01b0316815250606b5f836001600160a01b03166001600160a01b031681526020019081526020015f205f820151815f015f6101000a81548163ffffffff021916908363ffffffff1602179055506020820151815f0160046101000a8154816001600160a01b0302191690836001600160a01b031602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b6040516200135595949392919062004086565b60405180910390a150505050620013e0565b6040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b038781166004830152602482018790528216906340c10f19906044015f604051808303815f87803b158015620013c8575f80fd5b505af1158015620013db573d5f803e3d5ffd5b505050505b50505b604080518b815263ffffffff891660208201526001600160a01b0388811682840152861660608201526080810185905290517f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d9181900360a00190a1505050505050505050505050565b60685460ff16156200148b576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200149562002691565b60685463ffffffff610100909104811690881603620014e0576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f806060876001600160a01b03881662001563578834146200152e576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606d546001600160a01b038116945074010000000000000000000000000000000000000000900463ffffffff169250620018a2565b34156200159c576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606e546001600160a01b03908116908916036200162f576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018a90526001600160a01b03891690639dc29fac906044015f604051808303815f87803b15801562001612575f80fd5b505af115801562001625573d5f803e3d5ffd5b50505050620018a2565b6001600160a01b038089165f908152606b602090815260409182902082518084019093525463ffffffff8116835264010000000090049092169181018290529015620016fe576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b90526001600160a01b038a1690639dc29fac906044015f604051808303815f87803b158015620016d4575f80fd5b505af1158015620016e7573d5f803e3d5ffd5b5050505080602001519450805f01519350620018a0565b8515620017135762001713898b898962002706565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038b16906370a0823190602401602060405180830381865afa15801562001771573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620017979190620040c0565b9050620017b06001600160a01b038b1633308e62002bb1565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201525f906001600160a01b038c16906370a0823190602401602060405180830381865afa1580156200180e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620018349190620040c0565b9050620018428282620040d8565b6068548c9850610100900463ffffffff1696509350620018628762002c04565b6200186d8c62002d0b565b620018788d62002e07565b6040516020016200188c939291906200404a565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b5f84868e8e8688605354604051620018e3989796959493929190620040ee565b60405180910390a1620019db620019d55f85878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d82015260518101839052607181018290525f90609101604051602081830303815290604052805190602001209050979650505050505050565b62002ef2565b8615620019ec57620019ec62002340565b50505050620019fa60018055565b50505050505050565b5f54610100900460ff161580801562001a2257505f54600160ff909116105b8062001a3d5750303b15801562001a3d57505f5460ff166001145b62001acf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b5f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801562001b2c575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8916027fffffffffffffff0000000000000000000000000000000000000000ffffffffff1617650100000000006001600160a01b038681169190910291909117909155606c80547fffffffffffffffffffffffff000000000000000000000000000000000000000016848316179055606d541662001c3157606d5474010000000000000000000000000000000000000000900463ffffffff161562001c2b576040517f1a874c1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62001d63565b606d805463ffffffff861674010000000000000000000000000000000000000000027fffffffffffffffff0000000000000000000000000000000000000000000000009091166001600160a01b038816171790556040515f9060129062001c9890620036e9565b6060808252600d908201527f5772617070656420457468657200000000000000000000000000000000000000608082015260a0602082018190526004908201527f574554480000000000000000000000000000000000000000000000000000000060c082015260ff909116604082015260e0018190604051809103905ff590508015801562001d29573d5f803e3d5ffd5b50606e80547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03929092169190911790555b62001d6d62003007565b801562000cc1575f80547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050505050565b606c546001600160a01b0316331462001e1c576040517fb9b3a2c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000762620030a9565b60685460ff161562001e64576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff868116610100909204161462001eae576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62001ed48c8c8c8c8c62000ee160018e8e8e8e8e8e8e60405162000e0592919062003e92565b606e545f906001600160a01b031662001fbd57846001600160a01b031684888a868660405160240162001f0b949392919062004159565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f2000000000000000000000000000000000000000000000000000000001790525162001f70919062003ece565b5f6040518083038185875af1925050503d805f811462001fac576040519150601f19603f3d011682016040523d82523d5f602084013e62001fb1565b606091505b50508091505062002107565b606e546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03878116600483015260248201879052909116906340c10f19906044015f604051808303815f87803b15801562002022575f80fd5b505af115801562002035573d5f803e3d5ffd5b50505050846001600160a01b0316878985856040516024016200205c949392919062004159565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f20000000000000000000000000000000000000000000000000000000017905251620020c1919062003ece565b5f604051808303815f865af19150503d805f8114620020fc576040519150601f19603f3d011682016040523d82523d5f602084013e62002101565b606091505b50909150505b806200213f576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518c815263ffffffff8a1660208201526001600160a01b0389811682840152871660608201526080810186905290517f1df3f2a973a00d6635911755c260704e95e8a5876997546798770f76396fda4d9181900360a00190a150505050505050505050505050565b5f81620021b986868662000981565b1490505b949350505050565b60685460ff161562002203576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a5497905f90a1565b60685463ffffffff610100909104811690871603620022a3576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff16338989898888605354604051620022f99998979695949392919062004193565b60405180910390a162002334620019d56001606860019054906101000a900463ffffffff16338a8a8a898960405162000e0592919062003e92565b821562000cc15762000cc15b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff90921691909117908190556001600160a01b0365010000000000909104166333d6247d620023b962000862565b6040518263ffffffff1660e01b8152600401620023d891815260200190565b5f604051808303815f87803b158015620023f0575f80fd5b505af115801562002403573d5f803e3d5ffd5b50505050565b606854604080516020808201879052818301869052825180830384018152606083019384905280519101207f257b36320000000000000000000000000000000000000000000000000000000090925260648101919091525f916501000000000090046001600160a01b03169063257b3632906084016020604051808303815f875af11580156200249b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620024c19190620040c0565b9050805f03620024fc576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80680100000000000000008716600103620025605786915062002523848a8489620021aa565b6200255a576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b620025ca565b602087901c6200257281600162004200565b91508792506200259162002588868c8662000981565b8a8389620021aa565b620025c8576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505b620025d6828262003138565b505050505050505050565b6040516001600160a01b0383166024820152604481018290526200268c9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262003200565b505050565b600260015403620026ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001ac6565b6002600155565b5f62002716600482848662004227565b620027219162004250565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000082160162002967575f80808080808062002783896004818d62004227565b81019062002792919062004299565b9650965096509650965096509650336001600160a01b0316876001600160a01b031614620027ec576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03861630146200282f576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002869576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b0389811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e169162002917919062003ece565b5f604051808303815f865af19150503d805f811462002952576040519150601f19603f3d011682016040523d82523d5f602084013e62002957565b606091505b505050505050505050506200085b565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620029e3576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80808080808080620029fa8a6004818e62004227565b81019062002a099190620042ef565b97509750975097509750975097509750336001600160a01b0316886001600160a01b03161462002a65576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038716301462002aa8576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516001600160a01b038a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f169162002b5f919062003ece565b5f604051808303815f865af19150503d805f811462002b9a576040519150601f19603f3d011682016040523d82523d5f602084013e62002b9f565b606091505b50505050505050505050505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052620024039085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002627565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde030000000000000000000000000000000000000000000000000000000017905290516060915f9182916001600160a01b0386169162002c7a919062003ece565b5f60405180830381855afa9150503d805f811462002cb4576040519150601f19603f3d011682016040523d82523d5f602084013e62002cb9565b606091505b50915091508162002d00576040518060400160405280600781526020017f4e4f5f4e414d4500000000000000000000000000000000000000000000000000815250620021bd565b620021bd8162003305565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b410000000000000000000000000000000000000000000000000000000017905290516060915f9182916001600160a01b0386169162002d81919062003ece565b5f60405180830381855afa9150503d805f811462002dbb576040519150601f19603f3d011682016040523d82523d5f602084013e62002dc0565b606091505b50915091508162002d00576040518060400160405280600981526020017f4e4f5f53594d424f4c0000000000000000000000000000000000000000000000815250620021bd565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290515f91829182916001600160a01b0386169162002e7c919062003ece565b5f60405180830381855afa9150503d805f811462002eb6576040519150601f19603f3d011682016040523d82523d5f602084013e62002ebb565b606091505b509150915081801562002ecf575080516020145b62002edc576012620021bd565b80806020019051810190620021bd919062004376565b80600162002f0360206002620044cb565b62002f0f9190620040d8565b6053541062002f4a576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60535f815462002f5b9062003d69565b918290555090505f5b602081101562002ff6578082901c60011660010362002f9c57826033826020811062002f945762002f9462003d0f565b015550505050565b6033816020811062002fb25762002fb262003d0f565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062002fed9062003d69565b91505062002f64565b506200268c620044d8565b60018055565b5f54610100900460ff166200309f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001ac6565b62000762620034f0565b60685460ff16620030e6576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b3905f90a1565b6068545f90610100900463ffffffff161580156200315c575063ffffffff82166001145b1562003170575063ffffffff82166200319c565b6200318764010000000063ffffffff841662003e62565b620031999063ffffffff851662003e7c565b90505b600881901c5f8181526069602052604081208054600160ff861690811b91821892839055929091908183169003620019fa576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f62003256826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620035889092919063ffffffff16565b8051909150156200268c578080602001905181019062003277919062004505565b6200268c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001ac6565b60606040825110620033275781806020019051810190620007f3919062004523565b8151602003620034b2575f5b6020811080156200337e575082818151811062003354576200335462003d0f565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b15620033995780620033908162003d69565b91505062003333565b805f03620033dc57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b5f8167ffffffffffffffff811115620033f957620033f962003ea1565b6040519080825280601f01601f19166020018201604052801562003424576020820181803683370190505b5090505f5b82811015620034aa5784818151811062003447576200344762003d0f565b602001015160f81c60f81b82828151811062003467576200346762003d0f565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535080620034a18162003d69565b91505062003429565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b5f54610100900460ff1662003001576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001ac6565b6060620021bd84845f85855f80866001600160a01b03168587604051620035b0919062003ece565b5f6040518083038185875af1925050503d805f8114620035ec576040519150601f19603f3d011682016040523d82523d5f602084013e620035f1565b606091505b509150915062003604878383876200360f565b979650505050505050565b606083156200369c5782515f0362003694576001600160a01b0385163b62003694576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001ac6565b5081620021bd565b620021bd8383815115620036b35781518083602001fd5b806040517f08c379a000000000000000000000000000000000000000000000000000000000815260040162001ac691906200459e565b6119a180620045b383390190565b803563ffffffff81168114620034eb575f80fd5b6001600160a01b038116811462003720575f80fd5b50565b5f806040838503121562003735575f80fd5b6200374083620036f7565b9150602083013562003752816200370b565b809150509250929050565b801515811462003720575f80fd5b5f8083601f8401126200377c575f80fd5b50813567ffffffffffffffff81111562003794575f80fd5b602083019150836020828501011115620037ac575f80fd5b9250929050565b5f805f805f60808688031215620037c8575f80fd5b620037d386620036f7565b94506020860135620037e5816200370b565b93506040860135620037f7816200375d565b9250606086013567ffffffffffffffff81111562003813575f80fd5b62003821888289016200376b565b969995985093965092949392505050565b5f6020828403121562003843575f80fd5b813562003850816200370b565b9392505050565b60ff8116811462003720575f80fd5b5f805f805f805f60e0888a0312156200387d575f80fd5b87356200388a8162003857565b96506200389a60208901620036f7565b95506040880135620038ac816200370b565b9450620038bc60608901620036f7565b93506080880135620038ce816200370b565b9699959850939692959460a0840135945060c09093013592915050565b5f60208284031215620038fc575f80fd5b5035919050565b806104008101831015620007f3575f80fd5b5f805f610440848603121562003929575f80fd5b833592506200393c856020860162003903565b91506200394d6104208501620036f7565b90509250925092565b5f805f805f805f60a0888a0312156200396d575f80fd5b6200397888620036f7565b965060208801356200398a816200370b565b9550604088013567ffffffffffffffff80821115620039a7575f80fd5b620039b58b838c016200376b565b909750955060608a0135915080821115620039ce575f80fd5b50620039dd8a828b016200376b565b9094509250506080880135620039f38162003857565b8091505092959891949750929550565b5f805f805f8060a0878903121562003a19575f80fd5b62003a2487620036f7565b9550602087013562003a36816200370b565b945060408701359350606087013562003a4f816200375d565b9250608087013567ffffffffffffffff81111562003a6b575f80fd5b62003a7989828a016200376b565b979a9699509497509295939492505050565b5f806040838503121562003a9d575f80fd5b62003aa883620036f7565b915062003ab860208401620036f7565b90509250929050565b5f805f805f805f805f805f806109208d8f03121562003ade575f80fd5b62003aea8e8e62003903565b9b5062003afc8e6104008f0162003903565b9a506108008d013599506108208d013598506108408d0135975062003b256108608e01620036f7565b965062003b376108808e01356200370b565b6108808d0135955062003b4e6108a08e01620036f7565b945062003b606108c08e01356200370b565b6108c08d013593506108e08d0135925067ffffffffffffffff6109008e0135111562003b8a575f80fd5b62003b9d8e6109008f01358f016200376b565b81935080925050509295989b509295989b509295989b565b5f805f805f805f60c0888a03121562003bcc575f80fd5b62003bd788620036f7565b9650602088013562003be9816200370b565b955060408801359450606088013562003c02816200370b565b9350608088013562003c14816200375d565b925060a088013567ffffffffffffffff81111562003c30575f80fd5b62003c3e8a828b016200376b565b989b979a50959850939692959293505050565b5f805f805f60a0868803121562003c66575f80fd5b62003c7186620036f7565b9450602086013562003c83816200370b565b935062003c9360408701620036f7565b9250606086013562003ca5816200370b565b9150608086013562003cb7816200370b565b809150509295509295909350565b5f805f80610460858703121562003cda575f80fd5b8435935062003ced866020870162003903565b925062003cfe6104208601620036f7565b939692955092936104400135925050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003d9c5762003d9c62003d3c565b5060010190565b81835281816020850137505f602082840101525f6020601f19601f840116840101905092915050565b606081525f62003de160608301878962003da3565b828103602084015262003df681868862003da3565b91505060ff831660408301529695505050505050565b5f5b8381101562003e2857818101518382015260200162003e0e565b50505f910152565b5f835162003e4381846020880162003e0c565b83519083019062003e5981836020880162003e0c565b01949350505050565b8082028115828204841417620007f357620007f362003d3c565b80820180821115620007f357620007f362003d3c565b818382375f9101908152919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f825162003ee181846020870162003e0c565b9190910192915050565b604051601f8201601f1916810167ffffffffffffffff8111828210171562003f175762003f1762003ea1565b604052919050565b5f67ffffffffffffffff82111562003f3b5762003f3b62003ea1565b50601f01601f191660200190565b5f82601f83011262003f59575f80fd5b813562003f7062003f6a8262003f1f565b62003eeb565b81815284602083860101111562003f85575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f6060848603121562003fb4575f80fd5b833567ffffffffffffffff8082111562003fcc575f80fd5b62003fda8783880162003f49565b9450602086013591508082111562003ff0575f80fd5b5062003fff8682870162003f49565b9250506040840135620040128162003857565b809150509250925092565b5f81518084526200403681602086016020860162003e0c565b601f01601f19169290920160200192915050565b606081525f6200405e60608301866200401d565b82810360208401526200407281866200401d565b91505060ff83166040830152949350505050565b63ffffffff861681525f6001600160a01b038087166020840152808616604084015250608060608301526200360460808301848662003da3565b5f60208284031215620040d1575f80fd5b5051919050565b81810381811115620007f357620007f362003d3c565b5f61010060ff8b16835263ffffffff808b1660208501526001600160a01b03808b166040860152818a1660608601528089166080860152508660a08501528160c085015262004140828501876200401d565b925080851660e085015250509998505050505050505050565b6001600160a01b038516815263ffffffff84166020820152606060408201525f6200418960608301848662003da3565b9695505050505050565b5f61010060ff8c16835263ffffffff808c1660208501526001600160a01b03808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620041e6828501878962003da3565b925080851660e085015250509a9950505050505050505050565b63ffffffff81811683821601908082111562004220576200422062003d3c565b5092915050565b5f808585111562004236575f80fd5b8386111562004243575f80fd5b5050820193919092039150565b7fffffffff000000000000000000000000000000000000000000000000000000008135818116916004851015620042915780818660040360031b1b83161692505b505092915050565b5f805f805f805f60e0888a031215620042b0575f80fd5b8735620042bd816200370b565b96506020880135620042cf816200370b565b955060408801359450606088013593506080880135620038ce8162003857565b5f805f805f805f80610100898b03121562004308575f80fd5b883562004315816200370b565b9750602089013562004327816200370b565b96506040890135955060608901359450608089013562004347816200375d565b935060a0890135620043598162003857565b979a969950949793969295929450505060c08201359160e0013590565b5f6020828403121562004387575f80fd5b8151620038508162003857565b600181815b80851115620043f357817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115620043d757620043d762003d3c565b80851615620043e557918102915b93841c939080029062004399565b509250929050565b5f826200440b57506001620007f3565b816200441957505f620007f3565b81600181146200443257600281146200443d576200445d565b6001915050620007f3565b60ff84111562004451576200445162003d3c565b50506001821b620007f3565b5060208310610133831016604e8410600b841016171562004482575081810a620007f3565b6200448e838362004394565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115620044c357620044c362003d3c565b029392505050565b5f620038508383620043fb565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52600160045260245ffd5b5f6020828403121562004516575f80fd5b815162003850816200375d565b5f6020828403121562004534575f80fd5b815167ffffffffffffffff8111156200454b575f80fd5b8201601f810184136200455c575f80fd5b80516200456d62003f6a8262003f1f565b81815285602083850101111562004582575f80fd5b6200459582602083016020860162003e0c565b95945050505050565b602081525f6200385060208301846200401d56fe61010060405234801562000011575f80fd5b50604051620019a1380380620019a1833981016040819052620000349162000282565b828260036200004483826200038d565b5060046200005382826200038d565b50503360c0525060ff811660e05246608081905262000072906200007f565b60a0525062000455915050565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ab6200012c565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013d9062000301565b80601f01602080910402602001604051908101604052809291908181526020018280546200016b9062000301565b8015620001ba5780601f106200019057610100808354040283529160200191620001ba565b820191905f5260205f20905b8154815290600101906020018083116200019c57829003601f168201915b5050505050905090565b634e487b7160e01b5f52604160045260245ffd5b5f82601f830112620001e8575f80fd5b81516001600160401b0380821115620002055762000205620001c4565b604051601f8301601f19908116603f01168101908282118183101715620002305762000230620001c4565b816040528381526020925086838588010111156200024c575f80fd5b5f91505b838210156200026f578582018301518183018401529082019062000250565b5f93810190920192909252949350505050565b5f805f6060848603121562000295575f80fd5b83516001600160401b0380821115620002ac575f80fd5b620002ba87838801620001d8565b94506020860151915080821115620002d0575f80fd5b50620002df86828701620001d8565b925050604084015160ff81168114620002f6575f80fd5b809150509250925092565b600181811c908216806200031657607f821691505b6020821081036200033557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111562000388575f81815260208120601f850160051c81016020861015620003635750805b601f850160051c820191505b8181101562000384578281556001016200036f565b5050505b505050565b81516001600160401b03811115620003a957620003a9620001c4565b620003c181620003ba845462000301565b846200033b565b602080601f831160018114620003f7575f8415620003df5750858301515b5f19600386901b1c1916600185901b17855562000384565b5f85815260208120601f198616915b82811015620004275788860151825594840194600190910190840162000406565b50858210156200044557878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516115036200049e5f395f61022d01525f81816102fb015281816105ad015261067a01525f61052801525f818161036d01526104f201526115035ff3fe608060405234801561000f575f80fd5b506004361061016e575f3560e01c806370a08231116100d2578063a457c2d711610088578063d505accf11610063578063d505accf1461038f578063dd62ed3e146103a2578063ffa1ad74146103e7575f80fd5b8063a457c2d714610342578063a9059cbb14610355578063cd0d009614610368575f80fd5b806395d89b41116100b857806395d89b41146102db5780639dc29fac146102e3578063a3c573eb146102f6575f80fd5b806370a08231146102875780637ecebe00146102bc575f80fd5b806330adf81f116101275780633644e5151161010d5780633644e51514610257578063395093511461025f57806340c10f1914610272575f80fd5b806330adf81f146101ff578063313ce56714610226575f80fd5b806318160ddd1161015757806318160ddd146101b357806320606b70146101c557806323b872dd146101ec575f80fd5b806306fdde0314610172578063095ea7b314610190575b5f80fd5b61017a610423565b6040516101879190611255565b60405180910390f35b6101a361019e3660046112e6565b6104b3565b6040519015158152602001610187565b6002545b604051908152602001610187565b6101b77f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101a36101fa36600461130e565b6104cc565b6101b77f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610187565b6101b76104ef565b6101a361026d3660046112e6565b61054a565b6102856102803660046112e6565b610595565b005b6101b7610295366004611347565b73ffffffffffffffffffffffffffffffffffffffff165f9081526020819052604090205490565b6101b76102ca366004611347565b60056020525f908152604090205481565b61017a610653565b6102856102f13660046112e6565b610662565b61031d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610187565b6101a36103503660046112e6565b610717565b6101a36103633660046112e6565b6107cd565b6101b77f000000000000000000000000000000000000000000000000000000000000000081565b61028561039d366004611367565b6107da565b6101b76103b03660046113d4565b73ffffffffffffffffffffffffffffffffffffffff9182165f90815260016020908152604080832093909416825291909152205490565b61017a6040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043290611405565b80601f016020809104026020016040519081016040528092919081815260200182805461045e90611405565b80156104a95780601f10610480576101008083540402835291602001916104a9565b820191905f5260205f20905b81548152906001019060200180831161048c57829003601f168201915b5050505050905090565b5f336104c0818585610ad7565b60019150505b92915050565b5f336104d9858285610c56565b6104e4858585610d12565b506001949350505050565b5f7f000000000000000000000000000000000000000000000000000000000000000046146105255761052046610f31565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b335f81815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104c09082908690610590908790611483565b610ad7565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146106455760405162461bcd60e51b815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61064f8282610ff8565b5050565b60606004805461043290611405565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461070d5760405162461bcd60e51b815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d42726964676500000000000000000000000000000000606482015260840161063c565b61064f82826110cf565b335f81815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452909152812054909190838110156107c05760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161063c565b6104e48286868403610ad7565b5f336104c0818585610d12565b8342111561084f5760405162461bcd60e51b8152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d697400000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff87165f90815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866108a883611496565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f6109126104ef565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815282825280516020918201205f80855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa1580156109d3573d5f803e3d5ffd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610a4e57508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610ac05760405162461bcd60e51b815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e617475726500000000000000000000000000000000000000000000000000606482015260840161063c565b610acb8a8a8a610ad7565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610b5f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff8216610be85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff8381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381165f908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610d0c5781811015610cff5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161063c565b610d0c8484848403610ad7565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610d9b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff8216610e245760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff83165f9081526020819052604090205481811015610ebf5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff8481165f81815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610d0c565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610f5b610423565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff821661105b5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161063c565b8060025f82825461106c9190611483565b909155505073ffffffffffffffffffffffffffffffffffffffff82165f81815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166111585760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff82165f90815260208190526040902054818110156111f35760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161063c565b73ffffffffffffffffffffffffffffffffffffffff83165f818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610c49565b5f6020808352835180828501525f5b8181101561128057858101830151858201604001528201611264565b505f6040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146112e1575f80fd5b919050565b5f80604083850312156112f7575f80fd5b611300836112be565b946020939093013593505050565b5f805f60608486031215611320575f80fd5b611329846112be565b9250611337602085016112be565b9150604084013590509250925092565b5f60208284031215611357575f80fd5b611360826112be565b9392505050565b5f805f805f805f60e0888a03121561137d575f80fd5b611386886112be565b9650611394602089016112be565b95506040880135945060608801359350608088013560ff811681146113b7575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f80604083850312156113e5575f80fd5b6113ee836112be565b91506113fc602084016112be565b90509250929050565b600181811c9082168061141957607f821691505b602082108103611450577f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b50919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156104c6576104c6611456565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036114c6576114c6611456565b506001019056fea2646970667358221220176a1a9cf4a702d3853b858873fff4a6370c4e5d7d72d68593ec0ebe64fcc26964736f6c63430008140033a26469706673582212209002ffc0c7cb9056d22d47ac65cf05714a8ae8ce0af7e882f7e68b9fdede830e64736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMBridge proxy", + "balance": "340282366920938463463374607431768211455", + "nonce": "1", + "address": "0x40E0576c0A7dff9dc460B29ba73e79aBf73dD2a9", + "bytecode": "0x60806040526004361061005d575f3560e01c80635c60da1b116100425780635c60da1b146100a65780638f283970146100e3578063f851a440146101025761006c565b80633659cfe6146100745780634f1ef286146100935761006c565b3661006c5761006a610116565b005b61006a610116565b34801561007f575f80fd5b5061006a61008e366004610854565b610130565b61006a6100a136600461086d565b610178565b3480156100b1575f80fd5b506100ba6101eb565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100ee575f80fd5b5061006a6100fd366004610854565b610228565b34801561010d575f80fd5b506100ba610255565b61011e610282565b61012e610129610359565b610362565b565b610138610380565b73ffffffffffffffffffffffffffffffffffffffff1633036101705761016d8160405180602001604052805f8152505f6103bf565b50565b61016d610116565b610180610380565b73ffffffffffffffffffffffffffffffffffffffff1633036101e3576101de8383838080601f0160208091040260200160405190810160405280939291908181526020018383808284375f92019190915250600192506103bf915050565b505050565b6101de610116565b5f6101f4610380565b73ffffffffffffffffffffffffffffffffffffffff16330361021d57610218610359565b905090565b610225610116565b90565b610230610380565b73ffffffffffffffffffffffffffffffffffffffff1633036101705761016d816103e9565b5f61025e610380565b73ffffffffffffffffffffffffffffffffffffffff16330361021d57610218610380565b61028a610380565b73ffffffffffffffffffffffffffffffffffffffff16330361012e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b5f61021861044a565b365f80375f80365f845af43d5f803e80801561037c573d5ff35b3d5ffd5b5f7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6103c883610471565b5f825111806103d45750805b156101de576103e383836104bd565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f610412610380565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161016d816104e9565b5f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103a3565b61047a816105f5565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a250565b60606104e28383604051806060016040528060278152602001610977602791396106c0565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff811661058c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610350565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b73ffffffffffffffffffffffffffffffffffffffff81163b610699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e7472616374000000000000000000000000000000000000006064820152608401610350565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6105af565b60605f808573ffffffffffffffffffffffffffffffffffffffff16856040516106e9919061090b565b5f60405180830381855af49150503d805f8114610721576040519150601f19603f3d011682016040523d82523d5f602084013e610726565b606091505b509150915061073786838387610741565b9695505050505050565b606083156107d65782515f036107cf5773ffffffffffffffffffffffffffffffffffffffff85163b6107cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610350565b50816107e0565b6107e083836107e8565b949350505050565b8151156107f85781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103509190610926565b803573ffffffffffffffffffffffffffffffffffffffff8116811461084f575f80fd5b919050565b5f60208284031215610864575f80fd5b6104e28261082c565b5f805f6040848603121561087f575f80fd5b6108888461082c565b9250602084013567ffffffffffffffff808211156108a4575f80fd5b818601915086601f8301126108b7575f80fd5b8135818111156108c5575f80fd5b8760208285010111156108d6575f80fd5b6020830194508093505050509250925092565b5f5b838110156109035781810151838201526020016108eb565b50505f910152565b5f825161091c8184602087016108e9565b9190910192915050565b602081525f82518060208401526109448160408501602087016108e9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212202ac98acbfbb3d3ac1b74050e18c4e76db25a3ff2801ec69bf85d0c61414d502b64736f6c63430008140033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000fadb60b5059e31614e02083ff6c021a24c31c891", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000007cd6d5063c7782d34e2b1b03ed89ecf4a1412148" + } + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 implementation", + "balance": "0", + "nonce": "1", + "address": "0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9", + "bytecode": "0x608060405234801561000f575f80fd5b506004361061004a575f3560e01c806301fd90441461004e578063257b36321461006a57806333d6247d14610089578063a3c573eb1461009e575b5f80fd5b61005760015481565b6040519081526020015b60405180910390f35b61005761007836600461015e565b5f6020819052908152604090205481565b61009c61009736600461015e565b6100ea565b005b6100c57f00000000000000000000000040e0576c0a7dff9dc460b29ba73e79abf73dd2a981565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610061565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000040e0576c0a7dff9dc460b29ba73e79abf73dd2a91614610159576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b5f6020828403121561016e575f80fd5b503591905056fea26469706673582212205108c6c4f924146b736832a1bdf696e20d900450207b7452462368d150f2c71c64736f6c63430008140033" + }, + { + "contractName": "PolygonZkEVMGlobalExitRootL2 proxy", + "balance": "0", + "nonce": "1", + "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa", + "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033", + "storage": { + "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x000000000000000000000000fadb60b5059e31614e02083ff6c021a24c31c891", + "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000dc64a140aa3e981100a9beca4e685f962f0cf6c9" + } + }, + { + "contractName": "PolygonZkEVMTimelock", + "balance": "0", + "nonce": "1", + "address": "0x0165878A594ca255338adfa4d48449f69242Eb8F", + "bytecode": "0x6080604052600436106101bd575f3560e01c806364d62353116100f2578063b1c5f42711610092578063d547741f11610062578063d547741f1461063a578063e38335e514610659578063f23a6e611461066c578063f27a0c92146106b0575f80fd5b8063b1c5f4271461058d578063bc197c81146105ac578063c4d252f5146105f0578063d45c44351461060f575f80fd5b80638f61f4f5116100cd5780638f61f4f5146104c557806391d14854146104f8578063a217fddf14610547578063b08e51c01461055a575f80fd5b806364d62353146104685780638065657f146104875780638f2a0bb0146104a6575f80fd5b8063248a9ca31161015d57806331d507501161013857806331d50750146103b357806336568abe146103d25780633a6aae72146103f1578063584b153e14610449575f80fd5b8063248a9ca3146103375780632ab0f529146103655780632f2ff15d14610394575f80fd5b80630d3cf6fc116101985780630d3cf6fc1461025e578063134008d31461029157806313bc9f20146102a4578063150b7a02146102c3575f80fd5b806301d5062a146101c857806301ffc9a7146101e957806307bd02651461021d575f80fd5b366101c457005b5f80fd5b3480156101d3575f80fd5b506101e76101e2366004611bf6565b6106c4565b005b3480156101f4575f80fd5b50610208610203366004611c65565b610757565b60405190151581526020015b60405180910390f35b348015610228575f80fd5b506102507fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610214565b348015610269575f80fd5b506102507f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101e761029f366004611ca4565b6107b2565b3480156102af575f80fd5b506102086102be366004611d0b565b6108a7565b3480156102ce575f80fd5b506103066102dd366004611e28565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610214565b348015610342575f80fd5b50610250610351366004611d0b565b5f9081526020819052604090206001015490565b348015610370575f80fd5b5061020861037f366004611d0b565b5f908152600160208190526040909120541490565b34801561039f575f80fd5b506101e76103ae366004611e8c565b6108cc565b3480156103be575f80fd5b506102086103cd366004611d0b565b6108f5565b3480156103dd575f80fd5b506101e76103ec366004611e8c565b61090d565b3480156103fc575f80fd5b506104247f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610214565b348015610454575f80fd5b50610208610463366004611d0b565b6109c5565b348015610473575f80fd5b506101e7610482366004611d0b565b6109da565b348015610492575f80fd5b506102506104a1366004611ca4565b610aaa565b3480156104b1575f80fd5b506101e76104c0366004611ef7565b610ae8565b3480156104d0575f80fd5b506102507fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b348015610503575f80fd5b50610208610512366004611e8c565b5f9182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b348015610552575f80fd5b506102505f81565b348015610565575f80fd5b506102507ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b348015610598575f80fd5b506102506105a7366004611fa0565b610d18565b3480156105b7575f80fd5b506103066105c63660046120be565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b3480156105fb575f80fd5b506101e761060a366004611d0b565b610d5c565b34801561061a575f80fd5b50610250610629366004611d0b565b5f9081526001602052604090205490565b348015610645575f80fd5b506101e7610654366004611e8c565b610e56565b6101e7610667366004611fa0565b610e7a565b348015610677575f80fd5b50610306610686366004612161565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106bb575f80fd5b50610250611121565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc16106ee81611200565b5f6106fd898989898989610aaa565b9050610709818461120d565b5f817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161074496959493929190612208565b60405180910390a3505050505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107ac57506107ac82611359565b92915050565b5f80527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661082e5761082e81336113ef565b5f61083d888888888888610aaa565b905061084981856114a6565b610855888888886115e2565b5f817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a60405161088c9493929190612252565b60405180910390a361089d816116e2565b5050505050505050565b5f818152600160205260408120546001811180156108c55750428111155b9392505050565b5f828152602081905260409020600101546108e681611200565b6108f0838361178a565b505050565b5f8181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109c18282611878565b5050565b5f818152600160208190526040822054610906565b333014610a69576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109ae565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b5f868686868686604051602001610ac696959493929190612208565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b1281611200565b888714610ba1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b888514610c30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b5f610c418b8b8b8b8b8b8b8b610d18565b9050610c4d818461120d565b5f5b8a811015610d0a5780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610c8c57610c8c612291565b9050602002016020810190610ca191906122be565b8d8d86818110610cb357610cb3612291565b905060200201358c8c87818110610ccc57610ccc612291565b9050602002810190610cde91906122d7565b8c8b604051610cf296959493929190612208565b60405180910390a3610d0381612365565b9050610c4f565b505050505050505050505050565b5f8888888888888888604051602001610d38989796959493929190612447565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610d8681611200565b610d8f826109c5565b610e1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109ae565b5f828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b5f82815260208190526040902060010154610e7081611200565b6108f08383611878565b5f80527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610ef657610ef681336113ef565b878614610f85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b878414611014576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109ae565b5f6110258a8a8a8a8a8a8a8a610d18565b905061103181856114a6565b5f5b8981101561110b575f8b8b8381811061104e5761104e612291565b905060200201602081019061106391906122be565b90505f8a8a8481811061107857611078612291565b905060200201359050365f8a8a8681811061109557611095612291565b90506020028101906110a791906122d7565b915091506110b7848484846115e2565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b58868686866040516110ee9493929190612252565b60405180910390a3505050508061110490612365565b9050611033565b50611115816116e2565b50505050505050505050565b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16158015906111ef57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111ef919061250c565b156111f957505f90565b5060025490565b61120a81336113ef565b50565b611216826108f5565b156112a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109ae565b6112ab611121565b81101561133a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109ae565b611344814261252b565b5f928352600160205260409092209190915550565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107ac57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107ac565b5f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109c15761142c8161192d565b61143783602061194c565b604051602001611448929190612560565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109ae916004016125e0565b6114af826108a7565b61153b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109ae565b80158061155657505f81815260016020819052604090912054145b6109c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109ae565b5f8473ffffffffffffffffffffffffffffffffffffffff1684848460405161160b929190612630565b5f6040518083038185875af1925050503d805f8114611645576040519150601f19603f3d011682016040523d82523d5f602084013e61164a565b606091505b50509050806116db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109ae565b5050505050565b6116eb816108a7565b611777576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109ae565b5f90815260016020819052604090912055565b5f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109c1575f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905561181a3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109c1575f8281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107ac73ffffffffffffffffffffffffffffffffffffffff831660145b60605f61195a83600261263f565b61196590600261252b565b67ffffffffffffffff81111561197d5761197d611d22565b6040519080825280601f01601f1916602001820160405280156119a7576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000815f815181106119dd576119dd612291565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a3f57611a3f612291565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a9053505f611a7984600261263f565b611a8490600161252b565b90505b6001811115611b20577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611ac557611ac5612291565b1a60f81b828281518110611adb57611adb612291565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690815f1a90535060049490941c93611b1981612656565b9050611a87565b5083156108c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109ae565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bac575f80fd5b919050565b5f8083601f840112611bc1575f80fd5b50813567ffffffffffffffff811115611bd8575f80fd5b602083019150836020828501011115611bef575f80fd5b9250929050565b5f805f805f805f60c0888a031215611c0c575f80fd5b611c1588611b89565b965060208801359550604088013567ffffffffffffffff811115611c37575f80fd5b611c438a828b01611bb1565b989b979a50986060810135976080820135975060a09091013595509350505050565b5f60208284031215611c75575f80fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108c5575f80fd5b5f805f805f8060a08789031215611cb9575f80fd5b611cc287611b89565b955060208701359450604087013567ffffffffffffffff811115611ce4575f80fd5b611cf089828a01611bb1565b979a9699509760608101359660809091013595509350505050565b5f60208284031215611d1b575f80fd5b5035919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611d9657611d96611d22565b604052919050565b5f82601f830112611dad575f80fd5b813567ffffffffffffffff811115611dc757611dc7611d22565b611df860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611d4f565b818152846020838601011115611e0c575f80fd5b816020850160208301375f918101602001919091529392505050565b5f805f8060808587031215611e3b575f80fd5b611e4485611b89565b9350611e5260208601611b89565b925060408501359150606085013567ffffffffffffffff811115611e74575f80fd5b611e8087828801611d9e565b91505092959194509250565b5f8060408385031215611e9d575f80fd5b82359150611ead60208401611b89565b90509250929050565b5f8083601f840112611ec6575f80fd5b50813567ffffffffffffffff811115611edd575f80fd5b6020830191508360208260051b8501011115611bef575f80fd5b5f805f805f805f805f60c08a8c031215611f0f575f80fd5b893567ffffffffffffffff80821115611f26575f80fd5b611f328d838e01611eb6565b909b50995060208c0135915080821115611f4a575f80fd5b611f568d838e01611eb6565b909950975060408c0135915080821115611f6e575f80fd5b50611f7b8c828d01611eb6565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b5f805f805f805f8060a0898b031215611fb7575f80fd5b883567ffffffffffffffff80821115611fce575f80fd5b611fda8c838d01611eb6565b909a50985060208b0135915080821115611ff2575f80fd5b611ffe8c838d01611eb6565b909850965060408b0135915080821115612016575f80fd5b506120238b828c01611eb6565b999c989b509699959896976060870135966080013595509350505050565b5f82601f830112612050575f80fd5b8135602067ffffffffffffffff82111561206c5761206c611d22565b8160051b61207b828201611d4f565b9283528481018201928281019087851115612094575f80fd5b83870192505b848310156120b35782358252918301919083019061209a565b979650505050505050565b5f805f805f60a086880312156120d2575f80fd5b6120db86611b89565b94506120e960208701611b89565b9350604086013567ffffffffffffffff80821115612105575f80fd5b61211189838a01612041565b94506060880135915080821115612126575f80fd5b61213289838a01612041565b93506080880135915080821115612147575f80fd5b5061215488828901611d9e565b9150509295509295909350565b5f805f805f60a08688031215612175575f80fd5b61217e86611b89565b945061218c60208701611b89565b93506040860135925060608601359150608086013567ffffffffffffffff8111156121b5575f80fd5b61215488828901611d9e565b81835281816020850137505f602082840101525f60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a060408201525f61223d60a0830186886121c1565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff85168152836020820152606060408201525f6122876060830184866121c1565b9695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f602082840312156122ce575f80fd5b6108c582611b89565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261230a575f80fd5b83018035915067ffffffffffffffff821115612324575f80fd5b602001915036819003821315611bef575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361239557612395612338565b5060010190565b8183525f6020808501808196508560051b81019150845f5b8781101561243a57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126123f2575f80fd5b8701858101903567ffffffffffffffff81111561240d575f80fd5b80360382131561241b575f80fd5b6124268682846121c1565b9a87019a95505050908401906001016123b4565b5091979650505050505050565b60a080825281018890525f8960c08301825b8b8110156124945773ffffffffffffffffffffffffffffffffffffffff61247f84611b89565b16825260209283019290910190600101612459565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8911156124cc575f80fd5b8860051b9150818a602083013701828103602090810160408501526124f4908201878961239c565b60608401959095525050608001529695505050505050565b5f6020828403121561251c575f80fd5b815180151581146108c5575f80fd5b808201808211156107ac576107ac612338565b5f5b83811015612558578181015183820152602001612540565b50505f910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f835161259781601785016020880161253e565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516125d481602884016020880161253e565b01602801949350505050565b602081525f82518060208401526125fe81604085016020870161253e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b818382375f9101908152919050565b80820281158282048414176107ac576107ac612338565b5f8161266457612664612338565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220d904e0b10230579952f8427a107aa4349f9a1f5799108d399b11e28b578463e464736f6c63430008140033", + "storage": { + "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10", + "0xaedcc9e7897c0d335bdc5d92fe3a8b4f23727fe558cd1c19f332b28716a30559": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xf5e61edb9c9cc6bfbae4463e9a2b1dd6ac3b44ddef38f18016e56ba0363910d9": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x60b9d94c75b7b3f721925089391e4644cd890cb5e6466f9596dfbd2c54e0b280": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x4b63b79f1e338a49559dcd3193ac9eecc50d0f275d24e97cc8c319e5a31a8bd0": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5", + "0x800d5dfe4bba53eedee06cd4546a27da8de00f12db83f56062976d4493fda899": "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5" + } + }, + { + "accountName": "keyless Deployer", + "balance": "0", + "nonce": "1", + "address": "0x694AB5383a002a4796f95530c14Cf0C25ec3EA03" + }, + { + "accountName": "deployer", + "balance": "100000000000000000000000", + "nonce": "8", + "address": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" + } + ], + "firstBatchData": { + "transactions": "0xf8c380808401c9c380942a3dd3eb832af982ec71669e178424b10dca2ede80b8a4d3476afe000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005ca1ab1e0000000000000000000000000000000000000000000000000000000005ca1ab1e1bff", + "globalExitRoot": "0x0000000000000000000000000000000000000000000000000000000000000000", + "timestamp": 1697640780, + "sequencer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" + } + } \ No newline at end of file diff --git a/docker/scripts/v1ToV2/hardhat.example.paris b/docker/scripts/v1ToV2/hardhat.example.paris new file mode 100644 index 000000000..41037f816 --- /dev/null +++ b/docker/scripts/v1ToV2/hardhat.example.paris @@ -0,0 +1,258 @@ +import "dotenv/config"; +import "@nomicfoundation/hardhat-toolbox"; +import "@openzeppelin/hardhat-upgrades"; +import "hardhat-dependency-compiler"; + +import {HardhatUserConfig} from "hardhat/config"; + +const DEFAULT_MNEMONIC = "test test test test test test test test test test test junk"; + +/* + * You need to export an object to set up your config + * Go to https://hardhat.org/config/ to learn more + */ + +/** + * @type import('hardhat/config').HardhatUserConfig + */ + +const config: HardhatUserConfig = { + dependencyCompiler: { + paths: [ + "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol", + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol", + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol", + ], // , + // keep: true + }, + solidity: { + compilers: [ + { + version: "0.8.17", + settings: { + optimizer: { + enabled: true, + runs: 999999, + }, + }, + }, + { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 999999, + }, + evmVersion: "paris", + }, + }, + { + version: "0.6.11", + settings: { + optimizer: { + enabled: true, + runs: 999999, + }, + }, + }, + { + version: "0.5.12", + settings: { + optimizer: { + enabled: true, + runs: 999999, + }, + }, + }, + { + version: "0.5.16", + settings: { + optimizer: { + enabled: true, + runs: 999999, + }, + }, + }, + ], + overrides: { + "contracts/v2/PolygonRollupManager.sol": { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 99, + }, + evmVersion: "paris", + }, // try yul optimizer + }, + "contracts/v2/PolygonZkEVMBridgeV2.sol": { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 99, + }, + evmVersion: "paris", + }, + }, + "contracts/lib/TokenWrapped.sol": { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 9999, // must be the same as bridge, for testing porpuses + }, + evmVersion: "paris", + }, + }, + "contracts/v2/mocks/PolygonRollupManagerMock.sol": { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 10, + }, + evmVersion: "paris", + }, // 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: "paris", + }, // try yul optimizer + }, + "contracts/v2/mocks/PolygonRollupManagerMockInternalTest.sol": { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 10, + }, + evmVersion: "paris", + }, // try yul optimizer + }, + }, + }, + networks: { + mainnet: { + url: process.env.MAINNET_PROVIDER + ? process.env.MAINNET_PROVIDER + : `https://mainnet.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + ropsten: { + url: process.env.ROPSTEN_PROVIDER + ? process.env.ROPSTEN_PROVIDER + : `https://ropsten.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + goerli: { + url: process.env.GOERLI_PROVIDER + ? process.env.GOERLI_PROVIDER + : `https://goerli.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + rinkeby: { + url: process.env.RINKEBY_PROVIDER + ? process.env.RINKEBY_PROVIDER + : `https://rinkeby.infura.io/v3/${process.env.INFURA_PROJECT_ID}`, + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + localhost: { + url: "http://127.0.0.1:8545", + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + hardhat: { + initialDate: "0", + //allowUnlimitedContractSize: true, + initialBaseFeePerGas: 0, + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + polygonZKEVMTestnet: { + url: "https://rpc.public.zkevm-test.net", + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + polygonZKEVMMainnet: { + url: "https://zkevm-rpc.com", + accounts: { + mnemonic: process.env.MNEMONIC || DEFAULT_MNEMONIC, + path: "m/44'/60'/0'/0", + initialIndex: 0, + count: 20, + }, + }, + }, + gasReporter: { + enabled: !!process.env.REPORT_GAS, + outputFile: process.env.REPORT_GAS_FILE ? "./gas_report.md" : undefined, + noColors: !!process.env.REPORT_GAS_FILE, + }, + etherscan: { + apiKey: { + polygonZKEVMTestnet: `${process.env.ETHERSCAN_ZKEVM_API_KEY}`, + polygonZKEVMMainnet: `${process.env.ETHERSCAN_ZKEVM_API_KEY}`, + goerli: `${process.env.ETHERSCAN_API_KEY}`, + mainnet: `${process.env.ETHERSCAN_API_KEY}`, + }, + customChains: [ + { + network: "polygonZKEVMMainnet", + chainId: 1101, + urls: { + apiURL: "https://api-zkevm.polygonscan.com/api", + browserURL: "https://zkevm.polygonscan.com/", + }, + }, + { + network: "polygonZKEVMTestnet", + chainId: 1442, + urls: { + apiURL: "https://api-testnet-zkevm.polygonscan.com/api", + browserURL: "https://testnet-zkevm.polygonscan.com/", + }, + }, + ], + }, +}; + +export default config; diff --git a/docker/scripts/v2/deploy-docker.sh b/docker/scripts/v2/deploy-docker.sh index 63a8586f3..adfb268e2 100755 --- a/docker/scripts/v2/deploy-docker.sh +++ b/docker/scripts/v2/deploy-docker.sh @@ -4,10 +4,12 @@ DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml up -d geth sleep 5 node docker/scripts/fund-accounts.js cp docker/scripts/v2/deploy_parameters_docker.json deployment/v2/deploy_parameters.json +cp docker/scripts/v2/create_rollup_parameters.json deployment/v2/create_rollup_parameters.json npm run deploy:testnet:v2:localhost mkdir docker/deploymentOutput mv deployment/v2/deploy_output.json docker/deploymentOutput mv deployment/v2/genesis.json docker/deploymentOutput +mv deployment/v2/create_rollup_output.json docker/deploymentOutput DEV_PERIOD=1 docker-compose -f docker/docker-compose.geth.yml down sudo docker build -t hermeznetwork/geth-zkevm-contracts -f docker/Dockerfile.geth . # Let it readable for the multiplatform build coming later! diff --git a/package.json b/package.json index d92adee1d..c6cf9354f 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,11 @@ "deploy:v2:sepolia": "npx hardhat compile && npx ts-node deployment/v2/1_createGenesis.ts && npx hardhat run deployment/v2/2_deployPolygonZKEVMDeployer.ts --network sepolia && npx hardhat run deployment/v2/3_deployContracts.ts --network sepolia && npx hardhat run deployment/v2/4_createRollup.ts --network sepolia && npm run saveDeployment:sepolia", "deploy:testnet:v2:sepolia": "npx hardhat compile && rm -f deployment/v2/deploy_ongoing.json && npm run prepare:testnet:ZkEVM:sepolia && npm run deploy:v2:sepolia", "verify:v2:sepolia": "npx hardhat run deployment/v2/verifyContracts.js --network sepolia", + "prepare:v1ToV2:ZkEVM:localhost": "npx hardhat run deployment/v1ToV2/prepareTestnet.ts --network localhost", + "deploy:v1ToV2:localhost": "npx hardhat compile && rm -f .openzeppelin/unknown-31337.json && npx ts-node deployment/v1ToV2/1_createGenesis.ts --test && npx hardhat run deployment/v1ToV2/2_deployPolygonZKEVMDeployer.ts --network localhost && npx hardhat run deployment/v1ToV2/3_deployContracts.ts --network localhost", + "deploy:testnet:v1ToV2:localhost": "npx hardhat compile && rm -f deployment/v1ToV2/deploy_ongoing.json && npm run prepare:v1ToV2:ZkEVM:localhost && npm run deploy:v1ToV2:localhost", + "docker:v1ToV2:contracts": "./docker/scripts/v1ToV2/deploy-docker.sh", + "dockerv2:v1ToV2:contracts": "sudo ./docker/scripts/v1ToV2/deploy-dockerv2.sh", "saveDeployment:sepolia": "mkdir -p deployments/sepolia_$(date +%s) && cp -r deployment/v2/deploy_*.json deployments/sepolia_$(date +%s) && cp .openzeppelin/sepolia.json deployments/sepolia_$(date +%s) && cp deployment/v2/genesis.json deployments/sepolia_$(date +%s) && cp deployment/v2/create_rollup_output.json deployments/sepolia_$(date +%s)" } }