Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

update scapi #1145

Merged
merged 21 commits into from
Dec 18, 2020
Merged
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
38 changes: 19 additions & 19 deletions docs/en-us/reference/governance_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ An address can be registered as candidate or unregistered afterwards. Correspond

| Method | Parameters | Fee in GAS |
| ---- | ------------------------------------ | ---- |
| [`registerCandidate`](govapi/registerCandidate.md) | byte[] publicKey | 0.05 |
| [`unregisterCandidate`](govapi/unregisterCandidate.md) | byte[] publicKey | 0.05 |
| [`RegisterCandidate`](scapi/fw/dotnet/neo/Neo/RegisterCandidate.md) | UInt160 publicKey | 0.05 |
| [`UnregisterCandidate`](scapi/fw/dotnet/neo/Neo/UnregisterCandidate.md) | UInt160 publicKey | 0.05 |

> [!Note]
>
Expand All @@ -51,15 +51,15 @@ Voting contract method is as follows. Please not that voter's signature will be

| Method | Parameters | Fee in GAS |
| ---- | ------------------------------------ | ---- |
| [`vote`](govapi/vote.md) | byte[] account, byte[] voteTo | 5 |
| [`Vote`](scapi/fw/dotnet/neo/Neo/Vote.md) | UInt160 account, byte[] voteTo | 5 |

As voters' votes & held NEO, as well as registered candidates keep changing, candidate set and their votes are re-calculated in every block.

#### Corresponding contract methods

| Method | Parameters | Fee in GAS |
| ---- | ------------------------------------ | ---- |
| [`getCandidates`](govapi/getCandidates.md) | null | 1 |
| [`GetCandidates`](scapi/fw/dotnet/neo/Neo/GetCandidates.md) | null | 1 |

### Committee

Expand All @@ -76,21 +76,21 @@ Method definition and corresponding fee are defined in PolicyContract as shown b

| Method | Parameters | Fee in GAS |
| ---- | ------------------------------------ | ---- |
| [`setMaxBlockSize`](govapi/setMaxBlockSize.md) | uint blockSize | 0.03 |
| [`setMaxTransactionsPerBlock`](govapi/setMaxTransactionsPerBlock.md) | uint maxTransactions | 0.03 |
| [`setFeePerByte`](govapi/setFeePerByte.md) | long feePerByte | 0.03 |
| [`blockAccount`](govapi/blockAccount.md) | byte[] account | 0.03 |
| [`unblockAccount`](govapi/unblockAccount.md) | byte[] account | 0.03 |
| [`SetMaxBlockSize`](scapi/fw/dotnet/neo/Policy/SetMaxBlockSize.md) | uint blockSize | 0.03 |
| [`SetMaxTransactionsPerBlock`](scapi/fw/dotnet/neo/Policy/SetMaxTransactionsPerBlock.md) | uint maxTransactions | 0.03 |
| [`SetFeePerByte`](scapi/fw/dotnet/neo/Policy/SetFeePerByte.md) | long feePerByte | 0.03 |
| [`BlockAccount`](scapi/fw/dotnet/neo/Policy/BlockAccount.md) | UInt160 account | 0.03 |
| [`UnblockAccount`](scapi/fw/dotnet/neo/Policy/UnblockAccount.md) | UInt160 account | 0.03 |

To bring such modification into effect, committee members should send a transaction which calls corresponding method & includes enough signatures on chain. This transaction is executed as long as it's signed by more than half of the committee members.

Furthermore, PolicyContract also supports corresponding reading methods:

| Method | Parameters | Fee in GAS |
| ---- | ------------------------------------ | ---- |
| [`getMaxBlockSize`](govapi/getMaxBlockSize.md) | null | 0.01 |
| [`getMaxTransactionsPerBlock`](govapi/getMaxTransactionsPerBlock.md) | null | 0.01 |
| [`getFeePerByte`](govapi/getFeePerByte.md) | null | 0.01 |
| [`GetMaxBlockSize`](scapi/fw/dotnet/neo/Policy/GetMaxBlockSize.md) | null | 0.01 |
| [`GetMaxTransactionsPerBlock`](scapi/fw/dotnet/neo/Policy/GetMaxTransactionsPerBlock.md) | null | 0.01 |
| [`GetFeePerByte`](scapi/fw/dotnet/neo/Policy/GetFeePerByte.md) | null | 0.01 |
| [`getBlockedAccounts`](govapi/getBlockedAccounts.md) | null | 0.01 |

