style: format code with gofmt

This commit is contained in:
Krypto Kajun
2025-11-08 10:37:52 -06:00
parent 8cba462024
commit ae4abc5b5c
32 changed files with 9207 additions and 5843 deletions

View File

@@ -45,20 +45,20 @@ func main() {
// Method selectors for detection
selectors := map[string][]byte{
"token0": {0x0d, 0xfe, 0x16, 0x81}, // Common to many DEXs
"token1": {0xd2, 0x12, 0x20, 0xa7}, // Correct selector for token1()
"fee": {0xdd, 0xca, 0x3f, 0x43}, // UniswapV3
"slot0": {0x38, 0x50, 0xc7, 0xbd}, // UniswapV3
"globalState": {0x13, 0xaf, 0x40, 0x35}, // Algebra
"getReserves": {0x09, 0x02, 0xf1, 0xac}, // UniswapV2
"liquidity": {0x1a, 0x68, 0x6d, 0x0f}, // UniswapV3
"factory": {0xc4, 0x5a, 0x01, 0x55}, // Common
"tickSpacing": {0xd0, 0xc9, 0x38, 0x91}, // UniswapV3
"maxLiquidityPerTick": {0x70, 0xcf, 0x75, 0x4a}, // UniswapV3
"sqrtPriceX96": {0x88, 0x5a, 0xdb, 0x02}, // Some V3 variants
"observations": {0x25, 0x2c, 0x09, 0xd7}, // UniswapV3
"feeGrowthGlobal0X128":{0xf3, 0x05, 0x83, 0x99}, // UniswapV3
"feeGrowthGlobal1X128":{0x46, 0x14, 0x16, 0x27}, // UniswapV3
"token0": {0x0d, 0xfe, 0x16, 0x81}, // Common to many DEXs
"token1": {0xd2, 0x12, 0x20, 0xa7}, // Correct selector for token1()
"fee": {0xdd, 0xca, 0x3f, 0x43}, // UniswapV3
"slot0": {0x38, 0x50, 0xc7, 0xbd}, // UniswapV3
"globalState": {0x13, 0xaf, 0x40, 0x35}, // Algebra
"getReserves": {0x09, 0x02, 0xf1, 0xac}, // UniswapV2
"liquidity": {0x1a, 0x68, 0x6d, 0x0f}, // UniswapV3
"factory": {0xc4, 0x5a, 0x01, 0x55}, // Common
"tickSpacing": {0xd0, 0xc9, 0x38, 0x91}, // UniswapV3
"maxLiquidityPerTick": {0x70, 0xcf, 0x75, 0x4a}, // UniswapV3
"sqrtPriceX96": {0x88, 0x5a, 0xdb, 0x02}, // Some V3 variants
"observations": {0x25, 0x2c, 0x09, 0xd7}, // UniswapV3
"feeGrowthGlobal0X128": {0xf3, 0x05, 0x83, 0x99}, // UniswapV3
"feeGrowthGlobal1X128": {0x46, 0x14, 0x16, 0x27}, // UniswapV3
}
fmt.Println("Testing Method Signatures:")
@@ -204,4 +204,4 @@ func main() {
fmt.Println("Slot0 data available (price and tick info)")
}
}
}
}

View File

