6
// only the next three lines differ in elector/configuration smart contract upgrades
8
"auto/elector-code.fif" =: src-file
11
86400 30 * =: expire-in
15
{ show-options-help 1 halt } : usage
19
" [-s <fift-asm-code>] [-x <expire-in>] [-H <old-hash>] [<savefile>]" +cr +tab
20
+"Creates a new configuration proposal for upgrading the " +name +" smart contract code to <fift-asm-code> ('" src-file $+ +"' by default), "
21
+"and saves it as an internal message body into <savefile>.boc ('config-msg-body.boc' by default)"
22
disable-digit-options generic-help-setopt
23
"x" "--expires-in" { parse-int =: expire-in } short-long-option-arg
24
"Sets proposal expiration time in seconds (default " expire-in (.) $+ +")" option-help
25
"s" "--source" { =: src-file } short-long-option-arg
26
"Fift assembler source file for the new " +name +" smart contract code ('"
27
src-file $+ +"' by default)" option-help
28
"H" "--old-hash" { (hex-number) not abort"256-bit hex number expected as hash" =: old-hash }
30
"Sets the required cell hash of existing parameter value (0 means no value)" option-help
31
"h" "--help" { usage } short-long-option
32
"Shows a help message" option-help
38
$1 "config-msg-body.boc" replace-if-null =: savefile
39
expire-in now + =: expire-at
41
."Assembling new " name type ." smart contract code from " src-file type cr
43
dup <s 12 u@ 0xFF0 <> abort"not valid smart contract code"
44
<b swap ref, b> =: param-value
46
critical { ."Critical" } { ."Non-critical" } cond
47
." configuration proposal for configuration parameter " param-idx .
48
."will expire at " expire-at . ."(in " expire-in . ."seconds)" cr
50
now 32 << param-idx + =: query-id
51
."Query id is " query-id . cr
54
<b x{6e565052} s, query-id 64 u, expire-at 32 u,
55
<b x{f3} s, param-idx 32 i, param-value dict,
56
old-hash tuck 0>= tuck 1 i, -rot { 256 u, } { drop } cond b> ref,
59
dup ."resulting internal message body: " <s csr. cr
61
param-value totalcsize swap ."(a total of " . ."data bits, " . ."cell references -> "
62
drop dup Blen . ."BoC data bytes)" cr
65
."(Saved to file " type .")" cr