diff --git a/src/hooks/DAO/loaders/useFractalFreeze.ts b/src/hooks/DAO/loaders/useFractalFreeze.ts index 06a6c255f9..733590b886 100644 --- a/src/hooks/DAO/loaders/useFractalFreeze.ts +++ b/src/hooks/DAO/loaders/useFractalFreeze.ts @@ -8,6 +8,7 @@ import { FreezeVoteCastEvent } from '@fractal-framework/fractal-contracts/dist/t import { useCallback, useEffect, useRef } from 'react'; import { getAddress, getContract, zeroAddress } from 'viem'; import { useAccount, usePublicClient } from 'wagmi'; +import GnosisSafeL2Abi from '../../../assets/abi/GnosisSafeL2'; import VotesERC20Abi from '../../../assets/abi/VotesERC20'; import { isWithinFreezeProposalPeriod, @@ -98,13 +99,17 @@ export const useFractalFreeze = ({ isFrozen, }; - const { safeSingletonContract, freezeERC20VotingMasterCopyContract } = baseContracts; + const { freezeERC20VotingMasterCopyContract } = baseContracts; if (freezeVotingType === FreezeVotingType.MULTISIG) { - const safeContract = safeSingletonContract!.asProvider.attach( - await (freezeVotingContract as MultisigFreezeVoting).parentGnosisSafe(), - ); - const owners = await safeContract.getOwners(); + const safeContract = getContract({ + abi: GnosisSafeL2Abi, + address: getAddress( + await (freezeVotingContract as MultisigFreezeVoting).parentGnosisSafe(), + ), + client: publicClient, + }); + const owners = await safeContract.read.getOwners(); userHasVotes = owners.find(owner => owner === account) !== undefined; } else if (freezeVotingType === FreezeVotingType.ERC20) { const freezeERC20VotingContract = freezeERC20VotingMasterCopyContract.asProvider.attach( diff --git a/src/hooks/safe/useSafeContracts.ts b/src/hooks/safe/useSafeContracts.ts index 229b155797..521a1fd7a9 100644 --- a/src/hooks/safe/useSafeContracts.ts +++ b/src/hooks/safe/useSafeContracts.ts @@ -12,7 +12,6 @@ import { } from '@fractal-framework/fractal-contracts'; import { useMemo } from 'react'; import { MultiSend__factory } from '../../assets/typechain-types/usul'; -import { GnosisSafeL2__factory } from '../../assets/typechain-types/usul/factories/@gnosis.pm/safe-contracts/contracts'; import { useEthersProvider } from '../../providers/Ethers/hooks/useEthersProvider'; import { useNetworkConfig } from '../../providers/NetworkConfig/NetworkConfigProvider'; import useSignerOrProvider from '../utils/useSignerOrProvider'; @@ -23,7 +22,6 @@ export default function useSafeContracts() { const { contracts: { - safe, linearVotingMasterCopy, multisend, fractalAzoriusMasterCopy, @@ -61,11 +59,6 @@ export default function useSafeContracts() { asProvider: LinearERC721Voting__factory.connect(linearVotingERC721MasterCopy, provider), }; - const safeSingletonContract = { - asSigner: GnosisSafeL2__factory.connect(safe, signerOrProvider), - asProvider: GnosisSafeL2__factory.connect(safe, provider), - }; - const fractalModuleMasterCopyContract = { asSigner: FractalModule__factory.connect(fractalModuleMasterCopy, signerOrProvider), asProvider: FractalModule__factory.connect(fractalModuleMasterCopy, provider), @@ -111,7 +104,6 @@ export default function useSafeContracts() { multiSendContract, fractalAzoriusMasterCopyContract, linearVotingMasterCopyContract, - safeSingletonContract, fractalModuleMasterCopyContract, multisigFreezeGuardMasterCopyContract, azoriusFreezeGuardMasterCopyContract, @@ -122,7 +114,6 @@ export default function useSafeContracts() { linearVotingERC721MasterCopyContract, }; }, [ - safe, linearVotingMasterCopy, fractalAzoriusMasterCopy, multisend,