@@ -14,11 +14,11 @@ import (
)
type BlacklistEntry struct {
Address string `json:"address"`
FailureCount int `json:"failure_count"`
LastReason string `json:"last_reason"`
FirstSeen time.Time `json:"first_seen"`
IsBlacklisted bool `json:"is_blacklisted"`
Address string `json:"address"`
FailureCount int `json:"failure_count"`
LastReason string `json:"last_reason"`
FirstSeen time.Time `json:"first_seen"`
IsBlacklisted bool `json:"is_blacklisted"`
}
func main() {
@@ -44,10 +44,10 @@ func main() {
fmt.Println()
// Function selectors
token0Selector := []byte{0x0d, 0xfe, 0x16, 0x81} // token0()
token1Selector := []byte{0xd2, 0x12, 0x20, 0xa7} // token1()
feeSelector := []byte{0xdd, 0xca, 0x3f, 0x43} // fee()
slot0Selector := []byte{0x38, 0x50, 0xc7, 0xbd} // slot0()
token0Selector := []byte{0x0d, 0xfe, 0x16, 0x81} // token0()
token1Selector := []byte{0xd2, 0x12, 0x20, 0xa7} // token1()
feeSelector := []byte{0xdd, 0xca, 0x3f, 0x43} // fee()
slot0Selector := []byte{0x38, 0x50, 0xc7, 0xbd} // slot0()
reservesSelector := []byte{0x09, 0x02, 0xf1, 0xac} // getReserves()
uniV3Count := 0
@@ -155,4 +155,4 @@ func main() {
for reason, count := range reasonCounts {
fmt.Printf("%s: %d\n", reason, count)
}
}
}

View File

@@ -78,4 +78,4 @@ func main() {
fmt.Println("\nChecking token1() selector:")
fmt.Printf(" Correct V3 selector: 0xd21220a7\n")
fmt.Printf(" Our code selector: 0x%x\n", token1Selector)
}
}

View File

@@ -169,4 +169,4 @@ func testPool(client *ethclient.Client, poolABI abi.ABI, poolHex string, name st
} else if len(result) >= 32 {
fmt.Printf(" ✅ Raw token0(): 0x%x\n", result[12:32])
}
}
}

View File

@@ -154,7 +154,7 @@ tail -f logs/mev_bot.log | while read line; do
# Extract reject reason (at the end for context)
if echo "$line" | grep -oP 'rejectReason:[^]]+' &>/dev/null; then
REASON=$(echo "$line" | grep -oP 'rejectReason:[^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+' | cut -d: -f2)
REASON=$(echo "$line" | grep -oP 'rejectReason:\K[^}]+' | head -c 200)
# Trim to just the meaningful part (remove trailing field names)
REASON=$(echo "$REASON" | sed 's/ token[0-9].*$//' | sed 's/ protocol.*$//' | sed 's/ poolAddress.*$//')
echo -e "${RED} ❌ Reason: $REASON${NC}"
@@ -220,19 +220,19 @@ tail -f logs/mev_bot.log | while read line; do
echo -e "${RED}[$TIMESTAMP] ❌ ERROR #$ERRORS${NC}"
fi
# IMPROVED: Extract error message using multiple patterns
# IMPROVED: Extract error message using multiple patterns (CRITICAL FIX: removed truncation)
# Try pattern 1: "error:" or "error="
ERROR_MSG=$(echo "$line" | grep -oP 'error[=:].*' | head -c 100)
ERROR_MSG=$(echo "$line" | grep -oP 'error[=:]\s*\K[^|]*' | head -c 300)
# Try pattern 2: Extract message after [ERROR] or [WARN] tag
# Try pattern 2: Extract message after [ERROR] or [WARN] tag (CRITICAL FIX: increased limit to 300)
if [[ -z "$ERROR_MSG" ]]; then
ERROR_MSG=$(echo "$line" | sed -n 's/.*\[ERROR\]\s*//p' | sed -n 's/.*\[WARN\]\s*//p' | head -c 100)
ERROR_MSG=$(echo "$line" | sed -n 's/.*\[ERROR\]\s*//p' | sed -n 's/.*\[WARN\]\s*//p' | head -c 300)
fi
# Try pattern 3: Extract everything after timestamp and log level
# Try pattern 3: Extract everything after timestamp and log level (CRITICAL FIX: increased limit to 300)
if [[ -z "$ERROR_MSG" ]]; then
# Format: "2025/11/02 20:19:03 [ERROR] message"
ERROR_MSG=$(echo "$line" | sed -E 's/^[0-9]{4}\/[0-9]{2}\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} \[(ERROR|WARN)\] //' | head -c 100)
ERROR_MSG=$(echo "$line" | sed -E 's/^[0-9]{4}\/[0-9]{2}\/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} \[(ERROR|WARN)\] //' | head -c 300)
fi
# Display error message if extracted