From c44554f641f9926d0c3b026a5c5467e977377c2a Mon Sep 17 00:00:00 2001 From: JoscelynFarr Date: Fri, 26 Jan 2024 17:13:32 +0800 Subject: [PATCH] Fixed issue 49: https://github.com/sherlock-audit/2023-12-jojo-exchange-update-judging/issues/49 --- src/FundingRateArbitrage.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FundingRateArbitrage.sol b/src/FundingRateArbitrage.sol index d576f6a..2fe4fff 100644 --- a/src/FundingRateArbitrage.sol +++ b/src/FundingRateArbitrage.sol @@ -271,10 +271,10 @@ contract FundingRateArbitrage is Ownable { uint256 feeAmount = amount.decimalMul(depositFeeRate); if (feeAmount > 0) { amount -= feeAmount; - IERC20(usdc).transferFrom(msg.sender, owner(), feeAmount); + IERC20(usdc).safeTransferFrom(msg.sender, owner(), feeAmount); } uint256 earnUSDCAmount = amount.decimalDiv(getIndex()); - IERC20(usdc).transferFrom(msg.sender, address(this), amount); + IERC20(usdc).safeTransferFrom(msg.sender, address(this), amount); JOJODealer(jojoDealer).deposit(0, amount, msg.sender); earnUSDCBalance[msg.sender] += earnUSDCAmount; jusdOutside[msg.sender] += amount; @@ -321,9 +321,9 @@ contract FundingRateArbitrage is Ownable { require(USDCAmount >= withdrawSettleFee, "USDCAmount need to bigger than withdrawSettleFee"); uint256 feeAmount = (USDCAmount - withdrawSettleFee).decimalMul(withdrawFeeRate) + withdrawSettleFee; if (feeAmount > 0) { - IERC20(usdc).transfer(owner(), feeAmount); + IERC20(usdc).safeTransfer(owner(), feeAmount); } - IERC20(usdc).transfer(request.user, USDCAmount - feeAmount); + IERC20(usdc).safeTransfer(request.user, USDCAmount - feeAmount); request.isExecuted = true; totalEarnUSDCBalance -= request.earnUSDCAmount; emit PermitWithdraw(request.user, USDCAmount, feeAmount, request.earnUSDCAmount, requestIDList[i]);