From 29900ee1315e517549513b5f022a244b6fd57019 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Tue, 4 Jun 2024 00:22:24 -0400 Subject: [PATCH] add missing user and recipient registries --- contracts/tasks/runners/verifyAll.ts | 51 +++++++++++++++++++--------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/contracts/tasks/runners/verifyAll.ts b/contracts/tasks/runners/verifyAll.ts index 74972fe0c..7aa910b72 100644 --- a/contracts/tasks/runners/verifyAll.ts +++ b/contracts/tasks/runners/verifyAll.ts @@ -16,6 +16,7 @@ import { BaseContract } from 'ethers' import { HardhatEthersHelpers } from '@nomicfoundation/hardhat-ethers/types' import { ZERO_ADDRESS } from '../../utils/constants' import { ConstructorArguments } from '../helpers/ConstructorArguments' +import { getContractAt } from '../../utils/contracts' type ContractInfo = { name: string @@ -138,6 +139,8 @@ async function getContractList( clrfund: string, ethers: HardhatEthersHelpers ): Promise { + const userRegistries = new Set() + const recipientRegistries = new Set() const contractList: ContractInfo[] = [ { name: EContracts.ClrFund, @@ -145,10 +148,11 @@ async function getContractList( }, ] - const clrfundContract = (await ethers.getContractAt( + const clrfundContract = await getContractAt( EContracts.ClrFund, - clrfund - )) as BaseContract as ClrFund + clrfund, + ethers + ) const fundingRoundFactoryAddress = await clrfundContract.roundFactory() if (fundingRoundFactoryAddress !== ZERO_ADDRESS) { @@ -192,6 +196,16 @@ async function getContractList( }) } + const userRegistryAddress = await clrfundContract.userRegistry() + if (userRegistryAddress !== ZERO_ADDRESS) { + userRegistries.add(userRegistryAddress) + } + + const recipientRegistryAddress = await clrfundContract.recipientRegistry() + if (recipientRegistryAddress !== ZERO_ADDRESS) { + recipientRegistries.add(recipientRegistryAddress) + } + const fundingRoundAddress = await clrfundContract.getCurrentRound() if (fundingRoundAddress !== ZERO_ADDRESS) { contractList.push({ @@ -255,27 +269,32 @@ async function getContractList( // User Registry const userRegistryAddress = await fundingRound.userRegistry() if (userRegistryAddress !== ZERO_ADDRESS) { - const name = await getUserRegistryName(userRegistryAddress, ethers) - contractList.push({ - name, - address: userRegistryAddress, - }) + userRegistries.add(userRegistryAddress) } // Recipient Registry const recipientRegistryAddress = await fundingRound.recipientRegistry() if (recipientRegistryAddress !== ZERO_ADDRESS) { - const name = await getRecipientRegistryName( - recipientRegistryAddress, - ethers - ) - contractList.push({ - name, - address: recipientRegistryAddress, - }) + recipientRegistries.add(recipientRegistryAddress) } } + for (const address of userRegistries) { + const name = await getUserRegistryName(address, ethers) + contractList.push({ + name, + address, + }) + } + + for (const address of recipientRegistries) { + const name = await getRecipientRegistryName(address, ethers) + contractList.push({ + name, + address, + }) + } + return contractList }