Skip to content

Commit

Permalink
fix: gas optimisations #8 (CodeArena)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximebrugel committed Feb 18, 2022
1 parent 835fb74 commit 51ccc99
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions contracts/NestedFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,8 @@ contract NestedFactory is INestedFactory, ReentrancyGuard, OwnableProxyDelegatio
(bool success, uint256[] memory amounts) = callOperator(_order, _inputToken, _outputToken);
if (success) {
require(amounts[1] <= _amountToSpend, "NF: OVERSPENT");
if (_amountToSpend > amounts[1]) {
unchecked {
SafeERC20.safeTransfer(IERC20(_inputToken), _msgSender(), _amountToSpend - amounts[1]);
}
unchecked {
SafeERC20.safeTransfer(IERC20(_inputToken), _msgSender(), _amountToSpend - amounts[1]);
}
} else {
_safeTransferWithFees(IERC20(_inputToken), _amountToSpend, _msgSender(), _nftId);
Expand Down

0 comments on commit 51ccc99

Please sign in to comment.