diff --git a/apps/evm/src/ui/pool/AddSectionLegacy.tsx b/apps/evm/src/ui/pool/AddSectionLegacy.tsx
index a022ec4219..72033ad0d3 100644
--- a/apps/evm/src/ui/pool/AddSectionLegacy.tsx
+++ b/apps/evm/src/ui/pool/AddSectionLegacy.tsx
@@ -3,13 +3,6 @@
import { Pool } from '@sushiswap/client'
import { useIsMounted } from '@sushiswap/hooks'
import { Button } from '@sushiswap/ui'
-import {
- SushiSwapV2PoolState,
- getSushiSwapRouterContractConfig,
- useSushiSwapV2Pool,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import { CheckerProvider } from '@sushiswap/wagmi/systems/Checker/Provider'
import { FC, useCallback, useMemo, useState } from 'react'
import { APPROVE_TAG_ADD_LEGACY } from 'src/lib/constants'
import { type ChainId } from 'sushi/chain'
@@ -17,6 +10,13 @@ import { SushiSwapV2ChainId } from 'sushi/config'
import { tryParseAmount } from 'sushi/currency'
import { useTokensFromPool } from '../../lib/hooks'
+import { getSushiSwapRouterContractConfig } from 'src/lib/wagmi/hooks/contracts/useSushiSwapRouter'
+import {
+ SushiSwapV2PoolState,
+ useSushiSwapV2Pool,
+} from 'src/lib/wagmi/hooks/pools/hooks/useSushiSwapV2Pools'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
+import { CheckerProvider } from 'src/lib/wagmi/systems/Checker/Provider'
import { AddSectionReviewModalLegacy } from './AddSectionReviewModalLegacy'
import { AddSectionWidget } from './AddSectionWidget'
diff --git a/apps/evm/src/ui/pool/AddSectionMyPosition.tsx b/apps/evm/src/ui/pool/AddSectionMyPosition.tsx
index c39dcda2e6..b4c07155b3 100644
--- a/apps/evm/src/ui/pool/AddSectionMyPosition.tsx
+++ b/apps/evm/src/ui/pool/AddSectionMyPosition.tsx
@@ -1,6 +1,6 @@
import { Pool } from '@sushiswap/client'
import { classNames } from '@sushiswap/ui'
-import { Currency as UICurrency } from '@sushiswap/ui/components/currency'
+import { Currency as UICurrency } from '@sushiswap/ui'
import React, { FC } from 'react'
import { incentiveRewardToToken } from 'src/lib/functions'
import { ChainId } from 'sushi/chain'
diff --git a/apps/evm/src/ui/pool/AddSectionMyPositionStaked.tsx b/apps/evm/src/ui/pool/AddSectionMyPositionStaked.tsx
index 2f6d7349d0..c419973106 100644
--- a/apps/evm/src/ui/pool/AddSectionMyPositionStaked.tsx
+++ b/apps/evm/src/ui/pool/AddSectionMyPositionStaked.tsx
@@ -1,4 +1,4 @@
-import { Currency } from '@sushiswap/ui/components/currency'
+import { Currency } from '@sushiswap/ui'
import React, { FC } from 'react'
import { formatUSD } from 'sushi/format'
diff --git a/apps/evm/src/ui/pool/AddSectionMyPositionUnstaked.tsx b/apps/evm/src/ui/pool/AddSectionMyPositionUnstaked.tsx
index 94cbe7ba25..ead2d417f4 100644
--- a/apps/evm/src/ui/pool/AddSectionMyPositionUnstaked.tsx
+++ b/apps/evm/src/ui/pool/AddSectionMyPositionUnstaked.tsx
@@ -1,4 +1,4 @@
-import { Currency } from '@sushiswap/ui/components/currency'
+import { Currency } from '@sushiswap/ui'
import React, { FC } from 'react'
import { formatUSD } from 'sushi/format'
diff --git a/apps/evm/src/ui/pool/AddSectionPoolShareCardV2.tsx b/apps/evm/src/ui/pool/AddSectionPoolShareCardV2.tsx
index 1ee1d2bcd3..ce243870c8 100644
--- a/apps/evm/src/ui/pool/AddSectionPoolShareCardV2.tsx
+++ b/apps/evm/src/ui/pool/AddSectionPoolShareCardV2.tsx
@@ -6,8 +6,8 @@ import {
StatLabel,
StatValue,
} from '@sushiswap/ui'
-import { SushiSwapV2PoolState } from '@sushiswap/wagmi'
import { FC, useMemo } from 'react'
+import { SushiSwapV2PoolState } from 'src/lib/wagmi/hooks/pools/hooks/useSushiSwapV2Pools'
import { SushiSwapV2Pool } from 'sushi'
import { Amount, Type } from 'sushi/currency'
import { formatPercent } from 'sushi/format'
diff --git a/apps/evm/src/ui/pool/AddSectionReviewModal.tsx b/apps/evm/src/ui/pool/AddSectionReviewModal.tsx
index 6727fcb1bb..3151218922 100644
--- a/apps/evm/src/ui/pool/AddSectionReviewModal.tsx
+++ b/apps/evm/src/ui/pool/AddSectionReviewModal.tsx
@@ -1,5 +1,5 @@
import { Button, List } from '@sushiswap/ui'
-import { Currency } from '@sushiswap/ui/components/currency'
+import { Currency } from '@sushiswap/ui'
import { FC, useMemo } from 'react'
import { useTokenAmountDollarValues } from 'src/lib/hooks'
import { BentoBoxChainId } from 'sushi/config'
diff --git a/apps/evm/src/ui/pool/AddSectionReviewModalConcentrated.tsx b/apps/evm/src/ui/pool/AddSectionReviewModalConcentrated.tsx
index 96a815d99a..b0cb874098 100644
--- a/apps/evm/src/ui/pool/AddSectionReviewModalConcentrated.tsx
+++ b/apps/evm/src/ui/pool/AddSectionReviewModalConcentrated.tsx
@@ -17,27 +17,32 @@ import {
SettingsModule,
SettingsOverlay,
} from '@sushiswap/ui'
-import { createErrorToast, createToast } from '@sushiswap/ui/components/toast'
-import {
- UseCallParameters,
- getDefaultTTL,
- getV3NonFungiblePositionManagerContractConfig,
- useAccount,
- useCall,
- usePublicClient,
- useSendTransaction,
- useTransactionDeadline,
- useWaitForTransactionReceipt,
-} from '@sushiswap/wagmi'
+import { createErrorToast, createToast } from '@sushiswap/ui'
import React, { FC, ReactNode, useCallback, useMemo } from 'react'
import { Bound } from 'src/lib/constants'
import { useTokenAmountDollarValues } from 'src/lib/hooks'
import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
+import {
+ getDefaultTTL,
+ useTransactionDeadline,
+} from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
import { Chain, ChainId } from 'sushi/chain'
-import { SushiSwapV3FeeAmount, isSushiSwapV3ChainId } from 'sushi/config'
+import {
+ SUSHISWAP_V3_POSTIION_MANAGER,
+ SushiSwapV3FeeAmount,
+ isSushiSwapV3ChainId,
+} from 'sushi/config'
import { Amount, Type, tryParseAmount } from 'sushi/currency'
-import { NonfungiblePositionManager, Position } from 'sushi/pool'
+import { NonfungiblePositionManager, Position } from 'sushi/pool/sushiswap-v3'
import { Hex, SendTransactionReturnType, UserRejectedRequestError } from 'viem'
+import {
+ UseCallParameters,
+ useAccount,
+ useCall,
+ usePublicClient,
+ useSendTransaction,
+ useWaitForTransactionReceipt,
+} from 'wagmi'
import { useConcentratedDerivedMintInfo } from './ConcentratedLiquidityProvider'
interface AddSectionReviewModalConcentratedProps
@@ -199,7 +204,7 @@ export const AddSectionReviewModalConcentrated: FC<
})
return {
- to: getV3NonFungiblePositionManagerContractConfig(chainId).address,
+ to: SUSHISWAP_V3_POSTIION_MANAGER[chainId],
account: address,
chainId,
data: calldata as Hex,
diff --git a/apps/evm/src/ui/pool/AddSectionReviewModalLegacy.tsx b/apps/evm/src/ui/pool/AddSectionReviewModalLegacy.tsx
index 8542e4e9e4..44292e9793 100644
--- a/apps/evm/src/ui/pool/AddSectionReviewModalLegacy.tsx
+++ b/apps/evm/src/ui/pool/AddSectionReviewModalLegacy.tsx
@@ -14,32 +14,37 @@ import {
SettingsModule,
SettingsOverlay,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Dots } from '@sushiswap/ui/components/dots'
-import { createErrorToast, createToast } from '@sushiswap/ui/components/toast'
-import {
- SushiSwapV2PoolState,
- UseSimulateContractParameters,
- getDefaultTTL,
- getSushiSwapRouterContractConfig,
- useAccount,
- usePublicClient,
- useSimulateContract,
- useTransactionDeadline,
- useWaitForTransactionReceipt,
- useWriteContract,
-} from '@sushiswap/wagmi'
-import { SendTransactionReturnType } from '@sushiswap/wagmi/actions'
-import { useApproved } from '@sushiswap/wagmi/systems/Checker/Provider'
+import { Button } from '@sushiswap/ui'
+import { Dots } from '@sushiswap/ui'
+import { createErrorToast, createToast } from '@sushiswap/ui'
import { FC, ReactNode, useCallback, useMemo } from 'react'
import { APPROVE_TAG_ADD_LEGACY } from 'src/lib/constants'
import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
+import { getSushiSwapRouterContractConfig } from 'src/lib/wagmi/hooks/contracts/useSushiSwapRouter'
+import { SushiSwapV2PoolState } from 'src/lib/wagmi/hooks/pools/hooks/useSushiSwapV2Pools'
+import {
+ getDefaultTTL,
+ useTransactionDeadline,
+} from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
+import { useApproved } from 'src/lib/wagmi/systems/Checker/Provider'
import { gasMargin, slippageAmount } from 'sushi/calculate'
import { SushiSwapV2ChainId } from 'sushi/config'
import { BentoBoxChainId } from 'sushi/config'
import { Amount, Type } from 'sushi/currency'
import { ZERO } from 'sushi/math'
-import { Address, UserRejectedRequestError } from 'viem'
+import {
+ Address,
+ SendTransactionReturnType,
+ UserRejectedRequestError,
+} from 'viem'
+import {
+ UseSimulateContractParameters,
+ usePublicClient,
+ useWriteContract,
+} from 'wagmi'
+import { useSimulateContract } from 'wagmi'
+import { useAccount } from 'wagmi'
+import { useWaitForTransactionReceipt } from 'wagmi'
import { AddSectionReviewModal } from './AddSectionReviewModal'
interface UseAddSushiSwapV2 {
diff --git a/apps/evm/src/ui/pool/AddSectionReviewModalTrident.tsx b/apps/evm/src/ui/pool/AddSectionReviewModalTrident.tsx
deleted file mode 100644
index 6d7178c3f3..0000000000
--- a/apps/evm/src/ui/pool/AddSectionReviewModalTrident.tsx
+++ /dev/null
@@ -1,401 +0,0 @@
-import {
- DialogConfirm,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogProvider,
- DialogReview,
- DialogTitle,
- DialogTrigger,
-} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Dots } from '@sushiswap/ui/components/dots'
-import { createErrorToast, createToast } from '@sushiswap/ui/components/toast'
-import {
- TridentConstantPoolState,
- TridentStablePoolState,
- UseCallParameters,
- useAccount,
- useBentoBoxTotals,
- useCall,
- usePublicClient,
- useSendTransaction,
- useTotalSupply,
- useTridentRouterContract,
- useWaitForTransactionReceipt,
-} from '@sushiswap/wagmi'
-import {
- useApproved,
- useApprovedActions,
- useSignature,
-} from '@sushiswap/wagmi/systems/Checker/Provider'
-import { FC, ReactNode, useCallback, useMemo } from 'react'
-
-import {
- LiquidityInput,
- approveMasterContractAction,
- batchAction,
-} from 'src/lib/pool/trident'
-
-import { APPROVE_TAG_ADD_TRIDENT } from 'src/lib/constants'
-import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
-import { TridentConstantPool, TridentStablePool } from 'sushi'
-import { slippageAmount } from 'sushi/calculate'
-import { ChainId } from 'sushi/chain'
-import { BentoBoxChainId, TridentChainId } from 'sushi/config'
-import { Amount, Token, Type } from 'sushi/currency'
-import { Percent, ZERO } from 'sushi/math'
-import {
- Address,
- SendTransactionReturnType,
- UserRejectedRequestError,
- encodeAbiParameters,
- encodeFunctionData,
- parseAbiParameters,
- zeroAddress,
-} from 'viem'
-
-import { SlippageToleranceStorageKey } from '@sushiswap/hooks'
-import { AddSectionReviewModal } from './AddSectionReviewModal'
-
-interface AddSectionReviewModalTridentProps {
- poolAddress: string
- poolState: TridentConstantPoolState | TridentStablePoolState | undefined
- pool: TridentConstantPool | TridentStablePool | null | undefined
- chainId: TridentChainId
- token0: Type | undefined
- token1: Type | undefined
- input0: Amount
| undefined
- input1: Amount | undefined
- children: ReactNode
- onSuccess: () => void
-}
-
-const ZERO_PERCENT = new Percent('0')
-
-export const AddSectionReviewModalTrident: FC<
- AddSectionReviewModalTridentProps
-> = ({
- poolAddress,
- poolState,
- pool,
- chainId,
- token0,
- token1,
- input0,
- input1,
- children,
- onSuccess: _onSuccess,
-}) => {
- const { address, chain } = useAccount()
- const { signature } = useSignature(APPROVE_TAG_ADD_TRIDENT)
- const { setSignature } = useApprovedActions(APPROVE_TAG_ADD_TRIDENT)
- const { approved } = useApproved(APPROVE_TAG_ADD_TRIDENT)
- const client = usePublicClient()
-
- const liquidityToken = useMemo(() => {
- return new Token({
- address: poolAddress.includes(':')
- ? poolAddress.split(':')[1]
- : poolAddress,
- name: 'SLP Token',
- decimals: 18,
- symbol: 'SLP',
- chainId,
- })
- }, [chainId, poolAddress])
-
- const totalSupply = useTotalSupply(liquidityToken)
- const tokens = useMemo(() => [token0, token1], [token0, token1])
- const { data: rebases } = useBentoBoxTotals({ chainId, currencies: tokens })
- const contract = useTridentRouterContract(chainId)
- const [slippageTolerance] = useSlippageTolerance(
- SlippageToleranceStorageKey.AddLiquidity,
- )
- const [minAmount0, minAmount1] = useMemo(() => {
- return [
- input0
- ? poolState === TridentConstantPoolState.NOT_EXISTS ||
- poolState === TridentStablePoolState.NOT_EXISTS
- ? input0
- : Amount.fromRawAmount(
- input0.currency,
- slippageAmount(input0, slippageTolerance)[0],
- )
- : undefined,
- input1
- ? poolState === TridentConstantPoolState.NOT_EXISTS ||
- poolState === TridentStablePoolState.NOT_EXISTS
- ? input1
- : Amount.fromRawAmount(
- input1.currency,
- slippageAmount(input1, slippageTolerance)[0],
- )
- : undefined,
- ]
- }, [poolState, input0, input1, slippageTolerance])
-
- const noLiquidity = useMemo(() => {
- return (
- poolState === TridentConstantPoolState.NOT_EXISTS ||
- poolState === TridentStablePoolState.NOT_EXISTS ||
- Boolean(totalSupply && totalSupply.quotient === ZERO) ||
- Boolean(
- pool &&
- pool.reserve0.quotient === ZERO &&
- pool.reserve1.quotient === ZERO,
- )
- )
- }, [pool, poolState, totalSupply])
-
- const liquidityMinted = useMemo(() => {
- if (
- pool &&
- totalSupply &&
- token0 &&
- token1 &&
- input0 &&
- input1 &&
- rebases?.[token0.wrapped.address] &&
- rebases?.[token1.wrapped.address]
- ) {
- const amountA = input0.wrapped.toShare(rebases?.[token0.wrapped.address])
- const amountB = input1.wrapped.toShare(rebases?.[token1.wrapped.address])
-
- // Both can't be zero
- if (amountA.equalTo(ZERO) && amountB.equalTo(ZERO)) return undefined
-
- try {
- const slp = pool.getLiquidityMinted(totalSupply, amountA, amountB)
- const minSLP = slippageAmount(
- slp,
- noLiquidity ? ZERO_PERCENT : slippageTolerance,
- )[0]
- return Amount.fromRawAmount(slp.currency, minSLP.toString())
- } catch (error) {
- console.error(error)
- }
- }
-
- return undefined
- }, [
- noLiquidity,
- input0,
- input1,
- pool,
- rebases,
- slippageTolerance,
- token0,
- token1,
- totalSupply,
- ])
-
- const onSuccess = useCallback(
- (hash: SendTransactionReturnType) => {
- setSignature(undefined)
- _onSuccess()
-
- if (!chain?.id || !token0 || !token1) return
-
- const ts = new Date().getTime()
- createToast({
- account: address,
- type: 'mint',
- chainId: chain.id,
- txHash: hash,
- promise: client.waitForTransactionReceipt({ hash }),
- summary: {
- pending: `Adding liquidity to the ${token0.symbol}/${token1.symbol} pair`,
- completed: `Successfully added liquidity to the ${token0.symbol}/${token1.symbol} pair`,
- failed: 'Something went wrong when adding liquidity',
- },
- timestamp: ts,
- groupTimestamp: ts,
- })
- },
- [client, address, chain, token0, token1, setSignature, _onSuccess],
- )
-
- const onError = useCallback((e: Error) => {
- if (e instanceof UserRejectedRequestError) {
- createErrorToast(e?.message, true)
- }
- }, [])
-
- const prepare = useMemo(() => {
- try {
- if (
- !chain?.id ||
- !pool ||
- !token0 ||
- !token1 ||
- !chainId ||
- !contract ||
- !input0 ||
- !input1 ||
- !address ||
- !minAmount0 ||
- !minAmount1 ||
- !liquidityMinted
- )
- return
-
- let value = 0n
- const liquidityInput: LiquidityInput[] = []
- const encoded = encodeAbiParameters(parseAbiParameters('address'), [
- address,
- ])
-
- if (input0) {
- if (input0.currency.isNative) {
- value = BigInt(input0.quotient.toString())
- }
-
- liquidityInput.push({
- token: input0.currency.isNative
- ? zeroAddress
- : (input0.currency.wrapped.address as Address),
- native: true,
- amount: BigInt(input0.quotient.toString()),
- })
- }
-
- if (input1) {
- if (input1.currency.isNative) {
- value = BigInt(input1.quotient.toString())
- }
-
- liquidityInput.push({
- token: input1.currency.isNative
- ? zeroAddress
- : (input1.currency.wrapped.address as Address),
- native: true,
- amount: BigInt(input1.quotient.toString()),
- })
- }
-
- if (liquidityInput.length === 0) return
- return {
- to: contract.address,
- account: address,
- chainId,
- data: batchAction({
- actions: [
- approveMasterContractAction({
- signature: signature,
- }),
- encodeFunctionData({
- ...contract,
- functionName: 'addLiquidity',
- args: [
- liquidityInput,
- pool.liquidityToken.address as Address,
- BigInt(liquidityMinted.quotient.toString()),
- encoded,
- ],
- }),
- ],
- }),
- value,
- } satisfies UseCallParameters
- } catch (_e: unknown) {
- //
- }
- }, [
- chain?.id,
- pool,
- token0,
- token1,
- chainId,
- contract,
- input0,
- input1,
- address,
- minAmount0,
- minAmount1,
- liquidityMinted,
- signature,
- ])
-
- const { isError: isSimulationError } = useCall({
- ...prepare,
- query: {
- enabled: Boolean(
- approved &&
- minAmount0?.greaterThan(ZERO) &&
- minAmount1?.greaterThan(ZERO),
- ),
- },
- })
-
- const {
- sendTransactionAsync,
- isLoading: isWritePending,
- data: hash,
- } = useSendTransaction({
- mutation: {
- onSuccess,
- onError,
- },
- })
-
- const send = useMemo(() => {
- if (!prepare || isSimulationError) return undefined
-
- return async (confirm: () => void) => {
- try {
- await sendTransactionAsync(prepare)
-
- confirm()
- } catch {}
- }
- }, [isSimulationError, prepare, sendTransactionAsync])
-
- const { status } = useWaitForTransactionReceipt({ chainId, hash })
-
- return (
-
-
- {({ confirm }) => (
- <>
- {children}
-
-
- Add liquidity
-
- Please review your entered details.
-
-
-
-
-
-
-
- >
- )}
-
-
-
- )
-}
diff --git a/apps/evm/src/ui/pool/AddSectionStake.tsx b/apps/evm/src/ui/pool/AddSectionStake.tsx
index a658a8edda..5e4252fdfa 100644
--- a/apps/evm/src/ui/pool/AddSectionStake.tsx
+++ b/apps/evm/src/ui/pool/AddSectionStake.tsx
@@ -3,17 +3,8 @@
import { ChefType, Pool } from '@sushiswap/client'
import { usePool } from '@sushiswap/client/hooks'
import { useIsMounted } from '@sushiswap/hooks'
-import { Button } from '@sushiswap/ui/components/button'
-import { Dots } from '@sushiswap/ui/components/dots'
-import {
- getMasterChefContractConfig,
- useMasterChefDeposit,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import {
- useApproved,
- withCheckerRoot,
-} from '@sushiswap/wagmi/systems/Checker/Provider'
+import { Button } from '@sushiswap/ui'
+import { Dots } from '@sushiswap/ui'
import { FC, useMemo, useState } from 'react'
import { APPROVE_TAG_STAKE } from 'src/lib/constants'
import { useGraphPool } from 'src/lib/hooks'
@@ -22,6 +13,13 @@ import { tryParseAmount } from 'sushi/currency'
import { ZERO } from 'sushi/math'
import { useSWRConfig } from 'swr'
+import { getMasterChefContractConfig } from 'src/lib/wagmi/hooks/master-chef/use-master-chef-contract'
+import { useMasterChefDeposit } from 'src/lib/wagmi/hooks/master-chef/use-master-chef-deposit'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
+import {
+ useApproved,
+ withCheckerRoot,
+} from 'src/lib/wagmi/systems/Checker/Provider'
import { AddSectionStakeWidget } from './AddSectionStakeWidget'
interface AddSectionStakeProps {
@@ -67,7 +65,7 @@ const _AddSectionStake: FC = withCheckerRoot(
const { write, isLoading: isWritePending } = useMasterChefDeposit({
amount: amounts[0],
- chainId: liquidityToken.chainId,
+ chainId: liquidityToken?.chainId,
chef: chefType,
pid: farmId,
enabled: Boolean(
diff --git a/apps/evm/src/ui/pool/AddSectionStakeWidget.tsx b/apps/evm/src/ui/pool/AddSectionStakeWidget.tsx
index a83632f9a5..bf36ef04b0 100644
--- a/apps/evm/src/ui/pool/AddSectionStakeWidget.tsx
+++ b/apps/evm/src/ui/pool/AddSectionStakeWidget.tsx
@@ -7,9 +7,8 @@ import {
textFieldVariants,
typographyVariants,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Widget, WidgetHeader } from '@sushiswap/ui/components/widget'
-import { useTotalSupply } from '@sushiswap/wagmi'
+import { Button } from '@sushiswap/ui'
+import { Widget, WidgetHeader } from '@sushiswap/ui'
import { FC, ReactNode, useMemo } from 'react'
import {
useTokenAmountDollarValues,
@@ -18,6 +17,7 @@ import {
import { Amount, Token, Type, tryParseAmount } from 'sushi/currency'
import { formatUSD } from 'sushi/format'
+import { useTotalSupply } from 'src/lib/wagmi/hooks/tokens/useTotalSupply'
import { usePoolPosition } from './PoolPositionProvider'
interface AddSectionStakeWidgetProps {
@@ -27,7 +27,7 @@ interface AddSectionStakeWidgetProps {
setValue(value: string): void
reserve0: Amount | null
reserve1: Amount | null
- liquidityToken: Token
+ liquidityToken: Token | undefined
children: ReactNode
isFarm?: boolean
isIncentivized?: boolean
diff --git a/apps/evm/src/ui/pool/AddSectionWidget.tsx b/apps/evm/src/ui/pool/AddSectionWidget.tsx
index 0dd2df0538..ea376ec367 100644
--- a/apps/evm/src/ui/pool/AddSectionWidget.tsx
+++ b/apps/evm/src/ui/pool/AddSectionWidget.tsx
@@ -7,15 +7,12 @@ import {
WidgetFooter,
WidgetTitle,
} from '@sushiswap/ui'
-import { IconButton } from '@sushiswap/ui/components/iconbutton'
-import {
- SettingsModule,
- SettingsOverlay,
-} from '@sushiswap/ui/components/settings'
-import { Widget, WidgetHeader } from '@sushiswap/ui/components/widget'
-import { getDefaultTTL } from '@sushiswap/wagmi'
-import { Web3Input } from '@sushiswap/wagmi/components/web3-input'
+import { IconButton } from '@sushiswap/ui'
+import { SettingsModule, SettingsOverlay } from '@sushiswap/ui'
+import { Widget, WidgetHeader } from '@sushiswap/ui'
import React, { FC, ReactNode } from 'react'
+import { Web3Input } from 'src/lib/wagmi/components/web3-input'
+import { getDefaultTTL } from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
import { ChainId } from 'sushi/chain'
import { Type } from 'sushi/currency'
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityCollectButton.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityCollectButton.tsx
index 6caadd42c3..c221dd240f 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityCollectButton.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityCollectButton.tsx
@@ -1,21 +1,23 @@
'use client'
-import { createErrorToast, createToast } from '@sushiswap/ui/components/toast'
+import { createErrorToast, createToast } from '@sushiswap/ui'
+import { FC, ReactElement, useCallback, useMemo } from 'react'
+import { ConcentratedLiquidityPosition } from 'src/lib/wagmi/hooks/positions/types'
+import { ChainId } from 'sushi/chain'
+import {
+ SUSHISWAP_V3_POSTIION_MANAGER,
+ isSushiSwapV3ChainId,
+} from 'sushi/config'
+import { Amount, Type, unwrapToken } from 'sushi/currency'
+import { NonfungiblePositionManager, Position } from 'sushi/pool/sushiswap-v3'
+import { Hex, SendTransactionReturnType, UserRejectedRequestError } from 'viem'
import {
- ConcentratedLiquidityPosition,
UseCallParameters,
- getV3NonFungiblePositionManagerContractConfig,
useAccount,
useCall,
usePublicClient,
useSendTransaction,
-} from '@sushiswap/wagmi'
-import { FC, ReactElement, useCallback, useMemo } from 'react'
-import { ChainId } from 'sushi/chain'
-import { isSushiSwapV3ChainId } from 'sushi/config'
-import { Amount, Type, unwrapToken } from 'sushi/currency'
-import { NonfungiblePositionManager, Position } from 'sushi/pool'
-import { Hex, SendTransactionReturnType, UserRejectedRequestError } from 'viem'
+} from 'wagmi'
interface ConcentratedLiquidityCollectButton {
positionDetails: ConcentratedLiquidityPosition | undefined
@@ -73,7 +75,7 @@ export const ConcentratedLiquidityCollectButton: FC<
})
return {
- to: getV3NonFungiblePositionManagerContractConfig(chainId).address,
+ to: SUSHISWAP_V3_POSTIION_MANAGER[chainId],
chainId,
data: calldata as Hex,
value: BigInt(value),
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityHarvestButton.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityHarvestButton.tsx
index 88994c1f9a..0035746ab1 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityHarvestButton.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityHarvestButton.tsx
@@ -1,8 +1,8 @@
'use client'
import { useAngleRewards } from '@sushiswap/react-query'
-import { useHarvestAngleRewards } from '@sushiswap/wagmi'
import { FC, ReactElement, useMemo } from 'react'
+import { useHarvestAngleRewards } from 'src/lib/wagmi/hooks/rewards/hooks/useHarvestAngleRewards'
import { ChainId } from 'sushi/chain'
import { Address } from 'viem'
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityPositionAPRCell.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityPositionAPRCell.tsx
index 3e8c7cd1f2..c75fb5c3b8 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityPositionAPRCell.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityPositionAPRCell.tsx
@@ -6,9 +6,9 @@ import {
HoverCardContent,
HoverCardTrigger,
} from '@sushiswap/ui'
-import { ConcentratedLiquidityPositionWithV3Pool } from '@sushiswap/wagmi'
import { Row } from '@tanstack/react-table'
import { FC } from 'react'
+import { ConcentratedLiquidityPositionWithV3Pool } from 'src/lib/wagmi/hooks/positions/types'
export const ConcentratedLiquidityPositionAPRCell: FC<
Row
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityProvider.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityProvider.tsx
index 446300b7b5..31afe25dbf 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityProvider.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityProvider.tsx
@@ -1,6 +1,5 @@
'use client'
-import { useConcentratedLiquidityPool } from '@sushiswap/wagmi'
import {
FC,
ReactNode,
@@ -12,6 +11,7 @@ import {
} from 'react'
import { Bound, Field } from 'src/lib/constants'
import { getTickToPrice, tryParseTick } from 'src/lib/functions'
+import { useConcentratedLiquidityPool } from 'src/lib/wagmi/hooks/pools/hooks/useConcentratedLiquidityPool'
import {
SushiSwapV3ChainId,
SushiSwapV3FeeAmount,
@@ -37,7 +37,7 @@ import {
priceToClosestTick,
priceToNumber,
tickToPrice,
-} from 'sushi/pool'
+} from 'sushi/pool/sushiswap-v3'
type FullRange = true
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityRemoveWidget.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityRemoveWidget.tsx
index 94bde8a49a..f7fa22dc34 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityRemoveWidget.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityRemoveWidget.tsx
@@ -30,28 +30,33 @@ import {
SettingsOverlay,
classNames,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { createErrorToast, createToast } from '@sushiswap/ui/components/toast'
+import { Button } from '@sushiswap/ui'
+import { createErrorToast, createToast } from '@sushiswap/ui'
+import React, { FC, useCallback, useMemo, useState } from 'react'
+import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
+import { ConcentratedLiquidityPosition } from 'src/lib/wagmi/hooks/positions/types'
import {
- ConcentratedLiquidityPosition,
getDefaultTTL,
- getV3NonFungiblePositionManagerContractConfig,
- useAccount,
- useCall,
- usePublicClient,
- useSendTransaction,
useTransactionDeadline,
- useWaitForTransactionReceipt,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import React, { FC, useCallback, useMemo, useState } from 'react'
-import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
+} from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
import { Chain } from 'sushi/chain'
-import { SushiSwapV3ChainId, isSushiSwapV3ChainId } from 'sushi/config'
+import {
+ SUSHISWAP_V3_POSTIION_MANAGER,
+ SushiSwapV3ChainId,
+ isSushiSwapV3ChainId,
+} from 'sushi/config'
import { Amount, Type, unwrapToken } from 'sushi/currency'
import { Percent, ZERO } from 'sushi/math'
-import { NonfungiblePositionManager, Position } from 'sushi/pool'
+import { NonfungiblePositionManager, Position } from 'sushi/pool/sushiswap-v3'
import { Hex, SendTransactionReturnType, UserRejectedRequestError } from 'viem'
+import {
+ useCall,
+ useSendTransaction,
+ useWaitForTransactionReceipt,
+} from 'wagmi'
+import { useAccount } from 'wagmi'
+import { usePublicClient } from 'wagmi'
import { useTokenAmountDollarValues } from '../../lib/hooks'
interface ConcentratedLiquidityRemoveWidget {
@@ -203,7 +208,7 @@ export const ConcentratedLiquidityRemoveWidget: FC<
})
return {
- to: getV3NonFungiblePositionManagerContractConfig(chainId).address,
+ to: SUSHISWAP_V3_POSTIION_MANAGER[chainId],
data: calldata as Hex,
value: BigInt(_value),
}
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityURLStateProvider.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityURLStateProvider.tsx
index 1e3701156b..aad1aaf6e5 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityURLStateProvider.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityURLStateProvider.tsx
@@ -1,10 +1,9 @@
'use client'
-import { useChainId } from '@sushiswap/wagmi'
-import { useTokenWithCache } from '@sushiswap/wagmi'
import { usePathname, useRouter, useSearchParams } from 'next/navigation'
import React, { FC, ReactNode, createContext, useContext, useMemo } from 'react'
import { SUPPORTED_CHAIN_IDS } from 'src/config'
+import { useTokenWithCache } from 'src/lib/wagmi/hooks/tokens/useTokenWithCache'
import { ChainId } from 'sushi/chain'
import {
SushiSwapV3ChainId,
@@ -16,6 +15,7 @@ import {
} from 'sushi/config'
import { Native, Token, Type } from 'sushi/currency'
import { isAddress } from 'viem'
+import { useChainId } from 'wagmi'
import { z } from 'zod'
export const queryParamsSchema = z.object({
diff --git a/apps/evm/src/ui/pool/ConcentratedLiquidityWidget.tsx b/apps/evm/src/ui/pool/ConcentratedLiquidityWidget.tsx
index 81b29d8cbe..d6467a3acc 100644
--- a/apps/evm/src/ui/pool/ConcentratedLiquidityWidget.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedLiquidityWidget.tsx
@@ -3,23 +3,21 @@
import { Transition } from '@headlessui/react'
import { LockClosedIcon, PlusIcon } from '@heroicons/react-v1/solid'
import { DialogTrigger, FormSection, Message, classNames } from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import {
- getV3NonFungiblePositionManagerContractConfig,
- useConcentratedPositionOwner,
-} from '@sushiswap/wagmi'
-import { Web3Input } from '@sushiswap/wagmi/components/web3-input'
-import { Checker } from '@sushiswap/wagmi/systems'
+import { Button } from '@sushiswap/ui'
import { FC, Fragment, useCallback, useMemo } from 'react'
import { ChainId } from 'sushi/chain'
import {
+ SUSHISWAP_V3_POSTIION_MANAGER,
SushiSwapV3ChainId,
SushiSwapV3FeeAmount,
isWNativeSupported,
} from 'sushi/config'
import { Type } from 'sushi/currency'
-import { Position } from 'sushi/pool'
+import { Position } from 'sushi/pool/sushiswap-v3'
+import { Web3Input } from 'src/lib/wagmi/components/web3-input'
+import { useConcentratedPositionOwner } from 'src/lib/wagmi/hooks/positions/hooks/useConcentratedPositionOwner'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
import { Bound, Field } from '../../lib/constants'
import { AddSectionReviewModalConcentrated } from './AddSectionReviewModalConcentrated'
import {
@@ -263,19 +261,14 @@ export const ConcentratedLiquidityWidget: FC = ({
fullWidth
id="approve-erc20-0"
amount={parsedAmounts[Field.CURRENCY_A]}
- contract={
- getV3NonFungiblePositionManagerContractConfig(chainId).address
- }
+ contract={SUSHISWAP_V3_POSTIION_MANAGER[chainId]}
enabled={!depositADisabled}
>
=
const chainIds = useMemo(() => {
if (chainId) return [chainId] as SushiSwapV3ChainId[]
- return SUSHISWAP_V3_ENABLED_NETWORKS
+ return [...SUSHISWAP_V3_SUPPORTED_CHAIN_IDS]
}, [chainId])
const [paginationState, setPaginationState] = useState({
@@ -74,7 +76,11 @@ export const ConcentratedPositionsTable: FC =
const _positions = useMemo(() => {
const _tokenSymbols = tokenSymbols?.filter((el) => el !== '') || []
return (positions || [])
- ?.filter((el) => filterChainIds.includes(el.chainId))
+ ?.filter((el) =>
+ filterChainIds.includes(
+ el.chainId as (typeof filterChainIds)[number],
+ ),
+ )
.filter((el) =>
_tokenSymbols.length > 0
? _tokenSymbols.some((symbol) => {
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/Manual.tsx b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/Manual.tsx
deleted file mode 100644
index da54f3c07a..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/Manual.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-'use client'
-
-import { Slot } from '@radix-ui/react-slot'
-import { DataTable } from '@sushiswap/ui'
-import { ColumnDef, PaginationState, Row } from '@tanstack/react-table'
-import React, { FC, ReactNode, useCallback, useState } from 'react'
-import { ChainId } from 'sushi/chain'
-
-import { ConcentratedLiquidityPositionWithV3Pool } from '@sushiswap/wagmi'
-import { Address } from 'viem'
-import {
- NAME_COLUMN_V3,
- POSITION_SIZE_CELL,
- POSITION_UNCLAIMED_CELL,
- PRICE_RANGE_COLUMN,
-} from '../../../columns'
-import { useManualPositions } from './useManualPositions'
-
-const COLUMNS = [
- NAME_COLUMN_V3,
- PRICE_RANGE_COLUMN,
- POSITION_SIZE_CELL,
- POSITION_UNCLAIMED_CELL,
-] satisfies ColumnDef[]
-
-const tableState = { sorting: [{ id: 'positionSize', desc: true }] }
-
-interface Manual {
- chainId?: ChainId
- poolAddress?: Address
- onRowClick?(row: ConcentratedLiquidityPositionWithV3Pool): void
-}
-
-export const Manual: FC = ({ chainId, poolAddress, onRowClick }) => {
- const [paginationState, setPaginationState] = useState({
- pageIndex: 0,
- pageSize: 10,
- })
-
- const rowRenderer = useCallback(
- (row: Row, rowNode: ReactNode) => {
- if (onRowClick)
- return (
- onRowClick?.(row.original)}
- >
- {rowNode}
-
- )
- return rowNode
- },
- [onRowClick],
- )
-
- const { data, isInitialLoading } = useManualPositions({
- chainId,
- poolAddress,
- })
-
- return (
-
- `/pool/${row.chainId}:${
- row.address
- }/positions/${row.tokenId.toString()}`
- }
- rowRenderer={rowRenderer}
- columns={COLUMNS}
- data={data}
- pagination={true}
- onPaginationChange={setPaginationState}
- state={{
- ...tableState,
- pagination: paginationState,
- }}
- />
- )
-}
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/index.ts b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/index.ts
deleted file mode 100644
index a7b1889fcf..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './Manual'
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/useManualPositions.ts b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/useManualPositions.ts
deleted file mode 100644
index 4a5c138b1d..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Manual/useManualPositions.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-'use client'
-
-import { useAccount, useConcentratedLiquidityPositions } from '@sushiswap/wagmi'
-import { useMemo } from 'react'
-import { ChainId } from 'sushi/chain'
-import {
- SUSHISWAP_V3_SUPPORTED_CHAIN_IDS,
- isSushiSwapV3ChainId,
-} from 'sushi/config'
-import { Writeable } from 'zod'
-
-import { Address } from 'viem'
-import { usePoolFilters } from '../../../PoolsFiltersProvider'
-
-interface UseManualPositions {
- chainId?: ChainId
- poolAddress?: Address
-}
-
-export const useManualPositions = ({
- poolAddress,
- chainId,
-}: UseManualPositions) => {
- const { address } = useAccount()
- const { chainIds, tokenSymbols } = usePoolFilters()
-
- const chainIdsToQuery = useMemo(() => {
- if (chainId && isSushiSwapV3ChainId(chainId)) {
- return [chainId]
- }
-
- return SUSHISWAP_V3_SUPPORTED_CHAIN_IDS
- }, [chainId])
-
- const { data: manualPositions, isInitialLoading } =
- useConcentratedLiquidityPositions({
- account: address,
- chainIds: chainIdsToQuery as Writeable,
- })
-
- return {
- data: useMemo(() => {
- const _tokenSymbols = tokenSymbols?.filter((el) => el !== '') || []
- return (manualPositions || [])
- ?.filter((el) => chainIds.includes(el.chainId))
- .filter((el) =>
- _tokenSymbols.length > 0
- ? _tokenSymbols.some((symbol) => {
- return [
- el.pool?.token0.symbol,
- el.pool?.token1.symbol,
- ].includes(symbol.toUpperCase())
- })
- : true,
- )
- .filter((el) => {
- return (
- el.liquidity !== 0n &&
- (poolAddress
- ? el.address.toLowerCase() === poolAddress.toLowerCase()
- : true)
- )
- })
- }, [tokenSymbols, manualPositions, chainIds, poolAddress]),
- isInitialLoading,
- }
-}
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/Smart.tsx b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/Smart.tsx
deleted file mode 100644
index 846c326634..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/Smart.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-'use client'
-
-import { Slot } from '@radix-ui/react-slot'
-import { DataTable } from '@sushiswap/ui'
-import { ColumnDef, PaginationState } from '@tanstack/react-table'
-import { Row } from '@tanstack/react-table'
-import React, { FC, ReactNode, useCallback, useState } from 'react'
-import { ChainId } from 'sushi/chain'
-
-import { Card, CardHeader, CardTitle } from '@sushiswap/ui'
-import { Address } from 'viem'
-import {
- STEER_NAME_COLUMN,
- STEER_POSITION_SIZE_COLUMN,
- STEER_STRATEGY_COLUMN,
-} from './columns'
-import { SteerPosition, useSteerPositions } from './useSteerPositions'
-
-const COLUMNS = [
- STEER_NAME_COLUMN,
- STEER_STRATEGY_COLUMN,
- STEER_POSITION_SIZE_COLUMN,
-] satisfies ColumnDef[]
-
-const tableState = { sorting: [{ id: 'positionSize', desc: true }] }
-
-interface Smart {
- chainId?: ChainId
- poolAddress?: Address
- onRowClick?(row: SteerPosition): void
-}
-
-export const Smart: FC = ({ chainId, poolAddress, onRowClick }) => {
- const [paginationState, setPaginationState] = useState({
- pageIndex: 0,
- pageSize: 10,
- })
-
- const rowRenderer = useCallback(
- (row: Row, rowNode: ReactNode) => {
- if (onRowClick)
- return (
- onRowClick?.(row.original)}
- >
- {rowNode}
-
- )
- return rowNode
- },
- [onRowClick],
- )
-
- const { data, isLoading } = useSteerPositions({ chainId, poolAddress })
-
- return (
-
-
-
- My Positions{' '}
-
- ({data?.length})
-
-
-
-
- `/pool/${row.vault.pool.id}/smart/${row.vault.id}`
- }
- rowRenderer={rowRenderer}
- columns={COLUMNS}
- data={data}
- pagination={true}
- onPaginationChange={setPaginationState}
- state={{
- ...tableState,
- pagination: paginationState,
- }}
- />
-
- )
-}
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/columns/index.tsx b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/columns/index.tsx
index 6c7cd07a1a..14a429ab11 100644
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/columns/index.tsx
+++ b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/columns/index.tsx
@@ -13,33 +13,21 @@ import {
import { ColumnDef } from '@tanstack/react-table'
import { formatNumber } from 'sushi/format'
-import { Token, unwrapToken } from 'sushi/currency'
+import { SteerAccountPositionExtended } from 'src/lib/wagmi/hooks/steer/useSteerAccountPositionsExtended'
+import { unwrapToken } from 'sushi/currency'
import { ProtocolBadge } from '../../../../PoolNameCell'
-import { SteerPosition } from '../useSteerPositions'
import { SteerStrategyCell } from './SteerStrategyCell'
-export const STEER_NAME_COLUMN: ColumnDef = {
+export const STEER_NAME_COLUMN: ColumnDef<
+ SteerAccountPositionExtended,
+ unknown
+> = {
id: 'name',
header: 'Name',
cell: ({ row: { original } }) => {
const vault = original.vault
const pool = vault.pool
- const token0 = new Token({
- chainId: original.chainId,
- address: pool.token0.address,
- decimals: pool.token0.decimals,
- symbol: pool.token0.symbol,
- })
- const token1 = new Token({
- chainId: original.chainId,
- address: pool.token1.address,
- decimals: pool.token1.decimals,
- symbol: pool.token1.symbol,
- })
-
- const incentives = pool.incentives.filter((i) => i.rewardPerDay > 0)
-
return (
@@ -51,18 +39,18 @@ export const STEER_NAME_COLUMN: ColumnDef = {
}
>
-
-
+
+
- {unwrapToken(token0).symbol}{' '}
+ {unwrapToken(original.token0).symbol}{' '}
/
{' '}
- {unwrapToken(token1).symbol}{' '}
+ {unwrapToken(original.token1).symbol}{' '}
= {
- 🧑🌾{' '}
- {incentives.length > 1
- ? `x ${incentives.length}`
- : ''}{' '}
+ 🧑🌾{' '}
@@ -148,7 +133,10 @@ export const STEER_NAME_COLUMN: ColumnDef = {
size: 300,
}
-export const STEER_STRATEGY_COLUMN: ColumnDef = {
+export const STEER_STRATEGY_COLUMN: ColumnDef<
+ SteerAccountPositionExtended,
+ unknown
+> = {
id: 'strategy',
header: 'Strategy',
cell: (props) => ,
@@ -162,7 +150,10 @@ export const STEER_STRATEGY_COLUMN: ColumnDef = {
size: 300,
}
-export const STEER_POSITION_SIZE_COLUMN: ColumnDef = {
+export const STEER_POSITION_SIZE_COLUMN: ColumnDef<
+ SteerAccountPositionExtended,
+ unknown
+> = {
id: 'positionSize',
header: 'Position Size',
accessorFn: (row) => row.totalAmountUSD ?? 0,
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/index.ts b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/index.ts
deleted file mode 100644
index 4f41f158dd..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './Smart'
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/useSteerPositions.ts b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/useSteerPositions.ts
deleted file mode 100644
index 1968a860c2..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/Smart/useSteerPositions.ts
+++ /dev/null
@@ -1,101 +0,0 @@
-'use client'
-
-import { usePool, useSteerVaults } from '@sushiswap/client/hooks'
-import { useAllPrices } from '@sushiswap/react-query'
-import { useAccount, useSteerAccountPositions } from '@sushiswap/wagmi'
-import { useMemo } from 'react'
-import { ChainId } from 'sushi/chain'
-import { Amount, Token } from 'sushi/currency'
-import { Address } from 'viem'
-
-interface UseSteerPositions {
- chainId?: ChainId
- poolAddress?: Address
-}
-
-export const useSteerPositions = ({
- poolAddress,
- chainId,
-}: UseSteerPositions) => {
- const { address: account } = useAccount()
-
- const { data: vaultsPerChain, isLoading: isPerChainLoading } = useSteerVaults(
- {
- args: { chainIds: chainId ? [chainId] : undefined },
- shouldFetch: account && (!poolAddress || !chainId),
- },
- )
- const { data: vaultsPerPool, isLoading: isPerPoolLoading } = usePool({
- args: chainId && poolAddress ? { chainId, address: poolAddress } : '',
- shouldFetch: !!account && !!poolAddress && !!chainId,
- })
-
- const { data: prices, isLoading: isPricesLoading } = useAllPrices()
-
- const isVaultsLoading = isPerChainLoading || isPerPoolLoading
- const vaults = useMemo(() => {
- if (vaultsPerChain) {
- return vaultsPerChain
- }
-
- if (vaultsPerPool) {
- return vaultsPerPool.steerVaults.map((steerVault) => ({
- ...steerVault,
- pool: vaultsPerPool,
- }))
- }
- }, [vaultsPerChain, vaultsPerPool])
-
- const vaultIds = useMemo(() => vaults?.map((el) => el.id), [vaults])
- const { data: positions, isLoading: isPositionsLoading } =
- useSteerAccountPositions({
- vaultIds,
- account,
- })
-
- return {
- data: useMemo(() => {
- if (!vaults || !positions || !account) return []
-
- return positions.flatMap((el, i) => {
- if (!el || el.steerTokenBalance === 0n) return []
-
- const vault = vaults[i]
-
- const token0 = new Token({ chainId: vault.chainId, ...vault.token0 })
- const token1 = new Token({ chainId: vault.chainId, ...vault.token1 })
-
- const token0Price =
- prices?.[String(vault.chainId)]?.[token0.address] || 0
- const token1Price =
- prices?.[String(vault.chainId)]?.[token1.address] || 0
-
- const token0Amount = Amount.fromRawAmount(token0, el?.token0Balance)
- const token1Amount = Amount.fromRawAmount(token1, el?.token1Balance)
-
- const token0AmountUSD = Number(
- token0Amount?.multiply(token0Price).toSignificant(8),
- )
- const token1AmountUSD = Number(
- token1Amount?.multiply(token1Price).toSignificant(8),
- )
-
- return {
- ...el,
- vault,
- token0Amount,
- token1Amount,
- token0AmountUSD,
- token1AmountUSD,
- totalAmountUSD: token0AmountUSD + token1AmountUSD,
- }
- })
- }, [account, positions, prices, vaults]),
- isLoading:
- !!account && (isVaultsLoading || isPricesLoading || isPositionsLoading),
- }
-}
-
-export type SteerPosition = NonNullable<
- ReturnType['data']
->[number]
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/index.ts b/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/index.ts
deleted file mode 100644
index 754f36527f..0000000000
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/Tables/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './Manual'
-export * from './Smart'
diff --git a/apps/evm/src/ui/pool/ConcentratedPositionsTable/index.ts b/apps/evm/src/ui/pool/ConcentratedPositionsTable/index.ts
index 3c61e534a2..64a7ee3edb 100644
--- a/apps/evm/src/ui/pool/ConcentratedPositionsTable/index.ts
+++ b/apps/evm/src/ui/pool/ConcentratedPositionsTable/index.ts
@@ -1,2 +1 @@
export * from './ConcentratedPositionsTable'
-export * from './Tables'
diff --git a/apps/evm/src/ui/pool/CreatePositionManual.tsx b/apps/evm/src/ui/pool/CreatePositionManual.tsx
index f95d4eb364..1554cbcb48 100644
--- a/apps/evm/src/ui/pool/CreatePositionManual.tsx
+++ b/apps/evm/src/ui/pool/CreatePositionManual.tsx
@@ -9,11 +9,11 @@ import {
CardTitle,
Separator,
} from '@sushiswap/ui'
-import { useAccount } from '@sushiswap/wagmi'
import React, { FC, useMemo, useState } from 'react'
import { ConcentratedLiquidityWidget } from 'src/ui/pool/ConcentratedLiquidityWidget'
import { SushiSwapV3ChainId } from 'sushi/config'
import { unwrapToken } from 'sushi/currency'
+import { useAccount } from 'wagmi'
import { SelectPricesWidget } from './SelectPricesWidget'
interface ManualProps {
diff --git a/apps/evm/src/ui/pool/CreateSectionReviewModalTrident.tsx b/apps/evm/src/ui/pool/CreateSectionReviewModalTrident.tsx
deleted file mode 100644
index 8f815caa06..0000000000
--- a/apps/evm/src/ui/pool/CreateSectionReviewModalTrident.tsx
+++ /dev/null
@@ -1,403 +0,0 @@
-import {
- Button,
- DialogConfirm,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogProvider,
- DialogReview,
- DialogTitle,
- DialogTrigger,
- Dots,
-} from '@sushiswap/ui'
-import { createErrorToast, createToast } from '@sushiswap/ui/components/toast'
-import {
- PoolFinderType,
- UseCallParameters,
- useAccount,
- useBentoBoxTotals,
- useCall,
- usePublicClient,
- useSendTransaction,
- useTridentConstantPoolFactoryContract,
- useTridentRouterContract,
- useTridentStablePoolFactoryContract,
- useWaitForTransactionReceipt,
-} from '@sushiswap/wagmi'
-import {
- useApproved,
- useApprovedActions,
- useSignature,
-} from '@sushiswap/wagmi/systems/Checker/Provider'
-import { FC, ReactNode, useCallback, useMemo } from 'react'
-
-import {
- LiquidityInput,
- approveMasterContractAction,
- batchAction,
- deployNewPoolAction,
-} from 'src/lib/pool/trident'
-
-import { APPROVE_TAG_CREATE_TRIDENT } from 'src/lib/constants'
-import {
- TridentConstantPool,
- TridentStablePool,
- computeTridentConstantPoolAddress,
- computeTridentStablePoolAddress,
-} from 'sushi'
-import { ChainId } from 'sushi/chain'
-import { BentoBoxChainId, TridentChainId } from 'sushi/config'
-import { Amount, Type } from 'sushi/currency'
-import { Fee } from 'sushi/dex'
-import {
- Address,
- SendTransactionReturnType,
- UserRejectedRequestError,
- encodeAbiParameters,
- encodeFunctionData,
- parseAbiParameters,
- zeroAddress,
-} from 'viem'
-
-import { AddSectionReviewModal } from './AddSectionReviewModal'
-
-interface CreateSectionReviewModalTridentProps {
- chainId: TridentChainId
- token0: Type | undefined
- token1: Type | undefined
- input0: Amount | undefined
- input1: Amount | undefined
- fee: Fee
- poolType: PoolFinderType
- children: ReactNode
-}
-
-export const CreateSectionReviewModalTrident: FC<
- CreateSectionReviewModalTridentProps
-> = ({ token0, token1, input0, input1, fee, poolType, chainId, children }) => {
- const client = usePublicClient()
- const { address, chain } = useAccount()
- const { signature } = useSignature(APPROVE_TAG_CREATE_TRIDENT)
- const { setSignature } = useApprovedActions(APPROVE_TAG_CREATE_TRIDENT)
- const { approved } = useApproved(APPROVE_TAG_CREATE_TRIDENT)
- const contract = useTridentRouterContract(chainId)
- const constantProductPoolFactory =
- useTridentConstantPoolFactoryContract(chainId)
- const stablePoolFactory = useTridentStablePoolFactoryContract(chainId)
-
- const { data: totals } = useBentoBoxTotals({
- chainId,
- currencies: useMemo(() => [token0, token1], [token0, token1]),
- })
-
- const pool = useMemo(() => {
- if (!token0 || !token1 || !fee) return
- if (poolType === PoolFinderType.Classic) {
- return new TridentConstantPool(
- Amount.fromRawAmount(token0.wrapped, 0),
- Amount.fromRawAmount(token1.wrapped, 0),
- fee,
- false,
- )
- } else if (
- poolType === PoolFinderType.Stable &&
- totals &&
- token0.wrapped.address in totals &&
- token1.wrapped.address in totals
- ) {
- return new TridentStablePool(
- Amount.fromRawAmount(token0.wrapped, 0),
- Amount.fromRawAmount(token1.wrapped, 0),
- fee,
- totals[token0.wrapped.address],
- totals[token1.wrapped.address],
- )
- }
- }, [fee, token0, token1, poolType, totals])
-
- const totalSupply = useMemo(
- () => (pool ? Amount.fromRawAmount(pool?.liquidityToken, 0) : undefined),
- [pool],
- )
-
- const factory = useMemo(() => {
- switch (poolType) {
- case PoolFinderType.Classic:
- return constantProductPoolFactory
- case PoolFinderType.Stable:
- return stablePoolFactory
- }
- }, [constantProductPoolFactory, poolType, stablePoolFactory])
-
- const poolAddress = useMemo(() => {
- // !poolType === 0, don't guared against it
- if (!factory || !token0 || !token1 || !fee) return
- switch (poolType) {
- case PoolFinderType.Classic:
- return computeTridentConstantPoolAddress({
- factoryAddress: factory.address,
- tokenA: token0.wrapped,
- tokenB: token1.wrapped,
- fee: fee,
- twap: false,
- }) as Address
- case PoolFinderType.Stable:
- return computeTridentStablePoolAddress({
- factoryAddress: factory.address,
- tokenA: token0.wrapped,
- tokenB: token1.wrapped,
- fee: fee,
- }) as Address
- }
- }, [factory, fee, token0, token1, poolType])
-
- const isValid = useMemo(() => {
- return Boolean(
- chain?.id &&
- factory &&
- token0 &&
- token1 &&
- poolAddress &&
- input0 &&
- input1 &&
- totalSupply &&
- pool &&
- contract &&
- totals?.[token0.wrapped.address] &&
- totals?.[token1.wrapped.address],
- )
- }, [
- chain?.id,
- contract,
- factory,
- input0,
- input1,
- pool,
- poolAddress,
- token0,
- token1,
- totalSupply,
- totals,
- ])
-
- const onSuccess = useCallback(
- (hash: SendTransactionReturnType) => {
- setSignature(undefined)
-
- if (!chain?.id || !token0 || !token1) return
-
- const ts = new Date().getTime()
- createToast({
- account: address,
- type: 'mint',
- chainId: chain.id,
- txHash: hash,
- promise: client.waitForTransactionReceipt({ hash }),
- summary: {
- pending: `Adding liquidity to the ${token0.symbol}/${token1.symbol} pair`,
- completed: `Successfully added liquidity to the ${token0.symbol}/${token1.symbol} pair`,
- failed: 'Something went wrong when adding liquidity',
- },
- timestamp: ts,
- groupTimestamp: ts,
- })
- },
- [client, chain, token0, token1, address, setSignature],
- )
-
- const onError = useCallback((e: Error) => {
- if (e instanceof UserRejectedRequestError) {
- createErrorToast(e?.message, true)
- }
- }, [])
-
- const prepare = useMemo(() => {
- try {
- if (
- !chain?.id ||
- !factory ||
- !token0 ||
- !token1 ||
- !poolAddress ||
- !input0 ||
- !input1 ||
- !totalSupply ||
- !pool ||
- !contract ||
- !totals?.[token0.wrapped.address] ||
- !totals?.[token1.wrapped.address] ||
- !address
- ) {
- return undefined
- }
-
- let value
- const liquidityInput: LiquidityInput[] = []
- const encoded = encodeAbiParameters(parseAbiParameters('address'), [
- address,
- ])
-
- if (input0) {
- if (input0.currency.isNative) {
- value = input0.quotient
- }
-
- liquidityInput.push({
- token: input0.currency.isNative
- ? zeroAddress
- : (input0.currency.wrapped.address as Address),
- native: true,
- amount: BigInt(input0.quotient.toString()),
- })
- }
-
- if (input1) {
- if (input1.currency.isNative) {
- value = input1.quotient
- }
-
- liquidityInput.push({
- token: input1.currency.isNative
- ? zeroAddress
- : (input1.currency.wrapped.address as Address),
- native: true,
- amount: BigInt(input1.quotient.toString()),
- })
- }
-
- return {
- account: address,
- to: contract.address,
- value: value ?? 0n,
- data: batchAction({
- actions: [
- approveMasterContractAction({
- signature: signature,
- }),
- deployNewPoolAction({
- assets: [input0.currency, input1.currency],
- factory: factory.address,
- feeTier: fee,
- twap: false,
- }),
- encodeFunctionData({
- ...contract,
- functionName: 'addLiquidity',
- args: [
- liquidityInput,
- poolAddress,
- BigInt(
- pool
- .getLiquidityMinted(
- totalSupply,
- input0.wrapped.toShare(totals?.[token0.wrapped.address]),
- input1.wrapped.toShare(totals?.[token1.wrapped.address]),
- )
- .quotient.toString(),
- ),
- encoded,
- ],
- }),
- ],
- }),
- } satisfies UseCallParameters
- } catch (e: unknown) {
- console.error(e)
- }
- }, [
- address,
- chain?.id,
- contract,
- factory,
- fee,
- input0,
- input1,
- pool,
- poolAddress,
- signature,
- token0,
- token1,
- totalSupply,
- totals,
- ])
-
- const { isError: isSimulationError } = useCall({
- ...prepare,
- query: {
- enabled: Boolean(approved && totals),
- },
- })
-
- const {
- sendTransactionAsync,
- isLoading: isWritePending,
- data: hash,
- } = useSendTransaction({
- mutation: {
- onSuccess,
- onError,
- },
- })
-
- const send = useMemo(() => {
- if (!prepare || isSimulationError) return
-
- return async (confirm: () => void) => {
- try {
- await sendTransactionAsync(prepare)
-
- confirm()
- } catch {}
- }
- }, [isSimulationError, prepare, sendTransactionAsync])
-
- const { status } = useWaitForTransactionReceipt({ chainId, hash })
-
- return (
-
-
- {({ confirm }) => (
- <>
- {children}
-
-
- Create pool
-
- Please review your entered details.
-
-
-
-
-
-
-
- >
- )}
-
-
-
- )
-}
diff --git a/apps/evm/src/ui/pool/FarmRewardsAvailableTooltip.tsx b/apps/evm/src/ui/pool/FarmRewardsAvailableTooltip.tsx
index 024cb41617..8d23a65510 100644
--- a/apps/evm/src/ui/pool/FarmRewardsAvailableTooltip.tsx
+++ b/apps/evm/src/ui/pool/FarmRewardsAvailableTooltip.tsx
@@ -3,7 +3,7 @@ import {
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from '@sushiswap/ui/components/tooltip'
+} from '@sushiswap/ui'
import { FC } from 'react'
export const FarmRewardsAvailableTooltip: FC = () => {
diff --git a/apps/evm/src/ui/pool/LiquidityChartRangeInput/Zoom.tsx b/apps/evm/src/ui/pool/LiquidityChartRangeInput/Zoom.tsx
index 72cf60e143..c51d9a3d68 100644
--- a/apps/evm/src/ui/pool/LiquidityChartRangeInput/Zoom.tsx
+++ b/apps/evm/src/ui/pool/LiquidityChartRangeInput/Zoom.tsx
@@ -2,7 +2,7 @@ import {
MagnifyingGlassMinusIcon,
MagnifyingGlassPlusIcon,
} from '@heroicons/react/20/solid'
-import { Button } from '@sushiswap/ui/components/button'
+import { Button } from '@sushiswap/ui'
import {
ScaleLinear,
ZoomBehavior,
diff --git a/apps/evm/src/ui/pool/LiquidityChartRangeInput/index.tsx b/apps/evm/src/ui/pool/LiquidityChartRangeInput/index.tsx
index 100fe65bab..e6ee64a76f 100644
--- a/apps/evm/src/ui/pool/LiquidityChartRangeInput/index.tsx
+++ b/apps/evm/src/ui/pool/LiquidityChartRangeInput/index.tsx
@@ -1,11 +1,11 @@
import { ChartBarIcon, InboxIcon, StopIcon } from '@heroicons/react-v1/solid'
-import { SkeletonBox } from '@sushiswap/ui/components/skeleton'
+import { SkeletonBox } from '@sushiswap/ui'
import { format } from 'd3'
import React, { FC, ReactNode, useCallback, useMemo } from 'react'
import { Bound } from 'src/lib/constants'
import { SushiSwapV3ChainId, SushiSwapV3FeeAmount } from 'sushi/config'
import { Price, Token, Type } from 'sushi/currency'
-import { getPriceRangeWithTokenRatio } from 'sushi/pool'
+import { getPriceRangeWithTokenRatio } from 'sushi/pool/sushiswap-v3'
import colors from 'tailwindcss/colors'
import { Chart } from './Chart'
diff --git a/apps/evm/src/ui/pool/LiquidityDepthWidget.tsx b/apps/evm/src/ui/pool/LiquidityDepthWidget.tsx
index b408160619..aa821936ba 100644
--- a/apps/evm/src/ui/pool/LiquidityDepthWidget.tsx
+++ b/apps/evm/src/ui/pool/LiquidityDepthWidget.tsx
@@ -1,7 +1,7 @@
'use client'
import { useConcentratedLiquidityPoolStats } from '@sushiswap/react-query'
-import { SkeletonBox } from '@sushiswap/ui/components/skeleton'
+import { SkeletonBox } from '@sushiswap/ui'
import React, { FC, useMemo } from 'react'
import { Bound } from 'src/lib/constants'
import { SushiSwapV3ChainId } from 'sushi/config'
diff --git a/apps/evm/src/ui/pool/ManageTridentLiquidityCard.tsx b/apps/evm/src/ui/pool/ManageTridentLiquidityCard.tsx
deleted file mode 100644
index 3a8b47ea1c..0000000000
--- a/apps/evm/src/ui/pool/ManageTridentLiquidityCard.tsx
+++ /dev/null
@@ -1,150 +0,0 @@
-'use client'
-
-import { Pool } from '@sushiswap/client'
-import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
- Message,
- Separator,
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from '@sushiswap/ui'
-import Link from 'next/link'
-import { FC } from 'react'
-
-import { AddSectionStake } from './AddSectionStake'
-import { PoolPositionProvider } from './PoolPositionProvider'
-import { PoolPositionRewardsProvider } from './PoolPositionRewardsProvider'
-import { PoolPositionStakedProvider } from './PoolPositionStakedProvider'
-import { RemoveSectionTrident } from './RemoveSectionTrident'
-import { RemoveSectionUnstake } from './RemoveSectionUnstake'
-
-interface ManageTridentLiquidityCard {
- pool: Pool
- tab?: 'stake' | 'unstake' | 'add' | 'remove'
-}
-
-export const ManageTridentLiquidityCard: FC = ({
- pool,
- tab = 'remove',
-}) => {
- const isFarm = pool.wasIncentivized || pool.isIncentivized
-
- return (
-
-
- Manage
- Manage your position
-
- {}}
- className="w-full"
- defaultValue={tab}
- >
-
-
-
-
- Remove
-
-
- {isFarm ? (
-
-
- Stake
-
-
- ) : (
-
- Stake
-
- )}
- {isFarm ? (
-
-
- Unstake
-
-
- ) : (
-
- Unstake
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {isFarm ? (
-
- ) : (
-
- No farms available for this pool
-
- )}
-
-
-
-
- {isFarm ? (
-
- ) : (
-
- No farms available for this pool
-
- )}
-
-
-
-
-
-
-
- )
-}
diff --git a/apps/evm/src/ui/pool/MigrateTab.tsx b/apps/evm/src/ui/pool/MigrateTab.tsx
index 061b9e029a..188ebe5b55 100644
--- a/apps/evm/src/ui/pool/MigrateTab.tsx
+++ b/apps/evm/src/ui/pool/MigrateTab.tsx
@@ -33,25 +33,7 @@ import {
SettingsModule,
SettingsOverlay,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import {
- V3MigrateChainId,
- V3MigrateContractConfig,
- getDefaultTTL,
- getMasterChefContractConfig,
- useAccount,
- useMasterChefWithdraw,
- useSushiSwapV2Pool,
- useTotalSupply,
- useTransactionDeadline,
- useV3Migrate,
- useWaitForTransactionReceipt,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import {
- useApproved,
- withCheckerRoot,
-} from '@sushiswap/wagmi/systems/Checker/Provider'
+import { Button } from '@sushiswap/ui'
import React, { FC, useMemo, useState } from 'react'
import {
APPROVE_TAG_MIGRATE,
@@ -61,6 +43,24 @@ import {
} from 'src/lib/constants'
import { useGraphPool, useTokenAmountDollarValues } from 'src/lib/hooks'
import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
+import { getMasterChefContractConfig } from 'src/lib/wagmi/hooks/master-chef/use-master-chef-contract'
+import { useMasterChefWithdraw } from 'src/lib/wagmi/hooks/master-chef/use-master-chef-withdraw'
+import {
+ V3MigrateContractConfig,
+ useV3Migrate,
+} from 'src/lib/wagmi/hooks/migrate/hooks/useV3Migrate'
+import { V3MigrateChainId } from 'src/lib/wagmi/hooks/migrate/types'
+import { useSushiSwapV2Pool } from 'src/lib/wagmi/hooks/pools/hooks/useSushiSwapV2Pools'
+import { useTotalSupply } from 'src/lib/wagmi/hooks/tokens/useTotalSupply'
+import {
+ getDefaultTTL,
+ useTransactionDeadline,
+} from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
+import {
+ useApproved,
+ withCheckerRoot,
+} from 'src/lib/wagmi/systems/Checker/Provider'
import { Chain, ChainId } from 'sushi/chain'
import {
SushiSwapV2ChainId,
@@ -75,8 +75,9 @@ import {
SushiSwapV3Pool,
TickMath,
priceToClosestTick,
-} from 'sushi/pool'
+} from 'sushi/pool/sushiswap-v3'
import { Address } from 'viem'
+import { useAccount, useWaitForTransactionReceipt } from 'wagmi'
import { useConcentratedDerivedMintInfo } from './ConcentratedLiquidityProvider'
import { usePoolPosition } from './PoolPositionProvider'
import { usePoolPositionStaked } from './PoolPositionStakedProvider'
@@ -529,12 +530,12 @@ export const MigrateTab: FC<{ pool: Pool }> = withCheckerRoot(({ pool }) => {
size="sm"
onClick={() => setInvertPrice((prev) => !prev)}
>
- 1 {invertPrice ? _token1.symbol : _token0.symbol} ={' '}
+ 1 {invertPrice ? _token1!.symbol : _token0!.symbol} ={' '}
{invertPrice
? `${v2SpotPrice?.invert()?.toSignificant(6)} ${
- _token0.symbol
+ _token0!.symbol
}`
- : `${v2SpotPrice?.toSignificant(6)} ${_token1.symbol}`}
+ : `${v2SpotPrice?.toSignificant(6)} ${_token1!.symbol}`}
) : (
@@ -552,12 +553,12 @@ export const MigrateTab: FC<{ pool: Pool }> = withCheckerRoot(({ pool }) => {
size="sm"
onClick={() => setInvertPrice((prev) => !prev)}
>
- 1 {invertPrice ? _token1.symbol : _token0.symbol} ={' '}
+ 1 {invertPrice ? _token1!.symbol : _token0!.symbol} ={' '}
{invertPrice
? `${v3SpotPrice?.invert()?.toSignificant(6)} ${
- _token0.symbol
+ _token0!.symbol
}`
- : `${v3SpotPrice?.toSignificant(6)} ${_token1.symbol}`}
+ : `${v3SpotPrice?.toSignificant(6)} ${_token1!.symbol}`}
) : (
diff --git a/apps/evm/src/ui/pool/MigrateTabContent.tsx b/apps/evm/src/ui/pool/MigrateTabContent.tsx
index 4c8fa2246f..e072f41764 100644
--- a/apps/evm/src/ui/pool/MigrateTabContent.tsx
+++ b/apps/evm/src/ui/pool/MigrateTabContent.tsx
@@ -7,12 +7,12 @@ import {
Carousel,
Container,
} from '@sushiswap/ui'
-import { ConnectButton, useAccount } from '@sushiswap/wagmi'
import React from 'react'
-import { ChainId } from 'sushi/chain'
import { isSushiSwapV3ChainId } from 'sushi/config'
import { useIsMounted } from '@sushiswap/hooks'
+import { ConnectButton } from 'src/lib/wagmi/components/connect-button'
+import { useAccount } from 'wagmi'
import { PositionCard, PositionCardSkeleton } from './PositionCard'
import { PositionCardList } from './PositionCardList'
@@ -44,7 +44,7 @@ function MigrateTabContentPositions() {
- isSushiSwapV3ChainId(position?.chainId as ChainId),
+ isSushiSwapV3ChainId(position?.pool.chainId),
)}
render={(position) => }
className="px-2"
diff --git a/apps/evm/src/ui/pool/PoolButtons.tsx b/apps/evm/src/ui/pool/PoolButtons.tsx
index fb915718dd..38e3cc3bb0 100644
--- a/apps/evm/src/ui/pool/PoolButtons.tsx
+++ b/apps/evm/src/ui/pool/PoolButtons.tsx
@@ -1,6 +1,6 @@
import { Pool } from '@sushiswap/client'
import { LinkInternal } from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
+import { Button } from '@sushiswap/ui'
import Link from 'next/link'
import { FC } from 'react'
import { ZERO } from 'sushi/math'
diff --git a/apps/evm/src/ui/pool/PoolChartGraph.tsx b/apps/evm/src/ui/pool/PoolChartGraph.tsx
index 21bb953cec..ccb5738576 100644
--- a/apps/evm/src/ui/pool/PoolChartGraph.tsx
+++ b/apps/evm/src/ui/pool/PoolChartGraph.tsx
@@ -6,30 +6,34 @@ import {
SkeletonText,
classNames,
} from '@sushiswap/ui'
-import { CardDescription, CardTitle } from '@sushiswap/ui/components/card'
-import { SkeletonBox } from '@sushiswap/ui/components/skeleton'
+import { CardDescription, CardTitle } from '@sushiswap/ui'
+import { SkeletonBox } from '@sushiswap/ui'
import { format } from 'date-fns'
-import ReactECharts from 'echarts-for-react'
-import { EChartsOption } from 'echarts-for-react/lib/types'
import { FC, useCallback, useMemo } from 'react'
import { usePoolGraphData } from 'src/lib/hooks'
-import { ChainId } from 'sushi/chain'
-import { formatPercent, formatUSD } from 'sushi/format'
+
+import { formatUSD } from 'sushi/format'
import tailwindConfig from 'tailwind.config.js'
import resolveConfig from 'tailwindcss/resolveConfig'
+import { SushiSwapV2ChainId } from 'sushi/config'
import { PoolChartPeriod, chartPeriods } from './PoolChartPeriods'
import { PoolChartType } from './PoolChartTypes'
+import ReactEchartsCore from 'echarts-for-react/lib/core'
+import { EChartsOption } from 'echarts-for-react/lib/types'
+import 'echarts/lib/chart/bar'
+import 'echarts/lib/chart/line'
+import 'echarts/lib/component/tooltip'
+import 'echarts/lib/component/visualMap'
+import echarts from 'echarts/lib/echarts'
+import 'echarts/lib/visual/seriesColor'
+
interface PoolChartProps {
- chart:
- | PoolChartType.Volume
- | PoolChartType.Fees
- | PoolChartType.TVL
- | PoolChartType.APR
+ chart: PoolChartType.Volume | PoolChartType.Fees | PoolChartType.TVL
period: PoolChartPeriod
address: string
- chainId: ChainId
+ chainId: SushiSwapV2ChainId
}
const tailwind = resolveConfig(tailwindConfig)
@@ -40,12 +44,16 @@ export const PoolChartGraph: FC = ({
address,
chainId,
}) => {
- const { data: graphPair, isLoading } = usePoolGraphData({
+ const {
+ data: graphPair,
+ isInitialLoading: isLoading,
+ isError,
+ } = usePoolGraphData({
poolAddress: address,
chainId,
})
- const swapFee = graphPair ? graphPair?.swapFee / 10000 : 0
+ const swapFee = graphPair ? graphPair?.swapFee : 0
const [xData, yData]: [number[], number[]] = useMemo(() => {
const data =
@@ -56,16 +64,14 @@ export const PoolChartGraph: FC = ({
const currentDate = Math.round(Date.now())
const [x, y] = data.reduce<[number[], number[]]>(
(acc, cur) => {
- if (cur.date * 1000 >= currentDate - chartPeriods[period]) {
- acc[0].push(cur.date)
+ if (cur?.date * 1000 >= currentDate - chartPeriods[period]) {
+ acc[0].push(cur?.date)
if (chart === PoolChartType.Fees) {
- acc[1].push(Number(cur.volumeUSD * Number(swapFee)))
+ acc[1].push(Number(cur?.volumeUSD * Number(swapFee)))
} else if (chart === PoolChartType.Volume) {
- acc[1].push(Number(cur.volumeUSD))
+ acc[1].push(Number(cur?.volumeUSD))
} else if (chart === PoolChartType.TVL) {
- acc[1].push(Number(cur.liquidityUSD))
- } else if (chart === PoolChartType.APR) {
- acc[1].push(Number(cur.apr))
+ acc[1].push(Number(cur?.liquidityUSD))
}
}
return acc
@@ -89,11 +95,7 @@ export const PoolChartGraph: FC = ({
const nameNodes = document.getElementsByClassName('hoveredItemName')
if (valueNodes[0]) {
- if (chart === PoolChartType.APR) {
- valueNodes[0].innerHTML = formatPercent(value)
- } else {
- valueNodes[0].innerHTML = formatUSD(value)
- }
+ valueNodes[0].innerHTML = formatUSD(value)
}
if (valueNodes[1]) {
@@ -129,16 +131,19 @@ export const PoolChartGraph: FC = ({
fontSize: 12,
fontWeight: 600,
},
+ axisPointer: {
+ lineStyle: {
+ type: 'dashed',
+ },
+ },
formatter: (params: any) => {
onMouseOver({ name: params[0].name, value: params[0].value })
const date = new Date(Number(params[0].name * 1000))
return `
-
${
- chart === PoolChartType.APR
- ? formatPercent(params[0].value)
- : formatUSD(params[0].value)
- }
+
${formatUSD(
+ params[0].value,
+ )}
${
date instanceof Date && !Number.isNaN(date?.getTime())
? format(
@@ -191,13 +196,11 @@ export const PoolChartGraph: FC = ({
series: [
{
name: 'Volume',
- type:
- chart === PoolChartType.TVL || chart === PoolChartType.APR
- ? 'line'
- : 'bar',
+ type: chart === PoolChartType.TVL ? 'line' : 'bar',
smooth: true,
xAxisIndex: 0,
yAxisIndex: 0,
+ barWidth: '70%',
itemStyle: {
color: 'blue',
normal: {
@@ -217,35 +220,35 @@ export const PoolChartGraph: FC = ({
[xData, chart, yData, onMouseOver, period],
)
+ const defaultValue = yData[yData.length - 1] || 0
+
return (
<>
-
- {chart === PoolChartType.APR
- ? formatPercent(yData[yData.length - 1])
- : formatUSD(yData[yData.length - 1])}
- {' '}
+ {formatUSD(defaultValue)}{' '}
{chart === PoolChartType.Volume && (
•{' '}
- {formatUSD(Number(yData[yData.length - 1]) * Number(swapFee))}
+ {formatUSD(defaultValue * Number(swapFee))}
{' '}
earned
)}
- {xData.length ? (
+ {isLoading ? (
+
+ ) : isError || !xData.length ? (
+
+ ) : (
{format(
new Date(xData[xData.length - 1] * 1000),
'dd MMM yyyy HH:mm',
)}
- ) : (
-
)}
@@ -256,8 +259,14 @@ export const PoolChartGraph: FC = ({
'h-[400px] w-full dark:via-slate-800 dark:to-slate-900',
)}
/>
+ ) : isError ? (
+
) : (
-
+
)}
>
diff --git a/apps/evm/src/ui/pool/PoolChartPeriods.tsx b/apps/evm/src/ui/pool/PoolChartPeriods.tsx
index 29bda4f1c5..e7b5e9c19c 100644
--- a/apps/evm/src/ui/pool/PoolChartPeriods.tsx
+++ b/apps/evm/src/ui/pool/PoolChartPeriods.tsx
@@ -1,4 +1,4 @@
-import { Toggle } from '@sushiswap/ui/components/toggle'
+import { Toggle } from '@sushiswap/ui'
import React, { FC } from 'react'
export enum PoolChartPeriod {
diff --git a/apps/evm/src/ui/pool/PoolChartTypes.tsx b/apps/evm/src/ui/pool/PoolChartTypes.tsx
index 93d484a62f..ef227c0e22 100644
--- a/apps/evm/src/ui/pool/PoolChartTypes.tsx
+++ b/apps/evm/src/ui/pool/PoolChartTypes.tsx
@@ -1,11 +1,10 @@
-import { Toggle } from '@sushiswap/ui/components/toggle'
+import { Toggle } from '@sushiswap/ui'
import React from 'react'
export enum PoolChartType {
Volume = 'Volume',
TVL = 'TVL',
Fees = 'Fees',
- APR = 'APR',
Depth = 'Depth',
}
diff --git a/apps/evm/src/ui/pool/PoolChartV2.tsx b/apps/evm/src/ui/pool/PoolChartV2.tsx
index 780a985b31..8f97bdc68e 100644
--- a/apps/evm/src/ui/pool/PoolChartV2.tsx
+++ b/apps/evm/src/ui/pool/PoolChartV2.tsx
@@ -2,8 +2,8 @@
import { Card } from '@sushiswap/ui'
import React, { FC, useState } from 'react'
-import { ChainId } from 'sushi/chain'
+import { SushiSwapV2ChainId } from 'sushi/config'
import { PoolChartGraph } from './PoolChartGraph'
import { PoolChartPeriod, PoolChartPeriods } from './PoolChartPeriods'
import { PoolChartType, PoolChartTypes } from './PoolChartTypes'
@@ -12,7 +12,6 @@ const charts = [
PoolChartType.Volume,
PoolChartType.TVL,
PoolChartType.Fees,
- PoolChartType.APR,
] as const
const periods = [
PoolChartPeriod.Day,
@@ -24,7 +23,7 @@ const periods = [
interface PoolChartV2Props {
address: string
- chainId: ChainId
+ chainId: SushiSwapV2ChainId
}
const PoolChartV2: FC = ({ address, chainId }) => {
diff --git a/apps/evm/src/ui/pool/PoolComposition.tsx b/apps/evm/src/ui/pool/PoolComposition.tsx
index 092e0a00ee..26e340cb73 100644
--- a/apps/evm/src/ui/pool/PoolComposition.tsx
+++ b/apps/evm/src/ui/pool/PoolComposition.tsx
@@ -11,10 +11,10 @@ import {
CardHeader,
CardLabel,
CardTitle,
-} from '@sushiswap/ui/components/card'
+} from '@sushiswap/ui'
import React, { FC, useMemo } from 'react'
import { usePoolGraphData, useTokenAmountDollarValues } from 'src/lib/hooks'
-import { ChainId } from 'sushi/chain'
+import { SushiSwapV2ChainId } from 'sushi/config'
import { formatUSD } from 'sushi/format'
interface PoolCompositionProps {
@@ -24,7 +24,7 @@ interface PoolCompositionProps {
export const PoolComposition: FC = ({ pool }) => {
const { data, isLoading: isPoolLoading } = usePoolGraphData({
poolAddress: pool.address,
- chainId: pool.chainId as ChainId,
+ chainId: pool.chainId as SushiSwapV2ChainId,
})
const amounts = [data?.reserve0, data?.reserve1]
diff --git a/apps/evm/src/ui/pool/PoolDepthChart.tsx b/apps/evm/src/ui/pool/PoolDepthChart.tsx
index 1113868e60..0e1d599291 100644
--- a/apps/evm/src/ui/pool/PoolDepthChart.tsx
+++ b/apps/evm/src/ui/pool/PoolDepthChart.tsx
@@ -6,7 +6,6 @@ import {
CardTitle,
Toggle,
} from '@sushiswap/ui'
-import ReactECharts, { EChartsOption } from 'echarts-for-react'
import { useTheme } from 'next-themes'
import React, { FC, useCallback, useMemo, useState } from 'react'
import { formatUSD } from 'sushi/format'
@@ -14,6 +13,16 @@ import colors from 'tailwindcss/colors'
import { ChartEntry } from './LiquidityChartRangeInput/types'
+import ReactEChartsCore from 'echarts-for-react/lib/core'
+import { EChartsOption } from 'echarts-for-react/lib/types'
+import 'echarts/lib/chart/bar'
+import 'echarts/lib/chart/line'
+import 'echarts/lib/component/markLine'
+import 'echarts/lib/component/tooltip'
+import 'echarts/lib/component/visualMap'
+import echarts from 'echarts/lib/echarts'
+import 'echarts/lib/visual/seriesColor'
+
interface PoolDepthChartProps {
poolStats: NonNullable<
ReturnType['data']
@@ -23,10 +32,11 @@ interface PoolDepthChartProps {
}
const getTvlUSD = (
- liquidity: number | string,
- totalSupply: number | string,
+ liquidity: number | bigint | string,
+ totalLiquidity: number | bigint | string,
liquidityUSD: number | string,
-) => formatUSD((Number(liquidity) / Number(totalSupply)) * Number(liquidityUSD))
+) =>
+ formatUSD((Number(liquidity) / Number(totalLiquidity)) * Number(liquidityUSD))
export const PoolDepthChart: FC = ({
poolStats,
@@ -71,7 +81,7 @@ export const PoolDepthChart: FC = ({
if (valueNodes[0]) {
valueNodes[0].innerHTML = `${getTvlUSD(
value[1],
- Number(poolStats.totalSupply),
+ Number(poolStats.liquidity),
Number(poolStats.liquidityUSD),
)}`
}
@@ -82,12 +92,7 @@ export const PoolDepthChart: FC = ({
} per ${token0.symbol}`
}
},
- [
- poolStats.liquidityUSD,
- poolStats.totalSupply,
- token0.symbol,
- token1.symbol,
- ],
+ [poolStats.liquidityUSD, poolStats.liquidity, token0.symbol, token1.symbol],
)
const DEFAULT_OPTION = useMemo(
@@ -110,7 +115,7 @@ export const PoolDepthChart: FC = ({
const tvlUSD = getTvlUSD(
params[0].data[1],
- poolStats.totalSupply,
+ poolStats.liquidity,
poolStats.liquidityUSD,
)
@@ -203,7 +208,7 @@ export const PoolDepthChart: FC = ({
current,
resolvedTheme,
onMouseOver,
- poolStats.totalSupply,
+ poolStats.liquidity,
poolStats.liquidityUSD,
token0.symbol,
token1.symbol,
@@ -229,7 +234,7 @@ export const PoolDepthChart: FC = ({
{getTvlUSD(
currentLiquidity,
- Number(poolStats.totalSupply),
+ Number(poolStats.liquidity),
Number(poolStats.liquidityUSD),
)}
@@ -260,7 +265,11 @@ export const PoolDepthChart: FC = ({
-
+
>
)
diff --git a/apps/evm/src/ui/pool/PoolHeader.tsx b/apps/evm/src/ui/pool/PoolHeader.tsx
index f364779296..a1767a32ac 100644
--- a/apps/evm/src/ui/pool/PoolHeader.tsx
+++ b/apps/evm/src/ui/pool/PoolHeader.tsx
@@ -15,12 +15,12 @@ import {
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from '@sushiswap/ui/components/tooltip'
+} from '@sushiswap/ui'
import React, { FC, useMemo } from 'react'
import { Chain } from 'sushi/chain'
import { Token, unwrapToken } from 'sushi/currency'
import { formatPercent, shortenAddress } from 'sushi/format'
-import { SushiSwapV3Pool } from 'sushi/pool'
+import { SushiSwapV3Pool } from 'sushi/pool/sushiswap-v3'
import { APRHoverCard } from './APRHoverCard'
@@ -46,6 +46,7 @@ export const PoolHeader: FC = ({
}) => {
const [token0, token1] = useMemo(() => {
if (!pool) return [undefined, undefined]
+
if (pool instanceof SushiSwapV3Pool) {
return [unwrapToken(pool.token0), unwrapToken(pool.token1)]
}
diff --git a/apps/evm/src/ui/pool/PoolMyRewards.tsx b/apps/evm/src/ui/pool/PoolMyRewards.tsx
index 72f622277d..cbd57cda76 100644
--- a/apps/evm/src/ui/pool/PoolMyRewards.tsx
+++ b/apps/evm/src/ui/pool/PoolMyRewards.tsx
@@ -1,7 +1,7 @@
'use client'
import { Pool } from '@sushiswap/client'
-import { Button } from '@sushiswap/ui/components/button'
+import { Button } from '@sushiswap/ui'
import {
Card,
CardContent,
@@ -12,11 +12,11 @@ import {
CardHeader,
CardLabel,
CardTitle,
-} from '@sushiswap/ui/components/card'
-import { Checker } from '@sushiswap/wagmi/systems/Checker'
+} from '@sushiswap/ui'
import { FC } from 'react'
import { formatUSD } from 'sushi/format'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
import { type ChainId } from 'sushi/chain'
import { usePoolPositionRewards } from './PoolPositionRewardsProvider'
diff --git a/apps/evm/src/ui/pool/PoolNameCell.tsx b/apps/evm/src/ui/pool/PoolNameCell.tsx
index edd59e1f15..2c1ec33cb0 100644
--- a/apps/evm/src/ui/pool/PoolNameCell.tsx
+++ b/apps/evm/src/ui/pool/PoolNameCell.tsx
@@ -1,132 +1,57 @@
'use client'
-import { Pool, Protocol } from '@sushiswap/client'
import { classNames } from '@sushiswap/ui'
-import { Badge } from '@sushiswap/ui/components/badge'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { NetworkIcon } from '@sushiswap/ui/components/icons'
+import { Badge } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { NetworkIcon } from '@sushiswap/ui'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from '@sushiswap/ui/components/tooltip'
-import { Row } from '@tanstack/react-table'
+} from '@sushiswap/ui'
import { FC } from 'react'
import { useTokensFromPool } from 'src/lib/hooks'
-import { ChainId } from 'sushi/chain'
import { formatNumber } from 'sushi/format'
-import { PositionWithPool } from '../../types'
+import { PoolHasSteerVaults } from '@sushiswap/steer-sdk'
+import {
+ type PoolBase,
+ type PoolIfIncentivized,
+ SushiSwapProtocol,
+} from 'sushi'
-export const ProtocolBadge: Record = {
- [Protocol.BENTOBOX_STABLE]: (
-
- Trident Stable
-
- ),
- [Protocol.BENTOBOX_CLASSIC]: (
-
- Trident Classic
-
- ),
- [Protocol.SUSHISWAP_V2]: (
+export const ProtocolBadge: Record = {
+ // [Protocol.BENTOBOX_STABLE]: (
+ //
+ // Trident Stable
+ //
+ // ),
+ // [Protocol.BENTOBOX_CLASSIC]: (
+ //
+ // Trident Classic
+ //
+ // ),
+ [SushiSwapProtocol.SUSHISWAP_V2]: (
V2
),
- [Protocol.SUSHISWAP_V3]: (
+ [SushiSwapProtocol.SUSHISWAP_V3]: (
V3
),
}
-export const PoolNameCell: FC> = ({ original }) => {
- const { token0, token1 } = useTokensFromPool(original.pool)
-
- const incentives = original.pool.incentives.filter((i) => i.rewardPerDay > 0)
-
- return (
-
-
- {token0 && token1 && (
-
- }
- >
-
-
-
-
-
- )}
-
-
-
- {token0?.symbol}{' '}
-
- /
- {' '}
- {token1?.symbol}{' '}
-
-
-
- {ProtocolBadge[original.pool.protocol]}
-
- {formatNumber(original.pool.swapFee * 100)}%
-
- {original.pool.isIncentivized && (
-
-
-
-
- 🧑🌾 {incentives.length > 1
- ? `x ${incentives.length}`
- : ''}{' '}
-
-
-
- Farm rewards available
-
-
-
- )}
- {original.pool.hasEnabledSteerVault && (
-
-
-
-
- 💡
-
-
-
- Smart Pool available
-
-
-
- )}
-
-
-
- )
-}
-
-export const PoolNameCellPool: FC<{ pool: Pool }> = ({ pool }) => {
+export const PoolNameCell: FC<{
+ pool: PoolHasSteerVaults, true>
+}> = ({ pool }) => {
const { token0, token1 } = useTokensFromPool(pool)
- const incentives = pool.incentives.filter((i) => i.rewardPerDay > 0)
+ const isIncentivized = 'isIncentivized' in pool && pool.isIncentivized
+ const hasEnabledVault =
+ 'hasEnabledSteerVault' in pool && pool.hasEnabledSteerVault
return (
@@ -136,11 +61,7 @@ export const PoolNameCellPool: FC<{ pool: Pool }> = ({ pool }) => {
className="border-2 border-slate-900 rounded-full z-[11]"
position="bottom-right"
badgeContent={
-
+
}
>
@@ -186,14 +107,12 @@ export const PoolNameCellPool: FC<{ pool: Pool }> = ({ pool }) => {
- {pool.isIncentivized && (
+ {isIncentivized && (
- 🧑🌾 {incentives.length > 1
- ? `x ${incentives.length}`
- : ''}{' '}
+ 🧑🌾{' '}
@@ -202,7 +121,7 @@ export const PoolNameCellPool: FC<{ pool: Pool }> = ({ pool }) => {
)}
- {pool.hasEnabledSteerVault && (
+ {hasEnabledVault && (
diff --git a/apps/evm/src/ui/pool/PoolNameCellV3.tsx b/apps/evm/src/ui/pool/PoolNameCellV3.tsx
index c0f260fbc4..ec4a899cfa 100644
--- a/apps/evm/src/ui/pool/PoolNameCellV3.tsx
+++ b/apps/evm/src/ui/pool/PoolNameCellV3.tsx
@@ -1,10 +1,10 @@
import { classNames } from '@sushiswap/ui'
-import { Badge } from '@sushiswap/ui/components/badge'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { NetworkIcon } from '@sushiswap/ui/components/icons'
-import { ConcentratedLiquidityPositionWithV3Pool } from '@sushiswap/wagmi'
+import { Badge } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { NetworkIcon } from '@sushiswap/ui'
import { Row } from '@tanstack/react-table'
import { FC, useMemo } from 'react'
+import { ConcentratedLiquidityPositionWithV3Pool } from 'src/lib/wagmi/hooks/positions/types'
import { ChainId } from 'sushi/chain'
import { Type, unwrapToken } from 'sushi/currency'
import { formatNumber } from 'sushi/format'
diff --git a/apps/evm/src/ui/pool/PoolPageV2.tsx b/apps/evm/src/ui/pool/PoolPageV2.tsx
index b8815cba2c..bc8409694e 100644
--- a/apps/evm/src/ui/pool/PoolPageV2.tsx
+++ b/apps/evm/src/ui/pool/PoolPageV2.tsx
@@ -1,11 +1,10 @@
import { Container, Separator } from '@sushiswap/ui'
import { ManageV2LiquidityCard } from 'src/ui/pool/ManageV2LiquidityCard'
import { PoolTransactionsV2 } from 'src/ui/pool/PoolTransactionsV2'
-import { ChainId } from 'sushi/chain'
-import { Protocol, getPool } from '@sushiswap/client'
+import { getPool } from '@sushiswap/client'
import { FC } from 'react'
-import { ManageTridentLiquidityCard } from './ManageTridentLiquidityCard'
+import { SushiSwapV2ChainId } from 'sushi/config'
import { PoolChartV2 } from './PoolChartV2'
import { PoolComposition } from './PoolComposition'
import { PoolMyRewards } from './PoolMyRewards'
@@ -29,11 +28,7 @@ export const PoolPageV2: FC = ({ pool, tab }) => {
- {pool.protocol === Protocol.SUSHISWAP_V2 ? (
-
- ) : (
-
- )}
+
@@ -53,7 +48,7 @@ export const PoolPageV2: FC = ({ pool, tab }) => {
diff --git a/apps/evm/src/ui/pool/PoolPageV3.tsx b/apps/evm/src/ui/pool/PoolPageV3.tsx
index b085529761..7380375f2a 100644
--- a/apps/evm/src/ui/pool/PoolPageV3.tsx
+++ b/apps/evm/src/ui/pool/PoolPageV3.tsx
@@ -11,14 +11,12 @@ import {
CardDescription,
CardHeader,
CardTitle,
-} from '@sushiswap/ui/components/card'
-import { Toggle } from '@sushiswap/ui/components/toggle'
-import {
- useConcentratedLiquidityPool,
- useConcentratedLiquidityPoolReserves,
-} from '@sushiswap/wagmi'
+} from '@sushiswap/ui'
+import { Toggle } from '@sushiswap/ui'
import React, { FC, useState } from 'react'
import { useTokenAmountDollarValues } from 'src/lib/hooks'
+import { useConcentratedLiquidityPool } from 'src/lib/wagmi/hooks/pools/hooks/useConcentratedLiquidityPool'
+import { useConcentratedLiquidityPoolReserves } from 'src/lib/wagmi/hooks/pools/hooks/useConcentratedLiquidityPoolReserves'
import { SushiSwapV3ChainId } from 'sushi/config'
import { formatUSD } from 'sushi/format'
import { Address } from 'viem'
@@ -155,16 +153,16 @@ const Pool: FC<{ pool: Awaited
> }> = ({ pool }) => {
{formatUSD(
granularity === Granularity.Week
- ? poolStats.volume1w
- : poolStats.volume1d ?? 0,
+ ? poolStats.volumeUSD1w
+ : poolStats.volumeUSD1d ?? 0,
)}{' '}
0
? 'text-green'
: 'text-red',
@@ -173,8 +171,8 @@ const Pool: FC<{ pool: Awaited> }> = ({ pool }) => {
(
{poolStats[
granularity === Granularity.Week
- ? 'volumeChange1w'
- : 'volumeChange1d'
+ ? 'volumeUSD1wChange'
+ : 'volumeUSD1dChange'
].toFixed(2)}
%)
@@ -189,16 +187,16 @@ const Pool: FC<{ pool: Awaited
> }> = ({ pool }) => {
{formatUSD(
granularity === Granularity.Week
- ? poolStats.fees1w
- : poolStats.fees1d ?? 0,
+ ? poolStats.feesUSD1w
+ : poolStats.feesUSD1d ?? 0,
)}{' '}
0
? 'text-green'
: 'text-red',
@@ -207,8 +205,8 @@ const Pool: FC<{ pool: Awaited> }> = ({ pool }) => {
(
{poolStats[
granularity === Granularity.Week
- ? 'feesChange1w'
- : 'feesChange1d'
+ ? 'feesUSD1wChange'
+ : 'feesUSD1dChange'
].toFixed(2)}
%)
diff --git a/apps/evm/src/ui/pool/PoolPosition.tsx b/apps/evm/src/ui/pool/PoolPosition.tsx
index e48d2192c5..49a1fcae22 100644
--- a/apps/evm/src/ui/pool/PoolPosition.tsx
+++ b/apps/evm/src/ui/pool/PoolPosition.tsx
@@ -7,12 +7,13 @@ import {
CardDescription,
CardHeader,
CardTitle,
-} from '@sushiswap/ui/components/card'
+} from '@sushiswap/ui'
import { FC } from 'react'
import { formatUSD } from 'sushi/format'
import { SkeletonText } from '@sushiswap/ui'
-import { ConnectButton, useAccount } from '@sushiswap/wagmi'
+import { ConnectButton } from 'src/lib/wagmi/components/connect-button'
+import { useAccount } from 'wagmi'
import { PoolPositionDesktop } from './PoolPositionDesktop'
import { usePoolPosition } from './PoolPositionProvider'
import { PoolPositionStakedDesktop } from './PoolPositionStakedDesktop'
diff --git a/apps/evm/src/ui/pool/PoolPositionDesktop.tsx b/apps/evm/src/ui/pool/PoolPositionDesktop.tsx
index 7d8c0cb2d0..858bbf361a 100644
--- a/apps/evm/src/ui/pool/PoolPositionDesktop.tsx
+++ b/apps/evm/src/ui/pool/PoolPositionDesktop.tsx
@@ -1,9 +1,5 @@
import { Pool } from '@sushiswap/client'
-import {
- CardCurrencyAmountItem,
- CardGroup,
- CardLabel,
-} from '@sushiswap/ui/components/card'
+import { CardCurrencyAmountItem, CardGroup, CardLabel } from '@sushiswap/ui'
import { FC } from 'react'
import { formatUSD } from 'sushi/format'
diff --git a/apps/evm/src/ui/pool/PoolPositionProvider.tsx b/apps/evm/src/ui/pool/PoolPositionProvider.tsx
index a9284abd22..808719a82e 100644
--- a/apps/evm/src/ui/pool/PoolPositionProvider.tsx
+++ b/apps/evm/src/ui/pool/PoolPositionProvider.tsx
@@ -1,16 +1,16 @@
'use client'
-import { Pool } from '@sushiswap/client'
-import { useAccount } from '@sushiswap/wagmi'
-import { useBalanceWeb3 } from '@sushiswap/wagmi'
import { FC, ReactNode, createContext, useContext, useMemo } from 'react'
import {
useGraphPool,
useTokenAmountDollarValues,
useUnderlyingTokenBalanceFromPool,
} from 'src/lib/hooks'
+import { useBalanceWeb3 } from 'src/lib/wagmi/hooks/balances/useBalanceWeb3'
import { ChainId } from 'sushi/chain'
import { Amount, Type } from 'sushi/currency'
+import type { PoolId } from 'sushi/types'
+import { useAccount } from 'wagmi'
interface PoolPositionContext {
balance: Amount
| null | undefined
@@ -25,7 +25,7 @@ interface PoolPositionContext {
const Context = createContext(undefined)
export const PoolPositionProvider: FC<{
- pool: Pool
+ pool: PoolId
children: ReactNode
watch?: boolean
}> = ({ pool, children }) => {
diff --git a/apps/evm/src/ui/pool/PoolPositionRewardsProvider.tsx b/apps/evm/src/ui/pool/PoolPositionRewardsProvider.tsx
index 5bbe10e559..0557938dc3 100644
--- a/apps/evm/src/ui/pool/PoolPositionRewardsProvider.tsx
+++ b/apps/evm/src/ui/pool/PoolPositionRewardsProvider.tsx
@@ -1,17 +1,18 @@
'use client'
-import { ChefType, Pool } from '@sushiswap/client'
-import {
- RewarderType,
- useAccount,
- useMasterChef,
- useRewarder,
-} from '@sushiswap/wagmi'
+import { ChefType } from '@sushiswap/client'
import { FC, ReactNode, createContext, useContext, useMemo } from 'react'
import { incentiveRewardToToken } from 'src/lib/functions'
import { useTokenAmountDollarValues, useTokensFromPool } from 'src/lib/hooks'
+import { useMasterChef } from 'src/lib/wagmi/hooks/master-chef/use-master-chef'
+import {
+ RewarderType,
+ useRewarder,
+} from 'src/lib/wagmi/hooks/master-chef/use-rewarder'
import { ChainId } from 'sushi/chain'
import { Amount, Token } from 'sushi/currency'
+import type { Incentive, PoolBase, PoolWithIncentives } from 'sushi/types'
+import { useAccount } from 'wagmi'
interface PoolPositionRewardsContext {
pendingRewards: (Amount | undefined)[]
@@ -25,15 +26,15 @@ interface PoolPositionRewardsContext {
const Context = createContext(undefined)
interface PoolPositionRewardsProviderProps {
- pool: Pool
+ pool: PoolBase
farmId: number
chefType: ChefType
children: ReactNode
- incentives: Pool['incentives']
+ incentives: Incentive[]
}
interface PoolPositionStakedProviderProps {
- pool: Pool
+ pool: PoolWithIncentives
children: ReactNode
}
@@ -92,7 +93,7 @@ export const _PoolPositionRewardsProvider: FC<
const {
data: pendingRewards,
- isLoading,
+ isInitialLoading: isLoading,
isError,
} = useRewarder({
chainId: pool.chainId as ChainId,
diff --git a/apps/evm/src/ui/pool/PoolPositionStakedDesktop.tsx b/apps/evm/src/ui/pool/PoolPositionStakedDesktop.tsx
index 7d9d37477c..16bc5367ac 100644
--- a/apps/evm/src/ui/pool/PoolPositionStakedDesktop.tsx
+++ b/apps/evm/src/ui/pool/PoolPositionStakedDesktop.tsx
@@ -1,9 +1,5 @@
import { Pool } from '@sushiswap/client'
-import {
- CardCurrencyAmountItem,
- CardGroup,
- CardLabel,
-} from '@sushiswap/ui/components/card'
+import { CardCurrencyAmountItem, CardGroup, CardLabel } from '@sushiswap/ui'
import { FC } from 'react'
import { formatUSD } from 'sushi/format'
diff --git a/apps/evm/src/ui/pool/PoolPositionStakedProvider.tsx b/apps/evm/src/ui/pool/PoolPositionStakedProvider.tsx
index 4bbd2f9cd4..8b5c4db0d0 100644
--- a/apps/evm/src/ui/pool/PoolPositionStakedProvider.tsx
+++ b/apps/evm/src/ui/pool/PoolPositionStakedProvider.tsx
@@ -1,13 +1,14 @@
'use client'
-import { ChefType, Pool } from '@sushiswap/client'
-import { useMasterChef } from '@sushiswap/wagmi'
+import { ChefType } from '@sushiswap/client'
import { FC, ReactNode, createContext, useContext, useMemo } from 'react'
import {
useGraphPool,
useTokenAmountDollarValues,
useUnderlyingTokenBalanceFromPool,
} from 'src/lib/hooks'
+import { useMasterChef } from 'src/lib/wagmi/hooks/master-chef/use-master-chef'
+import type { PoolId, PoolWithIncentives } from 'sushi'
import { ChainId } from 'sushi/chain'
import { Amount, Currency, Token } from 'sushi/currency'
@@ -26,7 +27,7 @@ interface PoolPositionStakedContext {
const Context = createContext(undefined)
interface PoolPositionStakedProviderProps {
- pool: Pool
+ pool: PoolWithIncentives
children: ReactNode
watch?: boolean
}
@@ -65,7 +66,7 @@ export const PoolPositionStakedProvider: FC =
}
interface _PoolPositionStakedProviderProps {
- pool: Pool
+ pool: PoolId
children: ReactNode
farmId: number
chefType: ChefType
@@ -82,6 +83,7 @@ const _PoolPositionStakedProvider: FC<_PoolPositionStakedProviderProps> = ({
const {
data: { reserve0, reserve1, totalSupply, liquidityToken },
} = useGraphPool(pool)
+
const { balance, isLoading, isError, isWritePending, isWriteError } =
useMasterChef({
chainId: pool.chainId as ChainId,
diff --git a/apps/evm/src/ui/pool/PoolQuickHoverTooltip.tsx b/apps/evm/src/ui/pool/PoolQuickHoverTooltip.tsx
index 3a7d08aab2..5304660922 100644
--- a/apps/evm/src/ui/pool/PoolQuickHoverTooltip.tsx
+++ b/apps/evm/src/ui/pool/PoolQuickHoverTooltip.tsx
@@ -1,9 +1,9 @@
import { PlusIcon, UserCircleIcon } from '@heroicons/react-v1/solid'
import { Pool, Protocol } from '@sushiswap/client'
import { LinkInternal } from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { List } from '@sushiswap/ui/components/list/List'
+import { Button } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { List } from '@sushiswap/ui'
import React, { FC } from 'react'
import { incentiveRewardToToken } from 'src/lib/functions'
import { ChainId } from 'sushi/chain'
diff --git a/apps/evm/src/ui/pool/PoolRewards.tsx b/apps/evm/src/ui/pool/PoolRewards.tsx
index 7947410aac..2492305fb0 100644
--- a/apps/evm/src/ui/pool/PoolRewards.tsx
+++ b/apps/evm/src/ui/pool/PoolRewards.tsx
@@ -9,7 +9,7 @@ import {
CardLabel,
CardTitle,
} from '@sushiswap/ui'
-import { Card, CardDescription } from '@sushiswap/ui/components/card'
+import { Card, CardDescription } from '@sushiswap/ui'
import React, { FC } from 'react'
import { incentiveRewardToToken } from 'src/lib/functions'
import { ChainId } from 'sushi/chain'
diff --git a/apps/evm/src/ui/pool/PoolRewardsCell.tsx b/apps/evm/src/ui/pool/PoolRewardsCell.tsx
index a064459bdb..e7ac91eaca 100644
--- a/apps/evm/src/ui/pool/PoolRewardsCell.tsx
+++ b/apps/evm/src/ui/pool/PoolRewardsCell.tsx
@@ -1,4 +1,4 @@
-import { Currency } from '@sushiswap/ui/components/currency'
+import { Currency } from '@sushiswap/ui'
import { Row } from '@tanstack/react-table'
import { FC } from 'react'
import { ChainId } from 'sushi/chain'
diff --git a/apps/evm/src/ui/pool/PoolStats.tsx b/apps/evm/src/ui/pool/PoolStats.tsx
index 2f4bfaeaca..a937817a39 100644
--- a/apps/evm/src/ui/pool/PoolStats.tsx
+++ b/apps/evm/src/ui/pool/PoolStats.tsx
@@ -9,10 +9,10 @@ import {
CardTitle,
classNames,
} from '@sushiswap/ui'
-import { SkeletonText } from '@sushiswap/ui/components/skeleton'
+import { SkeletonText } from '@sushiswap/ui'
import { FC } from 'react'
import { usePoolGraphData } from 'src/lib/hooks'
-import { ChainId } from 'sushi/chain'
+import { SushiSwapV2ChainId } from 'sushi/config'
import { formatNumber, formatPercent, formatUSD } from 'sushi/format'
interface PoolStats {
@@ -22,7 +22,7 @@ interface PoolStats {
export const PoolStats: FC = ({ pool }) => {
const { data, isLoading } = usePoolGraphData({
poolAddress: pool.address,
- chainId: pool.chainId as ChainId,
+ chainId: pool.chainId as SushiSwapV2ChainId,
})
return (
diff --git a/apps/evm/src/ui/pool/PoolTransactionsV2.tsx b/apps/evm/src/ui/pool/PoolTransactionsV2.tsx
index 20157e7610..4792113416 100644
--- a/apps/evm/src/ui/pool/PoolTransactionsV2.tsx
+++ b/apps/evm/src/ui/pool/PoolTransactionsV2.tsx
@@ -1,8 +1,6 @@
'use client'
import { Pool } from '@sushiswap/client'
-import { getBuiltGraphSDK } from '@sushiswap/graph-client'
-import { SUSHISWAP_SUBGRAPH_URL } from '@sushiswap/graph-config'
import {
Card,
CardContent,
@@ -10,13 +8,19 @@ import {
CardTitle,
DataTable,
} from '@sushiswap/ui'
-import { Toggle } from '@sushiswap/ui/components/toggle'
+import { Toggle } from '@sushiswap/ui'
import { useQuery } from '@tanstack/react-query'
import { PaginationState } from '@tanstack/react-table'
import React, { FC, useMemo, useState } from 'react'
import { Chain, ChainId } from 'sushi/chain'
import { SushiSwapV2ChainId, isSushiSwapV2ChainId } from 'sushi/config'
+import {
+ getSushiV2Burns,
+ getSushiV2Mints,
+ getSushiV2Swaps,
+ getSushiV2Transactions,
+} from '../../../../../packages/graph-client/dist/subgraphs/sushi-v2'
import {
TX_AMOUNT_IN_V2_COLUMN,
TX_AMOUNT_OUT_V2_COLUMN,
@@ -43,11 +47,8 @@ const fetchAll = async (
chainId: SushiSwapV2ChainId,
opts: UseTransactionsV2Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_SUBGRAPH_URL[chainId],
- })
-
- const { transactions } = await sdk.V2Transactions({
+ const transactions = await getSushiV2Transactions({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: {
@@ -72,6 +73,8 @@ const fetchAll = async (
},
],
},
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return transactions
@@ -82,14 +85,13 @@ const fetchMints = async (
chainId: SushiSwapV2ChainId,
opts: UseTransactionsV2Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_SUBGRAPH_URL[chainId],
- })
-
- const { mints } = await sdk.V2Mints({
+ const mints = await getSushiV2Mints({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: { pair: poolId.toLowerCase() },
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return mints.map((mint) => ({
@@ -105,19 +107,19 @@ const fetchBurns = async (
chainId: SushiSwapV2ChainId,
opts: UseTransactionsV2Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_SUBGRAPH_URL[chainId],
- })
-
- const { burns } = await sdk.V2Burns({
+ const burns = await getSushiV2Burns({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: {
pair: poolId.toLowerCase(),
- amount0_not: null,
- amount1_not: null,
- sender_not: null,
+ // TODO: disbled for now, according to the types this can never be null so not sure if we need it anymore
+ // amount0_not: null,
+ // amount1_not: null,
+ // sender_not: null,
},
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return burns.map((burn) => ({
@@ -133,14 +135,13 @@ const fetchSwaps = async (
chainId: SushiSwapV2ChainId,
opts: UseTransactionsV2Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_SUBGRAPH_URL[chainId],
- })
-
- const { swaps } = await sdk.V2Swaps({
+ const swaps = await getSushiV2Swaps({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: { pair: poolId.toLowerCase() },
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return swaps.map((swap) => ({
@@ -213,8 +214,12 @@ function useTransactionsV2(
...swap,
sender: String(swap.sender),
to: String(swap.to),
- amountIn: Number(swap.amountIn),
- amountOut: Number(swap.amountOut),
+ amountIn: Number(
+ swap.amount0In !== '0' ? swap.amount0In : swap.amount1In,
+ ),
+ amountOut: Number(
+ swap.amount0Out !== '0' ? swap.amount0Out : swap.amount1Out,
+ ),
type: TransactionType.Swap as const,
}))
diff --git a/apps/evm/src/ui/pool/PoolTransactionsV3.tsx b/apps/evm/src/ui/pool/PoolTransactionsV3.tsx
index 3d36c607ff..30514730de 100644
--- a/apps/evm/src/ui/pool/PoolTransactionsV3.tsx
+++ b/apps/evm/src/ui/pool/PoolTransactionsV3.tsx
@@ -1,8 +1,6 @@
'use client'
import { Pool } from '@sushiswap/client'
-import { getBuiltGraphSDK } from '@sushiswap/graph-client'
-import { SUSHISWAP_V3_SUBGRAPH_URL } from '@sushiswap/graph-config'
import {
Card,
CardContent,
@@ -10,13 +8,20 @@ import {
CardTitle,
DataTable,
} from '@sushiswap/ui'
-import { Toggle } from '@sushiswap/ui/components/toggle'
+import { Toggle } from '@sushiswap/ui'
import { useQuery } from '@tanstack/react-query'
import { PaginationState } from '@tanstack/react-table'
import React, { FC, useMemo, useState } from 'react'
import { Chain, ChainId } from 'sushi/chain'
import { SushiSwapV3ChainId, isSushiSwapV3ChainId } from 'sushi/config'
+import {
+ getSushiV3Burns,
+ getSushiV3Collects,
+ getSushiV3Mints,
+ getSushiV3Swaps,
+ getSushiV3Transactions,
+} from '../../../../../packages/graph-client/dist/subgraphs/sushi-v3'
import {
TX_AMOUNT_IN_V3_COLUMN,
TX_AMOUNT_OUT_V3_COLUMN,
@@ -44,11 +49,8 @@ const fetchAll = async (
chainId: SushiSwapV3ChainId,
opts: UseTransactionsV3Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_V3_SUBGRAPH_URL[chainId],
- })
-
- const { transactions } = await sdk.V3Transactions({
+ const transactions = await getSushiV3Transactions({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: {
@@ -75,6 +77,8 @@ const fetchAll = async (
},
],
},
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return transactions
@@ -85,14 +89,13 @@ const fetchMints = async (
chainId: SushiSwapV3ChainId,
opts: UseTransactionsV3Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_V3_SUBGRAPH_URL[chainId],
- })
-
- const { mints } = await sdk.V3Mints({
+ const mints = await getSushiV3Mints({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: { pool: poolId.toLowerCase() },
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return mints.map((mint) => ({
@@ -109,14 +112,13 @@ const fetchBurns = async (
chainId: SushiSwapV3ChainId,
opts: UseTransactionsV3Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_V3_SUBGRAPH_URL[chainId],
- })
-
- const { burns } = await sdk.V3Burns({
+ const burns = await getSushiV3Burns({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: { pool: poolId.toLowerCase() },
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return burns.map((burn) => ({
@@ -133,14 +135,13 @@ const fetchSwaps = async (
chainId: SushiSwapV3ChainId,
opts: UseTransactionsV3Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_V3_SUBGRAPH_URL[chainId],
- })
-
- const { swaps } = await sdk.V3Swaps({
+ const swaps = await getSushiV3Swaps({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: { pool: poolId.toLowerCase() },
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return swaps.map((swap) => ({
@@ -157,14 +158,13 @@ const fetchCollects = async (
chainId: SushiSwapV3ChainId,
opts: UseTransactionsV3Opts,
) => {
- const sdk = getBuiltGraphSDK({
- url: SUSHISWAP_V3_SUBGRAPH_URL[chainId],
- })
-
- const { collects } = await sdk.V3Collects({
+ const collects = await getSushiV3Collects({
+ chainId,
first: opts.first,
skip: opts?.skip ?? 0,
where: { pool: poolId.toLowerCase() },
+ orderBy: 'timestamp',
+ orderDirection: 'desc',
})
return collects.map((collect) => ({
diff --git a/apps/evm/src/ui/pool/PoolsFiltersProvider.tsx b/apps/evm/src/ui/pool/PoolsFiltersProvider.tsx
index ce8f59bb01..3dde44c6f3 100644
--- a/apps/evm/src/ui/pool/PoolsFiltersProvider.tsx
+++ b/apps/evm/src/ui/pool/PoolsFiltersProvider.tsx
@@ -11,7 +11,7 @@ import {
useContext,
useMemo,
} from 'react'
-import { SUPPORTED_CHAIN_IDS } from 'src/config'
+import { SUPPORTED_CHAIN_IDS, isSupportedChainId } from 'src/config'
import { z } from 'zod'
import { useTypedSearchParams } from '../../lib/hooks'
@@ -39,7 +39,8 @@ export const poolFiltersSchema = z.object({
chainIds !== null && chainIds !== ','
? chainIds.split(',').map((chainId) => Number(chainId))
: SUPPORTED_CHAIN_IDS,
- ),
+ )
+ .transform((chainIds) => chainIds.filter(isSupportedChainId)),
protocols: z
.string()
.transform((protocols) =>
diff --git a/apps/evm/src/ui/pool/PoolsTable.tsx b/apps/evm/src/ui/pool/PoolsTable.tsx
index 7a5b2a8e6d..1182b1b2f7 100644
--- a/apps/evm/src/ui/pool/PoolsTable.tsx
+++ b/apps/evm/src/ui/pool/PoolsTable.tsx
@@ -11,7 +11,7 @@ import {
PlusIcon,
} from '@heroicons/react/24/outline'
import { Slot } from '@radix-ui/react-slot'
-import { GetPoolsArgs, Pool, Protocol } from '@sushiswap/client'
+import { GetPoolsArgs } from '@sushiswap/client'
import {
Button,
Card,
@@ -42,26 +42,37 @@ import { Native } from 'sushi/currency'
import { useSWRConfig } from 'swr'
import { usePoolCount, usePoolsInfinite } from '@sushiswap/client/hooks'
+import { PoolHasSteerVaults } from '@sushiswap/steer-sdk'
import { isAngleEnabledChainId } from 'sushi/config'
+import {
+ PoolBase,
+ PoolHistory,
+ PoolIfIncentivized,
+ unnestPool,
+} from 'sushi/types'
import { usePoolFilters } from './PoolsFiltersProvider'
import {
- APR_COLUMN_POOL,
+ APR_COLUMN,
FEES_COLUMN,
NAME_COLUMN_POOL,
TVL_COLUMN,
VOLUME_1D_COLUMN,
VOLUME_1M_COLUMN,
- VOLUME_7D_COLUMN,
+ VOLUME_1W_COLUMN,
} from './columns'
+type RequiredPool = PoolHasSteerVaults<
+ PoolIfIncentivized>
+>
+
const COLUMNS = [
NAME_COLUMN_POOL,
TVL_COLUMN,
VOLUME_1D_COLUMN,
- VOLUME_7D_COLUMN,
+ VOLUME_1W_COLUMN,
VOLUME_1M_COLUMN,
FEES_COLUMN,
- APR_COLUMN_POOL,
+ APR_COLUMN,
{
id: 'actions',
cell: ({ row }) =>
@@ -197,16 +208,6 @@ const COLUMNS = [
{row.original.token0.symbol} / {row.original.token1.symbol}
- {row.original.protocol === Protocol.BENTOBOX_STABLE && (
-
- Trident Stable
-
- )}
- {row.original.protocol === Protocol.BENTOBOX_CLASSIC && (
-
- Trident Classic
-
- )}
{row.original.protocol === 'SUSHISWAP_V2' && (
SushiSwap V2
@@ -287,11 +288,11 @@ const COLUMNS = [
disableLink: true,
skeleton: ,
},
- },
-] satisfies ColumnDef[]
+ } satisfies ColumnDef,
+] as ColumnDef[]
interface PositionsTableProps {
- onRowClick?(row: Pool): void
+ onRowClick?(row: RequiredPool): void
}
export const PoolsTable: FC = ({ onRowClick }) => {
@@ -325,6 +326,7 @@ export const PoolsTable: FC = ({ onRowClick }) => {
shouldFetch: true,
swrConfig: useSWRConfig(),
})
+
const data = useMemo(() => pools?.flat() || [], [pools])
const state: Partial = useMemo(() => {
@@ -338,7 +340,7 @@ export const PoolsTable: FC = ({ onRowClick }) => {
}, [data?.length, sorting])
const rowRenderer = useCallback(
- (row: Row, rowNode: ReactNode) => {
+ (row: Row, rowNode: ReactNode) => {
if (onRowClick)
return (
= ({ onRowClick }) => {
state={state}
onSortingChange={setSorting}
loading={!pools && isValidating}
- linkFormatter={(row) => `/pool/${row.chainId}%3A${row.address}`}
+ linkFormatter={(row) =>
+ `/pool/${unnestPool(row).chainId}%3A${unnestPool(row).address}`
+ }
rowRenderer={rowRenderer}
columns={COLUMNS}
data={data}
diff --git a/apps/evm/src/ui/pool/PositionCard.tsx b/apps/evm/src/ui/pool/PositionCard.tsx
index 1a67344d11..1390afbd77 100644
--- a/apps/evm/src/ui/pool/PositionCard.tsx
+++ b/apps/evm/src/ui/pool/PositionCard.tsx
@@ -1,21 +1,21 @@
import { LinkInternal } from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { SkeletonCircle, SkeletonText } from '@sushiswap/ui/components/skeleton'
+import { Button } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { SkeletonCircle, SkeletonText } from '@sushiswap/ui'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
-} from '@sushiswap/ui/components/tooltip'
+} from '@sushiswap/ui'
import React, { FC } from 'react'
+import { UserWithPool } from 'src/app/pool/api/user-with-pools/route'
import { useTokensFromPool } from 'src/lib/hooks'
-import { PositionWithPool } from 'src/types'
import { Chain } from 'sushi/chain'
import { formatNumber, formatUSD } from 'sushi/format'
interface PositionCard {
- position: PositionWithPool
+ position: UserWithPool
}
export const PositionCardSkeleton = () => {
@@ -44,12 +44,13 @@ export const PositionCardSkeleton = () => {
export const PositionCard: FC = ({ position }) => {
const { token0, token1 } = useTokensFromPool(position.pool)
const valueUSD =
- (Number(position.balance) / Number(position.pool.totalSupply)) *
+ (Number(position.unstakedBalance) / Number(position.pool.liquidity)) *
Number(position.pool.liquidityUSD)
+
return (
- {Chain.from(position.chainId)?.name}
+ {Chain.from(position.pool.chainId)?.name}
{token0.symbol}/{token1.symbol}{' '}
@@ -76,9 +77,6 @@ export const PositionCard: FC = ({ position }) => {
🧑🌾{' '}
- {position.pool.incentives.length > 1
- ? `x ${position.pool.incentives.length}`
- : ''}{' '}
diff --git a/apps/evm/src/ui/pool/PositionCardList.tsx b/apps/evm/src/ui/pool/PositionCardList.tsx
index dcc6dac66c..95fbd60e44 100644
--- a/apps/evm/src/ui/pool/PositionCardList.tsx
+++ b/apps/evm/src/ui/pool/PositionCardList.tsx
@@ -1,38 +1,38 @@
-import { Protocol } from '@sushiswap/client'
-import { useAccount } from '@sushiswap/wagmi'
import React, { FC, ReactNode } from 'react'
+import type { UserWithPool } from 'src/app/pool/api/user-with-pools/route'
import { SUPPORTED_CHAIN_IDS } from 'src/config'
-import { useUserPositions } from 'src/lib/hooks'
-import { PositionWithPool } from 'src/types'
+import { useSushiV2UserPositions } from 'src/lib/hooks'
+import { useAccount } from 'wagmi'
interface PositionCardList {
children({
positions,
isLoading,
- }: { positions: PositionWithPool[]; isLoading: boolean }): ReactNode
+ }: {
+ positions: UserWithPool[]
+ isLoading: boolean
+ }): ReactNode
}
-const value = (position: PositionWithPool) =>
- (Number(position.balance + position.stakedBalance) /
- Number(position.pool.totalSupply)) *
+const value = (position: UserWithPool) =>
+ (Number(position.unstakedBalance + position.stakedBalance) /
+ Number(position.pool.liquidity)) *
Number(position.pool.liquidityUSD)
export const PositionCardList: FC = ({ children }) => {
const { address } = useAccount()
- const { data: userPositions, isValidating } = useUserPositions({
- id: address,
+ const { data: userPositions, isLoading } = useSushiV2UserPositions({
+ id: address!,
chainIds: SUPPORTED_CHAIN_IDS,
})
return (
<>
{children({
- positions: isValidating
+ positions: isLoading
? new Array(6).fill(null)
- : (userPositions || [])
- .filter((el) => el.pool.protocol === Protocol.SUSHISWAP_V2)
- .sort((a, b) => value(b) - value(a)),
- isLoading: isValidating,
+ : (userPositions || []).sort((a, b) => value(b) - value(a)),
+ isLoading,
})}
>
)
diff --git a/apps/evm/src/ui/pool/PositionQuickHoverTooltip.tsx b/apps/evm/src/ui/pool/PositionQuickHoverTooltip.tsx
index c9d04472ff..dc258dd58d 100644
--- a/apps/evm/src/ui/pool/PositionQuickHoverTooltip.tsx
+++ b/apps/evm/src/ui/pool/PositionQuickHoverTooltip.tsx
@@ -1,15 +1,21 @@
import { ArrowDownIcon, MinusIcon, PlusIcon } from '@heroicons/react-v1/solid'
-import { Button } from '@sushiswap/ui/components/button'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { LinkInternal } from '@sushiswap/ui/components/link'
-import { List } from '@sushiswap/ui/components/list'
-import { useAccount, useSwitchChain } from '@sushiswap/wagmi'
+import { Button } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { LinkInternal } from '@sushiswap/ui'
+import { List } from '@sushiswap/ui'
import React, { FC, useCallback } from 'react'
-import { PositionWithPool } from 'src/types'
import { formatPercent, formatUSD } from 'sushi/format'
import { ZERO } from 'sushi/math'
+import type {
+ PoolBase,
+ PoolWithAprs,
+ PoolWithIncentives,
+ SushiPositionStaked,
+ SushiPositionWithPool,
+} from 'sushi'
import { ChainId } from 'sushi/chain'
+import { useAccount, useSwitchChain } from 'wagmi'
import { PoolPositionProvider, usePoolPosition } from './PoolPositionProvider'
import {
PoolPositionRewardsProvider,
@@ -21,7 +27,9 @@ import {
} from './PoolPositionStakedProvider'
interface PositionQuickHoverTooltipProps {
- row: PositionWithPool
+ row: SushiPositionStaked<
+ SushiPositionWithPool>>
+ >
}
export const PositionQuickHoverTooltip: FC = ({
diff --git a/apps/evm/src/ui/pool/PositionView.tsx b/apps/evm/src/ui/pool/PositionView.tsx
index 3f6a7f4704..bd948ff055 100644
--- a/apps/evm/src/ui/pool/PositionView.tsx
+++ b/apps/evm/src/ui/pool/PositionView.tsx
@@ -30,24 +30,22 @@ import {
WidgetAction,
classNames,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { FormattedNumber } from '@sushiswap/ui/components/formatted-number'
-import { SkeletonText } from '@sushiswap/ui/components/skeleton'
-import {
- getDefaultTTL,
- useAccount,
- useConcentratedLiquidityPositionsFromTokenId,
- useConcentratedPositionInfo,
- useConcentratedPositionOwner,
- useTokenWithCache,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
+import { Button } from '@sushiswap/ui'
+import { FormattedNumber } from '@sushiswap/ui'
+import { SkeletonText } from '@sushiswap/ui'
import { FC, useMemo, useState } from 'react'
+import { useConcentratedPositionInfo } from 'src/lib/wagmi/hooks/positions/hooks/useConcentratedPositionInfo'
+import { useConcentratedPositionOwner } from 'src/lib/wagmi/hooks/positions/hooks/useConcentratedPositionOwner'
+import { useConcentratedLiquidityPositionsFromTokenId } from 'src/lib/wagmi/hooks/positions/hooks/useConcentratedPositionsFromTokenId'
+import { useTokenWithCache } from 'src/lib/wagmi/hooks/tokens/useTokenWithCache'
+import { getDefaultTTL } from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
import { Chain } from 'sushi/chain'
import { SushiSwapV3ChainId, isAngleEnabledChainId } from 'sushi/config'
import { Amount, unwrapToken } from 'sushi/currency'
import { formatUSD } from 'sushi/format'
import { getAddress } from 'viem'
+import { useAccount } from 'wagmi'
import { Bound } from '../../lib/constants'
import {
formatTickPrice,
@@ -90,7 +88,7 @@ const Component: FC<{ id: string }> = ({ id }) => {
address: positionDetails?.token1,
})
- const { data: position, isLoading: isPositionLoading } =
+ const { data: position, isInitialLoading: isPositionLoading } =
useConcentratedPositionInfo({
chainId,
token0,
diff --git a/apps/evm/src/ui/pool/PositionsTab.tsx b/apps/evm/src/ui/pool/PositionsTab.tsx
index 4a79cf963a..3c466694f6 100644
--- a/apps/evm/src/ui/pool/PositionsTab.tsx
+++ b/apps/evm/src/ui/pool/PositionsTab.tsx
@@ -1,4 +1,3 @@
-import { Protocol } from '@sushiswap/client'
import {
Select,
SelectContent,
@@ -41,26 +40,6 @@ const ITEMS: { id: string; value: string; children: React.ReactNode }[] = [
),
},
- {
- id: 'trident-stable',
- value: 'stable',
- children: (
-
- 🍱
- Trident Stable
-
- ),
- },
- {
- id: 'trident-classic',
- value: 'classic',
- children: (
-
- 🍱
- Trident Classic
-
- ),
- },
{
id: 'sushiswap-smart',
value: 'smart',
@@ -110,22 +89,7 @@ export const PositionsTab = () => {
- `/pool/${row.pool.id}`}
- />
-
-
- `/pool/${row.pool.id}`}
- />
-
-
- `/pool/${row.pool.id}`}
- />
+ `/pool/${row.pool.id}`} />
diff --git a/apps/evm/src/ui/pool/PositionsTable.tsx b/apps/evm/src/ui/pool/PositionsTable.tsx
index e31fd26be2..142280b069 100644
--- a/apps/evm/src/ui/pool/PositionsTable.tsx
+++ b/apps/evm/src/ui/pool/PositionsTable.tsx
@@ -1,36 +1,30 @@
-import { Protocol } from '@sushiswap/client'
import { Card, CardHeader, CardTitle, DataTable } from '@sushiswap/ui'
-import { Slot } from '@sushiswap/ui/components/slot'
-import { useAccount } from '@sushiswap/wagmi'
-import { ColumnDef, PaginationState, Row } from '@tanstack/react-table'
+import { Slot } from '@sushiswap/ui'
+import { DisplayColumnDef, PaginationState, Row } from '@tanstack/react-table'
import React, { FC, ReactNode, useCallback, useMemo, useState } from 'react'
import { SUPPORTED_CHAIN_IDS } from 'src/config'
-import { useUserPositions } from 'src/lib/hooks'
-import { PositionWithPool } from 'src/types'
+import { useSushiV2UserPositions } from 'src/lib/hooks'
+import type { UserWithPool } from 'src/app/pool/api/user-with-pools/route'
+import { useAccount } from 'wagmi'
import { usePoolFilters } from './PoolsFiltersProvider'
-import {
- APR_COLUMN,
- NAME_COLUMN_POSITION_WITH_POOL,
- VALUE_COLUMN,
-} from './columns'
+import { APR_COLUMN, NAME_COLUMN_POOL, VALUE_COLUMN } from './columns'
+// ! Column types have to be checked manually
const COLUMNS = [
- NAME_COLUMN_POSITION_WITH_POOL,
+ NAME_COLUMN_POOL,
VALUE_COLUMN,
APR_COLUMN,
-] satisfies ColumnDef[]
+] as DisplayColumnDef[]
interface PositionsTableProps {
- protocol: Protocol
- onRowClick?(row: PositionWithPool): void
- rowLink?(row: PositionWithPool): string
+ onRowClick?(row: UserWithPool): void
+ rowLink?(row: UserWithPool): string
}
const tableState = { sorting: [{ id: 'value', desc: true }] }
export const PositionsTable: FC = ({
- protocol,
onRowClick,
rowLink,
}) => {
@@ -41,9 +35,9 @@ export const PositionsTable: FC = ({
pageSize: 10,
})
- const { data: positions, isValidating } = useUserPositions(
+ const { data: positions, isLoading } = useSushiV2UserPositions(
{
- id: address,
+ id: address!,
chainIds: SUPPORTED_CHAIN_IDS,
},
!!address,
@@ -62,14 +56,15 @@ export const PositionsTable: FC = ({
})
: true,
)
+
const chainFiltered = searchFiltered.filter((el) =>
- chainIds.includes(el.chainId),
+ chainIds.includes(el.pool.chainId as (typeof chainIds)[number]),
)
- return chainFiltered.filter((el) => el.pool?.protocol === protocol)
- }, [positions, tokenSymbols, chainIds, protocol])
+ return chainFiltered
+ }, [positions, tokenSymbols, chainIds])
const rowRenderer = useCallback(
- (row: Row, rowNode: ReactNode) => {
+ (row: Row, rowNode: ReactNode) => {
if (onRowClick)
return (
= ({
> =
({ original }) => {
diff --git a/apps/evm/src/ui/pool/RemoveSectionLegacy.tsx b/apps/evm/src/ui/pool/RemoveSectionLegacy.tsx
index 062a48784f..3ed707e9b1 100644
--- a/apps/evm/src/ui/pool/RemoveSectionLegacy.tsx
+++ b/apps/evm/src/ui/pool/RemoveSectionLegacy.tsx
@@ -7,30 +7,7 @@ import {
useDebounce,
useIsMounted,
} from '@sushiswap/hooks'
-import { Dots } from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { createToast } from '@sushiswap/ui/components/toast'
-import {
- PermitInfo,
- PermitType,
- SushiSwapV2PoolState,
- UseCallParameters,
- getSushiSwapRouterContractConfig,
- useAccount,
- useCall,
- usePublicClient,
- useSendTransaction,
- useSushiSwapRouterContract,
- useSushiSwapV2Pool,
- useTotalSupply,
- useTransactionDeadline,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import {
- useApproved,
- useSignature,
- withCheckerRoot,
-} from '@sushiswap/wagmi/systems/Checker/Provider'
+import { Button, Dots, createToast } from '@sushiswap/ui'
import { FC, useCallback, useEffect, useMemo, useState } from 'react'
import { APPROVE_TAG_REMOVE_LEGACY } from 'src/lib/constants'
import {
@@ -45,14 +22,41 @@ import { Amount, Native } from 'sushi/currency'
import { Percent } from 'sushi/math'
import { SendTransactionReturnType, encodeFunctionData } from 'viem'
+// import {
+// PermitInfo,
+// PermitType,
+// } from 'src/lib/wagmi/hooks/approvals/hooks/useTokenPermit'
+import {
+ getSushiSwapRouterContractConfig,
+ useSushiSwapRouterContract,
+} from 'src/lib/wagmi/hooks/contracts/useSushiSwapRouter'
+import {
+ SushiSwapV2PoolState,
+ useSushiSwapV2Pool,
+} from 'src/lib/wagmi/hooks/pools/hooks/useSushiSwapV2Pools'
+import { useTotalSupply } from 'src/lib/wagmi/hooks/tokens/useTotalSupply'
+import { useTransactionDeadline } from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
+import {
+ useApproved,
+ useSignature,
+ withCheckerRoot,
+} from 'src/lib/wagmi/systems/Checker/Provider'
+import {
+ UseCallParameters,
+ useAccount,
+ useCall,
+ usePublicClient,
+ useSendTransaction,
+} from 'wagmi'
import { usePoolPosition } from './PoolPositionProvider'
import { RemoveSectionWidget } from './RemoveSectionWidget'
-const REMOVE_V2_LIQUIDITY_PERMIT_INFO: PermitInfo = {
- version: '1',
- name: 'SushiSwap LP Token',
- type: PermitType.AMOUNT,
-}
+// const REMOVE_V2_LIQUIDITY_PERMIT_INFO: PermitInfo = {
+// version: '1',
+// name: 'SushiSwap LP Token',
+// type: PermitType.AMOUNT,
+// }
interface RemoveSectionLegacyProps {
pool: Pool
@@ -429,7 +433,7 @@ export const RemoveSectionLegacy: FC =
guardWhen={+percentage <= 0}
guardText="Enter amount"
>
- =
_pool.chainId as SushiSwapV2ChainId,
).address
}
- permitInfo={REMOVE_V2_LIQUIDITY_PERMIT_INFO}
- tag={APPROVE_TAG_REMOVE_LEGACY}
- ttlStorageKey={TTLStorageKey.RemoveLiquidity}
+ // permitInfo={REMOVE_V2_LIQUIDITY_PERMIT_INFO}
+ // tag={APPROVE_TAG_REMOVE_LEGACY}
+ // ttlStorageKey={TTLStorageKey.RemoveLiquidity}
>
-
+
diff --git a/apps/evm/src/ui/pool/RemoveSectionTrident.tsx b/apps/evm/src/ui/pool/RemoveSectionTrident.tsx
deleted file mode 100644
index ad2e0cc2e5..0000000000
--- a/apps/evm/src/ui/pool/RemoveSectionTrident.tsx
+++ /dev/null
@@ -1,411 +0,0 @@
-'use client'
-
-import { Pool, Protocol } from '@sushiswap/client'
-import { SlippageToleranceStorageKey, useIsMounted } from '@sushiswap/hooks'
-import { Button } from '@sushiswap/ui/components/button'
-import { Dots } from '@sushiswap/ui/components/dots'
-import { createToast } from '@sushiswap/ui/components/toast'
-import {
- TridentConstantPoolState,
- TridentStablePoolState,
- UseCallParameters,
- getTridentRouterContractConfig,
- useAccount,
- useBentoBoxTotals,
- useCall,
- usePublicClient,
- useSendTransaction,
- useTotalSupply,
- useTridentConstantPool,
- useTridentRouterContract,
- useTridentStablePool,
-} from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import {
- useApproved,
- useApprovedActions,
- useSignature,
- withCheckerRoot,
-} from '@sushiswap/wagmi/systems/Checker/Provider'
-import { FC, useCallback, useMemo, useState } from 'react'
-import { APPROVE_TAG_REMOVE_TRIDENT } from 'src/lib/constants'
-import {
- useTokensFromPool,
- useUnderlyingTokenBalanceFromPool,
-} from 'src/lib/hooks'
-import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
-import {
- LiquidityOutput,
- approveMasterContractAction,
- batchAction,
- burnLiquidityAction,
- sweepAction,
- unwrapWETHAction,
-} from 'src/lib/pool/trident/actions'
-import { slippageAmount } from 'sushi/calculate'
-import { ChainId } from 'sushi/chain'
-import { BentoBoxChainId, TridentChainId } from 'sushi/config'
-import { Amount, Native } from 'sushi/currency'
-import { Percent } from 'sushi/math'
-
-import { SendTransactionReturnType } from 'viem'
-import { usePoolPosition } from './PoolPositionProvider'
-import { RemoveSectionWidget } from './RemoveSectionWidget'
-
-interface RemoveSectionTridentProps {
- pool: Pool
-}
-
-export const RemoveSectionTrident: FC =
- withCheckerRoot(({ pool: _pool }) => {
- const chainId = _pool.chainId as BentoBoxChainId
- const client = usePublicClient()
- const { address, chain } = useAccount()
- const { token0, token1, liquidityToken } = useTokensFromPool(_pool)
- const isMounted = useIsMounted()
- const { approved } = useApproved(APPROVE_TAG_REMOVE_TRIDENT)
- const { signature } = useSignature(APPROVE_TAG_REMOVE_TRIDENT)
- const { setSignature } = useApprovedActions(APPROVE_TAG_REMOVE_TRIDENT)
- const contract = useTridentRouterContract(_pool.chainId as TridentChainId)
- const [slippageTolerance] = useSlippageTolerance(
- SlippageToleranceStorageKey.RemoveLiquidity,
- )
-
- const [percentage, setPercentage] = useState('0')
- const percentToRemove = useMemo(
- () => new Percent(percentage, 100),
- [percentage],
- )
- const tokens = useMemo(() => [token0, token1], [token0, token1])
- const { data: rebases } = useBentoBoxTotals({
- chainId: _pool.chainId as BentoBoxChainId,
- currencies: tokens,
- })
- const { balance } = usePoolPosition()
-
- const slpAmountToRemove = useMemo(() => {
- return balance?.multiply(percentToRemove)
- }, [balance, percentToRemove])
-
- // TODO: Standardize fee format
- const [tridentConstantPoolState, tridentConstantPool] =
- useTridentConstantPool(
- _pool.chainId as TridentChainId,
- token0,
- token1,
- _pool.swapFee * 10000,
- _pool.twapEnabled,
- )
-
- const [tridentStablePoolState, tridentStablePool] = useTridentStablePool(
- _pool.chainId as TridentChainId,
- token0,
- token1,
- _pool.swapFee * 10000,
- _pool.twapEnabled,
- )
-
- const [poolState, pool] = useMemo(() => {
- if (_pool.protocol === Protocol.BENTOBOX_STABLE)
- return [tridentStablePoolState, tridentStablePool]
- if (_pool.protocol === Protocol.BENTOBOX_CLASSIC)
- return [tridentConstantPoolState, tridentConstantPool]
-
- return [undefined, undefined]
- }, [
- _pool.protocol,
- tridentConstantPool,
- tridentConstantPoolState,
- tridentStablePool,
- tridentStablePoolState,
- ])
-
- const totalSupply = useTotalSupply(liquidityToken)
-
- const underlying = useUnderlyingTokenBalanceFromPool({
- reserve0: pool?.reserve0,
- reserve1: pool?.reserve1,
- totalSupply,
- balance: balance,
- })
-
- const [underlying0, underlying1] = underlying
-
- const currencyAToRemove = useMemo(
- () =>
- token0
- ? percentToRemove?.greaterThan('0') && underlying0
- ? Amount.fromRawAmount(
- token0,
- percentToRemove.multiply(underlying0.quotient).quotient || '0',
- )
- : Amount.fromRawAmount(token0, '0')
- : undefined,
- [token0, percentToRemove, underlying0],
- )
-
- const currencyBToRemove = useMemo(
- () =>
- token1
- ? percentToRemove?.greaterThan('0') && underlying1
- ? Amount.fromRawAmount(
- token1,
- percentToRemove.multiply(underlying1.quotient).quotient || '0',
- )
- : Amount.fromRawAmount(token1, '0')
- : undefined,
- [token1, percentToRemove, underlying1],
- )
-
- const [minAmount0, minAmount1] = useMemo(() => {
- return [
- currencyAToRemove
- ? Amount.fromRawAmount(
- currencyAToRemove.currency,
- slippageAmount(currencyAToRemove, slippageTolerance)[0],
- )
- : undefined,
- currencyBToRemove
- ? Amount.fromRawAmount(
- currencyBToRemove.currency,
- slippageAmount(currencyBToRemove, slippageTolerance)[0],
- )
- : undefined,
- ]
- }, [slippageTolerance, currencyAToRemove, currencyBToRemove])
-
- const onSuccess = useCallback(
- (hash: SendTransactionReturnType) => {
- setPercentage('0')
- setSignature(undefined)
-
- if (!chain?.id) return
-
- const ts = new Date().getTime()
- void createToast({
- account: address,
- type: 'burn',
- chainId: chain.id,
- txHash: hash,
- promise: client.waitForTransactionReceipt({ hash }),
- summary: {
- pending: `Removing liquidity from the ${token0.symbol}/${token1.symbol} pair`,
- completed: `Successfully removed liquidity from the ${token0.symbol}/${token1.symbol} pair`,
- failed: 'Something went wrong when removing liquidity',
- },
- timestamp: ts,
- groupTimestamp: ts,
- })
- },
- [client, address, chain, token0.symbol, token1.symbol, setSignature],
- )
-
- const prepare = useMemo(() => {
- try {
- if (
- !chain?.id ||
- !pool ||
- !token0 ||
- !token1 ||
- !_pool.chainId ||
- !contract ||
- !minAmount0 ||
- !minAmount1 ||
- !address ||
- !minAmount0 ||
- !minAmount1 ||
- !rebases?.[token0.wrapped.address] ||
- !rebases?.[token1.wrapped.address] ||
- !slpAmountToRemove
- )
- return undefined
-
- const liquidityOutput: LiquidityOutput[] = [
- {
- token: minAmount0.wrapped.currency.address,
- amount: minAmount0.toShare(rebases?.[token0.wrapped.address])
- .quotient,
- },
- {
- token: minAmount1.wrapped.currency.address,
- amount: minAmount1.toShare(rebases?.[token1.wrapped.address])
- .quotient,
- },
- ]
-
- let indexOfWETH = -1
- indexOfWETH =
- minAmount0.wrapped.currency.address ===
- Native.onChain(_pool.chainId).wrapped.address
- ? 0
- : indexOfWETH
- indexOfWETH =
- minAmount1.wrapped.currency.address ===
- Native.onChain(_pool.chainId).wrapped.address
- ? 1
- : indexOfWETH
-
- const actions = [
- approveMasterContractAction({ signature }),
- burnLiquidityAction({
- address: pool.liquidityToken.address,
- amount: slpAmountToRemove.quotient,
- recipient: indexOfWETH >= 0 ? contract.address : address,
- liquidityOutput,
- receiveToWallet: true,
- }),
- ]
-
- if (indexOfWETH >= 0) {
- actions.push(
- unwrapWETHAction({
- recipient: address,
- }),
- sweepAction({
- token: liquidityOutput[indexOfWETH === 0 ? 1 : 0].token,
- recipient: address,
- fromBento: false,
- }),
- )
- }
-
- return {
- account: address,
- to: contract.address,
- chainId: _pool.chainId as ChainId,
- data: batchAction({
- actions,
- }),
- } satisfies UseCallParameters
- } catch (_e: unknown) {
- return undefined
- }
- }, [
- chain?.id,
- pool,
- token0,
- token1,
- _pool.chainId,
- contract,
- minAmount0,
- minAmount1,
- address,
- rebases,
- slpAmountToRemove,
- signature,
- ])
-
- const { isError: isSimulationError } = useCall({
- ...prepare,
- query: {
- enabled: Boolean(approved && Number(percentage) > 0),
- },
- })
-
- const { sendTransactionAsync, isLoading: isWritePending } =
- useSendTransaction({
- mutation: {
- onSuccess,
- },
- })
-
- const send = useMemo(() => {
- if (!prepare || isSimulationError) return undefined
-
- return async () => {
- try {
- await sendTransactionAsync(prepare)
- } catch {}
- }
- }, [sendTransactionAsync, isSimulationError, prepare])
-
- return (
-
- 0}
- chainId={_pool.chainId as ChainId}
- percentage={percentage}
- token0={token0}
- token1={token1}
- token0Minimum={minAmount0}
- token1Minimum={minAmount1}
- setPercentage={setPercentage}
- >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
- })
diff --git a/apps/evm/src/ui/pool/RemoveSectionUnstake.tsx b/apps/evm/src/ui/pool/RemoveSectionUnstake.tsx
index 246044582f..063a561707 100644
--- a/apps/evm/src/ui/pool/RemoveSectionUnstake.tsx
+++ b/apps/evm/src/ui/pool/RemoveSectionUnstake.tsx
@@ -15,16 +15,16 @@ import {
WidgetHeader,
WidgetTitle,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Dots } from '@sushiswap/ui/components/dots'
-import { useMasterChefWithdraw } from '@sushiswap/wagmi'
-import { Checker } from '@sushiswap/wagmi/systems'
-import { withCheckerRoot } from '@sushiswap/wagmi/systems/Checker/Provider'
+import { Button } from '@sushiswap/ui'
+import { Dots } from '@sushiswap/ui'
import { FC, useMemo, useState } from 'react'
import { ChainId } from 'sushi/chain'
import { ZERO } from 'sushi/math'
import { useSWRConfig } from 'swr'
+import { useMasterChefWithdraw } from 'src/lib/wagmi/hooks/master-chef/use-master-chef-withdraw'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
+import { withCheckerRoot } from 'src/lib/wagmi/systems/Checker/Provider'
import { usePoolPositionStaked } from './PoolPositionStakedProvider'
interface AddSectionStakeProps {
diff --git a/apps/evm/src/ui/pool/RemoveSectionWidget.tsx b/apps/evm/src/ui/pool/RemoveSectionWidget.tsx
index 0017c3aa84..c3476375dc 100644
--- a/apps/evm/src/ui/pool/RemoveSectionWidget.tsx
+++ b/apps/evm/src/ui/pool/RemoveSectionWidget.tsx
@@ -11,24 +11,17 @@ import {
WidgetDescription,
WidgetFooter,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { IconButton } from '@sushiswap/ui/components/iconbutton'
-import {
- SettingsModule,
- SettingsOverlay,
-} from '@sushiswap/ui/components/settings'
-import {
- Widget,
- WidgetHeader,
- WidgetTitle,
-} from '@sushiswap/ui/components/widget'
+import { Button } from '@sushiswap/ui'
+import { IconButton } from '@sushiswap/ui'
+import { SettingsModule, SettingsOverlay } from '@sushiswap/ui'
+import { Widget, WidgetHeader, WidgetTitle } from '@sushiswap/ui'
import React, { FC, ReactNode } from 'react'
import { ChainId } from 'sushi/chain'
import { Amount, Type } from 'sushi/currency'
import { ZERO } from 'sushi/math'
import { SlippageToleranceStorageKey, TTLStorageKey } from '@sushiswap/hooks'
-import { getDefaultTTL } from '@sushiswap/wagmi'
+import { getDefaultTTL } from 'src/lib/wagmi/hooks/utils/hooks/useTransactionDeadline'
import { usePoolPosition } from './PoolPositionProvider'
interface RemoveSectionWidgetProps {
diff --git a/apps/evm/src/ui/pool/RewardSlide.tsx b/apps/evm/src/ui/pool/RewardSlide.tsx
index f91c882fa0..7c6026bbb1 100644
--- a/apps/evm/src/ui/pool/RewardSlide.tsx
+++ b/apps/evm/src/ui/pool/RewardSlide.tsx
@@ -16,11 +16,11 @@ import {
SkeletonBox,
SkeletonText,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { List } from '@sushiswap/ui/components/list/List'
-import { Checker } from '@sushiswap/wagmi/systems/Checker'
+import { Button } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { List } from '@sushiswap/ui'
import React, { FC, ReactNode, useMemo } from 'react'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
import { Chain } from 'sushi/chain'
import { formatNumber } from 'sushi/format'
import { Address } from 'viem'
diff --git a/apps/evm/src/ui/pool/RewardsSection.tsx b/apps/evm/src/ui/pool/RewardsSection.tsx
index 84700cc689..bda147dd27 100644
--- a/apps/evm/src/ui/pool/RewardsSection.tsx
+++ b/apps/evm/src/ui/pool/RewardsSection.tsx
@@ -11,12 +11,12 @@ import {
Container,
DataTable,
} from '@sushiswap/ui'
-import { Carousel } from '@sushiswap/ui/components/carousel'
-import { useAccount } from '@sushiswap/wagmi'
+import { Carousel } from '@sushiswap/ui'
import { ColumnDef, PaginationState } from '@tanstack/react-table'
import React, { FC, useCallback, useMemo, useState } from 'react'
-import { ANGLE_ENABLED_NETWORKS } from 'sushi/config'
+import { ANGLE_SUPPORTED_CHAIN_IDS } from 'sushi/config'
+import { useAccount } from 'wagmi'
import { usePoolFilters } from './PoolsFiltersProvider'
import { RewardSlide, RewardSlideSkeleton } from './RewardSlide'
import {
@@ -37,7 +37,7 @@ export const RewardsSection: FC = () => {
const { address } = useAccount()
const { chainIds, tokenSymbols } = usePoolFilters()
const { data, isInitialLoading } = useAngleRewardsMultipleChains({
- chainIds: ANGLE_ENABLED_NETWORKS,
+ chainIds: ANGLE_SUPPORTED_CHAIN_IDS,
account: address,
})
@@ -59,7 +59,9 @@ export const RewardsSection: FC = () => {
const positions = useMemo(() => {
const _tokenSymbols = tokenSymbols?.filter((el) => el !== '') || []
return (data ?? [])
- .filter((el) => chainIds.includes(el.chainId))
+ .filter((el) =>
+ chainIds.includes(el.chainId as (typeof chainIds)[number]),
+ )
.flatMap((el) => {
return Object.values(el.pools ?? {})
.filter(
@@ -87,7 +89,7 @@ export const RewardsSection: FC = () => {
<>
[0] | number>
containerWidth={1280}
- slides={chainsSorted || ANGLE_ENABLED_NETWORKS}
+ slides={chainsSorted || ANGLE_SUPPORTED_CHAIN_IDS}
render={(row) =>
typeof row === 'number' ? (
diff --git a/apps/evm/src/ui/pool/RewardsV3NameCell.tsx b/apps/evm/src/ui/pool/RewardsV3NameCell.tsx
index 5d6a9de3fe..036c4252b3 100644
--- a/apps/evm/src/ui/pool/RewardsV3NameCell.tsx
+++ b/apps/evm/src/ui/pool/RewardsV3NameCell.tsx
@@ -9,9 +9,9 @@ import {
HoverCardPrimitive,
HoverCardTrigger,
} from '@sushiswap/ui'
-import { Badge } from '@sushiswap/ui/components/badge'
-import { Currency } from '@sushiswap/ui/components/currency'
-import { NetworkIcon } from '@sushiswap/ui/components/icons'
+import { Badge } from '@sushiswap/ui'
+import { Currency } from '@sushiswap/ui'
+import { NetworkIcon } from '@sushiswap/ui'
import { Row } from '@tanstack/react-table'
import React, { FC } from 'react'
import { unwrapToken } from 'sushi/currency'
diff --git a/apps/evm/src/ui/pool/SelectFeeConcentratedWidget.tsx b/apps/evm/src/ui/pool/SelectFeeConcentratedWidget.tsx
index 597d71ea51..ca8a9bf31e 100644
--- a/apps/evm/src/ui/pool/SelectFeeConcentratedWidget.tsx
+++ b/apps/evm/src/ui/pool/SelectFeeConcentratedWidget.tsx
@@ -15,7 +15,7 @@ import {
LinkInternal,
Toggle,
} from '@sushiswap/ui'
-import { Dots } from '@sushiswap/ui/components/dots'
+import { Dots } from '@sushiswap/ui'
import React, { FC, memo, useMemo } from 'react'
import { usePoolsByTokenPair } from 'src/lib/hooks/usePoolsByTokenPair'
import { SushiSwapV3FeeAmount } from 'sushi/config'
@@ -71,19 +71,19 @@ export const SelectFeeConcentratedWidget: FC =
if (!pools) return tvlDistribution
const totalTvl = pools?.reduce(
- (acc, pool) => acc + Number(pool.totalValueLockedUSD),
+ (acc, pool) => acc + Number(pool.liquidityUSD),
0,
)
pools?.forEach((pool) => {
if (
- !FEE_OPTIONS.find((option) => option.value === Number(pool.feeTier))
+ !FEE_OPTIONS.find((option) => option.value === Number(pool.swapFee))
)
return
- const tvlShare = pool.totalValueLockedUSD / totalTvl
+ const tvlShare = pool.liquidityUSD / totalTvl
if (Number.isNaN(tvlShare)) return
- tvlDistribution.set(Number(pool.feeTier), tvlShare)
+ tvlDistribution.set(Number(pool.swapFee), tvlShare)
})
return tvlDistribution
diff --git a/apps/evm/src/ui/pool/SelectNetworkWidget.tsx b/apps/evm/src/ui/pool/SelectNetworkWidget.tsx
index cd90d6f4b7..69eb6be5a5 100644
--- a/apps/evm/src/ui/pool/SelectNetworkWidget.tsx
+++ b/apps/evm/src/ui/pool/SelectNetworkWidget.tsx
@@ -1,7 +1,7 @@
import { FormSection, NetworkSelector } from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { NetworkIcon } from '@sushiswap/ui/components/icons'
-import { SelectIcon } from '@sushiswap/ui/components/select'
+import { Button } from '@sushiswap/ui'
+import { NetworkIcon } from '@sushiswap/ui'
+import { SelectIcon } from '@sushiswap/ui'
import React, { FC, memo } from 'react'
import { ChainId, chainName } from 'sushi/chain'
diff --git a/apps/evm/src/ui/pool/SelectPoolTypeWidget.tsx b/apps/evm/src/ui/pool/SelectPoolTypeWidget.tsx
index 18543321a8..7c2015dd6e 100644
--- a/apps/evm/src/ui/pool/SelectPoolTypeWidget.tsx
+++ b/apps/evm/src/ui/pool/SelectPoolTypeWidget.tsx
@@ -3,9 +3,9 @@
import { RadioGroup } from '@headlessui/react'
import { StarIcon } from '@heroicons/react-v1/solid'
import { FormSection, classNames } from '@sushiswap/ui'
-import { CheckIcon } from '@sushiswap/ui/components/icons'
-import { PoolFinderType } from '@sushiswap/wagmi'
+import { CheckIcon } from '@sushiswap/ui'
import React, { FC, memo } from 'react'
+import { PoolFinderType } from 'src/lib/wagmi/systems/PoolFinder/types'
const POOL_OPTIONS = [
{
diff --git a/apps/evm/src/ui/pool/SelectPricesWidget.tsx b/apps/evm/src/ui/pool/SelectPricesWidget.tsx
index 12e0468dc1..e2a2fb9530 100644
--- a/apps/evm/src/ui/pool/SelectPricesWidget.tsx
+++ b/apps/evm/src/ui/pool/SelectPricesWidget.tsx
@@ -27,10 +27,8 @@ import {
TooltipTrigger,
classNames,
} from '@sushiswap/ui'
-import { SkeletonText } from '@sushiswap/ui/components/skeleton'
-import { Toggle } from '@sushiswap/ui/components/toggle'
-import { useAccount } from '@sushiswap/wagmi'
-import { useConcentratedLiquidityPositionsFromTokenId } from '@sushiswap/wagmi'
+import { SkeletonText } from '@sushiswap/ui'
+import { Toggle } from '@sushiswap/ui'
import React, {
FC,
ReactNode,
@@ -41,16 +39,26 @@ import React, {
} from 'react'
import { Bound, Field } from 'src/lib/constants'
import { useTokenAmountDollarValues } from 'src/lib/hooks'
-import { SushiSwapV3ChainId, SushiSwapV3FeeAmount } from 'sushi/config'
+import {
+ SushiSwapV3ChainId,
+ SushiSwapV3FeeAmount,
+ TICK_SPACINGS,
+} from 'sushi/config'
import { Type, tryParseAmount } from 'sushi/currency'
-import { getCapitalEfficiency, getTokenRatio } from 'sushi/pool'
+import {
+ getCapitalEfficiency,
+ getTokenRatio,
+ tickToPrice,
+} from 'sushi/pool/sushiswap-v3'
import { RadioGroup } from '@headlessui/react'
import { LockClosedIcon, LockOpenIcon } from '@heroicons/react/24/solid'
import { ExclamationTriangleIcon } from '@heroicons/react/24/solid'
import { useConcentratedLiquidityPoolStats } from '@sushiswap/react-query'
+import { useConcentratedLiquidityPositionsFromTokenId } from 'src/lib/wagmi/hooks/positions/hooks/useConcentratedPositionsFromTokenId'
import { formatPercent } from 'sushi/format'
import { Fraction } from 'sushi/math'
+import { useAccount } from 'wagmi'
import {
useConcentratedDerivedMintInfo,
useConcentratedMintActionHandlers,
@@ -64,6 +72,8 @@ enum PriceRange {
BPS_20000 = 1,
BPS_12000 = 2,
BPS_10100 = 3,
+ LEFT_SIDE = 4,
+ RIGHT_SIDE = 5,
}
enum YieldRatePeriod {
@@ -212,6 +222,46 @@ export const SelectPricesWidget: FC = ({
],
)
+ const setSingleSided = useCallback(
+ (side: 'left' | 'right') => {
+ if (!token0 || !token1 || !price || !feeAmount || !pool) return
+
+ getSetFullRange()
+
+ switch (side) {
+ case 'left': {
+ const newRightPrice = tickToPrice(
+ token0.wrapped,
+ token1.wrapped,
+ pool.tickCurrent + (invertPrice ? 1 : 0) * TICK_SPACINGS[feeAmount],
+ )
+ onRightRangeInput(newRightPrice.toFixed(6))
+ break
+ }
+ case 'right': {
+ const newLeftPrice = tickToPrice(
+ token0.wrapped,
+ token1.wrapped,
+ pool.tickCurrent + (invertPrice ? 0 : 1) * TICK_SPACINGS[feeAmount],
+ )
+ onLeftRangeInput(newLeftPrice.toFixed(6))
+ break
+ }
+ }
+ },
+ [
+ token0,
+ token1,
+ price,
+ feeAmount,
+ pool,
+ getSetFullRange,
+ invertPrice,
+ onRightRangeInput,
+ onLeftRangeInput,
+ ],
+ )
+
const formattedAmounts: {
[_formattedAmountsField in Field]: string
} = useMemo(
@@ -279,8 +329,23 @@ export const SelectPricesWidget: FC = ({
value: PriceRange.BPS_10100,
onClick: () => setPriceRange(new Fraction(10100, 10000)),
},
+ {
+ label: 'Single Sided (Left)',
+ value: PriceRange.LEFT_SIDE,
+ onClick: () => setSingleSided('left'),
+ },
+ {
+ label: 'Single Sided (Right)',
+ value: PriceRange.RIGHT_SIDE,
+ onClick: () => setSingleSided('right'),
+ },
+ ],
+ [
+ getSetFullRange,
+ setPriceRange,
+ setWeightLockedCurrencyBase,
+ setSingleSided,
],
- [getSetFullRange, setPriceRange, setWeightLockedCurrencyBase],
)
const isSorted =
@@ -497,7 +562,7 @@ export const SelectPricesWidget: FC = ({
)}
-
+
{PRICE_RANGE_OPTIONS.map(({ value, label, onClick }) => (
i.rewardPerDay > 0,
- )
-
return (
@@ -141,9 +137,6 @@ const COLUMNS = [
🧑🌾{' '}
- {incentives.length > 1
- ? `x ${incentives.length}`
- : ''}{' '}
@@ -244,11 +237,11 @@ const COLUMNS = [
{
id: 'fees1d',
header: 'Fees (24h)',
- accessorFn: (row) => row.pool.fees1d,
+ accessorFn: (row) => row.pool.feesUSD1d,
cell: (props) =>
- formatUSD(props.row.original.pool.fees1d).includes('NaN')
+ formatUSD(props.row.original.pool.feesUSD1d).includes('NaN')
? '$0.00'
- : formatUSD(props.row.original.pool.fees1d),
+ : formatUSD(props.row.original.pool.feesUSD1d),
meta: {
skeleton: ,
},
@@ -256,17 +249,10 @@ const COLUMNS = [
{
id: 'totalApr1d',
header: 'APR (24h)',
- accessorFn: (row) =>
- row.apr1d * 100 +
- row.pool.incentives
- .filter((el) => +el.rewardPerDay > 0)
- .reduce((acc, cur) => acc + cur.apr * 100, 0),
+ accessorFn: (row) => (row.apr1d + row.pool.incentiveApr) * 100,
cell: (props) => {
const totalAPR =
- props.row.original.apr1d * 100 +
- props.row.original.pool.incentives
- .filter((el) => +el.rewardPerDay > 0)
- .reduce((acc, cur) => acc + cur.apr * 100, 0)
+ (props.row.original.apr1d + props.row.original.pool.incentiveApr) * 100
return (
@@ -433,16 +419,6 @@ const COLUMNS = [
{row.original.token0.symbol} / {row.original.token1.symbol}
- {row.original.pool.protocol === Protocol.BENTOBOX_STABLE && (
-
- Trident Stable
-
- )}
- {row.original.pool.protocol === Protocol.BENTOBOX_CLASSIC && (
-
- Trident Classic
-
- )}
{row.original.pool.protocol === 'SUSHISWAP_V2' && (
SushiSwap V2
@@ -527,7 +503,7 @@ const COLUMNS = [
skeleton: ,
},
},
-] satisfies ColumnDef[]
+] satisfies ColumnDef[]
export const SmartPoolsTable = () => {
const { tokenSymbols, chainIds, protocols, farmsOnly } = usePoolFilters()
@@ -556,11 +532,11 @@ export const SmartPoolsTable = () => {
}
}, [sorting, pagination])
- const _vaults: SteerVaults = useMemo(
+ const _vaults = useMemo(
() =>
vaults
? vaults
- .filter((el) => (farmsOnly ? el.pool.incentives.length > 0 : true))
+ .filter((el) => (farmsOnly ? el.pool.isIncentivized : true))
.filter((el) =>
protocols.length > 0
? protocols.includes(el.pool.protocol)
diff --git a/apps/evm/src/ui/pool/SmartPositionsTable.tsx b/apps/evm/src/ui/pool/SmartPositionsTable.tsx
index e8e9a4340f..ccd3fd3f8a 100644
--- a/apps/evm/src/ui/pool/SmartPositionsTable.tsx
+++ b/apps/evm/src/ui/pool/SmartPositionsTable.tsx
@@ -12,15 +12,18 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@sushiswap/ui'
-import { useAccount, useSteerAccountPositionsExtended } from '@sushiswap/wagmi'
+import {
+ SteerAccountPositionExtended,
+ useSteerAccountPositionsExtended,
+} from 'src/lib/wagmi/hooks/steer/useSteerAccountPositionsExtended'
import { formatPercent } from 'sushi'
+import { useAccount } from 'wagmi'
import { APRHoverCard } from './APRHoverCard'
import {
STEER_NAME_COLUMN,
STEER_POSITION_SIZE_COLUMN,
STEER_STRATEGY_COLUMN,
} from './ConcentratedPositionsTable/Tables/Smart/columns'
-import { SteerPosition } from './ConcentratedPositionsTable/Tables/Smart/useSteerPositions'
import { usePoolFilters } from './PoolsFiltersProvider'
const COLUMNS = [
@@ -30,17 +33,12 @@ const COLUMNS = [
{
id: 'totalApr1d',
header: 'APR (24h)',
- accessorFn: (row) =>
- row.vault.apr1d * 100 +
- row.vault.pool.incentives
- .filter((el) => +el.rewardPerDay > 0)
- .reduce((acc, cur) => acc + cur.apr * 100, 0),
+ accessorFn: (row) => (row.vault.apr1d + row.vault.pool.incentiveApr) * 100,
cell: (props) => {
const totalAPR =
- props.row.original.vault.apr1d * 100 +
- props.row.original.vault.pool.incentives
- .filter((el) => +el.rewardPerDay > 0)
- .reduce((acc, cur) => acc + cur.apr * 100, 0)
+ (props.row.original.vault.apr1d +
+ props.row.original.vault.pool.incentiveApr) *
+ 100
return (
@@ -71,7 +69,7 @@ const COLUMNS = [
skeleton:
,
},
},
-] satisfies ColumnDef
[]
+] satisfies ColumnDef[]
const tableState = { sorting: [{ id: 'positionSize', desc: true }] }
@@ -106,7 +104,7 @@ export const SmartPositionsTable = () => {
`/pool/${row.vault.pool.id}/smart/${row.vault.id}`
}
columns={COLUMNS}
- data={_positions as SteerPosition[]}
+ data={_positions}
pagination={true}
onPaginationChange={setPaginationState}
state={{
diff --git a/apps/evm/src/ui/pool/Steer/SteerAPRChart/SteerAPRChart.tsx b/apps/evm/src/ui/pool/Steer/SteerAPRChart/SteerAPRChart.tsx
index 059e6cca3e..0dc338948c 100644
--- a/apps/evm/src/ui/pool/Steer/SteerAPRChart/SteerAPRChart.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerAPRChart/SteerAPRChart.tsx
@@ -1,14 +1,13 @@
'use client'
-import { Pool } from '@sushiswap/client'
-import { getSteerVaultAprTimeseries } from '@sushiswap/steer-sdk'
+import { SteerVaultId, getSteerVaultAprTimeseries } from '@sushiswap/steer-sdk'
import { useQuery } from '@tanstack/react-query'
import React, { FC } from 'react'
import { _SteerAPRChart } from './_SteerAPRChart'
interface SteerAPRChartProps {
- vault: Pool['steerVaults'][0]
+ vault: SteerVaultId
}
export const SteerAPRChart: FC = ({ vault }) => {
diff --git a/apps/evm/src/ui/pool/Steer/SteerAPRChart/_SteerAPRChart.tsx b/apps/evm/src/ui/pool/Steer/SteerAPRChart/_SteerAPRChart.tsx
index aa362fa3ed..8f6dd6b244 100644
--- a/apps/evm/src/ui/pool/Steer/SteerAPRChart/_SteerAPRChart.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerAPRChart/_SteerAPRChart.tsx
@@ -3,13 +3,20 @@
import { getSteerVaultAprTimeseries } from '@sushiswap/steer-sdk'
import { SkeletonBox } from '@sushiswap/ui'
import format from 'date-fns/format'
-import ReactECharts, { EChartsOption } from 'echarts-for-react'
import React, { useMemo } from 'react'
import ReactVirtualizedAutoSizer from 'react-virtualized-auto-sizer'
import { formatPercent } from 'sushi/format'
import tailwindConfig from 'tailwind.config.js'
import resolveConfig from 'tailwindcss/resolveConfig'
+import ReactEChartsCore from 'echarts-for-react/lib/core'
+import { EChartsOption } from 'echarts-for-react/lib/types'
+import 'echarts/lib/chart/line'
+import 'echarts/lib/component/tooltip'
+import 'echarts/lib/component/visualMap'
+import echarts from 'echarts/lib/echarts'
+import 'echarts/lib/visual/seriesColor'
+
const tailwind = resolveConfig(tailwindConfig)
interface _SteerAPRChartProps {
@@ -49,6 +56,11 @@ export function _SteerAPRChart({ timeseries, loading }: _SteerAPRChartProps) {
},
borderWidth: 0,
},
+ visualMap: {
+ show: false,
+ // @ts-ignore
+ color: [tailwind.theme.colors.blue['500']],
+ },
grid: {
top: 2,
bottom: 2,
@@ -144,7 +156,11 @@ export function _SteerAPRChart({ timeseries, loading }: _SteerAPRChartProps) {
{({ height, width }) => (
<>
{timeseries?.length ? (
-
+
) : (
= ({
@@ -65,7 +65,7 @@ export const SteerAPRHoverCard: FC
= ({
{pool.incentives.map((el) => {
const amount = tryParseAmount(
el.rewardPerDay.toString(),
- incentiveRewardToToken(el.chainId as ChainId, el),
+ incentiveRewardToToken(el.chainId, el),
)
if (!amount) return null
diff --git a/apps/evm/src/ui/pool/Steer/SteerCarousel.tsx b/apps/evm/src/ui/pool/Steer/SteerCarousel.tsx
index c439b85cc3..1be088d5d8 100644
--- a/apps/evm/src/ui/pool/Steer/SteerCarousel.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerCarousel.tsx
@@ -1,39 +1,45 @@
'use client'
-import { Pool } from '@sushiswap/client'
import { Carousel, SkeletonBox } from '@sushiswap/ui'
import { FC, useCallback, useMemo } from 'react'
+import { SteerVault } from '@sushiswap/steer-sdk'
+import type { PoolWithFeeAprs, PoolWithIncentives } from 'sushi/types'
import { SteerPoolCard } from './SteerPoolCard'
+type RequiredPool = PoolWithIncentives
+
interface SteerCarousel {
- pool?: Pool
+ pool?: RequiredPool
+ vaults?: SteerVault[]
isLoading?: boolean
}
export const SteerCarousel: FC = ({
pool,
+ vaults,
isLoading = false,
}) => {
- if (isLoading || !pool) {
+ if (isLoading || !pool || !vaults) {
return <_SteerCarouselLoading />
}
- return <_SteerCarousel pool={pool} />
+ return <_SteerCarousel pool={pool} vaults={vaults} />
}
interface _SteerCarousel {
- pool: Pool
+ pool: RequiredPool
+ vaults: SteerVault[]
}
-const _SteerCarousel: FC<_SteerCarousel> = ({ pool }) => {
+const _SteerCarousel: FC<_SteerCarousel> = ({ pool, vaults }) => {
const enabledVaults = useMemo(
- () => pool.steerVaults.filter((vault) => vault.isEnabled),
- [pool],
+ () => vaults.filter((vault) => vault.isEnabled),
+ [vaults],
)
const render = useCallback(
- (vault: Pool['steerVaults'][0]) => {
+ (vault: SteerVault) => {
return (
diff --git a/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityDistributionWidget.tsx b/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityDistributionWidget.tsx
index e5a0f0e67d..0553558f5b 100644
--- a/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityDistributionWidget.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityDistributionWidget.tsx
@@ -1,12 +1,12 @@
-import { Pool } from '@sushiswap/client'
import { CardTitle } from '@sushiswap/ui'
import React, { FC } from 'react'
+import { SteerVault } from '@sushiswap/steer-sdk'
import { SteerLiquidityInRangeChip } from './SteerLiquidityInRangeChip'
import { SteerTokenDistributionBar } from './SteerTokenDistributionBar'
interface SteerLiquidityDistributionWidgetProps {
- vault: Pool['steerVaults'][0]
+ vault: SteerVault
}
export const SteerLiquidityDistributionWidget: FC<
diff --git a/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityInRangeChip.tsx b/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityInRangeChip.tsx
index 602f24e2f4..f63158f9d1 100644
--- a/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityInRangeChip.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerLiquidityInRangeChip.tsx
@@ -1,6 +1,6 @@
'use client'
-import { Pool } from '@sushiswap/client'
+import { SteerVault } from '@sushiswap/steer-sdk'
import { Chip, SkeletonBox, classNames } from '@sushiswap/ui'
import React, { FC, useMemo } from 'react'
import { SushiSwapV3ChainId } from 'sushi/config'
@@ -8,7 +8,7 @@ import { Token } from 'sushi/currency'
import { useConcentratedActiveLiquidity } from '../../../../lib/pool/v3/use-concentrated-active-liquidity'
interface SteerLiquidityInRangeChipProps {
- vault: Pool['steerVaults'][0]
+ vault: SteerVault
}
export const SteerLiquidityInRangeChip: FC
= ({
diff --git a/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerTokenDistributionBar.tsx b/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerTokenDistributionBar.tsx
index 792c0ea8af..1c4e752dd7 100644
--- a/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerTokenDistributionBar.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerLiquidityDistributionWidget/SteerTokenDistributionBar.tsx
@@ -1,13 +1,12 @@
'use client'
-import { Pool } from '@sushiswap/client'
import { usePrices } from '@sushiswap/react-query'
-import { getTokenRatios } from '@sushiswap/steer-sdk'
+import { SteerVault, getTokenRatios } from '@sushiswap/steer-sdk'
import { useQuery } from '@tanstack/react-query'
import React from 'react'
interface SteerTokenDistributionBarProps {
- vault: Pool['steerVaults'][0]
+ vault: SteerVault
}
export function SteerTokenDistributionBar({
diff --git a/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAdd.tsx b/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAdd.tsx
index 7d807f6386..d0b7fa4062 100644
--- a/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAdd.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAdd.tsx
@@ -1,16 +1,20 @@
'use client'
import { PlusIcon } from '@heroicons/react-v1/solid'
-import { SteerVault } from '@sushiswap/client'
-import { STEER_PERIPHERY_ADDRESS, SteerChainId } from '@sushiswap/steer-sdk'
+import {
+ STEER_PERIPHERY_ADDRESS,
+ SteerChainId,
+ SteerVault,
+} from '@sushiswap/steer-sdk'
import { Button, DialogTrigger, classNames } from '@sushiswap/ui'
-import { CheckerProvider } from '@sushiswap/wagmi/systems/Checker/Provider'
import React, { FC, useMemo } from 'react'
import { ChainId } from 'sushi/chain'
import { useIsMounted } from '@sushiswap/hooks'
-import { Checker, Web3Input } from '@sushiswap/wagmi'
import { APPROVE_TAG_STEER, Field } from 'src/lib/constants'
+import { Web3Input } from 'src/lib/wagmi/components/web3-input'
+import { Checker } from 'src/lib/wagmi/systems/Checker'
+import { CheckerProvider } from 'src/lib/wagmi/systems/Checker/Provider'
import {
useSteerPositionAddActions,
useSteerPositionAddDerivedInfo,
diff --git a/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddProvider.tsx b/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddProvider.tsx
index fe5947e2ff..de59723067 100644
--- a/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddProvider.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddProvider.tsx
@@ -1,8 +1,7 @@
'use client'
-import type { SteerVault } from '@sushiswap/client'
import { useSteerVault } from '@sushiswap/client/hooks'
-import { useSteerVaultReserves } from '@sushiswap/wagmi'
+import type { SteerVault } from '@sushiswap/steer-sdk'
import {
FC,
ReactNode,
@@ -12,6 +11,7 @@ import {
useReducer,
} from 'react'
import { Field } from 'src/lib/constants'
+import { useSteerVaultReserves } from 'src/lib/wagmi/hooks/steer/useSteerVaultReserves'
import { Amount, Currency, Token, tryParseAmount } from 'sushi/currency'
interface State {
@@ -132,10 +132,7 @@ export function useSteerPositionAddDerivedInfo({
const [currencyA, currencyB] = useMemo(() => {
if (!vault) return []
- return [
- new Token({ chainId: vault.pool.chainId, ...vault.pool.token0 }),
- new Token({ chainId: vault.pool.chainId, ...vault.pool.token1 }),
- ]
+ return [new Token(vault.token0), new Token(vault.token1)]
}, [vault])
// currencies
diff --git a/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddReviewModal.tsx b/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddReviewModal.tsx
index 7ae5ceee42..c5933a5994 100644
--- a/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddReviewModal.tsx
+++ b/apps/evm/src/ui/pool/Steer/SteerLiquidityManagement/Add/SteerPositionAddReviewModal.tsx
@@ -1,7 +1,10 @@
'use client'
-import { SteerVault } from '@sushiswap/client'
-import { STEER_PERIPHERY_ADDRESS, isSteerChainId } from '@sushiswap/steer-sdk'
+import {
+ STEER_PERIPHERY_ADDRESS,
+ SteerVault,
+ isSteerChainId,
+} from '@sushiswap/steer-sdk'
import { steerPeripheryAbi } from '@sushiswap/steer-sdk/abi'
import {
Currency,
@@ -16,21 +19,11 @@ import {
createErrorToast,
createToast,
} from '@sushiswap/ui'
-import { Button } from '@sushiswap/ui/components/button'
-import { Dots } from '@sushiswap/ui/components/dots'
-import { List } from '@sushiswap/ui/components/list/List'
-import {
- UseSimulateContractParameters,
- useAccount,
- usePublicClient,
- useSimulateContract,
- useSteerAccountPosition,
- useWaitForTransactionReceipt,
- useWriteContract,
-} from '@sushiswap/wagmi'
-import { useApproved } from '@sushiswap/wagmi/systems/Checker/Provider'
+import { Button } from '@sushiswap/ui'
+import { Dots } from '@sushiswap/ui'
+import { List } from '@sushiswap/ui'
import React, { FC, ReactNode, useCallback, useMemo } from 'react'
-import { Chain, ChainId } from 'sushi/chain'
+import { Chain } from 'sushi/chain'
import { Amount } from 'sushi/currency'
import { formatUSD } from 'sushi/format'
import {
@@ -42,7 +35,14 @@ import {
import { SlippageToleranceStorageKey } from '@sushiswap/hooks'
import { APPROVE_TAG_STEER } from 'src/lib/constants'
import { useSlippageTolerance } from 'src/lib/hooks/useSlippageTolerance'
+import { useSteerAccountPosition } from 'src/lib/wagmi/hooks/steer/useSteerAccountPosition'
+import { useApproved } from 'src/lib/wagmi/systems/Checker/Provider'
import { slippageAmount } from 'sushi'
+import { UseSimulateContractParameters, usePublicClient } from 'wagmi'
+import { useAccount } from 'wagmi'
+import { useSimulateContract } from 'wagmi'
+import { useWaitForTransactionReceipt } from 'wagmi'
+import { useWriteContract } from 'wagmi'
import { useTokenAmountDollarValues } from '../../../../../lib/hooks'
import { SteerStrategyConfig } from '../../constants'
import { useSteerPositionAddDerivedInfo } from './SteerPositionAddProvider'
@@ -56,7 +56,6 @@ interface SteerPositionAddReviewModalProps {
export const SteerPositionAddReviewModal: FC =
({ vault, onSuccess: _onSuccess, successLink, children }) => {
- const { chainId } = vault as { chainId: ChainId }
const { currencies, parsedAmounts } = useSteerPositionAddDerivedInfo({
vault,
})
@@ -87,7 +86,7 @@ export const SteerPositionAddReviewModal: FC =
return [token0Amount, token1Amount]
}, [accountPosition, currencies])
const accountPositionValues = useTokenAmountDollarValues({
- chainId: chainId,
+ chainId: vault.chainId,
amounts: accountPositionAmountsArray,
})
const accountPositionValue = useMemo(
@@ -103,7 +102,7 @@ export const SteerPositionAddReviewModal: FC =
[parsedAmounts],
)
const newPositionValues = useTokenAmountDollarValues({
- chainId: chainId,
+ chainId: vault.chainId,
amounts: parsedAmountsArray,
})
const newPositionValue = useMemo(
@@ -123,7 +122,7 @@ export const SteerPositionAddReviewModal: FC =
void createToast({
account: address,
type: 'mint',
- chainId: chainId,
+ chainId: vault.chainId,
txHash: hash,
promise: client.waitForTransactionReceipt({ hash }),
summary: {
@@ -135,7 +134,7 @@ export const SteerPositionAddReviewModal: FC =
groupTimestamp: ts,
})
},
- [client, currencies, address, chainId, _onSuccess],
+ [client, currencies, address, vault.chainId, _onSuccess],
)
const onError = useCallback((e: Error) => {
@@ -145,13 +144,18 @@ export const SteerPositionAddReviewModal: FC =
}, [])
const prepare = useMemo(() => {
- if (!address || !currencies || !parsedAmounts || !isSteerChainId(chainId))
+ if (
+ !address ||
+ !currencies ||
+ !parsedAmounts ||
+ !isSteerChainId(vault.chainId)
+ )
return undefined
return {
- address: STEER_PERIPHERY_ADDRESS[chainId],
+ address: STEER_PERIPHERY_ADDRESS[vault.chainId],
abi: steerPeripheryAbi,
- chainId,
+ chainId: vault.chainId,
functionName: 'deposit',
args: [
vault.address as Address,
@@ -164,7 +168,7 @@ export const SteerPositionAddReviewModal: FC =
} satisfies UseSimulateContractParameters
}, [
address,
- chainId,
+ vault.chainId,
currencies,
parsedAmounts,
slippagePercent,
@@ -174,7 +178,7 @@ export const SteerPositionAddReviewModal: FC =
const { data: simulation, isError } = useSimulateContract({
...prepare,
query: {
- enabled: Boolean(approved && chainId === chain?.id),
+ enabled: Boolean(approved && vault.chainId === chain?.id),
},
})
@@ -214,7 +218,7 @@ export const SteerPositionAddReviewModal: FC =
}, [writeContractAsync, simulation /*, adjustedGas*/])
const { status } = useWaitForTransactionReceipt({
- chainId: chainId,
+ chainId: vault.chainId,
hash,
})
@@ -235,7 +239,7 @@ export const SteerPositionAddReviewModal: FC =
- {Chain.from(chainId)!.name}
+ {Chain.from(vault.chainId)!.name}
@@ -312,7 +316,7 @@ export const SteerPositionAddReviewModal: FC =
)}
= ({
vault,
}) => {
- const { chainId } = vault as { chainId: ChainId }
-
const client = usePublicClient()
const { address: account, chain } = useAccount()
const [value, setValue] = useState('0')
@@ -63,11 +55,11 @@ export const SteerPositionRemove: FC = ({
})
const [token0, token1] = useMemo(() => {
- const token0 = new Token({ chainId: chainId, ...vault.pool.token0 })
- const token1 = new Token({ chainId: chainId, ...vault.pool.token1 })
+ const token0 = new Token(vault.token0)
+ const token1 = new Token(vault.token1)
return [token0, token1]
- }, [chainId, vault])
+ }, [vault])
const tokenAmountsTotal = useMemo(() => {
const token0Amount = Amount.fromRawAmount(
@@ -107,7 +99,7 @@ export const SteerPositionRemove: FC = ({
void createToast({
account,
type: 'burn',
- chainId: chainId,
+ chainId: vault.chainId,
txHash: hash,
promise: client.waitForTransactionReceipt({ hash }),
summary: {
@@ -119,7 +111,7 @@ export const SteerPositionRemove: FC = ({
groupTimestamp: ts,
})
},
- [client, account, chainId, token0.symbol, token1.symbol],
+ [client, account, vault.chainId, token0.symbol, token1.symbol],
)
const onError = useCallback((e: Error) => {
@@ -134,13 +126,13 @@ export const SteerPositionRemove: FC = ({
!position ||
position?.steerTokenBalance === 0n ||
!tokenAmountsDiscounted ||
- !isSteerChainId(chainId)
+ !isSteerChainId(vault.chainId)
)
return undefined
return {
- address: vault.address as Address,
- chainId,
+ address: vault.address,
+ chainId: vault.chainId,
abi: steerMultiPositionManager,
functionName: 'withdraw',
args: [
@@ -152,7 +144,7 @@ export const SteerPositionRemove: FC = ({
} satisfies UseSimulateContractParameters
}, [
account,
- chainId,
+ vault.chainId,
position,
slippagePercent,
tokenAmountsDiscounted,
@@ -162,7 +154,7 @@ export const SteerPositionRemove: FC = ({
const { data: simulation } = useSimulateContract({
...prepare,
query: {
- enabled: prepare && chainId === chain?.id,
+ enabled: prepare && vault.chainId === chain?.id,
},
})
@@ -279,7 +271,7 @@ export const SteerPositionRemove: FC = ({
fullWidth
variant="outline"
size="xl"
- chainId={chainId}
+ chainId={vault.chainId}
>