Documentation ¶
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{ EthEndpoint: "CHANGEME-ETH", BscEndpoint: "wss://bsc-ws-node.nariox.org:443", ControlAPI: "0.0.0.0:6969", MinBuyPriceUSD: 10, Database: Database{ Type: "sqlite", Host: "localhost", Port: "5432", User: "user", Pass: "pass", DBName: "unipan", DBPath: "/changeme", SSLModeDisable: false, }, Logger: Logger{ Path: "unipan-bot.log", Debug: true, Dev: true, }, EthereumAccount: EthereumAccount{ Mode: "privatekey", KeyFilePath: "CHANGEME-PATH", KeyFilePassword: "CHANGEME-PASS", PrivateKey: "CHANGEME-PK", GasPrice: GasPrice{ MinimumGwei: ToWei("100.0", 9).String(), Multiplier: "3", }, }, Uniswap: Uniswap{ WETHAddress: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", }, PancakeSwap: PancakeSwap{ WBNBAddress: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", }, } )
Functions ¶
func LoggerFromConfig ¶
LoggerFromConfig returns a logger from our config
Types ¶
type Config ¶
type Config struct { // address of the ethereum rpc endpoint EthEndpoint string `yaml:"eth_endpoint"` // address of the bsc rpc endpoint BscEndpoint string `yaml:"bsc_endpoint"` // ControlAPI defines api endpoint used to control unipan ControlAPI string `yaml:"control_api"` // defines the minimum buy price in terms of USD MinBuyPriceUSD float64 `yaml:"min_buy_price_usd"` Database `yaml:"database"` Logger `yaml:"logger"` // provides control over ethereum accounts used for tranaction signing EthereumAccount `yaml:"ethereum_account"` Uniswap `yaml:"uniswap"` PancakeSwap `yaml:"pancakeswap"` }
Config bundles together configuration information
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 ¶
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 PancakeSwap ¶
type PancakeSwap struct {
WBNBAddress string `yaml:"wbnb_address"`
}
PancakeSwap defines configuration for the pancake swap portion of the bot
Click to show internal directories.
Click to hide internal directories.