#### How Are Committee Members Elected
Expand All @@ -103,7 +103,7 @@ Committee members will be refreshed every block.

| Method | Parameters | Fee in GAS | Return value |
| ---- | ------------------------------------ | ---- | ---- |
| [`getCommittee`](govapi/getCommittee.md) | null | 1 | Current committee members in format of Array<ECPoint> |
| [`GetCommittee`](scapi/fw/dotnet/neo/Neo/GetCommittee.md) | null | 1 | Current committee members in format of Array<ECPoint> |

### Validator

Expand All @@ -122,7 +122,7 @@ Similar to committee members, validators will be refreshed every block.
| Method | Parameters | Fee in GAS | Return value |
| ---- | ------------------------------------ | ---- | ---- |
| [`getValidators`](govapi/getValidators.md) | null | 1 | Current validators in format of Array<ECPoint> |
| [`getNextBlockValidators`](govapi/getNextBlockValidators.md) | null | 1 | Validators by persisting block in format of Array<ECPoint> |
| [`GetNextBlockValidators`](scapi/fw/dotnet/neo/Neo/GetNextBlockValidators.md) | null | 1 | Validators by persisting block in format of Array<ECPoint> |

## Token Distribution

Expand All @@ -134,7 +134,7 @@ Half of total NEO amount, or 50 million tokens are distributed in genesis block

3. Remaining half is distributed to standby validators' multi-signature address

All interactions in Neo are performed through transactions. Sending a transaction on chain requires paying GAS tokens as fee, including system fee and network fee. System fee will be burnt as resource consumption for transaction execution, while network fee will be distributed to the speaker (the validator who start a new-block proposal) of the block where corresponding transaction is included.
All interactions in Neo are performed through transactions. Sending a transaction on chain requires paying GAS tokens as fee, including system fee and network fee. System fee will be burnt as resource consumption for transaction execution, while network fee will be distributed to the speaker (the validator who start a new-block proposal) of the block where corresponding transaction is included.

## Nep5 Contract method

