diff --git a/src/hooks/DAO/loaders/governance/useAzoriusProposals.ts b/src/hooks/DAO/loaders/governance/useAzoriusProposals.ts index 60ba70925f..ba2499618e 100644 --- a/src/hooks/DAO/loaders/governance/useAzoriusProposals.ts +++ b/src/hooks/DAO/loaders/governance/useAzoriusProposals.ts @@ -6,6 +6,7 @@ import { import { VotedEvent as ERC20VotedEvent } from '@fractal-framework/fractal-contracts/dist/typechain-types/contracts/azorius/LinearERC20Voting'; import { VotedEvent as ERC721VotedEvent } from '@fractal-framework/fractal-contracts/dist/typechain-types/contracts/azorius/LinearERC721Voting'; import { useCallback, useEffect, useMemo, useRef } from 'react'; +import { logError } from '../../../../helpers/errorLogging'; import { useFractal } from '../../../../providers/App/AppProvider'; import { useEthersProvider } from '../../../../providers/Ethers/hooks/useEthersProvider'; import { CreateProposalMetadata, VotingStrategyType, DecodedTransaction } from '../../../../types'; @@ -140,25 +141,39 @@ export const useAzoriusProposals = () => { for (const proposalCreatedEvent of proposalCreatedEvents) { let proposalData; if (proposalCreatedEvent.args.metadata) { - const metadataEvent: CreateProposalMetadata = JSON.parse( - proposalCreatedEvent.args.metadata, - ); - const decodedTransactions = await decodeTransactions( - _decode, - proposalCreatedEvent.args.transactions.map(t => ({ ...t, value: t.value.toBigInt() })), - ); - proposalData = { - metaData: { - title: metadataEvent.title, - description: metadataEvent.description, - documentationUrl: metadataEvent.documentationUrl, - }, - transactions: proposalCreatedEvent.args.transactions.map(t => ({ - ...t, - value: t.value.toBigInt(), - })), - decodedTransactions, - }; + try { + const metadataEvent: CreateProposalMetadata = JSON.parse( + proposalCreatedEvent.args.metadata, + ); + + const decodedTransactions = await decodeTransactions( + _decode, + proposalCreatedEvent.args.transactions.map(t => ({ + ...t, + value: t.value.toBigInt(), + })), + ); + proposalData = { + metaData: { + title: metadataEvent.title, + description: metadataEvent.description, + documentationUrl: metadataEvent.documentationUrl, + }, + transactions: proposalCreatedEvent.args.transactions.map(t => ({ + ...t, + value: t.value.toBigInt(), + })), + decodedTransactions, + }; + } catch { + logError( + 'Unable to parse proposal metadata or transactions.', + 'metadata:', + proposalCreatedEvent.args.metadata, + 'transactions:', + proposalCreatedEvent.args.transactions, + ); + } } const proposal = await mapProposalCreatedEventToProposal(