Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions src/components/SubmitProposal/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { AbiCoder } from '@ethersproject/abi'
import { TransactionResponse } from '@ethersproject/abstract-provider'
import { ButtonConfirmed } from 'components/Button'
import { AutoColumn } from 'components/Column'
import Loader from 'components/Loader'
import { Coins } from 'constants/StablePools'
import { useActiveContractKit } from 'hooks'
import { useGovernanceContract } from 'hooks/useContract'
import React, { useState } from 'react'
import ReactMarkdown from 'react-markdown'
import { useTransactionAdder } from 'state/transactions/hooks'
import { TYPE } from 'theme'

export const burnerAddresses: { [c in Coins]: string } = {
[Coins.USD]: '0x13bCDEB0947200Dd2F1933c2dC47a01157aA9414',
[Coins.Bitcoin]: '0x2f0e18532b18Ac3D67f055e652C87Ed78560A556',
[Coins.Celo]: '0xbA270ceb17621CEb240A1A62dE43B37D148d2774',
[Coins.Ether]: '0xf14A820565010d95bD7ebda754e32811325394a4',
[Coins.Eur]: '0xe26b9d9C77ac382222D9473d029b6ffaE1aa13Ca',
}

const blackList: Set<string> = new Set([
'0xcC82628f6A8dEFA1e2B0aD7ed448bef3647F7941',
'0xBe50a3013A1c94768A1ABb78c3cB79AB28fc1aCE',
'0xE919F65739c26a42616b7b8eedC6b5524d1e3aC4',
'0xcFFfE0c89a779c09Df3DF5624f54cDf7EF5fDd5D',
'0x93DB49bE12B864019dA9Cb147ba75cDC0506190e',
'0xd7Bf6946b740930c60131044bD2F08787e1DdBd4',
])

export default function SubmitProposal() {
const { chainId } = useActiveContractKit()
const abi = new AbiCoder()
const governance = useGovernanceContract()
const GAUGE_PROXY = '0x0a3Ac12422C95F84b5bD18A6d9904d132a161C68'
const [submitting, setSubmitting] = useState<boolean>(false)
const submitTxn = useTransactionAdder()
const gauges = {
pUSD: '0xE7195E651Cc47853f0054d85c8ADFc79D532929f',
pCELO: '0xD0d57a6689188F854F996BEAE0Cb1949FDB5FF86',
pEURO: '0xCAEd243de23264Bdd8297c6eECcF320846eee18A',
}
const nGauges = Object.values(gauges).length

const signature = new Array(nGauges).fill('set_killed(address,bool)')

const data = Object.values(gauges).map((addr) => abi.encode(['address', 'bool'], [addr, true]))
const value = new Array(nGauges).fill(0)
const target = new Array(nGauges).fill(GAUGE_PROXY)

const description = `# Kill Gauges from Proposals 4, 5, 6
## TLDR: Proposals 4, 5, 6 passed but contained the incorrect contract calls, so they cannot be executed. This proposal lumps all three into one, with the correct calls.

* Proposal 4 - Kill pUSD gauge
* Proposal 5 - Kill pCelo gauge
* Proposal 6 - Kill pEURO gauge

### Details / Addresses
* Gauge Proxy: ${GAUGE_PROXY}
* Poof USD Gauge: ${gauges.pUSD}
* Poof CELO Gauge: ${gauges.pCELO}
* Poof cEURO Gauge: ${gauges.pEURO}
### Who is Proposing?
A community member who knows how to use the command line.
`

const onSubmit = async () => {
setSubmitting(true)
const txn = await governance
?.propose(target, value, signature, data, description, { gasLimit: 10000000 })
.then((resp: TransactionResponse) => submitTxn(resp, { summary: 'Submitted proposal!' }))
.catch((e) => console.log(e))
.finally(() => setSubmitting(false))
}
return (
<AutoColumn>
<TYPE.mediumHeader>Proposal Description: </TYPE.mediumHeader>
<TYPE.main width={900} wrap>
<ReactMarkdown>{description}</ReactMarkdown>
</TYPE.main>
<ButtonConfirmed onClick={submitting ? () => null : onSubmit}>
{submitting ? <Loader /> : 'Submit Proposal'}
</ButtonConfirmed>
</AutoColumn>
)
}
2 changes: 1 addition & 1 deletion src/constants/governance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const GOVERNANCE_ADDRESS: { [chainId: number]: string } = {
[42220]: ' 0xA5Eb84773633f33d442ECDaC48212B0dEBf3C84A',
[42220]: '0xA5Eb84773633f33d442ECDaC48212B0dEBf3C84A',
[44787]: '0xA878C6787490c9f0d2406bcd161b61f128Ab2708',
}

Expand Down
3 changes: 1 addition & 2 deletions src/hooks/useContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ import { useMobi } from './Tokens'
// returns null on errors
function useContract(address: string | undefined, ABI: any, withSignerIfPossible = true): Contract | null {
const { library, account } = useActiveContractKit()

return useMemo(() => {
if (!address || !ABI || !library) return null
try {
return getContract(address, ABI, library, withSignerIfPossible && account ? account : undefined)
} catch (error) {
console.error('Failed to get contract', error)
console.log('Failed to get contract', error)
return null
}
}, [address, ABI, library, withSignerIfPossible, account])
Expand Down
2 changes: 2 additions & 0 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Header from '../components/Header'
import Polling from '../components/Header/Polling'
import URLWarning from '../components/Header/URLWarning'
import Popups from '../components/Popups'
import SubmitProposal from '../components/SubmitProposal'
import DarkModeQueryParamReader from '../theme/DarkModeQueryParamReader'
import { getMobileOperatingSystem, Mobile } from '../utils/mobile'
import ApeViewer from './ApeViewer'
Expand Down Expand Up @@ -137,6 +138,7 @@ export default function App() {
<Route exact strict path="/ape-mode" component={ApeViewer} />
<Route exact strict path="/charts" component={Charts} />
<Route exact strict path="/opensum" component={OpenSum} />
<Route exact strict path="/secret/submit" component={SubmitProposal} />
{/* <Route exact strict path="/optics" component={Optics} /> */}
</Switch>
</ErrorBoundary>
Expand Down