@@ -44,15 +44,24 @@ public partial class ApplicationEngine : ExecutionEngine
4444 /// </summary>
4545 public const long TestModeGas = 20_00000000 ;
4646
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+
4751 /// <summary>
4852 /// Triggered when a contract calls System.Runtime.Notify.
4953 /// </summary>
50- public static event EventHandler < NotifyEventArgs > Notify ;
54+ public event OnNotifyEvent Notify ;
5155
5256 /// <summary>
5357 /// Triggered when a contract calls System.Runtime.Log.
5458 /// </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 ;
5665
5766 private static Dictionary < uint , InteropDescriptor > services ;
5867 // Total amount of GAS spent to execute.
@@ -435,8 +444,11 @@ public static ApplicationEngine Create(TriggerType trigger, IVerifiable containe
435444 // Adjust jump table according persistingBlock
436445
437446 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 )
439448 ?? new ApplicationEngine ( trigger , container , snapshot , persistingBlock , settings , gas , diagnostic , jumpTable ) ;
449+
450+ InstanceHandler ? . Invoke ( engine ) ;
451+ return engine ;
440452 }
441453
442454 /// <summary>
0 commit comments