.PHONY: help build test test-fork coverage deploy testnet configure simulate clean install

help: ## Show this help message
	@echo 'Usage: make [target]'
	@echo ''
	@echo 'Available targets:'
	@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "  %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install all dependencies
	npm install
	forge install

build: ## Build all contracts
	forge build

test: ## Run all tests
	forge test

test-fork: ## Run tests on mainnet fork
	forge test --fork-url $$RPC_URL

coverage: ## Generate test coverage
	forge coverage

deploy: ## Deploy to mainnet
	tsx scripts/deploy.ts

testnet: ## Deploy to testnet
	tsx scripts/testnet.ts

configure: ## Configure deployed contracts
	tsx scripts/configure.ts

simulate: ## Run simulations
	tsx scripts/simulate.ts

clean: ## Clean build artifacts
	forge clean
	rm -rf out/
	rm -rf dist/
	rm -rf cache/

lint: ## Run linter
	forge fmt --check
	npm run lint || true

format: ## Format code
	forge fmt
	npm run format || true

