Merge branch 'main' into encoding/dc/extend-transaction-to-have-selector
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
## [0.35.1](https://github.com/propeller-heads/tycho-execution/compare/0.35.0...0.35.1) (2025-02-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* (TychoRouter) Revert if empty swaps ([37efe52](https://github.com/propeller-heads/tycho-execution/commit/37efe52c10ea9028f735c3cfc15af0bc9c57a745))
|
||||
|
||||
## [0.35.0](https://github.com/propeller-heads/tycho-execution/compare/0.34.0...0.35.0) (2025-02-07)
|
||||
|
||||
|
||||
|
||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4340,7 +4340,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tycho-execution"
|
||||
version = "0.35.0"
|
||||
version = "0.35.1"
|
||||
dependencies = [
|
||||
"alloy",
|
||||
"alloy-primitives",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "tycho-execution"
|
||||
version = "0.35.0"
|
||||
version = "0.35.1"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
|
||||
@@ -17,6 +17,7 @@ import {LibSwap} from "../lib/LibSwap.sol";
|
||||
|
||||
error TychoRouter__WithdrawalFailed();
|
||||
error TychoRouter__AddressZero();
|
||||
error TychoRouter__EmptySwaps();
|
||||
error TychoRouter__NegativeSlippage(uint256 amount, uint256 minAmount);
|
||||
error TychoRouter__AmountInNotFullySpent(uint256 leftoverAmount);
|
||||
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
|
||||
@@ -191,6 +192,10 @@ contract TychoRouter is
|
||||
internal
|
||||
returns (uint256)
|
||||
{
|
||||
if (swaps_.length == 0) {
|
||||
revert TychoRouter__EmptySwaps();
|
||||
}
|
||||
|
||||
uint256 currentAmountIn;
|
||||
uint256 currentAmountOut;
|
||||
uint8 tokenInIndex = 0;
|
||||
|
||||
@@ -672,6 +672,13 @@ contract TychoRouterTest is TychoRouterTestSetup {
|
||||
assertGe(finalBalance, expAmountOut);
|
||||
}
|
||||
|
||||
function testEmptySwapsRevert() public {
|
||||
uint256 amountIn = 10 ** 18;
|
||||
bytes memory swaps = "";
|
||||
vm.expectRevert(TychoRouter__EmptySwaps.selector);
|
||||
tychoRouter.exposedSwap(amountIn, 2, swaps);
|
||||
}
|
||||
|
||||
function testSingleSwapIntegration() public {
|
||||
// Test created with calldata from our router encoder, replacing the executor
|
||||
// address with the USV2 executor address.
|
||||
|
||||
Reference in New Issue
Block a user