From 3d015cbd2f28d0a448d745f14d71f8bb97b75b50 Mon Sep 17 00:00:00 2001 From: envin Date: Tue, 23 Jan 2024 17:14:37 +0100 Subject: [PATCH] feat(swap-validator): add ethPNT as valid pegout --- src/utils/fee.js | 3 +-- src/utils/swap-valildator.js | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/fee.js b/src/utils/fee.js index 3a778fec..ca314f85 100644 --- a/src/utils/fee.js +++ b/src/utils/fee.js @@ -26,8 +26,7 @@ const getMigrationFees = (_from, _to) => { } const getSwapFees = async (_from, _to) => { - if (_from.id === ETHPNT_ON_ETH_MAINNET && _to.id === 'PNT') - return { basisPoints: 25, networkFee: 0, minProtocolFee: 0 } + if (_to.id === ETHPNT_ON_ETH_MAINNET) return { basisPoints: 25, networkFee: 0, minProtocolFee: 0 } if (_from.id === ETHPNT_ON_ETH_MAINNET) return { basisPoints: 10, networkFee: 0, minProtocolFee: 0 } try { const fromAsset = await createAsset(_from) diff --git a/src/utils/swap-valildator.js b/src/utils/swap-valildator.js index 21f2a3c1..4822bc16 100644 --- a/src/utils/swap-valildator.js +++ b/src/utils/swap-valildator.js @@ -4,6 +4,7 @@ export const isValidSwap = (from, to, assets) => { if (_.isNil(from) || _.isNil(to)) return false if (to.id === from.id) return false if (from.nativeSymbol === 'ethPNT' && to.nativeSymbol === 'PNT' && !to.isNative) return true + if (from.nativeSymbol === 'PNT' && to.nativeSymbol === 'ethPNT' && !from.isNative) return true if (!assets.find(({ id }) => from.id === id) && !assets.find(({ id }) => to.id === id)) return false if (to.isHidden) return false if (to.nativeSymbol.toLowerCase() !== from.nativeSymbol.toLowerCase()) return false