Skip to content

Commit

Permalink
Merge pull request #96 from pnetwork-association/feat/update-dismissed
Browse files Browse the repository at this point in the history
Feat/update dismissed
  • Loading branch information
envin3 authored Nov 4, 2024
2 parents 14b1531 + 592aa07 commit 4152b39
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/six-bears-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'ptokens-dapp-v2': minor
---

update dismissed list
28 changes: 22 additions & 6 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,47 @@ ignore:
SNYK-JS-WEB3UTILS-6229337:
- '*':
reason: will be fixed in v4 - fix planned
expires: 2024-09-10T00:00:00.000Z
expires: 2024-12-10T00:00:00.000Z
created: 2024-04-04T11:30:11.068Z
SNYK-JS-WS-7266574:
- '*':
reason: will be fixed in v4 - fix planned
expires: 2024-09-10T00:00:00.000Z
expires: 2024-12-10T00:00:00.000Z
created: 2024-08-28T11:30:11.068Z
SNYK-JS-ELLIPTIC-7577916:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-09-10T00:00:00.000Z
expires: 2024-12-10T00:00:00.000Z
created: 2024-08-28T11:30:11.068Z
SNYK-JS-ELLIPTIC-7577917:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-09-10T00:00:00.000Z
expires: 2024-12-10T00:00:00.000Z
created: 2024-08-28T11:30:11.068Z
SNYK-JS-ELLIPTIC-7577918:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-09-10T00:00:00.000Z
expires: 2024-12-10T00:00:00.000Z
created: 2024-08-28T11:30:11.068Z
SNYK-JS-MICROMATCH-6838728:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-09-10T00:00:00.000Z
expires: 2024-12-10T00:00:00.000Z
SNYK-JS-ELLIPTIC-8187303:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-12-10T00:00:00.000Z
SNYK-JS-BODYPARSER-7926860:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-12-10T00:00:00.000Z
SNYK-JS-ELLIPTIC-8172694:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-12-10T00:00:00.000Z
SNYK-JS-SECP256K1-8237220:
- '*':
reason: Will be fixed in v4 - fix planned
expires: 2024-12-10T00:00:00.000Z
created: 2024-08-28T11:30:11.068Z
patch: {}
26 changes: 23 additions & 3 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 } from '../../../settings/swap-assets'
import defaultAssets, { disabledAssets, 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 @@ -416,7 +416,8 @@ const Swap = ({
to.notifyDepositAddressWarning &&
to.id !== 'PBTC_ON_ARBITRUM_MAINNET' &&
to.id !== 'PBTC_ON_TELOS_MAINNET' &&
to.id !== 'PBTC_ON_LIBRE_MAINNET' && (
to.id !== 'PBTC_ON_LIBRE_MAINNET' &&
!(dismissedAssets.includes(from.id) || dismissedAssets.includes(to.id)) && (
<WarningEta>
Please refrain from using previously generated deposit addresses, as doing so may result in a loss
of funds.
Expand Down Expand Up @@ -456,9 +457,28 @@ const Swap = ({
direct control (i.e. not a CEX deposit address).
</InfoEta>
) : null}
{from && to && (disabledAssets.includes(from.id) || disabledAssets.includes(to.id)) ? (
{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) ? (
<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) ? (
<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)) ? (
<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}
{to &&
(to.id === 'PUSDC_ON_ALGORAND_MAINNET' ||
to.id === 'USDC_ON_ALGORAND_MAINNET' ||
Expand Down
10 changes: 8 additions & 2 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 } from '../settings/swap-assets'
import { disabledAssets, 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,7 +320,13 @@ const useSwap = ({
return
}

if (disabledAssets.includes(to.id)) {
if (
disabledAssets.includes(to.id) ||
dismissedAssets.includes(from.id) ||
dismissedAssets.includes(to.id) ||
from.blockchain === 'EOS' ||
to.blockchain === 'EOS'
) {
updateSwapButton('Disabled Swap', true)
return
}
Expand Down
8 changes: 4 additions & 4 deletions src/settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const settings = {
host: 'https://eos.greymass.com',
port: 443,
protocol: 'https',
endpoint: 'https://corsproxy.ptokens.io/v1/?apiurl=https://eos.greymass.com',
endpoint: 'https://eos.greymass.com',
label: 'EOS',
},
telos: {
Expand Down Expand Up @@ -110,10 +110,10 @@ const settings = {
},
ultra: {
chainId: 'a9c481dfbc7d9506dc7e87e9a137c931b0a9303f64fd7a1d08b8230133920097',
host: 'https://corsproxy.ptokens.io/v1/?apiurl=https://api.ultra.eossweden.org',
host: 'https://api.ultra.eossweden.org',
port: 443,
protocol: 'https',
endpoint: 'https://corsproxy.ptokens.io/v1/?apiurl=https://api.ultra.eossweden.org',
endpoint: 'https://api.ultra.eossweden.org',
label: 'Ultra',
},
arbitrum: {
Expand All @@ -122,7 +122,7 @@ const settings = {
label: 'Arbitrum',
},
luxochain: {
endpoint: 'https://corsproxy.ptokens.io/v1/?apiurl=https://lugano.nodes.luxochain.io',
endpoint: 'https://lugano.nodes.luxochain.io',
chainId: 110,
label: 'Luxochain',
},
Expand Down
14 changes: 10 additions & 4 deletions src/settings/swap-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { ChainId } from '@p.network/ptokens-constants'

export const disabledAssets = [
'GALA_ON_BSC_MAINNET',
'ANRX_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',
Expand All @@ -16,11 +14,19 @@ export const disabledAssets = [
'PSEEDS_ON_ETH_MAINNET',
'TLOS_ON_ETH_MAINNET',
'TLOS_ON_BSC_MAINNET',
'PUSDT_ON_LIBRE_MAINNET',
'PUSDC_ON_TELOS_MAINNET',
'PUSDT_ON_TELOS_MAINNET',
'PETH_ON_TELOS_MAINNET',
'NUCO_ON_TELOS_MAINNET',
'ZMT_ON_BSC_MAINNET',
'PUOS_ON_ULTRA_MAINNET',
]

export const dismissedAssets = [
'PUSDT_ON_LIBRE_MAINNET',
'PBTC_ON_LIBRE_MAINNET',
'IQ_ON_ETH_MAINNET',
'PBTC_ON_EOS_MAINNET',
]

const swapAssets = [
Expand Down

0 comments on commit 4152b39

Please sign in to comment.