Skip to content

Commit 0923fb4

Browse files
authored
fix: reward amount (#1931)
1 parent d262a90 commit 0923fb4

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"@cosmjs/tendermint-rpc": "^0.32.1",
5656
"@datadog/browser-logs": "^5.23.3",
5757
"@dydxprotocol/v4-client-js": "3.0.3",
58-
"@dydxprotocol/v4-localization": "1.1.332",
58+
"@dydxprotocol/v4-localization": "1.1.333",
5959
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
6060
"@emotion/is-prop-valid": "^1.3.0",
6161
"@hugocxl/react-to-image": "^0.0.9",

pnpm-lock.yaml

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bonsai/forms/trade/tradeInfo.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { MAX_SUBACCOUNT_NUMBER, NUM_PARENT_SUBACCOUNTS } from '@/constants/accou
1313
import { MAJOR_MARKETS } from '@/constants/markets';
1414
import { IndexerPositionSide } from '@/types/indexer/indexerApiGen';
1515

16+
import { OCT_2025_REWARDS_DETAILS } from '@/hooks/rewards/util';
17+
1618
import { assertNever } from '@/lib/assertNever';
1719
import { calc, mapIfPresent } from '@/lib/do';
1820
import {
@@ -888,14 +890,22 @@ function divideIfNonZeroElse(numerator: number, denominator: number, backup: num
888890
const RATE_LOST_TO_REV_SHARES = 0.4; // megavault and ops
889891
const MAX_POSSIBLE_TAKER_REV_SHARE = 0.5; // affiliates
890892

893+
const IS_FEE_REBATE_TIME: boolean = true;
894+
const FEE_REBATE_PERCENT = OCT_2025_REWARDS_DETAILS.rebateFraction;
895+
891896
function calculateTakerReward(
892897
usdcSize: number | undefined,
893898
fee: number | undefined,
894899
rewardsParams: RewardParamsSummary | undefined,
895900
feeTiers: FeeTierSummary[] | undefined
896901
): number | undefined {
897-
const feeMultiplier = rewardsParams?.feeMultiplier;
898902
const tokenPrice = rewardsParams?.tokenPrice;
903+
if (IS_FEE_REBATE_TIME) {
904+
return fee != null && tokenPrice != null && tokenPrice > 0
905+
? (fee * FEE_REBATE_PERCENT) / tokenPrice
906+
: undefined;
907+
}
908+
const feeMultiplier = rewardsParams?.feeMultiplier;
899909
const notional = usdcSize;
900910
const maxMakerRebate = findMaxMakerRebate(feeTiers);
901911

@@ -921,8 +931,13 @@ function calculateMakerReward(
921931
fee: number | undefined,
922932
rewardsParams: RewardParamsSummary | undefined
923933
): number | undefined {
924-
const feeMultiplier = rewardsParams?.feeMultiplier;
925934
const tokenPrice = rewardsParams?.tokenPrice;
935+
if (IS_FEE_REBATE_TIME) {
936+
return fee != null && tokenPrice != null && tokenPrice > 0
937+
? (fee * FEE_REBATE_PERCENT) / tokenPrice
938+
: undefined;
939+
}
940+
const feeMultiplier = rewardsParams?.feeMultiplier;
926941

927942
if (fee != null && feeMultiplier != null && tokenPrice != null && fee > 0.0 && tokenPrice > 0.0) {
928943
return (fee * feeMultiplier * RATE_LOST_TO_REV_SHARES) / tokenPrice;

src/constants/tooltips/trade.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { TOOLTIP_STRING_KEYS, type TooltipStrings } from '@/constants/localization';
22

3+
import { OCT_2025_REWARDS_DETAILS } from '@/hooks/rewards/util';
4+
35
export const tradeTooltips = {
46
'account-leverage': ({ stringGetter }) => ({
57
title: stringGetter({ key: TOOLTIP_STRING_KEYS.ACCOUNT_LEVERAGE_TITLE }),
@@ -141,7 +143,13 @@ export const tradeTooltips = {
141143
}),
142144
'max-reward-sept-2025': ({ stringGetter }) => ({
143145
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_SEPT_2025_TITLE }),
144-
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_SEPT_2025_BODY }),
146+
body: stringGetter({
147+
key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_SEPT_2025_BODY,
148+
params: {
149+
REWARD_PERCENT: OCT_2025_REWARDS_DETAILS.rebatePercentNumeric,
150+
REWARD_AMOUNT: OCT_2025_REWARDS_DETAILS.rewardAmount,
151+
},
152+
}),
145153
}),
146154
'max-withdraw': ({ stringGetter }) => ({
147155
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_TITLE }),

src/hooks/rewards/util.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,7 @@ export const OCT_2025_REWARDS_DETAILS = {
2424
rewardAmount: '$1M',
2525
rewardAmountUsd: 1_000_000,
2626
rebatePercent: '100%',
27+
rebatePercentNumeric: '100',
28+
rebateFraction: 1,
2729
endTime: '2025-10-31T23:59:59.000Z', // end of month
2830
};

0 commit comments

Comments
 (0)