Expand All @@ -145,14 +145,14 @@ NEO and GAS are [Nep5](https://github.com/neo-project/proposals/blob/master/nep-
| [`name`](govapi/name.md) | null | 0 | Token name in String |
| [`symbol`](govapi/symbol.md) | null | 0 | Token symbol in String |
| [`decimals`](govapi/decimals.md) | null | 0.01 | Token decimals in UInt |
| [`totalSupply`](govapi/totalSupply.md) | null | 0.01 | Token total supply in BigInteger |
| [`balanceOf`](govapi/balanceOf.md) | byte[] account | 0.01 | account balance in BigInteger |
| [`transfer`](govapi/transfer.md) | byte[] from, byte[] to, BigInteger amount | 0.08 | Send specified amount of token from Address *from* to Address *to*. Please note that it will check *from*'s signature, whether caller is *from*, whether *to* is payable, whether *from*'s balance is enough |
| [`TotalSupply`](scapi/fw/dotnet/neo/Neo/TotalSupply.md) | null | 0.01 | Token total supply in BigInteger |
| [`BalanceOf`](scapi/fw/dotnet/neo/Neo/BalanceOf.md) | UInt160 account | 0.01 | account balance in BigInteger |
| [`Transfer`](scapi/fw/dotnet/neo/Neo/Transfer.md) | UInt160 from, UInt160 to, BigInteger amount | 0.08 | Send specified amount of token from Address *from* to Address *to*. Please note that it will check *from*'s signature, whether caller is *from*, whether *to* is payable, whether *from*'s balance is enough |
| [`onPersist`](govapi/onPersist.md) | null | 0 | Manually perform actions this Nep5 contract will do upon block persisting |
| [`supportedStandards`](govapi/supportedStandards.md) | null | 0 | Supported NEP standards in String[] |

Contract methods by NEO:

| Method | Parameters | Fee in GAS | Return value |
| ---- | ------------------------------------ | ---- | ---- |
| [`unclaimedGas`](govapi/unclaimedGas.md) | byte[] account | 0.03 | unclaimed GAS amount of this address in uint |
| [`UnclaimedGas`](scapi/fw/dotnet/neo/Neo/UnclaimedGas.md) | UInt160 account | 0.03 | unclaimed GAS amount of this address in uint |
2 changes: 1 addition & 1 deletion docs/en-us/reference/scapi/fw/dotnet/neo/Crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Static class, which provides a method to verify signatures by ECDsa

Namespace[Neo.SmartContract.Framework.Services.Neo](../neo.md)
Namespace: [Neo.SmartContract.Framework.Services.Neo](../neo.md)

Assembly: Neo.SmartContract.Framework

Expand Down
25 changes: 25 additions & 0 deletions docs/en-us/reference/scapi/fw/dotnet/neo/Designation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Designation Class

Provides a set of methods of the native contract Designation, which hash is `0x7062149f9377e3a110a343f811b9e406f8ef7824`.

Namespace: [Neo.SmartContract.Framework.Services.Neo](../neo.md)

Assembly: Neo.SmartContract.Framework

## Syntax

```c#
public class Oracle
```

## Methods

| Name | Description |
| ---- | ------------- |
| Name | Contract name |

## Constructor

| Name | Description |
| ------------------------------------------------------------ | --------------------------- |
| [GetDesignatedByRole(DesignationRole role, uint index)](Designation/GetDesignatedByRole.md) | Initiates an Oracle request |
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# GetDesignatedByRole Method (DesignationRole, uint )

Initiates an Oracle request.

Namespace: [Neo.SmartContract.Framework.Services.Neo](../../neo.md)

Assembly: Neo.SmartContract.Framework

## Syntax

```c#
public static extern ECPoint[] GetDesignatedByRole(DesignationRole role, uint index);
```

Parameters:

- role: system role
- index: block height

`DesignationRole`, the enumeration type, which can be:

- `StateValidator`: the validator node
- `Oracle`: the Oracle node

## Example

```c#
public class Contract1 : SmartContract.Framework.SmartContract
{
public static void Main()
{
ECPoint[] oracles = Designation.GetDesignatedByRole(DesignationRole.Oracle, 1000);
return oracles;
}
}
```

Response body:

```json
[{
"type": "Array",
"value": [{
"type": "ByteString",
"value": "Auj/F8Vn1i8nT\u002BJHzIhKKmzTuP0Nd5qMWFYomlYKzKy0"
}]
}]
```

Response description:

- Array type: Oracle nodes list

- Other: failed.


6 changes: 3 additions & 3 deletions docs/en-us/reference/scapi/fw/dotnet/neo/Gas.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GAS Class

Provides a series of attributes and methods of the native contract GasToken.
Provides a series of attributes and methods of the native contract GasToken, which contract hash is 0x36a019d836d964c438c573f78badf79b9e7eebdd.

Namespace: [Neo.SmartContract.Framework.Services.Neo](../neo.md)

Expand All @@ -25,5 +25,5 @@ public class GAS
| Name | Description |
| ------------------------------------------------------------ | ---------------------------- |
| [TotalSupply()](Gas/TotalSupply.md) | Gets the total supply of GAS |
| [BalanceOf(byte\[\] account)](Gas/BalanceOf.md) | Gets the balance |
| [Transfer(byte\[\] from, byte\[\] to, BigInteger amount)](Gas/Transfer.md) | Transfers GAS |
| [BalanceOf(UInt160 account)](Gas/BalanceOf.md) | Gets the balance |
| [Transfer(UInt160 from, UInt160 to, BigInteger amount)](Gas/Transfer.md) | Transfers GAS |
17 changes: 16 additions & 1 deletion docs/en-us/reference/scapi/fw/dotnet/neo/Gas/BalanceOf.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Parameters:
```c#
public class Contract1 : SmartContract.Framework.SmartContract
{
private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();
private static readonly UInt160 account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();

public static object Main()
{
Expand All @@ -31,4 +31,19 @@ public class Contract1 : SmartContract.Framework.SmartContract
}
```

Response body:

```json
{
"Type":"Integer",
"value":"100000000"
}
```

Response description

- Integer type: The account balance obtained successfully.

- Other: failed.

[Back](../Gas.md)
26 changes: 20 additions & 6 deletions docs/en-us/reference/scapi/fw/dotnet/neo/Gas/Transfer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Transfer Method (byte[], byte[], BigInteger)
# Transfer Method (UInt160, UInt160, BigInteger)

Transfers GAS

Expand All @@ -9,7 +9,7 @@ Assembly: Neo.SmartContract.Framework
## Syntax

```c#
public static extern bool Transfer(byte[] from, byte[] to, BigInteger amount);
public static extern bool Transfer(UInt160 from, UInt160 to, BigInteger amount);
```

Parameters:
Expand All @@ -23,16 +23,30 @@ Parameters:
```c#
public class Contract1 : SmartContract.Framework.SmartContract
{
private static readonly byte[] from = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();
private static readonly byte[] to = "NXjtqYERuvSWGawjVux8UerNejvwdYg7eE".ToScriptHash();
private static readonly UInt160 from = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();
private static readonly UInt160 to = "NXjtqYERuvSWGawjVux8UerNejvwdYg7eE".ToScriptHash();

public static object Main()
{
BigInterger value = 1000;
bool result = GAS.Transfer(from, to, value);
bool result = GAS.Transfer(from, to, 1000);
return result;
}
}
```

Respond:

```json
{
"type":"Boolean",
"value":"true"
}
```

Respond description:

- Boolean type: true means assets are transferred successfully.

- Others: failed.

[Back](../Gas.md)
14 changes: 7 additions & 7 deletions docs/en-us/reference/scapi/fw/dotnet/neo/Neo.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Neo Class

Provides a series of attributes and methods of the native contract NeoToken.
Provides a series of attributes and methods of the native contract NeoToken, which contract hash is 0xe22f9134cef8b03e53f71b3f960a20a65cddc972.

Namespace: [Neo.SmartContract.Framework.Services.Neo](../neo.md)

Expand All @@ -25,14 +25,14 @@ public class NEO
| Name | Description |
| ------------------------------------------------------------ | ----------------------------------------------- |
| [TotalSupply()](Neo/TotalSupply.md) | Gets the total supply of NEO |
| [BalanceOf(byte\[\] account)](Neo/BalanceOf.md) | Gets the balance |
| [Transfer(byte\[\] from, byte\[\] to, BigInteger amount)](Neo/Transfer.md) | Transfers NEO |
| [BalanceOf(UInt160 account)](Neo/BalanceOf.md) | Gets the balance |
| [Transfer(UInt160 from, UInt160 to, BigInteger amount)](Neo/Transfer.md) | Transfers NEO |
| [SetGasPerBlock(BigInteger gasPerBlock)](Neo/SetGasPerBlock.md) | Sets the number of GAS generated for each block |
| [GetGasPerBlock()](Neo/GetGasPerBlock.md) | Gets the number of GAS generated for each block |
| [UnclaimedGas(byte\[\] account, uint end)](Neo/UnclaimedGas.md) | Gets the number of unclaimed GAS |
| [RegisterCandidate(byte\[\] pubkey)](Neo/RegisterCandidate.md) | Registers as a candidate |
| [UnRegisterCandidate(byte\[\] pubkey)](Neo/UnRegisterCandidate.md) | Unregisters as a candidate |
| [Vote(byte\[\] account, byte\[\] voteTo)](Neo/Vote.md) | Votes for candidates |
| [UnclaimedGas(UInt160 account, uint end)](Neo/UnclaimedGas.md) | Gets the number of unclaimed GAS |
| [RegisterCandidate(ECPoint pubkey)](Neo/RegisterCandidate.md) | Registers as a candidate |
| [UnRegisterCandidate(ECPoint pubkey)](Neo/UnRegisterCandidate.md) | Unregisters as a candidate |
| [Vote(UInt160 account, ECPoint voteTo)](Neo/Vote.md) | Votes for candidates |
| [GetCandidates()](Neo/GetCandidates.md) | Gets candidates list |
| [GetCommittee()](Neo/GetCommittee.md) | Gets committee members list |
| [GetNextBlockValidators()](Neo/GetNextBlockValidators.md) | Gets validators list for the next block |
24 changes: 20 additions & 4 deletions docs/en-us/reference/scapi/fw/dotnet/neo/Neo/BalanceOf.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# BalanceOf Method (byte[])
# BalanceOf Method (UInt160)

Gets the NEO balance in the account.

Expand All @@ -9,7 +9,7 @@ Assembly: Neo.SmartContract.Framework
## Syntax

```c#
public static extern BigInteger BalanceOf(byte[] account);
public static extern BigInteger BalanceOf(UInt160 account);
```

Parameters:
Expand All @@ -21,7 +21,7 @@ Parameters:
```c#
public class Contract1 : SmartContract.Framework.SmartContract
{
private static readonly byte[] account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();
private static readonly UInt160 account = "NXsG3zwpwcfvBiA3bNMx6mWZGEro9ZqTqM".ToScriptHash();

public static object Main()
{
Expand All @@ -31,4 +31,20 @@ public class Contract1 : SmartContract.Framework.SmartContract
}
```

[Back](../Neo.md)
Response body:

```json
{
"Type":"Integer",
"value":"100000000"
}
```

Response description:

- Integer type: The account balance is obtained successfully.

- Others: failed.

[Back](../Neo.md)

Loading