diff --git a/src/types/mod.rs b/src/types/mod.rs index 1c23195c..e91060a0 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -1,33 +1,3 @@ -use ethers::types::Address; -use reth_db::table::{Decode, Encode}; - pub mod reputation; pub mod user_operation; - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] -pub struct WrapAddress(Address); - -impl Decode for WrapAddress { - fn decode>(value: B) -> Result { - Ok(Address::from_slice(value.into().as_ref()).into()) - } -} - -impl Encode for WrapAddress { - type Encoded = [u8; 20]; - fn encode(self) -> Self::Encoded { - *self.0.as_fixed_bytes() - } -} - -impl From
for WrapAddress { - fn from(value: Address) -> Self { - Self(value) - } -} - -impl From for Address { - fn from(value: WrapAddress) -> Self { - value.0 - } -} +pub mod utils; diff --git a/src/types/utils.rs b/src/types/utils.rs new file mode 100644 index 00000000..a34b117f --- /dev/null +++ b/src/types/utils.rs @@ -0,0 +1,30 @@ +use ethers::types::Address; +use reth_db::table::{Decode, Encode}; + +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone)] +pub struct WrapAddress(Address); + +impl Decode for WrapAddress { + fn decode>(value: B) -> Result { + Ok(Address::from_slice(value.into().as_ref()).into()) + } +} + +impl Encode for WrapAddress { + type Encoded = [u8; 20]; + fn encode(self) -> Self::Encoded { + *self.0.as_fixed_bytes() + } +} + +impl From
for WrapAddress { + fn from(value: Address) -> Self { + Self(value) + } +} + +impl From for Address { + fn from(value: WrapAddress) -> Self { + value.0 + } +} diff --git a/src/uopool/database.rs b/src/uopool/database.rs index c5dc8231..3b66667e 100644 --- a/src/uopool/database.rs +++ b/src/uopool/database.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use super::Mempool; use crate::types::{ user_operation::{UserOperation, UserOperationHash}, - WrapAddress, + utils::WrapAddress, }; use ethers::types::{Address, U256}; use reth_db::{