removed the fucking vendor files

This commit is contained in:
Krypto Kajun
2025-09-16 11:05:47 -05:00
parent 42244ab42b
commit bccc122a85
1451 changed files with 48752 additions and 472999 deletions

View File

@@ -6,17 +6,21 @@ import (
"regexp"
"strconv"
"strings"
"time"
"gopkg.in/yaml.v3"
)
// Config represents the application configuration
type Config struct {
Arbitrum ArbitrumConfig `yaml:"arbitrum"`
Bot BotConfig `yaml:"bot"`
Uniswap UniswapConfig `yaml:"uniswap"`
Log LogConfig `yaml:"log"`
Database DatabaseConfig `yaml:"database"`
Arbitrum ArbitrumConfig `yaml:"arbitrum"`
Bot BotConfig `yaml:"bot"`
Uniswap UniswapConfig `yaml:"uniswap"`
Log LogConfig `yaml:"log"`
Database DatabaseConfig `yaml:"database"`
Ethereum EthereumConfig `yaml:"ethereum"`
Contracts ContractsConfig `yaml:"contracts"`
Arbitrage ArbitrageConfig `yaml:"arbitrage"`
}
// ArbitrumConfig represents the Arbitrum node configuration
@@ -111,6 +115,28 @@ type DatabaseConfig struct {
MaxIdleConnections int `yaml:"max_idle_connections"`
}
// EthereumConfig represents the Ethereum account configuration
type EthereumConfig struct {
// Private key for transaction signing
PrivateKey string `yaml:"private_key"`
// Account address
AccountAddress string `yaml:"account_address"`
// Gas price multiplier (for faster transactions)
GasPriceMultiplier float64 `yaml:"gas_price_multiplier"`
}
// ContractsConfig represents the smart contract addresses
type ContractsConfig struct {
// Arbitrage executor contract address
ArbitrageExecutor string `yaml:"arbitrage_executor"`
// Flash swapper contract address
FlashSwapper string `yaml:"flash_swapper"`
// Authorized caller addresses
AuthorizedCallers []string `yaml:"authorized_callers"`
// Authorized DEX addresses
AuthorizedDEXes []string `yaml:"authorized_dexes"`
}
// Load loads the configuration from a file
func Load(filename string) (*Config, error) {
// Read the config file
@@ -173,6 +199,25 @@ func (c *Config) OverrideWithEnv() {
c.Arbitrum.WSEndpoint = wsEndpoint
}
// Override fallback endpoints from environment
if fallbackEndpoints := os.Getenv("ARBITRUM_FALLBACK_ENDPOINTS"); fallbackEndpoints != "" {
endpoints := strings.Split(fallbackEndpoints, ",")
c.Arbitrum.FallbackEndpoints = make([]EndpointConfig, 0, len(endpoints))
for _, endpoint := range endpoints {
endpoint = strings.TrimSpace(endpoint)
if endpoint != "" {
c.Arbitrum.FallbackEndpoints = append(c.Arbitrum.FallbackEndpoints, EndpointConfig{
URL: endpoint,
RateLimit: RateLimitConfig{
RequestsPerSecond: 100,
MaxConcurrent: 10,
Burst: 20,
},
})
}
}
}
// Override rate limit settings
if rps := os.Getenv("RPC_REQUESTS_PER_SECOND"); rps != "" {
if val, err := strconv.Atoi(rps); err == nil {
@@ -198,4 +243,85 @@ func (c *Config) OverrideWithEnv() {
c.Bot.ChannelBufferSize = val
}
}
// Override Ethereum settings
if privateKey := os.Getenv("ETHEREUM_PRIVATE_KEY"); privateKey != "" {
c.Ethereum.PrivateKey = privateKey
}
if accountAddress := os.Getenv("ETHEREUM_ACCOUNT_ADDRESS"); accountAddress != "" {
c.Ethereum.AccountAddress = accountAddress
}
if gasPriceMultiplier := os.Getenv("ETHEREUM_GAS_PRICE_MULTIPLIER"); gasPriceMultiplier != "" {
if val, err := strconv.ParseFloat(gasPriceMultiplier, 64); err == nil {
c.Ethereum.GasPriceMultiplier = val
}
}
// Override contract addresses
if arbitrageExecutor := os.Getenv("CONTRACT_ARBITRAGE_EXECUTOR"); arbitrageExecutor != "" {
c.Contracts.ArbitrageExecutor = arbitrageExecutor
}
if flashSwapper := os.Getenv("CONTRACT_FLASH_SWAPPER"); flashSwapper != "" {
c.Contracts.FlashSwapper = flashSwapper
}
}
// ArbitrageConfig represents the arbitrage service configuration
type ArbitrageConfig struct {
// Enable or disable arbitrage service
Enabled bool `yaml:"enabled"`
// Contract addresses
ArbitrageContractAddress string `yaml:"arbitrage_contract_address"`
FlashSwapContractAddress string `yaml:"flash_swap_contract_address"`
// Profitability settings
MinProfitWei int64 `yaml:"min_profit_wei"`
MinROIPercent float64 `yaml:"min_roi_percent"`
MinSignificantSwapSize int64 `yaml:"min_significant_swap_size"`
SlippageTolerance float64 `yaml:"slippage_tolerance"`
// Scanning configuration
MinScanAmountWei int64 `yaml:"min_scan_amount_wei"`
MaxScanAmountWei int64 `yaml:"max_scan_amount_wei"`
// Gas configuration
MaxGasPriceWei int64 `yaml:"max_gas_price_wei"`
// Execution limits
MaxConcurrentExecutions int `yaml:"max_concurrent_executions"`
MaxOpportunitiesPerEvent int `yaml:"max_opportunities_per_event"`
// Timing settings
OpportunityTTL time.Duration `yaml:"opportunity_ttl"`
MaxPathAge time.Duration `yaml:"max_path_age"`
StatsUpdateInterval time.Duration `yaml:"stats_update_interval"`
// Pool discovery configuration
PoolDiscoveryConfig PoolDiscoveryConfig `yaml:"pool_discovery"`
}
// PoolDiscoveryConfig represents pool discovery service configuration
type PoolDiscoveryConfig struct {
// Enable or disable pool discovery
Enabled bool `yaml:"enabled"`
// Block range to scan for new pools
BlockRange uint64 `yaml:"block_range"`
// Polling interval for new pools
PollingInterval time.Duration `yaml:"polling_interval"`
// DEX factory addresses to monitor
FactoryAddresses []string `yaml:"factory_addresses"`
// Minimum liquidity threshold for pools
MinLiquidityWei int64 `yaml:"min_liquidity_wei"`
// Cache configuration
CacheSize int `yaml:"cache_size"`
CacheTTL time.Duration `yaml:"cache_ttl"`
}

View File

@@ -0,0 +1,86 @@
package tokens
import (
"github.com/ethereum/go-ethereum/common"
)
// ArbitrumTokens contains the addresses of popular tokens on Arbitrum
type ArbitrumTokens struct {
WETH common.Address
USDC common.Address
USDT common.Address
ARB common.Address
WBTC common.Address
DAI common.Address
LINK common.Address
UNI common.Address
GMX common.Address
GRT common.Address
}
// GetArbitrumTokens returns the addresses of popular tokens on Arbitrum
func GetArbitrumTokens() *ArbitrumTokens {
return &ArbitrumTokens{
WETH: common.HexToAddress("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"), // Wrapped Ether
USDC: common.HexToAddress("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), // USD Coin (bridged)
USDT: common.HexToAddress("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"), // Tether USD
ARB: common.HexToAddress("0x912CE59144191C1204E64559FE8253a0e49E6548"), // Arbitrum Token
WBTC: common.HexToAddress("0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f"), // Wrapped Bitcoin
DAI: common.HexToAddress("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"), // Dai Stablecoin
LINK: common.HexToAddress("0xf97f4df75117a78c1A5a0DBb814Af92458539FB4"), // ChainLink Token
UNI: common.HexToAddress("0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0"), // Uniswap
GMX: common.HexToAddress("0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a"), // GMX
GRT: common.HexToAddress("0x9623063377AD1B27544C965cCd7342f7EA7e88C7"), // The Graph
}
}
// GetTriangularPaths returns common triangular arbitrage paths on Arbitrum
func GetTriangularPaths() []TriangularPath {
tokens := GetArbitrumTokens()
return []TriangularPath{
{
Name: "USDC-WETH-WBTC-USDC",
Tokens: []common.Address{tokens.USDC, tokens.WETH, tokens.WBTC},
},
{
Name: "USDC-WETH-ARB-USDC",
Tokens: []common.Address{tokens.USDC, tokens.WETH, tokens.ARB},
},
{
Name: "WETH-USDC-USDT-WETH",
Tokens: []common.Address{tokens.WETH, tokens.USDC, tokens.USDT},
},
{
Name: "USDC-DAI-USDT-USDC",
Tokens: []common.Address{tokens.USDC, tokens.DAI, tokens.USDT},
},
{
Name: "WETH-ARB-GMX-WETH",
Tokens: []common.Address{tokens.WETH, tokens.ARB, tokens.GMX},
},
{
Name: "USDC-LINK-WETH-USDC",
Tokens: []common.Address{tokens.USDC, tokens.LINK, tokens.WETH},
},
}
}
// TriangularPath represents a triangular arbitrage path
type TriangularPath struct {
Name string
Tokens []common.Address
}
// GetMostLiquidTokens returns the most liquid tokens for market scanning
func GetMostLiquidTokens() []common.Address {
tokens := GetArbitrumTokens()
return []common.Address{
tokens.WETH,
tokens.USDC,
tokens.USDT,
tokens.ARB,
tokens.WBTC,
tokens.DAI,
}
}