Commit Graph

976 Commits

Author SHA1 Message Date
dianacarvalho1
d27e628902 Merge pull request #175 from propeller-heads/encoding/dc/bin-update
feat: Update tycho-encode bin with new arguments
2025-04-23 12:31:53 +01:00
semantic-release-bot
b63aad9d2e chore(release): 1.0.2 [skip ci]
## [1.0.2](https://github.com/propeller-heads/tycho-execution/compare/1.0.1...1.0.2) (2025-04-23)

### Bug Fixes

* After merge test fixes ([4ac108e](4ac108e7d1))
2025-04-23 12:31:53 +01:00
dianacarvalho1
d409ae764a Merge branch 'main' into encoding/dc/bin-update 2025-04-23 12:31:53 +01:00
dianacarvalho1
3604cc4667 Merge pull request #173 from propeller-heads/router/tnl/more-protocol-integration
test: 5-hop Multi protocol integration test
2025-04-23 12:31:53 +01:00
dianacarvalho1
eae7dfafc5 Merge branch 'main' into encoding/dc/bin-update 2025-04-23 12:31:53 +01:00
semantic-release-bot
48565f3460 chore(release): 1.0.1 [skip ci]
## [1.0.1](https://github.com/propeller-heads/tycho-execution/compare/1.0.0...1.0.1) (2025-04-23)

### Bug Fixes

* Changes after rebase ([d39a2ac](d39a2accce))
* Configurable fee on USV2 executor. ([826aa54](826aa54631))
* Tighten max feeBps in USV2 executor ([e07573b](e07573bbb8))
2025-04-23 12:31:53 +01:00
Diana Carvalho
02cbb67b38 fix: After merge test fixes
Took 11 minutes
2025-04-23 12:31:53 +01:00
Diana Carvalho
aba280acd0 feat: Update tycho-encode bin with new arguments
--- don't change below this line ---
ENG-4446 Took 51 minutes


Took 9 seconds
2025-04-23 12:31:53 +01:00
dianacarvalho1
f41fa004c9 Merge pull request #168 from propeller-heads/router/tnl/ENG-4440-configure-usv2-fork-fee
fix: Configurable fee on USV2 executor.
2025-04-23 12:31:53 +01:00
dianacarvalho1
fc249d5977 Merge branch 'main' into router/tnl/more-protocol-integration 2025-04-23 12:31:53 +01:00
semantic-release-bot
104e1ecd43 chore(release): 1.0.0 [skip ci]
## [1.0.0](https://github.com/propeller-heads/tycho-execution/compare/0.81.0...1.0.0) (2025-04-22)

### Features

* (WIP) Support selection of transfer into router ([528bd74](528bd746f7))
* Add sequential swap methods ([2e3ffa2](2e3ffa2c70))
* Add SequentialSwap integration test with regular approvals ([8836598](8836598e53))
* Add SingleSwap integration test and fix bug in method signatures ([9c4dfef](9c4dfef80d))
* Add TokenTransfer class to BalancerV2 ([8e7dd0b](8e7dd0b9e7))
* Add TokenTransfer class to Curve ([0e0dff7](0e0dff7f5a))
* Add transfer out for Curve ([005c5a6](005c5a6207))
* Add transfer out for Uniswap V4 ([534e4f0](534e4f00db))
* Allow for token_in_already_in_router ([655c0b2](655c0b2635))
* allow to pass msg.sender to USV3 callback ([bf4b229](bf4b229268))
* allow to pass msg.sender to USV3 callback ([e71a0bb](e71a0bb354))
* Decode single and sequential swaps in LibSwap ([9be4845](9be48456e5))
* Delete EVMStrategyEncoder (this is now unnecessary) ([1fabef7](1fabef7a97))
* Do not use V4Router for uniswap v4 ([09b5a73](09b5a732ef))
* ExecutorTransferMethods helper contract ([abd9db9](abd9db937d))
* ExecutorTransferMethods in UniswapV3Executor ([dbbd30e](dbbd30e596))
* ExecutorTransferMethods in UniswapV3Executor ([e5426f3](e5426f3038))
* Fix rollFork usage for Ekubo test ([d7b5e6d](d7b5e6dba5))
* Make USV3 callback work with direct executor call ([51a7910](51a7910844))
* No more fee taking ([89f9121](89f9121e4c))
* Optimize transfer to first pool ([bf63696](bf63696142))
* Proper USV2Executor transfer decoding + tests ([b7ff870](b7ff870a7c))
* Proper USV2Executor transfer decoding + tests ([9dce2c7](9dce2c7465))
* Proper USV3Executor transfer decoding + tests ([1e37320](1e37320087))
* Refactor callback for pancakeV3 and Ekubo to use transient storage ([deb10b8](deb10b82de))
* Refactor callback to use transient storage ([af44956](af449562b0))
* Refactor TychoEncoder ([1996fd3](1996fd39e8))
* sequential swap solution validation ([efa5096](efa5096661))
* Single swap methods. ([72ccadc](72ccadcaae))
* SingleSwapStrategyEncoder ([5efeb8b](5efeb8b305))
* SingleSwapStrategyEncoder ([03f6961](03f6961b13))
* SingleSwapStrategyEncoder ([dbf5d1d](dbf5d1ddda))
* Support in between swaps optimizations ([83d3721](83d3721bf1))
* Support out transfer straight to the receiver ([d28c254](d28c254225))
* Support returning values from the callback ([fb35a53](fb35a5305a))
* Support using the TransferType in uniswap v4 ([2ecbabe](2ecbabeafc))
* **tycho-router-encoder:** Select strategy depending on the solution ([7f14f1a](7f14f1a4ff))
* Use TokenTransfer optimization helper in Ekubo ([d4e8642](d4e864272d))

### Bug Fixes

* Add slither ignore for loop call ([15f4ed5](15f4ed5d36))
* After rebase fixes ([ae30218](ae30218842))
* bad merge ([03ef744](03ef744373))
* Bring back receiver address zero check ([8e60b6b](8e60b6beba))
* Calldata size for Ekubo pay callback ([fb855d0](fb855d00a4))
* Conscious slither silencing ([a645fc7](a645fc72ab))
* consider wrapping scenario when getting transfer type ([028e860](028e8605a1))
* Fix after merge with main ([3de5a19](3de5a192b6))
* Fix executor address in test and remove duplicated test ([9456dc7](9456dc7b0b))
* Fix integration tests with transfer in method support ([0f3a910](0f3a9101b9))
* fix slither CI action ([7431b26](7431b266e1))
* Fixes after merge with feature branch ([26e6c6c](26e6c6c266))
* Integration tests after merge ([55242fb](55242fb8c4))
* No more EVMStrategyEncoder ([fbbc4c5](fbbc4c5277))
* Post rebase fixes ([01483c4](01483c4407))
* Prevent multiple callbacks ([f91b101](f91b101a94))
* properly add ekubo_v2 to constants ([24dd814](24dd814098))
* Remove --ignore-compile flag for slither ([353667e](353667e565))
* Remove router_address from Solution object ([9eb18f4](9eb18f4474))
* Rename constants and update docstrings for clarity ([11dffdc](11dffdcb28))
* test fix after rebase ([e05ffed](e05ffedd5d))
* Test+formatting fixes after rebase. ([6cf0f52](6cf0f523c1))
* TransferType renaming after rebase ([12c410b](12c410bb03))
* unsupported protocols for chained swaps are always unsupported ([9ce6fc0](9ce6fc0153))
* USV3 encoding/decoding after rebase ([2d0a3ac](2d0a3ac3fd))
2025-04-23 12:31:53 +01:00
TAMARA LIPOWSKI
d5d6e37041 fix: Changes after rebase 2025-04-23 12:31:53 +01:00
TAMARA LIPOWSKI
132eed4bb9 test: 5-hop Multi-protocol integration test
- Needed to add ekubo and uniswap v4 to callback-limited protocols.
- I had to bump the fork block in all of our integration tests: The way it was before meant that certain integration tests were using certain executor addresses, and others were using different ones, because of the redeployment. This was a pain to account for on the rust side. Instead, all tests now use an Ekubo-compatible fork block. Values needed to be updated because of price changes between blocks.
2025-04-23 12:31:53 +01:00
dianacarvalho1
54f04ac785 Merge pull request #119 from propeller-heads/feature/gas-optimization
breaking: Gas optimization feature
2025-04-23 12:31:53 +01:00
TAMARA LIPOWSKI
af68016223 fix: Tighten max feeBps in USV2 executor
Value was too lenient. We are assuming no forks will have higher fees than the original USV2.
2025-04-23 12:31:53 +01:00
TAMARA LIPOWSKI
4f9785fdac fix: Configurable fee on USV2 executor.
- This fee is not the same depending on the fork. For example, Pancake V2 uses a 0.25% fee, while the USV2 fee is 0.3%. We were wrongly hard-coding this fee to 0.3%.
2025-04-23 12:31:53 +01:00
Diana Carvalho
7614e36f18 Merge branch 'refs/heads/main' into feature/gas-optimization
# Conflicts:
#	foundry/src/Dispatcher.sol
#	foundry/test/executors/CurveExecutor.t.sol

