-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2588 from IntersectMBO/staging
GovTool - v2.0.3
- Loading branch information
Showing
68 changed files
with
760 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,46 @@ | ||
SELECT COALESCE(SUM(utxo_view.value::numeric), 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; | ||
WITH RewardRest AS ( | ||
SELECT | ||
SUM(amount) AS amount, | ||
addr_id | ||
FROM | ||
reward_rest | ||
GROUP BY | ||
addr_id | ||
), | ||
Reward AS ( | ||
SELECT | ||
SUM(amount) AS amount, | ||
addr_id | ||
FROM | ||
reward | ||
GROUP BY | ||
addr_id | ||
), | ||
Balance AS ( | ||
SELECT | ||
COALESCE(SUM(uv.value), 0) AS amount, | ||
sa.id AS addr_id, | ||
encode(sa.hash_raw, 'hex') AS addr_raw | ||
FROM | ||
stake_address sa | ||
JOIN utxo_view uv ON uv.stake_address_id = sa.id | ||
GROUP BY | ||
addr_id, | ||
addr_raw | ||
) | ||
SELECT | ||
(COALESCE(rr.amount, 0) + COALESCE(r.amount, 0) + COALESCE(b.amount, 0)) AS total_balance, | ||
b.addr_raw | ||
FROM | ||
Balance b | ||
LEFT JOIN | ||
RewardRest rr ON rr.addr_id = b.addr_id | ||
LEFT JOIN | ||
Reward r ON r.addr_id = rr.addr_id | ||
WHERE | ||
b.addr_id = (SELECT id FROM stake_address WHERE hash_raw = decode(?, 'hex')) | ||
GROUP BY | ||
b.addr_raw, | ||
rr.amount, | ||
r.amount, | ||
b.amount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
select coalesce(sum(uv.value), 0) as amount | ||
from utxo_view uv | ||
join delegation_vote dv on uv.stake_address_id = dv.addr_id | ||
join drep_hash dh on dv.drep_hash_id = dh.id | ||
where dh.raw = decode(?,'hex') | ||
and dv.cert_index != 0 | ||
SELECT | ||
amount | ||
FROM | ||
drep_distr | ||
WHERE | ||
hash_id = (SELECT id FROM drep_hash WHERE raw = decode(?,'hex')) | ||
ORDER BY epoch_no DESC LIMIT 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.