diff --git a/src/components/DaoCreator/index.tsx b/src/components/DaoCreator/index.tsx index e49f575cf7..646cdd6eeb 100644 --- a/src/components/DaoCreator/index.tsx +++ b/src/components/DaoCreator/index.tsx @@ -30,15 +30,10 @@ function DaoCreator({ const choosenGovernance = values.essentials.governance; const freezeGuard = isSubDAO ? values.freeze : undefined; - const valuesEssentialsWithSnapshotURL = { - ...values.essentials, - snapshotURL: values.essentials.snapshotENS, - }; - switch (choosenGovernance) { case GovernanceType.MULTISIG: { const data = await prepareMultisigFormData({ - ...valuesEssentialsWithSnapshotURL, + ...values.essentials, ...values.multisig, freezeGuard, }); @@ -49,7 +44,7 @@ function DaoCreator({ } case GovernanceType.AZORIUS_ERC20: { const data = await prepareAzoriusERC20FormData({ - ...valuesEssentialsWithSnapshotURL, + ...values.essentials, ...values.azorius, ...values.erc20Token, freezeGuard, @@ -61,7 +56,7 @@ function DaoCreator({ } case GovernanceType.AZORIUS_ERC721: { const data = await prepareAzoriusERC721FormData({ - ...valuesEssentialsWithSnapshotURL, + ...values.essentials, ...values.azorius, ...values.erc721Token, freezeGuard, 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( diff --git a/src/models/DaoTxBuilder.ts b/src/models/DaoTxBuilder.ts index 1b64e2d568..723b78b094 100644 --- a/src/models/DaoTxBuilder.ts +++ b/src/models/DaoTxBuilder.ts @@ -231,7 +231,7 @@ export class DaoTxBuilder extends BaseTxBuilder { return buildContractCall( this.baseContracts.keyValuePairsContract, 'updateValues', - [['snapshotURL'], [this.daoData.snapshotURL]], + [['snapshotURL'], [this.daoData.snapshotENS]], 0, false, ); diff --git a/src/pages/daos/[daoAddress]/edit/governance/index.tsx b/src/pages/daos/[daoAddress]/edit/governance/index.tsx index 0a1a7475ce..81d45f7550 100644 --- a/src/pages/daos/[daoAddress]/edit/governance/index.tsx +++ b/src/pages/daos/[daoAddress]/edit/governance/index.tsx @@ -36,7 +36,7 @@ export default function ModifyGovernancePage() { deployAzorius( daoData as AzoriusERC20DAO | AzoriusERC721DAO, !daoName || createAccountSubstring(daoAddress!) === daoName, - !daoSnapshotENS && !!daoData.snapshotURL, + !daoSnapshotENS && !!daoData.snapshotENS, ); }; diff --git a/src/types/createDAO.ts b/src/types/createDAO.ts index 9b5dd926c8..9d68f47b75 100644 --- a/src/types/createDAO.ts +++ b/src/types/createDAO.ts @@ -41,16 +41,6 @@ export type DAOEssentials = { snapshotENS: string; }; -/** - * `DAOEssentialsEdge` is a transitionary type that is used in place of the in-app-only `DAOEssentials` type. - * `DAOEssentialsEdge` has a `snapshotURL` field in place of a `snapshotENS` field. - * - * A recent update necessitated the renaming of references to `snapshotURL` to `snapshotENS`, - * but as the contracts and subgraph already use `snapshotURL`, this type is used to maintain compatibility - * of the app with the contracts and subgraph of the outside world. - */ -type DAOEssentialsEdge = Omit & { snapshotURL: string }; - export type DAOGovernorERC20Token = { tokenCreationType: TokenCreationType; tokenImportAddress?: string; @@ -100,7 +90,7 @@ export interface SubDAO DAOFreezeGuardConfig {} export interface AzoriusGovernanceDAO - extends DAOEssentialsEdge, + extends DAOEssentials, DAOGovernorModuleConfig {} export interface AzoriusERC20DAO @@ -114,7 +104,7 @@ export interface AzoriusERC721DAO extends AzoriusGovernanceDAO, DAOGovernorERC721Token {} -export interface SafeMultisigDAO extends DAOEssentialsEdge, SafeConfiguration {} +export interface SafeMultisigDAO extends DAOEssentials, SafeConfiguration {} export type DAOTrigger = ( daoData: SafeMultisigDAO | AzoriusERC20DAO | AzoriusERC721DAO | SubDAO,