fix: Don't leak evm specific code to interfaces(PrivateKeySigner, Chain)

Pass the signer's private key as a string around and only create a PrivateKeySigner inside Permit2 (where it's needed)
Use tycho-core Chain instead of Alloy ChainID. Create a temp method to convert between them
Create a EVMSwapEncoder that implements the executor_selector (that is evm specific)

--- don't change below this line ---
ENG-4081 Took 1 hour 7 minutes
This commit is contained in:
Diana Carvalho
2025-01-30 13:17:23 +00:00
parent feb91cc639
commit 7a8872cc41
8 changed files with 69 additions and 58 deletions

View File

@@ -1,6 +1,3 @@
use alloy_primitives::FixedBytes;
use tycho_core::keccak256;
use crate::encoding::{
errors::EncodingError,
models::{EncodingContext, Swap},
@@ -17,9 +14,4 @@ pub trait SwapEncoder: Sync + Send {
encoding_context: EncodingContext,
) -> Result<Vec<u8>, EncodingError>;
fn executor_address(&self) -> &str;
fn executor_selector(&self) -> FixedBytes<4> {
let hash = keccak256("swap(uint256,bytes)".as_bytes());
FixedBytes::<4>::from([hash[0], hash[1], hash[2], hash[3]])
}
}