From ff34e4244681c7e17e99f134772fe52455c890aa Mon Sep 17 00:00:00 2001 From: Shargon Date: Mon, 26 Oct 2020 14:00:05 +0100 Subject: [PATCH] Add minimum oracle fee (#374) * Add minimum oracle fee * Update Oracle.cs * Update UnitTest_NativeContracts.cs * Change fee Co-authored-by: Luchuan --- .../Services/Neo/Oracle.cs | 1 + .../TestClasses/Contract_NativeContracts.cs | 5 +++++ .../UnitTest_NativeContracts.cs | 12 ++++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/Neo.SmartContract.Framework/Services/Neo/Oracle.cs b/src/Neo.SmartContract.Framework/Services/Neo/Oracle.cs index dbfe4ba5f..c7fdb028c 100644 --- a/src/Neo.SmartContract.Framework/Services/Neo/Oracle.cs +++ b/src/Neo.SmartContract.Framework/Services/Neo/Oracle.cs @@ -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); } diff --git a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NativeContracts.cs b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NativeContracts.cs index 22dff0d36..5523a90f2 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NativeContracts.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/TestClasses/Contract_NativeContracts.cs @@ -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; diff --git a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NativeContracts.cs b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NativeContracts.cs index 3f41fd48a..4c7751285 100644 --- a/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NativeContracts.cs +++ b/tests/Neo.Compiler.MSIL.UnitTests/UnitTest_NativeContracts.cs @@ -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]