From 9ce38e6ffab83f88c4df852eb5fb1eb5e43ac9fe Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Wed, 8 Nov 2023 13:46:11 +0300 Subject: [PATCH] Add helloevent Signed-off-by: Stanislav Bogatyrev --- l3/helloevent/go.mod | 5 +++++ l3/helloevent/go.sum | 2 ++ l3/helloevent/helloevent.go | 15 +++++++++++++++ l3/helloevent/helloevent.yml | 10 ++++++++++ 4 files changed, 32 insertions(+) create mode 100644 l3/helloevent/go.mod create mode 100644 l3/helloevent/go.sum create mode 100644 l3/helloevent/helloevent.go create mode 100644 l3/helloevent/helloevent.yml diff --git a/l3/helloevent/go.mod b/l3/helloevent/go.mod new file mode 100644 index 0000000..fd0dbbf --- /dev/null +++ b/l3/helloevent/go.mod @@ -0,0 +1,5 @@ +module helloevent + +go 1.20 + +require github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20231108063405-7045d3bd63d9 diff --git a/l3/helloevent/go.sum b/l3/helloevent/go.sum new file mode 100644 index 0000000..0001eeb --- /dev/null +++ b/l3/helloevent/go.sum @@ -0,0 +1,2 @@ +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20231108063405-7045d3bd63d9 h1:VcjYKiGIn4EuUfibi4QI6lWkAFfg7PTYL8TxMvd+7Ck= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20231108063405-7045d3bd63d9/go.mod h1:J/Mk6+nKeKSW4wygkZQFLQ6SkLOSGX5Ga0RuuuktEag= diff --git a/l3/helloevent/helloevent.go b/l3/helloevent/helloevent.go new file mode 100644 index 0000000..8cac0cf --- /dev/null +++ b/l3/helloevent/helloevent.go @@ -0,0 +1,15 @@ +package helloevent + +import "github.com/nspcc-dev/neo-go/pkg/interop/runtime" + +var notificationName string + +// init initializes notificationName before calling any other smart-contract method +func init() { + notificationName = "HelloWorld" +} + +// RuntimeNotify sends runtime notification with "HelloWorld" name +func RuntimeNotify(args []any) { + runtime.Notify(notificationName, args) +} diff --git a/l3/helloevent/helloevent.yml b/l3/helloevent/helloevent.yml new file mode 100644 index 0000000..cd00b92 --- /dev/null +++ b/l3/helloevent/helloevent.yml @@ -0,0 +1,10 @@ +name: "helloevent" +sourceurl: https://git.frostfs.info/Web3N3/web3-course +supportedstandards: [] +events: + - name: HelloWorld + parameters: + - name: args + type: Array +permissions: + - methods: '*'