Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions apps/root/src/common/components/modify-settings-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ 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;
Expand Down Expand Up @@ -583,6 +584,7 @@ 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;
Expand All @@ -607,7 +609,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr
/>
),
onClick: () => handleApproveToken(),
disabled: !!hasPendingApproval || shouldDisableByUsd,
disabled: !!hasPendingApproval || shouldDisableByUsd || shouldDisableIncrease,
options: [
{
text: (
Expand All @@ -625,7 +627,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr
}}
/>
),
disabled: !!hasPendingApproval || shouldDisableByUsd,
disabled: !!hasPendingApproval || shouldDisableByUsd || shouldDisableIncrease,
onClick: () => handleApproveToken(true),
},
],
Expand Down Expand Up @@ -666,7 +668,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr
variant: 'contained',
label: <FormattedMessage description="modifyPositionPermit2" defaultMessage="Authorize and modify position" />,
onClick: handleModifyRateAndSwaps,
disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd,
disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || shouldDisableIncrease,
},
];
}
Expand All @@ -678,7 +680,8 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr
variant: 'contained',
label: <FormattedMessage description="modifyPosition" defaultMessage="Modify position" />,
onClick: handleModifyRateAndSwaps,
disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd,
disabled:
!!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease),
},
];
}
Expand All @@ -690,7 +693,8 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr
variant: 'contained',
label: <FormattedMessage description="modifyPositionSafe" defaultMessage="Authorize and modify position" />,
onClick: handleModifyRateAndSwapsSafe,
disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd,
disabled:
!!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease),
},
];
}
Expand All @@ -702,7 +706,8 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr
variant: 'contained',
label: <FormattedMessage description="modifyPosition" defaultMessage="Modify position" />,
onClick: handleModifyRateAndSwapsSafe,
disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd,
disabled:
!!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease),
},
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ import { useTokenBalance } from '@state/balances/hooks';
import useActiveWallet from '@hooks/useActiveWallet';
import useAvailableSwapIntervals from '@hooks/useAvailableSwapIntervals';
import FormWalletSelector from '@common/components/form-wallet-selector';
import { Chains } from '@balmy/sdk';

const networkList = compact(
orderBy(
SUPPORTED_NETWORKS_DCA.map((chainId) => {
const foundNetwork = find(NETWORKS, { chainId });

if (chainId === Chains.ROOTSTOCK.chainId) {
return null;
}
if (!foundNetwork) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import useOpenConnectModal from '@hooks/useOpenConnectModal';
import { getDisplayWallet } from '@common/utils/parsing';
import useDcaTokens from '@hooks/useDcaTokens';
import { WalletActionType } from '@services/accountService';
import { Chains } from '@balmy/sdk';

const StyledCardFooterButton = styled(Button).attrs({ variant: 'outlined' })``;

Expand Down Expand Up @@ -116,6 +117,7 @@ const PositionCardButton = ({
!dcaTokens[`${chainId}-${position.from.underlyingTokens[0]?.address.toLowerCase()}` as TokenListId]) ||
(toHasYield && !dcaTokens[`${chainId}-${position.to.underlyingTokens[0]?.address.toLowerCase()}` as TokenListId]) ||
DCA_PAIR_BLACKLIST.includes(position.pairId) ||
position.chainId === Chains.ROOTSTOCK.chainId ||
!shouldEnableFrequency(
position.swapInterval.toString(),
position.from.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FormattedMessage } from 'react-intl';
import { ContainerBox, ErrorOutlineIcon, Link, Typography, colors } from 'ui-library';
import { AAVE_FROZEN_TOKENS, SONNE_FROZEN_TOKENS, YEARN_SONNE_FROZEN_TOKENS } from '@constants';
import styled from 'styled-components';
import { Chains } from '@balmy/sdk';

interface PositionWarningProps {
position: Position;
Expand Down Expand Up @@ -117,6 +118,17 @@ const PositionWarning = ({ position }: PositionWarningProps) => {
);
}

if (position.chainId === Chains.ROOTSTOCK.chainId) {
message = (
<>
<FormattedMessage
description="rootstock_warning"
defaultMessage="Rootstock has been deprecated on Balmy. Increases and deposits are disabled and swaps will not be executed. You can still withdraw and close your positions."
/>
</>
);
}

if (
YEARN_SONNE_FROZEN_TOKENS.includes(position.yields.to?.tokenAddress.toLowerCase() || '') ||
YEARN_SONNE_FROZEN_TOKENS.includes(position.yields.from?.tokenAddress.toLowerCase() || '')
Expand Down