diff --git a/pkg/rewards/2_goldStakerRewardAmounts.go b/pkg/rewards/2_goldStakerRewardAmounts.go index 84cee6bb..de2c94e0 100644 --- a/pkg/rewards/2_goldStakerRewardAmounts.go +++ b/pkg/rewards/2_goldStakerRewardAmounts.go @@ -119,7 +119,7 @@ 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 @@ -127,7 +127,7 @@ token_breakdowns AS ( 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 diff --git a/pkg/rewards/5_goldRfaeStakers.go b/pkg/rewards/5_goldRfaeStakers.go index 3d59ff47..830b262a 100644 --- a/pkg/rewards/5_goldRfaeStakers.go +++ b/pkg/rewards/5_goldRfaeStakers.go @@ -112,8 +112,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