#!/usr/bin/fift -s "TonUtil.fif" include "Asm.fif" include "GetOpt.fif" include { show-options-help 1 halt } : usage Basechain =: wc // create smart contract in basechain 65536 =: timeout "new-dns-query.boc" =: savefile variable dns-dict dictnew dns-dict ! begin-options " [-w] [-t] [-o]" +cr +tab +"Creates a new manual dns smart contract with 32-bit identifier managed by private key .pk, " +"and saves it into ('" savefile $+ +"' by default)" disable-digit-options generic-help-setopt "w" "--workchain" { parse-workchain-id =: wc } short-long-option-arg "Selects workchain to create smart contract (" wc (.) $+ +" by default)" option-help "t" "--timeout" { parse-int =: timeout } short-long-option-arg "Sets expiration timeout for the initialization message in seconds (" timeout (.) $+ +" by default)" option-help "o" "--output" { =: savefile } short-long-option-arg "Sets output file for generated initialization message ('" savefile $+ +"' by default)" option-help "h" "--help" { usage } short-long-option "Shows a help message" option-help parse-options $# 2 <> ' usage if 2 :$1..n $1 =: file-base $2 parse-int dup =: contract-id 32 fits ' usage ifnot { contract-id (.) $+ } : +contractid ."Creating new manual DNS smart contract in workchain " wc . ."with contract id " contract-id . cr // Create new manual DNS; source code included from `auto/dns-manual-code.fif` "auto/dns-manual-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 savefile tuck B>file ."(Saved dns smart-contract creating query to file " type .")" cr