Commit Graph

355 Commits

Author SHA1 Message Date
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
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
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
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
3d01158bbb chore: merge main
Took 3 minutes
2025-04-23 12:29:36 +01:00
TAMARA LIPOWSKI
7fc008a718 feat: Rename split swap interfaces
- In preparation for adding single and sequential swap methods.
2025-04-23 12:25:36 +01:00
Diana Carvalho
2e8392ab40 fix: Support pools that hold ETH but the coin is WETH
--- don't change below this line ---
ENG-4307 Took 1 hour 46 minutes
2025-04-11 16:17:37 +01:00
zach
bab30e3958 fix: add maverick for build 2025-04-11 08:43:03 +08:00
zach
bd642d7b45 update 2025-04-11 08:30:48 +08:00
zach
72a651d453 feat: add swap encode 2025-04-11 08:30:45 +08:00
Diana Carvalho
9e68ab8b01 fix: Checksum curve pool addresses
--- don't change below this line ---
ENG-4307 Took 5 minutes
2025-04-10 12:38:39 +01:00
Diana Carvalho
af449562b0 feat: Refactor callback to use transient storage
With this, we don't need the univ3 specific method in the router contract. This should be flexible enough for most protocols that integrate

TODO: is this safe enough??

--- don't change below this line ---
ENG-4411 Took 1 hour 52 minutes

Took 4 minutes

Took 5 minutes
2025-04-09 13:05:53 +01:00
Diana Carvalho
ce7189423f fix: Curve factory addresses are utf-8 encoded
Took 30 minutes
2025-04-08 19:18:52 +01:00
Diana Carvalho
739fb46d20 feat: Add protocol_specific_addresses.json file
This way we can define protocol and chain specific addresses in this file and use them in the Encoders

--- don't change below this line ---
ENG-4306 Took 1 hour 4 minutes
2025-04-08 09:30:29 +01:00
Diana Carvalho
913d677ffb feat: Support Curve ETH
Curve pools use a different address from ETH (native token)

- Pass Chain into the SwapEncoderBuilder and SwapEncoder
- Add native_token_curve_address and native_token_address to CurveSwapEncoder
- Added integration test for this curve case

--- don't change below this line ---
ENG-4306 Took 1 hour 4 minutes


Took 11 seconds
2025-04-08 09:30:29 +01:00
Diana Carvalho
1838ccf8a1 fix: Fix Ekubo test
--- don't change below this line ---
ENG-4306 Took 15 minutes
2025-04-08 09:30:29 +01:00
Diana Carvalho
1e47d0e25b feat(curve): Add integration test
Bonus fix of a shameful typo :|

--- don't change below this line ---
ENG-4306 Took 21 minutes
2025-04-08 09:30:29 +01:00
Diana Carvalho
e9bb8c576a feat(curve): Add CurveEncoder
We don't know the pool tokens in the ProtocolComponent, so we can't infer the indexes correctly. Added a call to the MetaRegistry curve contract to get the correct token indexes. To do this, I had to move the get_client to utils. We could actually refactor the transaction logic into its' own struct and use it here and in the approval logic
It was assumed that all the pools will have a "factory" static attribute, even if empty

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


Took 27 seconds
2025-04-08 09:30:29 +01:00
Tamara
e2be13521b Merge branch 'main' into encoding/tnl/fix-ekubo-grouping 2025-04-03 11:45:14 +02:00
TAMARA LIPOWSKI
b4c687bc3f fix: Proper ekubo protocol name in GROUPABLE_PROTOCOLS 2025-04-03 11:09:31 +02:00
Tamara
3a42059598 Merge branch 'main' into router/tnl/deploy-unichain 2025-04-03 10:53:31 +02:00
Diana Carvalho
5336969df8 fix: Fix tests after cherry picking
--- don't change below this line ---
ENG-4411 Took 1 hour 9 minutes

