diff --git a/src/components/swap-form/swap-details/swap-details.module.css b/src/components/swap-form/swap-details/swap-details.module.css index badaf97..ac1c9d5 100644 --- a/src/components/swap-form/swap-details/swap-details.module.css +++ b/src/components/swap-form/swap-details/swap-details.module.css @@ -11,10 +11,22 @@ font-size: 14px; } +.zero_fee { + height: unset; + padding: 2px var(--half-step); + border-radius: var(--step); + font-size: 12px; + line-height: unset; + color: rgb(var(--green-color)); + background-color: rgba(var(--green-color), 0.25); +} + .toggle_button { flex: 1; display: flex; justify-content: flex-end; + align-items: center; + gap: var(--step); cursor: pointer; } diff --git a/src/components/swap-form/swap-details/swap-details.tsx b/src/components/swap-form/swap-details/swap-details.tsx index 4a1d62d..f4af20d 100644 --- a/src/components/swap-form/swap-details/swap-details.tsx +++ b/src/components/swap-form/swap-details/swap-details.tsx @@ -12,6 +12,7 @@ import { } from '../../../store/swap-routes/swap-routes-selectors'; import {formatNumber} from '../../../utils/format-number.utils'; import {getClassName} from '../../../utils/style.utils'; +import {isTolFeePromo} from '../../../utils/tol-fee.utils'; import {Skeleton} from '../../skeleton/skeleton'; interface Props extends Omit { @@ -27,6 +28,7 @@ export const SwapDetails: FC = ({ const isRoutesLoading = useIsRoutesLoadingSelector(); const swapDisplayData = useSwapDisplayDataSelector(); + const isTolPromo = isTolFeePromo(inputAsset.address, outputAsset.address); const data = useMemo(() => { if (swapDisplayData.routes.length === 0) { @@ -78,6 +80,9 @@ export const SwapDetails: FC = ({ className={styles.toggle_button} onClick={toggleAccordion} > + {isTolPromo && ( +

0% fee

+ )} = (action$, state$) => action$.pipe( @@ -28,15 +29,28 @@ const loadSwapRoutesEpic: Epic = (action$, state$) => ); } - const maxDepth = + let maxDepth = payload.inputAssetAddress === payload.outputAssetAddress ? RiskTolerance.Risky : payload.riskTolerance; + let maxSplits = payload.maxSplits; const maxSlippage = Number(state.settings.maxSlippage); const referralAddress = state.wallet.pointsState.walletPoints.data.refParent ?? state.wallet.pointsState.refWallet ?? undefined; + let partnerId: string | undefined = undefined; + + if ( + isTolFeePromo( + payload.inputAssetAddress, + payload.outputAssetAddress + ) + ) { + maxDepth = RiskTolerance.Safe; + maxSplits = 1; + partnerId = 'TolS7Promo'; + } return from( getBestRoute({ @@ -45,9 +59,10 @@ const loadSwapRoutesEpic: Epic = (action$, state$) => outputAssetAddress: payload.outputAssetAddress, senderAddress: payload.senderAddress, maxDepth, - maxSplits: payload.maxSplits, + maxSplits, maxSlippage, - referralAddress + referralAddress, + partnerId }) ).pipe( map(response => diff --git a/src/utils/tol-fee.utils.ts b/src/utils/tol-fee.utils.ts new file mode 100644 index 0000000..1fb8e4c --- /dev/null +++ b/src/utils/tol-fee.utils.ts @@ -0,0 +1,26 @@ +import {TON, USDT} from '../globals'; + +const AquaUSD = 'EQAWDyxARSl3ol2G1RMLMwepr3v6Ter5ls3jiAlheKshgg0K'; +const wsTON = 'EQB0SoxuGDx5qjVt0P_bPICFeWdFLBmVopHhjgfs0q-wsTON'; +const DONE = 'EQCgGUMB_u1Gkrskw2o407Ig8ymQmfkxWuPW2d4INuQoPFJO'; +const stTON = 'EQDNhy-nxYFgUqzfUzImBEP67JqsyMIcyk2S5_RwNNEYku0k'; +const hTON = 'EQDPdq8xjAhytYqfGSX8KcFWIReCufsB9Wdg0pLlYSO_h76w'; + +const FEE_FREE_PAIRS = [ + [AquaUSD, USDT], + [TON, wsTON], + [DONE, USDT], + [TON, stTON], + [TON, hTON] +]; + +export const isTolFeePromo = ( + inputAssetAddress: string, + outputAssetAddress: string +) => + inputAssetAddress !== outputAssetAddress && + FEE_FREE_PAIRS.some( + pair => + pair.includes(inputAssetAddress) && + pair.includes(outputAssetAddress) + );