auto

package
v0.0.0-...-24f7fd5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// env variables
	ETH_KEY_DIR_PATH = "ETH_KEY_DIR_PATH"
	ETH_HTTP_PATH    = "ETH_HTTP_PATH"

	ETH_DEPLOYMENT_NUMBER      = "ETH_DEPLOYMENT_NUMBER"
	ETH_DEPLOYMENT_BIN_PATH    = "ETH_DEPLOYMENT_BIN_PATH"
	ETH_DEPLOYMENT_GAS_LIMIT   = "ETH_DEPLOYMENT_GAS_LIMIT"
	ETH_DEPLOYMENT_GAS_FEE_CAP = "ETH_DEPLOYMENT_GAS_FEE_CAP"
	ETH_DEPLOYMENT_GAS_TIP_CAP = "ETH_DEPLOYMENT_GAS_TIP_CAP"

	ETH_CALL_FREQ         = "ETH_CALL_FREQ"
	ETH_CALL_TOTAL_NUMBER = "ETH_CALL_TOTAL_NUMBER"
	ETH_CALL_ABI_PATH     = "ETH_CALL_ABI_PATH"
	ETH_CALL_METHOD_NAME  = "ETH_CALL_METHOD_NAME"
	ETH_CALL_GAS_LIMIT    = "ETH_CALL_GAS_LIMIT"
	ETH_CALL_GAS_FEE_CAP  = "ETH_CALL_GAS_FEE_CAP"
	ETH_CALL_GAS_TIP_CAP  = "ETH_CALL_GAS_TIP_CAP"

	ETH_SEND_FREQ         = "ETH_SEND_FREQ"
	ETH_SEND_TOTAL_NUMBER = "ETH_SEND_TOTAL_NUMBER"
	ETH_SEND_AMOUNT       = "ETH_SEND_AMOUNT"
	ETH_SEND_GAS_LIMIT    = "ETH_SEND_GAS_LIMIT"
	ETH_SEND_GAS_FEE_CAP  = "ETH_SEND_GAS_FEE_CAP"
	ETH_SEND_GAS_TIP_CAP  = "ETH_SEND_GAS_TIP_CAP"
)

Variables

This section is empty.

Functions

func NewTxSpammer

func NewTxSpammer(config *Config) shared.Service

NewTxSpammer creates a new tx spamming service

Types

type CallConfig

type CallConfig struct {
	ChainID   *big.Int
	GasLimit  uint64
	GasFeeCap *big.Int
	GasTipCap *big.Int
	Amount    *big.Int

	MethodName    string
	ABI           abi.ABI
	ContractAddrs []common.Address

	Frequency   time.Duration
	TotalNumber int
}

CallConfig holds the parameters for the contract calling txs

func NewCallConfig

func NewCallConfig(chainID *big.Int) (*CallConfig, error)

NewCallConfig constructs and returns a new CallConfig

type Config

type Config struct {
	// HTTP client for sending transactions
	RpcClient *rpc.Client
	EthClient *ethclient.Client
	ChainID   *big.Int

	// Key pairs for the accounts we will use to deploy contracts and send txs
	SenderKeys  []*ecdsa.PrivateKey
	SenderAddrs []common.Address

	// Tx signer for the chain we are working with
	Signer types.Signer

	// Configuration for the initial contract deployment
	DeploymentConfig *DeploymentConfig

	// Configuration for the contract calling txs
	CallConfig *CallConfig

	// Configuration for the eth transfer txs
	SendConfig *SendConfig
}

Config holds all the parameters for the auto tx spammer

func NewConfig

func NewConfig() (*Config, error)

type ContractDeployer

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

ContractDeployer is responsible for deploying contracts

func NewContractDeployer

func NewContractDeployer(config *Config, gen *TxGenerator) *ContractDeployer

NewContractDeployer returns a new ContractDeployer

func (*ContractDeployer) Deploy

func (cp *ContractDeployer) Deploy() ([]common.Address, error)

Deploy deploys the contracts according to the config provided at construction

type DeploymentConfig

type DeploymentConfig struct {
	ChainID   *big.Int
	GasLimit  uint64
	GasFeeCap *big.Int
	GasTipCap *big.Int
	Data      []byte

	Number uint64
}

DeploymentConfig holds the parameters for the contract deployment contracts

func NewDeploymentConfig

func NewDeploymentConfig(chainID *big.Int) (*DeploymentConfig, error)

NewDeploymentConfig constructs and returns a new DeploymentConfig

type EthSender

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

EthSender sends eth value transfer txs

func NewEthSender

func NewEthSender(config *Config) *EthSender

NewEthSender returns a new EthSender

func (*EthSender) Send

func (s *EthSender) Send(quitChan <-chan bool, txChan <-chan *types.Transaction, sentCh chan *types.Transaction) (<-chan bool, <-chan error)

Send awaits txs off the provided work queue and sends them

type GenParams

type GenParams struct {
	Sender    common.Address
	SenderKey *ecdsa.PrivateKey

	ChainID   *big.Int
	GasTipCap *big.Int
	GasFeeCap *big.Int
	GasLimit  uint64
	To        *common.Address
	Amount    *big.Int
	Data      []byte
}

GenParams params for GenerateTx method calls

type SendConfig

type SendConfig struct {
	ChainID   *big.Int
	GasLimit  uint64
	GasFeeCap *big.Int
	GasTipCap *big.Int
	Amount    *big.Int

	Frequency   time.Duration
	TotalNumber int
}

SendConfig holds the parameters for the eth transfer txs

func NewSendConfig

func NewSendConfig(chainID *big.Int) (*SendConfig, error)

NewSendConfig constructs and returns a new SendConfig

type Spammer

type Spammer struct {
	Deployer    *ContractDeployer
	Sender      *EthSender
	TxGenerator *TxGenerator
	// contains filtered or unexported fields
}

Spammer underlying struct type for spamming service

func (*Spammer) Loop

func (s *Spammer) Loop(quitChan <-chan bool) (<-chan bool, error)

type TxGenerator

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

TxGenerator generates and signs txs

func NewTxGenerator

func NewTxGenerator(config *Config) *TxGenerator

NewTxGenerator creates a new tx generator

func (*TxGenerator) GenerateTx

func (gen *TxGenerator) GenerateTx(params *GenParams) (*types.Transaction, common.Address, error)

GenerateTx generates tx from the provided params

func (*TxGenerator) GenerateTxs

func (gen *TxGenerator) GenerateTxs(quitChan <-chan bool) (<-chan bool, <-chan *types.Transaction, <-chan error)

type TxWatcher

type TxWatcher struct {
	PendingTxCh chan *types.Transaction
	// contains filtered or unexported fields
}

func NewTxWatcher

func NewTxWatcher(ethClient *ethclient.Client) *TxWatcher

func (*TxWatcher) Start

func (tw *TxWatcher) Start()

Jump to

Keyboard shortcuts

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