contract

package
v0.6.2-p2p-enhance Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WASMContract

type WASMContract struct {
	// CallerAddress is the result of the caller which initialised this
	// contract. However when the "call method" is delegated this value
	// needs to be initialised to that of the caller's caller.
	CallerAddress common.Address

	Code     []byte
	CodeHash common.Hash
	CodeAddr *common.Address
	Input    []byte

	GasLimit uint64
	Gas      uint64

	Args []byte

	DelegateCall bool
	// contains filtered or unexported fields
}

Contract represents an VNTChain contract in the state database. It contains the the contract code, calling arguments. Contract implements ContractRef

func NewWASMContract

func NewWASMContract(caller WASMContractRef, object WASMContractRef, value *big.Int, gas uint64) *WASMContract

NewWASMContract returns a new contract environment for the execution of WAVM.

func (*WASMContract) Address

func (c *WASMContract) Address() common.Address

Address returns the contracts address

func (*WASMContract) AsDelegate

func (c *WASMContract) AsDelegate() inter.Contract

AsDelegate sets the contract to be a delegate call and returns the current contract (for chaining calls)

func (*WASMContract) Caller

func (c *WASMContract) Caller() common.Address

Caller returns the caller of the contract.

Caller will recursively call caller when the contract is a delegate call, including that of caller's caller.

func (*WASMContract) GetByte

func (c *WASMContract) GetByte(n uint64) byte

GetByte returns the n'th byte in the contract's byte array

func (*WASMContract) SetCallCode

func (c *WASMContract) SetCallCode(addr *common.Address, hash common.Hash, code []byte)

SetCallCode sets the code of the contract and address of the backing data object

func (*WASMContract) SetCode

func (c *WASMContract) SetCode(hash common.Hash, code []byte)

SetCode sets the code to the contract

func (*WASMContract) UseGas

func (c *WASMContract) UseGas(gas uint64) (ok bool)

UseGas attempts the use gas and subtracts it and returns true on success

func (*WASMContract) Value

func (c *WASMContract) Value() *big.Int

Value returns the contracts value (sent to it from it's caller)

type WASMContractRef

type WASMContractRef interface {
	Address() common.Address
}

type WasmCode

type WasmCode struct {
	Code     []byte
	Abi      []byte
	Compiled []byte
}

Jump to

Keyboard shortcuts

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