Documentation ¶
Overview ¶
Package config handles config data decoded from config.yaml for the explorer service.
Index ¶
Constants ¶
const ( // BridgeContractType is the type of a bridge contract. BridgeContractType = "bridge" // SwapContractType is the type of the swap contract. SwapContractType = "swap" // MessageBusContractType is the type of a message bus contract. MessageBusContractType = "messagebus" // MetaSwapContractType is the type of a meta swap contract. MetaSwapContractType = "metaswap" // CCTPContractType is the type of a CCTP contract. CCTPContractType = "cctp" )
TODO: these should be put into the contracts themselves and implement a custom type.
Variables ¶
var ErrAddressLength = errors.New("invalid address length")
ErrAddressLength indicates that an invalid address length is found.
var ErrRequiredField = errors.New("field is required")
ErrRequiredField indicates that a required field is missing.
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶ added in v0.0.11
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 ContractConfigs `yaml:"contracts"` }
ChainConfig is the configuration for a chain.
func (ChainConfig) IsValid ¶ added in v0.0.11
func (c ChainConfig) IsValid() (ok bool, err error)
IsValid validates the chain config.
type ChainConfigs ¶ added in v0.0.11
type ChainConfigs []ChainConfig
ChainConfigs contains an array fo ChainConfigs.
func (ChainConfigs) IsValid ¶ added in v0.0.11
func (c ChainConfigs) IsValid() (ok bool, err error)
IsValid validates the chain config by asserting no two chains appear twice.
type Config ¶
type Config struct { // RefreshRate is the rate at which the explorer will refresh the last block height in seconds. RefreshRate int `yaml:"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 ChainConfigs `yaml:"chains"` }
Config is used to configure the explorer's data consumption.
func DecodeConfig ¶
DecodeConfig parses in a config from a file.
type ContractConfig ¶ added in v0.0.11
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 ¶ added in v0.0.11
func (c ContractConfig) IsValid() (ok bool, err error)
IsValid validates the chain config.
type ContractConfigs ¶ added in v0.0.11
type ContractConfigs []ContractConfig
ContractConfigs contains an array fo ChainConfigs.
func (ContractConfigs) IsValid ¶ added in v0.0.11
func (c ContractConfigs) IsValid() (ok bool, err error)
IsValid validates the contract config by asserting no two contracts appear twice.