Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add minimum oracle fee #374

Merged
merged 6 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Neo.SmartContract.Framework/Services/Neo/Oracle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Neo.SmartContract.Framework.Services.Neo
[Contract("0x3c05b488bf4cf699d0631bf80190896ebbf38c3b")]
public class Oracle
{
public const uint MinimumResponseFee = 0_10000000;
public static extern string Name { get; }
public static extern void Request(string url, string filter, string callback, object userData, long gasForResponse);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ public static string OracleName()
return Oracle.Name;
}

public static uint OracleMinimumResponseFee()
{
return Oracle.MinimumResponseFee;
}

public static string DesignationName()
{
return Designation.Name;
Expand Down
12 changes: 12 additions & 0 deletions tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NativeContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ public void Test_Oracle()
var entry = result.Pop();

Assert.AreEqual("Oracle", entry.GetString());

// Minimum Response Fee

testengine.Reset();
result = testengine.ExecuteTestCaseStandard("oracleMinimumResponseFee");

Assert.AreEqual(VMState.HALT, testengine.State);
Assert.AreEqual(1, result.Count);

entry = result.Pop();

Assert.AreEqual(0_10000000u, entry.GetInteger());
}

[TestMethod]
Expand Down