From cb84fa37df6c139ba75245efbcd528c63699f1bc Mon Sep 17 00:00:00 2001 From: FiboApe Date: Mon, 30 Jun 2025 13:58:32 -0300 Subject: [PATCH 1/4] feat(*): sunset --- .../modify-settings-modal/index.tsx | 17 ++--- .../src/frame/components/navigation/index.tsx | 28 ++++++++- .../components/dca-button/index.tsx | 3 +- .../components/position-card-button/index.tsx | 3 +- .../strategies-display-wrapper/index.tsx | 3 - .../toolbar/all-strategies-heading/index.tsx | 62 ++++++++----------- .../components/toolbar/index.tsx | 8 +-- .../components/all-strategies-table/index.tsx | 3 - apps/root/src/pages/earn/home/frame/index.tsx | 25 ++++---- .../position-summary-controls/index.tsx | 3 +- .../deposit/cta-button/index.tsx | 9 ++- apps/root/src/services/positionService.ts | 2 + .../src/components/navigation/index.tsx | 18 +++++- 13 files changed, 106 insertions(+), 78 deletions(-) diff --git a/apps/root/src/common/components/modify-settings-modal/index.tsx b/apps/root/src/common/components/modify-settings-modal/index.tsx index f7207e5d8..85333d5a4 100644 --- a/apps/root/src/common/components/modify-settings-modal/index.tsx +++ b/apps/root/src/common/components/modify-settings-modal/index.tsx @@ -69,7 +69,6 @@ import useDcaAllowanceTarget from '@hooks/useDcaAllowanceTarget'; import { abs } from '@common/utils/bigint'; import ChangesSummary from './components/changes-summary'; import { AddPositionToCalendarButton } from '../add-position-to-calendar'; -import { Chains } from '@balmy/sdk'; const StyledSummaryContainer = styled.div` display: flex; @@ -584,7 +583,6 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr const minimumTokensNeeded = usdPriceToToken(from, minimumToUse, usdPrice); - const shouldDisableIncrease = position.chainId === Chains.ROOTSTOCK.chainId; let actions: { label: React.ReactNode; onClick: () => void; @@ -609,7 +607,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr /> ), onClick: () => handleApproveToken(), - disabled: !!hasPendingApproval || shouldDisableByUsd || shouldDisableIncrease, + disabled: !!hasPendingApproval || shouldDisableByUsd || isIncreasingPosition, options: [ { text: ( @@ -627,7 +625,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr }} /> ), - disabled: !!hasPendingApproval || shouldDisableByUsd || shouldDisableIncrease, + disabled: !!hasPendingApproval || shouldDisableByUsd || isIncreasingPosition, onClick: () => handleApproveToken(true), }, ], @@ -668,7 +666,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwaps, - disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || shouldDisableIncrease, + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } @@ -680,8 +678,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwaps, - disabled: - !!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease), + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } @@ -693,8 +690,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwapsSafe, - disabled: - !!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease), + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } @@ -706,8 +702,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwapsSafe, - disabled: - !!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease), + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } diff --git a/apps/root/src/frame/components/navigation/index.tsx b/apps/root/src/frame/components/navigation/index.tsx index b84196093..5a504a9e6 100644 --- a/apps/root/src/frame/components/navigation/index.tsx +++ b/apps/root/src/frame/components/navigation/index.tsx @@ -14,7 +14,7 @@ import usePushToHistory from '@hooks/usePushToHistory'; import { changeRoute } from '@state/tabs/actions'; import { useRoute } from '@state/tabs/hooks'; import React, { useCallback } from 'react'; -import { defineMessage, useIntl } from 'react-intl'; +import { defineMessage, FormattedMessage, useIntl } from 'react-intl'; import { Switch, Navigation as NavigationUI, @@ -34,6 +34,9 @@ import { TrashIcon, MovingStarIcon, DollarSquareIcon, + Link, + Typography, + colors, } from 'ui-library'; // import { setSwitchActiveWalletOnConnectionThunk, toggleTheme } from '@state/config/actions'; // import { useSwitchActiveWalletOnConnection, useThemeMode } from '@state/config/hooks'; @@ -287,11 +290,34 @@ const Navigation = ({ children }: React.PropsWithChildren) => { ] : []; + const SunsetMessage = () => ( + + + `0px ${spacing(1)}`, + color: colors[mode].typography.white, + textDecorationColor: colors[mode].typography.white, + }} + > + + + + ); + return ( <> } + warning={} + warningLevel="error" headerContent={ maxUint32; const shouldDisableApproveButton = + true || !from || !to || !fromValue || @@ -106,7 +107,7 @@ const DcaButton = ({ cantFund || !balance || allowanceErrors || - parseUnits(fromValue, from.decimals) <= 0 || + parseUnits(fromValue, from?.decimals || 0) <= 0 || BigInt(frequencyValue) <= 0 || (shouldEnableYield && fromCanHaveYield && isUndefined(fromYield)) || (shouldEnableYield && toCanHaveYield && isUndefined(toYield)); diff --git a/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx b/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx index 4d2ab6b88..236267fa7 100644 --- a/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx +++ b/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx @@ -107,9 +107,10 @@ const PositionCardButton = ({ const fromHasYield = !!position.from.underlyingTokens.length; const toHasYield = !!position.to.underlyingTokens.length; - const canAddFunds = VERSIONS_ALLOWED_MODIFY.includes(position.version); + const canAddFunds = false && VERSIONS_ALLOWED_MODIFY.includes(position.version); const disabledIncrease = + true || disabled || !dcaTokens[`${chainId}-${position.from.address.toLowerCase()}` as TokenListId] || !dcaTokens[`${chainId}-${position.to.address.toLowerCase()}` as TokenListId] || diff --git a/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx b/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx index 91b1e2fb2..70b202235 100644 --- a/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx +++ b/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx @@ -24,7 +24,6 @@ interface StrategiesTableProps { withPagination?: boolean; showBalances?: boolean; farmsWithDepositableTokens?: FarmsWithAvailableDepositTokens; - handleMigrationModalOpen?: () => void; } const StrategiesDisplayWrapper = ({ @@ -35,7 +34,6 @@ const StrategiesDisplayWrapper = ({ withPagination, showBalances = true, farmsWithDepositableTokens, - handleMigrationModalOpen, }: StrategiesTableProps) => { const [page, setPage] = React.useState(0); const pushToHistory = usePushToHistory(); @@ -74,7 +72,6 @@ const StrategiesDisplayWrapper = ({ variant={variant} setPage={setPage} farmsWithDepositableTokens={farmsWithDepositableTokens} - handleMigrationModalOpen={handleMigrationModalOpen} /> {shouldShowMobileList ? ( ` - background-color: ${colors[palette.mode].accentPrimary}; - border-radius: 100px; - width: ${spacing(4.5)}; - height: ${spacing(4.5)}; - `} -`; +// const StyledMigrationAmount = styled(ContainerBox).attrs({ +// alignItems: 'center', +// justifyContent: 'center', +// })` +// ${({ theme: { palette, spacing } }) => ` +// background-color: ${colors[palette.mode].accentPrimary}; +// border-radius: 100px; +// width: ${spacing(4.5)}; +// height: ${spacing(4.5)}; +// `} +// `; -const AllStrategiesHeading = ({ - farmsWithDepositableTokens = [], - handleMigrationModalOpen, -}: { - farmsWithDepositableTokens?: FarmsWithAvailableDepositTokens; - handleMigrationModalOpen?: () => void; -}) => { - const { trackEvent } = useAnalytics(); +const AllStrategiesHeading = ( + { + // farmsWithDepositableTokens = [], + }: { + // farmsWithDepositableTokens?: FarmsWithAvailableDepositTokens; + } +) => { + // const { trackEvent } = useAnalytics(); const [isNotifyEmailModalOpen, setIsNotifyEmailModalOpen] = useState(false); - const migrableTokensAmount = farmsWithDepositableTokens?.filter( - (farm) => Number(farm.balance.amountInUSD) > 1 - ).length; - - const onMigrationModalOpen = () => { - if (!handleMigrationModalOpen) { - return; - } - handleMigrationModalOpen(); - trackEvent('Earn - One click migration - Table Toolbar - Open migration modal'); - }; + // const migrableTokensAmount = farmsWithDepositableTokens?.filter( + // (farm) => Number(farm.balance.amountInUSD) > 1 + // ).length; return ( <> @@ -55,7 +47,7 @@ const AllStrategiesHeading = ({ /> - + */} diff --git a/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx b/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx index a23c24c43..68fbae297 100644 --- a/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx +++ b/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx @@ -34,8 +34,7 @@ const AllStrategiesTableToolbar = ({ variant, strategiesCount, setPage, - farmsWithDepositableTokens, - handleMigrationModalOpen, + // farmsWithDepositableTokens, }: AllStrategiesTableToolbarProps) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -54,10 +53,7 @@ const AllStrategiesTableToolbar = ({ return ( {variant === StrategiesTableVariants.ALL_STRATEGIES ? ( - + ) : ( colors[mode].typography.typo1}> diff --git a/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx b/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx index ce21c7eec..3fbc560bd 100644 --- a/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx +++ b/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx @@ -11,10 +11,8 @@ const variant = StrategiesTableVariants.ALL_STRATEGIES; const AllStrategiesTable = ({ farmsWithDepositableTokens, - handleMigrationModalOpen, }: { farmsWithDepositableTokens: FarmsWithAvailableDepositTokens; - handleMigrationModalOpen: () => void; }) => { const hasFetchedAllStrategies = useHasFetchedAllStrategies(); const strategies = useAllStrategiesForTable(); @@ -34,7 +32,6 @@ const AllStrategiesTable = ({ isLoading={!hasFetchedAllStrategies} withPagination farmsWithDepositableTokens={farmsWithDepositableTokens} - handleMigrationModalOpen={handleMigrationModalOpen} /> ); }; diff --git a/apps/root/src/pages/earn/home/frame/index.tsx b/apps/root/src/pages/earn/home/frame/index.tsx index b624d35ac..1f6ab9b9e 100644 --- a/apps/root/src/pages/earn/home/frame/index.tsx +++ b/apps/root/src/pages/earn/home/frame/index.tsx @@ -9,18 +9,15 @@ import useEarnService from '@hooks/earn/useEarnService'; import AllStrategiesTable from '../components/all-strategies-table'; import useHasFetchedAllStrategies from '@hooks/earn/useHasFetchedAllStrategies'; import { FormattedMessage } from 'react-intl'; -import OneClickMigrationCard from '../components/one-click-migration-card'; import { useIsEarnMobile } from '@hooks/earn/useIsEarnMobile'; import useAvailableDepositTokens from '@hooks/earn/useAvailableDepositTokens'; -import OneClickMigrationModal from '../components/one-click-migration-modal'; const EarnFrame = () => { const dispatch = useAppDispatch(); const earnService = useEarnService(); const hasFetchedAllStrategies = useHasFetchedAllStrategies(); - const [migrationModalOpen, setMigrationModalOpen] = React.useState(false); - const { farmsWithDepositableTokens, updateFarmTokensBalances, isFetchingDepositTokenBalances } = - useAvailableDepositTokens(); + // const [migrationModalOpen, setMigrationModalOpen] = React.useState(false); + const { farmsWithDepositableTokens } = useAvailableDepositTokens(); React.useEffect(() => { dispatch(changeRoute(EARN_ROUTE.key)); }, []); @@ -34,21 +31,21 @@ const EarnFrame = () => { } }, []); - const handleMigrationModalOpen = () => { - setMigrationModalOpen(true); - void updateFarmTokensBalances(); - }; + // const handleMigrationModalOpen = () => { + // setMigrationModalOpen(true); + // void updateFarmTokensBalances(); + // }; const isEarnMobile = useIsEarnMobile(); return ( <> - setMigrationModalOpen(false)} farmsWithDepositableTokens={farmsWithDepositableTokens} isFetchingDepositTokenBalances={isFetchingDepositTokenBalances} - /> + /> */} @@ -65,17 +62,17 @@ const EarnFrame = () => { /> - + /> */} diff --git a/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx b/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx index 2100b5c2d..dd0051684 100644 --- a/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx +++ b/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx @@ -136,6 +136,7 @@ const PositionSummaryControls = ({ show, pendingTransaction, position, ownerWall React.useEffect(() => { let downloadUrl: string | null = null; const fetchPositionCsv = async () => { + console.log('fetchPositionCsv', position); const rawContent = await positionService.fetchPositionSwapsForCSV(position); const blob = new Blob([rawContent], { type: 'text/csv' }); @@ -152,7 +153,7 @@ const PositionSummaryControls = ({ show, pendingTransaction, position, ownerWall return () => { if (downloadUrl) URL.revokeObjectURL(downloadUrl); }; - }, []); + }, [position]); const onTerminate = () => { setShowTerminateModal(true); diff --git a/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx b/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx index 1b76617e6..15fbb3344 100644 --- a/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx +++ b/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx @@ -73,7 +73,14 @@ const EarnDepositCTAButton = ({ !!asset && !!depositAmount && !!balance && parseUnits(depositAmount, asset.decimals) > BigInt(balance.amount); const shouldDisableApproveButton = - !asset || !depositAmount || cantFund || !balance || isLoading || allowanceErrors || Number(depositAmount) === 0; + true || + !asset || + !depositAmount || + cantFund || + !balance || + isLoading || + allowanceErrors || + Number(depositAmount) === 0; const shouldDisableButton = shouldDisableApproveButton || !isApproved; diff --git a/apps/root/src/services/positionService.ts b/apps/root/src/services/positionService.ts index fa2fb29ce..fb07a7bed 100644 --- a/apps/root/src/services/positionService.ts +++ b/apps/root/src/services/positionService.ts @@ -464,9 +464,11 @@ export default class PositionService extends EventsManager } async fetchPositionSwapsForCSV(position: Position) { + console.log('fetchPositionSwapsForCSV', position); const hub = HUB_ADDRESS[position.version][position.chainId]; const positionId = `${position.chainId}-${hub}-${position.positionId}`; const apiData = await this.meanApiService.getDcaSwapsForExport([positionId]); + console.log('apiData', apiData, positionId, hub, position); return apiData.data; } diff --git a/packages/ui-library/src/components/navigation/index.tsx b/packages/ui-library/src/components/navigation/index.tsx index d08d36e65..f350220a6 100644 --- a/packages/ui-library/src/components/navigation/index.tsx +++ b/packages/ui-library/src/components/navigation/index.tsx @@ -22,7 +22,7 @@ import { ListItemButton } from '../listitembutton'; import { ListItemIcon } from '../listitemicon'; import { ListItemText } from '../listitemtext'; import { Container } from '../container'; -import { Link, Typography, useMediaQuery, useTheme } from '@mui/material'; +import { Alert, Link, Typography, useMediaQuery, useTheme } from '@mui/material'; import BalmyLogoLight from '../../assets/balmy-logo-light'; import BalmyLogoDark from '../../assets/balmy-logo-dark'; import styled from 'styled-components'; @@ -73,6 +73,8 @@ type NavigationProps = React.PropsWithChildren<{ headerContent?: React.ReactNode; promotedBanner?: React.ReactNode; shareReferralLink?: React.ReactNode; + warning?: React.ReactNode; + warningLevel?: 'info' | 'warning' | 'error'; }>; const drawerWidthLg = 240; @@ -344,6 +346,8 @@ const Navigation = ({ headerContent, promotedBanner, shareReferralLink, + warning, + warningLevel, }: NavigationProps) => { const [mobileOpen, setMobileOpen] = useState(false); const { @@ -403,6 +407,18 @@ const Navigation = ({ backgroundColor: colors[mode].background.secondary, }} > + {warning && ( + + {warning} + + )} Date: Wed, 2 Jul 2025 13:14:08 -0300 Subject: [PATCH 2/4] fixup! feat(*): sunset --- .../src/frame/components/navigation/index.tsx | 2 +- apps/root/src/hooks/useIsSomeWalletIndexed.ts | 22 ++++++++++++------- .../history/components/historyTable/index.tsx | 2 ++ .../pages/home/components/activity/index.tsx | 4 ++++ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/apps/root/src/frame/components/navigation/index.tsx b/apps/root/src/frame/components/navigation/index.tsx index 5a504a9e6..5d9898d2c 100644 --- a/apps/root/src/frame/components/navigation/index.tsx +++ b/apps/root/src/frame/components/navigation/index.tsx @@ -297,7 +297,7 @@ const Navigation = ({ children }: React.PropsWithChildren) => { defaultMessage="We've made the difficult decision to begin sunsetting Balmy. Starting today, deposits and increases for recurring investments, as well as earn vaults, are paused. You can read more about this decision and how it will affect you and your open positions " /> ; + +export type UnitsIndexedByChainPercentage = Record< + Address, + Record> +>; // > + export const IncludedIndexerUnitsArrayTypes: IncludedIndexerUnits[] = [ IndexerUnits.DCA, IndexerUnits.AGG_SWAPS, - IndexerUnits.ERC20_APPROVALS, - IndexerUnits.ERC20_TRANSFERS, IndexerUnits.EARN, - IndexerUnits.NATIVE_TRANSFERS, ] as const; export default function useIsSomeWalletIndexed(wallet?: Address) { diff --git a/apps/root/src/pages/history/components/historyTable/index.tsx b/apps/root/src/pages/history/components/historyTable/index.tsx index 00c31faf1..9e70650a3 100644 --- a/apps/root/src/pages/history/components/historyTable/index.tsx +++ b/apps/root/src/pages/history/components/historyTable/index.tsx @@ -562,6 +562,8 @@ const HistoryTable = ({ search, tokens, height, solid }: HistoryTableProps) => { const isLoadingWithoutEvents = isLoading && events.length === 0; const preFilteredEvents = React.useMemo( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore () => filterEventsByUnitIndexed(events, unitsByChainPercentages), [unitsByChainPercentages, events] ); diff --git a/apps/root/src/pages/home/components/activity/index.tsx b/apps/root/src/pages/home/components/activity/index.tsx index 0da1b71ea..acfa8c2d1 100644 --- a/apps/root/src/pages/home/components/activity/index.tsx +++ b/apps/root/src/pages/home/components/activity/index.tsx @@ -330,10 +330,14 @@ const Activity = ({ selectedWalletOption }: ActivityProps) => { const filteredEvents = React.useMemo(() => { if (selectedWalletOption === ALL_WALLETS) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore return filterEventsByUnitIndexed(events, unitsByChainPercentages); } else { return filterEventsByUnitIndexed( events.filter((event) => getTransactionInvolvedWallets(event).includes(selectedWalletOption)), + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore unitsByChainPercentages ); } From d0bdf04eb34324adf1ca95dd49085f47e0e316ee Mon Sep 17 00:00:00 2001 From: FiboApe Date: Wed, 2 Jul 2025 13:19:45 -0300 Subject: [PATCH 3/4] fixup! fixup! feat(*): sunset --- apps/root/src/services/positionService.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/root/src/services/positionService.ts b/apps/root/src/services/positionService.ts index fb07a7bed..fa2fb29ce 100644 --- a/apps/root/src/services/positionService.ts +++ b/apps/root/src/services/positionService.ts @@ -464,11 +464,9 @@ export default class PositionService extends EventsManager } async fetchPositionSwapsForCSV(position: Position) { - console.log('fetchPositionSwapsForCSV', position); const hub = HUB_ADDRESS[position.version][position.chainId]; const positionId = `${position.chainId}-${hub}-${position.positionId}`; const apiData = await this.meanApiService.getDcaSwapsForExport([positionId]); - console.log('apiData', apiData, positionId, hub, position); return apiData.data; } From 48b88d2934750414361c3287d87929fc1b4727d8 Mon Sep 17 00:00:00 2001 From: FiboApe Date: Wed, 2 Jul 2025 13:26:17 -0300 Subject: [PATCH 4/4] fixup! fixup! fixup! feat(*): sunset --- .../components/position-summary-controls/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx b/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx index dd0051684..98c68252e 100644 --- a/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx +++ b/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx @@ -136,7 +136,6 @@ const PositionSummaryControls = ({ show, pendingTransaction, position, ownerWall React.useEffect(() => { let downloadUrl: string | null = null; const fetchPositionCsv = async () => { - console.log('fetchPositionCsv', position); const rawContent = await positionService.fetchPositionSwapsForCSV(position); const blob = new Blob([rawContent], { type: 'text/csv' });