smartcontract: add Any type for parameter

It is used as a wildcard for default return type of a contract and
for a Null stack item.
This commit is contained in:
Evgenii Stratonikov 2020-03-18 18:20:31 +03:00
parent f64aa201c7
commit 6b7a57a66f

View file

@ -30,6 +30,7 @@ const (
ArrayType ParamType = 0x10 ArrayType ParamType = 0x10
MapType ParamType = 0x12 MapType ParamType = 0x12
InteropInterfaceType ParamType = 0xf0 InteropInterfaceType ParamType = 0xf0
AnyType ParamType = 0xfe
VoidType ParamType = 0xff VoidType ParamType = 0xff
) )
@ -60,6 +61,8 @@ func (pt ParamType) String() string {
return "InteropInterface" return "InteropInterface"
case VoidType: case VoidType:
return "Void" return "Void"
case AnyType:
return "Any"
default: default:
return "" return ""
} }
@ -154,6 +157,8 @@ func ParseParamType(typ string) (ParamType, error) {
return InteropInterfaceType, nil return InteropInterfaceType, nil
case "void": case "void":
return VoidType, nil return VoidType, nil
case "any":
return AnyType, nil
default: default:
return UnknownType, errors.Errorf("Unknown contract parameter type: %s", typ) return UnknownType, errors.Errorf("Unknown contract parameter type: %s", typ)
} }