Skip to content

Commit

Permalink
Merge pull request #89 from propeller-heads/router/hr/ENG-4277-refact…
Browse files Browse the repository at this point in the history
…or-unwrapeth

refactor: remove unnecessary checks from _unwrapEth
  • Loading branch information
royvardhan authored Feb 27, 2025
2 parents 6b57e81 + 0273f58 commit 7b06707
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions foundry/src/TychoRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
// ✷✷✷✷✷✷ ✷✷✷✷✷ ✷✷✷✷✷✷✷✷ ✷✷✷✷✷✷ ✷✷✷✷✷✷ ✷✷✷✷✷✷✷✷

error TychoRouter__AddressZero();
error TychoRouter__AmountZero();
error TychoRouter__EmptySwaps();
error TychoRouter__NegativeSlippage(uint256 amount, uint256 minAmount);
error TychoRouter__AmountInNotFullySpent(uint256 leftoverAmount);
Expand Down Expand Up @@ -440,13 +441,11 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
* @param amount of WETH to unwrap.
*/
function _unwrapETH(uint256 amount) internal {
uint256 unwrapAmount =
amount == 0 ? _weth.balanceOf(address(this)) : amount;
_weth.withdraw(unwrapAmount);
_weth.withdraw(amount);
}

/**
* @dev Allows this contract to receive native token
* @dev Allows this contract to receive native token with empty msg.data from contracts
*/
receive() external payable {
require(msg.sender.code.length != 0);
Expand Down

0 comments on commit 7b06707

Please sign in to comment.