Skip to content

Commit

Permalink
Expose GetInteropDescriptor (#3545)
Browse files Browse the repository at this point in the history
* Expose GetInteropDescriptor

* Update src/Neo/SmartContract/ApplicationEngine.cs

---------

Co-authored-by: Jimmy <jinghui@wayne.edu>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 23, 2024
1 parent 85f52f5 commit 9ed6cac
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Neo/SmartContract/ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using Array = System.Array;
using VMArray = Neo.VM.Types.Array;

Expand Down Expand Up @@ -241,9 +242,7 @@ protected static void OnSysCall(ExecutionEngine engine, Instruction instruction)
{
if (engine is ApplicationEngine app)
{
uint method = instruction.TokenU32;

app.OnSysCall(services[method]);
app.OnSysCall(GetInteropDescriptor(instruction.TokenU32));
}
else
{
Expand Down Expand Up @@ -641,6 +640,17 @@ private static InteropDescriptor Register(string name, string handler, long fixe
return descriptor;
}

/// <summary>
/// Get Interop Descriptor
/// </summary>
/// <param name="methodHash">Method Hash</param>
/// <returns>InteropDescriptor</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static InteropDescriptor GetInteropDescriptor(uint methodHash)
{
return services[methodHash];
}

/// <summary>
/// Creates a new instance of the <see cref="ApplicationEngine"/> class, and use it to run the specified script.
/// </summary>
Expand Down

0 comments on commit 9ed6cac

Please sign in to comment.