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

Support deposit-only mode #48

Merged
merged 1 commit into from
Aug 15, 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
6 changes: 3 additions & 3 deletions src/components/tip/TipCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ export function TipCard() {
if (!show) return null;
return (
<div className="relative px-3 py-3 w-100 sm:w-[31rem] bg-blue-500 shadow-lg rounded opacity-95">
<h2 className="text-white sm:text-lg">Bridge Tokens with Hyperlane Warp Routes!</h2>
<h2 className="text-white sm:text-lg"> ⚠️ Nautilus Bridge is in deposit-only mode.</h2>
<div className="flex items-end justify-between">
<p className="text-white mt-1.5 text-xs sm:text-sm max-w-[70%]">
Warp Routes make it easy to permissionlessly take your tokens interchain. Fork this
template to get started!
Currently, you can bridge from BSC and Solana to Nautilus. Transfers originating Nautilus
are expected to go live September 1st.
</p>
<a
href={links.github}
Expand Down
5 changes: 4 additions & 1 deletion src/consts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const isDevMode = process?.env?.NODE_ENV === 'development';
const version = process?.env?.NEXT_PUBLIC_VERSION ?? null;
const explorerApiKeys = JSON.parse(process?.env?.EXPLORER_API_KEYS || '{}');
const walletConnectProjectId = process?.env?.NEXT_PUBLIC_WALLET_CONNECT_ID || '';
const withdrawalWhitelist = process?.env?.NEXT_PUBLIC_BLOCK_WITHDRAWAL_WHITELIST || '';

interface Config {
debug: boolean; // Enables some debug features in the app
Expand All @@ -10,13 +11,15 @@ interface Config {
showTipBox: boolean; // Show/Hide the blue tip box above the main form
showDisabledTokens: boolean; // Show/Hide invalid token options in the selection modal
walletConnectProjectId: string;
withdrawalWhitelist: string; // comma-separated list of CAIP2 domains to which transfers are supported
}

export const config: Config = Object.freeze({
debug: isDevMode,
version,
explorerApiKeys,
showTipBox: false,
showTipBox: !!withdrawalWhitelist,
showDisabledTokens: false,
walletConnectProjectId,
withdrawalWhitelist,
});
7 changes: 7 additions & 0 deletions src/features/transfer/TransferTokenForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { IconButton } from '../../components/buttons/IconButton';
import { SolidButton } from '../../components/buttons/SolidButton';
import { ChevronIcon } from '../../components/icons/Chevron';
import { TextField } from '../../components/input/TextField';
import { config } from '../../consts/config';
import SwapIcon from '../../images/icons/swap.svg';
import { Color } from '../../styles/Color';
import { isValidAddress } from '../../utils/addresses';
Expand Down Expand Up @@ -458,6 +459,12 @@ function validateFormValues(
}
}

if (config.withdrawalWhitelist) {
if (!config.withdrawalWhitelist.split(',').includes(destinationCaip2Id)) {
return { destinationCaip2Id: 'Bridge is in deposit-only mode' };
}
}

return {};
}

Expand Down