-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add resume auctions proposal template
- Loading branch information
Showing
8 changed files
with
106 additions
and
9 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.
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
68 changes: 68 additions & 0 deletions
68
.../src/modules/create-proposal/components/TransactionForm/ResumeAuctions/ResumeAuctions.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,68 @@ | ||
import { Box, Button, Paragraph } from '@zoralabs/zord' | ||
import { encodeFunctionData } from 'viem' | ||
import { 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 { useChainStore } from 'src/stores/useChainStore' | ||
import { AddressType } from 'src/typings' | ||
|
||
export const ResumeAuctions = () => { | ||
const { auction } = useDaoStore((state) => state.addresses) | ||
const addTransaction = useProposalStore((state) => state.addTransaction) | ||
const chain = useChainStore((x) => x.chain) | ||
const { data: paused } = useContractRead({ | ||
abi: auctionAbi, | ||
address: auction, | ||
chainId: chain.id, | ||
functionName: 'paused', | ||
}) | ||
|
||
const handleResumeAuctionsTransaction = () => { | ||
const pause = { | ||
target: auction as AddressType, | ||
functionSignature: 'unpause()', | ||
calldata: encodeFunctionData({ | ||
abi: auctionAbi, | ||
functionName: 'unpause', | ||
}), | ||
value: '', | ||
} | ||
|
||
addTransaction({ | ||
type: TransactionType.RESUME_AUCTIONS, | ||
summary: 'Resume auctions', | ||
transactions: [pause], | ||
}) | ||
} | ||
|
||
return ( | ||
<Box w={'100%'}> | ||
{!paused ? ( | ||
<Box mb={'x8'}> | ||
<Paragraph size="md" color="negative"> | ||
It looks like auctions are already resumed 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={handleResumeAuctionsTransaction} | ||
disabled={!paused} | ||
> | ||
Add Transaction to Queue | ||
</Button> | ||
</Box> | ||
) | ||
} |
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
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