Skip to content

Commit

Permalink
Merge pull request #20 from neo-project/dev
Browse files Browse the repository at this point in the history
master < dev
  • Loading branch information
apisit authored Mar 1, 2022
2 parents d5cb041 + 2e8457f commit 0eb80a9
Show file tree
Hide file tree
Showing 47 changed files with 1,227 additions and 1,845 deletions.
7 changes: 4 additions & 3 deletions docs/n3/Advances/Neo VM instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ It's used to control the running process of NeoVM, including jump, call and othe

| Instruction | ABORT |
|----------|-------------------------------------------------------|
| Bytecode | 0x37 |
| Bytecode | 0x38 |
| Fee | 0 GAS |
| Function | It turns the vm state to FAULT immediately, and the exception cannot be caught. |

#### ASSERT

| Instruction | ASSERT |
|----------|------------------------------------------------------------------|
| Bytecode | 0x38 |
| Bytecode | 0x39 |
| Fee | 0.00000001 GAS |
| Function | Pop the top value of the stack, if it is false, then exit vm execution and set vm state to FAULT. |

Expand Down Expand Up @@ -1082,5 +1082,6 @@ It has implemented common operations for array, map, struct, etc.
| Function | Converts the top item to the specified type. |

:::note

The operation code with \* indicates that the result of the operation is not pushed back to the `EvaluationStack` using `PUSH()`.
:::
:::
2 changes: 1 addition & 1 deletion docs/n3/develop/deploy/invoke.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Three fields related to the contract invocation permission are defined in the co
| ------------- | ----------------------------- | ------------------------------------------------------------ |
| `Groups` | `ContractGroup[]` | Defines a group of trusted contracts, consisting of a public key and a signature of contract hash. |
| `Permissions` | `ContractPermission[]` | This field is an array containing a permission object, which defines other contracts and methods that the contract wants to call. The contract can be ScriptHash, Group, or wildcard *. The method is the method name or wildcard *. Contracts or methods not declared in the manifest cannot be called by the contract. |
| `Trusts` | `WildcardContainer\<UInt160>` | Defines other contracts trusted by the contract. The contract can be ScriptHash, Group, or wildcard *. If a contract is trusted, the user will not receive any warning message when the contract is called. |
| `Trusts` | `WildcardContainer<UInt160>` | Defines other contracts trusted by the contract. The contract can be ScriptHash, Group, or wildcard *. If a contract is trusted, the user will not receive any warning message when the contract is called. |

Assuming that the contract A calls the contract B, the following table details the invoking behavior and wallet behavior of the contract in various setting scenarios.

