interop: provide missing smartcontract parameter type defs

Contract can have Hash160, Hash256, Signature etc. types which
all map to a `[]byte` in Go. Having synonyms helps us to generate
proper manifest file.
This commit is contained in:
Evgenii Stratonikov 2020-08-28 10:47:15 +03:00
parent 49e9c1aa0f
commit cee1836183
10 changed files with 75 additions and 29 deletions

View file

@ -1,11 +1,23 @@
/*
Package interop contains smart contract API functions.
Package interop contains smart contract API functions and type synonyms.
Its subpackages can be imported into smart contracts written in Go to provide
various functionality. Upon compilation, functions from these packages will
be substituted with appropriate NeoVM system calls implemented by Neo. Usually
these system calls have additional price in NeoVM, so they're explicitly written
in the documentation of respective functions.
Types defined here are used for proper manifest generation. Here is how Go types
correspond to smartcontract and VM types:
int-like - Integer
bool - Boolean
[]byte - ByteArray (Buffer in VM)
string - String (ByteString in VM)
(interface{})(nil) - Any
non-byte slice - Array
map[K]V - map
Other types are defined explicitly in this pkg:
Hash160, Hash256, InteropInterface, PublicKey, Signature
Note that unless written otherwise structures defined in this packages can't be
correctly created by new() or composite literals, they should be received from
some interop functions (and then used as parameters for some other interop