Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable depositing to BNT #754

Merged
merged 2 commits into from
Nov 8, 2023
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
3 changes: 2 additions & 1 deletion src/elements/earn/pools/poolsTable/EarnTableV2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ export const EarnTableV2 = ({
id: 'actions',
Header: '',
accessor: 'pool_dlt_id',
Cell: (cellData) => PoolsTableCellActions(cellData.value),
Cell: (cellData) =>
PoolsTableCellActions(cellData.value, cellData.row.original.name),
width: 50,
minWidth: 50,
disableSortBy: true,
Expand Down
3 changes: 2 additions & 1 deletion src/elements/earn/pools/poolsTable/PoolsTableCellActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DepositDisabledModal } from 'elements/earn/pools/poolsTable/v3/DepositD
import { Navigate } from 'components/navigate/Navigate';
import { BancorURL } from 'router/bancorURL.service';

export const PoolsTableCellActions = (id: string) => {
export const PoolsTableCellActions = (id: string, symbol: string) => {
const enableDeposit = false;

const button = (onClick: () => void) => (
Expand All @@ -31,6 +31,7 @@ export const PoolsTableCellActions = (id: string) => {
<DepositDisabledModal
renderButton={(onclick) => button(onclick)}
isV3={false}
symbol={symbol}
/>
);
};
20 changes: 6 additions & 14 deletions src/elements/earn/pools/poolsTable/v3/DepositDisabledModal.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
import { useState } from 'react';
import { ModalV3 } from 'components/modal/ModalV3';
import { Navigate } from 'components/navigate/Navigate';

interface Props {
renderButton: (onClick: () => void) => React.ReactNode;
isV3: boolean;
symbol: string;
}

const V3Content = (
const V3Content = ({ symbol }: { symbol: string }) => (
<div className="leading-7 text-20 mb-30">
Deposits are currently disabled in the bancor.network UI. To deposit via
Etherscan at your own risk,{' '}
<Navigate
to="https://docs.bancor.network/guides/bancor-etherscan-guide/deposit"
className="text-primary dark:text-primary"
>
follow this guide
</Navigate>
.
Deposits to the {symbol} pool are currently disabled and are not available.
</div>
);

const V2Content = (
const V2Content = () => (
<div className="leading-7 text-20 mb-30">
Deposits are currently disabled on all v2 pools.
</div>
);

export const DepositDisabledModal = ({ renderButton, isV3 }: Props) => {
export const DepositDisabledModal = ({ renderButton, isV3, symbol }: Props) => {
const [isOpen, setIsOpen] = useState(false);

const onClose = async () => {
Expand All @@ -39,7 +31,7 @@ export const DepositDisabledModal = ({ renderButton, isV3 }: Props) => {
{renderButton(() => setIsOpen(true))}
<ModalV3 setIsOpen={onClose} isOpen={isOpen} large>
<div className="flex flex-col items-center gap-20 p-20 pb-40 text-center">
{isV3 ? V3Content : V2Content}
{isV3 ? <V3Content symbol={symbol} /> : <V2Content />}
</div>
</ModalV3>
</>
Expand Down
8 changes: 7 additions & 1 deletion src/elements/earn/pools/poolsTable/v3/DepositV3Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,13 @@ export const DepositV3Modal = ({ pool, renderButton }: Props) => {
const vaultBalance = toBigNumber(pool.poolDeficit);

if (!pool.depositingEnabled)
return <DepositDisabledModal renderButton={renderButton} isV3 />;
return (
<DepositDisabledModal
renderButton={renderButton}
isV3
symbol={pool.reserveToken.symbol}
/>
);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion src/services/observables/apiData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const apiPoolsV3$ = combineLatest([apiBntV3$]).pipe(
tkn: '0',
},
tradingEnabled: true,
depositingEnabled: true,
depositingEnabled: false,
};
return [...(await BancorApi.v3.getPools()), bntPool];
}),
Expand Down
Loading