Documentation ¶
Overview ¶
Package config provides a configuration file for customizing circuit-breaker functionality
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ExampleConfig is primarily used to provide a template for generating the config file ExampleConfig = &Config{ InfuraAPIKey: "INFURA-KEY", Network: "mainnet", MultiCallAddress: "0x3067b1b7bf344027c7439509fbdf344eb25f5991", Logger: Logger{ Path: "circuit-breaker.log", Debug: true, Dev: true, }, Pools: []Pool{ { Name: "DEFI5", ContractAddress: "0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41", SpotPriceBreakPercentage: 10, SupplyBreakPercentage: 5, }, { Name: "CC10", ContractAddress: "0x17ac188e09a7890a1844e5e65471fe8b0ccfadf3", SpotPriceBreakPercentage: 11, SupplyBreakPercentage: 6, }, }, Database: Database{ Type: "sqlite", Host: "localhost", Port: "5432", User: "user", Pass: "pass", DBName: "circuit-breaker", DBPath: "", SSLModeDisable: false, }, Alerts: Alerts{ Twilio: Twilio{ SID: "CHANGEME-SID", AuthToken: "CHANGEME-AT", From: "CHANEME-FROM", Recipients: []string{"RECIPIENT-1"}, }, }, Profiler: Profiler{ Enable: false, EnableStatsViz: false, Address: "localhost:6060", }, EthereumAccount: EthereumAccount{ Mode: "privatekey", KeyFilePath: "CHANGEME-PATH", KeyFilePassword: "CHANGEME-PASS", PrivateKey: "CHANGEME-PK", GasPrice: GasPrice{ MinimumGwei: ToWei("100.0", 9).String(), Multiplier: "3", }, }, } )
Functions ¶
func LoggerFromConfig ¶
LoggerFromConfig returns a logger from our config
Types ¶
type Alerts ¶
type Alerts struct {
Twilio `yaml:"twilio"`
}
Alerts allow configuration of various cirucit breaker alert capabilities currently only supporting twilio sms
type Config ¶
type Config struct { InfuraAPIKey string `yaml:"infura_api_key"` Network string `yaml:"network"` MultiCallAddress string `yaml:"multi_call_address"` Pools []Pool `yaml:"pools"` Database `yaml:"database"` Logger `yaml:"logger"` Alerts `yaml:"alerts"` Profiler `yaml:"profiler"` // provides control over ethereum accounts used for tranaction signing EthereumAccount `yaml:"ethereum_account"` }
Config wraps all configurable variables
type Database ¶
type Database struct { Type string `yaml:"type"` // sqlite or postgres, if sqlite all other options except DBName are ignored Host string `yaml:"host"` Port string `yaml:"port"` User string `yaml:"user"` Pass string `yaml:"pass"` DBName string `yaml:"db_name"` DBPath string `yaml:"db_path"` SSLModeDisable bool `yaml:"ssl_mode_disable"` }
Database provides configuration over our database connection
type EthereumAccount ¶
type EthereumAccount struct { // Mode specifies the ethereum account mode to use // currently supported values: keyfile, privatekey Mode string `yaml:"mode"` KeyFilePath string `yaml:"key_file_path"` KeyFilePassword string `yaml:"key_file_password"` PrivateKey string `yaml:"private_key"` GasPrice `yaml:"gas_price"` }
EthereumAccount provides configuration over the account used to sign transactions
type GasPrice ¶ added in v0.0.4
type GasPrice struct { // reports the minimum amount of gwei we will spend // if the gas price oracle from go-ethereum reports less than this // we override the gas price to this MinimumGwei string `yaml:"minimum_gwei"` // Multiplier controls the gas price multiplier // whatever the minimum gwei, or the value reported by the gasprice oracle // we multiply it by the value specified here. It defaults to three and should only // be changed with care as decreasing the multiplier could result in failure to get // next block transaction inclusion Multiplier string `yaml:"multiplier"` }
GasPrice controls how we specify gas prices for sending transactions
type Logger ¶
type Logger struct { Path string `yaml:"path"` Debug bool `yaml:"debug"` Dev bool `yaml:"dev"` FileOnly bool `yaml:"file_only"` Fields map[string]interface{} `yaml:"fields"` }
Logger provides configuration over zap logger
type Pool ¶
type Pool struct { Name string `yaml:"name"` ContractAddress string `yaml:"contract_address"` // the spot price fluctuation percent at which we should break a circuit SpotPriceBreakPercentage float64 `yaml:"spot_price_break_percentage"` // the total supply fluctation percent at which we should break a circuit SupplyBreakPercentage float64 `yaml:"supply_break_percentage"` }
Pool provides configuration information for a given index pool
type Profiler ¶
type Profiler struct { // enables the basic net/http/pprof server Enable bool `yaml:"enable"` // enables optional stats visualization (github.com/arl/statsviz) EnableStatsViz bool `yaml:"enable_statsviz"` // address to expose pprof handlers on Address string `yaml:"address"` }
Profiler configures golang profiler tooling
Click to show internal directories.
Click to hide internal directories.