Ton

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

5
{ ."usage: " @' $0 type ." <public-key> [<savefile>]" cr
6
  ."Creates a restricted wallet in the masterchain controlled by the private key corresponding to the specified public key" cr
7
  ."and saves its address into <savefile>.addr ('rwallet.addr' by default)" cr 1 halt
8
} : usage
9
$# 1- -2 and ' usage if
10

11
-1 =: wc
12
$1 parse-pubkey =: PubKey
13
def? $2 { @' $2 } { "rwallet" } cond constant file-base
14

15
."Creating new restricted wallet in workchain " wc . ."controlled by public key " PubKey .pubkey cr
16

17
// Create new restricted wallet; code taken from `auto/restricted-wallet-code.fif`
18
"auto/restricted-wallet-code.fif" include  // code
19
<b 0 32 u, PubKey 256 u, b> // data
20
null // no libraries
21
<b b{0011} s, 3 roll ref, rot ref, swap dict, b>  // create StateInit
22
dup ."StateInit: " <s csr. cr
23
dup hashu wc swap 2dup 2constant wallet_addr
24
."new wallet address = " 2dup .addr cr
25
2dup file-base +".addr" save-address-verbose
26
."Non-bounceable address (for init): " 2dup 7 .Addr cr
27
."Bounceable address (for later access): " 6 .Addr cr
28
<b b{1000100} s, wallet_addr addr, b{000010} s, swap 
29
  <s s, b{0} s, 0 256 u, 0 256 u, 0 32 u, -1 32 i, b>
30
dup ."External message for initialization is " <s csr. cr
31
2 boc+>B dup Bx. cr
32
file-base +"-query.boc" tuck B>file
33
."(Saved wallet creating query to file " type .")" cr
34

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

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

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

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