Skip to content

Commit

Permalink
Merge pull request #132 from ourzora/proposal-template-pause-auction
Browse files Browse the repository at this point in the history
Add proposal template pause auction
  • Loading branch information
neokry authored Mar 16, 2023
2 parents 898ff59 + 7d7e3c4 commit 969361b
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/web/src/components/Icon/assets/pause.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions apps/web/src/components/Icon/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import HandlebarCircle from './assets/handlebar-circle.svg'
import Move from './assets/move.svg'
import NewWindow from './assets/new-window.svg'
import NounsConnect from './assets/nouns-connect.svg'
import Pause from './assets/pause.svg'
import Plus from './assets/plus.svg'
import Refresh from './assets/refresh.svg'
import Trash from './assets/trash.svg'
Expand Down Expand Up @@ -59,6 +60,7 @@ export const icons = {
move: Move,
newWindow: NewWindow,
nounsConnect: NounsConnect,
pause: Pause,
plus: Plus,
refresh: Refresh,
trash: Trash,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Box, Button, Paragraph } from '@zoralabs/zord'
import { useContract, useContractRead } from 'wagmi'

import { auctionAbi } from 'src/data/contract/abis'
import { TransactionType } from 'src/modules/create-proposal/constants'
import { useProposalStore } from 'src/modules/create-proposal/stores'
import { useDaoStore } from 'src/modules/dao'
import { AddressType } from 'src/typings'

export const PauseAuctions = () => {
const { auction } = useDaoStore((state) => state.addresses)
const addTransaction = useProposalStore((state) => state.addTransaction)
const auctionContract = useContract({ abi: auctionAbi, address: auction })
const { data: paused } = useContractRead({
abi: auctionAbi,
address: auction,
functionName: 'paused',
})

const handlePauseAuctionsTransaction = () => {
const pause = {
target: auction as AddressType,
functionSignature: 'pause()',
calldata: auctionContract?.interface.encodeFunctionData('pause') || '',
value: '',
}

addTransaction({
type: TransactionType.PAUSE_AUCTIONS,
summary: 'Pause auctions',
transactions: [pause],
})
}

return (
<Box w={'100%'}>
{paused ? (
<Box mb={'x8'}>
<Paragraph size="md" color="negative">
It looks like auctions are already paused for this DAO.
</Paragraph>
</Box>
) : (
<Box mb={'x8'}>
<Paragraph size="md" color="text1">
No further input required for this transaction.
</Paragraph>
</Box>
)}
<Button
variant={'outline'}
borderRadius={'curved'}
w={'100%'}
type="button"
onClick={handlePauseAuctionsTransaction}
disabled={paused || typeof auctionContract === 'undefined'}
>
Add Transaction to Queue
</Button>
</Box>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './PauseAuctions'
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TransactionType } from 'src/modules/create-proposal/constants'

import { Airdrop } from './Airdrop'
import { CustomTransaction } from './CustomTransaction'
import { PauseAuctions } from './PauseAuctions'
import { SendEth } from './SendEth'

type TransactionFormType = {
Expand All @@ -17,6 +18,7 @@ interface TransactionFormProps {
export const TRANSACTION_FORM_OPTIONS = [
TransactionType.SEND_ETH,
TransactionType.AIRDROP,
TransactionType.PAUSE_AUCTIONS,
TransactionType.CUSTOM,
]

Expand All @@ -25,6 +27,7 @@ export const TransactionForm = ({ type }: TransactionFormProps) => {
[TransactionType.CUSTOM]: <CustomTransaction />,
[TransactionType.AIRDROP]: <Airdrop />,
[TransactionType.SEND_ETH]: <SendEth />,
[TransactionType.PAUSE_AUCTIONS]: <PauseAuctions />,
[TransactionType.UPGRADE]: null,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export enum TransactionType {
AIRDROP = 'airdrop',
CUSTOM = 'custom',
UPGRADE = 'upgrade',
PAUSE_AUCTIONS = 'pause-auctions',
}

export interface TransactionTypeProps {
Expand Down Expand Up @@ -40,6 +41,12 @@ export const TRANSACTION_TYPES = {
icon: 'plus',
iconBackdrop: color.ghostHover,
},
[TransactionType.PAUSE_AUCTIONS]: {
title: 'Pause Auctions',
subTitle: 'Create a proposal to pause auctions',
icon: 'pause',
iconBackdrop: 'rgba(236, 113, 75, 0.1)',
},
[TransactionType.CUSTOM]: {
title: 'Custom Transaction',
subTitle: 'Create any other kind of transaction',
Expand Down

2 comments on commit 969361b

@vercel
Copy link

@vercel vercel bot commented on 969361b Mar 16, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 969361b Mar 16, 2023

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:

testnet-nouns-builder – ./apps/web

testnet.nouns.build
testnet-nouns-builder-ourzora.vercel.app
testnet-nouns-builder-git-main-ourzora.vercel.app

Please sign in to comment.