22
33namespace Workbench \App \Providers ;
44
5+ use Farbcode \LaravelEvm \Events \CallPerformed ;
6+ use Farbcode \LaravelEvm \Events \TxBroadcasted ;
7+ use Farbcode \LaravelEvm \Events \TxFailed ;
8+ use Farbcode \LaravelEvm \Events \TxMined ;
9+ use Farbcode \LaravelEvm \Events \TxQueued ;
10+ use Farbcode \LaravelEvm \Events \TxReplaced ;
11+ use Illuminate \Support \Facades \Event ;
12+ use Illuminate \Support \Facades \Log ;
513use Illuminate \Support \ServiceProvider ;
614
715class WorkbenchServiceProvider extends ServiceProvider
@@ -19,6 +27,56 @@ public function register(): void
1927 */
2028 public function boot (): void
2129 {
22- //
30+ // Log read calls
31+ Event::listen (CallPerformed::class, function (CallPerformed $ e ) {
32+ Log::info ('EVM CallPerformed ' , [
33+ 'address ' => $ e ->address ,
34+ 'function ' => $ e ->function ,
35+ 'args ' => $ e ->args ,
36+ 'rawResult ' => $ e ->rawResult ,
37+ ]);
38+ });
39+
40+ // Log when transaction is queued
41+ Event::listen (TxQueued::class, function (TxQueued $ e ) {
42+ Log::info ('EVM TxQueued ' , [
43+ 'to ' => $ e ->to ,
44+ 'data ' => $ e ->data ,
45+ ]);
46+ });
47+
48+ // Log when transaction broadcasted
49+ Event::listen (TxBroadcasted::class, function (TxBroadcasted $ e ) {
50+ Log::info ('EVM TxBroadcasted ' , [
51+ 'txHash ' => $ e ->txHash ,
52+ 'fields ' => $ e ->fields ,
53+ ]);
54+ });
55+
56+ // Log when transaction mined
57+ Event::listen (TxMined::class, function (TxMined $ e ) {
58+ Log::info ('EVM TxMined ' , [
59+ 'txHash ' => $ e ->txHash ,
60+ 'receipt ' => $ e ->receipt ,
61+ ]);
62+ });
63+
64+ // Log replacement attempts
65+ Event::listen (TxReplaced::class, function (TxReplaced $ e ) {
66+ Log::info ('EVM TxReplaced ' , [
67+ 'oldTxHash ' => $ e ->oldTxHash ,
68+ 'attempt ' => $ e ->attempt ,
69+ 'newFields ' => $ e ->newFields ,
70+ ]);
71+ });
72+
73+ // Log failures
74+ Event::listen (TxFailed::class, function (TxFailed $ e ) {
75+ Log::warning ('EVM TxFailed ' , [
76+ 'to ' => $ e ->to ,
77+ 'data ' => $ e ->data ,
78+ 'reason ' => $ e ->reason ,
79+ ]);
80+ });
2381 }
2482}
0 commit comments