-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<B: Into<prost::bytes::Bytes>>(value: B) -> Result<Self, reth_db::Error> { | ||
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<Address> for WrapAddress { | ||
fn from(value: Address) -> Self { | ||
Self(value) | ||
} | ||
} | ||
|
||
impl From<WrapAddress> for Address { | ||
fn from(value: WrapAddress) -> Self { | ||
value.0 | ||
} | ||
} | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<B: Into<prost::bytes::Bytes>>(value: B) -> Result<Self, reth_db::Error> { | ||
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<Address> for WrapAddress { | ||
fn from(value: Address) -> Self { | ||
Self(value) | ||
} | ||
} | ||
|
||
impl From<WrapAddress> for Address { | ||
fn from(value: WrapAddress) -> Self { | ||
value.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters