Skip to content

Commit c310ac4

Browse files
committed
fix: do not allow permit for sc wallets
1 parent fc77098 commit c310ac4

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/components/transactions/Swap/actions/approval/useSwapTokenApproval.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { defaultAbiCoder, splitSignature } from 'ethers/lib/utils';
55
import { Dispatch, useEffect, useMemo, useRef, useState } from 'react';
66
import { MOCK_SIGNED_HASH } from 'src/helpers/useTransactionHandler';
77
import { calculateSignedAmount } from 'src/hooks/paraswap/common';
8+
import { useGetConnectedWalletType } from 'src/hooks/useGetConnectedWalletType';
89
import { useModalContext } from 'src/hooks/useModal';
910
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
1011
import { useRootStore } from 'src/store/root';
@@ -104,6 +105,8 @@ export const useSwapTokenApproval = ({
104105
const { sendTx, signTxData } = useWeb3Context();
105106
const [loadingPermitData, setLoadingPermitData] = useState(true);
106107

108+
const { isSmartContractWallet } = useGetConnectedWalletType();
109+
107110
const [
108111
user,
109112
generateApproval,
@@ -256,7 +259,7 @@ export const useSwapTokenApproval = ({
256259
};
257260
}, [chainId, token]);
258261

259-
const tryPermit = allowPermit && permitSupported === true;
262+
const tryPermit = allowPermit && permitSupported === true && !isSmartContractWallet;
260263
const usePermit = tryPermit && walletApprovalMethodPreference === ApprovalMethod.PERMIT;
261264

262265
const approval = async () => {

src/components/transactions/Swap/errors/shared/FlashLoanDisabledBlockingGuard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export const FlashLoanDisabledBlockingGuard = ({
7070
state.provider,
7171
state.useFlashloan,
7272
state.sourceReserve?.reserve?.flashLoanEnabled,
73+
state.destinationReserve?.reserve?.flashLoanEnabled,
7374
state.error,
7475
]);
7576

0 commit comments

Comments
 (0)