FlashLoanLiquidate.JOJOFlashLoan has no slippage control when swapping USDC
FlashLoanLiquidate.JOJOFlashLoan has no slippage control when swapping USDC\\nIn both GeneralRepay.repayJUSD and FlashLoanRepay.JOJOFlashLoan, the user-supplied minReceive parameter is used for slippage control when swapping USDC.\\n```\\n    function JOJOFlashLoan(\\n        address asset,\\n        uint256 amount,\\n        address to,\\n        bytes calldata param\\n    ) external {\\n        (address approveTarget, address swapTarget, uint256 minReceive, bytes memory data) = abi\\n            .decode(param, (address, address, uint256, bytes));\\n        IERC20(asset).approve(approveTarget, amount);\\n        (bool success, ) = swapTarget.call(data);\\n        if (success == false) {\\n            assembly {\\n                let ptr := mload(0x40)\\n                let size := returndatasize()\\n                returndatacopy(ptr, 0, size)\\n                revert(ptr, size)\\n            }\\n        }\\n        uint256 USDCAmount = IERC20(USDC).balanceOf(address(this));\\n        require(USDCAmount >= minReceive, "receive amount is too small");\\n// rest of code\\n    function repayJUSD(\\n        address asset,\\n        uint256 amount,\\n        address to,\\n        bytes memory param\\n    ) external {\\n        IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);\\n        uint256 minReceive;\\n        if (asset != USDC) {\\n            (address approveTarget, address swapTarget, uint256 minAmount, bytes memory data) = abi\\n                .decode(param, (address, address, uint256, bytes));\\n            IERC20(asset).approve(approveTarget, amount);\\n            (bool success, ) = swapTarget.call(data);\\n            if (success == false) {\\n                assembly {\\n                    let ptr := mload(0x40)\\n                    let size := returndatasize()\\n                    returndatacopy(ptr, 0, size)\\n                    revert(ptr, size)\\n                }\\n            }\\n            minReceive = minAmount;\\n        }\\n\\n        uint256 USDCAmount = IERC20(USDC).balanceOf(address(this));\\n        require(USDCAmount >= minReceive, "receive amount is too small");\\n```\\n\\nHowever, this is not done in FlashLoanLiquidate.JOJOFlashLoan, and the lack of slippage control may expose the user to sandwich attacks when swapping USDC.
Consider making FlashLoanLiquidate.JOJOFlashLoan use the minReceive parameter for slippage control when swapping USDC.
The lack of slippage control may expose the user to sandwich attacks when swapping USDC.
```\\n    function JOJOFlashLoan(\\n        address asset,\\n        uint256 amount,\\n        address to,\\n        bytes calldata param\\n    ) external {\\n        (address approveTarget, address swapTarget, uint256 minReceive, bytes memory data) = abi\\n            .decode(param, (address, address, uint256, bytes));\\n        IERC20(asset).approve(approveTarget, amount);\\n        (bool success, ) = swapTarget.call(data);\\n        if (success == false) {\\n            assembly {\\n                let ptr := mload(0x40)\\n                let size := returndatasize()\\n                returndatacopy(ptr, 0, size)\\n                revert(ptr, size)\\n            }\\n        }\\n        uint256 USDCAmount = IERC20(USDC).balanceOf(address(this));\\n        require(USDCAmount >= minReceive, "receive amount is too small");\\n// rest of code\\n    function repayJUSD(\\n        address asset,\\n        uint256 amount,\\n        address to,\\n        bytes memory param\\n    ) external {\\n        IERC20(asset).safeTransferFrom(msg.sender, address(this), amount);\\n        uint256 minReceive;\\n        if (asset != USDC) {\\n            (address approveTarget, address swapTarget, uint256 minAmount, bytes memory data) = abi\\n                .decode(param, (address, address, uint256, bytes));\\n            IERC20(asset).approve(approveTarget, amount);\\n            (bool success, ) = swapTarget.call(data);\\n            if (success == false) {\\n                assembly {\\n                    let ptr := mload(0x40)\\n                    let size := returndatasize()\\n                    returndatacopy(ptr, 0, size)\\n                    revert(ptr, size)\\n                }\\n            }\\n            minReceive = minAmount;\\n        }\\n\\n        uint256 USDCAmount = IERC20(USDC).balanceOf(address(this));\\n        require(USDCAmount >= minReceive, "receive amount is too small");\\n```\\n