-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from ourzora/proposal-template-pause-auction
Add proposal template pause auction
- Loading branch information
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
...eb/src/modules/create-proposal/components/TransactionForm/PauseAuctions/PauseAuctions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
apps/web/src/modules/create-proposal/components/TransactionForm/PauseAuctions/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './PauseAuctions' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
969361b
There was a problem hiding this comment.
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:
nouns-builder – ./apps/web
nouns.build
nouns-builder-ourzora.vercel.app
nouns-builder-git-main-ourzora.vercel.app
zouns-builder.vercel.app
www.nouns.build
969361b
There was a problem hiding this comment.
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