-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.sh
More file actions
137 lines (120 loc) · 4.03 KB
/
Copy pathdeploy.sh
File metadata and controls
137 lines (120 loc) · 4.03 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
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
#!/usr/bin/env bash
set -euo pipefail
dfx start --clean --background --host 127.0.0.1:5000
sleep 5
dfx canister create website_backend
CANISTER_BACKEND=$(dfx canister id website_backend)
dfx canister create dyahai_token
CANISTER_TOKEN=$(dfx canister id dyahai_token)
IDENTITY=$(dfx identity get-principal)
LOGO_BASE64=$(cat logo.txt)
dfx deploy internet_identity
cat > init-args-nft.did <<EOF
(
record {
icrc3_args = opt record {
maxRecordsToArchive = 4_000 : nat;
archiveIndexType = variant { Stable };
maxArchivePages = 62_500 : nat;
settleToRecords = 2_000 : nat;
archiveCycles = 2_000_000_000_000 : nat;
maxActiveRecords = 4_000 : nat;
maxRecordsInArchiveInstance = 5_000_000 : nat;
archiveControllers = null;
supportedBlocks = vec {};
};
icrc37_args = opt record {
deployer = principal "$CANISTER_BACKEND";
max_approvals = opt (100 : nat);
max_approvals_per_token_or_collection = opt (10 : nat);
settle_to_approvals = null;
max_revoke_approvals = null;
collection_approval_requires_token = opt true;
};
icrc7_args = opt record {
deployer = principal "$CANISTER_BACKEND";
allow_transfers = opt true;
supply_cap = null;
tx_window = null;
burn_account = null;
default_take_value = opt (1_000 : nat);
logo = opt "https://cdn.jsdelivr.net/gh/DyahCode/dyahai-assets@main/logo/DyahAI-logo.svg";
permitted_drift = null;
name = opt "DyahAI NFT";
description = opt "A Collection of Generative Image by DyahAI";
max_take_value = opt (10_000 : nat);
max_update_batch_size = opt (100 : nat);
max_query_batch_size = opt (100 : nat);
max_memo_size = opt (512 : nat);
supported_standards = null;
symbol = opt "DNFT";
};
},
)
EOF
dfx deploy nft --argument-file init-args-nft.did
CANISTER_NFT=$(dfx canister id nft)
dfx deploy website_backend --argument "(opt variant { Init = record { canister_ledger_token = \"$CANISTER_TOKEN\"; canister_ledger_nft = \"$CANISTER_NFT\"; } })"
cat > init-args.did <<EOF
(
variant {
Init = record {
decimals = opt (8 : nat8);
token_symbol = "DYA";
transfer_fee = 10_000 : nat;
metadata = vec {
record {
"icrc1:logo";
variant {
Text = "$LOGO_BASE64"
};
};
};
minting_account = record {
owner = principal "$IDENTITY";
subaccount = null;
};
initial_balances = vec {
record {
record {
owner = principal "$CANISTER_BACKEND";
subaccount = null;
};
10_000_000_000_299_890_000 : nat;
};
};
fee_collector_account = null;
archive_options = record {
num_blocks_to_archive = 0 : nat64;
max_transactions_per_response = null;
trigger_threshold = 2_000 : nat64;
more_controller_ids = null;
max_message_size_bytes = null;
cycles_for_archive_creation = null;
node_max_memory_size_bytes = null;
controller_id = principal "$IDENTITY";
};
max_memo_length = null;
token_name = "Dyah AI";
feature_flags = null;
}
},
)
EOF
dfx deploy dyahai_token --argument-file init-args.did
cat > init-args-index.did <<EOF
(opt variant { Init = record { ledger_id = principal "$CANISTER_TOKEN"; retrieve_blocks_from_ledger_interval_seconds = opt 10; } })
EOF
dfx deploy dyahai_token_index --argument-file init-args-index.did
CANISTER_TOKEN_INDEX=$(dfx canister id dyahai_token_index)
sed -i '/^MINTER_PRINCIPAL_ID=/d' .env 2>/dev/null || true
sed -i "1iMINTER_PRINCIPAL_ID='$IDENTITY'" .env
dfx deploy website_frontend
CANISTER_FRONTEND=$(dfx canister id website_frontend)
rm -f init-args.did init-args-index.did init-args-nft.did
echo "Backend Canister ID : $CANISTER_BACKEND"
echo "Frontend Canister ID: $CANISTER_FRONTEND"
echo "Token Canister ID : $CANISTER_TOKEN"
echo "Nft Canister ID : $CANISTER_NFT"
echo "Token Index Canister: $CANISTER_TOKEN_INDEX"
echo "Identity Principal : $IDENTITY"