indexerconfig

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package indexerconfig is the config loader for the indexer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	// ChainID is the ID of the chain.
	ChainID uint32 `yaml:"chain_id"`
	// RPCURL is the RPC of the chain.
	RPCURL string `yaml:"rpc_url"`
	// FetchBlockIncrement is the number of blocks to fetch at a time.
	FetchBlockIncrement uint64 `yaml:"fetch_block_increment"`
	// MaxGoroutines is the maximum number of goroutines that can be spawned.
	MaxGoroutines int `yaml:"max_goroutines"`
	// Contracts are the contracts.
	Contracts []ContractConfig `yaml:"contracts"`
}

ChainConfig is the configuration for a chain.

func (ChainConfig) IsValid

func (c ChainConfig) IsValid() error

IsValid validates the chain config.

type Config

type Config struct {
	// DefaultRefreshRate is the default rate at which data is refreshed.
	DefaultRefreshRate int `yaml:"default_refresh_rate"`
	// ScribeURL is the URL of the Scribe server.
	ScribeURL string `yaml:"scribe_url"`
	// RPCURL is the URL of the RPC server.
	RPCURL string `yaml:"rpc_url"`
	// BridgeConfigAddress is the address of BridgeConfig contract.
	BridgeConfigAddress string `yaml:"bridge_config_address"`
	// BridgeConfigChainID is the ChainID of BridgeConfig contract.
	BridgeConfigChainID uint32 `yaml:"bridge_config_chain_id"`
	// Chains stores the chain configurations.
	Chains []ChainConfig `yaml:"chains"`
}

Config is used to configure the explorer's data consumption.

func DecodeConfig

func DecodeConfig(filePath string) (cfg Config, err error)

DecodeConfig parses in a config from a file.

func (*Config) IsValid

func (c *Config) IsValid() error

IsValid makes sure the config is valid. This is done by calling IsValid() on each submodule. If any method returns an error that is returned here and the entirety of IsValid returns false. Any warnings are logged by the submodules respective loggers.

type ContractConfig

type ContractConfig struct {
	// ContractType is the type of contract.
	ContractType string `yaml:"contract_type"`
	// Addresses are the addresses of the contracts
	Address string `yaml:"address"`
	// StartBlock is where to start backfilling this address from.
	StartBlock int64 `yaml:"start_block"`
}

ContractConfig is the configuration for a contract.

func (ContractConfig) IsValid

func (c ContractConfig) IsValid() error

IsValid validates the chain config.

type ContractType

type ContractType int

ContractType is the type of contract specified by the config and used for selecting the correct parser.

const (
	// BridgeContractType is the ContractType for the bridge contract.
	BridgeContractType ContractType = iota
	// SwapContractType is the ContractType for the swap contract.
	SwapContractType
	// MessageBusContractType is the ContractType for the message bus contract.
	MessageBusContractType
	// MetaSwapContractType is the ContractType for the meta swap contract.
	MetaSwapContractType
	// CCTPContractType is the ContractType for the cctp contract.
	CCTPContractType
	// RFQContractType is the ContractType for the rfq contract.
	RFQContractType
)

func ContractTypeFromString

func ContractTypeFromString(s string) (ContractType, error)

ContractTypeFromString converts a string (intended to be from parsed config) into the ContractType type.

func (ContractType) String

func (c ContractType) String() string

Jump to

Keyboard shortcuts

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