compiler: save both VM and smartcontract types
VM types are used in debugger, while smartcontract ones are used in manifest. We can't save only one of them, because conversion in either side is lossy: 1. VM has `Array` and `Struct` but smartcontract only has `Array`. 2. Smartcontract has `Hash160` etc, which are all `ByteString` or `Buffer` in VM. And to spice things a bit more, return type in debugger can be `Void`, which corresponds to no real stackitem type (as it must exist).
This commit is contained in:
parent
3d0ed6eac3
commit
cbf26f315c
5 changed files with 140 additions and 67 deletions
30
examples/events/events.go
Normal file
30
examples/events/events.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package events
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
||||
)
|
||||
|
||||
// NotifySomeBytes emits notification with ByteArray.
|
||||
func NotifySomeBytes(arg []byte) {
|
||||
runtime.Notify("SomeBytes", arg)
|
||||
}
|
||||
|
||||
// NotifySomeInteger emits notification with Integer.
|
||||
func NotifySomeInteger(arg int) {
|
||||
runtime.Notify("SomeInteger", arg)
|
||||
}
|
||||
|
||||
// NotifySomeString emits notification with String.
|
||||
func NotifySomeString(arg string) {
|
||||
runtime.Notify("SomeString", arg)
|
||||
}
|
||||
|
||||
// NotifySomeMap emits notification with Map.
|
||||
func NotifySomeMap(arg map[string]int) {
|
||||
runtime.Notify("SomeMap", arg)
|
||||
}
|
||||
|
||||
// NotifySomeArray emits notification with Array.
|
||||
func NotifySomeArray(arg []int) {
|
||||
runtime.Notify("SomeArray", arg)
|
||||
}
|
23
examples/events/events.yml
Normal file
23
examples/events/events.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
name: "Event types example"
|
||||
supportedstandards: []
|
||||
events:
|
||||
- name: SomeBytes
|
||||
parameters:
|
||||
- name: bytes
|
||||
type: ByteArray
|
||||
- name: SomeInteger
|
||||
parameters:
|
||||
- name: int
|
||||
type: Integer
|
||||
- name: SomeString
|
||||
parameters:
|
||||
- name: str
|
||||
type: String
|
||||
- name: SomeMap
|
||||
parameters:
|
||||
- name: m
|
||||
type: Map
|
||||
- name: SomeArray
|
||||
parameters:
|
||||
- name: a
|
||||
type: Array
|
Loading…
Add table
Add a link
Reference in a new issue