Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: increase swap hardcoded fee, closes #4984 #5104

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/app/pages/swap/alex-swap-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { isDefined, isUndefined } from '@shared/utils';
import { LoadingKeys, useLoading } from '@app/common/hooks/use-loading';
import { useWalletType } from '@app/common/use-wallet-type';
import { NonceSetter } from '@app/components/nonce-setter';
import { defaultFeesMinValuesAsMoney } from '@app/query/stacks/fees/fees.utils';
import { useCurrentStacksAccount } from '@app/store/accounts/blockchain/stacks/stacks-account.hooks';
import { useGenerateStacksContractCallUnsignedTx } from '@app/store/transactions/contract-call.hooks';
import { useSignStacksTransaction } from '@app/store/transactions/transaction.hooks';
Expand All @@ -31,7 +30,11 @@ import { oneHundredMillion, useAlexSwap } from './hooks/use-alex-swap';
import { useStacksBroadcastSwap } from './hooks/use-stacks-broadcast-swap';
import { SwapAsset, SwapFormValues } from './hooks/use-swap-form';
import { SwapContext, SwapProvider } from './swap.context';
import { migratePositiveBalancesToTop, sortSwappableAssetsBySymbol } from './swap.utils';
import {
defaultSwapFee,
migratePositiveBalancesToTop,
sortSwappableAssetsBySymbol,
} from './swap.utils';

export const alexSwapRoutes = generateSwapRoutes(<AlexSwapContainer />);

Expand Down Expand Up @@ -86,7 +89,7 @@ function AlexSwapContainer() {
]);

onSetSwapSubmissionData({
fee: isSponsoredByAlex ? '0' : defaultFeesMinValuesAsMoney[1].amount.toString(),
fee: isSponsoredByAlex ? '0' : defaultSwapFee.amount.toString(),
feeCurrency: values.feeCurrency,
feeType: values.feeType,
liquidityFee: new BigNumber(Number(lpFee)).dividedBy(oneHundredMillion).toNumber(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function SwapDetailLayout({
{tooltipLabel ? (
<BasicTooltip label={tooltipLabel} side="bottom">
<Box _hover={{ cursor: 'pointer' }} color="ink.text-subdued">
<InfoCircleIcon />
<InfoCircleIcon variant="small" />
</Box>
</BasicTooltip>
) : null}
Expand Down
7 changes: 5 additions & 2 deletions src/app/pages/swap/components/swap-details/swap-details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function RouteNames(props: { swapSubmissionData: SwapSubmissionData }) {
});
}

const sponsoredFeeLabel =
'Sponsorship may not apply when you have pending transactions. In such cases, if you choose to proceed, the associated costs will be deducted from your balance.';

export function SwapDetails() {
const { swapSubmissionData } = useSwapContext();
const { isTestnet } = useCurrentNetworkState();
Expand Down Expand Up @@ -75,11 +78,11 @@ export function SwapDetails() {
/>
<SwapDetailLayout
title="Transaction fees"
tooltipLabel="Swap transactions are sponsored by default. However, this sponsorship may not apply when you have pending transactions. In such cases, if you choose to proceed, the associated costs will be deducted from your balance."
tooltipLabel={swapSubmissionData.sponsored ? sponsoredFeeLabel : undefined}
value={
swapSubmissionData.sponsored
? 'Sponsored'
: microStxToStx(swapSubmissionData.fee).toString()
: `${microStxToStx(swapSubmissionData.fee).toString()} STX`
}
/>
<SwapDetailLayout
Expand Down
4 changes: 4 additions & 0 deletions src/app/pages/swap/swap.utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { createMoney } from '@shared/models/money.model';

import { SwapAsset } from './hooks/use-swap-form';

export const defaultSwapFee = createMoney(1000000, 'STX');

export function sortSwappableAssetsBySymbol(swappableAssets: SwapAsset[]) {
return swappableAssets
.sort((a, b) => {
Expand Down
Loading