From 353861f7385b8dff191a8a9e73657f1e226bc481 Mon Sep 17 00:00:00 2001 From: royvardhan Date: Wed, 26 Feb 2025 20:49:19 +0530 Subject: [PATCH 1/4] refactor: update unwrapEth to only check 0 amount --- foundry/src/TychoRouter.sol | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/foundry/src/TychoRouter.sol b/foundry/src/TychoRouter.sol index c29ad40..6ae3e55 100644 --- a/foundry/src/TychoRouter.sol +++ b/foundry/src/TychoRouter.sol @@ -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); @@ -440,13 +441,14 @@ 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); + if (amount == 0) { + revert TychoRouter__AmountZero(); + } + _weth.withdraw(amount); } /** - * @dev Allows this contract to receive native token + * @dev Allows this contract to receive native token from contracts */ receive() external payable { require(msg.sender.code.length != 0); From 393ed615956ce9874c29661aefb5d31b8c17cb48 Mon Sep 17 00:00:00 2001 From: Harsh Vardhan Roy <42067944+royvardhan@users.noreply.github.com> Date: Wed, 26 Feb 2025 22:59:47 +0530 Subject: [PATCH 2/4] docs: update _unwrapEth docs Co-authored-by: Tamara --- foundry/src/TychoRouter.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundry/src/TychoRouter.sol b/foundry/src/TychoRouter.sol index 6ae3e55..e6f63c1 100644 --- a/foundry/src/TychoRouter.sol +++ b/foundry/src/TychoRouter.sol @@ -448,7 +448,7 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard { } /** - * @dev Allows this contract to receive native token from contracts + * @dev Allows this contract to receive native token with empty msg.data from contracts */ receive() external payable { require(msg.sender.code.length != 0); From 0273f5827462f6f6cadb5b7e78ae7c1d0bfd2e29 Mon Sep 17 00:00:00 2001 From: royvardhan Date: Thu, 27 Feb 2025 20:08:27 +0530 Subject: [PATCH 3/4] fix: remove 0 amount check in _unwrapEth --- foundry/src/TychoRouter.sol | 3 --- 1 file changed, 3 deletions(-) diff --git a/foundry/src/TychoRouter.sol b/foundry/src/TychoRouter.sol index e6f63c1..af3d7a0 100644 --- a/foundry/src/TychoRouter.sol +++ b/foundry/src/TychoRouter.sol @@ -441,9 +441,6 @@ contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard { * @param amount of WETH to unwrap. */ function _unwrapETH(uint256 amount) internal { - if (amount == 0) { - revert TychoRouter__AmountZero(); - } _weth.withdraw(amount); } From ce14e7a52c4a5224c13e064141e3a900b7b05503 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 27 Feb 2025 14:47:13 +0000 Subject: [PATCH 4/4] chore(release): 0.53.1 [skip ci] ## [0.53.1](https://github.com/propeller-heads/tycho-execution/compare/0.53.0...0.53.1) (2025-02-27) ### Bug Fixes * remove 0 amount check in _unwrapEth ([0273f58](https://github.com/propeller-heads/tycho-execution/commit/0273f5827462f6f6cadb5b7e78ae7c1d0bfd2e29)) --- CHANGELOG.md | 7 +++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f8e72b..9c73230 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.53.1](https://github.com/propeller-heads/tycho-execution/compare/0.53.0...0.53.1) (2025-02-27) + + +### Bug Fixes + +* remove 0 amount check in _unwrapEth ([0273f58](https://github.com/propeller-heads/tycho-execution/commit/0273f5827462f6f6cadb5b7e78ae7c1d0bfd2e29)) + ## [0.53.0](https://github.com/propeller-heads/tycho-execution/compare/0.52.2...0.53.0) (2025-02-26) diff --git a/Cargo.lock b/Cargo.lock index f6a5110..0825f69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4340,7 +4340,7 @@ dependencies = [ [[package]] name = "tycho-execution" -version = "0.53.0" +version = "0.53.1" dependencies = [ "alloy", "alloy-primitives", diff --git a/Cargo.toml b/Cargo.toml index 5be79af..9eaa16e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tycho-execution" -version = "0.53.0" +version = "0.53.1" edition = "2021" [[bin]]