Skip to content

Commit

Permalink
Remove Oracle Request (#2795)
Browse files Browse the repository at this point in the history
* Remove Oracle Request

* Change logic

* Use invocation Counter

* Update src/Neo/SmartContract/Native/OracleContract.cs

Co-authored-by: Erik Zhang <[email protected]>

Co-authored-by: Erik Zhang <[email protected]>
  • Loading branch information
shargon and erikzhang authored Aug 3, 2022
1 parent 718fc9f commit e32ef6e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Neo/SmartContract/Native/OracleContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public long GetPrice(DataCache snapshot)
[ContractMethod(RequiredCallFlags = CallFlags.States | CallFlags.AllowCall | CallFlags.AllowNotify)]
private ContractTask Finish(ApplicationEngine engine)
{
if (engine.InvocationStack.Count != 2) throw new InvalidOperationException();
if (engine.GetInvocationCounter() != 1) throw new InvalidOperationException();
Transaction tx = (Transaction)engine.ScriptContainer;
OracleResponse response = tx.GetAttribute<OracleResponse>();
if (response == null) throw new ArgumentException("Oracle response was not found");
Expand Down

0 comments on commit e32ef6e

Please sign in to comment.