Skip to content

Commit

Permalink
casting
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrajath committed Dec 2, 2024
1 parent 3389ebf commit f4572a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/rewards/2_goldStakerRewardAmounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ token_breakdowns AS (
WHEN sott.snapshot < @nileHardforkDate AND sott.reward_submission_date < @nileHardforkDate THEN
(sott.total_staker_operator_payout * 0.10)::text::decimal(38,0)
ELSE
floor(sott.total_staker_operator_payout * COALESCE(oas.split, 1000) / 10000.0)
floor(sott.total_staker_operator_payout * COALESCE(oas.split, 1000) / CAST(10000 AS DECIMAL))
END as operator_tokens,
CASE
WHEN sott.snapshot < @amazonHardforkDate AND sott.reward_submission_date < @amazonHardforkDate THEN
sott.total_staker_operator_payout - cast(sott.total_staker_operator_payout * 0.10 as DECIMAL(38,0))
WHEN sott.snapshot < @nileHardforkDate AND sott.reward_submission_date < @nileHardforkDate THEN
sott.total_staker_operator_payout - ((sott.total_staker_operator_payout * 0.10)::text::decimal(38,0))
ELSE
sott.total_staker_operator_payout - floor(sott.total_staker_operator_payout * COALESCE(oas.split, 1000) / 10000.0)
sott.total_staker_operator_payout - floor(sott.total_staker_operator_payout * COALESCE(oas.split, 1000) / CAST(10000 AS DECIMAL))
END as staker_tokens
FROM staker_operator_total_tokens sott
LEFT JOIN operator_avs_split_snapshots oas
Expand Down
4 changes: 2 additions & 2 deletions pkg/rewards/5_goldRfaeStakers.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ staker_operator_total_tokens AS (
-- If no split is found, default to 1000 (10%)
token_breakdowns AS (
SELECT sott.*,
floor(sott.total_staker_operator_payout * COALESCE(ops.split, 1000) / 10000.0) as operator_tokens,
sott.total_staker_operator_payout - floor(sott.total_staker_operator_payout * COALESCE(ops.split, 1000) / 10000.0) as staker_tokens
floor(sott.total_staker_operator_payout * COALESCE(ops.split, 1000) / CAST(10000 AS DECIMAL)) as operator_tokens,
sott.total_staker_operator_payout - floor(sott.total_staker_operator_payout * COALESCE(ops.split, 1000) / CAST(10000 AS DECIMAL)) as staker_tokens
FROM staker_operator_total_tokens sott
LEFT JOIN operator_pi_split_snapshots ops
ON sott.operator = ops.operator AND sott.snapshot = ops.snapshot
Expand Down

0 comments on commit f4572a6

Please sign in to comment.