-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Neo.SmartContract.Framework according to last neo3 changes (#106)
* Update syscalls for neo3 * Update block * Fix * UT for test all syscalls * Clean ut * Update values * Update opcodes * More Syscalls * All ut * Remove CRLF * Test Account * Json Test * Update * More tests * Ensure checks * Runtime done * Native contracts * Format * Reorder UT * Native contract tests * Remove unused class * Blockchain UT Except GetContract * Blockchain UT 100% * Crypto * Clean * ReadOnly Storages * Enumerator * Iterator * Contract Unit test * Format * Format * Revert dotnet upgrade in this PR
- Loading branch information
Showing
61 changed files
with
2,806 additions
and
571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public class Block : Header | ||
public class Block | ||
{ | ||
[Syscall("Neo.Block.GetTransactionCount")] | ||
public extern int GetTransactionCount(); | ||
|
||
[Syscall("Neo.Block.GetTransactions")] | ||
public extern Transaction[] GetTransactions(); | ||
|
||
[Syscall("Neo.Block.GetTransaction")] | ||
public extern Transaction GetTransaction(int index); | ||
public readonly byte[] Hash; | ||
public readonly uint Version; | ||
public readonly byte[] PrevHash; | ||
public readonly byte[] MerkleRoot; | ||
public readonly ulong Timestamp; | ||
public readonly uint Index; | ||
public readonly byte[] NextConsensus; | ||
public readonly int TransactionsCount; | ||
} | ||
} |
27 changes: 16 additions & 11 deletions
27
src/Neo.SmartContract.Framework/Services/Neo/Blockchain.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
using System.Numerics; | ||
|
||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public static class Blockchain | ||
{ | ||
[Syscall("Neo.Blockchain.GetHeight")] | ||
[Syscall("System.Blockchain.GetHeight")] | ||
public static extern uint GetHeight(); | ||
|
||
[Syscall("Neo.Blockchain.GetHeader")] | ||
public static extern Header GetHeader(uint height); | ||
|
||
[Syscall("Neo.Blockchain.GetHeader")] | ||
public static extern Header GetHeader(byte[] hash); | ||
|
||
[Syscall("Neo.Blockchain.GetBlock")] | ||
[Syscall("System.Blockchain.GetBlock")] | ||
public static extern Block GetBlock(uint height); | ||
|
||
[Syscall("Neo.Blockchain.GetBlock")] | ||
[Syscall("System.Blockchain.GetBlock")] | ||
public static extern Block GetBlock(byte[] hash); | ||
|
||
[Syscall("Neo.Blockchain.GetTransaction")] | ||
[Syscall("System.Blockchain.GetTransaction")] | ||
public static extern Transaction GetTransaction(byte[] hash); | ||
|
||
[Syscall("Neo.Blockchain.GetContract")] | ||
[Syscall("System.Blockchain.GetTransactionFromBlock")] | ||
public static extern Transaction GetTransactionFromBlock(byte[] blockHash, int txIndex); | ||
|
||
[Syscall("System.Blockchain.GetTransactionFromBlock")] | ||
public static extern Transaction GetTransactionFromBlock(uint blockIndex, int txIndex); | ||
|
||
[Syscall("System.Blockchain.GetTransactionHeight")] | ||
public static extern BigInteger GetTransactionHeight(byte[] hash); | ||
|
||
[Syscall("System.Blockchain.GetContract")] | ||
public static extern Contract GetContract(byte[] script_hash); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
src/Neo.SmartContract.Framework/Services/Neo/ContractPropertyState.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public static class Crypto | ||
{ | ||
[Syscall("Neo.Crypto.CheckSig")] | ||
public extern static bool VerifySignature(byte[] pubkey, byte[] signature); | ||
|
||
[Syscall("System.Crypto.Verify")] | ||
public extern static bool VerifySignature(byte[] message, byte[] pubkey, byte[] signature); | ||
|
||
[Syscall("Neo.Crypto.CheckMultiSig")] | ||
public extern static bool VerifySignatures(byte[][] pubkey, byte[][] signature); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Neo.SmartContract.Framework/Services/Neo/Enumerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public class Enumerator<TValue> | ||
{ | ||
[Syscall("Neo.Enumerator.Create")] | ||
public static extern Enumerator<TValue> Create(IEnumerable<TValue> entry); | ||
|
||
[Syscall("Neo.Enumerator.Concat")] | ||
public extern Enumerator<TValue> Concat(Enumerator<TValue> value); | ||
|
||
[Syscall("Neo.Enumerator.Next")] | ||
public extern bool Next(); | ||
|
||
public extern TValue Value | ||
{ | ||
[Syscall("Neo.Enumerator.Value")] | ||
get; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public static class Json | ||
{ | ||
[Syscall("Neo.Json.Serialize")] | ||
public extern static string Serialize(object obj); | ||
|
||
[Syscall("Neo.Json.Deserialize")] | ||
public extern static object Deserialize(string json); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public class Native | ||
{ | ||
[Appcall("0x43cf98eddbe047e198a3e5d57006311442a0ca15")] | ||
public static extern object NEO(string method, object[] arguments); | ||
|
||
[Appcall("0xa1760976db5fcdfab2a9930e8f6ce875b2d18225")] | ||
public static extern object GAS(string method, object[] arguments); | ||
|
||
[Appcall("0x9c5699b260bd468e2160dd5d45dfd2686bba8b77")] | ||
public static extern object Policy(string method, object[] arguments); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.