Skip to content

Commit 7eb9131

Browse files
authored
Merge pull request #2147 from IntersectMBO/staging
GovTool 1.0.21
2 parents 9742730 + a8e0e61 commit 7eb9131

File tree

4 files changed

+30
-31
lines changed

4 files changed

+30
-31
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ changes.
1616

1717
### Fixed
1818

19-
-
19+
- Fix counting epoch boundaries for Governance Actions [Issue 2125](https://github.com/IntersectMBO/govtool/issues/2125)
20+
- Fix displaying the SPO Votes [Issue 2085](https://github.com/IntersectMBO/govtool/issues/2085)
21+
- Fix counting ada holder voting power [Issue 2000](https://github.com/IntersectMBO/govtool/issues/2000)
2022

2123
### Changed
2224

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
select coalesce(sum(utxo_view.value), 0), encode(stake_address.hash_raw, 'hex')
2-
from stake_address
3-
join utxo_view
4-
on utxo_view.stake_address_id = stake_address.id
5-
where stake_address.hash_raw = decode(?, 'hex')
6-
group by stake_address.hash_raw
1+
SELECT COALESCE(SUM(utxo_view.value::numeric), 0) + COALESCE(SUM(reward_rest.amount), 0) AS total_value,
2+
encode(stake_address.hash_raw, 'hex')
3+
FROM stake_address
4+
JOIN utxo_view ON utxo_view.stake_address_id = stake_address.id
5+
LEFT JOIN reward_rest ON reward_rest.addr_id = stake_address.id
6+
WHERE reward_rest.earned_epoch IS NULL
7+
WHERE stake_address.hash_raw = decode(?, 'hex')
8+
GROUP BY stake_address.hash_raw;

govtool/backend/sql/list-proposals.sql

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ SELECT
5454
null
5555
end
5656
) as description,
57-
epoch_utils.last_epoch_end_time + epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no),
57+
CASE
58+
WHEN meta.network_name::text = 'mainnet' THEN
59+
epoch_utils.last_epoch_end_time +
60+
epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no)::bigint +
61+
INTERVAL '5 days'
62+
ELSE
63+
epoch_utils.last_epoch_end_time +
64+
epoch_utils.epoch_duration * (gov_action_proposal.expiration - epoch_utils.last_epoch_no)::bigint +
65+
INTERVAL '1 day'
66+
END AS expiry_date,
5867
gov_action_proposal.expiration,
5968
creator_block.time,
6069
creator_block.epoch_no,
@@ -78,9 +87,9 @@ SELECT
7887
always_no_confidence_voting_power.amount
7988
END) "no_votes",
8089
coalesce(Sum(ldd_drep.amount) FILTER (WHERE voting_procedure.vote::text = 'Abstain'), 0) + always_abstain_voting_power.amount "abstain_votes",
81-
coalesce(vp_by_pool.poolYesVotes, 0),
82-
coalesce(vp_by_pool.poolNoVotes, 0),
83-
coalesce(vp_by_pool.poolAbstainVotes, 0),
90+
coalesce(Sum(ldd_pool.amount) FILTER (WHERE voting_procedure.vote::text = 'Yes'), 0),
91+
coalesce(Sum(ldd_pool.amount) FILTER (WHERE voting_procedure.vote::text = 'No'), 0),
92+
coalesce(Sum(ldd_pool.amount) FILTER (WHERE voting_procedure.vote::text = 'Abstain'), 0),
8493
coalesce(vp_by_cc.ccYesVotes, 0),
8594
coalesce(vp_by_cc.ccNoVotes, 0),
8695
coalesce(vp_by_cc.ccAbstainVotes, 0),
@@ -95,6 +104,7 @@ FROM
95104
CROSS JOIN EpochUtils AS epoch_utils
96105
CROSS JOIN always_no_confidence_voting_power
97106
CROSS JOIN always_abstain_voting_power
107+
CROSS JOIN meta
98108
JOIN tx AS creator_tx ON creator_tx.id = gov_action_proposal.tx_id
99109
JOIN block AS creator_block ON creator_block.id = creator_tx.block_id
100110
LEFT JOIN voting_anchor ON voting_anchor.id = gov_action_proposal.voting_anchor_id
@@ -104,21 +114,8 @@ FROM
104114
LEFT JOIN voting_procedure ON voting_procedure.gov_action_proposal_id = gov_action_proposal.id
105115
LEFT JOIN LatestDrepDistr ldd_drep ON ldd_drep.hash_id = voting_procedure.drep_voter
106116
AND ldd_drep.rn = 1
107-
LEFT JOIN
108-
(
109-
SELECT
110-
gov_action_proposal_id,
111-
SUM(CASE WHEN vote = 'Yes' THEN 1 ELSE 0 END) AS poolYesVotes,
112-
SUM(CASE WHEN vote = 'No' THEN 1 ELSE 0 END) AS poolNoVotes,
113-
SUM(CASE WHEN vote = 'Abstain' THEN 1 ELSE 0 END) AS poolAbstainVotes
114-
FROM
115-
voting_procedure
116-
WHERE
117-
pool_voter IS NOT NULL
118-
GROUP BY
119-
gov_action_proposal_id
120-
) vp_by_pool
121-
ON gov_action_proposal.id = vp_by_pool.gov_action_proposal_id
117+
LEFT JOIN LatestDrepDistr ldd_pool ON ldd_pool.hash_id = voting_procedure.pool_voter
118+
AND ldd_pool.rn = 1
122119
LEFT JOIN
123120
(
124121
SELECT
@@ -159,9 +156,6 @@ GROUP BY
159156
off_chain_vote_gov_action_data.abstract,
160157
off_chain_vote_gov_action_data.motivation,
161158
off_chain_vote_gov_action_data.rationale,
162-
vp_by_pool.poolYesVotes,
163-
vp_by_pool.poolNoVotes,
164-
vp_by_pool.poolAbstainVotes,
165159
vp_by_cc.ccYesVotes,
166160
vp_by_cc.ccNoVotes,
167161
vp_by_cc.ccAbstainVotes,
@@ -177,4 +171,5 @@ GROUP BY
177171
always_no_confidence_voting_power.amount,
178172
always_abstain_voting_power.amount,
179173
prev_gov_action.index,
180-
prev_gov_action_tx.hash)
174+
prev_gov_action_tx.hash,
175+
meta.network_name)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const Vote = ({ type, vote, value }: VoteProps) => (
150150
wordBreak: "break-all",
151151
}}
152152
>
153-
{type === "dReps" ? `₳ ${correctAdaFormat(value)}` : value}
153+
{type !== "ccCommittee" ? `₳ ${correctAdaFormat(value)}` : value}
154154
</Typography>
155155
</Box>
156156
);

0 commit comments

Comments
 (0)