diff --git a/src/deployment/verifyContracts.js b/src/deployment/verifyContracts.js index 9a038686..82abcf44 100644 --- a/src/deployment/verifyContracts.js +++ b/src/deployment/verifyContracts.js @@ -9,6 +9,16 @@ const pathDeployParameters = path.join(__dirname, './deploy_parameters.json'); const deployOutputParameters = require(pathDeployOutputParameters); const deployParameters = require(pathDeployParameters); +async function getImplementationAddress(proxyAddress) { + // The specific storage slot for the implementation address as per EIP-1967 + const slot = '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'; + // Query the storage at the slot + const implementationAddressHex = await hre.ethers.provider.getStorageAt(proxyAddress, slot); + // Convert the storage result to a proper address format + const implementationAddress = hre.ethers.utils.getAddress(hre.ethers.utils.hexStripZeros(implementationAddressHex)); + return implementationAddress; +} + async function main() { // load deployer account if (typeof process.env.ETHERSCAN_API_KEY === 'undefined') { @@ -121,6 +131,19 @@ async function main() { expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); } + // verify zkEVM implementation address + try { + const implemenation = await getImplementationAddress(deployOutputParameters.polygonZkEVMAddress); + await hre.run( + 'verify:verify', + { + address: implemenation, + }, + ); + } catch (error) { + expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + } + // verify global exit root address try { await hre.run( @@ -133,6 +156,19 @@ async function main() { expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); } + // verify global exit implementation address + try { + const implemenation = await getImplementationAddress(deployOutputParameters.polygonZkEVMGlobalExitRootAddress); + await hre.run( + 'verify:verify', + { + address: implemenation, + }, + ); + } catch (error) { + expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + } + // verify bridge try { await hre.run( @@ -150,6 +186,19 @@ async function main() { expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); } + // verify bridge implementation address + try { + const implemenation = await getImplementationAddress(deployOutputParameters.polygonZkEVMBridgeAddress); + await hre.run( + 'verify:verify', + { + address: implemenation, + }, + ); + } catch (error) { + expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + } + // verify forking manager try { await hre.run( @@ -161,6 +210,19 @@ async function main() { } catch (error) { expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); } + + // verify fork manager implementation address + try { + const implemenation = await getImplementationAddress(deployOutputParameters.forkingManager); + await hre.run( + 'verify:verify', + { + address: implemenation, + }, + ); + } catch (error) { + expect(error.message.toLowerCase().includes('proxyadmin')).to.be.equal(true); + } } main()