Commit Graph

210 Commits

Author SHA1 Message Date
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
Tamara
db89a99826 Merge branch 'main' into feature/gas-optimization 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
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
TAMARA LIPOWSKI
e77a7bc3e1 test: Fix duplicate test 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
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
TAMARA LIPOWSKI
c4455dcabb refactor: Separate test files for split/sequential/single
- Add more test cases for sequential swap and single swap to match those of split swap (fee, slippage), to catch errors more easily if someone makes a small code change to either the single or sequential methods
- Excluded USV3 and USV4 tests on sequential and single swap, since these tests were more to test USV3 and USV4 executor functionality than the high level sswap methods - they should already be sufficiently tested.
- Remove `testSplitSwapSimple` and `testSplitSwapSingleUSV3` since this is already tested by several other high-level methods (see single USV3 and single USV4 tests). We should prioritize integration-testing public methods over private methods.
2025-04-23 12:26:31 +01:00
TAMARA LIPOWSKI
1dad4afb6b feat: Decode single and sequential swaps in LibSwap
- The old way was useful when we just had split swaps. Unfortunately, we now have split, sequential, and single swaps, which don't always require token indices or split percentages, so we need to decode differently for each case.
2025-04-23 12:26:31 +01:00
TAMARA LIPOWSKI
3ae9d3ad67 feat: Add sequential swap methods
- Add some basic tests (will add more in next commits)
- Adapt sequential tests (which originally tested split swap)
- Adapt a forgotten single swap test

TODO:
- Fix encoding of single and sequential swaps to not expect the split sawp format every time (the split and the token indices are not necessary and consume unnecessary gas).
2025-04-23 12:26:31 +01:00
TAMARA LIPOWSKI
64345663d0 feat: Single swap methods.
- Remove duplicate test case for single swp with permit2. This test came from the days when we could still have a 0 minimum amount.
2025-04-23 12:26:31 +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
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
Diana Carvalho
49aefc8c2a fix: Remove unnecessary test method
--- don't change below this line ---
ENG-4305 Took 2 minutes
2025-04-04 09:13:36 +01:00
Diana Carvalho
9f2184258a feat: Refactor Curve Executor not to use the router
We don't need to use all the functionalities of the Curve Router, only the swap type 1 (exchange). By bypassing the router we can save gas on 2 token transfers and with smaller calldata
A nice side effect is that the executor is much more readable and understandable now

--- don't change below this line ---
ENG-4305 Took 2 hours 25 minutes


Took 12 seconds
2025-04-03 18:18:16 +01:00
Diana Carvalho
f468a7831a fix: Improve curve executor tests and docstrings
--- don't change below this line ---
ENG-4305 Took 34 minutes


Took 8 seconds
2025-04-03 18:17:45 +01:00
royvardhan
3a08c0d71d test: test two more pool types 2025-04-03 18:17:45 +01:00
royvardhan
9e2a9f5329 fix: resolve pr comments
Took 2 seconds
2025-04-03 18:17:45 +01:00
royvardhan
07d6323316 chore: fmt 2025-04-03 18:17:45 +01:00
royvardhan
826eca4a80 refactor: move swap params from interface to executor, add needsApproval 2025-04-03 18:17:45 +01:00
royvardhan
3054ca042b chore: rename ethAddress to nativeToken, update tests 2025-04-03 18:17:45 +01:00
royvardhan
05ea2c7734 chore: cleanup 2025-04-03 18:17:45 +01:00
royvardhan
c3d36ae25f test: add curve swap tests with pools from indexer 2025-04-03 18:17:45 +01:00
royvardhan
93bdc86dc6 feat: allow executor to do native swaps, add diff pool type tests
Took 4 seconds
2025-04-03 18:17:45 +01:00
royvardhan
7cde5130d6 feat: add curve executor with router tests
Took 36 minutes


Took 2 minutes
2025-04-03 18:17:45 +01:00
TAMARA LIPOWSKI
9012d7b4d1 feat: deploy Ekubo gas optimizations
new executor and new router (since the executor is hardcoded for now).
2025-04-03 12:51:23 +02:00
TAMARA LIPOWSKI
25cafa31e7 chore: forge fmt 2025-04-03 10:53:55 +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
28f9f244e6 fix: test setup fix after rebase 2025-03-31 17:54:35 +02:00
TAMARA LIPOWSKI
c678f40057 fix: Take address for EkuboExecutor init
- To match the other executor inits and to not leak information about ICore into the deployment script.
- Also fix fork block of tests. This had been temporarily changed to test the Ekubo executor. For some reason, vm.rollFork is not working in this case. Skip the Ekubo integration test for now (we know it runs with the correct block, where the pool we call is actually already deployed)
2025-03-31 17:49:47 +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
9fc99caf74 forge fmt 2025-03-26 16:57:43 +01:00
die-herdplatte
47d96c2347 Add integration test 2025-03-26 16:50:03 +01:00
die-herdplatte
261e2b2091 Merge remote-tracking branch 'upstream/main' into ekubo 2025-03-26 08:25:37 +01:00
TAMARA LIPOWSKI
d582543057 feat: Pancakeswap V3 support 2025-03-25 17:50:25 +01:00
TAMARA LIPOWSKI
2a4ee88cad feat: Support Pancakeswap v3 on ethereum
- Needed to take pool code init hash as input param for executors
- Added tests for ethereum. Will test base on-chain.
- Important note: Pancakeswap uses their deployer instead of their factory (this is a different address) for target verification.
2025-03-20 12:40:03 -04:00
die-herdplatte
05d6286921 Merge remote-tracking branch 'origin/main' into ekubo 2025-03-20 09:59:19 +01:00
die-herdplatte
3c982c5824 Ekubo integration 2025-03-20 09:58:40 +01:00
TAMARA LIPOWSKI
0a8a34be03 feat: Support sushiswap v2 and pancakeswap v2 on ethereum
- Needed to take pool code init hash as input param for executors
- Added tests for ethereum. Will test base on-chain.
2025-03-19 14:27:34 -04:00
Diana Carvalho
27c9c53889 feat: Add check to don't support cyclical swaps with native actions
Remove unnecessary tests and improve comments

--- don't change below this line ---
ENG-4331 Took 30 minutes
2025-03-13 17:34:50 +00:00
royvardhan
ec26890d00 test: add assert in cyclic swap encoding tests 2025-03-12 00:49:42 +05:30
royvardhan
eb4ce40f6e test: add testCyclicSwapUnwrapOutputIntegration in encoder and testCyclicSwapUnwrapOutputIntegration test 2025-03-12 00:49:42 +05:30