From f4572a620536c54b525b7a54a147d97a8a8bb42f Mon Sep 17 00:00:00 2001 From: 0xrajath Date: Sun, 1 Dec 2024 17:30:54 -0500 Subject: [PATCH] casting --- pkg/rewards/2_goldStakerRewardAmounts.go | 4 ++-- pkg/rewards/5_goldRfaeStakers.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/rewards/2_goldStakerRewardAmounts.go b/pkg/rewards/2_goldStakerRewardAmounts.go index 32aabf71..be6bd6f6 100644 --- a/pkg/rewards/2_goldStakerRewardAmounts.go +++ b/pkg/rewards/2_goldStakerRewardAmounts.go @@ -118,7 +118,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 @@ -126,7 +126,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 7abe8e78..ed77127f 100644 --- a/pkg/rewards/5_goldRfaeStakers.go +++ b/pkg/rewards/5_goldRfaeStakers.go @@ -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