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

Develop #90

Closed
wants to merge 4 commits into from
Closed
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
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 16 additions & 21 deletions src/components/pages/swap/Swap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { MAX_IMPACT, PBTC_ON_ETH_MAINNET_V1_MIGRATION, PUOS_ON_ULTRA_MAINNET } f
import { sendEvent } from '../../../ga4'
import { useAssets } from '../../../hooks/use-assets'
import { useSwap } from '../../../hooks/use-swap'
import defaultAssets from '../../../settings/swap-assets'
import defaultAssets, { disabledAssets } from '../../../settings/swap-assets'
import Button from '../../atoms/button/Button'
import Icon from '../../atoms/icon/Icon'
import Switch from '../../atoms/switch/Switch'
Expand Down Expand Up @@ -410,12 +410,19 @@ const Swap = ({
caution!
</InfoEta>
) : null}
{from && from.isNative && to && to && to.notifyDepositAddressWarning && (
<WarningEta>
Please refrain from using previously generated deposit addresses, as doing so may result in a loss of
funds.
</WarningEta>
)}
{from &&
from.isNative &&
to &&
to &&
to.notifyDepositAddressWarning &&
to.id !== 'PBTC_ON_ARBITRUM_MAINNET' &&
to.id !== 'PBTC_ON_TELOS_MAINNET' &&
to.id !== 'PBTC_ON_LIBRE_MAINNET' && (
<WarningEta>
Please refrain from using previously generated deposit addresses, as doing so may result in a loss
of funds.
</WarningEta>
)}
{from && from.id === 'GALA_ON_BSC_MAINNET' && to && to.id === 'GALA' ? (
<InfoEta>
You are about to pegout (redeem){' '}
Expand Down Expand Up @@ -450,20 +457,8 @@ const Swap = ({
direct control (i.e. not a CEX deposit address).
</InfoEta>
) : null}
{(from && from.id === 'GALA' && to && to.id === 'GALA_ON_BSC_MAINNET') ||
(from && from.id === '$ANRX' && to && to.id === '$ANRX_ON_BSC_MAINNET') ||
(from && from.id === 'BTC' && to && to.id === 'PBTC_ON_ARBITRUM_MAINNET') ||
(from && from.id === 'PNT_ON_ETH_MAINNET' && to && to.id === 'PNT_ON_ARBITRUM_MAINNET') ||
(from && from.id === 'ETHPNT_ON_ETH_MAINNET' && to && to.id === 'PNT_ON_ARBITRUM_MAINNET') ||
(from && from.id === 'IQ' && to && to.id === 'IQ_ON_ETH_MAINNET') ||
(from && from.id === 'KEYS' && to && to.id === 'PKEYS_ON_BSC_MAINNET') ||
(from && from.id === 'LUXO' && to && to.id === 'LUXO_ON_BSC_MAINNET') ||
(from && from.id === 'OPEN' && to && to.id === 'POPEN_ON_BSC_MAINNET') ||
(from && from.id === 'OPIUM' && to && to.id === 'POPIUM_ON_BSC_MAINNET') ||
(from && from.id === 'PTERIA' && to && to.id === 'PTERIA_ON_BSC_MAINNET') ||
(from && from.id === 'SEEDS' && to && to.id === 'PSEEDS_ON_ETH_MAINNET') ||
(from && from.id === 'ZMT' && to && to.id === 'ZMT_ON_BSC_MAINNET') ? (
<WarningEta>{`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegouts are available until 09/30/2024`}</WarningEta>
{from && to && (disabledAssets.includes(from.id) || disabledAssets.includes(to.id)) ? (
<WarningEta>{`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegout the native token ASAP for a smooth redeem process.`}</WarningEta>
) : null}
{to &&
(to.id === 'PUSDC_ON_ALGORAND_MAINNET' ||
Expand Down
17 changes: 2 additions & 15 deletions src/hooks/use-swap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
CURVE_MAX_AMOUNT,
} from '../constants'
import { sendEvent } from '../ga4'
import { disabledAssets } from '../settings/swap-assets'
import { maybeOptInAlgoApp, maybeOptInAlgoAsset } from '../store/swap/utils/opt-in-algo'
import { isValidAccountByBlockchain } from '../utils/account-validator'
import { getSwapFees, computeSwapAmount } from '../utils/fee'
Expand Down Expand Up @@ -319,21 +320,7 @@ const useSwap = ({
return
}

if (
(from.id === 'GALA' && to.id === 'GALA_ON_BSC_MAINNET') ||
(from.id === '$ANRX' && to.id === '$ANRX_ON_BSC_MAINNET') ||
(from.id === 'BTC' && to.id === 'PBTC_ON_ARBITRUM_MAINNET') ||
(from.id === 'PNT_ON_ETH_MAINNET' && to.id === 'PNT_ON_ARBITRUM_MAINNET') ||
(from.id === 'ETHPNT_ON_ETH_MAINNET' && to.id === 'PNT_ON_ARBITRUM_MAINNET') ||
(from.id === 'IQ' && to.id === 'IQ_ON_ETH_MAINNET') ||
(from.id === 'KEYS' && to.id === 'PKEYS_ON_BSC_MAINNET') ||
(from.id === 'LUXO' && to.id === 'LUXO_ON_BSC_MAINNET') ||
(from.id === 'OPEN' && to.id === 'POPEN_ON_BSC_MAINNET') ||
(from.id === 'OPIUM' && to.id === 'POPIUM_ON_BSC_MAINNET') ||
(from.id === 'PTERIA' && to.id === 'PTERIA_ON_BSC_MAINNET') ||
(from.id === 'SEEDS' && to.id === 'PSEEDS_ON_ETH_MAINNET') ||
(from.id === 'ZMT' && to.id === 'ZMT_ON_BSC_MAINNET')
) {
if (disabledAssets.includes(to.id)) {
updateSwapButton('Disabled Swap', true)
return
}
Expand Down
23 changes: 23 additions & 0 deletions src/settings/swap-assets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import { ChainId } from '@p.network/ptokens-constants'

export const disabledAssets = [
'GALA_ON_BSC_MAINNET',
'ANRX_ON_BSC_MAINNET',
'PBTC_ON_ARBITRUM_MAINNET',
'PBTC_ON_LIBRE_MAINNET',
'PBTC_ON_TELOS_MAINNET',
'PNT_ON_ARBITRUM_MAINNET',
'IQ_ON_ETH_MAINNET',
'PKEYS_ON_BSC_MAINNET',
'LUXO_ON_BSC_MAINNET',
'POPEN_ON_BSC_MAINNET',
'POPIUM_ON_BSC_MAINNET',
'PTERIA_ON_BSC_MAINNET',
'PSEEDS_ON_ETH_MAINNET',
'TLOS_ON_ETH_MAINNET',
'TLOS_ON_BSC_MAINNET',
'PUSDT_ON_LIBRE_MAINNET',
'PUSDT_ON_TELOS_MAINNET',
'PETH_ON_TELOS_MAINNET',
'NUCO_ON_TELOS_MAINNET',
'ZMT_ON_BSC_MAINNET',
]

const swapAssets = [
/* ################# pTokens #################*/
{
Expand Down
Loading