generator

package
v0.7.1-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//nolint:lll
	DefaultContractBytecode = "" /* 8436-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseGenerator

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

func (*BaseGenerator) GetTransactionErrors

func (bg *BaseGenerator) GetTransactionErrors() []*FailedTxnInfo

func (*BaseGenerator) MarkFailedTxn

func (bg *BaseGenerator) MarkFailedTxn(failedTxn *FailedTxnInfo)

func (*BaseGenerator) SetGasEstimate

func (bg *BaseGenerator) SetGasEstimate(gasEstimate uint64)

type ContractArtifact

type ContractArtifact struct {
	Bytecode string   `json:"bytecode"`
	ABI      *abi.ABI `json:"abi"`
}

func ReadContractArtifact

func ReadContractArtifact(configPath string) (*ContractArtifact, error)

ReadContractArtifact reads the contract bytecode from the specified path

type ContractTxnGenerator added in v0.3.3

type ContractTxnGenerator interface {
	TransactionGenerator
	MarkFailedContractTxn(failedContractTxn *FailedContractTxnInfo)
	SetContractAddress(types.Address)
}

type ContractTxnsGenerator added in v0.3.3

type ContractTxnsGenerator struct {
	BaseGenerator
	// contains filtered or unexported fields
}

func NewERC20Generator added in v0.3.3

func NewERC20Generator(params *GeneratorParams) (*ContractTxnsGenerator, error)

call ERC20 contract method and encode parameters

func NewERC721Generator added in v0.3.3

func NewERC721Generator(params *GeneratorParams) (*ContractTxnsGenerator, error)

call ERC721 contract method and encode parameters

func (*ContractTxnsGenerator) GenerateTransaction added in v0.3.3

func (gen *ContractTxnsGenerator) GenerateTransaction() (*types.Transaction, error)

func (*ContractTxnsGenerator) GetExampleTransaction added in v0.3.3

func (gen *ContractTxnsGenerator) GetExampleTransaction() (*types.Transaction, error)

Returns contract deployment tx if contractAddress is empty, otherwise returns a token transfer tx

func (*ContractTxnsGenerator) MarkFailedContractTxn added in v0.3.3

func (gen *ContractTxnsGenerator) MarkFailedContractTxn(failedContractTxn *FailedContractTxnInfo)

func (*ContractTxnsGenerator) SetContractAddress added in v0.3.3

func (gen *ContractTxnsGenerator) SetContractAddress(addr types.Address)

type DeployGenerator

type DeployGenerator struct {
	BaseGenerator
	// contains filtered or unexported fields
}

func NewDeployGenerator

func NewDeployGenerator(params *GeneratorParams) (*DeployGenerator, error)

func (*DeployGenerator) GenerateTransaction

func (dg *DeployGenerator) GenerateTransaction() (*types.Transaction, error)

func (*DeployGenerator) GetExampleTransaction

func (dg *DeployGenerator) GetExampleTransaction() (*types.Transaction, error)

type FailedContractTxnInfo added in v0.3.3

type FailedContractTxnInfo struct {
	TxHash string
	Error  *TxnError
}

type FailedTxnInfo

type FailedTxnInfo struct {
	Index  uint64
	TxHash string
	Error  *TxnError
}

type GeneratorParams

type GeneratorParams struct {
	Nonce            uint64
	ChainID          uint64
	SenderAddress    types.Address
	RecieverAddress  types.Address
	SenderKey        *ecdsa.PrivateKey
	Value            *big.Int
	GasPrice         *big.Int
	ContractArtifact *ContractArtifact
	ConstructorArgs  []byte // smart contract constructor arguments
	ContractAddress  ethgo.Address
}

type TransactionGenerator

type TransactionGenerator interface {
	GenerateTransaction() (*types.Transaction, error)
	GetExampleTransaction() (*types.Transaction, error)
	GetTransactionErrors() []*FailedTxnInfo
	SetGasEstimate(gasEstimate uint64)
	MarkFailedTxn(failedTxn *FailedTxnInfo)
}

type TransferGenerator

type TransferGenerator struct {
	BaseGenerator
	// contains filtered or unexported fields
}

func NewTransferGenerator

func NewTransferGenerator(params *GeneratorParams) (*TransferGenerator, error)

func (*TransferGenerator) GenerateTransaction

func (tg *TransferGenerator) GenerateTransaction() (*types.Transaction, error)

func (*TransferGenerator) GetExampleTransaction

func (tg *TransferGenerator) GetExampleTransaction() (*types.Transaction, error)

type TxnError

type TxnError struct {
	Error     error
	ErrorType TxnErrorType
}

type TxnErrorType

type TxnErrorType string
const (
	ReceiptErrorType   TxnErrorType = "ReceiptErrorType"
	AddErrorType       TxnErrorType = "AddErrorType"
	ContractDeployType TxnErrorType = "ContractDeployErrorType"
)

Jump to

Keyboard shortcuts

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