- Add complete Market Manager package with in-memory storage and CRUD operations - Implement arbitrage detection with profit calculations and thresholds - Add database adapter with PostgreSQL schema for persistence - Create comprehensive logging system with specialized log files - Add detailed documentation and implementation plans - Include example application and comprehensive test suite - Update Makefile with market manager build targets - Add check-implementations command for verification
166 lines
4.0 KiB
Makefile
166 lines
4.0 KiB
Makefile
# Makefile for MEV Bot
|
|
|
|
# Variables
|
|
BINARY=mev-bot
|
|
MAIN_FILE=cmd/mev-bot/main.go
|
|
BINARY_PATH=bin/$(BINARY)
|
|
|
|
# Default target
|
|
.PHONY: all
|
|
all: build
|
|
|
|
# Build the application
|
|
.PHONY: build
|
|
build:
|
|
@echo "Building $(BINARY)..."
|
|
@mkdir -p bin
|
|
@go build -o $(BINARY_PATH) $(MAIN_FILE)
|
|
@echo "Build successful!"
|
|
|
|
# Build market manager example
|
|
.PHONY: build-mm
|
|
build-mm:
|
|
@echo "Building market manager example..."
|
|
@mkdir -p bin
|
|
@go build -o bin/marketmanager-example examples/marketmanager/main.go
|
|
@echo "Market manager example built successfully!"
|
|
|
|
# Run the application
|
|
.PHONY: run
|
|
run: build
|
|
@echo "Running $(BINARY)..."
|
|
@$(BINARY_PATH)
|
|
|
|
# Run market manager example
|
|
.PHONY: run-mm
|
|
run-mm: build-mm
|
|
@echo "Running market manager example..."
|
|
@bin/marketmanager-example
|
|
|
|
# Run tests
|
|
.PHONY: test
|
|
test:
|
|
@echo "Running tests..."
|
|
@go test -v ./...
|
|
|
|
# Run tests for market manager
|
|
.PHONY: test-mm
|
|
test-mm:
|
|
@echo "Running market manager tests..."
|
|
@go test -v ./pkg/marketmanager/...
|
|
|
|
# Run tests with coverage
|
|
.PHONY: test-coverage
|
|
test-coverage:
|
|
@echo "Running tests with coverage..."
|
|
@go test -coverprofile=coverage.out ./...
|
|
@go tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: coverage.html"
|
|
|
|
# Run unit tests
|
|
.PHONY: test-unit
|
|
test-unit:
|
|
@echo "Running unit tests..."
|
|
@go test -v ./test/unit/...
|
|
|
|
# Run integration tests
|
|
.PHONY: test-integration
|
|
test-integration:
|
|
@echo "Running integration tests..."
|
|
@go test -v ./test/integration/...
|
|
|
|
# Run end-to-end tests
|
|
.PHONY: test-e2e
|
|
test-e2e:
|
|
@echo "Running end-to-end tests..."
|
|
@go test -v ./test/e2e/...
|
|
|
|
# Clean build artifacts
|
|
.PHONY: clean
|
|
clean:
|
|
@echo "Cleaning..."
|
|
@rm -rf bin/
|
|
@rm -f coverage.out coverage.html
|
|
@echo "Clean complete!"
|
|
|
|
# Install dependencies
|
|
.PHONY: deps
|
|
deps:
|
|
@echo "Installing dependencies..."
|
|
@go mod tidy
|
|
@echo "Dependencies installed!"
|
|
|
|
# Format code
|
|
.PHONY: fmt
|
|
fmt:
|
|
@echo "Formatting code..."
|
|
@go fmt ./...
|
|
|
|
# Format market manager code
|
|
.PHONY: fmt-mm
|
|
fmt-mm:
|
|
@echo "Formatting market manager code..."
|
|
@go fmt ./pkg/marketmanager/...
|
|
@go fmt ./examples/marketmanager/...
|
|
|
|
# Vet code
|
|
.PHONY: vet
|
|
vet:
|
|
@echo "Vetting code..."
|
|
@go vet ./...
|
|
|
|
# Vet market manager code
|
|
.PHONY: vet-mm
|
|
vet-mm:
|
|
@echo "Vetting market manager code..."
|
|
@go vet ./pkg/marketmanager/...
|
|
@go vet ./examples/marketmanager/...
|
|
|
|
# Lint code (requires golangci-lint)
|
|
.PHONY: lint
|
|
lint:
|
|
@echo "Linting code..."
|
|
@which golangci-lint > /dev/null || (echo "golangci-lint not found, installing..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest)
|
|
@golangci-lint run
|
|
|
|
# Update dependencies
|
|
.PHONY: update
|
|
update:
|
|
@echo "Updating dependencies..."
|
|
@go get -u ./...
|
|
@go mod tidy
|
|
@echo "Dependencies updated!"
|
|
|
|
# Install test dependencies
|
|
.PHONY: test-deps
|
|
test-deps:
|
|
@echo "Installing test dependencies..."
|
|
@go get github.com/stretchr/testify/assert
|
|
@go mod tidy
|
|
@echo "Test dependencies installed!"
|
|
|
|
# Help
|
|
.PHONY: help
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " all - Build the application (default)"
|
|
@echo " build - Build the application"
|
|
@echo " build-mm - Build market manager example"
|
|
@echo " run - Build and run the application"
|
|
@echo " run-mm - Build and run market manager example"
|
|
@echo " test - Run tests"
|
|
@echo " test-mm - Run market manager tests"
|
|
@echo " test-coverage - Run tests with coverage report"
|
|
@echo " test-unit - Run unit tests"
|
|
@echo " test-integration - Run integration tests"
|
|
@echo " test-e2e - Run end-to-end tests"
|
|
@echo " clean - Clean build artifacts"
|
|
@echo " deps - Install dependencies"
|
|
@echo " test-deps - Install test dependencies"
|
|
@echo " fmt - Format code"
|
|
@echo " fmt-mm - Format market manager code"
|
|
@echo " vet - Vet code"
|
|
@echo " vet-mm - Vet market manager code"
|
|
@echo " lint - Lint code (requires golangci-lint)"
|
|
@echo " update - Update dependencies"
|
|
@echo " help - Show this help"
|