Skip to content

Commit a47daf6

Browse files
committed
chore: drep_info drep_status field
1 parent 3ef1427 commit a47daf6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

files/grest/rpc/governance/drep_info.sql

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RETURNS TABLE (
33
drep_id text,
44
hex text,
55
has_script boolean,
6-
registered boolean,
6+
drep_status text,
77
deposit text,
88
active boolean,
99
expires_epoch_no numeric,
@@ -125,7 +125,12 @@ BEGIN
125125
END AS drep_id,
126126
ENCODE(dh.raw, 'hex')::text AS hex,
127127
dh.has_script AS has_script,
128-
(CASE WHEN starts_with(dh.view,'drep_always') OR (COALESCE(dr.deposit, 0) >= 0 AND dr.drep_hash_id IS NOT NULL) THEN TRUE ELSE FALSE END) AS registered,
128+
(CASE
129+
WHEN starts_with(dh.view,'drep_always') THEN 'registered'
130+
WHEN dr.drep_hash_id IS NULL THEN 'not_registered'
131+
WHEN dr.deposit < 0 THEN 'deregistered'
132+
ELSE 'registered'
133+
END) AS drep_status,
129134
(CASE WHEN (dr.deposit < 0) OR starts_with(dh.view,'drep_always') THEN NULL ELSE ds.deposit END)::text AS deposit,
130135
(CASE WHEN starts_with(dh.view,'drep_always') THEN TRUE ELSE COALESCE(dr.deposit, 0) >= 0 AND (ds.active OR COALESCE(dd.active_until, 0) > curr_epoch) END) AS active,
131136
(CASE WHEN COALESCE(dr.deposit, 0) >= 0 THEN GREATEST(ds.expires_epoch_no, COALESCE(dd.active_until, 0)) ELSE NULL END) AS expires_epoch_no,

0 commit comments

Comments
 (0)