forked from dfinity/nns-dapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-ckbtc
executable file
·79 lines (69 loc) · 3.21 KB
/
deploy-ckbtc
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
#!/bin/bash
# Original source
# https://github.com/dfinity/ckBTC-Minter-Frontend/blob/master/local_deploy.sh
dfx canister create ckbtc_ledger --network "$DFX_NETWORK"
dfx canister create ckbtc_minter --network "$DFX_NETWORK"
dfx canister create ckbtc_kyt --network "$DFX_NETWORK"
MINTERID="$(dfx canister id ckbtc_minter --network "$DFX_NETWORK")"
echo "$MINTERID"
LEDGERID="$(dfx canister id ckbtc_ledger --network "$DFX_NETWORK")"
echo "$LEDGERID"
KYTID="$(dfx canister id ckbtc_kyt --network "$DFX_NETWORK")"
echo "$KYTID"
# echo "Step 2: deploying minter canister..."
dfx deploy ckbtc_minter --network "$DFX_NETWORK" --argument "(variant {
Init = record {
btc_network = variant { Regtest };
ledger_id = principal \"$LEDGERID\";
ecdsa_key_name = \"dfx_test_key\";
retrieve_btc_min_amount = 10_000;
max_time_in_queue_nanos = 420_000_000_000;
min_confirmations = opt 12;
mode = variant { GeneralAvailability };
kyt_fee = opt 13_333;
kyt_principal = opt principal \"$KYTID\";
}
})" --mode=reinstall
echo "Step 3: deploying ledger canister..."
PRINCIPAL="$(dfx identity get-principal)"
dfx deploy ckbtc_ledger --network "$DFX_NETWORK" --argument "(variant {
Init = record {
token_symbol = \"ckBTC\";
token_name = \"Token ckBTC\";
minting_account = record { owner = principal \"$MINTERID\" };
transfer_fee = 11_500;
metadata = vec {};
initial_balances = vec { record { record { owner = principal \"$PRINCIPAL\"; }; 100_000_000_000; }; };
archive_options = record {
num_blocks_to_archive = 10_000;
trigger_threshold = 20_000;
controller_id = principal \"$PRINCIPAL\";
cycles_for_archive_creation = opt 4_000_000_000_000;
};
}
})" --mode=reinstall
dfx deploy ckbtc_kyt --network "$DFX_NETWORK" --argument "(variant {
InitArg = record {
minter_id = principal \"$MINTERID\";
maintainers = vec {};
mode = variant { AcceptAll };
}
})" --mode=reinstall
echo "Step 4: deploying index canister..."
dfx deploy ckbtc_index --network "$DFX_NETWORK" --argument "(record { ledger_id = principal \"$LEDGERID\" })" --mode=reinstall
# Example to mint ckBTC
# BTCADDRESS="$(dfx canister call ckbtc_minter get_btc_address '(record {subaccount=null;})')"
# dfx canister call ckbtc_minter update_balance '(record {subaccount=null;})'
# WITHDRAWALADDRESS="$(dfx canister call ckbtc_minter get_withdrawal_account)"
# echo $BTCADDRESS
# echo $WITHDRAWALADDRESS
#
# cleaned_output=$(echo $WITHDRAWALADDRESS | sed -re 's/^\(|, \)$//g')
#
# dfx canister call ckbtc_ledger icrc1_transfer "(record {from=null; to=$cleaned_output; amount=1000000; fee=null; memo=null; created_at_time=null;})"
#
# Execute the command to get the input string and save the result
# dfx canister call ckbtc_minter retrieve_btc '(record {fee = null; address="bcrt1qu9za0uzzd3kjjecgv7waqq0ynn8dl8l538q0xl"; amount=10000})'
echo "Step 5: transfer ckBTC to principal..."
# record { owner= principal “”;}
dfx canister call ckbtc_ledger --network "$DFX_NETWORK" icrc1_transfer "(record {from=null; to=record { owner= principal \"73avq-yvrvj-kuzxq-kttlj-nkaz4-tecy6-biuud-3ymeg-guvci-naire-uqe\";}; amount=100000000; fee=null; memo=null; created_at_time=null;})"