Skip to content

Commit

Permalink
reset allowance after swap in dex swap
Browse files Browse the repository at this point in the history
  • Loading branch information
lufaque committed Feb 8, 2025
1 parent f61efda commit d19922c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 774 deletions.
1 change: 1 addition & 0 deletions contracts/DexSwap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ contract DexSwap is IDexSwap, InfraCommon, InfraStorage {
if (!isFromNative) {
IERC20(swapData.fromToken).safeIncreaseAllowance(routerAddress, fromAmount);
(success, ) = routerAddress.call(swapData.dexCallData);
IERC20(swapData.fromToken).forceApprove(routerAddress, 0);
} else {
(success, ) = routerAddress.call{value: fromAmount}(swapData.dexCallData);
}
Expand Down
Loading

0 comments on commit d19922c

Please sign in to comment.