chaingen

package
v5.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractSpec

type ContractSpec struct {
	DeploymentCode []byte
	ABI            abi.ABI
}

func ParseContract

func ParseContract(abiStr, binStr string) (*ContractSpec, error)

type GenContext

type GenContext struct {
	ChainConfig *params.ChainConfig
	GenFuncs    []func(int, *core.BlockGen)
	DB          ethdb.Database

	Keys      map[common.Address]*ecdsa.PrivateKey
	Contracts map[string]*ContractSpec
	Genesis   *types.Block
	// contains filtered or unexported fields
}

func DefaultGenContext

func DefaultGenContext(chainConfig *params.ChainConfig, db ethdb.Database) *GenContext

A GenContext which exactly replicates the chain generator used in existing tests

func NewGenContext

func NewGenContext(chainConfig *params.ChainConfig, db ethdb.Database) *GenContext

func (*GenContext) AddContract

func (gen *GenContext) AddContract(name string, spec *ContractSpec)

func (*GenContext) AddFunction

func (gen *GenContext) AddFunction(fn func(int, *core.BlockGen))

func (*GenContext) AddOwnedAccount

func (gen *GenContext) AddOwnedAccount(key *ecdsa.PrivateKey) common.Address

func (*GenContext) CreateCallTx

func (gen *GenContext) CreateCallTx(from common.Address, to common.Address, methodName string, args ...interface{}) (*types.Transaction, error)

func (*GenContext) CreateContractTx

func (gen *GenContext) CreateContractTx(from common.Address, contractName string) (*types.Transaction, error)

func (*GenContext) CreateLondonTx

func (gen *GenContext) CreateLondonTx(block *core.BlockGen, addr *common.Address, key *ecdsa.PrivateKey) (*types.Transaction, error)

func (*GenContext) CreateSendTx

func (gen *GenContext) CreateSendTx(from common.Address, to common.Address, amount *big.Int) (*types.Transaction, error)

func (*GenContext) DeployContract

func (gen *GenContext) DeployContract(from common.Address, contractName string) (common.Address, error)

func (*GenContext) MakeChain

func (gen *GenContext) MakeChain(n int) ([]*types.Block, []types.Receipts, *core.BlockChain)

MakeChain creates a chain of n blocks starting at and including the genesis block. the returned hash chain is ordered head->parent.

Jump to

Keyboard shortcuts

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