diff --git a/packages/lib/config/app.config.ts b/packages/lib/config/app.config.ts index 44e5a931b..0409be3fb 100644 --- a/packages/lib/config/app.config.ts +++ b/packages/lib/config/app.config.ts @@ -63,5 +63,3 @@ export function getChainName(chainId: GqlChain | SupportedChainId) { export function getChainShortName(chainId: GqlChain | SupportedChainId) { return getNetworkConfig(chainId).shortName } - -export const DELEGATE_OWNER = '0xba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1b' diff --git a/packages/lib/config/config.types.ts b/packages/lib/config/config.types.ts index 45e69c9b7..e6c201d4d 100644 --- a/packages/lib/config/config.types.ts +++ b/packages/lib/config/config.types.ts @@ -109,4 +109,5 @@ export interface ProjectConfig { variantConfig?: VariantConfig defaultNetwork: GqlChain ensNetwork: GqlChain + delegateOwner: Address } diff --git a/packages/lib/config/projects/balancer.ts b/packages/lib/config/projects/balancer.ts index 9f42d06bd..6540d3fa9 100644 --- a/packages/lib/config/projects/balancer.ts +++ b/packages/lib/config/projects/balancer.ts @@ -32,4 +32,5 @@ export const ProjectConfigBalancer: ProjectConfig = { corePoolId: '0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014', // veBAL BAL8020 (Balancer 80 BAL 20 WETH) pool on Ethereum defaultNetwork: GqlChain.Mainnet, ensNetwork: GqlChain.Mainnet, + delegateOwner: '0xba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1b', } diff --git a/packages/lib/config/projects/beets.ts b/packages/lib/config/projects/beets.ts index 0a1b97bc4..64fdd5414 100644 --- a/packages/lib/config/projects/beets.ts +++ b/packages/lib/config/projects/beets.ts @@ -11,4 +11,5 @@ export const ProjectConfigBeets: ProjectConfig = { corePoolId: '0x9e4341acef4147196e99d648c5e43b3fc9d026780002000000000000000005ec', // maBEETS BEETS8020 (Fresh BEETS) pool on Fantom defaultNetwork: GqlChain.Fantom, ensNetwork: GqlChain.Fantom, + delegateOwner: '0xba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1b', // TODO update this for sonic & optimism } diff --git a/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolMetaBadges.tsx b/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolMetaBadges.tsx index 43c4de8a5..0d52dad22 100644 --- a/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolMetaBadges.tsx +++ b/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolMetaBadges.tsx @@ -1,24 +1,15 @@ 'use client' -import { - Badge, - Flex, - HStack, - Text, - Popover, - PopoverTrigger, - PopoverContent, -} from '@chakra-ui/react' +import { Badge, Flex } from '@chakra-ui/react' import { usePool } from '../../PoolProvider' import Image from 'next/image' -import { fNum } from '@repo/lib/shared/utils/numbers' -import { Repeat } from 'react-feather' import { PoolListTokenPills } from '../../PoolList/PoolListTokenPills' import { shouldHideSwapFee } from '../../pool.utils' import { getChainShortName } from '@repo/lib/config/app.config' import { PoolTypeTag } from '../PoolTypeTag' import { PoolVersionTag } from '../../PoolList/PoolListTable/PoolVersionTag' import { PoolHookTag } from '../PoolHookTag' +import { PoolSwapFees } from './PoolSwapFees' export default function PoolMetaBadges() { const { pool, chain } = usePool() @@ -46,36 +37,7 @@ export default function PoolMetaBadges() { - {!shouldHideSwapFee(pool.type) && ( - - - - - - {fNum('feePercent', pool.dynamicData.swapFee)} - - - - - - The swap fee rate earned by Liquidity Providers anytime a swap is routed through this - pool. These fees automatically accumulate into each LP’s position. - - - - )} + {!shouldHideSwapFee(pool.type) && } ) } diff --git a/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolSwapFees.tsx b/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolSwapFees.tsx new file mode 100644 index 000000000..8af7b12bd --- /dev/null +++ b/packages/lib/modules/pool/PoolDetail/PoolHeader/PoolSwapFees.tsx @@ -0,0 +1,71 @@ +import { + Popover, + PopoverTrigger, + Badge, + HStack, + PopoverContent, + Text, + VStack, + Box, +} from '@chakra-ui/react' +import { fNum } from '@repo/lib/shared/utils/numbers' +import { Repeat } from 'react-feather' +import { Pool } from '../../PoolProvider' +import { shouldCallComputeDynamicSwapFee } from '../../pool.utils' +import { FluidIcon } from '@repo/lib/shared/components/icons/FluidIcon' + +export function PoolSwapFees({ pool }: { pool: Pool }) { + const isDynamicSwapFee = shouldCallComputeDynamicSwapFee(pool) + return ( + + {({ isOpen }) => ( + <> + + + + + {isDynamicSwapFee ? ( + + + + ) : ( + + {fNum('feePercent', pool.dynamicData.swapFee)} + + )} + + + + + + + Dynamic fee percentage + + {isDynamicSwapFee ? ( + + This pool has a dynamic fee rate that may change per swap based on custom logic. + + ) : ( + + This pool has a dynamic fee rate that may be updated through Balancer governance. + + )} + + + + )} + + ) +} diff --git a/packages/lib/modules/pool/PoolDetail/PoolInfo/PoolAttributes/useFormattedPoolAttributes.tsx b/packages/lib/modules/pool/PoolDetail/PoolInfo/PoolAttributes/useFormattedPoolAttributes.tsx index daf6799ca..3a6f47ff1 100644 --- a/packages/lib/modules/pool/PoolDetail/PoolInfo/PoolAttributes/useFormattedPoolAttributes.tsx +++ b/packages/lib/modules/pool/PoolDetail/PoolInfo/PoolAttributes/useFormattedPoolAttributes.tsx @@ -3,7 +3,6 @@ import { useMemo } from 'react' import { usePool } from '../../../PoolProvider' import { format } from 'date-fns' -import { DELEGATE_OWNER } from '@repo/lib/config/app.config' import { zeroAddress } from 'viem' import { abbreviateAddress } from '@repo/lib/shared/utils/addresses' import { fNum } from '@repo/lib/shared/utils/numbers' @@ -11,12 +10,15 @@ import { isBoosted, isCowAmmPool, isStable } from '../../../pool.helpers' import { useCurrency } from '@repo/lib/shared/hooks/useCurrency' import { getPoolTypeLabel, shouldHideSwapFee } from '../../../pool.utils' import { useTokens } from '@repo/lib/modules/tokens/TokensProvider' +import { getProjectConfig } from '@repo/lib/config/getProjectConfig' export function useFormattedPoolAttributes() { const { pool } = usePool() const { toCurrency } = useCurrency() const { usdValueForBpt } = useTokens() + const { delegateOwner } = getProjectConfig() + const poolOwnerData = useMemo(() => { if (!pool) return const { owner } = pool @@ -31,7 +33,7 @@ export function useFormattedPoolAttributes() { } } - if (owner === DELEGATE_OWNER) { + if (owner === delegateOwner) { return { title: 'Delegate owner', link: '', diff --git a/packages/lib/modules/pool/pool.utils.ts b/packages/lib/modules/pool/pool.utils.ts index e856fa2a1..38f9f0435 100644 --- a/packages/lib/modules/pool/pool.utils.ts +++ b/packages/lib/modules/pool/pool.utils.ts @@ -278,6 +278,10 @@ export function shouldHideSwapFee(poolType: GqlPoolType) { return poolType === GqlPoolType.CowAmm } +export function shouldCallComputeDynamicSwapFee(pool: Pool) { + return pool.hook && pool.hook.shouldCallComputeDynamicSwapFee +} + export function getPoolDisplayTokens(pool: Pool) { return pool.poolTokens.filter(token => pool.displayTokens.find( diff --git a/packages/lib/modules/transactions/transaction-steps/receipts/receipt.hooks.integration.spec.ts b/packages/lib/modules/transactions/transaction-steps/receipts/receipt.hooks.integration.spec.ts index 71f9e995c..a4aed1398 100644 --- a/packages/lib/modules/transactions/transaction-steps/receipts/receipt.hooks.integration.spec.ts +++ b/packages/lib/modules/transactions/transaction-steps/receipts/receipt.hooks.integration.spec.ts @@ -109,7 +109,10 @@ test('queries remove liquidity transaction', async () => { expect(result.current.sentBptUnits).toBe('6439.400687368663510166') }) -describe('queries swap transaction', () => { +/* + Skip until dRPC fixes issue with polygon tx queries +*/ +describe.skip('queries swap transaction', () => { const maticAddress = '0x0000000000000000000000000000000000001010' const wMaticAddress = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' const daiAddress = '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063' diff --git a/packages/lib/shared/components/icons/FluidIcon.tsx b/packages/lib/shared/components/icons/FluidIcon.tsx new file mode 100644 index 000000000..a2d108470 --- /dev/null +++ b/packages/lib/shared/components/icons/FluidIcon.tsx @@ -0,0 +1,27 @@ +/* eslint-disable max-len */ +export function FluidIcon({ size = 20 }: { size?: number }) { + return ( + + + + + + + + + + + ) +}