forked from neo-project/neo-devpack-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Remove old APIs: `Neo.Account.SetVotes` and `Neo.Validator.Register` 2. Add `StorageMap`
- Loading branch information
Erik Zhang
committed
Jan 8, 2018
1 parent
ffdb74e
commit d1980fc
Showing
16 changed files
with
96 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System.Numerics; | ||
|
||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public static class Helper | ||
{ | ||
public static StorageMap CreateMap(this StorageContext context, string prefix) | ||
{ | ||
return new StorageMap | ||
{ | ||
Context = context, | ||
Prefix = prefix | ||
}; | ||
} | ||
|
||
public static void Delete(this StorageMap map, byte[] key) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key); | ||
Storage.Delete(map.Context, k); | ||
} | ||
|
||
public static void Delete(this StorageMap map, string key) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key.AsByteArray()); | ||
Storage.Delete(map.Context, k); | ||
} | ||
|
||
public static byte[] Get(this StorageMap map, byte[] key) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key); | ||
return Storage.Get(map.Context, k); | ||
} | ||
|
||
public static byte[] Get(this StorageMap map, string key) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key.AsByteArray()); | ||
return Storage.Get(map.Context, k); | ||
} | ||
|
||
public static void Put(this StorageMap map, byte[] key, byte[] value) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key); | ||
Storage.Put(map.Context, k, value); | ||
} | ||
|
||
public static void Put(this StorageMap map, byte[] key, BigInteger value) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key); | ||
Storage.Put(map.Context, k, value); | ||
} | ||
|
||
public static void Put(this StorageMap map, byte[] key, string value) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key); | ||
Storage.Put(map.Context, k, value); | ||
} | ||
|
||
public static void Put(this StorageMap map, string key, byte[] value) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key.AsByteArray()); | ||
Storage.Put(map.Context, k, value); | ||
} | ||
|
||
public static void Put(this StorageMap map, string key, BigInteger value) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key.AsByteArray()); | ||
Storage.Put(map.Context, k, value); | ||
} | ||
|
||
public static void Put(this StorageMap map, string key, string value) | ||
{ | ||
byte[] k = map.Prefix.AsByteArray().Concat(new byte[] { 0 }).Concat(key.AsByteArray()); | ||
Storage.Put(map.Context, k, value); | ||
} | ||
} | ||
} |
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,8 @@ | ||
namespace Neo.SmartContract.Framework.Services.Neo | ||
{ | ||
public class StorageMap | ||
{ | ||
internal StorageContext Context; | ||
internal string Prefix; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
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,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Neo.SmartContract.Framework" version="2.5.2" targetFramework="net40" /> | ||
<package id="Neo.SmartContract.Framework" version="2.5.4" targetFramework="net40" /> | ||
</packages> |
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
Binary file not shown.
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,4 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Neo.SmartContract.Framework" version="2.5.2" targetFramework="net40" /> | ||
<package id="Neo.SmartContract.Framework" version="2.5.4" targetFramework="net40" /> | ||
</packages> |