@@ -9,31 +9,30 @@ use alloy::primitives::{Address, keccak256};
9
9
use std:: str:: FromStr ;
10
10
11
11
#[ derive( Debug , Clone , Copy ) ]
12
- struct EthereumAddress ( Address ) ;
12
+ struct AddressSqlite ( Address ) ;
13
13
14
- impl ToSql for EthereumAddress {
14
+ impl ToSql for AddressSqlite {
15
15
fn to_sql ( & self ) -> Result < ToSqlOutput < ' _ > > {
16
16
Ok ( ToSqlOutput :: from ( self . 0 . as_slice ( ) ) )
17
17
}
18
18
}
19
19
20
- // Convenience methods to convert between Address (Alloy) and EthereumAddress (Used for ToSql)
21
- impl From < Address > for EthereumAddress {
20
+ impl From < Address > for AddressSqlite {
22
21
fn from ( addr : Address ) -> Self {
23
- EthereumAddress ( addr)
22
+ AddressSqlite ( addr)
24
23
}
25
24
}
26
25
27
- impl From < EthereumAddress > for Address {
28
- fn from ( addr : EthereumAddress ) -> Self {
26
+ impl From < AddressSqlite > for Address {
27
+ fn from ( addr : AddressSqlite ) -> Self {
29
28
addr. 0
30
29
}
31
30
}
32
31
33
32
#[ derive( Debug ) ]
34
33
struct Transactions {
35
34
id : i32 ,
36
- sender : EthereumAddress ,
35
+ sender : AddressSqlite ,
37
36
transaction_type : TransactionType ,
38
37
data : Vec < u8 > ,
39
38
timestamp : i64 ,
@@ -62,8 +61,8 @@ impl ToSql for TransactionType {
62
61
#[ derive( Debug ) ]
63
62
struct Contracts {
64
63
id : i32 ,
65
- address : EthereumAddress ,
66
- signers : Vec < EthereumAddress > ,
64
+ address : AddressSqlite ,
65
+ signers : Vec < AddressSqlite > ,
67
66
transaction_id : i32 ,
68
67
}
69
68
@@ -99,7 +98,7 @@ fn initialize_db() -> Result<Connection, DatabaseError> {
99
98
// Using a fixed deployer address and init code for this example
100
99
// In production, these should be parameters or configured constants
101
100
// TODO: Change to sender of bridge address
102
- let deployer = EthereumAddress :: from (
101
+ let deployer = AddressSqlite :: from (
103
102
Address :: from_str ( "0x4000000000000000000000000000000000000000" ) . unwrap ( )
104
103
) ;
105
104
@@ -206,7 +205,7 @@ mod tests {
206
205
let mut conn = initialize_db ( ) . unwrap ( ) ;
207
206
let transaction = Transactions {
208
207
id : 0 ,
209
- sender : EthereumAddress :: from ( Address :: from_str ( "0x0000000000000000000000000000000000000001" ) . unwrap ( ) ) ,
208
+ sender : AddressSqlite :: from ( Address :: from_str ( "0x0000000000000000000000000000000000000001" ) . unwrap ( ) ) ,
210
209
transaction_type : TransactionType :: CreateToken ,
211
210
data : "0x" . as_bytes ( ) . to_vec ( ) ,
212
211
timestamp : 1715136000 ,
0 commit comments