TAMARA LIPOWSKI
44e8e0bb96
docs: Address comments, make clippy happy
2025-02-05 15:44:27 -05:00
TAMARA LIPOWSKI
f8b3baff55
chore: merge main
2025-02-05 13:48:00 -05:00
Harsh Vardhan Roy
9e61261a51
Update strategy_encoders.rs
...
Co-authored-by: Tamara <tamara@datarevenue.com >
2025-02-05 20:23:10 +05:30
Harsh Vardhan Roy
3803be897e
Merge branch 'main' into encoder/hr/ENG-4083-Validate-SplitSwap
2025-02-05 19:39:00 +05:30
Diana Carvalho
3dcb8aee7b
chore: Use tycho_core::dto objects instead of tycho_core::models
...
--- don't change below this line ---
ENG-4169 Took 11 minutes
2025-02-05 10:10:43 +00:00
TAMARA LIPOWSKI
52cce5f5c6
docs: (WIP) In-code docs for encoders
...
- TODO double check all this, look for missing docs
2025-02-04 18:14:32 -05:00
TAMARA LIPOWSKI
8cd7d9f76e
feat: Get native/wrapped addresses from chain
...
- These were being hardcoded to ETH and WETH, which may not always be the case for EVM-compatible chains.
2025-02-04 16:59:01 -05:00
royvardhan
7b7226356d
fix: get_mock_split_swap_strategy_encoder
2025-02-05 00:18:26 +05:30
Harsh Vardhan Roy
b19dc89c8c
Merge branch 'main' into encoder/hr/ENG-4083-Validate-SplitSwap
2025-02-05 00:17:21 +05:30
royvardhan
c787f5e722
fix: use native action to validate path
2025-02-05 00:14:09 +05:30
Diana Carvalho
79f513c76b
chore: After rebase with master fixes
...
Took 2 minutes
2025-02-04 17:32:14 +00:00
Diana Carvalho
c89f46a2e6
chore: Rename registry -> swap_encoder_registry
...
Took 14 minutes
Took 8 seconds
2025-02-04 17:30:19 +00:00
Diana Carvalho
23875b8b02
feat: Refactor Registries
...
Interface changes:
- Rename StrategySelector to StrategyEncoderRegistry
- Implement clone for SwapEncoder
The StrategyEncoderRegistry needs to be initialised at the highest level and the passed to the TychoEncoder.
The TychoEncoder doesn't hold the chain nor the signer_pk as attributes anymore
The StrategyEncoderRegistry does:
- Initialises the SwapEncoderRegistry
- Initialises all the strategies and saves them in a HashMap
- Later, the TychoEncoder only reads from this hashmap
The StrategyEncoder now each holds a SwapEncoderRegistry as an attribute and they use this to get the correct SwapEncoder instead of reading from the global SWAP_ENCODER_REGISTRY
Simplified the SwapEncoderRegistry to not need a Config (everything is done inside itself)
All SwapEncoders implement clone
Took 2 hours 29 minutes
Took 11 seconds
Took 2 minutes
2025-02-04 17:30:10 +00:00
royvardhan
2f0013a934
chore: naming
2025-02-04 22:34:53 +05:30
royvardhan
4da50ddc9e
chore: naming
2025-02-04 22:34:53 +05:30
royvardhan
4d97c3f16d
feat: add tests for wrap unwrap case
2025-02-04 22:34:10 +05:30
royvardhan
b0dda205b0
chore: break tests
2025-02-04 22:34:10 +05:30
royvardhan
b8013c6e7e
chore: move validation methods inside impl
2025-02-04 22:34:10 +05:30
royvardhan
b69aef9b8f
feat: add tests for split swap validations
2025-02-04 22:34:10 +05:30
royvardhan
95edd5b1fe
fix: checks in validations
2025-02-04 22:34:10 +05:30
royvardhan
f80ffa924f
feat: add validation for split swap
2025-02-04 22:34:10 +05:30
TAMARA LIPOWSKI
ff283bc333
fix: test fixes after merge
2025-02-04 11:49:27 -05:00
Tamara
9980170fe5
Merge branch 'main' into encoding/tnl/fix-wrapping-indices
2025-02-04 10:35:53 -05:00
TAMARA LIPOWSKI
3f4e27a348
fix: Fix bug with token indexing when wrapping/unwrapping
...
The issue was that we weren't indexing WETH properly since it was looking for the WETH address in tokens, when only native ETH would be in there
- Found by adding integration tests for the wrapping and unwrapping cases.
2025-02-03 22:46:20 -05:00
Diana Carvalho
de1c782bc1
fix: Calculate min_amount_out correctly and extend test to prove this
...
--- don't change below this line ---
ENG-4087 Took 1 minute
2025-01-31 18:42:09 +00:00
Diana Carvalho
1a8e0f102c
chore: Make objects public
...
Remove dead_code check and leftover file after a merge
Improve some docstrings
--- don't change below this line ---
ENG-4087 Took 1 hour 39 minutes
2025-01-31 18:40:59 +00:00
TAMARA LIPOWSKI
5a81ed6be5
fix: Expect decimal during encoding, add assert to test
...
- The util function was previously expecting a value between 0 and 100, which we felt was a weird UI.
- In integration test - make sure we spent all input tokens
2025-01-31 12:04:53 -05:00
TAMARA LIPOWSKI
ff3c7aa629
test: Split swap integration test
2025-01-31 11:34:50 -05:00
Diana Carvalho
c85c353e34
fix: Fix token index order in strategy encoding.
...
The contract relies on this order!!
Remove TODOs and comments
--- don't change below this line ---
ENG-4081 Took 1 hour 12 minutes
Took 12 seconds
2025-01-31 15:34:12 +00:00
TAMARA LIPOWSKI
4d697bfebf
test: Router integration test with many TODOs
2025-01-31 15:34:12 +00:00
TAMARA LIPOWSKI
b01fa4cf04
test: Change some addresses to match contract test
...
- Use Alice's PK to match our router test, set her as the receiver too
- Component id should be a usv2 pool
- Use our router test's router address as the test's router address
- Use our test's contract (address(this)) as the sender
2025-01-31 15:34:12 +00:00
TAMARA LIPOWSKI
5d6f0c1673
fix: Fix selector - shouldn't contain spaces
...
I found this because I kept hitting the fallback function, meaning the selector wasn't recognized
2025-01-31 15:34:12 +00:00
TAMARA LIPOWSKI
5f3d4406bd
fix: replace all unwraps with proper error handling
...
- Or more elegant assignments in place of the `.is_some()` and `.unwrap()` method.
2025-01-30 17:19:54 -05:00
Diana Carvalho
01d101acb5
chore: Move ple_encode to EVMStrategyEncoder
...
--- don't change below this line ---
ENG-4081 Took 3 minutes
2025-01-30 19:47:36 +00:00
Diana Carvalho
575c5bea5e
fix: Use max instead of min to get the min_amount_out
...
between slippaged amount and checked amount
Save router's address as Bytes and not String
--- don't change below this line ---
ENG-4081 Took 7 minutes
2025-01-30 19:44:57 +00:00
Diana Carvalho
a28b54888e
fix: Post merge's fixes
...
Because of the renaming, git couldn't identify the new files and handle the conflicts gracefully.
Copied implementation for ExecutorStrategyEncoder from main
Rollbacked on decision to encode the executor address and selector inside the SwapEncoders. This is only necessary for certain strategies. So it should be done at the strategy level
--- don't change below this line ---
ENG-4081 Took 35 minutes
2025-01-30 19:38:22 +00:00
Diana Carvalho
01df08deaa
Merge remote-tracking branch 'origin/encoding/dc/ENG-4081-split-swap-strategy' into encoding/dc/ENG-4081-split-swap-strategy
2025-01-30 19:01:32 +00:00
TAMARA LIPOWSKI
5b86ae4ac5
docs: (split strategy test) better calldata comments
...
...for clarity and debugging purposes.
2025-01-30 12:45:36 -05:00
Diana Carvalho
8fd3deba70
Merge branch 'refs/heads/main' into encoding/dc/ENG-4081-split-swap-strategy
...
# Conflicts:
# src/encoding/evm/router_encoder.rs
# src/encoding/evm/strategy_encoder/encoder.rs
# src/encoding/evm/strategy_encoder/selector.rs
# src/encoding/strategy_encoder.rs
Took 2 minutes
2025-01-30 16:08:08 +00:00
royvardhan
9c35da0760
chore: rename straight_to_pool to direct_execution
2025-01-30 21:17:25 +05:30
royvardhan
8cb95f0950
feat: remove exact_out from USV2
2025-01-30 21:17:25 +05:30
royvardhan
95d45975ad
chore: encoder test naming
2025-01-30 21:17:25 +05:30
royvardhan
4ef9b0b82f
chore: use Bytes
2025-01-30 21:17:25 +05:30
royvardhan
1b8bf56c75
feat: resolve pr comments
2025-01-30 21:17:25 +05:30
royvardhan
0196767eff
feat: add swap test with hex for univ2 executor
2025-01-30 21:17:25 +05:30
royvardhan
c482e21a5f
feat: add univ2 executor test with hex
2025-01-30 21:17:25 +05:30
royvardhan
0007c4924c
chore: update executor encoder tests
2025-01-30 21:17:25 +05:30
royvardhan
d2289c3765
chore: update test
2025-01-30 21:17:25 +05:30
royvardhan
ad70a0d5a8
feat: add executor encoder test
2025-01-30 21:17:25 +05:30
royvardhan
5c396512cf
feat: update ExecutorEncoder interface and relevant types
2025-01-30 21:17:25 +05:30