Took 18 minutes
2025-04-02 16:13:58 +01:00
Diana Carvalho
6cdca8381e feat: Fix rollFork usage for Ekubo test
- Created methods to deploy the router and the executors. Whenever we use rollFork we need to redeploy everything! Notice that the addresses will be different then!
- Created a test_executor_addresses.json to be used in the encoding tests, this way the calldata for the integration tests is already correct and we don't need to do any manual replacing (this was annoying). The addresses in this file match with the addresses used in the solidity tests

--- don't change below this line ---
ENG-4411 Took 1 hour 9 minutes

Took 28 minutes


Took 4 minutes

Took 45 minutes
2025-04-02 16:13:58 +01:00
TAMARA LIPOWSKI
4878229e1d fix: Set native and wrapped tokens for Unichain 2025-04-02 16:06:26 +02:00
TAMARA LIPOWSKI
d05e1183d4 feat: Unichain deployment 2025-04-02 15:49:08 +02:00
TAMARA LIPOWSKI
1f6f1a4236 feat: Add router_address to cli 2025-04-02 12:02:56 +02:00
TAMARA LIPOWSKI
c336a28905 feat: Support manual router address setting in builder 2025-04-02 11:24:31 +02:00
TAMARA LIPOWSKI
b397ddd2be fix: fix Solution.router_address for Ekubo 2025-04-02 11:24:12 +02:00
TAMARA LIPOWSKI
8865e22116 feat: Make EncodingContext.router_address optional 2025-04-02 11:24:04 +02:00
TAMARA LIPOWSKI
d5c589d2c0 feat: Remove router_address from Solution, set default
- The router address can be set when creating the SplitSwapStrategy, which now takes an Option<Bytes> as input during initialization (another breaking interface change)
- This change allows us to change our router address in the future with minimal effect on the users. Users should only pass the router address in the split swap initialization if they intend to use their own router for execution.
- This change also means that the router address does not need to be passed with the solution, even when using the executor strategy (which was pointless).
- I thought of having a router_address() method to set this in the encoder builder - but it seemed too messy, since we don't need the router address for execution for example. We would then potentially unnecessarily load and set the default router address when not needed. It is also not even used at the highest level EVMTychoEncoder, so it makes more sense for it to be directly associated with the swap strategy instead.
- Users will now not be able to encode for different routers without re-initializing the strategy. We assumed this use case to be very rare and not worth supporting.
2025-04-02 11:18:30 +02:00
TAMARA LIPOWSKI
18fa0cc7ad fix: ekubo -> ekubo_v2
This is how it's called in tycho indexer/simulation.
2025-03-31 18:45:36 +02:00
TAMARA LIPOWSKI
6c35f114e3 fix: ekubo -> ekubo_v2
This is how it's called in tycho indexer/simulation.
2025-03-31 18:38:44 +02:00
TAMARA LIPOWSKI
b3078f9c7b feat: Support Ekubo callback in TychoRouter
- add integration test
- cannot directly call _handleCallback from the locked method of the tycho router because of bytes memory to bytes callback conversion
- Rename to EkuboPoolKey because of conflict with USV4 pool key

- Bonus: fix bug where input token to swap method must be ERC20 (we should also support ETH)
2025-03-31 17:49:45 +02:00
Tamara
414a9609ec Merge branch 'main' into router/tnl/ENG-4409-pancake-v3-callback 2025-03-31 17:44:27 +02:00
die-herdplatte
485e5fd13e Merge remote-tracking branch 'upstream/main' into ekubo 2025-03-29 10:31:33 +01:00
kayibal
379858bfca fix: Handle unichain chain id 2025-03-27 16:58:34 +01:00
kayibal
0836bf7d53 feat: switch to tycho_commons 2025-03-27 16:58:34 +01:00
Tamara
db752f9222 Merge branch 'main' into ekubo 2025-03-27 15:54:34 +01:00
die-herdplatte
47d96c2347 Add integration test 2025-03-26 16:50:03 +01:00