mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-25 13:56:35 +00:00
75a9a42403
Check that all `Notify` invocations in source correspond to some event in manifest. Helpful for typos such as `transfer` instead of `Transfer`.
21 lines
636 B
Go
21 lines
636 B
Go
package iteratorcontract
|
|
|
|
import (
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/iterator"
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
|
|
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
|
|
)
|
|
|
|
// NotifyKeysAndValues sends notification with `foo` storage keys and values
|
|
func NotifyKeysAndValues() bool {
|
|
iter := storage.Find(storage.GetContext(), []byte("foo"))
|
|
values := iterator.Values(iter)
|
|
keys := iterator.Keys(iter)
|
|
|
|
runtime.Notify("found storage values", values)
|
|
// For illustration purposes event is emitted with 'Any' type.
|
|
var typedKeys interface{} = keys
|
|
runtime.Notify("found storage keys", typedKeys)
|
|
|
|
return true
|
|
}
|