-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (137 loc) · 4.65 KB
/
Makefile
File metadata and controls
160 lines (137 loc) · 4.65 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Mathematical AMM Toolkit - Makefile
# Convenience commands using gblend/forge
# Colors for output
RED := \033[0;31m
GREEN := \033[0;32m
BLUE := \033[0;34m
NC := \033[0m # No Color
.PHONY: help
help: ## Show this help message
@echo "Mathematical AMM Toolkit - Available Commands"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
.PHONY: setup
setup: ## Initialize and update submodules
@echo "$(BLUE)Setting up submodules...$(NC)"
git submodule update --init --recursive
.PHONY: clean
clean: ## Clean build artifacts
@echo "$(BLUE)Cleaning build artifacts...$(NC)"
gblend clean
.PHONY: build
build: ## Build all contracts (Rust and Solidity)
@echo "$(BLUE)Building all contracts with gblend...$(NC)"
gblend build
@echo "$(GREEN)✓ All contracts built$(NC)"
@echo "$(GREEN)✓ WASM at: out/MathematicalEngine/MathematicalEngine.wasm$(NC)"
@echo "$(GREEN)✓ Interface at: out/MathematicalEngine.wasm/interface.sol$(NC)"
.PHONY: build-solidity
build-solidity: ## Build only Solidity contracts
@echo "$(BLUE)Building Solidity contracts...$(NC)"
forge build
@echo "$(GREEN)✓ Solidity contracts built$(NC)"
.PHONY: deploy-rust
deploy-rust: build ## Deploy the Rust mathematical engine standalone
@echo "$(BLUE)Deploying Rust mathematical engine...$(NC)"
gblend create MathematicalEngine.wasm \
--rpc-url fluent-testnet \
--private-key $PRIVATE_KEY \
--broadcast
@echo "$(GREEN)✓ Math Engine deployed$(NC)"
.PHONY: deploy-amm
deploy-amm: build ## Deploy AMM contracts standalone
@echo "$(BLUE)Deploying Basic AMM...$(NC)"
gblend create src/BasicAMM.sol:BasicAMM \
--rpc-url fluent-testnet \
--private-key $PRIVATE_KEY \
--broadcast \
--constructor-args $TOKEN_A $TOKEN_B "Basic AMM LP Token" "BAMM-LP"
@echo "$(GREEN)✓ Basic AMM deployed$(NC)"
@echo "$(BLUE)Deploying Enhanced AMM...$(NC)"
gblend create src/BlendedAMM.sol:BlendedAMM \
--rpc-url fluent-testnet \
--private-key $PRIVATE_KEY \
--broadcast \
--constructor-args \
$TOKEN_A \
$TOKEN_B \
$MATH_ENGINE \
"Enhanced AMM LP Token" \
"EAMM-LP"
@echo "$(GREEN)✓ Enhanced AMM deployed$(NC)"
.PHONY: deploy
deploy: build ## Deploy all contracts to testnet (default)
@echo "$(BLUE)Deploying all contracts to testnet...$(NC)"
gblend script script/Deploy.s.sol:Deploy \
--profile testnet \
--private-key $PRIVATE_KEY \
--broadcast \
-vvv
@echo "$(GREEN)✓ All contracts deployed to testnet$(NC)"
.PHONY: deploy-devnet
deploy-devnet: build ## Deploy all contracts to devnet
@echo "$(BLUE)Deploying all contracts to devnet...$(NC)"
gblend script script/Deploy.s.sol:Deploy \
--profile devnet \
--private-key $PRIVATE_KEY \
--broadcast \
-vvv
@echo "$(GREEN)✓ All contracts deployed to devnet$(NC)"
.PHONY: bootstrap
bootstrap: ## Bootstrap deployed contracts with liquidity
@echo "$(BLUE)Bootstrapping contracts with liquidity...$(NC)"
gblend script script/Bootstrap.s.sol:Bootstrap \
--profile testnet \
--private-key $PRIVATE_KEY \
--broadcast \
-vvv
@echo "$(GREEN)✓ Contracts bootstrapped$(NC)"
.PHONY: bootstrap-devnet
bootstrap-devnet: ## Bootstrap deployed contracts on devnet
@echo "$(BLUE)Bootstrapping contracts on devnet...$(NC)"
gblend script script/Bootstrap.s.sol:Bootstrap \
--profile devnet \
--private-key $PRIVATE_KEY \
--broadcast \
-vvv
@echo "$(GREEN)✓ Contracts bootstrapped on devnet$(NC)"
.PHONY: test
test: ## Run all tests
@echo "$(BLUE)Running tests...$(NC)"
forge test -vv
.PHONY: test-gas
test-gas: ## Run gas benchmark tests
@echo "$(BLUE)Running gas benchmarks...$(NC)"
forge test --match-contract GasBenchmark --gas-report -vvv
.PHONY: snapshot
snapshot: ## Create gas snapshot
@echo "$(BLUE)Creating gas snapshot...$(NC)"
forge snapshot --match-contract GasBenchmark
@echo "$(GREEN)✓ Snapshot saved to .gas-snapshot$(NC)"
.PHONY: anvil
anvil: ## Start local Anvil testnet
@echo "$(BLUE)Starting Anvil...$(NC)"
anvil --host 0.0.0.0 --port 8545
.PHONY: verify-rust
verify-rust: ## Verify the Rust contract on explorer
@echo "$(BLUE)Verifying Rust contract...$(NC)"
@echo "Please provide the deployed address:"
@read -p "Contract address: " ADDRESS; \
gblend verify-contract $$ADDRESS MathematicalEngine.wasm \
--verifier blockscout \
--verifier-url https://blockscout.dev.fluentlabs.xyz \
--wasm
.PHONY: benchmark
benchmark: deploy test-gas snapshot ## Run complete benchmark suite
@echo "$(GREEN)✓ Benchmark complete!$(NC)"
@echo "Check the gas report above for detailed analysis"
.PHONY: console
console: ## Open Forge console
forge console
# Convenience aliases
.PHONY: b
b: build
.PHONY: d
d: deploy
.PHONY: t
t: test