Commit Graph

16 Commits

Author SHA1 Message Date
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
royvardhan
877f625efc fix: clippy 2025-01-28 22:27:26 +05:30
Harsh Vardhan Roy
5f5f30ee2d Merge branch 'main' into router/hr/ENG-4035-Balancer-V2-Executor 2025-01-28 22:17:05 +05:30
TAMARA LIPOWSKI
d95b74bb4e chore: small improvements
- Easier less convoluted way to decode address from string
- No more tokio test (not necessary)
- zero_for_one -> zero_to_one for consistency
2025-01-28 09:54:49 -05:00
royvardhan
a6a624b740 fix: balancer v2 encoder bug 2025-01-28 19:49:08 +05:30
TAMARA LIPOWSKI
9c63e099a9 feat: UniswapV3SwapEncoder
- No more supply owed action type or action data - we will always transfer from our router using a regular transfer in the callback.
- The receiver will always be sent with the actual swap call, meaning that no forward received action type or data is necessary either.
- We decode the pool fee as le-bytes and not be-bytes because that's how it's stored: 3c08359cf1/substreams/ethereum-uniswap-v3/src/modules/1_map_pool_created.rs (L64)
2025-01-27 14:25:57 -05:00
royvardhan
7c198fff92 fix: async 2025-01-27 13:44:03 +05:30
royvardhan
9cecea8968 feat: add balance v2 encoder test 2025-01-27 13:44:03 +05:30
TAMARA LIPOWSKI
ef07f49698 chore: merge main 2025-01-22 09:51:50 -05:00
TAMARA LIPOWSKI
748a3f06c3 chore: Renamings for clarity 2025-01-22 09:33:08 -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
cbf2b4de5a feat: Implement ProtocolApprovalsManager
I decided to make ProtocolApprovalsManager public method sync not to propagate asynceness early on onto the rest of the code. If later we decide that it is better to have this async, it should be easier to make that change than the opposite one.

--- don't change below this line ---
ENG-4064 Took 24 minutes
2025-01-20 16:05:06 +00:00
Diana Carvalho
bab5caa6f8 feat: Add EncodingError
Change method signatures to expect it and raise it where it makes sense

--- don't change below this line ---
ENG-4076 <#DTT#>
2025-01-17 17:00:52 +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