Merge branch 'refs/heads/main' into feature/gas-optimization

# Conflicts:
#	foundry/test/TychoRouter.t.sol
#	src/encoding/evm/strategy_encoder/strategy_encoders.rs
#	src/encoding/evm/utils.rs

Took 3 minutes

Took 35 seconds
This commit is contained in:
Diana Carvalho
2025-04-10 09:58:55 +01:00
21 changed files with 906 additions and 96 deletions

View File

@@ -1,5 +1,9 @@
use std::{cmp::max, sync::Arc};
use std::{cmp::max, env, sync::Arc};
use alloy::{
providers::{ProviderBuilder, RootProvider},
transports::BoxTransport,
};
use alloy_primitives::{aliases::U24, keccak256, Address, FixedBytes, Keccak256, U256, U8};
use alloy_sol_types::SolValue;
use num_bigint::BigUint;
@@ -150,6 +154,19 @@ pub fn ple_encode(action_data_array: Vec<Vec<u8>>) -> Vec<u8> {
encoded_action_data
}
/// Gets the client used for interacting with the EVM-compatible network.
pub async fn get_client() -> Result<Arc<RootProvider<BoxTransport>>, EncodingError> {
dotenv::dotenv().ok();
let eth_rpc_url = env::var("RPC_URL")
.map_err(|_| EncodingError::FatalError("Missing RPC_URL in environment".to_string()))?;
let client = ProviderBuilder::new()
.on_builtin(&eth_rpc_url)
.await
.map_err(|_| EncodingError::FatalError("Failed to build provider".to_string()))?;
Ok(Arc::new(client))
}
#[cfg(test)]
mod tests {
use num_bigint::BigUint;