Skip to content

Commit 934062d

Browse files
remoteramienzo-bitfly
authored andcommitted
refactor: unified percent scaling
1 parent e7812bd commit 934062d

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

backend/pkg/api/data_access/mobile.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (d *DataAccessService) GetValidatorDashboardMobileWidget(ctx context.Contex
173173
if err != nil {
174174
return nil, fmt.Errorf("error retrieving validator dashboard overview data: %w", err)
175175
}
176-
data.NetworkEfficiency = efficiency.TotalEfficiency[enums.AllTime].Float64 * 100
176+
data.NetworkEfficiency = efficiency.TotalEfficiency[enums.AllTime].Float64
177177

178178
// Validator status
179179
eg.Go(func() error {
@@ -254,8 +254,7 @@ func (d *DataAccessService) GetValidatorDashboardMobileWidget(ctx context.Contex
254254
data.RplApr = rpNetworkStats.NodeOperatorRewards.
255255
Mul(share).
256256
Div(queryResult.RPLStake).
257-
Mul(periodsPerYear).
258-
Mul(decimal.NewFromInt(100)).InexactFloat64()
257+
Mul(periodsPerYear).InexactFloat64()
259258
}
260259
return nil
261260
})
@@ -294,7 +293,6 @@ func (d *DataAccessService) GetValidatorDashboardMobileWidget(ctx context.Contex
294293
Where(goqu.L("r.validator_index IN (SELECT validator_index FROM validators)"))
295294

296295
*efficiency, err = runQuery[float64](ctx, d.clickhouseReader, ds)
297-
*efficiency *= 100
298296

299297
return err
300298
})
@@ -472,7 +470,7 @@ func (d *DataAccessService) getIndividualEfficiencies(ctx context.Context, indic
472470

473471
// Calculate efficiency
474472
for _, row := range queryResult {
475-
result[row.Index] = row.Efficiency * 100
473+
result[row.Index] = row.Efficiency
476474
}
477475

478476
return result, nil

backend/pkg/api/data_access/vdb_rocket_pool.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,7 @@ func (d *DataAccessService) GetValidatorDashboardRocketPool(ctx context.Context,
196196
return rpNetworkStats.NodeOperatorRewards.
197197
Mul(share).
198198
Div(node.StakedRPL).
199-
Mul(periodsPerYear).
200-
Mul(decimal.NewFromInt(100)).InexactFloat64()
199+
Mul(periodsPerYear).InexactFloat64()
201200
}
202201
return 0
203202
}
@@ -216,7 +215,7 @@ func (d *DataAccessService) GetValidatorDashboardRocketPool(ctx context.Context,
216215
currentETH := node.StakedRPL.Mul(rplPrice)
217216
minETH := node.RPLStakeMin.Mul(rplPrice).Mul(decimal.NewFromInt(10))
218217

219-
return currentETH.Div(minETH).Mul(decimal.NewFromInt(100)).InexactFloat64()
218+
return currentETH.Div(minETH).InexactFloat64()
220219
}
221220
return 0
222221
}

0 commit comments

Comments
 (0)