@@ -99,7 +99,7 @@ func StartVetoSlasherObserver(ctx context.Context, address string, vault string)
9999 continue
100100 }
101101
102- decoded := make (map [string ]interface {})
102+ decoded := make (map [string ]interface {}) //<-- here to change
103103 if err := parsedABI .UnpackIntoMap (decoded , event .Name , vLog .Data ); err != nil {
104104 log .Printf ("❌ [%s] Failed to unpack data: %v" , address , err )
105105 continue
@@ -124,6 +124,23 @@ func StartVetoSlasherObserver(ctx context.Context, address string, vault string)
124124 alertmanager .SendStructuredData (alertData )
125125 metrics .SlashingEventCounter .WithLabelValues (vault , address ).Inc ()
126126
127+ if event .Name == "RequestSlash" {
128+ operatorAddr , ok1 := decoded ["operator" ].(common.Address )
129+ subnetworkRaw , ok2 := decoded ["subnetwork" ].(string )
130+ slashAmount , ok3 := decoded ["slashAmount" ].(* big.Int )
131+
132+ if ! ok1 || ! ok2 || ! ok3 {
133+ log .Printf ("⚠️ [%s] Failed to cast RequestSlash fields properly" , address )
134+ continue
135+ }
136+
137+ amountFloat , _ := new (big.Float ).SetInt (slashAmount ).Float64 ()
138+
139+ metrics .AmountSlashedEventCounter .
140+ WithLabelValues (vault , operatorAddr .Hex (), subnetworkRaw ).
141+ Add (amountFloat )
142+ }
143+
127144 case <- ctx .Done ():
128145 log .Printf ("🛑 [%s] Stopping observer..." , address )
129146 return
0 commit comments