mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 19:29:39 +00:00
*: remove remaining references to neo-storm, update README
README update partially reverts c8d7671d26
and
updates it with current commands and sample output.
This commit is contained in:
parent
a1e3655560
commit
57c7df4dff
3 changed files with 58 additions and 8 deletions
52
README.md
52
README.md
|
@ -126,7 +126,57 @@ ApplicationConfiguration:
|
||||||
```
|
```
|
||||||
|
|
||||||
## Writing smart contracts in Go
|
## Writing smart contracts in Go
|
||||||
Golang's development is been moved to a separate repository which you can find here [neo-storm](https://github.com/CityOfZion/neo-storm)
|
In depth documentation about the **neo-go** compiler and smart contract examples can be found inside the [compiler package](https://github.com/CityOfZion/neo-go/tree/master/pkg/vm/compiler).
|
||||||
|
|
||||||
|
### Compile a smart contract
|
||||||
|
|
||||||
|
```
|
||||||
|
./bin/neo-go contract compile -i mycontract.go
|
||||||
|
```
|
||||||
|
|
||||||
|
By default the filename will be the name of your `.go` file with the `.avm` extension, the file will be located in the same directory where you called the command from. If you want another location for your compiled contract:
|
||||||
|
|
||||||
|
```
|
||||||
|
./bin/neo-go contract compile -i mycontract.go --out /Users/foo/bar/contract.avm
|
||||||
|
```
|
||||||
|
|
||||||
|
### Debugging your smart contract
|
||||||
|
You can dump the opcodes generated by the compiler with the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
./bin/neo-go contract inspect -i mycontract.go
|
||||||
|
```
|
||||||
|
|
||||||
|
This will result in something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
INDEX OPCODE DESC
|
||||||
|
0 0x54 PUSH4
|
||||||
|
1 0xc5 NEWARRAY
|
||||||
|
2 0x6b TOALTSTACK
|
||||||
|
3 0x5a PUSH10
|
||||||
|
4 0x6a DUPFROMALTSTACK
|
||||||
|
5 0x0 PUSH0
|
||||||
|
6 0x52 PUSH2
|
||||||
|
7 0x7a ROLL
|
||||||
|
8 0xc4 SETITEM
|
||||||
|
9 0x6a DUPFROMALTSTACK
|
||||||
|
10 0x0 PUSH0
|
||||||
|
11 0xc3 PICKITEM
|
||||||
|
12 0x5a PUSH10
|
||||||
|
13 0xa2 GTE
|
||||||
|
14 0x64 JMPIFNOT
|
||||||
|
15 0x7 7
|
||||||
|
15 0x0 0
|
||||||
|
17 0x51 PUSH1
|
||||||
|
18 0x6c FROMALTSTACK
|
||||||
|
19 0x75 DROP
|
||||||
|
20 0x66 RET
|
||||||
|
21 0x0 PUSH0
|
||||||
|
22 0x6c FROMALTSTACK
|
||||||
|
23 0x75 DROP
|
||||||
|
24 0x66 RET
|
||||||
|
```
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
|
|
|
@ -121,11 +121,11 @@ func initSmartContract(ctx *cli.Context) error {
|
||||||
return cli.NewExitError(err, 1)
|
return cli.NewExitError(err, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask contract information and write a storm.yml file unless the -skip-details flag is set.
|
// Ask contract information and write a neo-go.yml file unless the -skip-details flag is set.
|
||||||
// TODO: Fix the missing storm.yml file with the `init` command when the package manager is in place.
|
// TODO: Fix the missing neo-go.yml file with the `init` command when the package manager is in place.
|
||||||
if !ctx.Bool("skip-details") {
|
if !ctx.Bool("skip-details") {
|
||||||
details := parseContractDetails()
|
details := parseContractDetails()
|
||||||
if err := ioutil.WriteFile(filepath.Join(basePath, "storm.yml"), details.toStormFile(), 0644); err != nil {
|
if err := ioutil.WriteFile(filepath.Join(basePath, "neo-go.yml"), details.toStormFile(), 0644); err != nil {
|
||||||
return cli.NewExitError(err, 1)
|
return cli.NewExitError(err, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,8 +205,8 @@ type ContractDetails struct {
|
||||||
func (d ContractDetails) toStormFile() []byte {
|
func (d ContractDetails) toStormFile() []byte {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
|
|
||||||
buf.WriteString("# Storm specific configuration. Do not modify this unless you know what you are doing!\n")
|
buf.WriteString("# NEO-GO specific configuration. Do not modify this unless you know what you are doing!\n")
|
||||||
buf.WriteString("storm:\n")
|
buf.WriteString("neo-go:\n")
|
||||||
buf.WriteString(" version: 1.0\n")
|
buf.WriteString(" version: 1.0\n")
|
||||||
|
|
||||||
buf.WriteString("\n")
|
buf.WriteString("\n")
|
||||||
|
@ -222,7 +222,7 @@ func (d ContractDetails) toStormFile() []byte {
|
||||||
buf.WriteString("\n")
|
buf.WriteString("\n")
|
||||||
|
|
||||||
buf.WriteString("# Module section contains a list of imported modules\n")
|
buf.WriteString("# Module section contains a list of imported modules\n")
|
||||||
buf.WriteString("# This will be automatically managed by the neo-storm package manager\n")
|
buf.WriteString("# This will be automatically managed by the neo-go package manager\n")
|
||||||
buf.WriteString("modules: \n")
|
buf.WriteString("modules: \n")
|
||||||
return buf.Bytes()
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Runtime
|
# Runtime
|
||||||
A brief overview of NEO smart contract API's that can be used in the neo-storm framework.
|
A brief overview of NEO smart contract API's that can be used in the neo-go framework.
|
||||||
|
|
||||||
# Overview
|
# Overview
|
||||||
1. [Account]()
|
1. [Account]()
|
||||||
|
|
Loading…
Reference in a new issue