From 9293e2ed3db3b7bcc14a14709dc7cade4c6fab01 Mon Sep 17 00:00:00 2001 From: Gleiser Oliveira Date: Sat, 4 Nov 2023 08:41:15 -0600 Subject: [PATCH] fix: show the eta date for queued proposals --- .../__snapshots__/getProposal.spec.ts.snap | 1 + .../getProposals/__snapshots__/index.spec.ts.snap | 12 ++++++++++++ .../getVoterHistory/__snapshots__/index.spec.ts.snap | 12 ++++++++++++ .../ProposalList/GovernanceProposal/index.tsx | 5 +++-- src/pages/Governance/ProposalList/index.tsx | 2 ++ src/types/index.ts | 1 + src/utilities/formatToProposal.ts | 2 ++ 7 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/clients/api/queries/getProposals/__snapshots__/getProposal.spec.ts.snap b/src/clients/api/queries/getProposals/__snapshots__/getProposal.spec.ts.snap index a91bda2335..00cb07a569 100644 --- a/src/clients/api/queries/getProposals/__snapshots__/getProposal.spec.ts.snap +++ b/src/clients/api/queries/getProposals/__snapshots__/getProposal.spec.ts.snap @@ -20,6 +20,7 @@ exports[`api/queries/getProposal > returns proposal 1`] = ` }, "endBlock": 33499859, "endDate": 2023-09-20T07:54:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ diff --git a/src/clients/api/queries/getProposals/__snapshots__/index.spec.ts.snap b/src/clients/api/queries/getProposals/__snapshots__/index.spec.ts.snap index cef98e31c3..e4da75b68b 100644 --- a/src/clients/api/queries/getProposals/__snapshots__/index.spec.ts.snap +++ b/src/clients/api/queries/getProposals/__snapshots__/index.spec.ts.snap @@ -24,6 +24,7 @@ exports[`api/queries/getProposals > Gets called with correct default arguments 1 }, "endBlock": 33499859, "endDate": 2023-09-20T07:54:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -88,6 +89,7 @@ exports[`api/queries/getProposals > Gets called with correct default arguments 1 }, "endBlock": 33499859, "endDate": 2023-09-20T07:54:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -132,6 +134,7 @@ exports[`api/queries/getProposals > Gets called with correct default arguments 1 }, "endBlock": 33446667, "endDate": 2023-09-18T11:34:41.000Z, + "etaDate": 2023-09-19T07:59:29.000Z, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -176,6 +179,7 @@ exports[`api/queries/getProposals > Gets called with correct default arguments 1 }, "endBlock": 33358842, "endDate": 2023-09-15T10:23:20.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -220,6 +224,7 @@ exports[`api/queries/getProposals > Gets called with correct default arguments 1 }, "endBlock": 33340981, "endDate": 2023-09-14T19:30:15.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -264,6 +269,7 @@ exports[`api/queries/getProposals > Gets called with correct default arguments 1 }, "endBlock": 33337008, "endDate": 2023-09-14T16:11:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -318,6 +324,7 @@ exports[`api/queries/getProposals > returns formatted proposals 1`] = ` }, "endBlock": 33499859, "endDate": 2023-09-20T07:54:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -382,6 +389,7 @@ exports[`api/queries/getProposals > returns formatted proposals 1`] = ` }, "endBlock": 33499859, "endDate": 2023-09-20T07:54:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -426,6 +434,7 @@ exports[`api/queries/getProposals > returns formatted proposals 1`] = ` }, "endBlock": 33446667, "endDate": 2023-09-18T11:34:41.000Z, + "etaDate": 2023-09-19T07:59:29.000Z, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -470,6 +479,7 @@ exports[`api/queries/getProposals > returns formatted proposals 1`] = ` }, "endBlock": 33358842, "endDate": 2023-09-15T10:23:20.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -514,6 +524,7 @@ exports[`api/queries/getProposals > returns formatted proposals 1`] = ` }, "endBlock": 33340981, "endDate": 2023-09-14T19:30:15.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ @@ -558,6 +569,7 @@ exports[`api/queries/getProposals > returns formatted proposals 1`] = ` }, "endBlock": 33337008, "endDate": 2023-09-14T16:11:35.000Z, + "etaDate": undefined, "executedDate": undefined, "executedTxHash": undefined, "forVotes": [ diff --git a/src/clients/api/queries/getVoterHistory/__snapshots__/index.spec.ts.snap b/src/clients/api/queries/getVoterHistory/__snapshots__/index.spec.ts.snap index 1b0702d7f2..2e13365cf7 100644 --- a/src/clients/api/queries/getVoterHistory/__snapshots__/index.spec.ts.snap +++ b/src/clients/api/queries/getVoterHistory/__snapshots__/index.spec.ts.snap @@ -37,6 +37,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33336002, "endDate": 2023-09-14T15:21:17.000Z, + "etaDate": 2023-09-14T15:32:50.000Z, "executedDate": 2023-09-14T15:39:44.000Z, "executedTxHash": "0xac2d0b0876517e098d16aa4546b66a0f92391fb025a76fb25e8f3989e8be1dd1", "forVotes": [ @@ -87,6 +88,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33279845, "endDate": 2023-09-12T16:33:23.000Z, + "etaDate": 2023-09-12T16:46:41.000Z, "executedDate": 2023-09-12T16:47:38.000Z, "executedTxHash": "0x5b4f35529ccabfedeac5db1eea9385ab63a804c14f68c5e99a47ba96b6281f76", "forVotes": [ @@ -137,6 +139,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33279456, "endDate": 2023-09-12T16:13:56.000Z, + "etaDate": 2023-09-12T16:25:26.000Z, "executedDate": 2023-09-12T16:28:35.000Z, "executedTxHash": "0xc15918d42abe6dba39b1872784671e72769135bc32811012f4712e45ceacc0bf", "forVotes": [ @@ -187,6 +190,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33243153, "endDate": 2023-09-11T09:58:47.000Z, + "etaDate": 2023-09-11T10:28:11.000Z, "executedDate": 2023-09-11T10:34:59.000Z, "executedTxHash": "0x95014a018718ec888a696259d470715799249071c39e8b1d8c76da407e2de72a", "forVotes": [ @@ -239,6 +243,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 32926185, "endDate": 2023-08-31T09:50:13.000Z, + "etaDate": 2023-08-31T10:52:34.000Z, "executedDate": 2023-08-31T10:55:01.000Z, "executedTxHash": "0x684ed7132eae0ef40ac3fa13f5e66e05ce4b80cb2bc42806f423b35a4357bbfa", "forVotes": [ @@ -289,6 +294,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 32870813, "endDate": 2023-08-29T11:41:37.000Z, + "etaDate": 2023-08-29T11:52:16.000Z, "executedDate": 2023-08-29T11:54:52.000Z, "executedTxHash": "0xb06be6ed9813e4e4c675702bd74bb0f75c897c25365d9eea3387520c9ff39257", "forVotes": [ @@ -361,6 +367,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33336002, "endDate": 2023-09-14T15:21:17.000Z, + "etaDate": 2023-09-14T15:32:50.000Z, "executedDate": 2023-09-14T15:39:44.000Z, "executedTxHash": "0xac2d0b0876517e098d16aa4546b66a0f92391fb025a76fb25e8f3989e8be1dd1", "forVotes": [ @@ -411,6 +418,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33279845, "endDate": 2023-09-12T16:33:23.000Z, + "etaDate": 2023-09-12T16:46:41.000Z, "executedDate": 2023-09-12T16:47:38.000Z, "executedTxHash": "0x5b4f35529ccabfedeac5db1eea9385ab63a804c14f68c5e99a47ba96b6281f76", "forVotes": [ @@ -461,6 +469,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33279456, "endDate": 2023-09-12T16:13:56.000Z, + "etaDate": 2023-09-12T16:25:26.000Z, "executedDate": 2023-09-12T16:28:35.000Z, "executedTxHash": "0xc15918d42abe6dba39b1872784671e72769135bc32811012f4712e45ceacc0bf", "forVotes": [ @@ -511,6 +520,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 33243153, "endDate": 2023-09-11T09:58:47.000Z, + "etaDate": 2023-09-11T10:28:11.000Z, "executedDate": 2023-09-11T10:34:59.000Z, "executedTxHash": "0x95014a018718ec888a696259d470715799249071c39e8b1d8c76da407e2de72a", "forVotes": [ @@ -563,6 +573,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 32926185, "endDate": 2023-08-31T09:50:13.000Z, + "etaDate": 2023-08-31T10:52:34.000Z, "executedDate": 2023-08-31T10:55:01.000Z, "executedTxHash": "0x684ed7132eae0ef40ac3fa13f5e66e05ce4b80cb2bc42806f423b35a4357bbfa", "forVotes": [ @@ -613,6 +624,7 @@ Simulation of the VIP: [https://github.com/VenusProtocol/vips/pull/70](https://g }, "endBlock": 32870813, "endDate": 2023-08-29T11:41:37.000Z, + "etaDate": 2023-08-29T11:52:16.000Z, "executedDate": 2023-08-29T11:54:52.000Z, "executedTxHash": "0xb06be6ed9813e4e4c675702bd74bb0f75c897c25365d9eea3387520c9ff39257", "forVotes": [ diff --git a/src/pages/Governance/ProposalList/GovernanceProposal/index.tsx b/src/pages/Governance/ProposalList/GovernanceProposal/index.tsx index f589355d0c..990be0f79b 100644 --- a/src/pages/Governance/ProposalList/GovernanceProposal/index.tsx +++ b/src/pages/Governance/ProposalList/GovernanceProposal/index.tsx @@ -113,6 +113,7 @@ interface GovernanceProposalProps { endDate?: Date; cancelDate?: Date; queuedDate?: Date; + etaDate?: Date; executedDate?: Date; userVoteStatus?: VoteSupport; forVotesMantissa?: BigNumber; @@ -129,7 +130,7 @@ const GovernanceProposalUi: React.FC = ({ proposalTitle, proposalState, executedDate, - queuedDate, + etaDate, cancelDate, endDate, userVoteStatus, @@ -171,7 +172,7 @@ const GovernanceProposalUi: React.FC = ({ case ProposalState.Executed: return [executedDate, 'voteProposalUi.executedDate']; case ProposalState.Queued: - return [queuedDate, 'voteProposalUi.queuedUntilDate']; + return [etaDate, 'voteProposalUi.queuedUntilDate']; case ProposalState.Defeated: return [endDate, 'voteProposalUi.defeatedDate']; default: diff --git a/src/pages/Governance/ProposalList/index.tsx b/src/pages/Governance/ProposalList/index.tsx index e343c59d9f..5d2ff30df4 100644 --- a/src/pages/Governance/ProposalList/index.tsx +++ b/src/pages/Governance/ProposalList/index.tsx @@ -87,6 +87,7 @@ export const ProposalListUi: React.FC = ({ endDate, cancelDate, queuedDate, + etaDate, forVotesMantissa, abstainedVotesMantissa, againstVotesMantissa, @@ -103,6 +104,7 @@ export const ProposalListUi: React.FC = ({ executedDate={executedDate} cancelDate={cancelDate} queuedDate={queuedDate} + etaDate={etaDate} forVotesMantissa={forVotesMantissa} againstVotesMantissa={againstVotesMantissa} abstainedVotesMantissa={abstainedVotesMantissa} diff --git a/src/types/index.ts b/src/types/index.ts index 524657ca6b..133b9c253e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -196,6 +196,7 @@ export interface Proposal { proposalId: number; proposer: string; queuedDate: Date | undefined; + etaDate: Date | undefined; startDate: Date | undefined; state: ProposalState; cancelDate: Date | undefined; diff --git a/src/utilities/formatToProposal.ts b/src/utilities/formatToProposal.ts index 2eeadde9b7..167ece3012 100644 --- a/src/utilities/formatToProposal.ts +++ b/src/utilities/formatToProposal.ts @@ -19,6 +19,7 @@ const formatToProposal = ({ executedTimestamp, proposer, queuedTimestamp, + eta, startTimestamp, state, createdTxHash, @@ -114,6 +115,7 @@ const formatToProposal = ({ proposalId, proposer, queuedDate: queuedTimestamp ? createDateFromSecondsTimestamp(queuedTimestamp) : undefined, + etaDate: eta ? createDateFromSecondsTimestamp(eta) : undefined, startDate: createDateFromSecondsTimestamp(startTimestamp), state, createdTxHash: createdTxHash ?? undefined,