Skip to content

Commit 7ca1dac

Browse files
authored
fix: rfox lp unstake (#11800)
1 parent ac6c578 commit 7ca1dac

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎headers/csps/shapeshift.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Csp } from '../types'
22

33
export const csp: Csp = {
4-
'connect-src': ['https://*.shapeshift.com', 'https://*.*.shapeshift.com'],
4+
'connect-src': ['https://*.shapeshift.com'],
55
}

‎src/pages/RFOX/components/Unstake/UnstakeInput.tsx‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CardBody, CardFooter, Collapse, Flex, Skeleton, Stack } from '@chakra-ui/react'
2-
import { fromAssetId } from '@shapeshiftoss/caip'
2+
import { fromAssetId, uniV2EthFoxArbitrumAssetId } from '@shapeshiftoss/caip'
33
import type { Asset } from '@shapeshiftoss/types'
44
import { isSome } from '@shapeshiftoss/utils'
55
import { useCallback, useEffect, useMemo, useState } from 'react'
@@ -277,7 +277,7 @@ export const UnstakeInput: React.FC<UnstakeRouteProps & UnstakeInputProps> = ({
277277
stakingAssetAccountId &&
278278
hasEnteredValue &&
279279
stakingAsset &&
280-
cooldownPeriodData?.cooldownPeriod
280+
cooldownPeriodData?.cooldownPeriod !== undefined
281281
)
282282
)
283283
return
@@ -286,7 +286,7 @@ export const UnstakeInput: React.FC<UnstakeRouteProps & UnstakeInputProps> = ({
286286
stakingAssetAccountId,
287287
stakingAssetId,
288288
unstakingAmountCryptoBaseUnit: toBaseUnit(amountCryptoPrecision, stakingAsset.precision),
289-
cooldownPeriod: cooldownPeriodData?.cooldownPeriod,
289+
cooldownPeriod: cooldownPeriodData.cooldownPeriod,
290290
})
291291

292292
navigate(UnstakeRoutePaths.Confirm)
@@ -301,6 +301,11 @@ export const UnstakeInput: React.FC<UnstakeRouteProps & UnstakeInputProps> = ({
301301
stakingAssetId,
302302
])
303303

304+
const handleUnstakeClick = useMemo(() => {
305+
if (stakingAssetId === uniV2EthFoxArbitrumAssetId) return handleSubmit
306+
return handleWarning
307+
}, [handleSubmit, handleWarning, stakingAssetId])
308+
304309
const validateHasEnoughFeeBalance = useCallback(
305310
(input: string) => {
306311
if (bnOrZero(input).isZero()) return true
@@ -479,11 +484,11 @@ export const UnstakeInput: React.FC<UnstakeRouteProps & UnstakeInputProps> = ({
479484
!hasEnteredValue ||
480485
!isUnstakeFeesSuccess ||
481486
Boolean(errors.amountFieldInput) ||
482-
!cooldownPeriodData?.cooldownPeriodSeconds,
487+
cooldownPeriodData?.cooldownPeriodSeconds === undefined,
483488
)}
484489
size='lg'
485490
mx={-2}
486-
onClick={handleWarning}
491+
onClick={handleUnstakeClick}
487492
colorScheme={Boolean(errors.amountFieldInput) ? 'red' : 'blue'}
488493
isLoading={isUnstakeFeesLoading}
489494
>

‎src/pages/RFOX/constants.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getStakingContract } from './helpers'
99
export const stakeEvent = getAbiItem({ abi: RFOX_ABI, name: 'Stake' })
1010
export const unstakeEvent = getAbiItem({ abi: RFOX_ABI, name: 'Unstake' })
1111

12-
export const IPFS_GATEWAY = 'https://gateway.shapeshift.com/ipfs'
12+
export const IPFS_GATEWAY = 'https://gateway.pinata.cloud/ipfs'
1313

1414
export const CURRENT_EPOCH_IPFS_HASH = 'bafkreidwawtp6luapulgga67cicthy6saycxpzfeqomajxiosmlhkwgoyy'
1515
export const STUB_RUNE_ADDRESS = 'thor1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqn8p0r8'

0 commit comments

Comments
 (0)