Skip to content

Commit fc4ae54

Browse files
authored
Revert "(fix) Hotfix for calculations on SPOs on gov actions"
1 parent 9c7f14a commit fc4ae54

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

govtool/backend/sql/get-network-total-stake.sql

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,8 @@ TotalStakeControlledByActiveDReps AS (
6767
AND COALESCE(rd.deposit, 0) >= 0
6868
AND ((DRepActivity.epoch_no - GREATEST(COALESCE(lve.epoch_no, 0), COALESCE(rd.epoch_no, 0))) <= DRepActivity.drep_activity)
6969
),
70-
-- it's a hotfix for duplication issue https://github.com/IntersectMBO/cardano-db-sync/issues/1986
71-
LatestPoolStat AS (
72-
SELECT DISTINCT ON (pool_hash_id) *
73-
FROM
74-
pool_stat
75-
WHERE
76-
epoch_no = (SELECT MAX(no) FROM epoch)
77-
),
7870
TotalStakeControlledBySPOs AS (
79-
SELECT SUM(ps.stake)::bigint AS total FROM LatestPoolStat ps WHERE ps.epoch_no = (SELECT no FROM CurrentEpoch)
71+
SELECT SUM(ps.stake)::bigint AS total FROM pool_stat ps WHERE ps.epoch_no = (SELECT no FROM CurrentEpoch)
8072
),
8173
AlwaysAbstainVotingPower AS (
8274
SELECT COALESCE((SELECT amount FROM drep_hash

govtool/frontend/src/components/molecules/VotesSubmitted.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,14 @@ export const VotesSubmitted = ({
109109
100 - (dRepYesVotesPercentage ?? 0) - (dRepNoVotesPercentage ?? 0);
110110

111111
const poolYesVotesPercentage =
112-
typeof poolYesVotes === "number" &&
113-
typeof networkTotalStake?.totalStakeControlledBySPOs === "number" &&
114-
networkTotalStake.totalStakeControlledBySPOs > 0
115-
? (poolYesVotes / networkTotalStake.totalStakeControlledBySPOs) * 100
116-
: undefined;
117-
const poolNoVotesPercentage =
118-
typeof poolNoVotes === "number" &&
119-
typeof networkTotalStake?.totalStakeControlledBySPOs === "number" &&
120-
networkTotalStake.totalStakeControlledBySPOs > 0
121-
? (poolNoVotes / networkTotalStake.totalStakeControlledBySPOs) * 100
112+
poolYesVotes + poolNoVotes
113+
? (poolYesVotes / (poolYesVotes + poolNoVotes)) * 100
122114
: undefined;
115+
const poolNoVotesPercentage = poolYesVotesPercentage
116+
? 100 - poolYesVotesPercentage
117+
: poolNoVotes
118+
? 100
119+
: undefined;
123120

124121
const ccYesVotesPercentage = noOfCommitteeMembers
125122
? (ccYesVotes / noOfCommitteeMembers) * 100

0 commit comments

Comments
 (0)