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:
@@ -1,7 +1,7 @@
|
||||
use alloy_primitives::{aliases::U24, Address, Keccak256, U256};
|
||||
use alloy_sol_types::SolValue;
|
||||
use num_bigint::BigUint;
|
||||
use tycho_core::Bytes;
|
||||
use tycho_core::{models::Chain, Bytes};
|
||||
|
||||
use crate::encoding::errors::EncodingError;
|
||||
|
||||
@@ -65,3 +65,10 @@ pub fn percentage_to_uint24(percentage: f64) -> U24 {
|
||||
let scaled = (percentage / 100.0) * (MAX_UINT24 as f64);
|
||||
U24::from(scaled.round())
|
||||
}
|
||||
|
||||
pub fn to_chain_id(chain: Chain) -> Result<u64, EncodingError> {
|
||||
match chain {
|
||||
Chain::Ethereum => Ok(1),
|
||||
_ => Err(EncodingError::FatalError("Unsupported chain".to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user