Documentation ¶
Overview ¶
Package config contains the config for the Scribe
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAddressLength = errors.New("invalid address length")
ErrAddressLength indicates that an invalid address length is found.
var ErrDuplicateAddress = errors.New("duplicate address")
ErrDuplicateAddress indicates that a duplicate address is found.
var ErrDuplicateChainID = errors.New("duplicate chain id")
ErrDuplicateChainID indicates that a duplicate chain ID is found.
var ErrInvalidChainID = errors.New("invalid chain id")
ErrInvalidChainID indicates that the chain ID is invalid.
var ErrRequiredField = errors.New("field is required")
ErrRequiredField indicates that a required field is missing.
Functions ¶
func GenerateConfig ¶ added in v0.0.26
func GenerateConfig(ctx context.Context, omniRPCUrl, deployPath string, requiredConfirmations uint32, outputPath string, skippedChainIDS []int, cg ClientGenerator) error
GenerateConfig generates a config using a hardhat deployment and scribe. this requires scribe to be live.
Types ¶
type ChainConfig ¶
type ChainConfig struct { // ChainID is the ID of the chain. ChainID uint32 `yaml:"chain_id"` // RequiredConfirmations is the number of confirmations required for a block to be finalized. RequiredConfirmations uint32 `yaml:"required_confirmations"` // Contracts stores all the contract information for the chain. Contracts ContractConfigs `yaml:"contracts"` // BlockTimeChunkCount is the number of chunks (goroutines) to process at a time while backfilling blocktimes. BlockTimeChunkCount uint64 `yaml:"block_time_chunk_count"` // BlockTimeChunkSize is the number of blocks to process per chunk (goroutine) while backfilling blocktimes. BlockTimeChunkSize uint64 `yaml:"block_time_chunk_size"` // ContractSubChunkSize is the number of blocks to request for in each get logs request in the batch request. ContractSubChunkSize int `yaml:"contract_sub_chunk_size"` // ContractChunkSize is the number of blocks to process per chunk while backfilling contracts. ContractChunkSize int `yaml:"contract_chunk_size"` // StoreConcurrency is the number of goroutines to use when storing data. StoreConcurrency int `yaml:"store_concurrency"` // storeConcurrencyThreshold is the max number of block from head in which concurrent store is allowed. StoreConcurrencyThreshold uint64 `yaml:"store_concurrency_threshold"` }
ChainConfig defines the config for a specific chain.
type ClientGenerator ¶ added in v0.0.26
type ClientGenerator func(ctx context.Context, rawURL string) (ReceiptClient, error)
ClientGenerator generates an ethclient from a context and a url, this is used so we can override ethclient.DialContext for testing.
type Config ¶
type Config struct { // Chains stores all chain information Chains ChainConfigs `yaml:"chains"` // RefreshRate is the rate at which the scribe will refresh the last block height in seconds. RefreshRate uint `yaml:"refresh_rate"` // RPCURL is the url of the omnirpc. RPCURL string `yaml:"rpc_url"` // ConfirmationRefreshRate is the rate at which the scribe will refresh the last confirmed block height in seconds. ConfirmationRefreshRate int64 `yaml:"confirmation_refresh_rate"` }
Config is used to configure a Scribe instance and information about chains and contracts.
func DecodeConfig ¶
DecodeConfig parses in a config from a file.
type ContractConfig ¶
type ContractConfig struct { // Address is the address of the contract. Address string `yaml:"address"` // StartBlock is the block number to start indexing events from. StartBlock uint64 `yaml:"start_block"` // RefreshRate is the rate at which the contract is refreshed. RefreshRate uint64 `yaml:"refresh_rate"` }
ContractConfig defines the config for a specific contract.
type ContractConfigs ¶
type ContractConfigs []ContractConfig
ContractConfigs contains a list of ContractConfigs.
type DBConfig ¶
type DBConfig struct { // Type of the database to use for sql. Type string `toml:"Type"` // ConnString is the connection string used for mysql ConnString string `toml:"ConnString"` }
DBConfig is used for configuring the.
type ReceiptClient ¶ added in v0.0.26
type ReceiptClient interface { // TransactionReceipt returns the receipt of a mined transaction. Note that the // transaction may not be included in the current canonical chain even if a receipt // exists. // TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error) }
ReceiptClient is an client that implements receipt fetching.
func DefaultClientGenerator ¶ added in v0.0.26
func DefaultClientGenerator(ctx context.Context, rawURL string) (ReceiptClient, error)
DefaultClientGenerator generates the default ethclient.