Skip to content

Commit

Permalink
debug: update verification script
Browse files Browse the repository at this point in the history
  • Loading branch information
viraj124 committed Sep 24, 2024
1 parent 2a77edc commit 0560d16
Showing 1 changed file with 3 additions and 39 deletions.
42 changes: 3 additions & 39 deletions packages/solidity-contracts/scripts/hardhat/verifyDeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ task('verify-deployment', 'Verifies the deployed contract bytecode').setAction(

const deployments = await hre.deployments.all();


for (const [contractName, deployment] of Object.entries(deployments)) {
console.log(`\nVerifying ${contractName} (${deployment.address}):`);



try {
console.log('--- Fetching deployed bytecode...');
let deployedBytecode: string;
Expand All @@ -33,7 +30,6 @@ task('verify-deployment', 'Verifies the deployed contract bytecode').setAction(
const ContractFactory = await localHardhat.ethers.getContractFactory(
deployment.linkedData.factory
);
let localAddress: string;

if (!deployment.linkedData.isProxy) {
console.log('--- Validating Upgrade...');
Expand All @@ -47,46 +43,14 @@ task('verify-deployment', 'Verifies the deployed contract bytecode').setAction(
);

console.log('--- Upgrade Validated...');

console.log(
'--- Performing mock upgrade to fetch the local bytecode...'
);

const proxyfactory = await localHardhat.ethers.getContractFactory(
contractName
);
const proxy = await localHardhat.upgrades.deployProxy(proxyfactory, [], {
initializer: 'initialize',
constructorArgs: deployment.linkedData.constructorArgs,
});

await proxy.waitForDeployment();


const contract = await localHardhat.upgrades.upgradeProxy(
deployment.address,
ContractFactory,
{
kind: 'uups',
constructorArgs: deployment.linkedData.constructorArgs,
}
);

console.log('--- Upgrade successful');
await contract.waitForDeployment();
localAddress = await contract.getAddress();
} else continue;

console.log('--- Fetching local deployment bytecode...');
let localBytecode: string;
if (!deployment.linkedData.isProxy) {

localBytecode = await hre.ethers.provider.getCode(
localAddress
);
// await (await hre.artifacts.readArtifact(deployment.linkedData.factory)).deployedBytecode

// localBytecode = await (await hre.artifacts.readArtifact(deployment.linkedData.factory)).deployedBytecode
localBytecode = await (
await hre.artifacts.readArtifact(deployment.linkedData.factory)
).bytecode;
} else continue;

console.log('--- Comparing bytecodes...');
Expand Down

0 comments on commit 0560d16

Please sign in to comment.