Skip to content

Commit

Permalink
PR 306 - add voting_power field to pool_info endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
gregbgithub committed Nov 17, 2024
1 parent bdc40ef commit f1edd3f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions files/grest/rpc/pool/pool_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ RETURNS TABLE (
live_pledge text,
live_stake text,
live_delegators bigint,
live_saturation numeric
live_saturation numeric,
voting_power text
)
LANGUAGE plpgsql
AS $$
Expand Down Expand Up @@ -106,7 +107,8 @@ BEGIN
live.pledge::text,
live.stake::text,
live.delegators,
ROUND((live.stake / _saturation_limit) * 100, 2)
ROUND((live.stake / _saturation_limit) * 100, 2),
pst.voting_power::text
FROM _all_pool_info AS api
LEFT JOIN public.pool_hash AS ph ON ph.id = api.pool_hash_id
LEFT JOIN public.pool_update AS pu ON pu.id = api.update_id
Expand All @@ -117,6 +119,7 @@ BEGIN
-- could add this condition too since delegations elsewhere are meaningless: and dh.view like 'drep_always%'
LEFT JOIN public.pool_metadata_ref AS pmr ON pmr.id = api.meta_id
LEFT JOIN public.off_chain_pool_data AS ocpd ON api.meta_id = ocpd.pmr_id
LEFT JOIN public.pool_stat AS pst ON pst.pool_hash_id = api.pool_hash_id AND pst.epoch_no = _epoch_no
LEFT JOIN LATERAL (
SELECT
SUM(COUNT(b.id)) OVER () AS cnt,
Expand Down

0 comments on commit f1edd3f

Please sign in to comment.