Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code assist for native contract. #289

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 120 additions & 6 deletions src/Neo.SmartContract.Framework/Services/Neo/Native.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,128 @@
using System.Numerics;

namespace Neo.SmartContract.Framework.Services.Neo
{
public class Native
{
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern object NEO(string method, object[] arguments);
public class NEO
{
/// <param name="method">Please input &quot;name&quot;</param>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please input "name"<

Add descriptions please

[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern string Name(string method, object[] arguments);

/// <param name="method">Please input &quot;symbol&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern string Symbol(string method, object[] arguments);

/// <param name="method">Please input &quot;decimals&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern int Decimals(string method, object[] arguments);

/// <param name="method">Please input &quot;totalSupply&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern BigInteger TotalSupply(string method, object[] arguments);

/// <param name="method">Please input &quot;BalanceOf&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern BigInteger BalanceOf(string method, byte[] scriptHash);

/// <param name="method">Please input &quot;Transfer&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern bool Transfer(string method, byte[] from, byte[] to, BigInteger amount);

/// <param name="method">Please input &quot;RegisterCandidate&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern bool RegisterCandidate(string method, byte[] publicKey);

/// <param name="method">Please input &quot;UnregisterCandidate&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern bool UnregisterCandidate(string method, byte[] publicKey);

/// <param name="method">Please input &quot;Vote&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern bool Vote(string method, byte[] scriptHash, byte[][] candidatePublicKey);

/// <param name="method">Please input &quot;GetValidators&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern byte[][] GetValidators(string method, object[] arguments);

/// <param name="method">Please input &quot;GetCandidates&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern byte[][] GetCandidates(string method, object[] arguments);

/// <param name="method">Please input &quot;GetCommittee&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern byte[][] GetCommittee(string method, object[] arguments);

/// <param name="method">Please input &quot;GetNextBlockValidators&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern byte[][] GetNextBlockValidators(string method, object[] arguments);

/// <param name="method">Please input &quot;UnclaimedGas&quot;</param>
[Appcall("0xde5f57d430d3dece511cf975a8d37848cb9e0525")]
public static extern BigInteger UnclaimedGas(string method, byte[] scriptHash, uint endBlockIndex);
}

public class GAS
{
/// <param name="method">Please input &quot;name&quot;</param>
[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern string Name(string method, object[] arguments);

/// <param name="method">Please input &quot;symbol&quot;</param>
[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern string Symbol(string method, object[] arguments);

/// <param name="method">Please input &quot;decimals&quot;</param>
[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern int Decimals(string method, object[] arguments);

/// <param name="method">Please input &quot;totalSupply&quot;</param>
[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern BigInteger TotalSupply(string method, object[] arguments);

/// <param name="method">Please input &quot;BalanceOf&quot;</param>
[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern BigInteger BalanceOf(string method, byte[] scriptHash);

/// <param name="method">Please input &quot;Transfer&quot;</param>
[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern bool Transfer(string method, byte[] from, byte[] to, BigInteger amount);
}

public class Policy
{
/// <param name="method">Please input &quot;GetMaxTransactionsPerBlock&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern BigInteger GetMaxTransactionsPerBlock(string method, object[] arguments);

/// <param name="method">Please input &quot;deGetFeePerBytecimals&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern BigInteger GetFeePerByte(string method, object[] arguments);

/// <param name="method">Please input &quot;GetBlockedAccounts&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern byte[][] GetBlockedAccounts(string method, object[] arguments);

/// <param name="method">Please input &quot;SetMaxBlockSize&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern bool SetMaxBlockSize(string method, BigInteger maxBlockSize);

/// <param name="method">Please input &quot;SetMaxTransactionsPerBlock&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern bool SetMaxTransactionsPerBlock(string method, BigInteger maxTransactionsPerBlock);

/// <param name="method">Please input &quot;SetFeePerByte&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern bool SetFeePerByte(string method, BigInteger feePerByte);

[Appcall("0x668e0c1f9d7b70a99dd9e06eadd4c784d641afbc")]
public static extern object GAS(string method, object[] arguments);
/// <param name="method">Please input &quot;BlockAccount&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern bool BlockAccount(string method, byte[] scriptHash);

[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern object Policy(string method, object[] arguments);
/// <param name="method">Please input &quot;UnblockAccount&quot;</param>
[Appcall("0xce06595079cd69583126dbfd1d2e25cca74cffe9")]
public static extern bool UnblockAccount(string method, byte[] scriptHash);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ public class Contract_Native : SmartContract.Framework.SmartContract
[DisplayName("NEO_Decimals")]
public static int NEO_Decimals()
{
return (int)Native.NEO("decimals", new object[0]);
return (int)Native.NEO.Decimals("decimals", new object[0]);
}

[DisplayName("NEO_Name")]
public static string NEO_Name()
{
return (string)Native.NEO("name", new object[0]);
return (string)Native.NEO.Name("name", new object[0]);
}

[DisplayName("GAS_Decimals")]
public static int GAS_Decimals()
{
return (int)Native.GAS("decimals", new object[0]);
return (int)Native.GAS.Decimals("decimals", new object[0]);
}

[DisplayName("GAS_Name")]
public static string GAS_Name()
{
return (string)Native.GAS("name", new object[0]);
return (string)Native.GAS.Name("name", new object[0]);
}

public static BigInteger Policy_GetFeePerByte()
{
return (BigInteger)Native.Policy("getFeePerByte", new object[0]);
return (BigInteger)Native.Policy.GetFeePerByte("getFeePerByte", new object[0]);
}
}
}