serverconfig

package
v0.18.7 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package serverconfig is the config loader for the server

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"`
	/// GetLogsRange is the max number of blocks to request in a single getLogs request.
	GetLogsRange uint64 `yaml:"get_logs_range"`
	// GetLogsBatchAmount is the number of getLogs requests to include in a single batch request.
	GetLogsBatchAmount uint64 `yaml:"get_logs_batch_amount"`
	// BlockTime is the block time of the chain.
	BlockTime uint64 `yaml:"avg_block_time"`
	// Swaps are the addresses of the swaps on the chain for parsing token address logs.
	Swaps []string `yaml:"swaps"`
	// Chains stores the chain configurations.
	Contracts ContractsConfig `yaml:"contracts"`
}

ChainConfig is the config for each chain in the server config.

func (*ChainConfig) IsValid

func (c *ChainConfig) IsValid() error

IsValid checks if the entered ChainConfig is valid.

type Config

type Config struct {
	// HTTPPort is the http port for the api
	HTTPPort uint16 `yaml:"http_port"`
	// DBAddress is the address of the database
	DBAddress string `yaml:"db_address"`
	// HydrateCache is a flag for enabling cache hydration.
	HydrateCache bool `yaml:"hydrate_cache"`
	// 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"`
	// SwapTopicHash is the hash of the swap topic.
	SwapTopicHash string `yaml:"swap_topic_hash"`
	// Chains stores the chain configurations.
	Chains map[uint32]ChainConfig `yaml:"chains"`
}

Config is used to configure the explorer server.

func DecodeServerConfig

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

DecodeServerConfig parses in a config from a file.

func (*Config) IsValid

func (c *Config) IsValid() error

IsValid makes sure the config is valid.

type ContractsConfig

type ContractsConfig struct {
	// CCTP is the address of the cctp contract
	CCTP string `yaml:"cctp"`
	// Bridge is the URL of the Scribe server.
	Bridge string `yaml:"bridge"`
	// RFQ is the address of the rfq contract
	RFQ string `yaml:"rfq"`
}

ContractsConfig is config for each contract in the server config.

func (ContractsConfig) IsValid

func (c ContractsConfig) IsValid() error

IsValid checks if the entered ContractsConfig is valid.

Jump to

Keyboard shortcuts

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