Skip to content

Commit

Permalink
fix contract verification error
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed May 13, 2024
1 parent 2f980e2 commit 3724763
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 3 additions & 2 deletions contracts/tasks/helpers/ConstructorArguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Poll,
Tally,
} from '../../typechain-types'
import { getContractAt } from '../../utils/contracts'
import { getContractAt, getQualifiedContractName } from '../../utils/contracts'

/** A list of functions to get contract constructor arguments from the contract */
const ConstructorArgumentsGetters: Record<
Expand Down Expand Up @@ -312,7 +312,8 @@ export class ConstructorArguments {
address: string,
ethers: HardhatEthersHelpers
): Promise<Array<unknown>> {
const contractArtifact = this.hre.artifacts.readArtifactSync(name)
const qualifiedName = getQualifiedContractName(name)
const contractArtifact = this.hre.artifacts.readArtifactSync(qualifiedName)
const contractInterface = new Interface(contractArtifact.abi)
if (contractInterface.deploy.inputs.length === 0) {
// no argument
Expand Down
8 changes: 3 additions & 5 deletions contracts/utils/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,13 @@ export async function getCurrentFundingRoundContract(
* @param name The contract name
* @returns The qualified contract name
*/
export function getQualifiedContractName(name: EContracts): string {
export function getQualifiedContractName(name: EContracts | string): string {
let contractName = String(name)
if (contractName.includes('Poseidon')) {
contractName = `:${name}`
}
if (name === EContracts.PollFactory) {
} else if (name === EContracts.PollFactory) {
contractName = 'contracts/maci/PollFactory.sol:PollFactory'
}
if (name === EContracts.Poll) {
} else if (name === EContracts.Poll) {
contractName = 'contracts/maci/Poll.sol:Poll'
}
return contractName
Expand Down

0 comments on commit 3724763

Please sign in to comment.