Added examples folder

Imported from CityOfZion/neo-storm (77d0e5949470b2648acd37c71116f4469197772b).
This commit is contained in:
Anthony De Meulemeester 2018-08-20 10:59:35 +02:00 committed by Roman Khimov
parent 1927bc54d5
commit 86715511d0
3 changed files with 29 additions and 0 deletions

17
examples/check_witness.go Normal file
View file

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

View file

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

6
interop/util/util.go Normal file
View file

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