#!/usr/bin/fift -s "TonUtil.fif" include "Asm.fif" include { ."usage: " @' $0 type ." []" cr ."Creates a new high-load wallet in the specified workchain, with the controlling private key saved to or loaded from .pk " ."('new-wallet.pk' by default)" cr ." is the 32-bit identifier of this subwallet among all controlled by the same private key" cr 1 halt } : usage $# 2- -2 and ' usage if $1 parse-workchain-id =: wc // set workchain id from command line argument $2 parse-int dup =: subwallet-id // parse subwallet-id 32 fits ' usage ifnot { subwallet-id (.) $+ } : +subwallet def? $3 { @' $3 } { "new-wallet" } cond constant file-base ."Creating new high-load wallet in workchain " wc . ."with subwallet id " subwallet-id . cr // Create new high-load wallet; source code included from `highload-wallet-code.fif` "highload-wallet-code.fif" include // code // data null // no libraries // create StateInit dup ."StateInit: " dup ."signing message: " dup ."External message for initialization is " B dup Bx. cr file-base +subwallet +"-query.boc" tuck B>file ."(Saved wallet creating query to file " type .")" cr