Expand Down
2 changes: 1 addition & 1 deletion docs/n3/develop/write/difference.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ using System;
| ----------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| Contract info | You need to fill in contract information such as the name, author, email, etc. when deploying the contract. | Add the contract features to the contract file, written as [C# Features](https://docs.microsoft.com/zh-cn/dotnet/csharp/programming-guide/concepts/attributes/), for example:<br/>[ManifestExtra("Author", "Neo")]<br/>[ManifestExtra("Email", "[email protected]")]<br/>[ContractTrust("\*")]<br/>[ContractPermission("\*", "\*")]<br/>[SupportedStandards("NEP-17")]<br/>[ManifestExtra("Description", "This is a contract example")]<br/>public class Contract1 : SmartContract |
| Contract function | When deploying a contract, you need to declare contract features such as whether to use storage, whether it can be called dynamically, and whether to accept NEP-5 assets. | All contracts can use the storage and dynamic calls by default. You can implement the OnNEP17Payment method to accept NEP-17 assets and implement the OnNEP11Payment method to accept NEP-11 (NFT standard) assets. |
| Declare support for NEP | Code example:<br/>public static string[] SupportedStandards()<br/>{<br/> string[] result = { "NEP-5", "NEP-7", "NEP-10" };<br/> return result;<br/>} | Directly add the feature to the contract class name `[SupportedStandards("NEP-17")]` 特性。 |
| Declare support for NEP | Code example:<br/>public static string[] SupportedStandards()<br/>{<br/> string[] result = { "NEP-5", "NEP-7", "NEP-10" };<br/> return result;<br/>} | Directly add the feature to the contract class name `[SupportedStandards("NEP-17")]` |

### Declaration of static variables

Expand Down
2 changes: 1 addition & 1 deletion docs/n3/develop/write/manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ The Manifest file includes the following fields.
| SupportedStandards | string[] | Supported NEP standard, equivalent to NEP-10 in Neo Legacy.x |
| Abi | ContractAbi | NEP-14 (NeoContract ABI) Description of smart contract methods (name, parameters, return value, offset, safe or not), events (name, parameters) |
| Permissions | ContractPermission[] Consisting of the contract and its method names | This field is an array containing a permission object, which defines other contracts and methods that the contract wants to call. The contract can be ScriptHash, Group, or wildcard *. The method is the method name or wildcard *. Contracts or methods not declared in the manifest cannot be called by the contract. |
| Trusts | WildcardContainer\\<UInt160\> | Defines other contracts trusted by the contract. The contract can be ScriptHash, Group, or wildcard *. If a contract is trusted, the user will not receive any warning message when the contract is called. |
| Trusts | WildcardContainer<UInt160\> | Defines other contracts trusted by the contract. The contract can be ScriptHash, Group, or wildcard *. If a contract is trusted, the user will not receive any warning message when the contract is called. |
| Extra | object | Other user-defined data, such as developer, email, URL, contract profile, etc. |

26 changes: 12 additions & 14 deletions docs/n3/exchange/transaction.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
---
sidebar_label: 'Dealing with Asset Transactions'
sidebar_position: 3
---

# Dealing with Asset Transactions

## Overview
Expand Down Expand Up @@ -31,7 +26,7 @@ NetworkFee = VerificationCost + tx.size * FeePerByte

## System fee

The system fee is charged for the instructions executed by NeoVM. For each instruction fee refer to [System Fee](../fees). The total system fee you need to pay depends on the number and type of the instructions executed by your smart contract. The following figure shows the calculation formula:
The system fee is charged for the instructions executed by NeoVM. For each instruction fee refer to [System Fee](../fees.md). The total system fee you need to pay depends on the number and type of the instructions executed by your smart contract. The following figure shows the calculation formula:

```
SystemFee = InvocationCost = The sum of all executed opcode fee
Expand All @@ -54,7 +49,7 @@ The way for a exchange itself to query balance of the user deposit address is di
The exchange needs to do the following:

1. Construct JSON files to invoke either of the following RPC methods:
- getnep17balances (Plugin [RpcNep17Tracker](https://github.com/neo-project/neo-modules/releases/) is required)
- getnep17balances (Plugin [TokensTracker](https://github.com/neo-project/neo-modules/releases/) is required)
- invokefunction (Plugin [RpcServer](https://github.com/neo-project/neo-modules/releases/) is required)
2. Send a `getnep17balances` request to the Neo RPC server to get the asset hash and amount.
3. Send the invokefunction requests twice to the Neo RPC server to get the corresponding asset symbol and decimals, respectively.
Expand Down Expand Up @@ -363,8 +358,11 @@ The following shows an example of the API invoking result.

:::note

- The failed NEP-17 transaction can also be recorded in blockchain, so you need to determine whether the vm status parameter "vmstate" is correct (HALT).
- "vmstate" indicates the vm status after it executes the contract. If it contains "FAULT", that means the execution is failed and the transaction is invalid.
This example shows the log of a successful token transfer, however, in case of a failed transfer or NeoVM exception, the outcomes can be:

- Failed transfer: no Transfer notification event is returned, execution ends in a `HALT` state with a stack value of `False`.
- NeoVM exception: a Transfer notification event may or may not be returned, but execution ends in a `FAULT` state.

:::

The parameters related to a transaction in the file are the following:
Expand All @@ -377,11 +375,11 @@ The parameters related to a transaction in the file are the following:

- from account: The first object in the array is the account address where the asset is transferred from. Its type "bytearray" and the value "uXtKzX+CD2HS1NT5rqXrUEmN31U=“ can be decoded to "NcphtjgTye3c3ZL5J5nDZhsf3UJMGAjd7o" with base64.

:::note

In Neo, hexadecimal strings are processed in big-endian order if they are preceded by 0x, or little-endian order if they are not.
:::

:::note
In Neo, hexadecimal strings are processed in big-endian order if they are preceded by 0x, or little-endian order if they are not.
:::
```json
{
"type": "ByteString",
Expand Down
2 changes: 1 addition & 1 deletion docs/n3/foundation/Wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Example:
| Private Key | 087780053c374394a48d685aacf021804fa9fab19537d16194ee215e825942a0 |
| Public Key (Compressed) | 03cdb067d930fd5adaa6c68545016044aaddec64ba39e548250eaea551172e535c |
| Script | 0c2103cdb067d930fd5adaa6c68545016044aaddec64ba39e548250eaea551172e535c4156e7b327 |
| Address | NhZ5eahZAZ6UBsbCLcCQH6qqHdzuxt2HKa |
| Address | NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs |
#### Multi-Signature Address
Expand Down
2 changes: 0 additions & 2 deletions docs/n3/foundation/consensus/vote_validator.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Neo is an open and transparent blockchain network where anyone can either initia
:::note

Committee members have the privilege to modify the configuration of Neo network by voting, currently including fee per byte for network transmission, execution fee factor, storage price, blocking / unblocking account, etc.

:::

There is no duty assigned to candidates. However, committee members and validators are elected from certain number of candidates with most votes. Their relationship can be described in the following picture. There is no explicit relationship between committee members and validators but, as default committee member amount (21) is more than that of validators, generally speaking validators are a subset of committee members.
Expand All @@ -19,7 +18,6 @@ Voting is a dynamic and continuous process. If the NEO asset of a voter is chang
:::note

Genesis Block is the first block,its `NextConsensus` is set to the script hash of standby consensus nodes' multi-signature contract.

:::

## From Delegate to Speaker
Expand Down
9 changes: 2 additions & 7 deletions docs/n3/node/Introduction.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
---
sidebar_label: 'Introduction'
sidebar_position: 0
---

# Neo Node Introduction
Nodes that store all of the blockchain are called “full-nodes”. They are connected to the blockchain through a P2P network. All the nodes in the blockchain network are equal, they act both as a client interface and as a server.

Expand Down Expand Up @@ -41,13 +36,13 @@ There are two full-node programs:
| Create multi-party signed address | ✔   ||
| Generate multiple addresses | ||
| Change wallet password |||
| Delete address || |
| Delete address || |
| **Contract** | | |
| Query contract || |
| Deploy contract |||
| Invoke contract |||
| **Advanced** | | |
| Register to candidate | ✔   |     |
| Register to candidate | ✔   | |
| Voting | ✔   ||
| Custom transaction construction || |
| Signature |||
Expand Down
Loading

0 comments on commit 0eb80a9

Please sign in to comment.