Skip to content

Commit

Permalink
add fix for polygon proposal title (#2974)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahZinsmeister committed Dec 13, 2021
1 parent a5b152d commit e2baa05
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
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

2 comments on commit e2baa05

@vercel
Copy link

@vercel vercel bot commented on e2baa05 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

widgets – ./

widgets-git-main-uniswap.vercel.app
widgets-uniswap.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e2baa05 Dec 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

interface – ./

interface-uniswap.vercel.app
interface-git-main-uniswap.vercel.app

Please sign in to comment.