From a92e9d783b22a4e2486ba7577050fa1a201c7431 Mon Sep 17 00:00:00 2001 From: Mayank Mittal Date: Tue, 24 Nov 2026 14:10:43 +0530 Subject: [PATCH 1/2] fix(withdraw): withdraw soETH on Ethereum only; bridge Base shares first soETH held on Base no longer requests on the Base queue. Like soETH on Fuse, it takes two steps: bridge the shares to the same Safe on Ethereum through the Base soETH teller (the Safe pays the LayerZero fee in Base ETH; Base has no bridge paymaster), then request WETH on the Ethereum queue. The Base vault's idle WETH falls short of supply x rate, so Base solves revert unless topped up by hand. Existing Base-queue requests are still shown and can be cancelled. Co-Authored-By: Claude Opus 5.5 --- components/Unstake/RegularWithdrawForm.tsx | 88 +++------- constants/withdraw.ts | 6 +- hooks/useBridgeSoEthBaseToMainnet.ts | 186 +++++++++++++++++++++ lib/soEthWithdraw.ts | 86 ++++++---- 4 files changed, 272 insertions(+), 94 deletions(-) create mode 100644 hooks/useBridgeSoEthBaseToMainnet.ts diff --git a/components/Unstake/RegularWithdrawForm.tsx b/components/Unstake/RegularWithdrawForm.tsx index 0aa8d6a53..8d34fb7fa 100644 --- a/components/Unstake/RegularWithdrawForm.tsx +++ b/components/Unstake/RegularWithdrawForm.tsx @@ -22,6 +22,7 @@ import { WalletTokenButton } from '@/components/WalletTokenSelector'; import { UNSTAKE_MODAL } from '@/constants/modals'; import { getVaultKey, isSolidTokenSymbol } from '@/constants/withdraw'; import useBridgeForWithdraw from '@/hooks/useBridgeForWithdraw'; +import useBridgeSoEthBaseToMainnet from '@/hooks/useBridgeSoEthBaseToMainnet'; import useBridgeToMainnetSoEth from '@/hooks/useBridgeToMainnetSoEth'; import useUser from '@/hooks/useUser'; import { useFuseVaultBalance, useSoEthVaultBalance, useSoFuseVaultBalance } from '@/hooks/useVault'; @@ -34,7 +35,7 @@ import useWithdrawSoFuse from '@/hooks/useWithdrawSoFuse'; import { ADDRESSES } from '@/lib/config'; import { showFailureSheet } from '@/lib/errors'; import getTokenIcon from '@/lib/getTokenIcon'; -import { getSoEthWithdrawChain, SOETH_WITHDRAW_CHAINS } from '@/lib/soEthWithdraw'; +import { isSoEthBaseConfigured, SOETH_WITHDRAW_CHAINS } from '@/lib/soEthWithdraw'; import { getSoUsdWithdrawChain, resumeWithdrawAmount, @@ -141,21 +142,17 @@ const RegularWithdrawForm = () => { // soEURC withdraws in one step on Base, like soFUSE on Fuse, and is shown in EUR. // The new Base deployments report the share's on-chain symbol as soEUR. const isSoEurc = getVaultKey(selectedToken?.contractTickerSymbol) === 'EUR'; - // soETH held on Base withdraws in one step, through the Base queue for Base WETH, - // like soEURC. soETH on Fuse keeps the two steps (bridge to Ethereum, then the - // Ethereum queue), and so does a withdraw resumed after that bridge. - const isSoEthOnBase = - isSoEth && - getSoEthWithdrawChain(selectedToken?.chainId) === base.id && - session?.vault !== 'ETH'; - // soETH on Base in a build with no Base soETH deployment: neither flow fits. The two-step flow - // below bridges the Safe's FUSE shares, not these, so it must not be offered for them. + // soETH is only withdrawn on Ethereum. Shares on Fuse or Base bridge there in + // step 1 (Fuse through the paymaster, Base paying the LayerZero fee in Base ETH), + // then step 2 requests them on the Ethereum queue for WETH. + const isSoEthOnBase = isSoEth && selectedToken?.chainId === base.id; + // soETH on Base in a build with no Base soETH teller: it cannot be bridged from here. The Fuse + // bridge moves the Safe's Fuse shares, not these, so it must not be offered for them. const isSoEthOnBaseUnavailable = - isSoEth && selectedToken?.chainId === base.id && !isSoEthOnBase && session?.vault !== 'ETH'; - const soEthWithdrawChain = SOETH_WITHDRAW_CHAINS[isSoEthOnBase ? base.id : mainnet.id]; - // Base soETH is paid out by the Base queue at the Base accountant's rate, not Ethereum's. + isSoEthOnBase && !isSoEthBaseConfigured && session?.vault !== 'ETH'; + const soEthWithdrawChain = SOETH_WITHDRAW_CHAINS[mainnet.id]; const { data: exchangeRate } = useVaultExchangeRate( - isSoFuse ? 'FUSE' : isSoEthOnBase ? 'ETH_BASE' : isSoEth ? 'ETH' : isSoEurc ? 'EUR' : 'USDC', + isSoFuse ? 'FUSE' : isSoEth ? 'ETH' : isSoEurc ? 'EUR' : 'USDC', ); const tokenType = selectedToken?.type || TokenType.ERC20; const isNative = tokenType === TokenType.NATIVE; @@ -282,14 +279,14 @@ const RegularWithdrawForm = () => { const { bridge, bridgeStatus } = useBridgeForWithdraw(withdrawChainId); const { bridgeSoEth, bridgeSoEthStatus } = useBridgeToMainnetSoEth(); + const { bridgeSoEthFromBase, bridgeSoEthFromBaseStatus } = useBridgeSoEthBaseToMainnet(); const { withdraw, withdrawStatus, isAllowanceLoading } = useWithdraw(withdrawChainId); - const { withdrawSoEth, withdrawSoEthStatus } = useWithdrawSoEth( - isSoEthOnBase ? base.id : mainnet.id, - ); + const { withdrawSoEth, withdrawSoEthStatus } = useWithdrawSoEth(mainnet.id); const { withdrawSoFuse, withdrawSoFuseStatus } = useWithdrawSoFuse(); const { withdrawSoEurc, withdrawSoEurcStatus } = useWithdrawSoEurc(); const isBridgeLoading = bridgeStatus === Status.PENDING; - const isBridgeSoEthLoading = bridgeSoEthStatus === Status.PENDING; + const isBridgeSoEthLoading = + bridgeSoEthStatus === Status.PENDING || bridgeSoEthFromBaseStatus === Status.PENDING; const isWithdrawLoading = withdrawStatus === Status.PENDING; const isWithdrawSoEthLoading = withdrawSoEthStatus === Status.PENDING; const isWithdrawSoFuseLoading = withdrawSoFuseStatus === Status.PENDING; @@ -297,10 +294,10 @@ const RegularWithdrawForm = () => { const [activeStep, setActiveStep] = useState<1 | 2>(1); // Bridging vaults (soUSD, soETH) always render both steps. A token held on - // Fuse starts on step 1 (bridge); a token already on the withdraw chain (Base - // or Ethereum for soUSD, Ethereum for soETH) — or an unfinished withdraw - // resumed from storage — jumps to step 2 (withdraw). - // soFUSE, soEURC and soETH on Base have no bridge and keep the single-step layout. + // Fuse (or soETH on Base) starts on step 1 (bridge); a token already on the + // withdraw chain (Base or Ethereum for soUSD, Ethereum for soETH) — or an + // unfinished withdraw resumed from storage — jumps to step 2 (withdraw). + // soFUSE and soEURC have no bridge and keep the single-step layout. const isUsdVault = !isSoFuse && !isSoEth && !isSoEurc; const isEthVault = isSoEth; const isOnEthereum = selectedToken?.chainId === 1; @@ -506,7 +503,8 @@ const RegularWithdrawForm = () => { const onBridgeSoEthSubmit = async (data: WithdrawFormData) => { try { - await bridgeSoEth(data.amount.toString()); + // Base shares pay their own LayerZero fee in Base ETH; Fuse shares go through the paymaster. + await (isSoEthOnBase ? bridgeSoEthFromBase : bridgeSoEth)(data.amount.toString()); setTransaction({ amount: Number(data.amount), symbol: 'soETH', @@ -767,45 +765,6 @@ const RegularWithdrawForm = () => { )} - ) : isSoEthOnBase ? ( - - - - - Withdraw to WETH - - {/* An estimate: the queue keeps a request open for at least three days and a solver - usually fills it well within them, but nothing guarantees a payout by then. */} - - Usually within 3 days - - - - ) : isUsdVault ? ( <> {/* Step 1: Bridge to the withdraw chain */} @@ -958,6 +917,11 @@ const RegularWithdrawForm = () => { ~2 min + {isSoEthOnBase && activeStep === 1 && ( + + Bridge fee is paid in ETH on Base from your wallet + + )}