@@ -44,15 +44,24 @@ public partial class ApplicationEngine : ExecutionEngine
44
44
/// </summary>
45
45
public const long TestModeGas = 20_00000000 ;
46
46
47
+ public delegate void OnInstanceHandlerEvent ( ApplicationEngine engine ) ;
48
+ public delegate void OnLogEvent ( ApplicationEngine engine , LogEventArgs args ) ;
49
+ public delegate void OnNotifyEvent ( ApplicationEngine engine , NotifyEventArgs args ) ;
50
+
47
51
/// <summary>
48
52
/// Triggered when a contract calls System.Runtime.Notify.
49
53
/// </summary>
50
- public static event EventHandler < NotifyEventArgs > Notify ;
54
+ public event OnNotifyEvent Notify ;
51
55
52
56
/// <summary>
53
57
/// Triggered when a contract calls System.Runtime.Log.
54
58
/// </summary>
55
- public static event EventHandler < LogEventArgs > Log ;
59
+ public event OnLogEvent Log ;
60
+
61
+ /// <summary>
62
+ /// On Application Engine
63
+ /// </summary>
64
+ public static OnInstanceHandlerEvent InstanceHandler ;
56
65
57
66
private static Dictionary < uint , InteropDescriptor > services ;
58
67
// Total amount of GAS spent to execute.
@@ -435,8 +444,11 @@ public static ApplicationEngine Create(TriggerType trigger, IVerifiable containe
435
444
// Adjust jump table according persistingBlock
436
445
437
446
var jumpTable = settings == null || settings . IsHardforkEnabled ( Hardfork . HF_Echidna , index ) ? DefaultJumpTable : NotEchidnaJumpTable ;
438
- return Provider ? . Create ( trigger , container , snapshot , persistingBlock , settings , gas , diagnostic , jumpTable )
447
+ var engine = Provider ? . Create ( trigger , container , snapshot , persistingBlock , settings , gas , diagnostic , jumpTable )
439
448
?? new ApplicationEngine ( trigger , container , snapshot , persistingBlock , settings , gas , diagnostic , jumpTable ) ;
449
+
450
+ InstanceHandler ? . Invoke ( engine ) ;
451
+ return engine ;
440
452
}
441
453
442
454
/// <summary>
0 commit comments