Skip to content

Commit

Permalink
Add minimum oracle fee (#374)
Browse files Browse the repository at this point in the history
* Add minimum oracle fee

* Update Oracle.cs

* Update UnitTest_NativeContracts.cs

* Change fee

Co-authored-by: Luchuan <luchuan@ngd.neo.org>
  • Loading branch information
shargon and Tommo-L authored Oct 26, 2020
1 parent 936fa5d commit ff34e42
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
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

0 comments on commit ff34e42

Please sign in to comment.