forked from Heliobond/contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (54 loc) · 1.96 KB
/
Copy pathMakefile
File metadata and controls
63 lines (54 loc) · 1.96 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
.PHONY: build test test-vault test-registry check-interface-docs check-event-field-types test-gas-budget-check install-hooks deploy-testnet
build:
stellar contract build
# Wire scripts/hooks/pre-commit into git so `cargo fmt --check` runs before every commit (#251).
install-hooks:
git config core.hooksPath scripts/hooks
@echo "Pre-commit hook installed: cargo fmt --check now runs before every commit."
test:
cargo test
# Scope to a single crate for faster local iteration (#254).
test-vault:
cargo test -p investment-vault
test-registry:
cargo test -p project-registry
check-interface-docs:
python3 scripts/check_interface_docs.py
check-event-field-types:
python3 scripts/check_event_field_types.py
test-gas-budget-check:
python3 -m unittest discover -s scripts/tests
deploy-testnet: test build
@echo "Checking WASM sizes (budget: 131072 bytes)..."
@FAILED=0; \
for f in target/wasm32v1-none/release/*.wasm; do \
name=$$(basename "$$f" .wasm); \
size=$$(wc -c < "$$f"); \
printf " %-40s %7d bytes\n" "$$name" "$$size"; \
if [ "$$size" -gt 131072 ]; then \
echo "FAILED: $$name exceeds budget"; \
FAILED=1; \
fi; \
done; \
[ "$$FAILED" -eq 0 ] || exit 1
@mkdir -p deploy
@REGISTRY_ID=$$(stellar contract deploy \
--wasm target/wasm32v1-none/release/project_registry.wasm \
--source $(STELLAR_SECRET_KEY) \
--network testnet \
-- \
--admin $(ADMIN_ADDRESS) \
--whitelister $(WHITELISTER_ADDRESS)) && \
echo "ProjectRegistry: $$REGISTRY_ID" && \
VAULT_ID=$$(stellar contract deploy \
--wasm target/wasm32v1-none/release/investment_vault.wasm \
--source $(STELLAR_SECRET_KEY) \
--network testnet \
-- \
--admin $(ADMIN_ADDRESS) \
--usdc_sac $(USDC_SAC_ADDRESS) \
--registry $$REGISTRY_ID) && \
echo "InvestmentVault: $$VAULT_ID" && \
printf '{"network":"testnet","project_registry":"%s","investment_vault":"%s"}\n' \
"$$REGISTRY_ID" "$$VAULT_ID" > deploy/testnet.json && \
echo "Saved to deploy/testnet.json"