mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 23:42:23 +00:00
Compiler (#37)
* refactored structs so the scope is not needed anymore + fix passing struct in func arguments. * implemented byte arrays and added runtime tests * Added sc examples in compiler README + added quick nested if test. * Updated README * Changed import paths to interop layer
This commit is contained in:
parent
16ab1d524f
commit
b6b8542caf
9 changed files with 21 additions and 12 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.20.0
|
||||
0.21.0
|
||||
|
|
0
pkg/smartcontract/.keep
Normal file
0
pkg/smartcontract/.keep
Normal file
|
@ -66,8 +66,8 @@ func Main() bool {
|
|||
package mytoken
|
||||
|
||||
import (
|
||||
"github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
"github.com/CityOfZion/neo-go/pkg/smartcontract/storage"
|
||||
"github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
"github.com/CityOfZion/neo-go/pkg/vm/smartcontract/storage"
|
||||
)
|
||||
|
||||
var owner = []byte{0xaf, 0x12, 0xa8, 0x68, 0x7b, 0x14, 0x94, 0x8b, 0xc4, 0xa0, 0x08, 0x12, 0x8a, 0x55, 0x0a, 0x63, 0x69, 0x5b, 0xc1, 0xa5}
|
||||
|
|
|
@ -6,7 +6,7 @@ var runtimeTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
|
||||
func Main() bool {
|
||||
runtime.Notify("hello")
|
||||
|
@ -20,7 +20,7 @@ var runtimeTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
|
||||
func Main() bool {
|
||||
runtime.Log("hello you there!")
|
||||
|
@ -34,7 +34,7 @@ var runtimeTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
|
||||
func Main() int {
|
||||
t := runtime.GetTime()
|
||||
|
@ -48,7 +48,7 @@ var runtimeTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
|
||||
func Main() int {
|
||||
trigger := runtime.GetTrigger()
|
||||
|
@ -68,7 +68,7 @@ var runtimeTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
|
||||
func Main() int {
|
||||
owner := []byte{0xaf, 0x12, 0xa8, 0x68, 0x7b, 0x14, 0x94, 0x8b, 0xc4, 0xa0, 0x08, 0x12, 0x8a, 0x55, 0x0a, 0x63, 0x69, 0x5b, 0xc1, 0xa5}
|
||||
|
@ -86,7 +86,7 @@ var runtimeTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/runtime"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/runtime"
|
||||
|
||||
func Main() int {
|
||||
block := runtime.GetCurrentBlock()
|
||||
|
|
|
@ -6,7 +6,7 @@ var storageTestCases = []testCase{
|
|||
`
|
||||
package foo
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/storage"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/storage"
|
||||
|
||||
func Main() int {
|
||||
ctx := storage.GetContext()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package runtime
|
||||
|
||||
import "github.com/CityOfZion/neo-go/pkg/smartcontract/types"
|
||||
import "github.com/CityOfZion/neo-go/pkg/vm/smartcontract/types"
|
||||
|
||||
// CheckWitness verifies if the invoker is the owner of the contract.
|
||||
func CheckWitness(hash []byte) bool {
|
9
pkg/vm/smartcontract/types/block.go
Normal file
9
pkg/vm/smartcontract/types/block.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package types
|
||||
|
||||
// Block represents a block in the blockchain.
|
||||
type Block struct{}
|
||||
|
||||
// Index returns the height of the block.
|
||||
func (b Block) Index() int {
|
||||
return 0
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package vm
|
||||
|
||||
// Syscalls is a mapping between the syscall function name
|
||||
// Syscalls are a mapping between the syscall function name
|
||||
// and the registerd VM interop API.
|
||||
var Syscalls = map[string]string{
|
||||
// Storage API
|
||||
|
|
Loading…
Reference in a new issue