@@ -21,6 +21,26 @@ DRepDistr AS (
2121CurrentEpoch AS (
2222 SELECT MAX (no) AS no FROM epoch
2323),
24+ CommitteeMembers AS (
25+ SELECT DISTINCT ON (cm .committee_hash_id )
26+ cr .id ,
27+ block .time ,
28+ encode(cold_key_hash .raw , ' hex' ) cold_key,
29+ encode(hot_key_hash .raw , ' hex' ) hot_key
30+ FROM committee_registration cr
31+ JOIN tx ON tx .id = cr .tx_id
32+ JOIN block ON block .id = tx .block_id
33+ JOIN committee_hash cold_key_hash ON cr .cold_key_id = cold_key_hash .id
34+ JOIN committee_hash hot_key_hash ON cr .hot_key_id = hot_key_hash .id
35+ JOIN committee_member cm ON cm .committee_hash_id = cold_key_hash .id OR cm .committee_hash_id = hot_key_hash .id
36+ LEFT JOIN committee_de_registration cdr ON cdr .cold_key_id = cold_key_hash .id
37+ CROSS JOIN CurrentEpoch
38+ WHERE
39+ cdr .id IS NULL AND cm .expiration_epoch > CurrentEpoch .no
40+ ),
41+ NoOfCommitteeMembers AS (
42+ SELECT COUNT (* ) total FROM CommitteeMembers
43+ ),
2444ActiveDRepBoundaryEpoch AS (
2545 SELECT epoch_no - drep_activity AS epoch_no FROM DRepActivity
2646),
@@ -187,9 +207,6 @@ AlwaysNoConfidenceVotingPower AS (
187207TotalDRepDistr AS (
188208 SELECT SUM (COALESCE(amount, 0 ))::bigint total_drep_distr FROM drep_distr where epoch_no = (SELECT no from CurrentEpoch)
189209),
190- CommitteeMembersCount AS (
191- SELECT COUNT (* ) AS no_of_committee_members FROM committee_member
192- ),
193210LatestGovAction AS (
194211 SELECT gap .id , gap .enacted_epoch
195212 FROM gov_action_proposal gap
@@ -223,7 +240,7 @@ SELECT
223240 AlwaysAbstainVotingPower .amount AS always_abstain_voting_power,
224241 AlwaysNoConfidenceVotingPower .amount AS always_no_confidence_voting_power,
225242 meta .network_name ,
226- CommitteeMembersCount . no_of_committee_members ,
243+ NoOfCommitteeMembers . total no_of_committee_members,
227244 CommitteeThreshold .quorum_numerator ,
228245 CommitteeThreshold .quorum_denominator
229246FROM CurrentEpoch
@@ -242,6 +259,6 @@ CROSS JOIN TotalActiveCIP119CompliantDReps
242259CROSS JOIN TotalRegisteredDirectVoters
243260CROSS JOIN AlwaysAbstainVotingPower
244261CROSS JOIN AlwaysNoConfidenceVotingPower
245- CROSS JOIN CommitteeMembersCount
262+ CROSS JOIN NoOfCommitteeMembers
246263CROSS JOIN CommitteeThreshold
247264CROSS JOIN meta;
0 commit comments