tests

package
v0.0.0-...-bf5c25a Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: LGPL-3.0-or-later Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const AddressLength = 12

AddressLength define the length of Address

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

Account is account

func NewAccount

func NewAccount(addr *Address) *Account

NewAccount is the constructor of Account

func (*Account) AddBalance

func (a *Account) AddBalance(balance uint64) error

AddBalance is the implementation of interface Note: In fact, we should avoid overflow

func (*Account) Copy

func (a *Account) Copy() evm.Account

Copy return a copy of an account Note: Please reimplement this if account structure changed

func (*Account) GetAddress

func (a *Account) GetAddress() evm.Address

GetAddress is the implementation of interface

func (*Account) GetBalance

func (a *Account) GetBalance() uint64

GetBalance is the implementation of interface

func (*Account) GetCode

func (a *Account) GetCode() []byte

GetCode is the implementation of interface

func (*Account) GetCodeHash

func (a *Account) GetCodeHash() []byte

GetCodeHash return the hash of account code, please return [32]byte, and return [32]byte{0, ..., 0} if code is empty

func (*Account) GetNonce

func (a *Account) GetNonce() uint64

GetNonce is the implementation of interface

func (*Account) HasSuicide

func (a *Account) HasSuicide() bool

HasSuicide is the implementation of interface

func (*Account) SetCode

func (a *Account) SetCode(code []byte)

SetCode is the implementation of interface

func (*Account) SetNonce

func (a *Account) SetNonce(nonce uint64)

SetNonce is the implementation of interface

func (*Account) SubBalance

func (a *Account) SubBalance(balance uint64) error

SubBalance is the implementation of interface

func (*Account) Suicide

func (a *Account) Suicide()

Suicide is the implementation of interface

type Address

type Address struct {
	// contains filtered or unexported fields
}

Address is the address

func BytesToAddress

func BytesToAddress(bytes []byte) *Address

BytesToAddress convert bytes to address

func HexToAddress

func HexToAddress(s string) (*Address, error)

HexToAddress convert hex string to address

func RandomAddress

func RandomAddress() *Address

RandomAddress random generate an address

func (*Address) Bytes

func (a *Address) Bytes() []byte

Bytes return bytes of Address

func (*Address) Copy

func (a *Address) Copy() *Address

Copy return the copy of address

func (*Address) Length

func (a *Address) Length() int

Length return the length of address

func (*Address) String

func (a *Address) String() string

String return hex of address

type Blockchain

type Blockchain struct {
}

Blockchain is the blockchain, which is used for testting, it will cooperated with address

func NewBlockchain

func NewBlockchain() *Blockchain

NewBlockchain is the constructor of Blockchain

func (*Blockchain) BytesToAddress

func (bc *Blockchain) BytesToAddress(bytes []byte) evm.Address

BytesToAddress is the implementation of interface

func (*Blockchain) Create2Address

func (bc *Blockchain) Create2Address(caller evm.Address, salt, code []byte) evm.Address

Create2Address is the implementation of interface

func (*Blockchain) CreateAddress

func (bc *Blockchain) CreateAddress(caller evm.Address, nonce uint64) evm.Address

CreateAddress is the implementation of interface

func (*Blockchain) GetBlockHash

func (bc *Blockchain) GetBlockHash(num uint64) []byte

GetBlockHash is the implementation of interface

func (*Blockchain) NewAccount

func (bc *Blockchain) NewAccount(address evm.Address) evm.Account

NewAccount is the implementation of interface

Jump to

Keyboard shortcuts

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