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

@@ -15,19 +15,19 @@ import (
type PoolType string
const (
PoolTypeUnknown PoolType = "unknown"
PoolTypeUniswapV2 PoolType = "uniswap_v2"
PoolTypeUniswapV3 PoolType = "uniswap_v3"
PoolTypeUniswapV4 PoolType = "uniswap_v4"
PoolTypeSushiswap PoolType = "sushiswap"
PoolTypeBalancer PoolType = "balancer"
PoolTypeCurve PoolType = "curve"
PoolTypeAlgebraV1 PoolType = "algebra_v1"
PoolTypeAlgebraV19 PoolType = "algebra_v1.9"
PoolTypeUnknown PoolType = "unknown"
PoolTypeUniswapV2 PoolType = "uniswap_v2"
PoolTypeUniswapV3 PoolType = "uniswap_v3"
PoolTypeUniswapV4 PoolType = "uniswap_v4"
PoolTypeSushiswap PoolType = "sushiswap"
PoolTypeBalancer PoolType = "balancer"
PoolTypeCurve PoolType = "curve"
PoolTypeAlgebraV1 PoolType = "algebra_v1"
PoolTypeAlgebraV19 PoolType = "algebra_v1.9"
PoolTypeAlgebraIntegral PoolType = "algebra_integral"
PoolTypeCamelot PoolType = "camelot"
PoolTypeKyberswap PoolType = "kyberswap"
PoolTypePancakeV3 PoolType = "pancake_v3"
PoolTypeCamelot PoolType = "camelot"
PoolTypeKyberswap PoolType = "kyberswap"
PoolTypePancakeV3 PoolType = "pancake_v3"
)
// PoolDetector identifies pool/exchange types using unique signatures
@@ -44,15 +44,15 @@ func NewPoolDetector(client *ethclient.Client) *PoolDetector {
// PoolInfo contains detected pool information
type PoolInfo struct {
Address common.Address
Type PoolType
Token0 common.Address
Token1 common.Address
Fee *big.Int
Version string
Confidence float64
DetectedAt time.Time
Properties map[string]interface{}
Address common.Address
Type PoolType
Token0 common.Address
Token1 common.Address
Fee *big.Int
Version string
Confidence float64
DetectedAt time.Time
Properties map[string]interface{}
}
// DetectPoolType identifies the pool type using unique method signatures
@@ -75,15 +75,15 @@ func (pd *PoolDetector) DetectPoolType(ctx context.Context, poolAddr common.Addr
// Method selectors for detection
selectors := map[string][]byte{
"token0": {0x0d, 0xfe, 0x16, 0x81}, // Common to many DEXs
"token1": {0xd2, 0x1c, 0xec, 0xd4}, // Common to many DEXs
"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
"token0": {0x0d, 0xfe, 0x16, 0x81}, // Common to many DEXs
"token1": {0xd2, 0x1c, 0xec, 0xd4}, // Common to many DEXs
"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
}
@@ -195,14 +195,14 @@ func (pd *PoolDetector) DetectFromTransaction(ctx context.Context, txData []byte
// Common swap selectors by protocol
swapSelectors := map[string]PoolType{
"0x128acb08": PoolTypeUniswapV3, // swap (V3)
"0x5c11d795": PoolTypeUniswapV2, // swapExactTokensForTokensSupportingFeeOnTransferTokens
"0x38ed1739": PoolTypeUniswapV2, // swapExactTokensForTokens
"0x8803dbee": PoolTypeUniswapV2, // swapTokensForExactTokens
"0x04e45aaf": PoolTypeUniswapV3, // exactInputSingle
"0x414bf389": PoolTypeUniswapV3, // exactInputSingle (SwapRouter02)
"0xac9650d8": PoolTypeUniswapV3, // multicall (V3)
"0x5ae401dc": PoolTypeUniswapV3, // multicall with deadline
"0x128acb08": PoolTypeUniswapV3, // swap (V3)
"0x5c11d795": PoolTypeUniswapV2, // swapExactTokensForTokensSupportingFeeOnTransferTokens
"0x38ed1739": PoolTypeUniswapV2, // swapExactTokensForTokens
"0x8803dbee": PoolTypeUniswapV2, // swapTokensForExactTokens
"0x04e45aaf": PoolTypeUniswapV3, // exactInputSingle
"0x414bf389": PoolTypeUniswapV3, // exactInputSingle (SwapRouter02)
"0xac9650d8": PoolTypeUniswapV3, // multicall (V3)
"0x5ae401dc": PoolTypeUniswapV3, // multicall with deadline
}
selectorHex := fmt.Sprintf("0x%x", selector)
@@ -307,4 +307,4 @@ func (pd *PoolDetector) extractPoolFromCalldata(data []byte) *common.Address {
}
}
return nil
}
}