contract

package
v0.90.1-pre Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 0 Imported by: 41

Documentation

Overview

Package contract provides functions to work with contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateStandardAccount added in v0.90.0

func CreateStandardAccount(pub []byte) []byte

CreateStandardAccount calculates script hash of a given public key. This function uses `System.Contract.CreateStandardAccount` syscall.

func Destroy

func Destroy()

Destroy deletes calling contract (the one that calls Destroy) from the blockchain, so it's only possible to do that from the contract itself and not by any outside code. When contract is deleted all associated storage items are deleted too. This function uses `System.Contract.Destroy` syscall.

func IsStandard added in v0.90.0

func IsStandard(h []byte) bool

IsStandard checks if contract with provided hash is a standard signature/multisig contract. This function uses `System.Contract.IsStandard` syscall.

Types

type Contract

type Contract struct{}

Contract represents a Neo contract and is used in interop functions. It's an opaque data structure that you can manipulate with using functions from this package. It's similar in function to the Contract class in the Neo .net framework.

func Create

func Create(script []byte, manifest []byte) Contract

Create creates a new contract using a set of input parameters:

script      contract's bytecode (limited in length by 1M)
manifest    contract's manifest (limited in length by 2 KiB)

It returns this new created Contract when successful (and fails transaction if not). It uses `System.Contract.Create` syscall.

func Update added in v0.90.0

func Update(script []byte, manifest []byte) Contract

Update updates script and manifest of the calling contract (that is the one that calls Update) to the new ones. Its parameters have exactly the same semantics as for Create. The old contract will be deleted by this call, if it has any storage associated it will be migrated to the new contract. New contract is returned. This function uses `System.Contract.Update` syscall.

Jump to

Keyboard shortcuts

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