From 02ed6ce8667a040b8beb6d3a6a8a7e0f94dbfdbd Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Tue, 7 May 2024 13:56:03 -0400 Subject: [PATCH] Remove fractalRegistryContract from BaseContracts, resolve all downstream issues --- src/hooks/DAO/useBuildDAOTx.ts | 5 +++-- src/hooks/DAO/useDeployAzorius.ts | 5 +++-- src/models/DaoTxBuilder.ts | 9 +++++++-- src/models/TxBuilderFactory.ts | 4 ++++ src/types/contract.ts | 2 -- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/hooks/DAO/useBuildDAOTx.ts b/src/hooks/DAO/useBuildDAOTx.ts index cc0bb141c6..55f5577eca 100644 --- a/src/hooks/DAO/useBuildDAOTx.ts +++ b/src/hooks/DAO/useBuildDAOTx.ts @@ -24,6 +24,7 @@ const useBuildDAOTx = () => { votesERC20WrapperMasterCopy, votesERC20MasterCopy, keyValuePairs, + fractalRegistry, }, } = useNetworkConfig(); @@ -54,7 +55,6 @@ const useBuildDAOTx = () => { linearVotingERC721MasterCopyContract, fractalAzoriusMasterCopyContract, zodiacModuleProxyFactoryContract, - fractalRegistryContract, fractalModuleMasterCopyContract, multisigFreezeGuardMasterCopyContract, azoriusFreezeGuardMasterCopyContract, @@ -94,7 +94,6 @@ const useBuildDAOTx = () => { const buildrerBaseContracts: BaseContracts = { fractalModuleMasterCopyContract: fractalModuleMasterCopyContract.asSigner, - fractalRegistryContract: fractalRegistryContract.asSigner, safeFactoryContract: safeFactoryContract.asSigner, safeSingletonContract: safeSingletonContract.asSigner, multisigFreezeGuardMasterCopyContract: multisigFreezeGuardMasterCopyContract.asSigner, @@ -115,6 +114,7 @@ const useBuildDAOTx = () => { votesERC20WrapperMasterCopy, votesERC20MasterCopy, keyValuePairs, + fractalRegistry, parentAddress, parentTokenAddress, ); @@ -165,6 +165,7 @@ const useBuildDAOTx = () => { votesERC20WrapperMasterCopy, votesERC20MasterCopy, keyValuePairs, + fractalRegistry, ], ); diff --git a/src/hooks/DAO/useDeployAzorius.ts b/src/hooks/DAO/useDeployAzorius.ts index 24381bc103..36a54ada62 100644 --- a/src/hooks/DAO/useDeployAzorius.ts +++ b/src/hooks/DAO/useDeployAzorius.ts @@ -27,6 +27,7 @@ const useDeployAzorius = () => { votesERC20WrapperMasterCopy, votesERC20MasterCopy, keyValuePairs, + fractalRegistry, }, addressPrefix, } = useNetworkConfig(); @@ -57,7 +58,6 @@ const useDeployAzorius = () => { linearVotingERC721MasterCopyContract, fractalAzoriusMasterCopyContract, zodiacModuleProxyFactoryContract, - fractalRegistryContract, fractalModuleMasterCopyContract, multisigFreezeGuardMasterCopyContract, azoriusFreezeGuardMasterCopyContract, @@ -78,7 +78,6 @@ const useDeployAzorius = () => { const builderBaseContracts: BaseContracts = { fractalModuleMasterCopyContract: fractalModuleMasterCopyContract.asProvider, - fractalRegistryContract: fractalRegistryContract.asProvider, safeFactoryContract: safeFactoryContract.asProvider, safeSingletonContract: safeSingletonContract.asProvider, multisigFreezeGuardMasterCopyContract: multisigFreezeGuardMasterCopyContract.asProvider, @@ -99,6 +98,7 @@ const useDeployAzorius = () => { votesERC20WrapperMasterCopy, votesERC20MasterCopy, keyValuePairs, + fractalRegistry, undefined, undefined, ); @@ -160,6 +160,7 @@ const useDeployAzorius = () => { votesERC20WrapperMasterCopy, votesERC20MasterCopy, keyValuePairs, + fractalRegistry, ], ); diff --git a/src/models/DaoTxBuilder.ts b/src/models/DaoTxBuilder.ts index df2cd83588..cda0b12a55 100644 --- a/src/models/DaoTxBuilder.ts +++ b/src/models/DaoTxBuilder.ts @@ -1,5 +1,6 @@ import { ethers } from 'ethers'; import { PublicClient, getAddress, zeroAddress } from 'viem'; +import FractalRegistryAbi from '../assets/abi/FractalRegistry'; import KeyValuePairsAbi from '../assets/abi/KeyValuePairs'; import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts'; import { buildContractCall, buildContractCallViem, encodeMultiSend } from '../helpers'; @@ -34,6 +35,7 @@ export class DaoTxBuilder extends BaseTxBuilder { private internalTxs: SafeTransaction[] = []; private readonly keyValuePairsAddress: string; + private readonly fractalRegistryAddress: string; constructor( signerOrProvider: ethers.Signer | any, @@ -46,6 +48,7 @@ export class DaoTxBuilder extends BaseTxBuilder { safeContract: GnosisSafeL2, txBuilderFactory: TxBuilderFactory, keyValuePairsAddress: string, + fractalRegistryAddress: string, parentAddress?: string, parentTokenAddress?: string, parentStrategyType?: VotingStrategyType, @@ -69,6 +72,7 @@ export class DaoTxBuilder extends BaseTxBuilder { this.parentStrategyAddress = parentStrategyAddress; this.keyValuePairsAddress = keyValuePairsAddress; + this.fractalRegistryAddress = fractalRegistryAddress; // Prep fractal module txs for setting up subDAOs this.setFractalModuleTxs(); @@ -227,8 +231,9 @@ export class DaoTxBuilder extends BaseTxBuilder { // private buildUpdateDAONameTx(): SafeTransaction { - return buildContractCall( - this.baseContracts.fractalRegistryContract, + return buildContractCallViem( + FractalRegistryAbi, + getAddress(this.fractalRegistryAddress), 'updateDAOName', [this.daoData.daoName], 0, diff --git a/src/models/TxBuilderFactory.ts b/src/models/TxBuilderFactory.ts index 4a5a98c0f3..0b77d858ef 100644 --- a/src/models/TxBuilderFactory.ts +++ b/src/models/TxBuilderFactory.ts @@ -32,6 +32,7 @@ export class TxBuilderFactory extends BaseTxBuilder { private votesERC20WrapperMasterCopyAddress: string; private votesERC20MasterCopyAddress: string; private keyValuePairsAddress: string; + private fractalRegistryAddress: string; constructor( signerOrProvider: ethers.Signer | any, @@ -43,6 +44,7 @@ export class TxBuilderFactory extends BaseTxBuilder { votesERC20WrapperMasterCopyAddress: string, votesERC20MasterCopyAddress: string, keyValuePairsAddress: string, + fractalRegistryAddress: string, parentAddress?: string, parentTokenAddress?: string, ) { @@ -61,6 +63,7 @@ export class TxBuilderFactory extends BaseTxBuilder { this.votesERC20WrapperMasterCopyAddress = votesERC20WrapperMasterCopyAddress; this.votesERC20MasterCopyAddress = votesERC20MasterCopyAddress; this.keyValuePairsAddress = keyValuePairsAddress; + this.fractalRegistryAddress = fractalRegistryAddress; } public setSafeContract(safeAddress: string) { @@ -100,6 +103,7 @@ export class TxBuilderFactory extends BaseTxBuilder { this.safeContract!, this, this.keyValuePairsAddress, + this.fractalRegistryAddress, this.parentAddress, this.parentTokenAddress, parentStrategyType, diff --git a/src/types/contract.ts b/src/types/contract.ts index 881eb564c1..3dd200a263 100644 --- a/src/types/contract.ts +++ b/src/types/contract.ts @@ -2,7 +2,6 @@ import { GnosisSafeProxyFactory, ModuleProxyFactory, FractalModule, - FractalRegistry, MultisigFreezeGuard, MultisigFreezeVoting, ERC20FreezeVoting, @@ -22,7 +21,6 @@ export type ContractConnection = { export interface BaseContracts { fractalModuleMasterCopyContract: FractalModule; - fractalRegistryContract: FractalRegistry; safeFactoryContract: GnosisSafeProxyFactory; safeSingletonContract: GnosisSafeL2; multisigFreezeGuardMasterCopyContract: MultisigFreezeGuard;