Ton

Форк
0
/
new-highload-wallet.fif 
44 строки · 1.8 Кб
1
#!/usr/bin/fift -s
2
"TonUtil.fif" include
3
"Asm.fif" include
4

5
{ ."usage: " @' $0 type ." <workchain-id> <subwallet-id> [<filename-base>]" cr
6
  ."Creates a new high-load wallet in the specified workchain, with the controlling private key saved to or loaded from <filename-base>.pk "
7
  ."('new-wallet.pk' by default)" cr 
8
  ."<subwallet-id> is the 32-bit identifier of this subwallet among all controlled by the same private key" cr 1 halt
9
} : usage
10
$# 2- -2 and ' usage if
11

12
$1 parse-workchain-id =: wc    // set workchain id from command line argument
13
$2 parse-int dup =: subwallet-id   // parse subwallet-id
14
32 fits ' usage ifnot
15
{ subwallet-id (.) $+ } : +subwallet
16
def? $3 { @' $3 } { "new-wallet" } cond constant file-base
17

18
."Creating new high-load wallet in workchain " wc . 
19
."with subwallet id " subwallet-id . cr
20

21
// Create new high-load wallet; source code included from `auto/highload-wallet-code.fif`
22
"auto/highload-wallet-code.fif" include
23
// code
24
<b 0 32 u, subwallet-id 32 i,
25
   file-base +".pk" load-generate-keypair
26
   constant wallet_pk
27
   B, 
28
b> // data
29
null // no libraries
30
<b b{0011} s, 3 roll ref, rot ref, swap dict, b>  // create StateInit
31
dup ."StateInit: " <s csr. cr
32
dup hashu wc swap 2dup 2constant wallet_addr
33
."new wallet address = " 2dup .addr cr
34
2dup file-base +subwallet +".addr" save-address-verbose
35
."Non-bounceable address (for init): " 2dup 7 .Addr cr
36
."Bounceable address (for later access): " 6 .Addr cr
37
<b subwallet-id 32 i, -1 32 i, 0 32 u, false 1 i, b>
38
dup ."signing message: " <s csr. cr
39
dup hashu wallet_pk ed25519_sign_uint rot
40
<b b{1000100} s, wallet_addr addr, b{000010} s, swap <s s, b{0} s, swap B, swap <s s, b>
41
dup ."External message for initialization is " <s csr. cr
42
2 boc+>B dup Bx. cr
43
file-base +subwallet +"-query.boc" tuck B>file
44
."(Saved wallet creating query to file " type .")" cr
45

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.