Skip to content

Commit

Permalink
fix(#2000): fix counting ada holder voting power
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzalowski committed Oct 15, 2024
1 parent 8616572 commit 8876afd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ changes.

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

### Changed

Expand Down
14 changes: 8 additions & 6 deletions govtool/backend/sql/get-stake-key-voting-power.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
select coalesce(sum(utxo_view.value), 0), encode(stake_address.hash_raw, 'hex')
from stake_address
join utxo_view
on utxo_view.stake_address_id = stake_address.id
where stake_address.hash_raw = decode(?, 'hex')
group by stake_address.hash_raw
SELECT COALESCE(SUM(utxo_view.value::numeric), 0) + COALESCE(SUM(reward_rest.amount), 0) AS total_value,
encode(stake_address.hash_raw, 'hex')
FROM stake_address
JOIN utxo_view ON utxo_view.stake_address_id = stake_address.id
LEFT JOIN reward_rest ON reward_rest.addr_id = stake_address.id
WHERE reward_rest.earned_epoch IS NULL
WHERE stake_address.hash_raw = decode(?, 'hex')
GROUP BY stake_address.hash_raw;

0 comments on commit 8876afd

Please sign in to comment.