Documentation
¶
Index ¶
- Constants
- type Account
- func (a *Account) AddBalance(balance uint64) error
- func (a *Account) Copy() evm.Account
- func (a *Account) GetAddress() evm.Address
- func (a *Account) GetBalance() uint64
- func (a *Account) GetCode() []byte
- func (a *Account) GetCodeHash() []byte
- func (a *Account) GetNonce() uint64
- func (a *Account) HasSuicide() bool
- func (a *Account) SetCode(code []byte)
- func (a *Account) SetNonce(nonce uint64)
- func (a *Account) SubBalance(balance uint64) error
- func (a *Account) Suicide()
- type Address
- type Blockchain
- func (bc *Blockchain) BytesToAddress(bytes []byte) evm.Address
- func (bc *Blockchain) Create2Address(caller evm.Address, salt, code []byte) evm.Address
- func (bc *Blockchain) CreateAddress(caller evm.Address, nonce uint64) evm.Address
- func (bc *Blockchain) GetBlockHash(num uint64) []byte
- func (bc *Blockchain) NewAccount(address evm.Address) evm.Account
Constants ¶
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 (*Account) AddBalance ¶
AddBalance is the implementation of interface Note: In fact, we should avoid overflow
func (*Account) Copy ¶
Copy return a copy of an account Note: Please reimplement this if account structure changed
func (*Account) GetAddress ¶
GetAddress is the implementation of interface
func (*Account) GetBalance ¶
GetBalance is the implementation of interface
func (*Account) GetCodeHash ¶
GetCodeHash return the hash of account code, please return [32]byte, and return [32]byte{0, ..., 0} if code is empty
func (*Account) HasSuicide ¶
HasSuicide is the implementation of interface
func (*Account) SubBalance ¶
SubBalance is the implementation of interface
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address is the address
func BytesToAddress ¶
BytesToAddress convert bytes to address
func HexToAddress ¶
HexToAddress convert hex string to 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 ¶
Create2Address is the implementation of interface
func (*Blockchain) CreateAddress ¶
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