interop

package module
v0.0.0-...-0ae5e7e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2024 License: MIT Imports: 1 Imported by: 48

Documentation

Overview

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
(any)(nil) - Any
non-byte slice - Array
map[K]V - map

Other types are defined explicitly in this pkg: Hash160, Hash256, Interface, 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 functions).

Index

Constants

View Source
const (
	// Hash160Len is the length of proper Hash160 in bytes, use it to
	// sanitize input parameters.
	Hash160Len = 20
	// Hash256Len is the length of proper Hash256 in bytes, use it to
	// sanitize input parameters.
	Hash256Len = 32
	// PublicKeyCompressedLen is the length of compressed public key (which
	// is the most common public key type), use it to sanitize input
	// parameters.
	PublicKeyCompressedLen = 33
	// PublicKeyUncompressedLen is the length of uncompressed public key
	// (but you're not likely to ever encounter that), use it to sanitize
	// input parameters.
	PublicKeyUncompressedLen = 65
	// SignatureLen is the length of standard signature, use it to sanitize
	// input parameters.
	SignatureLen = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash160

type Hash160 []byte

Hash160 represents 20-byte hash.

func (Hash160) Equals

func (a Hash160) Equals(b any) bool

Equals compares Hash160 with the provided stackitem using EQUAL opcode. The provided stackitem `b` must be either one of the primitive type (int, bool, string, []byte) or derived from the primitive type, otherwise Equals will fail on .(string) conversion.

type Hash256

type Hash256 []byte

Hash256 represents 32-byte hash.

func (Hash256) Equals

func (a Hash256) Equals(b any) bool

Equals compares Hash256 with the provided stackitem using EQUAL opcode. The provided stackitem `b` must be either one of the primitive type (int, bool, string, []byte) or derived from the primitive type, otherwise Equals will fail on .(string) conversion.

type Interface

type Interface any

Interface represents interop interface type which is needed for transparent handling of VM-internal types (e.g. storage.Context).

type PublicKey

type PublicKey []byte

PublicKey represents marshalled ecdsa public key.

func (PublicKey) Equals

func (a PublicKey) Equals(b any) bool

Equals compares PublicKey with the provided stackitem using EQUAL opcode. The provided stackitem `b` must be either one of the primitive type (int, bool, string, []byte) or derived from the primitive type, otherwise Equals will fail on .(string) conversion.

type Signature

type Signature []byte

Signature represents 64-byte signature.

func (Signature) Equals

func (a Signature) Equals(b any) bool

Equals compares Signature with the provided stackitem using EQUAL opcode. The provided stackitem `b` must be either one of the primitive types (int, bool, string, []byte) or derived from the primitive type, otherwise Equals will fail on .(string) conversion.

Directories

Path Synopsis
Package contract provides functions to work with contracts.
Package contract provides functions to work with contracts.
Package convert provides functions for type conversion.
Package convert provides functions for type conversion.
Package crypto provides an interface to cryptographic syscalls.
Package crypto provides an interface to cryptographic syscalls.
Package iterator provides functions to work with Neo iterators.
Package iterator provides functions to work with Neo iterators.
lib
Package math provides access to useful numeric functions available in Neo VM.
Package math provides access to useful numeric functions available in Neo VM.
native
crypto
Package crypto provides interface to CryptoLib native contract.
Package crypto provides interface to CryptoLib native contract.
gas
Package gas provides interface to GasToken native contract.
Package gas provides interface to GasToken native contract.
ledger
Package ledger provides an interface to LedgerContract native contract.
Package ledger provides an interface to LedgerContract native contract.
management
Package management provides an interface to ContractManagement native contract.
Package management provides an interface to ContractManagement native contract.
neo
Package neo provides an interface to NeoToken native contract.
Package neo provides an interface to NeoToken native contract.
notary
Package notary provides an interface to Notary native contract.
Package notary provides an interface to Notary native contract.
oracle
Package oracle provides an interface to OracleContract native contract.
Package oracle provides an interface to OracleContract native contract.
policy
Package policy provides an interface to PolicyContract native contract.
Package policy provides an interface to PolicyContract native contract.
roles
Package roles provides an interface to RoleManagement native contract.
Package roles provides an interface to RoleManagement native contract.
std
Package std provides an interface to StdLib native contract.
Package std provides an interface to StdLib native contract.
Package neogointernal contains definitions of compiler intrinsics.
Package neogointernal contains definitions of compiler intrinsics.
Package runtime provides various service functions related to execution environment.
Package runtime provides various service functions related to execution environment.
Package storage provides functions to access and modify contract's storage.
Package storage provides functions to access and modify contract's storage.
Package util contains some special useful functions that are provided by compiler and VM.
Package util contains some special useful functions that are provided by compiler and VM.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL