diff --git a/contracts/tasks/helpers/ContractStorage.ts b/contracts/tasks/helpers/ContractStorage.ts index dcca53fa63..d74a34e69e 100644 --- a/contracts/tasks/helpers/ContractStorage.ts +++ b/contracts/tasks/helpers/ContractStorage.ts @@ -87,6 +87,7 @@ export class ContractStorage { const logEntry: IStorageInstanceEntry = { id, + deploymentTxHash: deploymentTx?.hash, }; if (args !== undefined) { @@ -177,6 +178,20 @@ export class ContractStorage { return address; } + /** + * Get Contract Deployment Transaction Hash + */ + getDeploymentTxHash(id: EContracts, network: string, address: string): string | undefined { + const collection = this.db.get(`${network}.instance.${address}`); + const instanceEntry = collection.value() as IStorageInstanceEntry | undefined; + + if (instanceEntry?.id !== id) { + throw new Error(`Contract ${id} with address ${address} and network ${network} not found.`); + } + + return instanceEntry.deploymentTxHash; + } + /** * Get contract from the json file with sizes and multi count * diff --git a/contracts/tasks/helpers/types.ts b/contracts/tasks/helpers/types.ts index 11969112f6..77fbedc51b 100644 --- a/contracts/tasks/helpers/types.ts +++ b/contracts/tasks/helpers/types.ts @@ -431,6 +431,11 @@ export interface IStorageInstanceEntry { */ id: string; + /** + * Deployment Transaction Hash + */ + deploymentTxHash?: string; + /** * Params for verification */