Skip to content

Commit

Permalink
add missing user and recipient registries
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Jun 4, 2024
1 parent 1d8a6eb commit 29900ee
Showing 1 changed file with 35 additions and 16 deletions.
51 changes: 35 additions & 16 deletions contracts/tasks/runners/verifyAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -138,17 +139,20 @@ async function getContractList(
clrfund: string,
ethers: HardhatEthersHelpers
): Promise<ContractInfo[]> {
const userRegistries = new Set<string>()
const recipientRegistries = new Set<string>()
const contractList: ContractInfo[] = [
{
name: EContracts.ClrFund,
address: clrfund,
},
]

const clrfundContract = (await ethers.getContractAt(
const clrfundContract = await getContractAt<ClrFund>(
EContracts.ClrFund,
clrfund
)) as BaseContract as ClrFund
clrfund,
ethers
)

const fundingRoundFactoryAddress = await clrfundContract.roundFactory()
if (fundingRoundFactoryAddress !== ZERO_ADDRESS) {
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 29900ee

Please sign in to comment.