@@ -34,7 +34,7 @@ import {
34
34
useQueueWithdrawCrab ,
35
35
} from '@state/crab/hooks'
36
36
import { readyAtom } from '@state/squeethPool/atoms'
37
- import { useUserCrabV2TxHistory } from '@hooks/useUserCrabV2TxHistory '
37
+ import { useCheckLegacyCrabV2User } from '@hooks/useCheckLegacyUser '
38
38
import {
39
39
dailyHistoricalFundingAtom ,
40
40
impliedVolAtom ,
@@ -73,8 +73,6 @@ import { CrabTradeTransactionType, CrabTradeType, CrabTransactionConfirmation, O
73
73
import { CRAB_EVENTS } from '@utils/amplitude'
74
74
import useAmplitude from '@hooks/useAmplitude'
75
75
import useExecuteOnce from '@hooks/useExecuteOnce'
76
- import useAppEffect from '@hooks/useAppEffect'
77
- import { CrabStrategyV2TxType , CrabStrategyTxType } from 'src/types'
78
76
import useTrackTransactionFlow from '@hooks/useTrackTransactionFlow'
79
77
80
78
enum WithdrawSteps {
@@ -150,7 +148,6 @@ const CrabWithdraw: React.FC<{ onTxnConfirm: (txn: CrabTransactionConfirmation)
150
148
const address = useAtomValue ( addressAtom )
151
149
const { allowance : crabAllowance , approve : approveCrab } = useUserAllowance ( crabStrategy2 , crabHelper )
152
150
const { allowance : crabQueueAllowance , approve : approveQueueCrab } = useUserAllowance ( crabStrategy2 , crabNetting )
153
- const { data } = useUserCrabV2TxHistory ( address ?? '' )
154
151
155
152
const impliedVol = useAtomValue ( impliedVolAtom )
156
153
const normFactor = useAtomValue ( normFactorAtom )
@@ -179,23 +176,10 @@ const CrabWithdraw: React.FC<{ onTxnConfirm: (txn: CrabTransactionConfirmation)
179
176
[ track ] ,
180
177
)
181
178
182
- useAppEffect ( ( ) => {
183
- // show token toggle only if the user has deposited before 28th December 00:00 UTC, the launch date of new design
184
- const launchDate = new Date ( '2022-12-28T00:00:00.000Z' ) . getTime ( ) / 1000
185
- const isLegacyUser =
186
- data ?. some ( ( tx ) => {
187
- const isDepositTx =
188
- tx . type === CrabStrategyV2TxType . FLASH_DEPOSIT ||
189
- tx . type === CrabStrategyV2TxType . DEPOSIT ||
190
- tx . type === CrabStrategyV2TxType . DEPOSIT_V1 ||
191
- tx . type === CrabStrategyTxType . DEPOSIT ||
192
- tx . type === CrabStrategyV2TxType . OTC_DEPOSIT
193
-
194
- return isDepositTx && tx . timestamp < launchDate
195
- } ) ?? false
196
-
179
+ const isLegacyUser = useCheckLegacyCrabV2User ( address ?? '' )
180
+ useEffect ( ( ) => {
197
181
setShowTokenToggle ( isLegacyUser )
198
- } , [ data ] )
182
+ } , [ isLegacyUser ] )
199
183
200
184
const withdrawPriceImpactWarning = useAppMemo ( ( ) => {
201
185
if ( useQueue ) return false
0 commit comments