@@ -25,14 +25,15 @@ use astria_withdrawer::{
25
25
SequencerWithdrawalFilter ,
26
26
} ;
27
27
use ethers:: {
28
+ self ,
29
+ abi:: AbiEncode ,
28
30
contract:: EthEvent ,
29
31
providers:: Middleware ,
30
32
types:: {
31
33
Filter ,
32
34
Log ,
33
35
H256 ,
34
36
} ,
35
- utils:: hex:: ToHexExt as _,
36
37
} ;
37
38
pub use generated:: * ;
38
39
@@ -379,6 +380,7 @@ where
379
380
. ok_or_else ( || GetWithdrawalActionsError :: log_without_block_number ( & log) ) ?
380
381
. as_u64 ( ) ;
381
382
383
+ // TODO: add log index
382
384
let rollup_withdrawal_event_id = log
383
385
. transaction_hash
384
386
. ok_or_else ( || GetWithdrawalActionsError :: log_without_transaction_hash ( & log) ) ?
@@ -437,10 +439,16 @@ where
437
439
. ok_or_else ( || GetWithdrawalActionsError :: log_without_block_number ( & log) ) ?
438
440
. as_u64 ( ) ;
439
441
440
- let rollup_withdrawal_event_id = log
442
+ let transaction_hash = log
441
443
. transaction_hash
442
444
. ok_or_else ( || GetWithdrawalActionsError :: log_without_transaction_hash ( & log) ) ?
443
445
. encode_hex ( ) ;
446
+ let event_index = log
447
+ . log_index
448
+ . ok_or_else ( || GetWithdrawalActionsError :: log_without_log_index ( & log) ) ?
449
+ . encode_hex ( ) ;
450
+
451
+ let rollup_withdrawal_event_id = transaction_hash + & event_index;
444
452
445
453
let event = decode_log :: < SequencerWithdrawalFilter > ( log)
446
454
. map_err ( GetWithdrawalActionsError :: decode_log) ?;
@@ -503,6 +511,11 @@ impl GetWithdrawalActionsError {
503
511
fn log_without_transaction_hash ( _log : & Log ) -> Self {
504
512
Self ( GetWithdrawalActionsErrorKind :: LogWithoutTransactionHash )
505
513
}
514
+
515
+ // XXX: Somehow identify the log?
516
+ fn log_without_log_index ( _log : & Log ) -> Self {
517
+ Self ( GetWithdrawalActionsErrorKind :: LogWithoutLogIndex )
518
+ }
506
519
}
507
520
508
521
#[ derive( Debug , thiserror:: Error ) ]
@@ -519,6 +532,8 @@ enum GetWithdrawalActionsErrorKind {
519
532
LogWithoutBlockNumber ,
520
533
#[ error( "log did not contain a transaction hash" ) ]
521
534
LogWithoutTransactionHash ,
535
+ #[ error( "log did not contain a log index" ) ]
536
+ LogWithoutLogIndex ,
522
537
#[ error( transparent) ]
523
538
CalculateWithdrawalAmount ( CalculateWithdrawalAmountError ) ,
524
539
}
0 commit comments