Skip to content

Commit

Permalink
upgrade to v2.5.4
Browse files Browse the repository at this point in the history
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
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Installer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.2")]
[assembly: AssemblyVersion("2.5.4")]
//[assembly: AssemblyFileVersion("1.6.1")]
2 changes: 1 addition & 1 deletion Installer/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="NeoContractPlugin.neoproject.73db6e85-ea96-427d-9425-399625b66e69" Version="2.5.2" Language="en-US" Publisher="The Neo Project" />
<Identity Id="NeoContractPlugin.neoproject.73db6e85-ea96-427d-9425-399625b66e69" Version="2.5.4" Language="en-US" Publisher="The Neo Project" />
<DisplayName>NeoContractPlugin</DisplayName>
<Description xml:space="preserve">Allow users to create smart contract in Visual Studio.</Description>
<MoreInfo>https://github.com/neo-project/neo-devpack-dotnet</MoreInfo>
Expand Down
2 changes: 1 addition & 1 deletion Neo.ConvertTask/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.2")]
[assembly: AssemblyVersion("2.5.4")]
//[assembly: AssemblyFileVersion("1.6.1")]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Copyright>2016-2017 The Neo Project</Copyright>
<AssemblyTitle>Neo.SmartContract.Framework</AssemblyTitle>
<Version>2.5.2</Version>
<Version>2.5.4</Version>
<Authors>The Neo Project</Authors>
<TargetFrameworks>netstandard1.6;net40</TargetFrameworks>
<AssemblyName>Neo.SmartContract.Framework</AssemblyName>
Expand Down
2 changes: 0 additions & 2 deletions Neo.SmartContract.Framework/Services/Neo/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ public class Account
{
[Syscall("Neo.Account.GetVotes")]
get;
[Syscall("Neo.Account.SetVotes")]
set;
}

[Syscall("Neo.Account.GetBalance")]
Expand Down
76 changes: 76 additions & 0 deletions Neo.SmartContract.Framework/Services/Neo/Helper.cs
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);
}
}
}
8 changes: 8 additions & 0 deletions Neo.SmartContract.Framework/Services/Neo/StorageMap.cs
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;
}
}
8 changes: 0 additions & 8 deletions Neo.SmartContract.Framework/Services/Neo/Validator.cs

This file was deleted.

Binary file modified Template.CSharp/Neo.ConvertTask.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Template.CSharp/ProjectTemplate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Neo.SmartContract.Framework, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Neo.SmartContract.Framework.2.5.2\lib\net40\Neo.SmartContract.Framework.dll</HintPath>
<Reference Include="Neo.SmartContract.Framework, Version=2.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Neo.SmartContract.Framework.2.5.4\lib\net40\Neo.SmartContract.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System"/>
Expand Down
2 changes: 1 addition & 1 deletion Template.CSharp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.2")]
[assembly: AssemblyVersion("2.5.4")]
//[assembly: AssemblyFileVersion("1.6.1")]
2 changes: 1 addition & 1 deletion Template.CSharp/packages_t.config
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>
2 changes: 1 addition & 1 deletion Template.VB/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.5.2")>
<Assembly: AssemblyVersion("2.5.4")>
'<Assembly: AssemblyFileVersion("1.0.0.0")>
Binary file modified Template.VB/Neo.ConvertTask.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Template.VB/ProjectTemplate.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
</PropertyGroup>

<ItemGroup>
<Reference Include="Neo.SmartContract.Framework, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Neo.SmartContract.Framework.2.5.2\lib\net40\Neo.SmartContract.Framework.dll</HintPath>
<Reference Include="Neo.SmartContract.Framework, Version=2.5.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Neo.SmartContract.Framework.2.5.4\lib\net40\Neo.SmartContract.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion Template.VB/packages_t.config
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>

0 comments on commit d1980fc

Please sign in to comment.