-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (74 loc) · 3.5 KB
/
Copy pathMakefile
File metadata and controls
95 lines (74 loc) · 3.5 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
NETWORK ?= testnet
SOURCE ?= deployer
WASM_DIR := contracts/target/wasm32v1-none/release
.PHONY: build test test-verbose lint fmt clean deploy check-tools
## Build all contracts for release (WASM)
build:
@echo "Building contracts..."
cd contracts && cargo build -p parashield-policy-engine --target wasm32v1-none --release --quiet
cd contracts && cargo build -p parashield-oracle-verifier --target wasm32v1-none --release --quiet
cd contracts && cargo build -p parashield-claims-processor --target wasm32v1-none --release --quiet
cd contracts && cargo build -p parashield-risk-pool --target wasm32v1-none --release --quiet
cd contracts && cargo build -p parashield-governance-dao --target wasm32v1-none --release --quiet
@echo "Build complete. WASMs in $(WASM_DIR)/"
## Build with debug assertions (for detailed error messages during dev)
build-debug:
cd contracts && cargo build -p parashield-policy-engine --target wasm32v1-none --profile release-with-logs
cd contracts && cargo build -p parashield-oracle-verifier --target wasm32v1-none --profile release-with-logs
cd contracts && cargo build -p parashield-claims-processor --target wasm32v1-none --profile release-with-logs
cd contracts && cargo build -p parashield-risk-pool --target wasm32v1-none --profile release-with-logs
cd contracts && cargo build -p parashield-governance-dao --target wasm32v1-none --profile release-with-logs
## Run all contract tests
test:
cd contracts && cargo test --quiet 2>&1 | tail -20
## Run tests with full output
test-verbose:
cd contracts && cargo test -- --nocapture
## Run tests for a specific contract
test-oracle:
cd contracts && cargo test -p parashield-oracle-verifier -- --nocapture
test-policy:
cd contracts && cargo test -p parashield-policy-engine -- --nocapture
test-claims:
cd contracts && cargo test -p parashield-claims-processor -- --nocapture
test-pool:
cd contracts && cargo test -p parashield-risk-pool -- --nocapture
test-dao:
cd contracts && cargo test -p parashield-governance-dao -- --nocapture
## Run Clippy linter
lint:
cd contracts && cargo clippy --all-targets -- -D warnings -A clippy::duplicated_attributes
## Format Rust source
fmt:
cd contracts && cargo fmt --all
## Check formatting without modifying files
fmt-check:
cd contracts && cargo fmt --all -- --check
## Remove build artifacts
clean:
cd contracts && cargo clean
## Deploy to testnet (requires stellar CLI and funded deployer key)
deploy:
./scripts/deploy_testnet.sh
## Check required tools are installed
check-tools:
@which stellar > /dev/null || (echo "Error: stellar CLI not found. Install from https://github.com/stellar/stellar-cli" && exit 1)
@which cargo > /dev/null || (echo "Error: cargo not found. Install Rust from https://rustup.rs" && exit 1)
@rustup target list --installed | grep -q wasm32v1-none || (echo "Adding wasm32v1-none target..." && rustup target add wasm32v1-none)
@echo "All required tools found."
## Run full pre-release check: tests + lint + wasm-sizes
pre-release: test lint wasm-sizes
@echo "==> Pre-release checks passed. Ready to tag."
## Deploy to Mainnet — requires DEPLOYER_SECRET env var
deploy-mainnet:
./scripts/deploy_mainnet.sh
## Submit oracle data (see scripts/submit_oracle_data.sh for env vars)
submit-oracle:
./scripts/submit_oracle_data.sh
## Check deployed contract balances
check-balances:
./scripts/check_balances.sh
## Print sizes of compiled WASMs
wasm-sizes: build
@echo "Contract WASM sizes:"
@ls -lh $(WASM_DIR)/*.wasm 2>/dev/null || echo "No WASMs built yet. Run 'make build' first."