2020-05-18 07:42:44 +00:00
|
|
|
/*
|
|
|
|
Package contract provides functions to work with contracts.
|
|
|
|
*/
|
2018-08-21 10:57:48 +00:00
|
|
|
package contract
|
|
|
|
|
2020-08-28 07:47:15 +00:00
|
|
|
import "github.com/nspcc-dev/neo-go/pkg/interop"
|
|
|
|
|
2020-12-08 12:37:03 +00:00
|
|
|
// CallFlag specifies valid call flags.
|
|
|
|
type CallFlag byte
|
|
|
|
|
|
|
|
// Using `smartcontract` package from compiled contract requires moderate
|
|
|
|
// compiler refactoring, thus all flags are mirrored here.
|
|
|
|
const (
|
2020-12-11 07:34:01 +00:00
|
|
|
ReadStates CallFlag = 1 << iota
|
|
|
|
WriteStates
|
2020-12-08 12:37:03 +00:00
|
|
|
AllowCall
|
|
|
|
AllowNotify
|
2020-12-11 07:34:01 +00:00
|
|
|
States = ReadStates | WriteStates
|
|
|
|
ReadOnly = ReadStates | AllowCall
|
|
|
|
All = States | AllowCall | AllowNotify
|
2020-12-08 12:37:03 +00:00
|
|
|
NoneFlag CallFlag = 0
|
|
|
|
)
|
|
|
|
|
2020-06-17 08:38:32 +00:00
|
|
|
// IsStandard checks if contract with provided hash is a standard signature/multisig contract.
|
|
|
|
// This function uses `System.Contract.IsStandard` syscall.
|
2020-08-28 07:47:15 +00:00
|
|
|
func IsStandard(h interop.Hash160) bool {
|
2020-06-17 08:38:32 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// CreateStandardAccount calculates script hash of a given public key.
|
|
|
|
// This function uses `System.Contract.CreateStandardAccount` syscall.
|
2020-08-28 07:47:15 +00:00
|
|
|
func CreateStandardAccount(pub interop.PublicKey) []byte {
|
2020-06-17 08:38:32 +00:00
|
|
|
return nil
|
|
|
|
}
|
2020-07-16 09:13:55 +00:00
|
|
|
|
|
|
|
// GetCallFlags returns calling flags which execution context was created with.
|
|
|
|
// This function uses `System.Contract.GetCallFlags` syscall.
|
|
|
|
func GetCallFlags() int64 {
|
|
|
|
return 0
|
|
|
|
}
|
2020-12-08 11:11:06 +00:00
|
|
|
|
|
|
|
// Call executes previously deployed blockchain contract with specified hash
|
|
|
|
// (20 bytes in BE form) using provided arguments.
|
|
|
|
// It returns whatever this contract returns. This function uses
|
|
|
|
// `System.Contract.Call` syscall.
|
|
|
|
func Call(scriptHash interop.Hash160, method string, args ...interface{}) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
2020-12-08 12:37:03 +00:00
|
|
|
|
|
|
|
// CallEx executes previously deployed blockchain contract with specified hash
|
|
|
|
// (20 bytes in BE form) using provided arguments and call flags.
|
|
|
|
// It returns whatever this contract returns. This function uses
|
|
|
|
// `System.Contract.CallEx` syscall.
|
|
|
|
func CallEx(f CallFlag, scriptHash interop.Hash160, method string, args ...interface{}) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|