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#>
This commit is contained in:
Diana Carvalho
2025-01-17 13:18:28 +00:00
parent e77a50b2bb
commit bab5caa6f8
12 changed files with 100 additions and 38 deletions

View File

@@ -2,9 +2,9 @@ use std::str::FromStr;
use alloy_primitives::Address;
use alloy_sol_types::SolValue;
use anyhow::Error;
use crate::encoding::{
errors::EncodingError,
evm::{
approvals::protocol_approvals_manager::ProtocolApprovalsManager, utils::bytes_to_address,
},
@@ -25,7 +25,7 @@ impl SwapEncoder for UniswapV2SwapEncoder {
&self,
_swap: Swap,
_encoding_context: EncodingContext,
) -> Result<Vec<u8>, Error> {
) -> Result<Vec<u8>, EncodingError> {
todo!()
}
@@ -47,7 +47,11 @@ impl SwapEncoder for BalancerV2SwapEncoder {
.expect("Invalid string for balancer vault address"),
}
}
fn encode_swap(&self, swap: Swap, encoding_context: EncodingContext) -> Result<Vec<u8>, Error> {
fn encode_swap(
&self,
swap: Swap,
encoding_context: EncodingContext,
) -> Result<Vec<u8>, EncodingError> {
let token_approvals_manager = ProtocolApprovalsManager::new();
let runtime = tokio::runtime::Handle::try_current()
.is_err()