-
Notifications
You must be signed in to change notification settings - Fork 2
/
justfile
159 lines (124 loc) · 4.68 KB
/
justfile
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
# shellcheck disable=all
# Load in `.env`
set dotenv-load
export PATH := './target/bin:' + env_var('PATH')
export SOROBAN_NETWORK := env_var('SOROBAN_NETWORK')
TARGET_DIR := './target/loam'
SMARTDEPLOY := TARGET_DIR / 'smartdeploy.wasm'
BASE := TARGET_DIR / 'base.wasm'
soroban := 'target/bin/soroban'
loam := 'target/bin/loam'
FILE := 'target/bin/soroban-smartdeploy'
UPLOAD_FEE := '10000000'
# smartdeploy := 'soroban contract invoke --id ' + env_var('DEFAULT_ID') + ' -- '
# hash := if path_exists({{SMARTDEPLOY}}) == "true" {`soroban contract install --wasm ./target/wasm32-unknown-unknown/contracts/example_status_message.wasm --config-dir ./target` } else {""}
id:=`cat contract_id.txt`
ROOT_DIR := 'target/contracts/smartdeploy'
[private]
@default: setup build
soroban config network add standalone \
--rpc-url http://localhost:8000/soroban/rpc \
--network-passphrase "Standalone Network ; February 2017"
# check clippy and cargo-spellcheck
check:
cargo spellcheck -c ./.config/spellcheck.toml
@soroban +args:
soroban {{args}}
# Execute plugin
s name +args:
@soroban {{ name }} {{ args }}
smartdeploy +args:
@just smartdeploy_raw -- {{args}}
@smartdeploy_raw +args:
@soroban contract invoke --id {{id}} {{args}}
@soroban_install name:
@soroban contract install --wasm ./target/wasm32-unknown-unknown/release-with-logs/{{name}}.wasm
@generate: build
@soroban contract bindings typescript \
--contract-id {{id}} \
--wasm {{SMARTDEPLOY}} \
--output-dir {{ ROOT_DIR }}/smartdeploy \
--overwrite \
target:
echo {{TARGET_DIR}}
echo {{SMARTDEPLOY}}
build +args='':
loam build --profile release-with-logs --out-dir target/loam {{args}}
[private]
setup_default:
-soroban config identity generate default --config-dir $CONFIG_DIR
@setup:
echo {{ if path_exists(soroban) == "true" { "" } else { `cargo install_soroban_dev` } }}
echo {{ if path_exists(loam) == "true" { "" } else { `cargo install_loam` } }}
echo {{ if path_exists(env_var('CONFIG_DIR') / '.soroban/identity/default.toml') == "true" { "" } else { `just setup_default` } }}
@fund_default:
soroban config identity fund default
@deploy_self:
just build --package smartdeploy
@./deploy.sh
[private]
@claim_self owner='default':
just smartdeploy claim_already_deployed_contract --deployed_name smartdeploy --id {{ id }} --owner {{owner}}
@set_owner owner:
@just smartdeploy_raw -- owner_set --new_owner {{ owner }}
[private]
@install_self:
echo "#!/usr/bin/env bash \nsoroban contract invoke --id {{id}} -- \$@" > {{ FILE }}
chmod +x {{ FILE }}
publish_all: fund_default deploy_self
#!/usr/bin/env bash
set -e;
echo $SOROBAN_NETWORK;
just install_self;
for name in $(loam build --ls)
do
if [ "$name" != "smartdeploy" ]; then
echo $name;
just build --package $name;
name="${name//-/_}";
just publish_one $name
cargo r -- install $name
fi
done
[private]
@publish_one name:
@just publish {{ name }}
@just deploy {{ name }} {{ name }}
@deploy contract_name deployed_name owner='default':
@just smartdeploy_raw --source {{owner}} -- deploy --contract_name {{contract_name}} --deployed_name {{deployed_name}} --owner {{owner}}
@dev_deploy name file owner='default':
just smartdeploy_raw --fee {{UPLOAD_FEE}} --source {{owner}} -- \
dev_deploy \
--owner {{owner}}} \
--name {{name}} \
--wasm-file-path {{file}}} \
@publish name kind='Patch' author='default':
@just smartdeploy_raw --fee {{UPLOAD_FEE}} --source {{author}} -- \
publish \
--contract_name {{name}} \
--wasm-file-path ./target/loam/{{name}}.wasm \
--kind {{kind}} \
--author {{author}} \
# Delete non-wasm artifacts
@clean:
rm -rf .soroban/*.json hash.txt target/bin/soroban-* target/smartdeploy/*
# Delete installed binaries
@clean_installed_binaries:
rm target/bin/loam target/bin/soroban target/bin/smartdeploy
# List Published Contracts
published_contracts start='0' limit='100':
@just smartdeploy list_published_contracts --start {{start}} --limit {{limit}} | jq .
# List Deployed Contracts
deployed_contracts start='0' limit='100':
@just smartdeploy list_deployed_contracts --start {{start}} --limit {{limit}} | jq .
@install_contract name:
./install_contract.sh {{name}}
start_docker:
docker run --rm -it \
-p 8000:8000 \
--name stellar \
stellar/quickstart:soroban-dev@sha256:c1030a6ee75c31ba6807b8feddded2af23789b5f2c9be3ac55a550630a35ef42 \
--local \
--enable-soroban-rpc \
smartdeploy_id:
just smartdeploy fetch_contract_id --deployed_name smartdeploy | jq .