@@ -461,7 +461,14 @@ func (t *Tracer) decodeCall(byteSignature []byte, rawCall Call) (*DecodedCall, e
461461
462462 }
463463
464- txEvents , err = t .decodeContractLogs (L , rawCall .Logs , abiResult .ABI )
464+ var allABIs []* abi.ABI
465+ if t .ABIFinder .ContractStore == nil {
466+ allABIs = append (allABIs , & abiResult .ABI )
467+ } else {
468+ allABIs = t .ABIFinder .ContractStore .GetAllABIs ()
469+ }
470+
471+ txEvents , err = t .decodeContractLogs (L , rawCall .Logs , allABIs )
465472 if err != nil {
466473 L .Debug ().Err (err ).Msg ("Failed to decode logs" )
467474 } else {
@@ -602,27 +609,29 @@ func (t *Tracer) SaveDecodedCallsAsJson(dirname string) error {
602609 return nil
603610}
604611
605- func (t * Tracer ) decodeContractLogs (l zerolog.Logger , logs []TraceLog , a abi.ABI ) ([]DecodedCommonLog , error ) {
606- l .Trace ().Msg ("Decoding events" )
612+ func (t * Tracer ) decodeContractLogs (l zerolog.Logger , logs []TraceLog , allABIs [] * abi.ABI ) ([]DecodedCommonLog , error ) {
613+ l .Trace ().Msg ("Decoding ALL events" )
607614 var eventsParsed []DecodedCommonLog
608615 for _ , lo := range logs {
609- for _ , evSpec := range a .Events {
610- if evSpec .ID .Hex () == lo .Topics [0 ] {
611- l .Trace ().Str ("Name" , evSpec .RawName ).Str ("Signature" , evSpec .Sig ).Msg ("Unpacking event" )
612- eventsMap , topicsMap , err := decodeEventFromLog (l , a , evSpec , lo )
613- if err != nil {
614- return nil , errors .Wrap (err , ErrDecodeLog )
615- }
616- parsedEvent := decodedLogFromMaps (& DecodedCommonLog {}, eventsMap , topicsMap )
617- if decodedLog , ok := parsedEvent .(* DecodedCommonLog ); ok {
618- decodedLog .Signature = evSpec .Sig
619- t .mergeLogMeta (decodedLog , lo )
620- eventsParsed = append (eventsParsed , * decodedLog )
621- l .Trace ().Interface ("Log" , parsedEvent ).Msg ("Transaction log" )
622- } else {
623- l .Trace ().
624- Str ("Actual type" , fmt .Sprintf ("%T" , decodedLog )).
625- Msg ("Failed to cast decoded event to DecodedCommonLog" )
616+ for _ , singleAbi := range allABIs {
617+ for _ , evSpec := range singleAbi .Events {
618+ if evSpec .ID .Hex () == lo .Topics [0 ] {
619+ l .Trace ().Str ("Name" , evSpec .RawName ).Str ("Signature" , evSpec .Sig ).Msg ("Unpacking event" )
620+ eventsMap , topicsMap , err := decodeEventFromLog (l , * singleAbi , evSpec , lo )
621+ if err != nil {
622+ return nil , errors .Wrap (err , ErrDecodeLog )
623+ }
624+ parsedEvent := decodedLogFromMaps (& DecodedCommonLog {}, eventsMap , topicsMap )
625+ if decodedLog , ok := parsedEvent .(* DecodedCommonLog ); ok {
626+ decodedLog .Signature = evSpec .Sig
627+ t .mergeLogMeta (decodedLog , lo )
628+ eventsParsed = append (eventsParsed , * decodedLog )
629+ l .Trace ().Interface ("Log" , parsedEvent ).Msg ("Transaction log" )
630+ } else {
631+ l .Trace ().
632+ Str ("Actual type" , fmt .Sprintf ("%T" , decodedLog )).
633+ Msg ("Failed to cast decoded event to DecodedCommonLog" )
634+ }
626635 }
627636 }
628637 }
0 commit comments