Commit e2baa051 authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

add fix for polygon proposal title (#2974)

parent a5b152da
export const UNISWAP_GRANTS_START_BLOCK = 11473815 export const UNISWAP_GRANTS_START_BLOCK = 11473815
export const BRAVO_START_BLOCK = 13059344 export const BRAVO_START_BLOCK = 13059344
export const ONE_BIP_START_BLOCK = 13551293 export const ONE_BIP_START_BLOCK = 13551293
export const POLYGON_START_BLOCK = 13786993
export const POLYGON_PROPOSAL_TITLE = 'Should Uniswap v3 be deployed to Polygon?'
...@@ -8,6 +8,7 @@ import { formatUnits } from '@ethersproject/units' ...@@ -8,6 +8,7 @@ import { formatUnits } from '@ethersproject/units'
import { t } from '@lingui/macro' import { t } from '@lingui/macro'
import { abi as GOV_ABI } from '@uniswap/governance/build/GovernorAlpha.json' import { abi as GOV_ABI } from '@uniswap/governance/build/GovernorAlpha.json'
import { CurrencyAmount, Token } from '@uniswap/sdk-core' import { CurrencyAmount, Token } from '@uniswap/sdk-core'
import { POLYGON_PROPOSAL_TITLE } from 'constants/proposals/polygon_proposal_title'
import { UNISWAP_GRANTS_PROPOSAL_DESCRIPTION } from 'constants/proposals/uniswap_grants_proposal_description' import { UNISWAP_GRANTS_PROPOSAL_DESCRIPTION } from 'constants/proposals/uniswap_grants_proposal_description'
import { import {
useGovernanceBravoContract, useGovernanceBravoContract,
...@@ -21,7 +22,12 @@ import { useCallback, useMemo } from 'react' ...@@ -21,7 +22,12 @@ import { useCallback, useMemo } from 'react'
import { calculateGasMargin } from 'utils/calculateGasMargin' import { calculateGasMargin } from 'utils/calculateGasMargin'
import { SupportedChainId } from '../../constants/chains' import { SupportedChainId } from '../../constants/chains'
import { BRAVO_START_BLOCK, ONE_BIP_START_BLOCK, UNISWAP_GRANTS_START_BLOCK } from '../../constants/proposals' import {
BRAVO_START_BLOCK,
ONE_BIP_START_BLOCK,
POLYGON_START_BLOCK,
UNISWAP_GRANTS_START_BLOCK,
} from '../../constants/proposals'
import { UNI } from '../../constants/tokens' import { UNI } from '../../constants/tokens'
import { useLogs } from '../logs/hooks' import { useLogs } from '../logs/hooks'
import { useSingleCallResult, useSingleContractMultipleData } from '../multicall/hooks' import { useSingleCallResult, useSingleContractMultipleData } from '../multicall/hooks'
...@@ -217,14 +223,21 @@ export function useAllProposalData(): { data: ProposalData[]; loading: boolean } ...@@ -217,14 +223,21 @@ export function useAllProposalData(): { data: ProposalData[]; loading: boolean }
return { return {
data: proposalsCallData.map((proposal, i) => { data: proposalsCallData.map((proposal, i) => {
let description = formattedLogs[i]?.description
const startBlock = parseInt(proposal?.result?.startBlock?.toString()) const startBlock = parseInt(proposal?.result?.startBlock?.toString())
let description = formattedLogs[i]?.description
if (startBlock === UNISWAP_GRANTS_START_BLOCK) { if (startBlock === UNISWAP_GRANTS_START_BLOCK) {
description = UNISWAP_GRANTS_PROPOSAL_DESCRIPTION description = UNISWAP_GRANTS_PROPOSAL_DESCRIPTION
} }
let title = description?.split(/#+\s|\n/g)[1]
if (startBlock === POLYGON_START_BLOCK) {
title = POLYGON_PROPOSAL_TITLE
}
return { return {
id: proposal?.result?.id.toString(), id: proposal?.result?.id.toString(),
title: description?.split(/# |\n/g)[1] ?? t`Untitled`, title: title ?? t`Untitled`,
description: description ?? t`No description.`, description: description ?? t`No description.`,
proposer: proposal?.result?.proposer, proposer: proposal?.result?.proposer,
status: proposalStatesCallData[i]?.result?.[0] ?? ProposalState.UNDETERMINED, status: proposalStatesCallData[i]?.result?.[0] ?? ProposalState.UNDETERMINED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment