Commit Graph

967 Commits

Author SHA1 Message Date
TAMARA LIPOWSKI
d9066d0a09 feat: Use TokenTransfer optimization helper in Ekubo 2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
4a20fa6215 fix: Conscious slither silencing
- This arbitrary sender should be same, since the sender is always set to be msg.sender from within the contract (no calldata can be sent specifying otherwise). This is just used to circumvent msg.sender being the pool/protocol during callbacks.
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
7ba99561db chore: nightly fmt.
Somehow missed.
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
61c0163bee fix: test fix after rebase 2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
e18e38af74 chore: forge fmt.
Somehow missed.
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
e96ea1b10b fix: Test+formatting fixes after rebase. 2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
a301a1cef3 feat: (WIP) Support selection of transfer into router
- For protocols like Balancer and Curve, which expect funds to be in the router at the time of swap, we must support also transferring funds from the user into the router. Doing this in the router would mean we are dealing with transfers in two different places: in the router main methods and in the executors. To avoid this, we are now performing transfers just in the executors, and two transfer types have been added to support transfers into the router.

TODO:
- Add this for Balancer and Curve (only added for USV4 atm).
- TODO consider renaming TRANSFER_FROM and TRANSFER_PERMIT2 to include "pool" in the name
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
59a80dc392 feat: Optimize transfer to first pool
TODO: Update integration tests on solidity side, since a few were now updated on the encoding side to use a transferFrom.
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
ee7495551e chore: Renamings + comment fixes
- Renamed ExecutorTransferMethods to TokenTransfer to avoid leaking information about how the transfer happens into the executor. The executor shouldn't care if there are multiple methods or one single method that takes care of everything.
- Also renamed TransferMethod to TransferType to match the rust encoding
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
e8f56ff088 feat: Proper USV2Executor transfer decoding + tests
- Properly decode, update tests with proper decoding
- Added test case for each transfer method
- Also fully tested permit2 transferFrom and it works perfectly.

TODO:
- Fix integration tests once encoding is implemented.
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
a37805d046 feat: allow to pass msg.sender to USV3 callback
- So that we can possibly do a transferFrom
- This should still be safe since the user can't control what is passed here
2025-04-23 12:31:41 +01:00
TAMARA LIPOWSKI
31891397c7 feat: ExecutorTransferMethods in UniswapV3Executor 2025-04-23 12:31:41 +01:00
Tamara
27cebdb3e1 Merge pull request #160 from propeller-heads/router/tnl/ENG-4420-no-fee-taking
feat: No more fee taking
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
d3ff9fd0e2 fix: Fix integration tests with transfer in method support
- For now, hardcode them to TRANSFER on the rust encoder side. This will be fixed in an upcoming PR.
- Remove the split swap simple route integration test - seemed overkill since simple routes are tested in many other integration tests, the original rust test named doesn't exist anymore, and simple routes should anyway be passing through the single endpoint.
2025-04-23 12:31:40 +01:00
dianacarvalho1
5fe2c2715c Merge pull request #143 from propeller-heads/router/dc/ENG-4411-refactor-callback-transient-storage
feat: Refactor callback to use transient storage
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
6f2e5ac10e feat: No more fee taking
- This required an extra transfer into the router at the end of the swap sequence, costing an unnecessary 40k gas or more for certain protocols.
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
e3ac394d27 feat: Proper USV3Executor transfer decoding + tests
- Properly decode, update tests with proper decoding
- Added test case for each transfer method
- Also fully tested permit2 transferFrom and it works perfectly.

NOTE:
UniswapV3 doesn't support NONE as a transfer method.

TODO:
- Fix integration tests once encoding is implemented.
2025-04-23 12:31:40 +01:00
Diana Carvalho
26ec30852d fix: Fixes after merge with feature branch
Update some tests calldata

Took 9 minutes
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
30557e7e54 refactor: create Permit2TestHelper
- To avoid duplicating permit2 setup code for TychoRouter and executor tests.
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
ca1d474f08 feat: Proper USV2Executor transfer decoding + tests
- Properly decode, update tests with proper decoding
- Added test case for each transfer method
- Also fully tested permit2 transferFrom and it works perfectly.

TODO:
- Fix integration tests once encoding is implemented.
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
8969186654 feat: allow to pass msg.sender to USV3 callback
- So that we can possibly do a transferFrom
- This should still be safe since the user can't control what is passed here
2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
389009901e feat: ExecutorTransferMethods in UniswapV3Executor 2025-04-23 12:31:40 +01:00
TAMARA LIPOWSKI
147ba68392 feat: ExecutorTransferMethods helper contract
- Also sketch its use in USV2 (missing proper decoding)
2025-04-23 12:31:40 +01:00
Diana Carvalho
b391c0e2f3 Merge branch 'refs/heads/feature/gas-optimization' into router/dc/ENG-4411-refactor-callback-transient-storage
# Conflicts:
#	foundry/test/TychoRouter.t.sol
#	src/encoding/evm/strategy_encoder/strategy_encoders.rs

Took 5 minutes

Took 35 seconds
2025-04-23 12:31:38 +01:00
Diana Carvalho
fff8ef0d87 fix: Fix after merge with main
Mostly had to delete some tests (because they were moved) and fix others

Took 17 minutes

Took 8 seconds

Took 17 seconds
2025-04-23 12:31:15 +01:00
Diana Carvalho
35441456ac Merge branch 'refs/heads/main' into feature/gas-optimization
# Conflicts:
#	foundry/test/TychoRouter.t.sol
#	src/encoding/evm/strategy_encoder/strategy_encoders.rs
#	src/encoding/evm/utils.rs

