@@ -57,10 +57,36 @@ export const updateDisputeRequestData = (event: DisputeCreation): void => {
5757 if ( ! receipt ) return ;
5858
5959 const logs = receipt . logs ;
60+ const coreDisputeId = event . params . _disputeID ;
6061
6162 // note that the topic at 0th index is always the event signature
62- const disputeRequestEventIndex = logs . findIndex ( ( log ) => log . topics [ 0 ] == DisputeRequestSignature ) ;
63- const crossChainDisputeEventIndex = logs . findIndex ( ( log ) => log . topics [ 0 ] == CrossChainDisputeIncomingSignature ) ;
63+ // For DisputeRequestSignature
64+ let disputeRequestEventIndex = - 1 ;
65+ for ( let i = 0 ; i < logs . length ; i ++ ) {
66+ let log = logs [ i ] ;
67+ if ( log . topics . length > 2 && log . topics [ 0 ] == DisputeRequestSignature ) {
68+ // 3rd indexed argument in event is _arbitratorDisputeId
69+ let decodedId = ethereum . decode ( "uint256" , log . topics [ 2 ] ) ;
70+ if ( decodedId != null && coreDisputeId . equals ( decodedId . toBigInt ( ) ) ) {
71+ disputeRequestEventIndex = i ;
72+ break ;
73+ }
74+ }
75+ }
76+
77+ // For CrossChainDisputeIncomingSignature
78+ let crossChainDisputeEventIndex = - 1 ;
79+ for ( let i = 0 ; i < logs . length ; i ++ ) {
80+ let log = logs [ i ] ;
81+ if ( log . topics . length > 3 && log . topics [ 0 ] == CrossChainDisputeIncomingSignature ) {
82+ // 4th indexed argument in event is _arbitratorDisputeId
83+ let decodedId = ethereum . decode ( "uint256" , log . topics [ 3 ] ) ;
84+ if ( decodedId != null && coreDisputeId . equals ( decodedId . toBigInt ( ) ) ) {
85+ crossChainDisputeEventIndex = i ;
86+ break ;
87+ }
88+ }
89+ }
6490
6591 if ( crossChainDisputeEventIndex !== - 1 ) {
6692 const crossChainDisputeEvent = logs [ crossChainDisputeEventIndex ] ;
0 commit comments