diff --git a/src/components/proposals/ProposalCard.tsx b/src/components/proposals/ProposalCard.tsx index 23f598f7..e37b33d0 100644 --- a/src/components/proposals/ProposalCard.tsx +++ b/src/components/proposals/ProposalCard.tsx @@ -101,7 +101,7 @@ export default function ProposalCard({ const quorumPercentage = safeNumberFromBigInt(proposal.voting_quorum); const thresholdPercentage = safeNumberFromBigInt(proposal.voting_threshold); - // Calculate if requirements are met + // Calculate if requirements are met (using exact floating point comparison) const metQuorum = calculations.participationRate >= quorumPercentage; const metThreshold = calculations.totalVotes > 0 @@ -125,7 +125,7 @@ export default function ProposalCard({ } if (isActive) { - return percentage !== undefined ? `${percentage.toFixed(1)}%` : "0%"; + return percentage !== undefined ? `${percentage.toFixed(4)}%` : "0%"; } return met ? "Passed" : "Failed"; diff --git a/src/components/proposals/ProposalHeader.tsx b/src/components/proposals/ProposalHeader.tsx index 63614d31..bf88654a 100644 --- a/src/components/proposals/ProposalHeader.tsx +++ b/src/components/proposals/ProposalHeader.tsx @@ -51,7 +51,7 @@ export function ProposalHeader({ proposal }: ProposalHeaderProps) { const quorumPercentage = safeNumberFromBigInt(proposal.voting_quorum); const thresholdPercentage = safeNumberFromBigInt(proposal.voting_threshold); - // Calculate if requirements are met + // Calculate if requirements are met (using exact floating point comparison) const metQuorum = calculations.participationRate >= quorumPercentage; const metThreshold = calculations.totalVotes > 0 @@ -70,7 +70,7 @@ export function ProposalHeader({ proposal }: ProposalHeaderProps) { // Helper function to get status text const getStatusText = (isMet: boolean, percentage: number) => { if (isMet) return "Passed"; - return `${percentage.toFixed(1)}%`; + return `${percentage.toFixed(4)}%`; }; // Get DAO/token image - prioritize token image, fallback to DAO image if available diff --git a/src/components/proposals/VotesTable.tsx b/src/components/proposals/VotesTable.tsx index c3c35108..da323d62 100644 --- a/src/components/proposals/VotesTable.tsx +++ b/src/components/proposals/VotesTable.tsx @@ -72,7 +72,7 @@ const VotesTable = ({ proposalId, limit }: VotesTableProps) => { return ( {typeof finalScore === "number" - ? finalScore.toFixed(1) + ? finalScore.toFixed(4) : String(finalScore)} ); @@ -82,7 +82,7 @@ const VotesTable = ({ proposalId, limit }: VotesTableProps) => { return ( {typeof parsedScore === "number" - ? parsedScore.toFixed(1) + ? parsedScore.toFixed(4) : String(parsedScore)} ); diff --git a/src/components/proposals/VotingProgressChart.tsx b/src/components/proposals/VotingProgressChart.tsx index 3facf42b..44425d6a 100644 --- a/src/components/proposals/VotingProgressChart.tsx +++ b/src/components/proposals/VotingProgressChart.tsx @@ -90,7 +90,7 @@ const VotingProgressChart = ({ const quorumPercentage = safeNumberFromBigInt(proposal.voting_quorum); const thresholdPercentage = safeNumberFromBigInt(proposal.voting_threshold); - // Calculate if requirements are met + // Calculate if requirements are met (using exact floating point comparison) const metQuorum = calculations.participationRate >= quorumPercentage; const metThreshold = calculations.totalVotes > 0 @@ -127,7 +127,7 @@ const VotingProgressChart = ({ return "Met"; } return percentage !== undefined - ? `In Progress (${percentage.toFixed(1)}%)` + ? `In Progress (${percentage.toFixed(4)}%)` : "In Progress"; } @@ -492,7 +492,7 @@ const VotingProgressChart = ({ decimals={8} variant="abbreviated" />{" "} - ({enhancedCalculations.votesForPercent.toFixed(1)}%) + ({enhancedCalculations.votesForPercent.toFixed(4)}%) ) : ( Failed to fetch @@ -507,7 +507,7 @@ const VotingProgressChart = ({ decimals={8} variant="abbreviated" />{" "} - ({enhancedCalculations.votesAgainstPercent.toFixed(1)}%) + ({enhancedCalculations.votesAgainstPercent.toFixed(4)}%) ) : ( Failed to fetch @@ -592,7 +592,7 @@ const VotingProgressChart = ({
- Approval: {enhancedCalculations.approvalRate.toFixed(1)}% of votes + Approval: {enhancedCalculations.approvalRate.toFixed(4)}% of votes cast
@@ -658,7 +658,7 @@ const VotingProgressChart = ({
- {enhancedCalculations.participationRate.toFixed(1)}% of{" "} + {enhancedCalculations.participationRate.toFixed(4)}% of{" "} {enhancedCalculations.quorumPercentage}% required
@@ -715,7 +715,7 @@ const VotingProgressChart = ({
- {enhancedCalculations.approvalRate.toFixed(1)}% of{" "} + {enhancedCalculations.approvalRate.toFixed(4)}% of{" "} {enhancedCalculations.thresholdPercentage}% required