Documentation ¶
Index ¶
- Constants
- Variables
- func CreateOrAppendToJsonArray(filePath string, newItem any) error
- func DoesPragmaSupportCustomRevert(pragma Pragma) bool
- func EtherToWei(eth *big.Float) *big.Int
- func LoadDeployedContracts(filename string) (map[string]string, error)
- func NewAddress() (string, string, error)
- func NewEphemeralKeys(addrs int64) ([]string, error)
- func NewLoggingTransport() http.RoundTripper
- func OpenJsonFileAsStruct(path string, v any) error
- func ReturnFunds(c *Client, toAddr string) error
- func SaveDeployedContract(filename, contractName, address string) error
- func ValidateConfig(cfg *Config) error
- func WeiToEther(wei *big.Int) *big.Float
- type ABIFinder
- type ABIFinderResult
- type ABIStore
- type BlockStats
- type BlockStatsConfig
- type Call
- type CallOpt
- type Client
- func (m *Client) AnySyncedKey() int
- func (m *Client) CalculateGasEstimations(request GasEstimationRequest) GasEstimations
- func (m *Client) CalculateNetworkCongestionMetric(blocksNumber uint64, strategy string) (float64, error)
- func (m *Client) CalculateSubKeyFunding(addrs, gasPrice, rooKeyBuffer int64) (*FundingDetails, error)
- func (m *Client) CallMsgFromTx(tx *types.Transaction) (ethereum.CallMsg, error)
- func (m *Client) Decode(tx *types.Transaction, txErr error) (*DecodedTransaction, error)
- func (m *Client) DecodeCustomABIErr(txErr error) (string, error)
- func (m *Client) DecodeSendErr(txErr error) error
- func (m *Client) DecodeTx(tx *types.Transaction) (*DecodedTransaction, error)
- func (m *Client) DeployContract(auth *bind.TransactOpts, name string, abi abi.ABI, bytecode []byte, ...) (DeploymentData, error)
- func (m *Client) DeployContractFromContractStore(auth *bind.TransactOpts, name string, params ...interface{}) (DeploymentData, error)
- func (m *Client) DeployDebugContract(subDbgAddr common.Address) (*network_debug_contract.NetworkDebugContract, common.Address, error)
- func (m *Client) DeployDebugSubContract() (*network_sub_debug_contract.NetworkDebugSubContract, common.Address, error)
- func (m *Client) DownloadContractAndGetPragma(address common.Address, block *big.Int) (Pragma, error)
- func (m *Client) EstimateGasLimitForFundTransfer(from, to common.Address, amount *big.Int) (uint64, error)
- func (m *Client) GetRootKeyAddress() (common.Address, error)
- func (m *Client) GetRootPrivateKey() (*ecdsa.PrivateKey, error)
- func (m *Client) GetSuggestedEIP1559Fees(ctx context.Context, priority string) (maxFeeCap *big.Int, adjustedTipCap *big.Int, err error)
- func (m *Client) GetSuggestedLegacyFees(ctx context.Context, priority string) (adjustedGasPrice *big.Int, err error)
- func (m *Client) HistoricalFeeData(priority string) (baseFee float64, historicalGasTipCap float64, err error)
- func (m *Client) MustGetRootKeyAddress() common.Address
- func (m *Client) MustGetRootPrivateKey() *ecdsa.PrivateKey
- func (m *Client) NewCallKeyOpts(keyNum int, o ...CallOpt) *bind.CallOpts
- func (m *Client) NewCallOpts(o ...CallOpt) *bind.CallOpts
- func (m *Client) NewDefaultGasEstimationRequest() GasEstimationRequest
- func (m *Client) NewTXKeyOpts(keyNum int, o ...TransactOpt) *bind.TransactOpts
- func (m *Client) NewTXOpts(o ...TransactOpt) *bind.TransactOpts
- func (m *Client) RetryTxAndDecode(f func() (*types.Transaction, error)) (*DecodedTransaction, error)
- func (m *Client) SaveDecodedCallsAsJson(dirname string) error
- func (m *Client) TransferETHFromKey(ctx context.Context, fromKeyNum int, to string, value *big.Int, ...) error
- func (m *Client) WaitMined(ctx context.Context, l zerolog.Logger, b bind.DeployBackend, ...) (*types.Receipt, error)
- func (m *Client) WaitUntilNoPendingTx(address common.Address, timeout time.Duration) error
- func (m *Client) WaitUntilNoPendingTxForKeyNum(keyNum int, timeout time.Duration) error
- func (m *Client) WaitUntilNoPendingTxForRootKey(timeout time.Duration) error
- type ClientBuilder
- func (c *ClientBuilder) Build() (*Client, error)
- func (c *ClientBuilder) BuildConfig() (*Config, error)
- func (c *ClientBuilder) UseNetworkWithChainId(chainId uint64) *ClientBuilder
- func (c *ClientBuilder) UseNetworkWithName(name string) *ClientBuilder
- func (c *ClientBuilder) WithArtifactsFolder(folder string) *ClientBuilder
- func (c *ClientBuilder) WithDynamicGasPrices(gasFeeCap, gasTipCap int64) *ClientBuilder
- func (c *ClientBuilder) WithEIP1559DynamicFees(enabled bool) *ClientBuilder
- func (c *ClientBuilder) WithEphemeralAddresses(ephemeralAddressCount, rootKeyBufferAmount int64) *ClientBuilder
- func (c *ClientBuilder) WithGasBumping(retries uint, maxGasPrice int64, customBumpingStrategy GasBumpStrategyFn) *ClientBuilder
- func (c *ClientBuilder) WithGasPriceEstimations(enabled bool, estimationBlocks uint64, txPriority string) *ClientBuilder
- func (c *ClientBuilder) WithGethWrappersFolders(folders []string) *ClientBuilder
- func (c *ClientBuilder) WithLegacyGasPrice(gasPrice int64) *ClientBuilder
- func (c *ClientBuilder) WithNetworkChainId(chainId uint64) *ClientBuilder
- func (c *ClientBuilder) WithNetworkName(name string) *ClientBuilder
- func (c *ClientBuilder) WithNonceManager(rateLimitSec int, retries uint, timeout, retryDelay time.Duration) *ClientBuilder
- func (c *ClientBuilder) WithPrivateKeys(pks []string) *ClientBuilder
- func (c *ClientBuilder) WithProtections(pendingNonceProtectionEnabled, nodeHealthStartupCheck bool, ...) *ClientBuilder
- func (c *ClientBuilder) WithReadOnlyMode() *ClientBuilder
- func (c *ClientBuilder) WithRpcDialTimeout(timeout time.Duration) *ClientBuilder
- func (c *ClientBuilder) WithRpcUrl(url string) *ClientBuilder
- func (c *ClientBuilder) WithTracing(level string, outputs []string) *ClientBuilder
- func (c *ClientBuilder) WithTransactionTimeout(timeout time.Duration) *ClientBuilder
- func (c *ClientBuilder) WithTransferGasFee(transferGasFee int64) *ClientBuilder
- type ClientOpt
- type CommonData
- type Config
- func (c *Config) AppendPksToNetwork(pks []string, name string) bool
- func (c *Config) FirstNetworkURL() string
- func (c *Config) GasBumpRetries() uint
- func (c *Config) GenerateContractMapFileName() string
- func (c *Config) GetMaxConcurrency() int
- func (c *Config) HasMaxBumpGasPrice() bool
- func (c *Config) IsExperimentEnabled(experiment string) bool
- func (c *Config) IsSimulatedNetwork() bool
- func (c *Config) ParseKeys() ([]common.Address, []*ecdsa.PrivateKey, error)
- func (c *Config) ShouldSaveDeployedContractMap() bool
- type ContextErrorKey
- type ContractLoader
- type ContractMap
- func (c ContractMap) AddContract(addr, name string)
- func (c ContractMap) GetContractAddress(addr string) string
- func (c ContractMap) GetContractMap() map[string]string
- func (c ContractMap) GetContractName(addr string) string
- func (c ContractMap) IsKnownAddress(addr string) bool
- func (c ContractMap) Size() int
- type ContractStore
- type DecodableLog
- type DecodedCall
- type DecodedCommonLog
- type DecodedTransaction
- type DecodedTransactionLog
- type DeploymentData
- type Duration
- func (d Duration) Before(t time.Time) time.Time
- func (d Duration) Duration() time.Duration
- func (d Duration) IsInstant() bool
- func (d Duration) MarshalJSON() ([]byte, error)
- func (d Duration) MarshalText() ([]byte, error)
- func (d *Duration) Scan(v interface{}) (err error)
- func (d Duration) Shorter(od Duration) bool
- func (d Duration) String() string
- func (d *Duration) UnmarshalJSON(input []byte) error
- func (d *Duration) UnmarshalText(input []byte) error
- func (d Duration) Value() (driver.Value, error)
- type FundingDetails
- type GasBumpConfig
- type GasBumpStrategyFn
- type GasEstimationRequest
- type GasEstimations
- type GasEstimator
- type GasPercentiles
- type GasSuggestions
- type KeyNonce
- type LFUHeaderCache
- type LogWithEventData
- type LoggingTransport
- type Network
- type NonceManager
- type NonceManagerCfg
- type NonceStatus
- type Pragma
- type TXCallTraceOutput
- type TXFourByteMetadataOutput
- type Trace
- type TraceLog
- type Tracer
- func (t *Tracer) AddDecodedCalls(txHash string, calls []*DecodedCall)
- func (t *Tracer) DecodeTrace(l zerolog.Logger, trace Trace) ([]*DecodedCall, error)
- func (t *Tracer) GetAllDecodedCalls() map[string][]*DecodedCall
- func (t *Tracer) GetDecodedCalls(txHash string) []*DecodedCall
- func (t *Tracer) PrintTXTrace(txHash string) error
- func (t *Tracer) SaveDecodedCallsAsJson(dirname string) error
- func (t *Tracer) TraceGethTX(txHash string) ([]*DecodedCall, error)
- type TransactOpt
- func WithFrom(fromAddress common.Address) TransactOpt
- func WithGasFeeCap(gasFeeCap *big.Int) TransactOpt
- func WithGasLimit(gasLimit uint64) TransactOpt
- func WithGasPrice(gasPrice *big.Int) TransactOpt
- func WithGasTipCap(gasTipCap *big.Int) TransactOpt
- func WithNoSend(noSend bool) TransactOpt
- func WithNonce(nonce *big.Int) TransactOpt
- func WithSignerFn(signerFn bind.SignerFn) TransactOpt
- func WithValue(value *big.Int) TransactOpt
- type TransactionLog
Constants ¶
const ( ErrEmptyConfigPath = "toml config path is empty, set SETH_CONFIG_PATH" ErrCreateABIStore = "failed to create ABI store" ErrReadingKeys = "failed to read keys" ErrCreateNonceManager = "failed to create nonce manager" ErrCreateTracer = "failed to create tracer" ErrReadContractMap = "failed to read deployed contract map" ErrRpcHealthCheckFailed = "RPC health check failed ¯\\_(ツ)_/¯" ErrContractDeploymentFailed = "contract deployment failed" ErrNoPksEphemeralMode = "no private keys loaded, cannot fund ephemeral addresses" // unused by Seth, but used by upstream ErrNoKeyLoaded = "failed to load private key" ErrReadOnlyWithPrivateKeys = "read-only mode is enabled, but you tried to load private keys" ErrReadOnlyEphemeralKeys = "ephemeral mode is not supported in read-only mode" ErrReadOnlyGasBumping = "gas bumping is not supported in read-only mode" ErrReadOnlyRpcHealth = "RPC health check is not supported in read-only mode" ErrReadOnlyPendingNonce = "pending nonce protection is not supported in read-only mode" ContractMapFilePattern = "deployed_contracts_%s_%s.toml" RevertedTransactionsFilePattern = "reverted_transactions_%s_%s.json" )
const ( NoPkForRpcHealthCheckErr = "you need to provide at least one private key to check the RPC health" NoPkForNonceProtection = "you need to provide at least one private key to enable nonce protection" NoPkForEphemeralKeys = "you need to provide at least one private key to generate and fund ephemeral addresses" NoPkForGasPriceEstimation = "you need to provide at least one private key to enable gas price estimations" )
const ( ErrReadSethConfig = "failed to read TOML config for seth" ErrUnmarshalSethConfig = "failed to unmarshal TOML config for seth" ErrEmptyRootPrivateKey = "no root private key were set, set %s=..." GETH = "Geth" ANVIL = "Anvil" CONFIG_FILE_ENV_VAR = "SETH_CONFIG_PATH" ROOT_PRIVATE_KEY_ENV_VAR = "SETH_ROOT_PRIVATE_KEY" NETWORK_ENV_VAR = "SETH_NETWORK" URL_ENV_VAR = "SETH_URL" DefaultNetworkName = "Default" DefaultDialTimeout = 1 * time.Minute DefaultPendingNonceProtectionTimeout = 1 * time.Minute DefaultTransferGasFee = 21_000 DefaultGasPrice = 100_000_000_000 // 100 Gwei DefaultGasFeeCap = 100_000_000_000 // 100 Gwei DefaultGasTipCap = 50_000_000_000 // 50 Gwei )
const ( Experiment_SlowFundsReturn = "slow_funds_return" Experiment_Eip1559FeeEqualier = "eip_1559_fee_equalizer" )
const ( ErrOpenABIFile = "failed to open ABI file" ErrParseABI = "failed to parse ABI file" ErrOpenBINFile = "failed to open BIN file" ErrNoABIInFile = "no ABI content found in file" )
const ( ErrDecodeInput = "failed to decode transaction input" ErrDecodeOutput = "failed to decode transaction output" ErrDecodeLog = "failed to decode log" ErrDecodedLogNonIndexed = "failed to decode non-indexed log data" ErrDecodeILogIndexed = "failed to decode indexed log data" ErrTooShortTxData = "tx data is less than 4 bytes, can't decode" ErrRPCJSONCastError = "failed to cast CallMsg error as rpc.DataError" WarnNoContractStore = "ContractStore is nil, use seth.NewContractStore(...) to decode transactions" )
const ( Priority_Degen = "degen" //this is undocumented option, which we left for cases, when we need to set the highest gas price Priority_Fast = "fast" Priority_Standard = "standard" Priority_Slow = "slow" Congestion_Low = "low" Congestion_Medium = "medium" Congestion_High = "high" Congestion_VeryHigh = "extreme" )
const ( // each block has the same weight in the computation CongestionStrategy_Simple = "simple" // newer blocks have more weight in the computation CongestionStrategy_NewestFirst = "newest_first" )
const ( ErrKeySyncTimeout = "key sync timeout, consider increasing key_sync_timeout in seth.toml, or increasing the number of keys" ErrKeySync = "failed to sync the key" ErrNonce = "failed to get nonce" TimeoutKeyNum = -80001 )
const ( ErrNoTrace = "no trace found" ErrNoABIMethod = "no ABI method found" ErrNoAbiFound = "no ABI found in Contract Store" ErrNoFourByteFound = "no method signatures found in tracing data" ErrInvalidMethodSignature = "no method signature found or it's not 4 bytes long" WrnMissingCallTrace = "" /* 135-byte string literal not displayed */ FAILED_TO_DECODE = "failed to decode" UNKNOWN = "unknown" NO_DATA = "no data" CommentMissingABI = "Call not decoded due to missing ABI instance" )
const ( MetadataNotFoundErr = "metadata section not found" InvalidMetadataLengthErr = "invalid metadata length" FailedToDecodeMetadataErr = "failed to decode metadata" NotCompiledWithSolcErr = "not compiled with solc" )
const (
ErrInsufficientRootKeyBalance = "insufficient root key balance: %s"
)
const (
ErrRPCConnectionRefused = "connection refused"
)
const (
ErrRetryTimeout = "retry timeout"
)
const (
LogLevelEnvVar = "SETH_LOG_LEVEL"
)
Variables ¶
var ( // Amount of funds that will be left on the root key, when splitting funds between ephemeral addresses ZeroInt64 int64 TracingLevel_None = "NONE" TracingLevel_Reverted = "REVERTED" TracingLevel_All = "ALL" TraceOutput_Console = "console" TraceOutput_JSON = "json" TraceOutput_DOT = "dot" )
var ( ZeroGasSuggestedErr = "either base fee or suggested tip is 0" BlockFetchingErr = "failed to fetch enough block headers for congestion calculation" )
var (
L zerolog.Logger
)
var NoOpGasBumpStrategyFn = func(previousGasPrice *big.Int) *big.Int {
return previousGasPrice
}
NoOpGasBumpStrategyFn is a default gas bump strategy that does nothing
var PriorityBasedGasBumpingStrategyFn = func(priority string) GasBumpStrategyFn { switch priority { case Priority_Degen: return func(gasPrice *big.Int) *big.Int { return gasPrice.Mul(gasPrice, big.NewInt(2)) } case Priority_Fast: return func(gasPrice *big.Int) *big.Int { gasPriceFloat, _ := gasPrice.Float64() newGasPriceFloat := big.NewFloat(0.0).Mul(big.NewFloat(gasPriceFloat), big.NewFloat(1.3)) newGasPrice, _ := newGasPriceFloat.Int64() return big.NewInt(newGasPrice) } case Priority_Standard: return func(gasPrice *big.Int) *big.Int { gasPriceFloat, _ := gasPrice.Float64() newGasPriceFloat := big.NewFloat(0.0).Mul(big.NewFloat(gasPriceFloat), big.NewFloat(1.15)) newGasPrice, _ := newGasPriceFloat.Int64() return big.NewInt(newGasPrice) } case Priority_Slow: return func(gasPrice *big.Int) *big.Int { gasPriceFloat, _ := gasPrice.Float64() newGasPriceFloat := big.NewFloat(0.0).Mul(big.NewFloat(gasPriceFloat), big.NewFloat(1.05)) newGasPrice, _ := newGasPriceFloat.Int64() return big.NewInt(newGasPrice) } default: return func(gasPrice *big.Int) *big.Int { return gasPrice } } }
PriorityBasedGasBumpingStrategyFn is a function that returns a gas bump strategy based on the priority. For Fast priority it bumps gas price by 30%, for Standard by 15%, for Slow by 5% and for the rest it does nothing.
Functions ¶
func CreateOrAppendToJsonArray ¶
CreateOrAppendToJsonArray appends to a JSON array in a file or creates a new JSON array if the file is empty or doesn't exist
func DoesPragmaSupportCustomRevert ¶
DoesPragmaSupportCustomRevert checks if the pragma version supports custom revert messages (must be >= 0.8.4)
func EtherToWei ¶
EtherToWei converts an ETH float amount to wei
func NewEphemeralKeys ¶
NewEphemeralKeys creates desired number of ephemeral keys, should be used only with ephemeral networks. Remember that they are not persisted anywhere, so you shouldn't use that option with live networks.
func NewLoggingTransport ¶
func NewLoggingTransport() http.RoundTripper
NewLoggingTransport creates a new logging transport for GAP or default transport controlled by SETH_LOG_LEVEL
func OpenJsonFileAsStruct ¶
func ReturnFunds ¶
ReturnFunds returns funds to the root key from all other keys
func SaveDeployedContract ¶
func ValidateConfig ¶
ValidateConfig checks and validates the provided Config struct. It ensures essential fields have valid values or default to appropriate values when necessary. This function performs validation on gas price estimation, gas limit, tracing level, trace outputs, network dial timeout, and pending nonce protection timeout. If any configuration is invalid, it returns an error.
Types ¶
type ABIFinder ¶
type ABIFinder struct { ContractMap ContractMap ContractStore *ContractStore }
func NewABIFinder ¶
func NewABIFinder(contractMap ContractMap, contractStore *ContractStore) ABIFinder
func (*ABIFinder) FindABIByMethod ¶
func (a *ABIFinder) FindABIByMethod(address string, signature []byte) (ABIFinderResult, error)
FindABIByMethod finds the ABI method and instance for the given contract address and signature If the contract address is known, it will use the ABI instance that is known to be at the address. If the contract address is not known, it will iterate over all known ABIs and check if any of them has a method with the given signature. If there are duplicates we will use the first ABI that matched.
type ABIFinderResult ¶
type ABIFinderResult struct { ABI abi.ABI Method *abi.Method DuplicateCount int // contains filtered or unexported fields }
func (*ABIFinderResult) ContractName ¶
func (a *ABIFinderResult) ContractName() string
type BlockStats ¶
BlockStats is a block stats calculator
func NewBlockStats ¶
func NewBlockStats(c *Client) (*BlockStats, error)
NewBlockStats creates a new instance of BlockStats
func (*BlockStats) CalculateBlockDurations ¶
func (cs *BlockStats) CalculateBlockDurations(blocks []*types.Block) error
CalculateBlockDurations calculates and logs the duration, TPS, gas used, and gas limit between each consecutive block
type BlockStatsConfig ¶
type BlockStatsConfig struct {
RPCRateLimit int `toml:"rpc_requests_per_second_limit"`
}
func (*BlockStatsConfig) Validate ¶
func (cfg *BlockStatsConfig) Validate() error
type Call ¶
type Call struct { From string `json:"from"` Gas string `json:"gas"` GasUsed string `json:"gasUsed"` Input string `json:"input"` Logs []TraceLog `json:"logs"` Output string `json:"output"` To string `json:"to"` Type string `json:"type"` Value string `json:"value"` Error string `json:"error"` Calls []Call `json:"calls"` }
type CallOpt ¶
CallOpt is a functional option for bind.CallOpts
func WithBlockNumber ¶
WithBlockNumber sets blockNumber option for bind.CallOpts
func WithPending ¶
WithPending sets pending option for bind.CallOpts
type Client ¶
type Client struct { Cfg *Config Client *ethclient.Client Addresses []common.Address PrivateKeys []*ecdsa.PrivateKey ChainID int64 URL string Context context.Context CancelFunc context.CancelFunc Errors []error ContractStore *ContractStore NonceManager *NonceManager Tracer *Tracer ContractAddressToNameMap ContractMap ABIFinder *ABIFinder HeaderCache *LFUHeaderCache }
Client is a vanilla go-ethereum client with enhanced debug logging
func DefaultClient ¶
DefaultClient returns a Client with reasonable default config with the specified RPC URL and private keys. You should pass at least 1 private key. It assumes that network is EIP-1559 compatible (if it's not, the client will later automatically update its configuration to reflect it).
func NewClientRaw ¶
func NewClientRaw( cfg *Config, addrs []common.Address, pkeys []*ecdsa.PrivateKey, opts ...ClientOpt, ) (*Client, error)
NewClientRaw creates a new raw seth client without dependencies
func NewClientWithConfig ¶
NewClientWithConfig creates a new seth client with all deps setup from config
func (*Client) AnySyncedKey ¶
AnySyncedKey returns the first synced key
func (*Client) CalculateGasEstimations ¶
func (m *Client) CalculateGasEstimations(request GasEstimationRequest) GasEstimations
CalculateGasEstimations calculates gas estimations (price, tip/cap) or uses hardcoded values if estimation is disabled, estimation errors or network is a simulated one.
func (*Client) CalculateNetworkCongestionMetric ¶
func (m *Client) CalculateNetworkCongestionMetric(blocksNumber uint64, strategy string) (float64, error)
CalculateNetworkCongestionMetric calculates a simple congestion metric based on the last N blocks according to selected strategy.
func (*Client) CalculateSubKeyFunding ¶
func (m *Client) CalculateSubKeyFunding(addrs, gasPrice, rooKeyBuffer int64) (*FundingDetails, error)
CalculateSubKeyFunding calculates all required params to split funds from the root key to N test keys
func (*Client) CallMsgFromTx ¶
func (m *Client) CallMsgFromTx(tx *types.Transaction) (ethereum.CallMsg, error)
CallMsgFromTx creates ethereum.CallMsg from tx, used in simulated calls
func (*Client) Decode ¶
func (m *Client) Decode(tx *types.Transaction, txErr error) (*DecodedTransaction, error)
Decode waits for transaction to be minted, then decodes transaction inputs, outputs, logs and events and depending on 'tracing_level' it either returns immediately or if the level matches it traces all calls. Where tracing results are sent depends on the 'trace_outputs' field in the config. If transaction was reverted the error returned will be revert error, not decoding error (that, if any, will only be logged). At the same time we also return decoded transaction, so contrary to go convention you might get both error and result, because we want to return the decoded transaction even if it was reverted. Last, but not least, if gas bumps are enabled, we will try to bump gas on transaction mining timeout and resubmit it with higher gas.
func (*Client) DecodeCustomABIErr ¶
DecodeCustomABIErr decodes typed Solidity errors
func (*Client) DecodeSendErr ¶ added in v1.2.1
DecodeSendErr tries to decode the error and return the reason of the revert. If the error is not revert, it returns the original error. If the error is revert, but it cannot be decoded, it logs the error and returns the original error. If the error is revert, and it can be decoded, it returns the decoded error. This function is used to decode errors that are returned by the send transaction function.
func (*Client) DecodeTx ¶ added in v1.2.1
func (m *Client) DecodeTx(tx *types.Transaction) (*DecodedTransaction, error)
DecodeTx waits for transaction to be minted, then decodes transaction inputs, outputs, logs and events and depending on 'tracing_level' and transaction status (reverted or not) it either returns immediately or traces all calls. If transaction was reverted the error returned will be revert error, not decoding error (that, if any, will only be logged). At the same time we also return decoded transaction, so contrary to go convention you might get both error and result, because we want to return the decoded transaction even if it was reverted. Last, but not least, if gas bumps are enabled, we will try to bump gas on transaction mining timeout and resubmit it with higher gas.
func (*Client) DeployContract ¶
func (m *Client) DeployContract(auth *bind.TransactOpts, name string, abi abi.ABI, bytecode []byte, params ...interface{}) (DeploymentData, error)
DeployContract deploys contract using ABI and bytecode passed to it, waits for transaction to be minted and contract really available at the address, so that when the method returns it's safe to interact with it. It also saves the contract address and ABI name to the contract map, so that we can use that, when tracing transactions. It is suggested to use name identical to the name of the contract Solidity file.
func (*Client) DeployContractFromContractStore ¶
func (m *Client) DeployContractFromContractStore(auth *bind.TransactOpts, name string, params ...interface{}) (DeploymentData, error)
DeployContractFromContractStore deploys contract from Seth's Contract Store, waits for transaction to be minted and contract really available at the address, so that when the method returns it's safe to interact with it. It also saves the contract address and ABI name to the contract map, so that we can use that, when tracing transactions. Name by which you refer the contract should be the same as the name of ABI file (you can omit the .abi suffix).
func (*Client) DeployDebugContract ¶
func (m *Client) DeployDebugContract(subDbgAddr common.Address) (*network_debug_contract.NetworkDebugContract, common.Address, error)
func (*Client) DeployDebugSubContract ¶
func (m *Client) DeployDebugSubContract() (*network_sub_debug_contract.NetworkDebugSubContract, common.Address, error)
func (*Client) DownloadContractAndGetPragma ¶
func (m *Client) DownloadContractAndGetPragma(address common.Address, block *big.Int) (Pragma, error)
DownloadContractAndGetPragma retrieves the bytecode of a contract at a specified address and block, then decodes it to extract the pragma version. Returns the pragma version or an error if retrieval or decoding fails.
func (*Client) EstimateGasLimitForFundTransfer ¶
func (m *Client) EstimateGasLimitForFundTransfer(from, to common.Address, amount *big.Int) (uint64, error)
EstimateGasLimitForFundTransfer estimates gas limit for fund transfer
func (*Client) GetRootKeyAddress ¶
GetRootKeyAddress returns the root key address from the client configuration. If no addresses are found, it returns an error. Root key address is the first address in the list of addresses.
func (*Client) GetRootPrivateKey ¶
func (m *Client) GetRootPrivateKey() (*ecdsa.PrivateKey, error)
GetRootPrivateKey returns the private key of root key/address from the client configuration. If no private keys are found, it returns an error. Root private key is the first private key in the list of private keys.
func (*Client) GetSuggestedEIP1559Fees ¶
func (m *Client) GetSuggestedEIP1559Fees(ctx context.Context, priority string) (maxFeeCap *big.Int, adjustedTipCap *big.Int, err error)
GetSuggestedEIP1559Fees returns suggested tip/fee cap calculated based on historical data, current congestion, and priority.
func (*Client) GetSuggestedLegacyFees ¶
func (m *Client) GetSuggestedLegacyFees(ctx context.Context, priority string) (adjustedGasPrice *big.Int, err error)
GetSuggestedLegacyFees calculates the suggested gas price based on historical data, current congestion, and priority.
func (*Client) HistoricalFeeData ¶
func (*Client) MustGetRootKeyAddress ¶
MustGetRootKeyAddress returns the root key address from the client configuration. If no addresses are found, it panics. Root key address is the first address in the list of addresses.
func (*Client) MustGetRootPrivateKey ¶
func (m *Client) MustGetRootPrivateKey() *ecdsa.PrivateKey
MustGetRootPrivateKey returns the private key of root key/address from the client configuration. If no private keys are found, it panics. Root private key is the first private key in the list of private keys.
func (*Client) NewCallKeyOpts ¶
NewCallKeyOpts returns a new sequential call options wrapper from the key N
func (*Client) NewCallOpts ¶
NewCallOpts returns a new sequential call options wrapper
func (*Client) NewDefaultGasEstimationRequest ¶
func (m *Client) NewDefaultGasEstimationRequest() GasEstimationRequest
NewDefaultGasEstimationRequest creates a new default gas estimation request based on current network configuration
func (*Client) NewTXKeyOpts ¶
func (m *Client) NewTXKeyOpts(keyNum int, o ...TransactOpt) *bind.TransactOpts
NewTXKeyOpts returns a new transaction options wrapper, sets opts.GasPrice and opts.GasLimit from seth.toml or override with options
func (*Client) NewTXOpts ¶
func (m *Client) NewTXOpts(o ...TransactOpt) *bind.TransactOpts
NewTXOpts returns a new transaction options wrapper, Sets gas price/fee tip/cap and gas limit either based on TOML config or estimations.
func (*Client) RetryTxAndDecode ¶
func (m *Client) RetryTxAndDecode(f func() (*types.Transaction, error)) (*DecodedTransaction, error)
RetryTxAndDecode executes transaction several times, retries if connection is lost and decodes all the data
func (*Client) SaveDecodedCallsAsJson ¶
func (*Client) TransferETHFromKey ¶
func (m *Client) TransferETHFromKey(ctx context.Context, fromKeyNum int, to string, value *big.Int, gasPrice *big.Int) error
TransferETHFromKey initiates a transfer of Ether from a specified key to a recipient address. It validates the private key index, estimates gas limit if not provided, and sends the transaction. The function signs and sends an Ethereum transaction using the specified fromKeyNum and recipient address, with the specified amount and gas price.
func (*Client) WaitMined ¶
func (m *Client) WaitMined(ctx context.Context, l zerolog.Logger, b bind.DeployBackend, tx *types.Transaction) (*types.Receipt, error)
WaitMined the same as bind.WaitMined, awaits transaction receipt until timeout
func (*Client) WaitUntilNoPendingTx ¶
WaitUntilNoPendingTx waits until there's no pending transaction for address. If after timeout there are still pending transactions, it returns error.
func (*Client) WaitUntilNoPendingTxForKeyNum ¶
WaitUntilNoPendingTxForKeyNum waits until there's no pending transaction for key at index `keyNum`. If index is out of range or if after timeout there are still pending transactions, it returns error.
type ClientBuilder ¶
type ClientBuilder struct {
// contains filtered or unexported fields
}
func NewClientBuilder ¶
func NewClientBuilder() *ClientBuilder
NewClientBuilder creates a new ClientBuilder with reasonable default values. You only need to pass private key(s) and RPC URL to build a usable config.
func NewClientBuilderWithConfig ¶ added in v1.50.4
func NewClientBuilderWithConfig(config *Config) *ClientBuilder
NewClientBuilderWithConfig creates a new ClientBuilder with a provided config. If it doesn't have the network set, remember to set it with `UseNetworkWithName(name string)` or `WithSelectedNetworkWithChainId(chainId uint64)`, before calling any of the methods that modify the Network.
func (*ClientBuilder) Build ¶
func (c *ClientBuilder) Build() (*Client, error)
Build creates a new Client from the builder.
func (*ClientBuilder) BuildConfig ¶ added in v1.50.4
func (c *ClientBuilder) BuildConfig() (*Config, error)
BuildConfig returns the config from the builder.
func (*ClientBuilder) UseNetworkWithChainId ¶ added in v1.50.4
func (c *ClientBuilder) UseNetworkWithChainId(chainId uint64) *ClientBuilder
UseNetworkWithChainId sets the network to use by chain ID. If the network with the provided chain ID is not found in the `Networks` slice, config will fail on build. There is no default value.
func (*ClientBuilder) UseNetworkWithName ¶ added in v1.50.4
func (c *ClientBuilder) UseNetworkWithName(name string) *ClientBuilder
UseNetworkWithName sets the network to use by name. If the network with the provided name is not found in the `Networks` slice, config will fail on build. There is no default value.
func (*ClientBuilder) WithArtifactsFolder ¶
func (c *ClientBuilder) WithArtifactsFolder(folder string) *ClientBuilder
WithArtifactsFolder sets the folder where the Seth artifacts such as DOT graphs or JSON will be saved. Default value is "seth_artifacts".
func (*ClientBuilder) WithDynamicGasPrices ¶
func (c *ClientBuilder) WithDynamicGasPrices(gasFeeCap, gasTipCap int64) *ClientBuilder
WithDynamicGasPrices sets the gas fee cap and gas tip cap for EIP-1559 dynamic fees. These values will be used only if EIP-1559 dynamic fees are enabled. Default values are 150 gwei for gas fee cap and 50 gwei for gas tip cap.
func (*ClientBuilder) WithEIP1559DynamicFees ¶
func (c *ClientBuilder) WithEIP1559DynamicFees(enabled bool) *ClientBuilder
WithEIP1559DynamicFees enables or disables EIP-1559 dynamic fees. If enabled, you should set gas fee cap and gas tip cap with `WithDynamicGasPrices()` Default value is true.
func (*ClientBuilder) WithEphemeralAddresses ¶
func (c *ClientBuilder) WithEphemeralAddresses(ephemeralAddressCount, rootKeyBufferAmount int64) *ClientBuilder
WithEphemeralAddresses sets the number of ephemeral addresses to generate and the amount of funds to keep in the root private key. Default values are 0 for ephemeral addresses and 0 for root key funds buffer.
func (*ClientBuilder) WithGasBumping ¶
func (c *ClientBuilder) WithGasBumping(retries uint, maxGasPrice int64, customBumpingStrategy GasBumpStrategyFn) *ClientBuilder
WithGasBumping sets the number of retries for gas bumping and max gas price. You can also provide a custom bumping strategy. If the transaction is not mined within this number of retries, it will be considered failed. If the gas price is bumped to a value higher than max gas price, no more gas bumping will be attempted and previous gas price will be used by all subsequent attempts. If set to 0 max price is not checked. Default value is 0 retries. If you want to use default bumping strategy (where gas increase % based on gas_price_estimation_tx_priority), pass `nil` as the customBumpingStrategy.
func (*ClientBuilder) WithGasPriceEstimations ¶
func (c *ClientBuilder) WithGasPriceEstimations(enabled bool, estimationBlocks uint64, txPriority string) *ClientBuilder
WithGasPriceEstimations enables or disables gas price estimations, sets the number of blocks to use for estimation or transaction priority. Even with estimations enabled you should still either set legacy gas price with `WithLegacyGasPrice()` or EIP-1559 dynamic fees with `WithDynamicGasPrices()` ss they will be used as fallback values, if the estimations fail. Following priorities are supported: "slow", "standard" and "fast" Default values are true for enabled, 200 blocks for estimation and "standard" for priority.
func (*ClientBuilder) WithGethWrappersFolders ¶ added in v1.2.1
func (c *ClientBuilder) WithGethWrappersFolders(folders []string) *ClientBuilder
WithGethWrappersFolders sets list of folders where the Geth wrappers are stored. Seth will load ABIs from all wrappers it finds in theses folders (including subfolders). Default value is an empty string (= loading disabled).
func (*ClientBuilder) WithLegacyGasPrice ¶
func (c *ClientBuilder) WithLegacyGasPrice(gasPrice int64) *ClientBuilder
WithLegacyGasPrice sets the gas price for legacy transactions that will be used only if EIP-1559 dynamic fees are disabled. Default value is 1 gwei.
func (*ClientBuilder) WithNetworkChainId ¶ added in v1.50.4
func (c *ClientBuilder) WithNetworkChainId(chainId uint64) *ClientBuilder
WithNetworkChainId sets the network chainID. If no value is set, we will ask the RPC node for the chainID. There is no default value.
func (*ClientBuilder) WithNetworkName ¶
func (c *ClientBuilder) WithNetworkName(name string) *ClientBuilder
WithNetworkName sets the network name, useful mostly for debugging and logging. Default value is "default".
func (*ClientBuilder) WithNonceManager ¶
func (c *ClientBuilder) WithNonceManager(rateLimitSec int, retries uint, timeout, retryDelay time.Duration) *ClientBuilder
WithNonceManager sets the rate limit for key sync, number of retries, timeout and retry delay. Default values are 10 calls per second, 3 retires, 60s timeout and 5s retry delay.
func (*ClientBuilder) WithPrivateKeys ¶
func (c *ClientBuilder) WithPrivateKeys(pks []string) *ClientBuilder
WithPrivateKeys sets the private keys for the config. At least one is required to build a valid config. Default value is an empty slice (which is an incorrect value).
func (*ClientBuilder) WithProtections ¶
func (c *ClientBuilder) WithProtections(pendingNonceProtectionEnabled, nodeHealthStartupCheck bool, pendingNonceProtectionTimeout *Duration) *ClientBuilder
WithProtections enables or disables nonce protection (fails, when key has a pending transaction, and you try to submit another one) and node health check on startup. Default values are false for nonce protection, true for node health check and 1 minute timeout.
func (*ClientBuilder) WithReadOnlyMode ¶ added in v1.50.6
func (c *ClientBuilder) WithReadOnlyMode() *ClientBuilder
WithReadOnlyMode sets the client to read-only mode. It removes all private keys from all Networks and disables nonce protection and ephemeral addresses.
func (*ClientBuilder) WithRpcDialTimeout ¶
func (c *ClientBuilder) WithRpcDialTimeout(timeout time.Duration) *ClientBuilder
WithRpcDialTimeout sets the timeout for dialing the RPC server. If the connection is not established within this time, it will be considered failed. Default value is 1 minute.
func (*ClientBuilder) WithRpcUrl ¶
func (c *ClientBuilder) WithRpcUrl(url string) *ClientBuilder
WithRpcUrl sets the RPC URL for the config. Default value is an empty string (which is an incorrect value).
func (*ClientBuilder) WithTracing ¶
func (c *ClientBuilder) WithTracing(level string, outputs []string) *ClientBuilder
WithTracing sets the tracing level and outputs. Tracing level can be one of: "all", "reverted", "none". Outputs can be one or more of: "console", "dot" or "json". Default values are "reverted" and ["console", "dot"].
func (*ClientBuilder) WithTransactionTimeout ¶
func (c *ClientBuilder) WithTransactionTimeout(timeout time.Duration) *ClientBuilder
WithTransactionTimeout sets the timeout for transactions. If the transaction is not mined within this time, it will be considered failed. Default value is 5 minutes.
func (*ClientBuilder) WithTransferGasFee ¶
func (c *ClientBuilder) WithTransferGasFee(transferGasFee int64) *ClientBuilder
WithTransferGasFee sets the gas fee for transfer transactions. This value is used, when sending funds to ephemeral keys or returning funds to root private key. Default value is 21_000 wei.
type ClientOpt ¶
type ClientOpt func(c *Client)
ClientOpt is a client functional option
func WithABIFinder ¶
WithABIFinder ABIFinder functional option
func WithContractMap ¶
func WithContractMap(contractAddressToNameMap ContractMap) ClientOpt
WithContractMap contractAddressToNameMap functional option
func WithContractStore ¶
func WithContractStore(as *ContractStore) ClientOpt
WithContractStore ContractStore functional option
func WithNonceManager ¶
func WithNonceManager(nm *NonceManager) ClientOpt
WithNonceManager NonceManager functional option
type CommonData ¶
type CommonData struct { CallType string `json:"call_type,omitempty"` Signature string `json:"signature"` Method string `json:"method"` Input map[string]interface{} `json:"input,omitempty"` Output map[string]interface{} `json:"output,omitempty"` NestingLevel int `json:"nesting_level,omitempty"` ParentSignature string `json:"parent_signature,omitempty"` Error string `json:"error,omitempty"` }
type Config ¶
type Config struct { RPCHeaders http.Header // external fields // ArtifactDir is the directory where all artifacts generated by seth are stored (e.g. transaction traces) ArtifactsDir string `toml:"artifacts_dir"` EphemeralAddrs *int64 `toml:"ephemeral_addresses_number"` RootKeyFundsBuffer *int64 `toml:"root_key_funds_buffer"` ABIDir string `toml:"abi_dir"` BINDir string `toml:"bin_dir"` GethWrappersDirs []string `toml:"geth_wrappers_dirs"` ContractMapFile string `toml:"contract_map_file"` SaveDeployedContractsMap bool `toml:"save_deployed_contracts_map"` Network *Network `toml:"network"` Networks []*Network `toml:"networks"` NonceManager *NonceManagerCfg `toml:"nonce_manager"` TracingLevel string `toml:"tracing_level"` TraceOutputs []string `toml:"trace_outputs"` PendingNonceProtectionEnabled bool `toml:"pending_nonce_protection_enabled"` PendingNonceProtectionTimeout *Duration `toml:"pending_nonce_protection_timeout"` ConfigDir string `toml:"abs_path"` ExperimentsEnabled []string `toml:"experiments_enabled"` CheckRpcHealthOnStart bool `toml:"check_rpc_health_on_start"` BlockStatsConfig *BlockStatsConfig `toml:"block_stats"` GasBump *GasBumpConfig `toml:"gas_bump"` ReadOnly bool `toml:"read_only"` ForceHTTP bool `toml:"force_http"` // contains filtered or unexported fields }
func ReadConfig ¶
ReadConfig reads the TOML config file from location specified by env var "SETH_CONFIG_PATH" and returns a Config struct
func (*Config) AppendPksToNetwork ¶
AppendPksToNetwork appends private keys to the network with the specified name and returns "true" if the network was updated.
func (*Config) FirstNetworkURL ¶
FirstNetworkURL returns first network URL
func (*Config) GasBumpRetries ¶
GasBumpRetries returns the number of retries for gas bumping
func (*Config) GenerateContractMapFileName ¶
GenerateContractMapFileName generates a file name for the contract map
func (*Config) GetMaxConcurrency ¶
GetMaxConcurrency returns the maximum number of concurrent transactions. Root key is excluded from the count.
func (*Config) HasMaxBumpGasPrice ¶
HasMaxBumpGasPrice returns true if the max gas price for gas bumping is set
func (*Config) IsExperimentEnabled ¶
IsExperimentEnabled returns true if the experiment is enabled
func (*Config) IsSimulatedNetwork ¶
IsSimulatedNetwork returns true if the network is simulated (i.e. Geth or Anvil)
func (*Config) ShouldSaveDeployedContractMap ¶
ShouldSaveDeployedContractMap returns true if the contract map should be saved (i.e. not a simulated network and functionality is enabled)
type ContextErrorKey ¶
type ContextErrorKey struct{}
type ContractLoader ¶
ContractLoader is a helper struct for loading contracts
func NewContractLoader ¶
func NewContractLoader[T any](client *Client) *ContractLoader[T]
NewContractLoader creates a new contract loader
func (*ContractLoader[T]) LoadContract ¶
func (cl *ContractLoader[T]) LoadContract(name string, address common.Address, abiLoadFn func() (*abi.ABI, error), wrapperInitFn func(common.Address, bind.ContractBackend) (*T, error)) (*T, error)
LoadContract loads contract by name, address, ABI loader and wrapper init function, it adds contract ABI to Seth Contract Store and address to Contract Map. Thanks to that we can easily trace and debug interactions with the contract. Signatures of functions passed to this method were chosen to conform to Geth wrappers' GetAbi() and NewXXXContract() functions.
type ContractMap ¶
type ContractMap struct {
// contains filtered or unexported fields
}
func NewContractMap ¶
func NewContractMap(contracts map[string]string) ContractMap
func NewEmptyContractMap ¶
func NewEmptyContractMap() ContractMap
func (ContractMap) AddContract ¶
func (c ContractMap) AddContract(addr, name string)
func (ContractMap) GetContractAddress ¶
func (c ContractMap) GetContractAddress(addr string) string
func (ContractMap) GetContractMap ¶
func (c ContractMap) GetContractMap() map[string]string
func (ContractMap) GetContractName ¶
func (c ContractMap) GetContractName(addr string) string
func (ContractMap) IsKnownAddress ¶
func (c ContractMap) IsKnownAddress(addr string) bool
func (ContractMap) Size ¶
func (c ContractMap) Size() int
type ContractStore ¶
type ContractStore struct { ABIs ABIStore BINs map[string][]byte // contains filtered or unexported fields }
ContractStore contains all ABIs that are used in decoding. It might also contain contract bytecode for deployment
func NewContractStore ¶
func NewContractStore(abiPath, binPath string, gethWrappersPaths []string) (*ContractStore, error)
NewContractStore creates a new Contract store
func (*ContractStore) AddBIN ¶
func (c *ContractStore) AddBIN(name string, bin []byte)
func (*ContractStore) GetAllABIs ¶ added in v1.50.8
func (c *ContractStore) GetAllABIs() []*abi.ABI
type DecodableLog ¶
type DecodedCall ¶
type DecodedCall struct { CommonData FromAddress string `json:"from_address,omitempty"` ToAddress string `json:"to_address,omitempty"` From string `json:"from,omitempty"` To string `json:"to,omitempty"` Events []DecodedCommonLog `json:"events,omitempty"` Comment string `json:"comment,omitempty"` Value int64 `json:"value,omitempty"` GasLimit uint64 `json:"gas_limit,omitempty"` GasUsed uint64 `json:"gas_used,omitempty"` }
DecodedCall decoded call
type DecodedCommonLog ¶
type DecodedCommonLog struct { Signature string `json:"signature"` Address common.Address `json:"address"` EventData map[string]interface{} `json:"event_data"` Topics []string `json:"topics,omitempty"` }
func (*DecodedCommonLog) MergeEventData ¶
func (d *DecodedCommonLog) MergeEventData(newEventData map[string]interface{})
MergeEventData merges new event data into the existing EventData map in the DecodedTransactionLog.
type DecodedTransaction ¶
type DecodedTransaction struct { CommonData Index uint `json:"index"` Hash string `json:"hash,omitempty"` Protected bool `json:"protected,omitempty"` Transaction *types.Transaction `json:"transaction,omitempty"` Receipt *types.Receipt `json:"receipt,omitempty"` Events []DecodedTransactionLog `json:"events,omitempty"` }
DecodedTransaction decoded transaction
type DecodedTransactionLog ¶
type DecodedTransactionLog struct { DecodedCommonLog BlockNumber uint64 `json:"block_number"` Index uint `json:"index"` TXHash string `json:"hash"` TXIndex uint `json:"tx_index"` Removed bool `json:"removed"` FileTag string `json:"file_tag,omitempty"` }
DecodedTransactionLog decoded Solidity log(event)
func (*DecodedTransactionLog) MergeEventData ¶
func (d *DecodedTransactionLog) MergeEventData(newEventData map[string]interface{})
type DeploymentData ¶
type DeploymentData struct { Address common.Address Transaction *types.Transaction BoundContract *bind.BoundContract }
type Duration ¶
Duration is a non-negative time duration.
func MustMakeDuration ¶
func ParseDuration ¶
func (Duration) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (Duration) MarshalText ¶
MarshalText implements the text.Marshaler interface.
func (Duration) String ¶
String returns a string representing the duration in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*Duration) UnmarshalText ¶
UnmarshalText implements the text.Unmarshaler interface.
type FundingDetails ¶
type FundingDetails struct { RootBalance *big.Int TotalFee *big.Int FreeBalance *big.Int AddrFunding *big.Int NetworkTransferFee int64 }
FundingDetails funding details about shares we put into test keys
type GasBumpConfig ¶
type GasBumpConfig struct { Retries uint `toml:"retries"` MaxGasPrice int64 `toml:"max_gas_price"` StrategyFn GasBumpStrategyFn `toml:"-"` }
type GasBumpStrategyFn ¶
GasBumpStrategyFn is a function that returns a new gas price based on the previous one
type GasEstimationRequest ¶
type GasEstimations ¶
type GasEstimator ¶
GasEstimator estimates gas prices
func NewGasEstimator ¶
func NewGasEstimator(c *Client) *GasEstimator
NewGasEstimator creates a new gas estimator
func (*GasEstimator) Stats ¶
func (m *GasEstimator) Stats(fromNumber uint64, priorityPerc float64) (GasSuggestions, error)
Stats calculates gas price and tip cap suggestions based on historical fee data over a specified number of blocks. It computes quantiles for base fees and tip caps and provides suggested gas price and tip cap values.
type GasPercentiles ¶
type GasPercentiles struct { Max float64 Perc99 float64 Perc75 float64 Perc50 float64 Perc25 float64 }
GasPercentiles contains gas percentiles
type GasSuggestions ¶
type GasSuggestions struct { GasPrice *GasPercentiles TipCap *GasPercentiles SuggestedGasPrice *big.Int SuggestedGasTipCap *big.Int }
type LFUHeaderCache ¶
type LFUHeaderCache struct {
// contains filtered or unexported fields
}
LFUHeaderCache is a Least Frequently Used header cache
func NewLFUBlockCache ¶
func NewLFUBlockCache(capacity uint64) *LFUHeaderCache
NewLFUBlockCache creates a new LFU cache with the given capacity.
type LogWithEventData ¶
type LogWithEventData interface {
MergeEventData(map[string]interface{})
}
type LoggingTransport ¶
type LoggingTransport struct {
Transport http.RoundTripper
}
LoggingTransport is a custom transport to log requests and responses
type Network ¶
type Network struct { Name string `toml:"name"` URLs []string `toml:"urls_secret"` ChainID uint64 `toml:"chain_id"` EIP1559DynamicFees bool `toml:"eip_1559_dynamic_fees"` GasPrice int64 `toml:"gas_price"` GasFeeCap int64 `toml:"gas_fee_cap"` GasTipCap int64 `toml:"gas_tip_cap"` GasLimit uint64 `toml:"gas_limit"` TxnTimeout *Duration `toml:"transaction_timeout"` DialTimeout *Duration `toml:"dial_timeout"` TransferGasFee int64 `toml:"transfer_gas_fee"` PrivateKeys []string `toml:"private_keys_secret"` GasPriceEstimationEnabled bool `toml:"gas_price_estimation_enabled"` GasPriceEstimationBlocks uint64 `toml:"gas_price_estimation_blocks"` GasPriceEstimationTxPriority string `toml:"gas_price_estimation_tx_priority"` }
type NonceManager ¶
type NonceManager struct { *sync.Mutex Client *Client SyncTimeout time.Duration SyncedKeys chan *KeyNonce Addresses []common.Address PrivateKeys []*ecdsa.PrivateKey Nonces map[common.Address]int64 // contains filtered or unexported fields }
NonceManager tracks nonce for each address
func NewNonceManager ¶
func NewNonceManager(cfg *Config, addrs []common.Address, privKeys []*ecdsa.PrivateKey) (*NonceManager, error)
NewNonceManager creates a new nonce manager that tracks nonce for each address
func (*NonceManager) NextNonce ¶
func (m *NonceManager) NextNonce(addr common.Address) *big.Int
NextNonce returns new nonce for addr this method is external for module testing, but you should not use it since handling nonces on the client is unpredictable
func (*NonceManager) UpdateNonces ¶
func (m *NonceManager) UpdateNonces() error
UpdateNonces syncs nonces for addresses
type NonceManagerCfg ¶
type NonceStatus ¶
type Pragma ¶
Pragma represents the version of the Solidity compiler used to compile the contract
func DecodePragmaVersion ¶
DecodePragmaVersion extracts the pragma version from the bytecode or returns an error if it's not found or can't be decoded. Based on https://www.rareskills.io/post/solidity-metadata
type TXCallTraceOutput ¶
func (*TXCallTraceOutput) AsCall ¶
func (t *TXCallTraceOutput) AsCall() Call
type Trace ¶
type Trace struct { TxHash string FourByte map[string]*TXFourByteMetadataOutput CallTrace *TXCallTraceOutput OpCodesTrace map[string]interface{} }
type TraceLog ¶
type Tracer ¶
type Tracer struct { Cfg *Config Addresses []common.Address ContractStore *ContractStore ContractAddressToNameMap ContractMap ABIFinder *ABIFinder // contains filtered or unexported fields }
func NewTracer ¶
func NewTracer(cs *ContractStore, abiFinder *ABIFinder, cfg *Config, contractAddressToNameMap ContractMap, addresses []common.Address) (*Tracer, error)
func (*Tracer) AddDecodedCalls ¶
func (t *Tracer) AddDecodedCalls(txHash string, calls []*DecodedCall)
func (*Tracer) DecodeTrace ¶
DecodeTrace decodes the trace of a transaction including all subcalls. It returns a list of decoded calls. Depending on the config it also saves the decoded calls as JSON files.
func (*Tracer) GetAllDecodedCalls ¶
func (t *Tracer) GetAllDecodedCalls() map[string][]*DecodedCall
func (*Tracer) GetDecodedCalls ¶
func (t *Tracer) GetDecodedCalls(txHash string) []*DecodedCall
func (*Tracer) PrintTXTrace ¶
func (*Tracer) SaveDecodedCallsAsJson ¶
func (*Tracer) TraceGethTX ¶
func (t *Tracer) TraceGethTX(txHash string) ([]*DecodedCall, error)
type TransactOpt ¶
type TransactOpt func(o *bind.TransactOpts)
TransactOpt is a wrapper for bind.TransactOpts
func WithFrom ¶ added in v1.50.4
func WithFrom(fromAddress common.Address) TransactOpt
WithFrom sets from option for bind.TransactOpts
func WithGasFeeCap ¶
func WithGasFeeCap(gasFeeCap *big.Int) TransactOpt
WithGasFeeCap sets gasFeeCap option for bind.TransactOpts
func WithGasLimit ¶
func WithGasLimit(gasLimit uint64) TransactOpt
WithGasLimit sets gasLimit option for bind.TransactOpts
func WithGasPrice ¶
func WithGasPrice(gasPrice *big.Int) TransactOpt
WithGasPrice sets gasPrice option for bind.TransactOpts
func WithGasTipCap ¶
func WithGasTipCap(gasTipCap *big.Int) TransactOpt
WithGasTipCap sets gasTipCap option for bind.TransactOpts
func WithNoSend ¶
func WithNoSend(noSend bool) TransactOpt
WithNoSend sets noSend option for bind.TransactOpts
func WithNonce ¶
func WithNonce(nonce *big.Int) TransactOpt
WithNonce sets nonce option for bind.TransactOpts
func WithSignerFn ¶ added in v1.50.4
func WithSignerFn(signerFn bind.SignerFn) TransactOpt
WithSignerFn sets signerFn option for bind.TransactOpts
func WithValue ¶
func WithValue(value *big.Int) TransactOpt
WithValue sets value option for bind.TransactOpts
type TransactionLog ¶
func (TransactionLog) GetData ¶
func (t TransactionLog) GetData() []byte
func (TransactionLog) GetTopics ¶
func (t TransactionLog) GetTopics() []common.Hash