-
Notifications
You must be signed in to change notification settings - Fork 12
/
deploy_sns.sh
executable file
·42 lines (30 loc) · 1.64 KB
/
deploy_sns.sh
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
#!/usr/bin/env bash
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
export CONFIG="${1:-sns-test.yml}"
. ./constants.sh normal
export CURRENT_DX_IDENT="$(dfx identity whoami)"
dfx identity use "${DX_IDENT}"
. ./setup_wallet.sh "${DX_IDENT}"
dfx ledger --network "${NETWORK}" fabricate-cycles --canister "${WALLET}" --t 2345
ic-admin \
--nns-url "${NETWORK_URL}" propose-to-update-sns-deploy-whitelist \
--test-neuron-proposer \
--added-principals "${WALLET}" \
--proposal-title "Let me SNS!" \
--summary "This proposal whitelists developer's principal to deploy SNS"
${DFX} nns import --network-mapping "${DX_NETWORK}=mainnet"
if [ "${CANISTER_TEST}" == "_test" ]
then
curl -L "https://raw.githubusercontent.com/dfinity/ic/${IC_COMMIT}/rs/nns/governance/canister/governance_test.did" -o ./candid/nns-governance.did
curl -L "https://raw.githubusercontent.com/dfinity/ic/${IC_COMMIT}/rs/sns/governance/canister/governance_test.did" -o ./candid/sns_governance.did
fi
curl -L "https://raw.githubusercontent.com/dfinity/nns-dapp/${NNS_DAPP_RELEASE}/sns_aggregator/sns_aggregator.did" -o ./candid/sns_aggregator.did
cat <<< $(jq -r 'del(.canisters."internet_identity".remote)' dfx.json) > dfx.json
cat <<< $(jq -r 'del(.canisters."nns-dapp".remote)' dfx.json) > dfx.json
cat <<< $(jq -r 'del(.canisters."sns_aggregator".remote)' dfx.json) > dfx.json
sed "s/aaaaa-aa/${DX_PRINCIPAL}/" "$CONFIG" > "${CONFIG}.tmp"
mv "${CONFIG}.tmp" "${CONFIG}"
sns deploy --network "${NETWORK}" --init-config-file "${CONFIG}" --save-to ".dfx/${DX_NETWORK}/canister_ids.json"
# Switch back to the previous identity
dfx identity use "$CURRENT_DX_IDENT"