Skip to content

Commit

Permalink
synchronize with AntShares 2.0.0-preview1
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Zhang committed Jun 2, 2017
1 parent 8e94227 commit f1e9c65
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 54 deletions.
4 changes: 2 additions & 2 deletions src/AntShares.ILConvertPlugin/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("1.6.1")]
[assembly: AssemblyFileVersion("1.6.1")]
[assembly: AssemblyVersion("2.0.0")]
//[assembly: AssemblyFileVersion("1.6.1")]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Copyright>2016 The Antshares team</Copyright>
<AssemblyTitle>AntShares.SmartContract.Framework</AssemblyTitle>
<Version>1.6.1</Version>
<Version>2.0.0</Version>
<Authors>The Antshares team</Authors>
<TargetFrameworks>netstandard1.6;net40</TargetFrameworks>
<AssemblyName>AntShares.SmartContract.Framework</AssemblyName>
Expand Down
5 changes: 1 addition & 4 deletions src/AntShares.SmartContract.Framework/Contract.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using AntShares.SmartContract.Framework.Services.System;
using AntShares.VM;
using AntShares.VM;

namespace AntShares.SmartContract.Framework
{
public class Contract
{
protected static ExecutionEngine ExecutionEngine { get; } = new ExecutionEngine();

[OpCode(OpCode.SHA1)]
protected extern static byte[] Sha1(byte[] data);

Expand Down
5 changes: 1 addition & 4 deletions src/AntShares.SmartContract.Framework/FunctionCode.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using AntShares.SmartContract.Framework.Services.AntShares;

namespace AntShares.SmartContract.Framework
namespace AntShares.SmartContract.Framework
{
public class FunctionCode : Contract
{
protected static Storage Storage { get; } = new Storage();
}
}
4 changes: 2 additions & 2 deletions src/AntShares.SmartContract.Framework/OpCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public enum OpCode : byte
// Note: Arithmetic inputs are limited to signed 32-bit integers, but may overflow their output.
INC = 0x8B, // 1 is added to the input.
DEC = 0x8C, // 1 is subtracted from the input.
SAL = 0x8D, // The input is multiplied by 2.
SAR = 0x8E, // The input is divided by 2.
//SAL = 0x8D, // The input is multiplied by 2.
//SAR = 0x8E, // The input is divided by 2.
NEGATE = 0x8F, // The sign of the input is flipped.
ABS = 0x90, // The input is made positive.
NOT = 0x91, // If the input is 0 or 1, it is flipped. Otherwise the output will be 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ public class Asset
[Syscall("AntShares.Asset.GetIssuer")]
get;
}

[Syscall("AntShares.Asset.Renew")]
public extern uint Renew(byte years);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,22 @@ public static class Blockchain
[Syscall("AntShares.Blockchain.GetAccount")]
public static extern Account GetAccount(byte[] script_hash);

[Syscall("AntShares.Blockchain.RegisterValidator")]
public static extern byte[] RegisterValidator(byte[] pubkey);

[Syscall("AntShares.Blockchain.GetValidators")]
public static extern byte[][] GetValidators();

[Syscall("AntShares.Blockchain.CreateAsset")]
public static extern Asset CreateAsset(byte asset_type, string name, long amount, byte precision, byte[] owner, byte[] admin, byte[] issuer);

[Syscall("AntShares.Blockchain.GetAsset")]
public static extern Asset GetAsset(byte[] asset_id);

[Syscall("AntShares.Blockchain.CreateContract")]
public static extern Contract CreateContract(byte[] script, byte[] parameter_list, byte return_type, bool need_storage, string name, string version, string author, string email, string description);

[Syscall("AntShares.Blockchain.GetContract")]
public static extern Contract GetContract(byte[] script_hash);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace AntShares.SmartContract.Framework.Services.AntShares
{
public class Contract
{
public extern byte[] Script
{
[Syscall("AntShares.Contract.GetScript")]
get;
}

[Syscall("AntShares.Contract.Destroy")]
public static extern void Destroy();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
namespace AntShares.SmartContract.Framework.Services.AntShares
{
public class Storage
public static class Storage
{
public static extern StorageContext CurrentContext
{
[Syscall("AntShares.Storage.GetContext")]
get;
}

[Syscall("AntShares.Storage.Get")]
public extern byte[] Get(StorageContext context, byte[] key);
public static extern byte[] Get(StorageContext context, byte[] key);

[Syscall("AntShares.Storage.Get")]
public extern byte[] Get(StorageContext context, string key);
public static extern byte[] Get(StorageContext context, string key);

[Syscall("AntShares.Storage.Put")]
public extern void Put(StorageContext context, byte[] key, byte[] value);
public static extern void Put(StorageContext context, byte[] key, byte[] value);

[Syscall("AntShares.Storage.Put")]
public extern void Put(StorageContext context, byte[] key, string value);
public static extern void Put(StorageContext context, byte[] key, string value);

[Syscall("AntShares.Storage.Put")]
public extern void Put(StorageContext context, string key, byte[] value);
public static extern void Put(StorageContext context, string key, byte[] value);

[Syscall("AntShares.Storage.Put")]
public extern void Put(StorageContext context, string key, string value);
public static extern void Put(StorageContext context, string key, string value);

[Syscall("AntShares.Storage.Delete")]
public extern void Delete(StorageContext context, byte[] key);
public static extern void Delete(StorageContext context, byte[] key);

[Syscall("AntShares.Storage.Delete")]
public extern void Delete(StorageContext context, string key);
public static extern void Delete(StorageContext context, string key);
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
using System;

namespace AntShares.SmartContract.Framework.Services.AntShares
namespace AntShares.SmartContract.Framework.Services.AntShares
{
[Flags]
public enum StorageContext : byte
public class StorageContext
{
Current = 1,
CallingContract = 2,
EntryContract = 4
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
namespace AntShares.SmartContract.Framework.Services.System
{
public class ExecutionEngine
public static class ExecutionEngine
{
public extern IScriptContainer ScriptContainer
public static extern IScriptContainer ScriptContainer
{
[Syscall("System.ExecutionEngine.GetScriptContainer")]
get;
}

public extern byte[] ExecutingScriptHash
public static extern byte[] ExecutingScriptHash
{
[Syscall("System.ExecutionEngine.GetExecutingScriptHash")]
get;
}

public extern byte[] CallingScriptHash
public static extern byte[] CallingScriptHash
{
[Syscall("System.ExecutionEngine.GetCallingScriptHash")]
get;
}

public extern byte[] EntryScriptHash
public static extern byte[] EntryScriptHash
{
[Syscall("System.ExecutionEngine.GetEntryScriptHash")]
get;
Expand Down
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("1.6.1")]
[assembly: AssemblyFileVersion("1.6.1")]
[assembly: AssemblyVersion("2.0.0")]
//[assembly: AssemblyFileVersion("1.6.1")]
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="AntShares.SmartContract.antshares.73db6e85-ea96-427d-9425-399625b66e69" Version="1.6.1" Language="en-US" Publisher="The Antshares team" />
<Identity Id="AntShares.SmartContract.antshares.73db6e85-ea96-427d-9425-399625b66e69" Version="2.0.0" Language="en-US" Publisher="The Antshares team" />
<DisplayName>AntShares.SmartContract</DisplayName>
<Description xml:space="preserve">AntShares Smart Contract</Description>
<MoreInfo>https://github.com/AntShares/AntShares.SmartContract.Framework</MoreInfo>
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions src/AntShares.SmartContract.Template/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="AntShares.SmartContract.Framework, Version=1.6.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\AntShares.SmartContract.Framework.1.6.1\lib\net40\AntShares.SmartContract.Framework.dll</HintPath>
<Reference Include="AntShares.SmartContract.Framework, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\AntShares.SmartContract.Framework.2.0.0\lib\net40\AntShares.SmartContract.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System"/>
Expand Down
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("1.6.1")]
[assembly: AssemblyFileVersion("1.6.1")]
[assembly: AssemblyVersion("2.0.0")]
//[assembly: AssemblyFileVersion("1.6.1")]
2 changes: 1 addition & 1 deletion src/AntShares.SmartContract.Template/packages.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="AntShares.SmartContract.Framework" version="1.6.1" targetFramework="net40" />
<package id="AntShares.SmartContract.Framework" version="2.0.0" targetFramework="net40" />
</packages>

0 comments on commit f1e9c65

Please sign in to comment.