1+ import { STRING_KEYS } from '@/constants/localization' ;
2+
13export function pointsToEstimatedDydxRewards (
24 points ?: number ,
35 totalPoints ?: number ,
@@ -23,15 +25,104 @@ export function feesToEstimatedDollarRewards(totalFees?: number): number {
2325 return totalFees * CURRENT_SURGE_REWARDS_DETAILS . rebateFraction ;
2426}
2527
28+ type BonkRewardTier = {
29+ positionRange : number [ ] ;
30+ reward : number ;
31+ } ;
32+
33+ type BonkRewardsDetails = {
34+ rewards : BonkRewardTier [ ] ;
35+ rewardAmount : string ;
36+ rewardAmountUsd : number ;
37+ topPrizeAmount : string ;
38+ startTime : string ;
39+ endTime : string ;
40+ titleStringKey : string ;
41+ leaderboardSize : number ;
42+ } ;
43+
44+ // returns string derived from current time or timestamp in format: Mar | March | March 1
45+ export const simpleDateString = (
46+ timestamp ?: string ,
47+ options ?: {
48+ month ?: 'long' | 'short' | undefined ;
49+ day ?: 'numeric' | undefined ;
50+ }
51+ ) => {
52+ const date = timestamp ? new Date ( timestamp ) : new Date ( ) ;
53+ return date . toLocaleString ( 'en-US' , {
54+ ...options ,
55+ month : options ?. month ?? 'long' ,
56+ timeZone : 'UTC' ,
57+ } ) ;
58+ } ;
59+
60+ const februaryBonkRewards = [
61+ { positionRange : [ 1 , 1 ] , reward : 25000 } ,
62+ { positionRange : [ 2 , 2 ] , reward : 15000 } ,
63+ { positionRange : [ 3 , 3 ] , reward : 10000 } ,
64+ { positionRange : [ 4 , 5 ] , reward : 5000 } ,
65+ { positionRange : [ 6 , 10 ] , reward : 4000 } ,
66+ { positionRange : [ 11 , 20 ] , reward : 2000 } ,
67+ ] ;
68+
69+ const marchBonkRewards = [
70+ { positionRange : [ 1 , 1 ] , reward : 15000 } ,
71+ { positionRange : [ 2 , 2 ] , reward : 7500 } ,
72+ { positionRange : [ 3 , 3 ] , reward : 5000 } ,
73+ { positionRange : [ 4 , 5 ] , reward : 2500 } ,
74+ { positionRange : [ 6 , 10 ] , reward : 2000 } ,
75+ { positionRange : [ 11 , 15 ] , reward : 1500 } ,
76+ ] ;
77+
78+ const BONK_REWARDS_MAP = {
79+ February : {
80+ rewards : februaryBonkRewards ,
81+ rewardAmount : '$100K' ,
82+ rewardAmountUsd : 100_000 ,
83+ topPrizeAmount : '$25,000' ,
84+ leaderboardSize : 20 ,
85+ startTime : '2026-02-01T00:00:00.000Z' ,
86+ endTime : '2026-02-28T23:59:59.000Z' ,
87+ titleStringKey : STRING_KEYS . BONK_PNL_COMPETITION_NAME_FEBRUARY ,
88+ } ,
89+ March : {
90+ rewards : marchBonkRewards ,
91+ rewardAmount : '$50k' ,
92+ rewardAmountUsd : 50_000 ,
93+ topPrizeAmount : '$15,000' ,
94+ leaderboardSize : 15 ,
95+ startTime : '2026-03-01T00:00:00.000Z' ,
96+ endTime : '2026-03-31T23:59:59.000Z' ,
97+ titleStringKey : STRING_KEYS . BONK_PNL_COMPETITION_NAME_MARCH ,
98+ } ,
99+ } ;
100+
101+ const bonkRewardsMonths = Object . keys ( BONK_REWARDS_MAP ) as ( keyof typeof BONK_REWARDS_MAP ) [ ] ;
102+ const lastBonkRewardsMonth = bonkRewardsMonths [
103+ bonkRewardsMonths . length - 1
104+ ] as keyof typeof BONK_REWARDS_MAP ;
105+
106+ export const CURRENT_BONK_REWARDS_DETAILS : BonkRewardsDetails =
107+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
108+ BONK_REWARDS_MAP [ simpleDateString ( ) as keyof typeof BONK_REWARDS_MAP ] ??
109+ BONK_REWARDS_MAP [ lastBonkRewardsMonth ] ;
110+
26111export function positionToBonkRewards ( position : number | undefined ) {
27112 if ( ! position ) return 0 ;
28- if ( position === 1 ) return 25000 ;
29- if ( position === 2 ) return 15000 ;
30- if ( position === 3 ) return 10000 ;
31- if ( position === 4 || position === 5 ) return 5000 ;
32- if ( position >= 6 && position <= 10 ) return 4000 ;
33- if ( position >= 11 && position <= 20 ) return 2000 ;
34- return 0 ;
113+
114+ const activeBonkRewards = CURRENT_BONK_REWARDS_DETAILS . rewards ;
115+
116+ if ( ! activeBonkRewards . length ) return 0 ;
117+
118+ const activeBonkReward = activeBonkRewards . find (
119+ ( reward ) =>
120+ ! ! reward . positionRange [ 0 ] &&
121+ ! ! reward . positionRange [ 1 ] &&
122+ position >= reward . positionRange [ 0 ] &&
123+ position <= reward . positionRange [ 1 ]
124+ ) ;
125+ return activeBonkReward ?. reward ?? 0 ;
35126}
36127
37128export const CURRENT_SURGE_REWARDS_DETAILS = {
@@ -49,11 +140,6 @@ export const LIQUIDATION_REBATES_DETAILS = {
49140 rebateAmountUsd : 1_000_000 ,
50141} ;
51142
52- export const CURRENT_BONK_REWARDS_DETAILS = {
53- startTime : '2026-02-01T00:00:00.000Z' , // start of february 2026
54- endTime : '2026-02-28T23:59:59.000Z' , // end of february 2026
55- } ;
56-
57143export const DEC_2025_COMPETITION_DETAILS = {
58144 rewardAmount : '$1M' ,
59145 rewardAmountUsd : 1_000_000 ,
0 commit comments