Took 4 minutes

Took 12 seconds
2025-04-23 12:31:51 +01:00
dianacarvalho1
ca349a8e11 Merge pull request #166 from propeller-heads/router/dc/ENG-4437-uniswapv4-refactor
feat: Do not use V4Router for uniswap v4
2025-04-23 12:31:42 +01:00
dianacarvalho1
4a3a8ac6a6 Merge pull request #172 from propeller-heads/router/tnl/ENG-4443-usv3-executor-swap
feat: Make USV3 callback work with direct executor call
2025-04-23 12:31:42 +01:00
Diana Carvalho
d024fe240b fix: Post rebase fixes
--- don't change below this line ---
ENG-4437 Took 2 minutes
2025-04-23 12:31:42 +01:00
dianacarvalho1
342d2cfa1a Merge pull request #174 from propeller-heads/encoding/dc/ENG-4446-tokens-already-in-router
feat: Allow for token_in_already_in_router
2025-04-23 12:31:42 +01:00
TAMARA LIPOWSKI
5562dd210e feat: Make USV3 callback work with direct executor call
- We have decided to now support calling our executors normally (without using delegatecalls) since they now support specifying token transfers.
- This was disabled for UniswapV3 in the past also because of data decoding issues. This seems to be the solution, though.
2025-04-23 12:31:42 +01:00
Diana Carvalho
eb2c17d0ba docs: Add comment to delegatecall in UniV4 executor
--- don't change below this line ---
ENG-4437 Took 8 minutes
2025-04-23 12:31:42 +01:00
Diana Carvalho
dff4a345fc chore: Move get_receiver logic inside TransferOptimization
Added tests for all cases

--- don't change below this line ---
ENG-4446 Took 1 hour 8 minutes
2025-04-23 12:31:42 +01:00
Diana Carvalho
4a61de56b7 feat: Support using the TransferType in uniswap v4
Update tests

--- don't change below this line ---
ENG-4437 Took 1 hour 3 minutes

Took 2 minutes
2025-04-23 12:31:42 +01:00
Diana Carvalho
cebacc68fe test: Add integration test for it
--- don't change below this line ---
ENG-4446 Took 12 minutes
2025-04-23 12:31:42 +01:00
Diana Carvalho
cd608cb8e9 feat: Do not use V4Router for uniswap v4
Do our own implementation. In the end this is much cleaner than I expected and I was able to do a few improvements:
- we don't need to use actions. using function selectors and delegate call instead
- we don't need to convert into V4 Router types
- we don't need to check balances to get the amount out, we can just use the returned value

--- don't change below this line ---
ENG-4437 Took 3 hours 56 minutes


Took 3 minutes

Took 11 minutes
2025-04-23 12:31:42 +01:00
Diana Carvalho
df92be8875 feat: Allow for token_in_already_in_router
--- don't change below this line ---
ENG-4446 Took 31 minutes


Took 26 seconds
2025-04-23 12:31:42 +01:00
Diana Carvalho
304740574b chore: get_transfer_type should receive a SwapGroup and not a Swap
Only the first swap of a SwapGroup would actually get a transfer in, so we don't need to do this inside of the swaps loop
Rename in_token and out_token to token_in and token_out in SwapGroup

--- don't change below this line ---
ENG-4446 Took 22 minutes
2025-04-23 12:31:42 +01:00
Diana Carvalho
87de8bd637 chore: Refactor TransferOptimization to be a struct instead of a trait
--- don't change below this line ---
ENG-4446 Took 39 minutes
2025-04-23 12:31:42 +01:00
dianacarvalho1
5567ee459c Merge pull request #170 from propeller-heads/encoding/dc/ENG-4327-improve-tests
chore: Rename test module from chained_swaps to optimized_transfers
2025-04-23 12:31:41 +01:00
dianacarvalho1
393631e8c9 Merge pull request #169 from propeller-heads/encoding/dc/ENG-4327-improve-tests
chore: Improve tests
2025-04-23 12:31:41 +01:00
Diana Carvalho
0751e0d153 chore: Rename test module from chained_swaps to optimized_transfers
--- don't change below this line ---
ENG-4327 Took 17 minutes
2025-04-23 12:31:41 +01:00
dianacarvalho1
b4236dd879 Merge pull request #164 from propeller-heads/router/dc/ENG-4314-optimize-in-between-transfer
feat: Support in between swaps transfer optimizations
2025-04-23 12:31:41 +01:00
Diana Carvalho
a951dfb21a chore: Improve tests:
In both encoding and contracts:
- Make sure that the tests names/encoder match what is happening (we had test_split_... that was only a single swap).
- Made modules inside the encodings tests
  - In swap_encoders: there is one module per protocol
  - In strategy_encoders: there is one module per strategy and an extra protocol_integration module. Inside the sequential module there is another module called chained_swaps
