Skip to content

Commit

Permalink
fix: weighted average commission
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc committed Dec 10, 2024
1 parent ec0e82c commit b0cd64a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/pkg/api/data_access/vdb_rocket_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ func (d *DataAccessService) GetValidatorDashboardRocketPool(ctx context.Context,
goqu.L("COUNT(mp.address) as minipools_total"),
goqu.L("SUM(CASE WHEN mp.node_deposit_balance = 8e18 THEN 1 ELSE 0 END) AS minipools_leb8"),
goqu.L("SUM(CASE WHEN mp.node_deposit_balance = 16e18 THEN 1 ELSE 0 END) AS minipools_leb16"),
goqu.L("CASE WHEN COUNT(mp.address) > 0 THEN SUM(mp.node_fee) / COUNT(mp.address) ELSE 0 END AS avg_commission"),
goqu.L(`
CASE
WHEN SUM(CASE WHEN mp.status = 'Staking' THEN mp.node_deposit_balance ELSE 0 END) > 0
THEN
SUM(CASE WHEN mp.status = 'Staking' THEN mp.node_fee * mp.node_deposit_balance ELSE 0 END) /
SUM(CASE WHEN mp.status = 'Staking' THEN mp.node_deposit_balance ELSE 0 END)
ELSE 0
END AS avg_commission
`),
goqu.T("n").Col("unclaimed_rpl_rewards").As("rpl_unclaimed"),
goqu.L("n.rpl_cumulative_rewards - n.unclaimed_rpl_rewards as rpl_claimed"),
goqu.T("n").Col("effective_rpl_stake").As("effective_rpl"),
Expand Down

0 comments on commit b0cd64a

Please sign in to comment.