Commit Graph

24 Commits

Author SHA1 Message Date
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
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
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
1b8bf56c75 feat: resolve pr comments 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
Diana Carvalho
feb91cc639 feat: Implement SplitSwapStrategyEncoder
The strategy works as follows:
- Manage approvals needed
- Compute min amount (if check amount is any):
  - if slippage is defined, apply slippage on the expected amount and take the min value between that and the check amount
  - if not, it's just the check amount
- Iterate through the swaps
  - call the corresponding swap encoder to encode the swap
  - add swap header (tokens indexes and split)
  - ple encode the swaps
- Add extra inputs (amounts, token addresses, min amount, (un)wrap, number of tokens and receiver)

Misc:
- Move executor address and selector encoding inside the SwapEncoder
- Add default executor_selector to SwapEncoder
- Pass router address inside the SplitSwapStrategyEncoder
- Move Permit2 inside the SplitSwapStrategyEncoder. It is a responsibility and a specificity of the strategy to need permit2 approvals

--- don't change below this line ---
ENG-4081 Took 1 hour 21 minutes
2025-01-30 11:23:32 +00:00
TAMARA LIPOWSKI
ef07f49698 chore: merge main 2025-01-22 09:51:50 -05:00
TAMARA LIPOWSKI
cc979880e2 chore: Rename address_for_approvals -> router_address
When will this not be the router address that we use for approvals? It will always be the router address. address_for_approvals sounds to me very vague (which approvals?).
2025-01-21 16:35:19 -05:00
TAMARA LIPOWSKI
7b4bf0205d feat: UniswapV2 Swap Encoder 2025-01-21 16:35:19 -05:00
Diana Carvalho
979cdf7437 chore: Do not use expect
--- don't change below this line ---
ENG-4063 Took 57 minutes


Took 17 seconds

Took 45 seconds
2025-01-21 18:48:49 +00:00
Diana Carvalho
38b8bb0e78 feat: Simplify StrategyEncoders and RouterEncoder
No more SingleSwapStrategyEncoder or SequentialStrategyEncoder
No more batch routing (so no need for batch permits as well). If multiple solutions are found, return multiple Transactions

--- don't change below this line ---
ENG-4076 <#DTT#>
2025-01-17 16:21:26 +00:00
Diana Carvalho
6c6ba21894 feat: Add evm feature gate
- Move all evm code inside evm directory
- StrategyEncoder:
  - Kept StrategyEncoder trait but created a new one: EVMStrategyEncoder to implement encode_protocol_header (that is evm specific).
  - All StrategyEncoders implement both traits now
  - Renamed DefaultStrategySelector -> EVMStrategySelector
- RouterEncoder:
  - Created a RouterEncoder trait and a EVMRouterEncoder that implements it
- Moved utils inside evm directory as well
- Renamed config.json -> executor_addresses.json and moved it to a higher config directory
- Make alloy optional and dependent on the evm feature gate

--- don't change below this line ---
ENG-4075 <#DTT#>
2025-01-17 12:52:39 +00:00
TAMARA LIPOWSKI
f8e8a72c53 chore: fix clippy warnings and nightly fmt 2025-01-16 16:35:02 -05:00
Diana Carvalho
6f8bbd89a5 feat: Make check amount optional 2025-01-16 17:18:11 +00:00
Diana Carvalho
5a661ab6ca feat: Add Transaction as output of encoding 2025-01-16 17:18:11 +00:00
Diana Carvalho
f9f83b439f fix: Add expected_amount to Solution 2025-01-16 17:18:11 +00:00
Diana Carvalho
a25c56e667 fix: Simplify models. Delete Solution and rename Order->Solution 2025-01-16 17:18:11 +00:00
Diana Carvalho
3e609c75ae feat: Support encoding only the pool swap
Create StraightToPoolStrategyEncoder
2025-01-16 17:18:11 +00:00
Diana Carvalho
647f697ea2 chore: Refactor models:
- Delete min_checked_amount and use check_amount instead
- Use Bytes and not Address in interfaces
- Move router_address from Solution to Order
2025-01-16 17:17:52 +00:00
Diana Carvalho
5d79da44f3 feat: Add permit2 draft 2025-01-16 17:17:52 +00:00
Diana Carvalho
fa462ee9f3 feat: Handle native actions 2025-01-16 17:17:52 +00:00
Diana Carvalho
36fe8f4b76 feat: Initial draft of encoding module 2025-01-16 17:17:50 +00:00