Took 3 minutes

Took 35 seconds
2025-04-23 12:30:46 +01:00
dianacarvalho1
86e6ca54af Merge pull request #156 from propeller-heads/encoding/dc/ENG-4332-mutiplex-strategy
feat: Select strategy in TychoRouterEncoder depending on the solution
2025-04-23 12:30:13 +01:00
dianacarvalho1
ae4dfa5775 Merge pull request #155 from propeller-heads/encoding/dc/ENG-4332-mutiplex-strategy
feat: Refactor TychoEncoder into two: TychoRouterEncoder and TychoExecutorEncoder
2025-04-23 12:30:13 +01:00
Diana Carvalho
f5e712e0ff feat(tycho-router-encoder): Select strategy depending on the solution
- The tycho router address default is set at the EncoderBuilder level (not inside the strategies)
- Rename TychoCoreChain to TychoCommonChain
- Only take TychoCommonChain as an argument at the outermost level: EncoderBuilder. Everywhere else we use the execution Chain right away

--- don't change below this line ---
ENG-4332 Took 1 hour 10 minutes
2025-04-23 12:30:13 +01:00
Tamara
db89a99826 Merge branch 'main' into feature/gas-optimization 2025-04-23 12:30:13 +01:00
Diana Carvalho
6fd0ab54c1 docs: Improve doc
--- don't change below this line ---
ENG-4306 Took 4 minutes
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
56d3eee618 fix: No more EVMStrategyEncoder
bad merge
2025-04-23 12:30:13 +01:00
Diana Carvalho
8b4b79b353 feat: Refactor TychoEncoder
We have a trait TychoEncoder and then two implementations: TychoRouterEncoder and TychoExecutorEncoder.
This way we go a level above with the decision if it is a direct execution or if it should use the tycho router.

- Created two builders: one for each tycho encoder
- Delete ExecutorStrategyEncoder and move code straight into the TychoExecutorEncoder
- Add validate_solution to trait TychoEncoder
- Move group_swaps.rs a level up
- Update tests and usage cases

Doing this we get rid of all that weird stuff we were doing before

--- don't change below this line ---
ENG-4306 Took 2 hours 6 minutes


Took 12 seconds
2025-04-23 12:30:13 +01:00
Tamara
899f0efeff Merge pull request #154 from propeller-heads/encoding/dc/4318-single-strategy-integration-test
feat: Add SingleSwap integration test
2025-04-23 12:30:13 +01:00
Tamara
1d298a371d Merge pull request #132 from propeller-heads/encoding/tnl/ENG-4318-sequential-strategy
feat: SequentialSwapStrategyEncoder
2025-04-23 12:30:13 +01:00
Diana Carvalho
df1c05ea00 feat: Add SingleSwap integration test and fix bug in method signatures
--- don't change below this line ---
ENG-4306 Took 27 minutes


Took 15 seconds
2025-04-23 12:30:13 +01:00
dianacarvalho1
012b9f1508 Merge pull request #130 from propeller-heads/encoding/tnl/4318-single-strategy
feat: SingleSwapStrategyEncoder
2025-04-23 12:30:13 +01:00
Diana Carvalho
6e7bf3c019 feat: Add SequentialSwap integration test with regular approvals
Improve docstrings

--- don't change below this line ---
ENG-4306 Took 20 minutes
2025-04-23 12:30:13 +01:00
Diana Carvalho
6430c99d76 feat: Delete EVMStrategyEncoder (this is now unnecessary)
Moved ple_encode into utils.rs

--- don't change below this line ---
ENG-4306 Took 5 minutes
2025-04-23 12:30:13 +01:00
Diana Carvalho
2f81b167d4 fix: Fix executor address in test and remove duplicated test
--- don't change below this line ---
ENG-4306 Took 12 minutes


Took 18 seconds
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
f12bebcdfb test: Fix executor address in swap test 2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
e77a7bc3e1 test: Fix duplicate test 2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
fcedd39f30 fix: Remove router_address from Solution object
after merge
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
c67c9acac4 test: Sequential swap integration test
- And other small fixes after merge
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
11a05e4f18 feat: SingleSwapStrategyEncoder
- Had to take the implementation of the swap header encoding out of the main EVMStrategyEncoder trait, since it will now be difference for single and split swap strategies.
- Integration tests will be added in separate task/PR.


Took 7 seconds
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
0d8150e22f feat: sequential swap solution validation
- Basically reuse all methods of split swap validation, minus those specific to splits.
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
5d586c25e3 feat: SingleSwapStrategyEncoder
- Had to take the implementation of the swap header encoding out of the main EVMStrategyEncoder trait, since it will now be difference for single and split swap strategies.
- Integration tests will be added in separate task/PR.
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
a5f07a25ef feat: SingleSwapStrategyEncoder
- Had to take the implementation of the swap header encoding out of the main EVMStrategyEncoder trait, since it will now be difference for single and split swap strategies.
- Integration tests will be added in separate task/PR.
2025-04-23 12:30:13 +01:00
TAMARA LIPOWSKI
3f6bc5643e fix: Integration tests after merge
Took 50 seconds
2025-04-23 12:30:06 +01:00
TAMARA LIPOWSKI
3d01158bbb chore: merge main
Took 3 minutes
2025-04-23 12:29:36 +01:00