#!/usr/bin/fift -s "TonUtil.fif" include "Asm.fif" include { ."usage: " @' $0 type ." []" cr ."Creates a restricted wallet in the masterchain controlled by the private key corresponding to the specified public key" cr ."and saves its address into .addr ('rwallet.addr' by default)" cr 1 halt } : usage $# 1- -2 and ' usage if -1 =: wc $1 parse-pubkey =: PubKey def? $2 { @' $2 } { "rwallet" } cond constant file-base ."Creating new restricted wallet in workchain " wc . ."controlled by public key " PubKey .pubkey cr // Create new restricted wallet; code taken from `auto/restricted-wallet-code.fif` "auto/restricted-wallet-code.fif" include // code // data null // no libraries // create StateInit dup ."StateInit: " dup ."External message for initialization is " B dup Bx. cr file-base +"-query.boc" tuck B>file ."(Saved wallet creating query to file " type .")" cr