Last active
May 24, 2024 13:04
-
-
Save Rexagon/bb78a0b7686ea0be3e878bc0fca83fb2 to your computer and use it in GitHub Desktop.
Generates a simple hello-world contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"TonUtil.fif" include | |
"Asm.fif" include | |
"Lists.fif" include | |
"GetOpt.fif" include | |
{ show-options-help 1 halt } : usage | |
false =: tick | |
false =: tock | |
variable extra-currencies | |
{ extra-currencies @ cc+ extra-currencies ! } : extra-cc+! | |
begin-options | |
" <balance> [-x <extra-balance>*<extra-currency-id>] [--tick] [--tock]" +cr +cr | |
+"Creates a state for a tick-tock account" +cr | |
disable-digit-options generic-help-setopt | |
"--tick" { true =: tick } long-option | |
"Enables tick trigger" option-help | |
"--tock" { true =: tock } long-option | |
"Enables tock trigger" option-help | |
"x" "--extra" { $>xcc extra-cc+! } short-long-option-arg | |
"Indicates the balance in extra currencies" option-help | |
"h" "--help" { usage } short-long-option | |
"Shows a help message" option-help | |
parse-options | |
$# 1 < ' usage if | |
$1 $>cc extra-cc+! extra-currencies @ 2=: balance | |
<b b{110000} s, 0 64 u, 0 32 u, 0 2 u, 0 32 u, "Hello, world!" $, b> constant ext_msg | |
PROGRAM{ | |
recv_internal x{} PROC | |
run_ticktock PROC:<{ | |
ext_msg PUSHREF ZERO SENDRAWMSG | |
}> | |
}END>c constant code | |
<b b{01} s, tick 1 u, tock 1 u, b{100} s, code ref, b> constant state_init | |
// b account - b | |
{ swap b{100} s, -1 8 i, swap 256 u, } : addr_std, | |
// b state_init - b | |
{ swap 0 64 u, balance Gram+cc, b{1} s, swap <s s, } : account_storage, | |
// b - b | |
{ b{000000000} s, 0 32 u, b{0} s, } : storage_info, | |
<b b{1} s, | |
state_init hashu addr_std, | |
storage_info, | |
state_init account_storage, | |
b> boc>base64 type cr |
Author
Rexagon
commented
May 24, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment