-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (77 loc) · 3.08 KB
/
Makefile
File metadata and controls
104 lines (77 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Bank Smart Contract Makefile
# Default target
.DEFAULT_GOAL := help
# Variables
NETWORK ?= anvil
PRIVATE_KEY ?= 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
# Help
help: ## Show this help message
@echo "Bank Smart Contract Commands"
@echo "============================"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Build
build: ## Compile the smart contracts
forge build
clean: ## Clean the build artifacts
forge clean
# Testing
test: ## Run all tests
forge test
test-unit: ## Run unit tests only
forge test --match-contract BankTest
test-fuzz: ## Run fuzz tests only
forge test --match-contract BankFuzzTest
test-workflow: ## Run complete workflow test
forge test --match-contract CompleteWorkflowTest -vv
test-coverage: ## Run tests with coverage report
forge coverage
test-gas: ## Run tests with gas reporting
forge test --gas-report
# Local Development
anvil: ## Start local Anvil node
anvil
deploy-local: ## Deploy to local Anvil network
forge script script/Deploy.s.sol --rpc-url http://localhost:8545 --broadcast --private-key $(PRIVATE_KEY)
# Testnet Deployment
deploy-sepolia: ## Deploy to Sepolia testnet
@echo "Deploying to Sepolia..."
forge script script/Deploy.s.sol --rpc-url $(SEPOLIA_RPC_URL) --broadcast --verify
deploy-complete: ## Deploy complete workflow (BigBank + Admin)
@echo "Deploying complete workflow..."
forge script script/DeployCompleteWorkflow.s.sol --rpc-url http://localhost:8545 --broadcast --private-key $(PRIVATE_KEY)
# Interactions
deposit: ## Make a deposit (requires BANK_CONTRACT_ADDRESS and DEPOSIT_AMOUNT env vars)
forge script script/interactions/Deposit.s.sol --rpc-url $(RPC_URL) --broadcast
withdraw: ## Make a withdrawal (requires BANK_CONTRACT_ADDRESS and WITHDRAW_AMOUNT env vars)
forge script script/interactions/Withdraw.s.sol --rpc-url $(RPC_URL) --broadcast
# Verification
verify: ## Verify contract on Etherscan
@echo "Please run: forge verify-contract <CONTRACT_ADDRESS> src/Bank.sol:Bank --etherscan-api-key \$$ETHERSCAN_API_KEY --chain $(NETWORK)"
# Formatting and Linting
fmt: ## Format Solidity code
forge fmt
# Documentation
doc: ## Generate documentation
forge doc
# Utilities
size: ## Check contract sizes
forge build --sizes
flatten: ## Flatten the contract
forge flatten src/Bank.sol > Bank_flattened.sol
# Setup
setup: ## Initial project setup
@echo "Setting up Bank project..."
@forge install
@cp env.example .env
@echo "✅ Setup complete! Please edit .env file with your configuration."
# Quick commands for development workflow
dev: build test ## Build and test (development workflow)
full-test: clean build test-coverage test-gas ## Complete test suite
# Demo commands
demo-local: ## Run complete local demo
@echo "Starting local demo..."
@make anvil &
@sleep 3
@make deploy-local
@echo "✅ Local demo setup complete!"
.PHONY: help build clean test test-unit test-fuzz test-coverage test-gas anvil deploy-local deploy-sepolia deposit withdraw verify fmt doc size flatten setup dev full-test demo-local