blockchainadapter

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain struct {
	// Upstream is the world state callback, which is common to all VMs
	Upstream vmi.BlockchainHook

	// VMType is a VM indentifier used for generating new addresses.
	VMType []byte

	// AddressLength is the expected length of an address, in bytes
	AddressLength int

	// LogToConsole when set to true causes the adapter to also print all operations to console
	LogToConsole bool
	// contains filtered or unexported fields
}

Blockchain is an adapter between K and the outside world This class is specific to only 1 generated interpreter

func (*Blockchain) AccountExists

func (b *Blockchain) AccountExists(c m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

AccountExists adapts between K model and elrond function

func (*Blockchain) ComputeDelta added in v0.0.19

func (b *Blockchain) ComputeDelta(acctAddr []byte, finalBalance *big.Int) (*big.Int, error)

ComputeDelta computes the delta from a final balance of an account

func (*Blockchain) ConvertKIntToAddress

func (b *Blockchain) ConvertKIntToAddress(addrAsK m.KReference, ms *m.ModelState) ([]byte, bool)

ConvertKIntToAddress takes a K Int and converts it to an address with the correct number of bytes, will pad left with zeroes, based on the configured address length

func (*Blockchain) GetBalance

func (b *Blockchain) GetBalance(c m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

GetBalance adapts between K model and elrond function

func (*Blockchain) GetBlockhash

func (b *Blockchain) GetBlockhash(c m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

GetBlockhash adapts between K model and elrond function

func (*Blockchain) GetCode

func (b *Blockchain) GetCode(c m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

GetCode adapts between K model and elrond function

func (*Blockchain) GetInputAccounts added in v0.0.11

func (b *Blockchain) GetInputAccounts() []*vmi.OutputAccount

GetInputAccounts yields all account input data that went through the adapter, if logging was enabled.

func (*Blockchain) GetNonce

func (b *Blockchain) GetNonce(c m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

GetNonce adapts between K model and elrond function

func (*Blockchain) GetStorageData

func (b *Blockchain) GetStorageData(kaddr m.KReference, kindex m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

GetStorageData adapts between K model and elrond function

func (*Blockchain) InitAdapter added in v0.0.16

func (b *Blockchain) InitAdapter(senderAddress []byte, callValue *big.Int)

InitAdapter should be called before each SC execution.

func (*Blockchain) IsCodeEmpty

func (b *Blockchain) IsCodeEmpty(c m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

IsCodeEmpty adapts between K model and elrond function

func (*Blockchain) NewAddress added in v0.0.16

func (b *Blockchain) NewAddress(kaddr, knonce m.KReference, lbl m.KLabel, sort m.Sort, config m.KReference, ms *m.ModelState) (m.KReference, error)

NewAddress adapts between K model and elrond function

Jump to

Keyboard shortcuts

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