You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/pkg/api/data_access/vdb_rewards.go
+48-48Lines changed: 48 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -89,15 +89,15 @@ func (d *DataAccessService) GetValidatorDashboardRewards(ctx context.Context, da
89
89
With("validators", goqu.L("(SELECT validator_index as validator_index, group_id FROM users_val_dashboards_validators WHERE dashboard_id = ?)", dashboardId.Id)).
90
90
Select(
91
91
goqu.L("e.epoch"),
92
-
goqu.L(`SUM(COALESCE(e.attestations_reward, 0) + COALESCE(e.blocks_cl_reward, 0) + COALESCE(e.sync_reward, 0)) AS cl_rewards`),
93
-
goqu.L("SUM(COALESCE(e.attestations_scheduled, 0)) AS attestations_scheduled"),
94
-
goqu.L("SUM(COALESCE(e.attestations_observed, 0)) AS attestations_observed"),
95
-
goqu.L("SUM(COALESCE(e.blocks_scheduled, 0)) AS blocks_scheduled"),
96
-
goqu.L("SUM(COALESCE(e.blocks_proposed, 0)) AS blocks_proposed"),
97
-
goqu.L("SUM(COALESCE(e.sync_scheduled, 0)) AS sync_scheduled"),
98
-
goqu.L("SUM(COALESCE(e.sync_executed, 0)) AS sync_executed"),
92
+
goqu.L(`SUM(e.attestations_reward + e.blocks_cl_reward + e.sync_reward) AS cl_rewards`),
93
+
goqu.L("SUM(e.attestations_scheduled) AS attestations_scheduled"),
94
+
goqu.L("SUM(e.attestations_observed) AS attestations_observed"),
95
+
goqu.L("SUM(e.blocks_scheduled) AS blocks_scheduled"),
96
+
goqu.L("SUM(e.blocks_proposed) AS blocks_proposed"),
97
+
goqu.L("SUM(e.sync_scheduled) AS sync_scheduled"),
98
+
goqu.L("SUM(e.sync_executed) AS sync_executed"),
99
99
goqu.L("SUM(CASE WHEN e.slashed THEN 1 ELSE 0 END) AS slashed_in_epoch"),
100
-
goqu.L("SUM(COALESCE(e.blocks_slashing_count, 0)) AS slashed_amount")).
100
+
goqu.L("SUM(e.blocks_slashing_count) AS slashed_amount")).
With("validators", goqu.L("(SELECT validator_index as validator_index, group_id FROM users_val_dashboards_validators WHERE dashboard_id = ?)", dashboardId.Id)).
528
528
Select(
529
-
goqu.L("COALESCE(e.attestations_source_reward, 0) AS attestations_source_reward"),
530
-
goqu.L("COALESCE(e.attestations_target_reward, 0) AS attestations_target_reward"),
531
-
goqu.L("COALESCE(e.attestations_head_reward, 0) AS attestations_head_reward"),
532
-
goqu.L("COALESCE(e.attestations_inactivity_reward, 0) AS attestations_inactivity_reward"),
533
-
goqu.L("COALESCE(e.attestations_inclusion_reward, 0) AS attestations_inclusion_reward"),
534
-
goqu.L("COALESCE(e.attestations_scheduled, 0) AS attestations_scheduled"),
535
-
goqu.L("COALESCE(e.attestations_head_executed, 0) AS attestations_head_executed"),
536
-
goqu.L("COALESCE(e.attestations_source_executed, 0) AS attestations_source_executed"),
537
-
goqu.L("COALESCE(e.attestations_target_executed, 0) AS attestations_target_executed"),
538
-
goqu.L("COALESCE(e.blocks_scheduled, 0) AS blocks_scheduled"),
539
-
goqu.L("COALESCE(e.blocks_proposed, 0) AS blocks_proposed"),
540
-
goqu.L("COALESCE(e.blocks_cl_reward, 0) AS blocks_cl_reward"),
541
-
goqu.L("COALESCE(e.sync_scheduled, 0) AS sync_scheduled"),
542
-
goqu.L("COALESCE(e.sync_executed, 0) AS sync_executed"),
543
-
goqu.L("COALESCE(e.sync_reward, 0) AS sync_reward"),
529
+
goqu.L("e.attestations_source_reward"),
530
+
goqu.L("e.attestations_target_reward"),
531
+
goqu.L("e.attestations_head_reward"),
532
+
goqu.L("e.attestations_inactivity_reward"),
533
+
goqu.L("e.attestations_inclusion_reward"),
534
+
goqu.L("e.attestations_scheduled"),
535
+
goqu.L("e.attestations_head_executed"),
536
+
goqu.L("e.attestations_source_executed"),
537
+
goqu.L("e.attestations_target_executed"),
538
+
goqu.L("e.blocks_scheduled"),
539
+
goqu.L("e.blocks_proposed"),
540
+
goqu.L("e.blocks_cl_reward"),
541
+
goqu.L("e.sync_scheduled"),
542
+
goqu.L("e.sync_executed"),
543
+
goqu.L("e.sync_reward"),
544
544
goqu.L("(CASE WHEN e.slashed THEN 1 ELSE 0 END) AS slashed_in_epoch"),
545
-
goqu.L("COALESCE(e.blocks_slashing_count, 0) AS slashed_amount"),
546
-
goqu.L("COALESCE(e.blocks_cl_slasher_reward, 0) AS slasher_reward"),
547
-
goqu.L("COALESCE(e.blocks_cl_attestations_reward, 0) AS blocks_cl_attestations_reward"),
548
-
goqu.L("COALESCE(e.blocks_cl_sync_aggregate_reward, 0) AS blocks_cl_sync_aggregate_reward")).
545
+
goqu.L("e.blocks_slashing_count AS slashed_amount"),
546
+
goqu.L("e.blocks_cl_slasher_reward AS slasher_reward"),
0 commit comments