Skip to content

Commit

Permalink
Dao xxx env dev old (#255)
Browse files Browse the repository at this point in the history
* DAO-XXX-ENV-DEV-OLD Will use old parameters as the current parameters are way too fast.

* fix: time remaining should only render if status = active due to network and performance purposes
  • Loading branch information
Freshenext authored Oct 7, 2024
1 parent e891a56 commit 7c299c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ NEXT_PUBLIC_EXPLORER=https://explorer.testnet.rootstock.io
NEXT_PUBLIC_BUILD_ID=

NEXT_PUBLIC_RIF_ADDRESS=0x19f64674d8a5b4e652319f5e239efd3bc969a1fe
NEXT_PUBLIC_STRIF_ADDRESS=0x7C19923bac1b41e9bBD1c33815A61854beeD9b54
NEXT_PUBLIC_GOVERNOR_ADDRESS=0x0DB02C99619bB0E6d2cBeF5545Cc968DAb724E10
NEXT_PUBLIC_EA_NFT_ADDRESS=0xa060A65967cb9b9511E3A4ec091Aa81c6dCe6662
NEXT_PUBLIC_STRIF_ADDRESS=0xC4b091d97AD25ceA5922f09fe80711B7ACBbb16f
NEXT_PUBLIC_GOVERNOR_ADDRESS=0xB1A39B8f57A55d1429324EEb1564122806eb297F
NEXT_PUBLIC_EA_NFT_ADDRESS=0x979deF73ec80B8AE24Ae46765b81D9aF7b1C9327
NEXT_PUBLIC_MULTICALL_ADDRESS=0xcA11bde05977b3631167028862bE2a173976CA11
NEXT_PUBLIC_GRANTS_BUCKET_ADDRESS=0xfaca664c661af7e0e630c8f92b401012cd2a30ef
NEXT_PUBLIC_GRANTS_ACTIVE_BUCKET_ADDRESS=0x2217E4d3Ae0A6E30075D1B5a7b8C1520E8009f49
Expand Down
20 changes: 15 additions & 5 deletions src/app/proposals/TimeRemainingColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,23 @@ const convertToTimeRemaining = (seconds: number) => {
return `${days}d ${hours}h ${minutes}m ${remainingSeconds}s`
}

/**
* This helps to render the right hook due to how Wagmi works...
* If the status is not active, there is no point in fetching the status of the vote
*/
const HOOK_TO_USE = {
dummy: (proposalId: string, number: bigint) => ({
blocksUntilClosure: 0,
proposalDeadlineBlock: undefined,
}),
real: useGetProposalDeadline,
}

export const TimeRemainingColumn = () => {
const { latestBlockNumber } = useSharedProposalsTableContext()
const { proposalId, blockNumber } = useProposalContext()
const { blocksUntilClosure, proposalDeadlineBlock } = useGetProposalDeadline(
proposalId,
latestBlockNumber || BigInt(1),
)
const { proposalId, blockNumber, proposalStateHuman } = useProposalContext()
const hookToUse = HOOK_TO_USE[proposalStateHuman === 'Active' ? 'real' : 'dummy']
const { blocksUntilClosure, proposalDeadlineBlock } = hookToUse(proposalId, latestBlockNumber || BigInt(1))

const votingWindowBlocks = BigInt(proposalDeadlineBlock || 1) - BigInt(blockNumber)
const ratio = Number(blocksUntilClosure) / Number(votingWindowBlocks)
Expand Down

0 comments on commit 7c299c3

Please sign in to comment.