diff --git a/src/hooks/DAO/useBuildDAOTx.ts b/src/hooks/DAO/useBuildDAOTx.ts index 6955f50bef..f8eeeebd81 100644 --- a/src/hooks/DAO/useBuildDAOTx.ts +++ b/src/hooks/DAO/useBuildDAOTx.ts @@ -18,7 +18,7 @@ const useBuildDAOTx = () => { const signerOrProvider = useSignerOrProvider(); const { createOptions, - contracts: { fallbackHandler, votesERC20WrapperMasterCopy }, + contracts: { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy }, } = useNetworkConfig(); const { @@ -54,7 +54,6 @@ const useBuildDAOTx = () => { freezeMultisigVotingMasterCopyContract, freezeERC20VotingMasterCopyContract, freezeERC721VotingMasterCopyContract, - votesTokenMasterCopyContract, claimingMasterCopyContract, keyValuePairsContract, } = baseContracts; @@ -72,7 +71,6 @@ const useBuildDAOTx = () => { if ( !fractalAzoriusMasterCopyContract || !linearVotingMasterCopyContract || - !votesTokenMasterCopyContract || !azoriusFreezeGuardMasterCopyContract || !claimingMasterCopyContract ) { @@ -84,7 +82,6 @@ const useBuildDAOTx = () => { linearVotingMasterCopyContract: linearVotingMasterCopyContract.asSigner, linearVotingERC721MasterCopyContract: linearVotingERC721MasterCopyContract.asSigner, azoriusFreezeGuardMasterCopyContract: azoriusFreezeGuardMasterCopyContract.asSigner, - votesTokenMasterCopyContract: votesTokenMasterCopyContract.asSigner, claimingMasterCopyContract: claimingMasterCopyContract.asSigner, }; } @@ -110,6 +107,7 @@ const useBuildDAOTx = () => { daoData, fallbackHandler, votesERC20WrapperMasterCopy, + votesERC20MasterCopy, parentAddress, parentTokenAddress, ); @@ -157,6 +155,7 @@ const useBuildDAOTx = () => { createOptions, fallbackHandler, votesERC20WrapperMasterCopy, + votesERC20MasterCopy, ], ); diff --git a/src/hooks/DAO/useDeployAzorius.ts b/src/hooks/DAO/useDeployAzorius.ts index c6dcf46905..7a85510812 100644 --- a/src/hooks/DAO/useDeployAzorius.ts +++ b/src/hooks/DAO/useDeployAzorius.ts @@ -21,7 +21,7 @@ const useDeployAzorius = () => { const signerOrProvider = useSignerOrProvider(); const navigate = useNavigate(); const { - contracts: { fallbackHandler, votesERC20WrapperMasterCopy }, + contracts: { fallbackHandler, votesERC20WrapperMasterCopy, votesERC20MasterCopy }, addressPrefix, } = useNetworkConfig(); const { @@ -54,7 +54,6 @@ const useDeployAzorius = () => { azoriusFreezeGuardMasterCopyContract, freezeMultisigVotingMasterCopyContract, freezeERC20VotingMasterCopyContract, - votesTokenMasterCopyContract, claimingMasterCopyContract, keyValuePairsContract, } = baseContracts; @@ -64,7 +63,6 @@ const useDeployAzorius = () => { fractalAzoriusMasterCopyContract: fractalAzoriusMasterCopyContract.asProvider, linearVotingMasterCopyContract: linearVotingMasterCopyContract.asProvider, azoriusFreezeGuardMasterCopyContract: azoriusFreezeGuardMasterCopyContract.asProvider, - votesTokenMasterCopyContract: votesTokenMasterCopyContract.asProvider, claimingMasterCopyContract: claimingMasterCopyContract.asProvider, } as AzoriusContracts; @@ -88,6 +86,7 @@ const useDeployAzorius = () => { daoData, fallbackHandler, votesERC20WrapperMasterCopy, + votesERC20MasterCopy, undefined, undefined, ); @@ -146,6 +145,7 @@ const useDeployAzorius = () => { fallbackHandler, addressPrefix, votesERC20WrapperMasterCopy, + votesERC20MasterCopy, ], ); diff --git a/src/models/AzoriusTxBuilder.ts b/src/models/AzoriusTxBuilder.ts index ca4a7658b3..7c2f2ad4a4 100644 --- a/src/models/AzoriusTxBuilder.ts +++ b/src/models/AzoriusTxBuilder.ts @@ -21,6 +21,7 @@ import { isHex, encodeFunctionData, } from 'viem'; +import VotesERC20Abi from '../assets/abi/VotesERC20'; import VotesERC20WrapperAbi from '../assets/abi/VotesERC20Wrapper'; import { GnosisSafeL2 } from '../assets/typechain-types/usul/@gnosis.pm/safe-contracts/contracts'; import { buildContractCall, getRandomBytes } from '../helpers'; @@ -56,6 +57,7 @@ export class AzoriusTxBuilder extends BaseTxBuilder { public votesTokenContract: VotesERC20 | undefined; private votesERC20WrapperMasterCopyAddress: string; + private votesERC20MasterCopyAddress: string; private tokenNonce: bigint; private strategyNonce: bigint; @@ -69,6 +71,7 @@ export class AzoriusTxBuilder extends BaseTxBuilder { daoData: AzoriusERC20DAO | AzoriusERC721DAO, safeContract: GnosisSafeL2, votesERC20WrapperMasterCopyAddress: string, + votesERC20MasterCopyAddress: string, parentAddress?: Address, parentTokenAddress?: Address, ) { @@ -89,6 +92,7 @@ export class AzoriusTxBuilder extends BaseTxBuilder { this.azoriusNonce = getRandomBytes(); this.votesERC20WrapperMasterCopyAddress = votesERC20WrapperMasterCopyAddress; + this.votesERC20MasterCopyAddress = votesERC20MasterCopyAddress; if (daoData.votingStrategyType === VotingStrategyType.LINEAR_ERC20) { daoData = daoData as AzoriusERC20DAO; @@ -187,11 +191,7 @@ export class AzoriusTxBuilder extends BaseTxBuilder { return buildContractCall( this.baseContracts.zodiacModuleProxyFactoryContract, 'deployModule', - [ - this.azoriusContracts!.votesTokenMasterCopyContract.address, - this.encodedSetupTokenData, - this.tokenNonce, - ], + [this.votesERC20MasterCopyAddress, this.encodedSetupTokenData, this.tokenNonce], 0, false, ); @@ -345,19 +345,16 @@ export class AzoriusTxBuilder extends BaseTxBuilder { ], ); - const encodedSetupTokenData = - this.azoriusContracts!.votesTokenMasterCopyContract.interface.encodeFunctionData('setUp', [ - encodedInitTokenData, - ]); - if (!isHex(encodedSetupTokenData)) { - throw new Error('Error encoding setup token data'); - } - this.encodedSetupTokenData = encodedSetupTokenData; + this.encodedSetupTokenData = encodeFunctionData({ + abi: VotesERC20Abi, + functionName: 'setUp', + args: [encodedInitTokenData], + }); } private setPredictedTokenAddress() { const tokenByteCodeLinear = generateContractByteCodeLinear( - getAddress(this.azoriusContracts!.votesTokenMasterCopyContract.address), + getAddress(this.votesERC20MasterCopyAddress), ); const tokenSalt = generateSalt(this.encodedSetupTokenData!, this.tokenNonce); diff --git a/src/models/TxBuilderFactory.ts b/src/models/TxBuilderFactory.ts index a45654eea2..cae1742ce3 100644 --- a/src/models/TxBuilderFactory.ts +++ b/src/models/TxBuilderFactory.ts @@ -30,6 +30,7 @@ export class TxBuilderFactory extends BaseTxBuilder { public fallbackHandler: string; private votesERC20WrapperMasterCopyAddress: string; + private votesERC20MasterCopyAddress: string; constructor( signerOrProvider: ethers.Signer | any, @@ -38,6 +39,7 @@ export class TxBuilderFactory extends BaseTxBuilder { daoData: SafeMultisigDAO | AzoriusERC20DAO | AzoriusERC721DAO | SubDAO, fallbackHandler: string, votesERC20WrapperMasterCopyAddress: string, + votesERC20MasterCopyAddress: string, parentAddress?: string, parentTokenAddress?: string, ) { @@ -53,6 +55,7 @@ export class TxBuilderFactory extends BaseTxBuilder { this.fallbackHandler = fallbackHandler; this.saltNum = getRandomBytes(); this.votesERC20WrapperMasterCopyAddress = votesERC20WrapperMasterCopyAddress; + this.votesERC20MasterCopyAddress = votesERC20MasterCopyAddress; } public setSafeContract(safeAddress: string) { @@ -135,6 +138,7 @@ export class TxBuilderFactory extends BaseTxBuilder { this.daoData as AzoriusERC20DAO, this.safeContract!, this.votesERC20WrapperMasterCopyAddress, + this.votesERC20MasterCopyAddress, this.parentAddress ? getAddress(this.parentAddress) : undefined, this.parentTokenAddress ? getAddress(this.parentTokenAddress) : undefined, ); diff --git a/src/types/fractal.ts b/src/types/fractal.ts index 798238f5f3..c4cb228a12 100644 --- a/src/types/fractal.ts +++ b/src/types/fractal.ts @@ -9,7 +9,6 @@ import { ERC20Claim, ERC20FreezeVoting, MultisigFreezeVoting, - VotesERC20, MultisigFreezeGuard, KeyValuePairs, ERC721FreezeVoting, @@ -347,7 +346,6 @@ export interface FractalContracts { freezeMultisigVotingMasterCopyContract: ContractConnection; freezeERC20VotingMasterCopyContract: ContractConnection; freezeERC721VotingMasterCopyContract: ContractConnection; - votesTokenMasterCopyContract: ContractConnection; claimingMasterCopyContract: ContractConnection; keyValuePairsContract: ContractConnection; } diff --git a/src/types/strategyAzorius.ts b/src/types/strategyAzorius.ts index 0e3388290e..135c059083 100644 --- a/src/types/strategyAzorius.ts +++ b/src/types/strategyAzorius.ts @@ -2,7 +2,6 @@ import { Azorius, LinearERC20Voting, AzoriusFreezeGuard, - VotesERC20, ERC20Claim, LinearERC721Voting, } from '@fractal-framework/fractal-contracts'; @@ -12,6 +11,5 @@ export interface AzoriusContracts { linearVotingMasterCopyContract: LinearERC20Voting; linearVotingERC721MasterCopyContract: LinearERC721Voting; azoriusFreezeGuardMasterCopyContract: AzoriusFreezeGuard; - votesTokenMasterCopyContract: VotesERC20; claimingMasterCopyContract: ERC20Claim; }