diff --git a/.changeset/twenty-llamas-obey.md b/.changeset/twenty-llamas-obey.md new file mode 100644 index 00000000..6190a73c --- /dev/null +++ b/.changeset/twenty-llamas-obey.md @@ -0,0 +1,5 @@ +--- +'ptokens-dapp-v2': patch +--- + +fix: enable only pegouts diff --git a/src/components/pages/swap/Swap.jsx b/src/components/pages/swap/Swap.jsx index 710d9912..70516c3d 100644 --- a/src/components/pages/swap/Swap.jsx +++ b/src/components/pages/swap/Swap.jsx @@ -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, { disabledAssets, dismissedAssets } from '../../../settings/swap-assets' +import defaultAssets, { dismissedAssets } from '../../../settings/swap-assets' import Button from '../../atoms/button/Button' import Icon from '../../atoms/icon/Icon' import Switch from '../../atoms/switch/Switch' @@ -457,42 +457,19 @@ const Swap = ({ direct control (i.e. not a CEX deposit address). ) : null} - {/* {from && - to && - (from.blockchain == 'EOS' || to.blockchain == 'EOS') && - !(dismissedAssets.includes(from.id) || dismissedAssets.includes(to.id)) ? ( - - EOS chain will soon be upgraded to pNetwork v4 and has been disabled on v2. Swaps will soon be resumed - on v4. - - ) : null} */} - {/* {from && to && (disabledAssets.includes(to.id) || to.blockchain == 'EOS')? ( - {`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegout the native token ASAP for a smooth redeem process.`} - ) : null} - {from && to && (disabledAssets.includes(from.id) || from.blockchain == 'EOS') ? ( - {`${from.name} on ${from.blockchain} has been dismissed. Proceed ASAP for a smooth redeem process.`} - ) : null} */} - {/* {from && to && (dismissedAssets.includes(to.id) || dismissedAssets.includes(from.id) || - disabledAssets.includes(to.id) - ) ? ( - - { - 'Token no longer supported. This token is no longer active on pNetwork and the redemption window via the official dApp has closed. For further assistance, please contact hello@p.network.' - } - - ) : null} */} - {from && - to && - (dismissedAssets.includes(to.id) || - dismissedAssets.includes(from.id) || - (disabledAssets.includes(to.id) && disabledAssets.includes(from.id)) || - (from.blockchain == 'EOS' && disabledAssets.includes(to.id)) || - (to.blockchain == 'EOS' && disabledAssets.includes(from.id))) ? ( - {`Token no longer supported. Please pegout towards native ${to.nativeSymbol}`} - ) : from && to && (disabledAssets.includes(from.id) || from.blockchain == 'EOS') ? ( - {`${from.name} on ${from.blockchain} has been dismissed. Proceed ASAP for a smooth redeem process.`} - ) : from && to && (disabledAssets.includes(to.id) || to.blockchain == 'EOS') ? ( - {`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegout the native token ASAP for a smooth redeem process.`} + {from && to && !dismissedAssets.includes(from.id) && !dismissedAssets.includes(to.id) ? ( + from.isNative ? ( + + {`${from.name} on ${from.blockchain} has been dismissed. Please pegout ASAP if you have pTokens.`} + + ) : to.isNative ? ( + {`Proceed ASAP for a smooth redeem process.`} + ) : ( + + {`${from.name} on ${from.blockchain} and ${to.name} on ${to.blockchain} have been dismissed. + Please pegout to ${from.nativeSymbol} if you have pTokens ASAP.`} + + ) ) : null} {to && (to.id === 'PUSDC_ON_ALGORAND_MAINNET' || diff --git a/src/hooks/use-swap.js b/src/hooks/use-swap.js index 3b93981e..f5dd3777 100644 --- a/src/hooks/use-swap.js +++ b/src/hooks/use-swap.js @@ -10,7 +10,7 @@ import { CURVE_MAX_AMOUNT, } from '../constants' import { sendEvent } from '../ga4' -import { disabledAssets, dismissedAssets } from '../settings/swap-assets' +import { dismissedAssets } 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' @@ -320,13 +320,7 @@ const useSwap = ({ return } - if ( - disabledAssets.includes(to.id) || - dismissedAssets.includes(from.id) || - dismissedAssets.includes(to.id) || - // from.blockchain === 'EOS' || - to.blockchain === 'EOS' - ) { + if (dismissedAssets.includes(to.id) || dismissedAssets.includes(from.id) || !to.isNative || from.isNative) { updateSwapButton('Disabled Swap', true) return } diff --git a/src/settings/swap-assets.js b/src/settings/swap-assets.js index 6b266ffc..28e90752 100644 --- a/src/settings/swap-assets.js +++ b/src/settings/swap-assets.js @@ -1,47 +1,6 @@ import { ChainId } from '@p.network/ptokens-constants' -export const disabledAssets = [ - 'GALA_ON_BSC_MAINNET', - '$ANRX_ON_BSC_MAINNET', - 'PBTC_ON_ETH_MAINNET', - 'PBTC_ON_BSC_MAINNET', - 'PBTC_ON_ALGORAND_MAINNET', - 'PBTC_ON_ARBITRUM_MAINNET', - 'PBTC_ON_TELOS_MAINNET', - 'PNT_ON_ARBITRUM_MAINNET', - 'PNT_ON_POLYGON_MAINNET', - 'PNT_ON_GNOSIS_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', - 'PUSDC_ON_ALGORAND_MAINNET', - 'PUSDC_ON_TELOS_MAINNET', - 'PUSDT_ON_ALGORAND_MAINNET', - 'PUSDT_ON_TELOS_MAINNET', - 'PETH_ON_TELOS_MAINNET', - 'NUCO_ON_TELOS_MAINNET', - 'ZMT_ON_BSC_MAINNET', - 'PUOS_ON_ULTRA_MAINNET', - 'WSB_ON_ETH_MAINNET', - 'PLTC_ON_ETH_MAINNET', - 'BIST_ON_BSC_MAINNET', - 'PUSDT_ON_LIBRE_MAINNET', - 'PBTC_ON_LIBRE_MAINNET', - 'IQ_ON_ETH_MAINNET', - 'PBTC_ON_EOS_MAINNET', -] - -export const dismissedAssets = [ - // 'PUSDT_ON_LIBRE_MAINNET', - // 'PBTC_ON_LIBRE_MAINNET', - // 'IQ_ON_ETH_MAINNET', - // 'PBTC_ON_EOS_MAINNET', -] +export const dismissedAssets = ['USDC_ON_ALGORAND_MAINNET', 'USDT_ON_ALGORAND_MAINNET'] const swapAssets = [ /* ################# pTokens #################*/