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 +}