#!/usr/bin/fift -s "TonUtil.fif" include "Asm.fif" include { ."usage: " @' $0 type ." []" cr ."Creates a restricted lockup 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 $# 2- -2 and ' usage if -1 =: wc $1 parse-pubkey =: PubKey $2 $>GR =: amount def? $3 { @' $3 } { "rwallet" } cond constant file-base ."Creating new restricted lockup wallet in workchain " wc . ."controlled by public key " PubKey .pubkey ." with nominal amount " amount .GR cr // D x t -- D' { idict! not abort"cannot add value" } : rdict-entry // balance -- dict { dictnew over -32768 rdict-entry over 3/4 */ 92 rdict-entry over 1/2 */ 183 rdict-entry swap 1/4 */ 366 rdict-entry 0 548 rdict-entry } : make-rdict // Create new restricted wallet; code taken from `auto/restricted-wallet2-code.fif` "auto/restricted-wallet2-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