Skip to content

Commit

Permalink
Bubbling up verification artifacts to verification.json (#2817)
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk authored Oct 19, 2023
1 parent b0870b1 commit a330c71
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
6 changes: 5 additions & 1 deletion typescript/sdk/src/core/HyperlaneCoreDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ export class HyperlaneCoreDeployer extends HyperlaneDeployer<
config,
coreAddresses,
);
this.addDeployedContracts(chain, hooks);
this.addDeployedContracts(
chain,
hooks,
this.hookDeployer.verificationInputs[chain],
);
return hooks[config.type].address;
}

Expand Down
27 changes: 17 additions & 10 deletions typescript/sdk/src/deploy/HyperlaneDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,26 @@ export abstract class HyperlaneDeployer<
protected addDeployedContracts(
chain: ChainName,
contracts: HyperlaneContracts<any>,
) {
verificationInputs?: ContractVerificationInput[],
): void {
this.deployedContracts[chain] = {
...this.deployedContracts[chain],
...contracts,
};
if (verificationInputs)
this.addVerificationArtifacts(chain, verificationInputs);
}

protected addVerificationArtifacts(
chain: ChainName,
artifacts: ContractVerificationInput[],
): void {
this.verificationInputs[chain] = this.verificationInputs[chain] || [];
artifacts.forEach((artifact) => {
this.verificationInputs[chain].push(artifact);
});

// TODO: deduplicate
}

protected async runIf<T>(
Expand Down Expand Up @@ -275,19 +290,11 @@ export abstract class HyperlaneDeployer<
contract,
factory.bytecode,
);
this.addVerificationArtifact(chain, verificationInput);
this.addVerificationArtifacts(chain, [verificationInput]);

return contract;
}

protected addVerificationArtifact(
chain: ChainName,
artifact: ContractVerificationInput,
) {
this.verificationInputs[chain] = this.verificationInputs[chain] || [];
this.verificationInputs[chain].push(artifact);
}

async deployContract<K extends keyof Factories>(
chain: ChainName,
contractName: K,
Expand Down
12 changes: 8 additions & 4 deletions typescript/sdk/src/deploy/HyperlaneProxyFactoryDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ export class HyperlaneProxyFactoryDeployer extends HyperlaneDeployer<
this.factories,
) as (keyof ProxyFactoryFactories)[]) {
const factory = await this.deployContract(chain, factoryName, []);
this.addVerificationArtifact(chain, {
name: proxyFactoryImplementations[factoryName],
address: await factory.implementation(),
});
this.addVerificationArtifacts(chain, [
{
name: proxyFactoryImplementations[factoryName],
address: await factory.implementation(),
constructorArguments: '',
isProxy: true,
},
]);
contracts[factoryName] = factory;
}
return contracts as HyperlaneContracts<ProxyFactoryFactories>;
Expand Down
7 changes: 6 additions & 1 deletion typescript/sdk/src/hook/HyperlaneHookDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ export class HyperlaneHookDeployer extends HyperlaneDeployer<
);
}
const igpContracts = await this.igpDeployer.deployContracts(chain, config);
this.addDeployedContracts(chain, igpContracts);
// bubbling up addresses and verification input artifacts
this.addDeployedContracts(
chain,
igpContracts,
this.igpDeployer.verificationInputs[chain],
);
return igpContracts;
}

Expand Down

0 comments on commit a330c71

Please sign in to comment.