diff --git a/src/components/SubmitProposal/index.tsx b/src/components/SubmitProposal/index.tsx new file mode 100644 index 00000000000..4843ba9a800 --- /dev/null +++ b/src/components/SubmitProposal/index.tsx @@ -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 = 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(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 ( + + Proposal Description: + + {description} + + null : onSubmit}> + {submitting ? : 'Submit Proposal'} + + + ) +} diff --git a/src/constants/governance.ts b/src/constants/governance.ts index 5cf9ee7253e..ae7d1e2a81e 100644 --- a/src/constants/governance.ts +++ b/src/constants/governance.ts @@ -1,5 +1,5 @@ export const GOVERNANCE_ADDRESS: { [chainId: number]: string } = { - [42220]: ' 0xA5Eb84773633f33d442ECDaC48212B0dEBf3C84A', + [42220]: '0xA5Eb84773633f33d442ECDaC48212B0dEBf3C84A', [44787]: '0xA878C6787490c9f0d2406bcd161b61f128Ab2708', } diff --git a/src/hooks/useContract.ts b/src/hooks/useContract.ts index e22e9f0fc92..d71f9b00b06 100644 --- a/src/hooks/useContract.ts +++ b/src/hooks/useContract.ts @@ -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]) diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 75dcf19e23c..6111924747c 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -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' @@ -137,6 +138,7 @@ export default function App() { + {/* */}