Compare commits
10 Commits
a82d0f2885
...
4b69a0b6bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b69a0b6bc | ||
|
|
238c4cea71 | ||
|
|
e0cc25e166 | ||
|
|
605122fa96 | ||
|
|
644790ef01 | ||
|
|
2a1662f505 | ||
|
|
23405350b6 | ||
|
|
b175834311 | ||
|
|
d775b80cca | ||
|
|
40ea447d2d |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -1,3 +1,23 @@
|
|||||||
|
## [0.131.0](https://github.com/propeller-heads/tycho-execution/compare/0.130.2...0.131.0) (2025-10-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Deploy new UniswapV4Executor to unichain and base ([605122f](https://github.com/propeller-heads/tycho-execution/commit/605122fa9693c7a885f68626dbe47b200889b946))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Forge fmt (after updating local foundry) ([e0cc25e](https://github.com/propeller-heads/tycho-execution/commit/e0cc25e1666c844392e6c6e4053e37e93ab04955))
|
||||||
|
|
||||||
|
## [0.130.2](https://github.com/propeller-heads/tycho-execution/compare/0.130.1...0.130.2) (2025-10-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Forge fmt was going crazy in this function ([40ea447](https://github.com/propeller-heads/tycho-execution/commit/40ea447d2dd2fedc9972d9fcd2cb8f56b9e44f8c))
|
||||||
|
* Make TychoEncode Send + Sync ([ef0f9ab](https://github.com/propeller-heads/tycho-execution/commit/ef0f9ab959514e2c6dcb545cad2edbfeee863c15))
|
||||||
|
|
||||||
## [0.130.1](https://github.com/propeller-heads/tycho-execution/compare/0.130.0...0.130.1) (2025-10-09)
|
## [0.130.1](https://github.com/propeller-heads/tycho-execution/compare/0.130.0...0.130.1) (2025-10-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4785,7 +4785,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.130.1"
|
version = "0.131.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy",
|
"alloy",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.130.1"
|
version = "0.131.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors."
|
description = "Provides tools for encoding and executing swaps against Tycho router and protocol executors."
|
||||||
repository = "https://github.com/propeller-heads/tycho-execution"
|
repository = "https://github.com/propeller-heads/tycho-execution"
|
||||||
|
|||||||
@@ -18,14 +18,14 @@
|
|||||||
"base": {
|
"base": {
|
||||||
"uniswap_v2": "0xF744EBfaA580cF3fFc25aD046E92BD8B770a0700",
|
"uniswap_v2": "0xF744EBfaA580cF3fFc25aD046E92BD8B770a0700",
|
||||||
"uniswap_v3": "0x647bffbf8bd72bf6341ecba8b0279e090313a40d",
|
"uniswap_v3": "0x647bffbf8bd72bf6341ecba8b0279e090313a40d",
|
||||||
"uniswap_v4": "0x7Dfa502736C7bd84DA1402F7524214215BC9534d",
|
"uniswap_v4": "0x8a3520889fE0bbF9E1F4a9724C27d8D6Ed9f0e29",
|
||||||
"uniswap_v4_hooks": "0x7Dfa502736C7bd84DA1402F7524214215BC9534d",
|
"uniswap_v4_hooks": "0x8a3520889fE0bbF9E1F4a9724C27d8D6Ed9f0e29",
|
||||||
"rfq:bebop": "0x489A3f531dA3873D6585BF3f8E0dEE48CAC6F7BC"
|
"rfq:bebop": "0x489A3f531dA3873D6585BF3f8E0dEE48CAC6F7BC"
|
||||||
},
|
},
|
||||||
"unichain": {
|
"unichain": {
|
||||||
"uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E",
|
"uniswap_v2": "0x00C1b81e3C8f6347E69e2DDb90454798A6Be975E",
|
||||||
"uniswap_v3": "0xD26A838A41af3d4815DfD745a080B2062c4124d1",
|
"uniswap_v3": "0xD26A838A41af3d4815DfD745a080B2062c4124d1",
|
||||||
"uniswap_v4": "0x647bfFbF8Bd72bF6341ECBa8B0279e090313A40D",
|
"uniswap_v4": "0x052a40Ab2875437e0fF7f68976954AD62aB1f235",
|
||||||
"uniswap_v4_hooks": "0x647bfFbF8Bd72bF6341ECBa8B0279e090313A40D"
|
"uniswap_v4_hooks": "0x052a40Ab2875437e0fF7f68976954AD62aB1f235"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -811,8 +811,9 @@ contract TychoRouter is
|
|||||||
view
|
view
|
||||||
returns (uint256)
|
returns (uint256)
|
||||||
{
|
{
|
||||||
return
|
return token == address(0)
|
||||||
token == address(0) ? owner.balance : IERC20(token).balanceOf(owner);
|
? owner.balance
|
||||||
|
: IERC20(token).balanceOf(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -93,10 +93,9 @@ contract CurveExecutor is IExecutor, RestrictTransferFrom {
|
|||||||
// crypto or llamma
|
// crypto or llamma
|
||||||
if (tokenIn == nativeToken || tokenOut == nativeToken) {
|
if (tokenIn == nativeToken || tokenOut == nativeToken) {
|
||||||
// slither-disable-next-line arbitrary-send-eth
|
// slither-disable-next-line arbitrary-send-eth
|
||||||
CryptoPoolETH(pool)
|
CryptoPoolETH(pool).exchange{value: ethAmount}(
|
||||||
.exchange{
|
uint256(int256(i)), uint256(int256(j)), amountIn, 0, true
|
||||||
value: ethAmount
|
);
|
||||||
}(uint256(int256(i)), uint256(int256(j)), amountIn, 0, true);
|
|
||||||
} else {
|
} else {
|
||||||
CryptoPool(pool)
|
CryptoPool(pool)
|
||||||
.exchange(
|
.exchange(
|
||||||
|
|||||||
@@ -42,13 +42,12 @@ contract MaverickV2Executor is IExecutor, RestrictTransferFrom {
|
|||||||
|
|
||||||
bool isTokenAIn = pool.tokenA() == tokenIn;
|
bool isTokenAIn = pool.tokenA() == tokenIn;
|
||||||
int32 tickLimit = isTokenAIn ? type(int32).max : type(int32).min;
|
int32 tickLimit = isTokenAIn ? type(int32).max : type(int32).min;
|
||||||
IMaverickV2Pool.SwapParams memory swapParams =
|
IMaverickV2Pool.SwapParams memory swapParams = IMaverickV2Pool.SwapParams({
|
||||||
IMaverickV2Pool.SwapParams({
|
amount: givenAmount,
|
||||||
amount: givenAmount,
|
tokenAIn: isTokenAIn,
|
||||||
tokenAIn: isTokenAIn,
|
exactOutput: false,
|
||||||
exactOutput: false,
|
tickLimit: tickLimit
|
||||||
tickLimit: tickLimit
|
});
|
||||||
});
|
|
||||||
|
|
||||||
_transfer(target, transferType, address(tokenIn), givenAmount);
|
_transfer(target, transferType, address(tokenIn), givenAmount);
|
||||||
|
|
||||||
|
|||||||
@@ -216,9 +216,7 @@ contract TychoRouterSequentialSwapTest is TychoRouterTestSetup {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
uint256 amountOut = tychoRouter.sequentialSwapPermit2{
|
uint256 amountOut = tychoRouter.sequentialSwapPermit2{value: amountIn}(
|
||||||
value: amountIn
|
|
||||||
}(
|
|
||||||
amountIn,
|
amountIn,
|
||||||
address(0),
|
address(0),
|
||||||
USDC_ADDR,
|
USDC_ADDR,
|
||||||
|
|||||||
@@ -222,9 +222,7 @@ contract TychoRouterSingleSwapTest is TychoRouterTestSetup {
|
|||||||
bytes memory swap =
|
bytes memory swap =
|
||||||
encodeSingleSwap(address(usv2Executor), protocolData);
|
encodeSingleSwap(address(usv2Executor), protocolData);
|
||||||
|
|
||||||
uint256 amountOut = tychoRouter.singleSwapPermit2{
|
uint256 amountOut = tychoRouter.singleSwapPermit2{value: amountIn}(
|
||||||
value: amountIn
|
|
||||||
}(
|
|
||||||
amountIn,
|
amountIn,
|
||||||
address(0),
|
address(0),
|
||||||
DAI_ADDR,
|
DAI_ADDR,
|
||||||
|
|||||||
@@ -271,9 +271,7 @@ contract TychoRouterSplitSwapTest is TychoRouterTestSetup {
|
|||||||
bytes[] memory swaps = new bytes[](1);
|
bytes[] memory swaps = new bytes[](1);
|
||||||
swaps[0] = swap;
|
swaps[0] = swap;
|
||||||
|
|
||||||
uint256 amountOut = tychoRouter.splitSwapPermit2{
|
uint256 amountOut = tychoRouter.splitSwapPermit2{value: amountIn}(
|
||||||
value: amountIn
|
|
||||||
}(
|
|
||||||
amountIn,
|
amountIn,
|
||||||
address(0),
|
address(0),
|
||||||
DAI_ADDR,
|
DAI_ADDR,
|
||||||
|
|||||||
@@ -281,6 +281,7 @@ contract UniswapV4ExecutorTestForEuler is Constants, TestUtils {
|
|||||||
|
|
||||||
UniswapV4ExecutorExposed uniswapV4Exposed;
|
UniswapV4ExecutorExposed uniswapV4Exposed;
|
||||||
IERC20 USDT = IERC20(USDT_ADDR);
|
IERC20 USDT = IERC20(USDT_ADDR);
|
||||||
|
IERC20 USDC = IERC20(USDC_ADDR);
|
||||||
IERC20 RLUSD = IERC20(RLUSD_ADDR);
|
IERC20 RLUSD = IERC20(RLUSD_ADDR);
|
||||||
IERC20 WBTC = IERC20(WBTC_ADDR);
|
IERC20 WBTC = IERC20(WBTC_ADDR);
|
||||||
|
|
||||||
@@ -364,6 +365,49 @@ contract UniswapV4ExecutorTestForEuler is Constants, TestUtils {
|
|||||||
assertTrue(WBTC.balanceOf(ALICE) == amountOut);
|
assertTrue(WBTC.balanceOf(ALICE) == amountOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testDoubleEulerSwapLowBalance() public {
|
||||||
|
// 10 USDC -(euler)-> RLUSD -(euler)-> USDT
|
||||||
|
// We use RLUSD pools because it doesn't have significant balance on the pool
|
||||||
|
// manager contract
|
||||||
|
uint256 amountIn = 10_000000;
|
||||||
|
deal(USDC_ADDR, address(uniswapV4Exposed), amountIn);
|
||||||
|
address eulerProxy = 0xe0a80d35bB6618CBA260120b279d357978c42BCE;
|
||||||
|
uint256 usdcEulerBalanceBefore = USDC.balanceOf(eulerProxy);
|
||||||
|
|
||||||
|
UniswapV4Executor.UniswapV4Pool[] memory pools =
|
||||||
|
new UniswapV4Executor.UniswapV4Pool[](2);
|
||||||
|
|
||||||
|
// USDC -> RLUSD
|
||||||
|
pools[0] = UniswapV4Executor.UniswapV4Pool({
|
||||||
|
intermediaryToken: RLUSD_ADDR,
|
||||||
|
fee: uint24(40),
|
||||||
|
tickSpacing: int24(1),
|
||||||
|
hook: address(0x8B0DAD43EA6E83B2A6a0de18c5985030ba0Da8A8),
|
||||||
|
hookData: bytes("")
|
||||||
|
});
|
||||||
|
// RLUSD -> USDT
|
||||||
|
pools[1] = UniswapV4Executor.UniswapV4Pool({
|
||||||
|
intermediaryToken: USDT_ADDR,
|
||||||
|
fee: uint24(50),
|
||||||
|
tickSpacing: int24(1),
|
||||||
|
hook: address(0xF87ACF8428F2f9403AAA0256A7272d6549ECa8A8),
|
||||||
|
hookData: bytes("")
|
||||||
|
});
|
||||||
|
|
||||||
|
bytes memory data = UniswapV4Utils.encodeExactInput(
|
||||||
|
USDC_ADDR,
|
||||||
|
USDT_ADDR,
|
||||||
|
true,
|
||||||
|
RestrictTransferFrom.TransferType.Transfer,
|
||||||
|
ALICE,
|
||||||
|
pools
|
||||||
|
);
|
||||||
|
|
||||||
|
uint256 amountOut = uniswapV4Exposed.swap(amountIn, data);
|
||||||
|
assertEq(USDC.balanceOf(eulerProxy), usdcEulerBalanceBefore + amountIn);
|
||||||
|
assertTrue(USDT.balanceOf(ALICE) == amountOut);
|
||||||
|
}
|
||||||
|
|
||||||
function testMultipleSwapLastSwapEuler() public {
|
function testMultipleSwapLastSwapEuler() public {
|
||||||
// USDC -> RLUSD -(euler)- > USDT
|
// USDC -> RLUSD -(euler)- > USDT
|
||||||
// Sanity check to see if a grouped swap with Euler in the last hop works
|
// Sanity check to see if a grouped swap with Euler in the last hop works
|
||||||
|
|||||||
Reference in New Issue
Block a user