contract

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: GPL-3.0 Imports: 3 Imported by: 6

Documentation

Overview

Package contract defines the Contract API. All chains that have "smart contracts" should implement this API. UTXO-based chains that support scripting must not attempt to implementing scripting using this API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallData

type CallData pack.Bytes

CallData is used to specify a function and its parameters when invoking business logic on a contract.

func (CallData) Marshal

func (data CallData) Marshal(buf []byte, rem int) ([]byte, int, error)

Marshal the address to binary. You should not call this function directly, unless you are implementing marshalling for a container type.

func (CallData) SizeHint

func (data CallData) SizeHint() int

SizeHint returns the number of bytes required to represent the calldata in binary.

func (*CallData) Unmarshal

func (data *CallData) Unmarshal(buf []byte, rem int) ([]byte, int, error)

Unmarshal the address from binary. You should not call this function directly, unless you are implementing unmarshalling for a container type.

type Caller

type Caller interface {
	// CallContract at the specified address, using the specified calldata as
	// input (this encodes the function and its parameters). The function output
	// is returned as raw uninterpreted bytes. It is up to the application to
	// interpret these bytes in a meaningful way.  If the call cannot be
	// completed before the context is done, or the call is invalid, then an
	// error should be returned.
	CallContract(context.Context, address.Address, CallData) (pack.Bytes, error)
}

The Caller interface defines the functionality required to call readonly functions on a contract. Calling functions that mutate contract state should be done using the Account API.

Jump to

Keyboard shortcuts

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