- In contracts, each strategy has its own file. Integration tests per strategy should also be here. Renamed TychoRouterIntegration to TychoRouterProtocolIntegration. Only protocol integration tests should be in this file

--- don't change below this line ---
ENG-4327 Took 1 hour 13 minutes
2025-04-23 12:31:41 +01:00
dianacarvalho1
5ba4bb3809 Merge pull request #163 from propeller-heads/router/dc/ENG-4315-optimize-out-transfer
feat: Support out transfer straight to the receiver
2025-04-23 12:31:41 +01:00
Diana Carvalho
244b7d3482 fix: Rename constants and update docstrings for clarity
--- don't change below this line ---
ENG-4314 Took 44 minutes


Took 9 seconds
2025-04-23 12:31:41 +01:00
Tamara
c10d5874f8 Merge pull request #162 from propeller-heads/router/tnl/ENG-4419-ekubo-token-transfer
feat: Use TokenTransfer optimization helper in Ekubo
2025-04-23 12:31:41 +01:00
Diana Carvalho
d447551e20 fix: Bring back receiver address zero check
Add small docs and rename variables

--- don't change below this line ---
ENG-4314 Took 1 hour 39 minutes
2025-04-23 12:31:41 +01:00
Diana Carvalho
8aa5b08b41 fix: unsupported protocols for chained swaps are always unsupported
not only when the previous swap if of the same protocol!
Improve docs and naming

--- don't change below this line ---
ENG-4314 Took 15 minutes
2025-04-23 12:31:41 +01:00
Tamara
ae6fe0402d Merge pull request #158 from propeller-heads/encodig/tnl/ENG-4313-transfer-in
feat: Optimize transfer to first pool in encoding
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
860bba4b7a fix: Add slither ignore for loop call
- This started being an issue only with slither upgrade in the CI. We accept the risk here, and have for some time.
2025-04-23 12:31:41 +01:00
Diana Carvalho
8145f416b7 fix: After rebase fixes
- In Tycho Router
  - Fix integration tests
  - If the trade is cyclical, we can't do the balance check for the correctness of the amountOut transfers
- In encoding,
  - if it is a wrap trade, the transfer should be just a normal Transfer (not TransferFrom nor a Permit2Transfer)
  - add test names to println! statements

--- don't change below this line ---
ENG-4315 Took 1 hour 0 minutes

Took 30 seconds

Took 21 seconds

Took 16 seconds


Took 17 seconds
2025-04-23 12:31:41 +01:00
Diana Carvalho
efe12cfcd6 feat: Support in between swaps optimizations
--- don't change below this line ---
ENG-4314 Took 31 seconds
2025-04-23 12:31:41 +01:00
Tamara
95bd4ab14b Merge pull request #111 from propeller-heads/router/tnl/executor-transfer-sketch
feat: TokenTransfer helper contract
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
30dc3f7682 chore: renamings for clarity
- Also added a check for length in the Curve executor.
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
11886b3ac1 fix: properly add ekubo_v2 to constants
Mistakenly added "ekubo"
2025-04-23 12:31:41 +01:00
Diana Carvalho
ec87969aa6 feat: Add transfer out for Uniswap V4
Add transfer in Executor and pass receiver address in encoding
This is done by using the TAKE action instead of TAKE_ALL

--- don't change below this line ---
ENG-4315 Took 1 hour 36 minutes

Took 2 minutes
2025-04-23 12:31:41 +01:00
Diana Carvalho
eb1aa6cdcd chore: Correct typo in all balancerAfter/Before (again)
--- don't change below this line ---
ENG-4314 Took 1 hour 14 minutes
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
f3c4128eda fix: USV3 encoding/decoding after rebase
- Also do some renamings and comment improvements:
transfer method -> type
- Remove integration tests since we no longer support direct calls to USV3 executor, even for testing.
2025-04-23 12:31:41 +01:00