diff --git a/src/pages/KyberDAO/Vote/ProposalItem/VoteInformation.tsx b/src/pages/KyberDAO/Vote/ProposalItem/VoteInformation.tsx index 37477345b6..124bc409bf 100644 --- a/src/pages/KyberDAO/Vote/ProposalItem/VoteInformation.tsx +++ b/src/pages/KyberDAO/Vote/ProposalItem/VoteInformation.tsx @@ -31,10 +31,21 @@ const InfoRow = styled(RowBetween)` font-size: 12px; padding: 6px 0; ` + +function getEpochInformation( + epochPeriodInSeconds: number, + firstEpochStartTimestamp: number, + proposalStartTimestamp: number, +) { + const epochNumber = Math.floor((proposalStartTimestamp - firstEpochStartTimestamp) / epochPeriodInSeconds) + const epochStartTimestamp = firstEpochStartTimestamp + epochNumber * epochPeriodInSeconds + return { epochNumber, epochStartTimestamp } +} + export default function VoteInformation({ proposal }: { proposal: ProposalDetail }) { const theme = useTheme() const { account } = useActiveWeb3React() - const { stakerInfo } = useVotingInfo() + const { stakerInfo, daoInfo } = useVotingInfo() const votePowerAmount: number = useMemo( () => stakerInfo @@ -49,6 +60,11 @@ export default function VoteInformation({ proposal }: { proposal: ProposalDetail ) .multiply(proposal.executor_minimum_quorum) .divide(BIPS_BASE) + const { epochNumber, epochStartTimestamp } = getEpochInformation( + daoInfo.epoch_period_in_seconds, + daoInfo.first_epoch_start_timestamp, + proposal.start_timestamp, + ) return ( @@ -86,6 +102,12 @@ export default function VoteInformation({ proposal }: { proposal: ProposalDetail {Math.floor(proposal.vote_stats.total_vote_count).toLocaleString()} + + + Epoch {epochNumber} Start Date + + {dayjs(epochStartTimestamp * 1000).format('DD MMMM YYYY')} + Quorum Status