Skip to content

Commit

Permalink
feat: disable withdrawal checks for sARBy vault
Browse files Browse the repository at this point in the history
  • Loading branch information
dimlbc committed Dec 19, 2024
1 parent caa837f commit 03e66c7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/trading-widget/src/core-kit/const/synthetix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export const DHEDGE_SYNTHETIX_V3_VAULT_ADDRESSES: Address[] = [
'0xe9b5260d99d283ff887859c569baf8ad1bd12aac', // Synthetix ETH Yield Arbitrum
]

export const DHEDGE_SYNTHETIX_V3_DEPRECATED_VAULT_ADDRESSES: Address[] = [
'0xddd6b1f34e12c0230ab23cbd4514560b24438514', // Synthetix ARB Yield Arbitrum
]

// Should include symbols for all vaults from DHEDGE_SYNTHETIX_V3_VAULT_ADDRESSES
export const SYNTHETIX_V3_VAULTS_WITHDRAW_ASSET_SYMBOL_MAP: Record<
string,
Expand Down
6 changes: 6 additions & 0 deletions packages/trading-widget/src/core-kit/utils/synthetix.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
DHEDGE_SYNTHETIX_V3_ASSETS_MAP,
DHEDGE_SYNTHETIX_V3_DEPRECATED_VAULT_ADDRESSES,
DHEDGE_SYNTHETIX_V3_VAULT_ADDRESSES,
} from 'core-kit/const'

Expand All @@ -14,3 +15,8 @@ export const isSynthetixV3Asset = (address: string) =>
Object.values(DHEDGE_SYNTHETIX_V3_ASSETS_MAP).some((asset) =>
isEqualAddress(asset, address),
)

export const skipSynthetixV3WithdrawalChecks = (address: string) =>
DHEDGE_SYNTHETIX_V3_DEPRECATED_VAULT_ADDRESSES.some((vault) =>
isEqualAddress(vault, address),
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
import { useSynthetixV3OraclesUpdate } from 'core-kit/hooks/trading'
import { useWithdrawLiquidity } from 'core-kit/hooks/trading/synthetix-v3/use-withdraw-liquidity'
import { useInitWithdrawAllowance } from 'core-kit/hooks/trading/withdraw-v2/init-step'
import { isSynthetixV3Vault } from 'core-kit/utils'
import {
isSynthetixV3Vault,
skipSynthetixV3WithdrawalChecks,
} from 'core-kit/utils'

import {
useHighSlippageCheck,
Expand Down Expand Up @@ -45,12 +48,16 @@ export const useValidInitWithdrawButton = () => {
})
}

const isSynthetixVault = isSynthetixV3Vault(address)
const performSynthetixWithdrawalChecks =
isSynthetixV3Vault(address) && !skipSynthetixV3WithdrawalChecks(address)


Check failure on line 54 in packages/trading-widget/src/trading-widget/components/withdraw/init-step/button/valid-init-withdraw-button/valid-init-withdraw-button.hooks.ts

View workflow job for this annotation

GitHub Actions / Build

Delete `⏎`
return {
requiresWithdrawalWindow: isSynthetixVault && !isWithdrawal,
requiresWithdrawalWindow: performSynthetixWithdrawalChecks && !isWithdrawal,
requiresWithdrawalLiquidity:
isSynthetixVault && !!sendToken.value && liquidity.noLiquidity,
performSynthetixWithdrawalChecks &&
!!sendToken.value &&
liquidity.noLiquidity,
requiresEndOfCooldown: cooldownActive,
requiresApprove: !canSpend,
requiresHighSlippageConfirm,
Expand Down

0 comments on commit 03e66c7

Please sign in to comment.