mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 13:47:19 +00:00
Added examples folder
Imported from CityOfZion/neo-storm (77d0e5949470b2648acd37c71116f4469197772b).
This commit is contained in:
parent
1927bc54d5
commit
86715511d0
3 changed files with 29 additions and 0 deletions
17
examples/check_witness.go
Normal file
17
examples/check_witness.go
Normal 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
|
||||
}
|
6
interop/runtime/runtime.go
Normal file
6
interop/runtime/runtime.go
Normal 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
6
interop/util/util.go
Normal 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
|
||||
}
|
Loading…
Reference in a new issue