diff --git a/contracts/tasks/helpers/Deployment.ts b/contracts/tasks/helpers/Deployment.ts index 830c03af08..f469647d73 100644 --- a/contracts/tasks/helpers/Deployment.ts +++ b/contracts/tasks/helpers/Deployment.ts @@ -396,10 +396,14 @@ export class Deployment { * @param {IGetContractParams} params - params * @returns contract wrapper */ - async getContract({ name, key, address, signer }: IGetContractParams): Promise { + async getContract({ name, key, address, abi, signer }: IGetContractParams): Promise { const deployer = signer || (await this.getDeployer()); const contractAddress = address || this.storage.mustGetAddress(name, this.hre!.network.name, key); + if (abi) { + return new BaseContract(contractAddress, abi, deployer) as unknown as T; + } + const factory = await this.hre?.ethers.getContractAt(name.toString(), contractAddress, deployer); if (!factory) { diff --git a/contracts/tasks/helpers/types.ts b/contracts/tasks/helpers/types.ts index 1666da8fdc..040d4e250f 100644 --- a/contracts/tasks/helpers/types.ts +++ b/contracts/tasks/helpers/types.ts @@ -1,6 +1,15 @@ import type { AccQueue, MACI, MessageProcessor, Poll, Tally, Verifier, VkRegistry } from "../../typechain-types"; import type { HardhatEthersSigner } from "@nomicfoundation/hardhat-ethers/signers"; -import type { BaseContract, BigNumberish, Fragment, JsonFragment, Signer, ContractFactory } from "ethers"; +import type { + BaseContract, + BigNumberish, + Fragment, + JsonFragment, + Signer, + ContractFactory, + Interface, + InterfaceAbi, +} from "ethers"; import type { Libraries, TaskArguments } from "hardhat/types"; import type { Poll as PollWrapper } from "maci-core"; import type { Keypair, PrivKey } from "maci-domainobjs"; @@ -362,6 +371,11 @@ export interface IGetContractParams { */ address?: string; + /** + * Contract abi + */ + abi?: Interface | InterfaceAbi; + /** * Eth signer */