Skip to content

Commit

Permalink
Merge pull request #102 from pnetwork-association/fix/only-pegouts
Browse files Browse the repository at this point in the history
Fix/only pegouts
  • Loading branch information
envin3 authored Nov 25, 2024
2 parents f90cdbe + 4f9da4d commit c688397
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 87 deletions.
5 changes: 5 additions & 0 deletions .changeset/twenty-llamas-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ptokens-dapp-v2': patch
---

fix: enable only pegouts
51 changes: 14 additions & 37 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, { 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'
Expand Down Expand Up @@ -457,42 +457,19 @@ const Swap = ({
direct control (i.e. not a CEX deposit address).
</InfoEta>
) : null}
{/* {from &&
to &&
(from.blockchain == 'EOS' || to.blockchain == 'EOS') &&
!(dismissedAssets.includes(from.id) || dismissedAssets.includes(to.id)) ? (
<WarningEta>
EOS chain will soon be upgraded to pNetwork v4 and has been disabled on v2. Swaps will soon be resumed
on v4.
</WarningEta>
) : null} */}
{/* {from && to && (disabledAssets.includes(to.id) || to.blockchain == 'EOS')? (
<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}
{from && to && (disabledAssets.includes(from.id) || from.blockchain == 'EOS') ? (
<WarningEta>{`${from.name} on ${from.blockchain} has been dismissed. Proceed ASAP for a smooth redeem process.`}</WarningEta>
) : null} */}
{/* {from && to && (dismissedAssets.includes(to.id) || dismissedAssets.includes(from.id) ||
disabledAssets.includes(to.id)
) ? (
<WarningEta>
{
'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 [email protected].'
}
</WarningEta>
) : 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))) ? (
<WarningEta>{`Token no longer supported. Please pegout towards native ${to.nativeSymbol}`}</WarningEta>
) : from && to && (disabledAssets.includes(from.id) || from.blockchain == 'EOS') ? (
<WarningEta>{`${from.name} on ${from.blockchain} has been dismissed. Proceed ASAP for a smooth redeem process.`}</WarningEta>
) : from && to && (disabledAssets.includes(to.id) || to.blockchain == 'EOS') ? (
<WarningEta>{`${to.name} on ${to.blockchain} has been dismissed and pegins are disabled. Pegout the native token ASAP for a smooth redeem process.`}</WarningEta>
{from && to && !dismissedAssets.includes(from.id) && !dismissedAssets.includes(to.id) ? (
from.isNative ? (
<WarningEta>
{`${from.name} on ${from.blockchain} has been dismissed. Please pegout ASAP if you have pTokens.`}
</WarningEta>
) : to.isNative ? (
<WarningEta>{`Proceed ASAP for a smooth redeem process.`}</WarningEta>
) : (
<WarningEta>
{`${from.name} on ${from.blockchain} and ${to.name} on ${to.blockchain} have been dismissed.
Please pegout to ${from.nativeSymbol} if you have pTokens ASAP.`}
</WarningEta>
)
) : null}
{to &&
(to.id === 'PUSDC_ON_ALGORAND_MAINNET' ||
Expand Down
10 changes: 2 additions & 8 deletions src/hooks/use-swap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
}
Expand Down
43 changes: 1 addition & 42 deletions src/settings/swap-assets.js
Original file line number Diff line number Diff line change
@@ -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 #################*/
Expand Down

0 comments on commit c688397

Please sign in to comment.