diff --git a/src/hooks/DAO/useBuildDAOTx.ts b/src/hooks/DAO/useBuildDAOTx.ts index 7a0c90c18b..23c846641e 100644 --- a/src/hooks/DAO/useBuildDAOTx.ts +++ b/src/hooks/DAO/useBuildDAOTx.ts @@ -19,7 +19,12 @@ const useBuildDAOTx = () => { const signerOrProvider = useSignerOrProvider(); const { createOptions, - contracts: { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy }, + contracts: { + fallbackHandler, + votesERC20WrapperMasterCopy, + votesERC20MasterCopy, + keyValuePairs, + }, } = useNetworkConfig(); const { @@ -111,6 +116,7 @@ const useBuildDAOTx = () => { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy, + keyValuePairs, parentAddress, parentTokenAddress, ); @@ -160,6 +166,7 @@ const useBuildDAOTx = () => { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy, + keyValuePairs, ], ); diff --git a/src/hooks/DAO/useDeployAzorius.ts b/src/hooks/DAO/useDeployAzorius.ts index 58fc7ddb1f..11789c75a8 100644 --- a/src/hooks/DAO/useDeployAzorius.ts +++ b/src/hooks/DAO/useDeployAzorius.ts @@ -22,7 +22,12 @@ const useDeployAzorius = () => { const signerOrProvider = useSignerOrProvider(); const navigate = useNavigate(); const { - contracts: { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy }, + contracts: { + fallbackHandler, + votesERC20WrapperMasterCopy, + votesERC20MasterCopy, + keyValuePairs, + }, addressPrefix, } = useNetworkConfig(); const { @@ -58,7 +63,6 @@ const useDeployAzorius = () => { freezeMultisigVotingMasterCopyContract, freezeERC20VotingMasterCopyContract, claimingMasterCopyContract, - keyValuePairsContract, } = baseContracts; let azoriusContracts; @@ -79,7 +83,6 @@ const useDeployAzorius = () => { freezeERC20VotingMasterCopyContract: freezeERC20VotingMasterCopyContract.asProvider, freezeMultisigVotingMasterCopyContract: freezeMultisigVotingMasterCopyContract.asProvider, zodiacModuleProxyFactoryContract: zodiacModuleProxyFactoryContract.asProvider, - keyValuePairsContract: keyValuePairsContract.asProvider, } as BaseContracts; const txBuilderFactory = new TxBuilderFactory( @@ -91,6 +94,7 @@ const useDeployAzorius = () => { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy, + keyValuePairs, undefined, undefined, ); @@ -151,6 +155,7 @@ const useDeployAzorius = () => { addressPrefix, votesERC20WrapperMasterCopy, votesERC20MasterCopy, + keyValuePairs, ], ); diff --git a/src/models/DaoTxBuilder.ts b/src/models/DaoTxBuilder.ts index 5bc726442c..df2cd83588 100644 --- a/src/models/DaoTxBuilder.ts +++ b/src/models/DaoTxBuilder.ts @@ -1,7 +1,8 @@ import { ethers } from 'ethers'; -import { PublicClient, zeroAddress } from 'viem'; +import { PublicClient, getAddress, zeroAddress } from 'viem'; +import KeyValuePairsAbi from '../assets/abi/KeyValuePairs'; import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts'; -import { buildContractCall, encodeMultiSend } from '../helpers'; +import { buildContractCall, buildContractCallViem, encodeMultiSend } from '../helpers'; import { BaseContracts, SafeMultisigDAO, @@ -32,6 +33,8 @@ export class DaoTxBuilder extends BaseTxBuilder { private internalTxs: SafeTransaction[] = []; + private readonly keyValuePairsAddress: string; + constructor( signerOrProvider: ethers.Signer | any, publicClient: PublicClient, @@ -42,6 +45,7 @@ export class DaoTxBuilder extends BaseTxBuilder { createSafeTx: SafeTransaction, safeContract: GnosisSafeL2, txBuilderFactory: TxBuilderFactory, + keyValuePairsAddress: string, parentAddress?: string, parentTokenAddress?: string, parentStrategyType?: VotingStrategyType, @@ -64,6 +68,8 @@ export class DaoTxBuilder extends BaseTxBuilder { this.parentStrategyType = parentStrategyType; this.parentStrategyAddress = parentStrategyAddress; + this.keyValuePairsAddress = keyValuePairsAddress; + // Prep fractal module txs for setting up subDAOs this.setFractalModuleTxs(); } @@ -231,8 +237,9 @@ export class DaoTxBuilder extends BaseTxBuilder { } private buildUpdateDAOSnapshotENSTx(): SafeTransaction { - return buildContractCall( - this.baseContracts.keyValuePairsContract, + return buildContractCallViem( + KeyValuePairsAbi, + getAddress(this.keyValuePairsAddress), 'updateValues', [['snapshotENS'], [this.daoData.snapshotENS]], 0, diff --git a/src/models/TxBuilderFactory.ts b/src/models/TxBuilderFactory.ts index 80a31d8c18..4a5a98c0f3 100644 --- a/src/models/TxBuilderFactory.ts +++ b/src/models/TxBuilderFactory.ts @@ -31,6 +31,7 @@ export class TxBuilderFactory extends BaseTxBuilder { private votesERC20WrapperMasterCopyAddress: string; private votesERC20MasterCopyAddress: string; + private keyValuePairsAddress: string; constructor( signerOrProvider: ethers.Signer | any, @@ -41,6 +42,7 @@ export class TxBuilderFactory extends BaseTxBuilder { fallbackHandler: string, votesERC20WrapperMasterCopyAddress: string, votesERC20MasterCopyAddress: string, + keyValuePairsAddress: string, parentAddress?: string, parentTokenAddress?: string, ) { @@ -58,6 +60,7 @@ export class TxBuilderFactory extends BaseTxBuilder { this.saltNum = getRandomBytes(); this.votesERC20WrapperMasterCopyAddress = votesERC20WrapperMasterCopyAddress; this.votesERC20MasterCopyAddress = votesERC20MasterCopyAddress; + this.keyValuePairsAddress = keyValuePairsAddress; } public setSafeContract(safeAddress: string) { @@ -96,6 +99,7 @@ export class TxBuilderFactory extends BaseTxBuilder { this.createSafeTx!, this.safeContract!, this, + this.keyValuePairsAddress, this.parentAddress, this.parentTokenAddress, parentStrategyType, diff --git a/src/types/contract.ts b/src/types/contract.ts index 5947349e24..881eb564c1 100644 --- a/src/types/contract.ts +++ b/src/types/contract.ts @@ -6,7 +6,6 @@ import { MultisigFreezeGuard, MultisigFreezeVoting, ERC20FreezeVoting, - KeyValuePairs, ERC721FreezeVoting, } from '@fractal-framework/fractal-contracts'; import { MultiSend } from '../assets/typechain-types/usul'; @@ -32,5 +31,4 @@ export interface BaseContracts { freezeERC721VotingMasterCopyContract: ERC721FreezeVoting; freezeMultisigVotingMasterCopyContract: MultisigFreezeVoting; zodiacModuleProxyFactoryContract: ModuleProxyFactory; - keyValuePairsContract: KeyValuePairs; }