Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: polygon proposal title #2974

Merged
merged 1 commit into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/constants/proposals/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const UNISWAP_GRANTS_START_BLOCK = 11473815
export const BRAVO_START_BLOCK = 13059344
export const ONE_BIP_START_BLOCK = 13551293
export const POLYGON_START_BLOCK = 13786993
1 change: 1 addition & 0 deletions src/constants/proposals/polygon_proposal_title.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const POLYGON_PROPOSAL_TITLE = 'Should Uniswap v3 be deployed to Polygon?'
19 changes: 16 additions & 3 deletions src/state/governance/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { formatUnits } from '@ethersproject/units'
import { t } from '@lingui/macro'
import { abi as GOV_ABI } from '@uniswap/governance/build/GovernorAlpha.json'
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 {
useGovernanceBravoContract,
Expand All @@ -21,7 +22,12 @@ import { useCallback, useMemo } from 'react'
import { calculateGasMargin } from 'utils/calculateGasMargin'

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 { useLogs } from '../logs/hooks'
import { useSingleCallResult, useSingleContractMultipleData } from '../multicall/hooks'
Expand Down Expand Up @@ -217,14 +223,21 @@ export function useAllProposalData(): { data: ProposalData[]; loading: boolean }

return {
data: proposalsCallData.map((proposal, i) => {
let description = formattedLogs[i]?.description
const startBlock = parseInt(proposal?.result?.startBlock?.toString())

let description = formattedLogs[i]?.description
if (startBlock === UNISWAP_GRANTS_START_BLOCK) {
description = UNISWAP_GRANTS_PROPOSAL_DESCRIPTION
}

let title = description?.split(/#+\s|\n/g)[1]
if (startBlock === POLYGON_START_BLOCK) {
title = POLYGON_PROPOSAL_TITLE
}

return {
id: proposal?.result?.id.toString(),
title: description?.split(/# |\n/g)[1] ?? t`Untitled`,
title: title ?? t`Untitled`,
description: description ?? t`No description.`,
proposer: proposal?.result?.proposer,
status: proposalStatesCallData[i]?.result?.[0] ?? ProposalState.UNDETERMINED,
Expand Down