From 86715511d0bd9192cd2331dad7247b54c7f23953 Mon Sep 17 00:00:00 2001 From: Anthony De Meulemeester Date: Mon, 20 Aug 2018 10:59:35 +0200 Subject: [PATCH] Added examples folder Imported from CityOfZion/neo-storm (77d0e5949470b2648acd37c71116f4469197772b). --- examples/check_witness.go | 17 +++++++++++++++++ interop/runtime/runtime.go | 6 ++++++ interop/util/util.go | 6 ++++++ 3 files changed, 29 insertions(+) create mode 100644 examples/check_witness.go create mode 100644 interop/runtime/runtime.go create mode 100644 interop/util/util.go diff --git a/examples/check_witness.go b/examples/check_witness.go new file mode 100644 index 000000000..17b399cc7 --- /dev/null +++ b/examples/check_witness.go @@ -0,0 +1,17 @@ +package check_witness_contract + +import ( + "github.com/CityOfZion/neo-go-sc/interop/runtime" + "github.com/CityOfZion/neo-go-sc/interop/util" +) + +// Check if the invoker of the contract is the specified owner. + +var owner = util.FromAddress("Aej1fe4mUgou48Zzup5j8sPrE3973cJ5oz") + +func Main() bool { + if runtime.CheckWitness(owner) { + return true + } + return false +} diff --git a/interop/runtime/runtime.go b/interop/runtime/runtime.go new file mode 100644 index 000000000..da0e82bcb --- /dev/null +++ b/interop/runtime/runtime.go @@ -0,0 +1,6 @@ +package runtime + +// CheckWitness verifies if the given hash is the invoker of the contract. +func CheckWitness(hash []byte) bool { + return true +} diff --git a/interop/util/util.go b/interop/util/util.go new file mode 100644 index 000000000..f5b658fdd --- /dev/null +++ b/interop/util/util.go @@ -0,0 +1,6 @@ +package util + +// FromAddress is an utility function that converts an NEO address to its hash. +func FromAddress(address string) []byte { + return nil +}