From 5bcadf1bd47ca359ef4a2f905e8691c873b3b42c Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 11 Jun 2023 15:21:20 +0500 Subject: [PATCH] Created wallet-v5r1 with tests --- .gitignore | 5 +- README.md | 7 - build.py | 60 + build/boc/plugin-tester.boc | Bin 0 -> 72 bytes build/boc/plugin-tester.hex | 1 + build/boc/plugin.boc | Bin 0 -> 106 bytes build/boc/plugin.hex | 1 + build/boc/registry.boc | Bin 0 -> 339 bytes build/boc/registry.hex | 1 + build/boc/wallet.boc | Bin 0 -> 1255 bytes build/boc/wallet.hex | 1 + build/plugin-tester.fif | 181 ++ build/plugin.fif | 193 ++ build/plugin_tests.fif | 2155 ++++++++++++++++++++++ build/registry.fif | 323 ++++ build/registry_tests.fif | 2314 +++++++++++++++++++++++ build/wallet.fif | 690 +++++++ build/wallet_tests.fif | 2734 ++++++++++++++++++++++++++++ fift/block-sigs-raw.txt | 168 ++ fift/config-validators.boc | Bin 0 -> 20136 bytes fift/exotic.fif | 19 + func/build.sh | 4 - func/plugin.fc | 15 + func/print-hex.fif | 13 - func/registry.fc | 104 ++ func/simple-subscription-plugin.fc | 179 -- func/stdlib.fc | 425 ++++- func/wallet-v4-code.fc | 198 -- func/wallet-v5-code.fc | 200 -- func/wallet.fc | 285 +++ project.yaml | 24 + show-log.py | 120 ++ test-wallet-v5.ts | 37 + tests/plugin.fc | 71 + tests/registry.fc | 47 + tests/wallet.fc | 69 + wallet-v5.ts | 198 ++ 37 files changed, 10234 insertions(+), 608 deletions(-) delete mode 100644 README.md create mode 100644 build.py create mode 100644 build/boc/plugin-tester.boc create mode 100644 build/boc/plugin-tester.hex create mode 100644 build/boc/plugin.boc create mode 100644 build/boc/plugin.hex create mode 100644 build/boc/registry.boc create mode 100644 build/boc/registry.hex create mode 100644 build/boc/wallet.boc create mode 100644 build/boc/wallet.hex create mode 100644 build/plugin-tester.fif create mode 100644 build/plugin.fif create mode 100644 build/plugin_tests.fif create mode 100644 build/registry.fif create mode 100644 build/registry_tests.fif create mode 100644 build/wallet.fif create mode 100644 build/wallet_tests.fif create mode 100644 fift/block-sigs-raw.txt create mode 100644 fift/config-validators.boc create mode 100644 fift/exotic.fif delete mode 100755 func/build.sh create mode 100644 func/plugin.fc delete mode 100644 func/print-hex.fif create mode 100644 func/registry.fc delete mode 100644 func/simple-subscription-plugin.fc delete mode 100644 func/wallet-v4-code.fc delete mode 100644 func/wallet-v5-code.fc create mode 100644 func/wallet.fc create mode 100644 project.yaml create mode 100644 show-log.py create mode 100644 test-wallet-v5.ts create mode 100644 tests/plugin.fc create mode 100644 tests/registry.fc create mode 100644 tests/wallet.fc create mode 100644 wallet-v5.ts diff --git a/.gitignore b/.gitignore index 770259c..4f3942e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -.idea/ -func/*.boc \ No newline at end of file +*.pk +toncli.log +toncli.err diff --git a/README.md b/README.md deleted file mode 100644 index 7cd6fe4..0000000 --- a/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Wallet V5 -Wallet v5 is custom version of wallet for use instead of v4. - -There are two main differences from previous versions: -1. execute arbitrary code onchain. User can pass a continuation to be executed -- this is useful for predicting unsafe random. -2. plugin functionality: plugins are continuations, like small inlined contracts. They may be executed upon getting an incoming message. - Actual plugin's code is stored in masterchain, so that plugins are just masterchain libraries. diff --git a/build.py b/build.py new file mode 100644 index 0000000..1e2d34c --- /dev/null +++ b/build.py @@ -0,0 +1,60 @@ +#!/usr/bin/python3 +import base64 +import shutil +import sys +import os + +FIFT_LIBS_LIST = 'Fift Asm AsmTests TonUtil Lists Color'.split(' ') +CONTRACTS_LIST = 'plugin registry wallet'.split(' ') + +ap = os.path.abspath + +base_path = ap(__file__ + '/../') +fift_path = os.environ['FIFTPATH'] + +print('====== Starting build ====================') + +os.system('cls') # clears screen + enables escape sequences + +for fift_lib in FIFT_LIBS_LIST: + shutil.copy(ap(f'{fift_path}toncli/lib/fift-libs/{fift_lib}.fif'), + ap(f'{base_path}/{fift_lib}.fif')) + +print('====== Loaded libs for toncli ============') + +with open(ap(base_path + '/fift/exotic.fif')) as f: + exotic_patch = f.read() + +with open(ap(base_path + '/Asm.fif'), 'a') as f: f.write(exotic_patch) +with open(ap(base_path + '/AsmTests.fif'), 'a') as f: f.write(exotic_patch) + +print('====== Patched Fift libraries ============') + +os.chdir(base_path) +os.system('toncli run_tests >toncli.log 2>toncli.err') +os.system('python show-log.py') + +print('====== Ran tests =========================') + +os.system('toncli build') + +print('====== Built contract in prod mode =======') + +for contract in CONTRACTS_LIST: + with open(ap(base_path + f'/build/{contract}.fif'), 'a') as f: + f.write(f'\nboc>B "build/boc/{contract}.boc" B>file') + os.system(f'toncli fift run build/{contract}.fif') + + with open(ap(f'build/boc/{contract}.boc'), 'rb') as rf: + boc = rf.read() + print(f'====== BOC of {repr(contract)} is {len(boc)} B') + with open(ap(f'build/boc/{contract}.hex'), 'wb') as wf: + wf.write(base64.b16encode(boc)) + + print(f'====== Saved {repr(contract)} in BOC and HEX representation') + +if '--noclean' not in sys.argv: + for fift_lib in FIFT_LIBS_LIST: + os.remove(ap(f'{base_path}/{fift_lib}.fif')) + + print('====== Deleted Fift libs =================') diff --git a/build/boc/plugin-tester.boc b/build/boc/plugin-tester.boc new file mode 100644 index 0000000000000000000000000000000000000000..421eae3c53d0b5bdb34bc083804935feb79e36ad GIT binary patch literal 72 zcmV-O0Js0O?woP~0RjO4Jpcg|{{Zx)6ZE|D$O{1gT+@Q^)4)9=FYZvw@0gq3FuynV eN%L4q-L`jnMOa@+Gh4d0a>&aE%l~oDBl`rNvm)*Q literal 0 HcmV?d00001 diff --git a/build/boc/plugin-tester.hex b/build/boc/plugin-tester.hex new file mode 100644 index 0000000..9bdff35 --- /dev/null +++ b/build/boc/plugin-tester.hex @@ -0,0 +1 @@ +B5EE9C7201010201003D000114FF00F4A413F4BCF2C80B01005CD382F0D3C03D232FEE50CBEF989BDE30BF37F749F35849DDB6777A45585F49335BBAB672C8CB07CBFF71CF23FB04 \ No newline at end of file diff --git a/build/boc/plugin.boc b/build/boc/plugin.boc new file mode 100644 index 0000000000000000000000000000000000000000..b09d60e6181f81b2bc9deaac83bc343cc2645c66 GIT binary patch literal 106 zcmV-w0G0o>?woP~0SEyAUjP9V{{Zx)6ZE|D$O{1i0b&9J01D8A5AyH=0U!hg01LkA zxA6gl0s?gg2LMg2%f^H-0?LQ8)lqmIvrVg%TdDf@%&VvZGN`T+zG0gCEP^6dwm<+8 MtzU_+f&UN~Ktob0m;e9( literal 0 HcmV?d00001 diff --git a/build/boc/plugin.hex b/build/boc/plugin.hex new file mode 100644 index 0000000..2db980b --- /dev/null +++ b/build/boc/plugin.hex @@ -0,0 +1 @@ +B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840 \ No newline at end of file diff --git a/build/boc/registry.boc b/build/boc/registry.boc new file mode 100644 index 0000000000000000000000000000000000000000..ab2206a031d98627053aea805d44f17831e98bd7 GIT binary patch literal 339 zcmV-Z0j&PD?woP~0tEp80Y?A<6#oG9q!aYK^2iGT0s&$I0|EBXGa}bX!64%Z(9;6} zaj@eEgbxGL9|3|8L;uuIx)k#C0@N@df(hX>fB}L5hM@UDFj#;R_%m<;fFSe?Z=o=N zDAytQDEdS&!2gtk2G=3p(?0{K0@FV*Py?u-0jR4Ff)EDU!oZ*sp&-Kl^5BB)L?F<| z0Fp3m-Xa75i=e~{1QWt%00RUA4MFmPV6gxt@Mhox072*&-$G#kQLaPqQS^vmf&VE6 z4X#7IrhW%d1*U#rpa)Sv15s8V1RxEyg@Hi;+W7z@0)q$i7wuFba{C5v08$`=0n?Xn zjA*5$_7SkD%M5C!$&0Qv&UYRPc> l00H>`f)K<1)K7pI$jb!;`am!g&lXtv0usxP%m2x6`vBa`j>`Z5 literal 0 HcmV?d00001 diff --git a/build/boc/registry.hex b/build/boc/registry.hex new file mode 100644 index 0000000..454d399 --- /dev/null +++ b/build/boc/registry.hex @@ -0,0 +1 @@ +B5EE9C7201020501000147000114FF00F4A413F4BCF2C80B01020162020301F6D03322D749C120E308D0D3030171B0E308840F03D31F01821043FFD44FBA14F2F402D430208209E1338001820186A0F94130588012F83370018020F40C6FA1308028D721F828FA4430C0FF948306D721DED33F03A802D33F305003A8A001A8AB0F821006DAC2C0A012A120C2FFF2E082ED4420D0C70092306DDE2204008BA0C40B0413C267000304030D41F28260B10025F066E0030041E818DF42610051AE43F051F4886181FF29060DAE43BDA67E075005A67E60A00751400351561F04200DB585814100DAF90023028307F417ED542172FB066F0052208201D3976F8C68A5A5F87E8100FF6F8420A461D0DB400168F85EA16F806F1020FA445B708018C8CB0558CF16821005F5E100FA02CB6AC970FB0001F9008210C3FFD44F8018C8CB0504FA403014CF1658FA0212CB8ECBFFC970FB00 \ No newline at end of file diff --git a/build/boc/wallet.boc b/build/boc/wallet.boc new file mode 100644 index 0000000000000000000000000000000000000000..3032b86f88479284bfc5bceeeed0e947ba9e852e GIT binary patch literal 1255 zcmdn`ZcY&+lM*8X%WVcmk^c-|mI!~@^XUXPBNL+n6EhQ|2Ma6XqfeLR6`KTHIlaH` z>Pup55^%Yiv~^cs=v$Wym+il>d|_eyk$7323_v7wTAuN|*vYpc6Ad0c z=2c)~I>W{ebOH}All@IL3zkVg)EW8OW=L@NwoLk=&%ih1Cyzjz{J%xD*ClE=IGMh0 zV_vw-&Y4A__EP)fQlsP*j_btuRKGFG9&u(7{#yUGR7Nk!ah>=-l_jif{4cg8erQsK z(1&GffVw`%MBA6jq%gB6ToRnDSt{eYf_dRBn|llo?n_+s_WtmfiSgfk4o8neO#inP zT>P-t={`fE`qQTPBh1I7k1!wQ;%0bdn4@I$%fX2zwo>=P%Oadi@1X@ z)}UfIX9SCjNDKp!<3hl~JuRO_xQX%Be%$flY=G60N%1U?82%VuQT)je;v@oeqj-~m z^ZzUU4H73#vl8Rq^I}Z`oShjADovaZjT?Z8qHV!XM}vrh2B9Cu4GLd)@)sI3GOW0+ zc-fwL1=D4Fg8=3g3m8|d=3nrO>2#OSnUe*-85r2Uu!0gKA3u-~69*Ckf()uVPS#!V zBCTZ*+lxlH0c8kRXhp|#hWstap`D#0MTJ55YnP>@GtWjhOL)P#H0^g zgX%TjH1{`#T|hm|XA&4xH#|pm$C)z;KsQQA0tq>J2IDR3@2;37mHw|`UPFUDk5%#` zmh1-w3I7_O2{17gN=Y*WF6Fw%c&l^avicXCFF2S#9A0Lp;I@xl&EamkB^&=so%>!1 zNgM95FkeUn8Ym;nV7%z@R$*tK{}+TW2(UkF_o;E{t>NR5zhHCNi9vNyqz4y|{KcHZ z4_Uk*bQ{nGXKhhj@cO}g4g;_Y7-F|^@IH`5kp;Q0D24Z0;UR&9f0NFBS;k=XviE^E z?*j*0HUY+8hNwv~#6*M%lz5bzI2!Kx@0xAQe4YEh@K1qH56$`{n41Jr?!JD#YkC0l zPZ6NVG~syWPY2B(JpvXifg-y;J+x3>5>l*+HDUhX|H1Hub+SU<<|z>$xFcT}Ff9pC KR%Fn^su%!sW)FM- literal 0 HcmV?d00001 diff --git a/build/boc/wallet.hex b/build/boc/wallet.hex new file mode 100644 index 0000000..26c2c25 --- /dev/null +++ b/build/boc/wallet.hex @@ -0,0 +1 @@ +B5EE9C72010222010004DB000114FF00F4A413F4BCF2C80B010201200203020148040501E2F2D31F21821045094BF5BA8E6201821044D562B5BA8E55ED44D0D33FF404F40401F861D31F04D3FF51138307F40FF2E12CD0ED1E016F0182015D566F8C68A5A5F87E8100FF6F8420A461017FDB3868F85EA16F80305502F84104C8CB3F13F40013F40012CB1F01CF16C9ED549130E2E30D200202CC06070201200C0D023FD906380492F827010E8698180B8D8492F82F000E98F90C10861FFEA27DD7187C080902F7B603A1A63E4304207DD287E3753263A841AE160E25F6011DC4430413F57FED751C2E6241AE17FE24A405060FE8B661F08225060FE8B661F0C31D7C430420F35C5B3F751C64030420D2119329751C45A803A1DA3CDE00E0DF18D14B4BF0FD0201FEDF084148C202FFB670D1F0BD42DF006127E5825FC403C61BC403C50A0B00EA316C2232FA40308D0867FF2895FF484C3E78684A0D6D77F4F39248815FBF588D6175153B699FF1093F94C4C705B3E308ED44D0D33FF404F40401F861D31F04D3FF3053028307F40F31B3E30872C8CB075210CBFF71CF230283075042F4174013F84104C8CB3F13F40013F40012CB1F01CF16C9ED5400CE32821044D562B5BA8E59ED44D0D33FF404F40401F861D31F04D3FF51138307F40FF2E12CD0ED1E103847666F04138201DABF6F8C68A5A5F87E8100FF6F8420A461017FDB3868F85EA16F80304330F84104C8CB3F13F40013F40012CB1F01CF16C9ED54925F04E200FC31D421F9005442148307F417821043FFD44F8018C8CB058D0867FF2895FF484C3E78684A0D6D77F4F39248815FBF588D6175153B699FF1093F94C4CF16821009896800248209E1338001820186A0F9413058708012F8338020F40C6FA1308100A8D721D33F03A802D33F305003A8A001A8AB0FA0FA02CB8A12CCC970FB000006F405010201200E0F020120161702012010110025B8C97ED44D0D33FF404F40401F861D31F5F03802012012130201201415005FB0C59BC03B513434CFFD013D01007E1874C7C408D7C0E4C81BACE38460C1FD259BE94C0075D3341BC0961BC0807A0C200073B2695BC03B513434CFFD013D01007E1874C7C408D7C0E4C81BACE386E0C1FD259BE94C3E10548420C1FD03CC00B5D334161BC0D61BC0807A0C200033B29DFB513434CFFD013D01007E1874C7C408D7C0E0C1FD03CC600025B0E73B513434CFFD013D01007E1874C7CCCC6002012018190201201E1F0033B4AFDDA89A1A67FE809E80803F0C3A63E2046BE07060FE81E6100202711A1B0051A50ADE01DA89A1A67FE809E80803F0C3A63E2046BE072640DD6739060FE92CDF4A6062B0DE0403D0610201201C1D0033A2E3B513434CFFD013D01007E1874C7C408D7C0E0C1FD03CC3420025A259480A0C1FD16CC3E1044A0C1FD16CC3E1860033B4CD3DA89A1A67FE809E80803F0C3A63EBE09F083060FE81E610005DB6080DE01DA89A1A67FE809E80803F0C3A63E2046BE072640DD671C21060FE92CDF4A6003AE98DE04B0DE0403D061001FA31ED44D0D33FF404F40401F861D31F54341402D421F90023820880DE4FBA9B3303D70BFF13F910F2E1368E1803821064DDEBEBBA975003F914F2E13696135F03F2C137E2E2D0D33F5114BAF2E13823A4547325F84104C8CB3F13F40013F40012CB1F01CF16C9ED54F80FF800F40593206EB39458F00B59E83002A4502321002AF84104C8CB3F13F40013F40012CB1F01CF16C9ED54 \ No newline at end of file diff --git a/build/plugin-tester.fif b/build/plugin-tester.fif new file mode 100644 index 0000000..3dbe49c --- /dev/null +++ b/build/plugin-tester.fif @@ -0,0 +1,181 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `D:\TON_FunC\multisig-wallet-v5\func\plugin-tester.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + DECLPROC main + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + main PROC:<{ + // + 95777667642679660377467689763779873824204430231994672328435264094237668129462 PUSHINT // _1=95777667642679660377467689763779873824204430231994672328435264094237668129462 + 2 PUSHINT // _1=95777667642679660377467689763779873824204430231994672328435264094237668129462 _2=2 + NEWC // _1=95777667642679660377467689763779873824204430231994672328435264094237668129462 _2=2 _3 + 8 STU // _1=95777667642679660377467689763779873824204430231994672328435264094237668129462 _5 + 256 STU // _7 + ONE ENDXC // code + SETCODE + }> +}END>c + +boc>B "build/boc/plugin-tester.boc" B>file +boc>B "build/boc/plugin-tester.boc" B>file +boc>B "build/boc/plugin-tester.boc" B>file \ No newline at end of file diff --git a/build/plugin.fif b/build/plugin.fif new file mode 100644 index 0000000..e265993 --- /dev/null +++ b/build/plugin.fif @@ -0,0 +1,193 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `D:\TON_FunC\multisig-wallet-v5\func\plugin.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + DECLPROC main + 119703 DECLMETHOD creator_address + 121535 DECLMETHOD process_internal + 89430 DECLMETHOD process_external + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + main PROC:<{ + // + 16 PUSHPOW2DEC // _0=65535 + THROWANY + }> + creator_address PROC:<{ + // + x{8016543D9EAA8BC0ED9A6D5CA2DD4FD7BE655D401195457095F30CD7D9641112B5B_} PUSHSLICE // _0 + }> + process_internal PROC:<{ + // balance msg_value in_msg in_msg_body + s1 s3 XCHG + 3 BLKDROP // in_msg + s0 DUMP // _5 + DROP // + }> + process_external PROC:<{ + // in_msg_body + s0 DUMP // _2 + DROP // + }> +}END>c + +boc>B "build/boc/plugin.boc" B>file \ No newline at end of file diff --git a/build/plugin_tests.fif b/build/plugin_tests.fif new file mode 100644 index 0000000..3d02ae8 --- /dev/null +++ b/build/plugin_tests.fif @@ -0,0 +1,2155 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\1.address_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\bad_messages_generator.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\c5_parse_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\message_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\storage-test-helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\tests-helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\token-helpers.func` `D:\TON_FunC\multisig-wallet-v5\func\plugin.fc` `D:\TON_FunC\multisig-wallet-v5\tests\plugin.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + 114362 DECLMETHOD generate_empty_address + 103563 DECLMETHOD generate_internal_address + 71142 DECLMETHOD generate_internal_address_with_custom_data + 105789 DECLMETHOD generate_external_address + 77760 DECLMETHOD generate_external_address_with_custom_data + 119020 DECLMETHOD generate_var_address + 101577 DECLMETHOD generate_var_address_with_custom_data + DECLPROC generate_any_address + 76887 DECLMETHOD generate_external_out_message_with_bad_source_address + 113901 DECLMETHOD generate_external_out_message_with_bad_destination_address + 124331 DECLMETHOD generate_external_in_message_with_bad_source_address + 128854 DECLMETHOD generate_external_in_message_with_bad_destination_address + 122899 DECLMETHOD generate_internal_message_with_bad_grams_data + 105345 DECLMETHOD generate_internal_message_with_bad_init_state_data + DECLPROC parse_send_raw_message + DECLPROC parse_lib_code + DECLPROC parse_raw_reserve + DECLPROC parse_set_code + DECLPROC parse_c5 + DECLPROC generate_init_state + DECLPROC generate_init_state_with_data + DECLPROC parse_init_state + DECLPROC random_query_id + DECLPROC generate_internal_message_body + DECLPROC generate_internal_message_custom + DECLPROC generate_get_royalty_params + DECLPROC generate_nft_transfer_request + DECLPROC generate_nft_get_static_data_request + DECLPROC generate_nft_deploy_request + DECLPROC generate_jetton_burn_request + DECLPROC generate_jetton_burn_notification + DECLPROC generate_jetton_internal_transfer_request + DECLPROC generate_jetton_transfer_request + DECLPROC generate_internal_message + DECLPROC generate_internal_message_relaxed + DECLPROC generate_external_in_message + DECLPROC generate_external_in_message_with_empty_source_address + DECLPROC generate_external_out_message + DECLPROC generate_external_out_message_with_empty_destination_address + DECLPROC generate_external_out_message_relaxed + DECLPROC parse_internal_message + DECLPROC parse_external_message + 69682 DECLMETHOD init_environment + 104832 DECLMETHOD storage_key + 68533 DECLMETHOD load_storage_with_tag + 113134 DECLMETHOD save_storage_with_tag + 85860 DECLMETHOD get_c7 + 78457 DECLMETHOD invoke_method + 93676 DECLMETHOD invoke_method_expect_fail + 127733 DECLMETHOD assert_no_actions + DECLPROC token_snake_len + DECLPROC get_snake_tail + 103208 DECLMETHOD snake_concat + DECLPROC snake_concat_tagged + DECLPROC snake_equal? + DECLPROC main + 119703 DECLMETHOD creator_address + 121535 DECLMETHOD process_internal + 89430 DECLMETHOD process_external + DECLPROC novm::invoke + DECLPROC __test_donations_fail_transfer + DECLPROC __test_creator_address + DECLPROC __test_invoke_creator_address + DECLPROC __test_plugin_invoke_creator_address + DECLPROC __test_vminvoke_process_internal + DECLPROC __test_c7_get + DECLPROC __test_c7_tenth_get + DECLPROC __test_config_8 + DECLPROC __test_mycode_get + DECLPROC __test_mycode + DECLPROC __test_test_address + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + generate_empty_address PROC:<{ + // + 0 PUSHINT // _0=0 + NEWC // _0=0 _1 + 2 STU // _3 + ENDC // _4 + CTOS // _5 + }> + generate_internal_address PROC:<{ + // + RANDU256 // address + -1 PUSHINT // address _3=-1 + 0 PUSHINT // address _3=-1 _4=0 + 2 PUSHINT // address _3=-1 _4=0 _5=2 + NEWC // address _3=-1 _4=0 _5=2 _6 + 2 STU // address _3=-1 _4=0 _8 + 1 STU // address _3=-1 _10 + 8 STI // address _12 + 256 STU // _14 + ENDC // _15 + CTOS // address_cell + }> + generate_internal_address_with_custom_data PROC:<{ + // anycast workchain_id address + 2 PUSHINT // anycast workchain_id address _4=2 + NEWC // anycast workchain_id address _4=2 _5 + 2 STU // anycast workchain_id address _7 + s1 s3 XCHG // address workchain_id anycast _7 + 1 STU // address workchain_id _9 + 8 STI // address _11 + 256 STU // _13 + ENDC // _14 + CTOS // address_cell + }> + generate_external_address PROC:<{ + // address_length + RANDU256 // address_length address + 1 PUSHINT // address_length address _4=1 + NEWC // address_length address _4=1 _5 + 2 STU // address_length address _7 + s2 s(-1) PUXC // address_length address address_length _7 + 9 STU // address_length address _9 + ROT // address _9 address_length + STUX // _10 + ENDC // _11 + CTOS // address_cell + }> + generate_external_address_with_custom_data PROC:<{ + // address_length address + 1 PUSHINT // address_length address _3=1 + NEWC // address_length address _3=1 _4 + 2 STU // address_length address _6 + s2 s(-1) PUXC // address_length address address_length _6 + 9 STU // address_length address _8 + ROT // address _8 address_length + STUX // _9 + ENDC // _10 + CTOS // address_cell + }> + generate_var_address PROC:<{ + // address_length + DUP + 8 PUSHPOW2 // address_length address_length _1=256 + GREATER // address_length _2 + IFJMP:<{ // address_length + RANDU256 // address_length address + RANDU256 // address_length address address_secondpart + -1 PUSHINT // address_length address address_secondpart _8=-1 + 0 PUSHINT // address_length address address_secondpart _8=-1 _9=0 + 3 PUSHINT // address_length address address_secondpart _8=-1 _9=0 _10=3 + NEWC // address_length address address_secondpart _8=-1 _9=0 _10=3 _11 + 2 STU // address_length address address_secondpart _8=-1 _9=0 _13 + 1 STU // address_length address address_secondpart _8=-1 _15 + s1 s4 XCHG // _8=-1 address address_secondpart address_length _15 + 9 STU // _8=-1 address address_secondpart _17 + s1 s3 XCHG // address_secondpart address _8=-1 _17 + 8 STI // address_secondpart address _19 + 256 STU // address_secondpart _21 + 256 STU // _23 + ENDC // _24 + CTOS // address_cell + }> // address_length + RANDU256 // address_length address + -1 PUSHINT // address_length address _29=-1 + 0 PUSHINT // address_length address _29=-1 _30=0 + 3 PUSHINT // address_length address _29=-1 _30=0 _31=3 + NEWC // address_length address _29=-1 _30=0 _31=3 _32 + 2 STU // address_length address _29=-1 _30=0 _34 + 1 STU // address_length address _29=-1 _36 + s3 s(-1) PUXC // address_length address _29=-1 address_length _36 + 9 STU // address_length address _29=-1 _38 + 8 STI // address_length address _40 + ROT // address _40 address_length + STUX // _41 + ENDC // _42 + CTOS // address_cell + }> + generate_var_address_with_custom_data PROC:<{ + // anycast workchain_id address_length address_slice + OVER + 8 PUSHPOW2 // anycast workchain_id address_length address_slice address_length _4=256 + GREATER // anycast workchain_id address_length address_slice _5 + IFJMP:<{ // anycast workchain_id address_length address_slice + 256 LDU // anycast workchain_id address_length addr address_slice + 256 LDU // anycast workchain_id address_length addr _52 _51 + DROP // anycast workchain_id address_length addr addr_second_part + 3 PUSHINT // anycast workchain_id address_length addr addr_second_part _15=3 + NEWC // anycast workchain_id address_length addr addr_second_part _15=3 _16 + 2 STU // anycast workchain_id address_length addr addr_second_part _18 + s1 s5 XCHG // addr_second_part workchain_id address_length addr anycast _18 + 1 STU // addr_second_part workchain_id address_length addr _20 + s1 s2 XCHG // addr_second_part workchain_id addr address_length _20 + 9 STU // addr_second_part workchain_id addr _22 + s1 s2 XCHG // addr_second_part addr workchain_id _22 + 8 STI // addr_second_part addr _24 + 256 STU // addr_second_part _26 + 256 STU // _28 + ENDC // _29 + CTOS // address_cell + }> // anycast workchain_id address_length address_slice + 256 LDU // anycast workchain_id address_length _54 _53 + DROP // anycast workchain_id address_length addr + 3 PUSHINT // anycast workchain_id address_length addr _36=3 + NEWC // anycast workchain_id address_length addr _36=3 _37 + 2 STU // anycast workchain_id address_length addr _39 + s1 s4 XCHG // addr workchain_id address_length anycast _39 + 1 STU // addr workchain_id address_length _41 + s1 s(-1) PUXC // addr workchain_id address_length address_length _41 + 9 STU // addr workchain_id address_length _43 + s1 s2 XCHG // addr address_length workchain_id _43 + 8 STI // addr address_length _45 + SWAP // addr _45 address_length + STUX // _46 + ENDC // _47 + CTOS // address_cell + }> + generate_any_address PROC:<{ + // typeOfAddress + DUP // typeOfAddress typeOfAddress + 0 EQINT // typeOfAddress _2 + IFJMP:<{ // typeOfAddress + DROP // + generate_empty_address CALLDICT // _3 + }> // typeOfAddress + DUP // typeOfAddress typeOfAddress + 1 EQINT // typeOfAddress _5 + IFJMP:<{ // typeOfAddress + DROP // + generate_internal_address CALLDICT // _6 + }> // typeOfAddress + 2 EQINT // _8 + IFJMP:<{ // + 8 PUSHPOW2 // _9=256 + generate_external_address CALLDICT // _10 + }> // + 8 PUSHPOW2 // _11=256 + generate_var_address CALLDICT // _12 + }> + generate_external_out_message_with_bad_source_address PROC:<{ + // + 1 PUSHINT // _1=1 + -1 PUSHINT // _1=1 _2=-1 + 0 PUSHINT // _1=1 _2=-1 _3=0 + 2 PUSHINT // _1=1 _2=-1 _3=0 _4=2 + NEWC // _1=1 _2=-1 _3=0 _4=2 _5 + 2 STU // _1=1 _2=-1 _3=0 _7 + 1 STU // _1=1 _2=-1 _9 + 8 STI // _1=1 _11 + 10 STU // _13 + ENDC // _14 + CTOS // ssrc_invalid + 0 PUSHINT // ssrc_invalid _16=0 + 3 PUSHINT // ssrc_invalid _16=0 _17=3 + NEWC // ssrc_invalid _16=0 _17=3 _18 + 2 STU // ssrc_invalid _16=0 _20 + 1 STI // ssrc_invalid _22 + SWAP // _22 ssrc_invalid + STSLICER // _23 + ENDC // _24 + }> + generate_external_out_message_with_bad_destination_address PROC:<{ + // + generate_internal_address CALLDICT // ssrc + 0 PUSHINT // ssrc _2=0 + 3 PUSHINT // ssrc _2=0 _3=3 + NEWC // ssrc _2=0 _3=3 _4 + 2 STU // ssrc _2=0 _6 + ROT // _2=0 _6 ssrc + STSLICER // _2=0 _7 + 1 STI // _9 + ENDC // _10 + }> + generate_external_in_message_with_bad_source_address PROC:<{ + // + 0 PUSHINT // _1=0 + 7 PUSHPOW2 // _1=0 _2=128 + 1 PUSHINT // _1=0 _2=128 _3=1 + NEWC // _1=0 _2=128 _3=1 _4 + 2 STU // _1=0 _2=128 _6 + 9 STU // _1=0 _8 + 10 STU // _10 + ENDC // _11 + CTOS // ssrc_invalid + 2 PUSHINT // ssrc_invalid _13=2 + NEWC // ssrc_invalid _13=2 _14 + 2 STU // ssrc_invalid _16 + SWAP // _16 ssrc_invalid + STSLICER // _17 + ENDC // _18 + }> + generate_external_in_message_with_bad_destination_address PROC:<{ + // + 8 PUSHPOW2 // _1=256 + generate_external_address CALLDICT // ssrc + 0 PUSHINT // ssrc _3=0 + 2 PUSHINT // ssrc _3=0 _4=2 + NEWC // ssrc _3=0 _4=2 _5 + 2 STU // ssrc _3=0 _7 + ROT // _3=0 _7 ssrc + STSLICER // _3=0 _8 + 1 STI // _10 + ENDC // _11 + }> + generate_internal_message_with_bad_grams_data PROC:<{ + // + generate_internal_address CALLDICT // ssrc + generate_internal_address CALLDICT // ssrc sdest + 1 PUSHINT // ssrc sdest _4=1 + 8 PUSHINT // ssrc sdest _4=1 _5=8 + 0 PUSHINT // ssrc sdest _4=1 _5=8 _6=0 + s0 s0 s0 PUSH3 // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _9=0 + NEWC // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _9=0 _10 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _12 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _7=0 _14 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _16 + 1 STU // ssrc sdest _4=1 _5=8 _18 + s0 s4 XCHG2 // _5=8 sdest _4=1 _18 ssrc + STSLICER // _5=8 sdest _4=1 _19 + ROT // _5=8 _4=1 _19 sdest + STSLICER // _5=8 _4=1 _20 + s1 s2 XCHG // _4=1 _5=8 _20 + 4 STU // _4=1 _22 + 1 STU // _24 + ENDC // _25 + }> + generate_internal_message_with_bad_init_state_data PROC:<{ + // + generate_internal_address CALLDICT // ssrc + generate_internal_address CALLDICT // ssrc sdest + 1 PUSHINT // ssrc sdest _5=1 + s0 s0 PUSH2 // ssrc sdest _5=1 _6=1 _7=1 + 0 PUSHINT // ssrc sdest _5=1 _6=1 _7=1 _8=0 + s1 s1 s0 PUSH3 // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _11=0 + NEWC // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _11=0 _12 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _14 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _16 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _18 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _20 + 1 STU // ssrc sdest _5=1 _6=1 _22 + 1 STU // ssrc sdest _5=1 _24 + 1 STU // ssrc sdest init_state_with_bad_data + 0 PUSHINT // ssrc sdest init_state_with_bad_data _27=0 + SWAP // ssrc sdest _27=0 init_state_with_bad_data + ENDC // ssrc sdest _27=0 _28 + 1 PUSHINT // ssrc sdest _27=0 _28 _29=1 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 + 1000 PUSHINT // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 + PUSHNULL // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 + s6 s6 s6 PUSH3 // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _37=0 + NEWC // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _37=0 _38 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _40 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _42 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _44 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _46 + s0 s9 XCHG2 // _33 sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _46 ssrc + STSLICER // _33 sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _47 + s0 s7 XCHG2 // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _47 sdest + STSLICER // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _48 + s5 PUSH // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _48 _49=0 + STGRAMS // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _50 + s1 s7 XCHG // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _33 _50 + STDICT // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _51 + s4 PUSH // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _51 _52=0 + STGRAMS // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _53 + s4 PUSH // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _53 _54=0 + STGRAMS // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _55 + s1 s5 XCHG // _31=1000 _30=1 _27=0 _28 _29=1 _32=1000 _55 + 64 STU // _31=1000 _30=1 _27=0 _28 _29=1 _57 + s1 s5 XCHG // _29=1 _30=1 _27=0 _28 _31=1000 _57 + 32 STU // _29=1 _30=1 _27=0 _28 _59 + s1 s3 XCHG // _29=1 _28 _27=0 _30=1 _59 + 1 STU // _29=1 _28 _27=0 _61 + s1 s3 XCHG // _27=0 _28 _29=1 _61 + 1 STU // _27=0 _28 _63 + STREF // _27=0 _64 + 1 STU // _66 + ENDC // _67 + }> + parse_send_raw_message PROCINLINE:<{ + // out_action + 8 LDU // _1 out_action + LDREF // _1 _9 _8 + DROP // _1 _4 + }> + parse_lib_code PROCINLINE:<{ + // out_action + 7 LDU // mode out_action + DUP // mode out_action out_action + SREFS // mode out_action _5 + 0 GTINT // mode out_action _7 + IF:<{ // mode out_action + LDREF // mode _20 _19 + DROP // mode _8 + }>ELSE<{ // mode out_action + 256 LDSLICE // mode _22 _21 + DROP // mode loaded_bits + NEWC // mode loaded_bits _14 + SWAP // mode _14 loaded_bits + STSLICER // mode _15 + ENDC // mode _16 + }> + }> + parse_raw_reserve PROCINLINE:<{ + // out_action + 8 LDU // _1 out_action + LDDICT // _1 _9 _8 + DROP // _1 _4 + }> + parse_set_code PROCINLINE:<{ + // out_action + LDREF // _4 _3 + DROP // _1 + }> + parse_c5 PROCINLINE:<{ + // + NIL // list_of_actions_tuple + c5 PUSH // list_of_actions_tuple c5 + NIL // list_of_actions_tuple c5 actions + SWAP // list_of_actions_tuple actions c5 + CTOS // list_of_actions_tuple actions out_action_node + DUP // list_of_actions_tuple actions out_action_node out_action_node + SBITS // list_of_actions_tuple actions out_action_node _8 + 0 EQINT // list_of_actions_tuple actions out_action_node _10 + IF:<{ // list_of_actions_tuple actions out_action_node + 3 BLKDROP // + PUSHNULL // _11 + }>ELSE<{ // list_of_actions_tuple actions out_action_node + 0 PUSHINT // list_of_actions_tuple actions out_action_node num=0 + UNTIL:<{ + SWAP // list_of_actions_tuple actions num out_action_node + LDREF // list_of_actions_tuple actions num next out_action_node + s0 s3 XCHG2 // list_of_actions_tuple next num out_action_node actions + CONS // list_of_actions_tuple next num actions + s0 s2 XCHG // list_of_actions_tuple actions num next + CTOS // list_of_actions_tuple actions num out_action_node + SWAP // list_of_actions_tuple actions out_action_node num + INC // list_of_actions_tuple actions out_action_node num + OVER // list_of_actions_tuple actions out_action_node num out_action_node + SBITS // list_of_actions_tuple actions out_action_node num _23 + 0 EQINT // list_of_actions_tuple actions out_action_node num break + }> // list_of_actions_tuple actions out_action_node num + NIP // list_of_actions_tuple actions num + 0 PUSHINT // list_of_actions_tuple actions num i=0 + UNTIL:<{ + s0 s2 XCHG // list_of_actions_tuple i num actions + UNCONS // list_of_actions_tuple i num out_action actions + SWAP // list_of_actions_tuple i num actions out_action + 32 LDU // list_of_actions_tuple i num actions action_code out_action + OVER + 247711853 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _35=247711853 + EQUAL // list_of_actions_tuple i num actions action_code out_action _36 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_send_raw_message INLINECALLDICT // list_of_actions_tuple i num actions mode body + 0 PUSHINT // list_of_actions_tuple i num actions mode body _42=0 + s0 s2 XCHG // list_of_actions_tuple i num actions _42=0 body mode + TRIPLE // list_of_actions_tuple i num actions _41 + s1 s4 XCHG // actions i num list_of_actions_tuple _41 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + OVER + 2907562126 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _44=2907562126 + EQUAL // list_of_actions_tuple i num actions action_code out_action _45 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_set_code INLINECALLDICT // list_of_actions_tuple i num actions new_setcode + 1 PUSHINT // list_of_actions_tuple i num actions new_setcode _50=1 + SWAP + -1 PUSHINT // list_of_actions_tuple i num actions _50=1 new_setcode _51=-1 + TRIPLE // list_of_actions_tuple i num actions _49 + s1 s4 XCHG // actions i num list_of_actions_tuple _49 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + OVER + 921090057 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _53=921090057 + EQUAL // list_of_actions_tuple i num actions action_code out_action _54 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_raw_reserve INLINECALLDICT // list_of_actions_tuple i num actions mode currencies + 2 PUSHINT // list_of_actions_tuple i num actions mode currencies _60=2 + s0 s2 XCHG // list_of_actions_tuple i num actions _60=2 currencies mode + TRIPLE // list_of_actions_tuple i num actions _59 + s1 s4 XCHG // actions i num list_of_actions_tuple _59 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + SWAP + 653925844 PUSHINT // list_of_actions_tuple i num actions out_action action_code _62=653925844 + EQUAL // list_of_actions_tuple i num actions out_action _63 + IF:<{ // list_of_actions_tuple i num actions out_action + parse_lib_code INLINECALLDICT // list_of_actions_tuple i num actions mode lib_cell_or_lib_hash + 3 PUSHINT // list_of_actions_tuple i num actions mode lib_cell_or_lib_hash _69=3 + s0 s2 XCHG // list_of_actions_tuple i num actions _69=3 lib_cell_or_lib_hash mode + TRIPLE // list_of_actions_tuple i num actions _68 + s1 s4 XCHG // actions i num list_of_actions_tuple _68 + TPUSH // actions i num list_of_actions_tuple + s0 s3 XCHG // list_of_actions_tuple i num actions + }>ELSE<{ + DROP // list_of_actions_tuple i num actions + }> + s0 s3 XCHG // actions i num list_of_actions_tuple + }> + }> + }> + s0 s2 XCHG // actions list_of_actions_tuple num i + INC // actions list_of_actions_tuple num i + s0 s1 PUSH2 // actions list_of_actions_tuple num i i num + GEQ // actions list_of_actions_tuple num i _73 + s3 s4 XCHG // list_of_actions_tuple actions num i _73 + }> // list_of_actions_tuple actions num i + 3 BLKDROP // list_of_actions_tuple + }> + }> + generate_init_state PROC:<{ + // + 0 PUSHINT // _0=0 + s0 s0 s0 PUSH3 // _0=0 _1=0 _2=0 _3=0 + 1 PUSHINT // _0=0 _1=0 _2=0 _3=0 _4=1 + s0 s1 PUSH2 // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _6=0 + NEWC // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _6=0 _7 + 1 STU // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _9 + 1 STU // _0=0 _1=0 _2=0 _3=0 _4=1 _11 + 1 STU // _0=0 _1=0 _2=0 _3=0 _13 + 1 STU // _0=0 _1=0 _2=0 _15 + 1 STU // _0=0 _1=0 _17 + 1 STU // _0=0 _19 + 1 STU // _21 + }> + generate_init_state_with_data PROC:<{ + // code data library + 1 PUSHINT // code data library _3=1 + s0 s0 PUSH2 // code data library _3=1 _4=1 _5=1 + 0 PUSHINT // code data library _3=1 _4=1 _5=1 _6=0 + s1 s1 s0 PUSH3 // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _9=0 + NEWC // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _9=0 _10 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _12 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _14 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _16 + 1 STU // code data library _3=1 _4=1 _5=1 _18 + 1 STU // code data library _3=1 _4=1 _20 + s1 s5 XCHG // _4=1 data library _3=1 code _20 + STREF // _4=1 data library _3=1 _21 + s1 s4 XCHG // _3=1 data library _4=1 _21 + 1 STU // _3=1 data library _23 + s1 s2 XCHG // _3=1 library data _23 + STREF // _3=1 library _24 + s1 s2 XCHG // library _3=1 _24 + 1 STU // library _26 + STREF // _27 + }> + parse_init_state PROC:<{ + // cs + NIL // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_five cs + s2 s1 XCPU // cs maybe_five parsed_tuple maybe_five + TPUSH // cs maybe_five parsed_tuple + SWAP // cs parsed_tuple maybe_five + 1 EQINT // cs parsed_tuple _10 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + 5 LDU // parsed_tuple _12 cs + -ROT // cs parsed_tuple _12 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_tick_tock cs + s2 s1 XCPU // cs maybe_tick_tock parsed_tuple maybe_tick_tock + TPUSH // cs maybe_tick_tock parsed_tuple + SWAP // cs parsed_tuple maybe_tick_tock + 1 EQINT // cs parsed_tuple _23 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple _25 cs + -ROT // cs parsed_tuple _25 + TPUSH // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple _30 cs + -ROT // cs parsed_tuple _30 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_code cs + s2 s1 XCPU // cs maybe_code parsed_tuple maybe_code + TPUSH // cs maybe_code parsed_tuple + SWAP // cs parsed_tuple maybe_code + 1 EQINT // cs parsed_tuple _41 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _43 cs + -ROT // cs parsed_tuple _43 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_data cs + s2 s1 XCPU // cs maybe_data parsed_tuple maybe_data + TPUSH // cs maybe_data parsed_tuple + SWAP // cs parsed_tuple maybe_data + 1 EQINT // cs parsed_tuple _53 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _55 cs + -ROT // cs parsed_tuple _55 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_library cs + s2 s1 XCPU // cs maybe_library parsed_tuple maybe_library + TPUSH // cs maybe_library parsed_tuple + SWAP // cs parsed_tuple maybe_library + 1 EQINT // cs parsed_tuple _65 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _91 _90 + DROP // parsed_tuple _67 + TPUSH // parsed_tuple + }>ELSE<{ + NIP // parsed_tuple + }> + }> + random_query_id PROC:<{ + // + LTIME + ADDRAND + 64 PUSHPOW2 // _3 + RAND // _4 + INC // _6 + }> + generate_internal_message_body PROC:<{ + // op query_id + SWAP + NEWC // query_id op _3 + 32 STU // query_id body + OVER // query_id body query_id + 0 EQINT // query_id body _7 + IF:<{ // query_id body + NIP // body + random_query_id CALLDICT // body query_id + SWAP // query_id body + }> // query_id body + 64 STU // _10 + }> + generate_internal_message_custom PROC:<{ + // bounce ton_amount init_state payload src_addr dst_addr fwd_fee + s2 PUSH // bounce ton_amount init_state payload src_addr dst_addr fwd_fee src_addr + ISNULL // bounce ton_amount init_state payload src_addr dst_addr fwd_fee _8 + IF:<{ // bounce ton_amount init_state payload src_addr dst_addr fwd_fee + s2 POP // bounce ton_amount init_state payload fwd_fee dst_addr + generate_internal_address CALLDICT // bounce ton_amount init_state payload fwd_fee dst_addr _9 + }>ELSE<{ // bounce ton_amount init_state payload _9 dst_addr fwd_fee + s0 s2 XCHG // bounce ton_amount init_state payload fwd_fee dst_addr _9 + }> // bounce ton_amount init_state payload fwd_fee dst_addr ssrc + OVER // bounce ton_amount init_state payload fwd_fee dst_addr ssrc dst_addr + ISNULL // bounce ton_amount init_state payload fwd_fee dst_addr ssrc _12 + IF:<{ // bounce ton_amount init_state payload fwd_fee dst_addr ssrc + NIP // bounce ton_amount init_state payload fwd_fee ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload fwd_fee ssrc _13 + }>ELSE<{ // bounce ton_amount init_state payload fwd_fee _13 ssrc + SWAP // bounce ton_amount init_state payload fwd_fee ssrc _13 + }> // bounce ton_amount init_state payload fwd_fee ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 + DUP // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 + PUSHNULL // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 + 0 PUSHINT // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _21=0 + NEWC // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _21=0 _22 + 1 STU // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _24 + 1 STU // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _26 + s1 s11 XCHG // _19=0 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 bounce _26 + 1 STU // _19=0 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _28 + s1 s10 XCHG // _18 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _19=0 _28 + 1 STU // _18 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _30 + s0 s4 XCHG2 // _18 ton_amount init_state payload fwd_fee _17=1000 sdest _16=1000 _30 ssrc + STSLICER // _18 ton_amount init_state payload fwd_fee _17=1000 sdest _16=1000 _31 + ROT // _18 ton_amount init_state payload fwd_fee _17=1000 _16=1000 _31 sdest + STSLICER // _18 ton_amount init_state payload fwd_fee _17=1000 _16=1000 _32 + s0 s6 XCHG2 // _18 _16=1000 init_state payload fwd_fee _17=1000 _32 ton_amount + STGRAMS // _18 _16=1000 init_state payload fwd_fee _17=1000 _33 + s1 s6 XCHG // _17=1000 _16=1000 init_state payload fwd_fee _18 _33 + STDICT // _17=1000 _16=1000 init_state payload fwd_fee _34 + 0 PUSHINT // _17=1000 _16=1000 init_state payload fwd_fee _34 _35=0 + STGRAMS // _17=1000 _16=1000 init_state payload fwd_fee _36 + SWAP // _17=1000 _16=1000 init_state payload _36 fwd_fee + STGRAMS // _17=1000 _16=1000 init_state payload _37 + s1 s4 XCHG // payload _16=1000 init_state _17=1000 _37 + 64 STU // payload _16=1000 init_state _39 + s1 s2 XCHG // payload init_state _16=1000 _39 + 32 STU // payload init_state _41 + s1 s(-1) PUXC // payload init_state init_state _41 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _45 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _48 + OVER // payload msg init_state_builder _48 init_state_builder + BBITS // payload msg init_state_builder _48 _49 + ADD // payload msg init_state_builder _50 + 10 PUSHPOW2DEC // payload msg init_state_builder _50 _51=1023 + GEQ // payload msg init_state_builder _52 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _53 + 1 PUSHINT + ROT // payload _53 _54=1 msg + 1 STU // payload _53 _56 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _58=0 msg + 1 STU // payload init_state_builder _60 + SWAP // payload _60 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _62 + s2 PUSH // payload msg _62 payload + BBITS // payload msg _62 _63 + ADD // payload msg _64 + 10 PUSHPOW2DEC // payload msg _64 _65=1023 + GEQ // payload msg _66 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _67 + 1 PUSHINT + ROT // _67 _68=1 msg + 1 STU // _67 _70 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _72=0 + SWAP // payload _72=0 msg + 1 STU // payload _74 + SWAP // _74 payload + STBR // msg + }> + ENDC // _76 + }> + generate_get_royalty_params PROC:<{ + // query_id + 1765620048 PUSHINT // query_id _1=1765620048 + SWAP // _1=1765620048 query_id + generate_internal_message_body CALLDICT // _2 + }> + generate_nft_transfer_request PROC:<{ + // new_owner response_dst query_id custom_payload forward_amount forward_payload is_ref? + 1607220500 PUSHINT // new_owner response_dst query_id custom_payload forward_amount forward_payload is_ref? _8=1607220500 + s0 s5 XCHG2 // new_owner response_dst is_ref? custom_payload forward_amount forward_payload _8=1607220500 query_id + generate_internal_message_body CALLDICT // new_owner response_dst is_ref? custom_payload forward_amount forward_payload _9 + s0 s6 XCHG2 // forward_payload response_dst is_ref? custom_payload forward_amount _9 new_owner + STSLICER // forward_payload response_dst is_ref? custom_payload forward_amount _10 + s0 s4 XCHG2 // forward_payload forward_amount is_ref? custom_payload _10 response_dst + STSLICER // forward_payload forward_amount is_ref? custom_payload req + OVER // forward_payload forward_amount is_ref? custom_payload req custom_payload + ISNULL // forward_payload forward_amount is_ref? custom_payload req _12 + IF:<{ // forward_payload forward_amount is_ref? custom_payload req + 0 PUSHINT + s2 POP // forward_payload forward_amount is_ref? _13=0 req + 1 STU // forward_payload forward_amount is_ref? req + }>ELSE<{ // forward_payload forward_amount is_ref? custom_payload req + 1 PUSHINT // forward_payload forward_amount is_ref? custom_payload req _16=1 + SWAP // forward_payload forward_amount is_ref? custom_payload _16=1 req + 1 STU // forward_payload forward_amount is_ref? custom_payload _18 + STREF // forward_payload forward_amount is_ref? req + }> + ROT // forward_payload is_ref? req forward_amount + STGRAMS // forward_payload is_ref? req + s2 PUSH // forward_payload is_ref? req forward_payload + ISNULL // forward_payload is_ref? req _21 + NOT // forward_payload is_ref? req _22 + IF:<{ // forward_payload is_ref? req + SWAP // forward_payload req is_ref? + IF:<{ // forward_payload req + 1 PUSHINT // forward_payload req _23=1 + SWAP // forward_payload _23=1 req + 1 STU // forward_payload _25 + STREF // req + }>ELSE<{ // forward_payload req + 0 PUSHINT // forward_payload req _27=0 + SWAP // forward_payload _27=0 req + 1 STU // forward_payload _29 + SWAP // _29 forward_payload + CTOS // _29 _30 + STSLICER // req + }> + }>ELSE<{ // forward_payload is_ref? req + NIP + 0 PUSHINT + s2 POP // _32=0 req + 1 STU // req + }> + }> + generate_nft_get_static_data_request PROC:<{ + // query_id + 801842850 PUSHINT // query_id _1=801842850 + NEWC // query_id _1=801842850 _2 + 32 STU // query_id _4 + 64 STU // _6 + }> + generate_nft_deploy_request PROC:<{ + // idx content query_id forward_amount + 1 PUSHINT + ROT // idx content forward_amount _4=1 query_id + generate_internal_message_body CALLDICT // idx content forward_amount _5 + s1 s3 XCHG // forward_amount content idx _5 + 64 STU // forward_amount content _7 + ROT // content _7 forward_amount + STGRAMS // content _8 + STREF // _9 + }> + generate_jetton_burn_request PROC:<{ + // query_id amount dst custom_payload + 1499400124 PUSHINT // query_id amount dst custom_payload _5=1499400124 + s0 s4 XCHG2 // custom_payload amount dst _5=1499400124 query_id + generate_internal_message_body CALLDICT // custom_payload amount dst _6 + ROT // custom_payload dst _6 amount + STGRAMS // custom_payload dst _7 + SWAP // custom_payload _7 dst + STSLICER // custom_payload burn_msg + OVER // custom_payload burn_msg custom_payload + ISNULL // custom_payload burn_msg _9 + NOT // custom_payload burn_msg _10 + IF:<{ // custom_payload burn_msg + 1 PUSHINT // custom_payload burn_msg _11=1 + SWAP // custom_payload _11=1 burn_msg + 1 STU // custom_payload _13 + STREF // burn_msg + }>ELSE<{ // custom_payload burn_msg + 0 PUSHINT + s2 POP // _15=0 burn_msg + 1 STU // burn_msg + }> + }> + generate_jetton_burn_notification PROC:<{ + // query_id amount sender resp_dst + 2078119902 PUSHINT // query_id amount sender resp_dst _4=2078119902 + s0 s4 XCHG2 // resp_dst amount sender _4=2078119902 query_id + generate_internal_message_body CALLDICT // resp_dst amount sender _5 + ROT // resp_dst sender _5 amount + STGRAMS // resp_dst sender _6 + SWAP // resp_dst _6 sender + STSLICER // resp_dst _7 + SWAP // _7 resp_dst + STSLICER // _8 + }> + generate_jetton_internal_transfer_request PROC:<{ + // query_id amount from resp_addr forward_amount forward_payload is_ref? + 395134233 PUSHINT // query_id amount from resp_addr forward_amount forward_payload is_ref? _8=395134233 + s0 s7 XCHG2 // is_ref? amount from resp_addr forward_amount forward_payload _8=395134233 query_id + generate_internal_message_body CALLDICT // is_ref? amount from resp_addr forward_amount forward_payload _9 + s0 s5 XCHG2 // is_ref? forward_payload from resp_addr forward_amount _9 amount + STGRAMS // is_ref? forward_payload from resp_addr forward_amount _10 + s0 s3 XCHG2 // is_ref? forward_payload forward_amount resp_addr _10 from + STSLICER // is_ref? forward_payload forward_amount resp_addr _11 + SWAP // is_ref? forward_payload forward_amount _11 resp_addr + STSLICER // is_ref? forward_payload forward_amount _12 + SWAP // is_ref? forward_payload _12 forward_amount + STGRAMS // is_ref? forward_payload req + OVER // is_ref? forward_payload req forward_payload + ISNULL // is_ref? forward_payload req _14 + NOT // is_ref? forward_payload req _15 + IF:<{ // is_ref? forward_payload req + s0 s2 XCHG // req forward_payload is_ref? + IF:<{ // req forward_payload + 1 PUSHINT + ROT // forward_payload _16=1 req + 1 STU // forward_payload _18 + STREF // req + }>ELSE<{ // req forward_payload + 0 PUSHINT + ROT // forward_payload _20=0 req + 1 STU // forward_payload _22 + SWAP // _22 forward_payload + CTOS // _22 _23 + STSLICER // req + }> + }>ELSE<{ // is_ref? forward_payload req + NIP + 0 PUSHINT + s2 POP // _25=0 req + 1 STU // req + }> + }> + generate_jetton_transfer_request PROC:<{ + // query_id amount dst resp_dst custom_payload forward_amount forward_payload is_ref? + 260734629 PUSHINT // query_id amount dst resp_dst custom_payload forward_amount forward_payload is_ref? _9=260734629 + s0 s8 XCHG2 // is_ref? amount dst resp_dst custom_payload forward_amount forward_payload _9=260734629 query_id + generate_internal_message_body CALLDICT // is_ref? amount dst resp_dst custom_payload forward_amount forward_payload _10 + s0 s6 XCHG2 // is_ref? forward_payload dst resp_dst custom_payload forward_amount _10 amount + STGRAMS // is_ref? forward_payload dst resp_dst custom_payload forward_amount _11 + s0 s4 XCHG2 // is_ref? forward_payload forward_amount resp_dst custom_payload _11 dst + STSLICER // is_ref? forward_payload forward_amount resp_dst custom_payload _12 + ROT // is_ref? forward_payload forward_amount custom_payload _12 resp_dst + STSLICER // is_ref? forward_payload forward_amount custom_payload req + OVER // is_ref? forward_payload forward_amount custom_payload req custom_payload + ISNULL // is_ref? forward_payload forward_amount custom_payload req _14 + IF:<{ // is_ref? forward_payload forward_amount custom_payload req + 0 PUSHINT + s2 POP // is_ref? forward_payload forward_amount _15=0 req + 1 STU // is_ref? forward_payload forward_amount req + }>ELSE<{ // is_ref? forward_payload forward_amount custom_payload req + 1 PUSHINT // is_ref? forward_payload forward_amount custom_payload req _18=1 + SWAP // is_ref? forward_payload forward_amount custom_payload _18=1 req + 1 STU // is_ref? forward_payload forward_amount custom_payload _20 + STREF // is_ref? forward_payload forward_amount req + }> + SWAP // is_ref? forward_payload req forward_amount + STGRAMS // is_ref? forward_payload req + OVER // is_ref? forward_payload req forward_payload + ISNULL // is_ref? forward_payload req _23 + NOT // is_ref? forward_payload req _24 + IF:<{ // is_ref? forward_payload req + s0 s2 XCHG // req forward_payload is_ref? + IF:<{ // req forward_payload + 1 PUSHINT + ROT // forward_payload _25=1 req + 1 STU // forward_payload _27 + STREF // req + }>ELSE<{ // req forward_payload + 0 PUSHINT + ROT // forward_payload _29=0 req + 1 STU // forward_payload _31 + SWAP // _31 forward_payload + CTOS // _31 _32 + STSLICER // req + }> + }>ELSE<{ // is_ref? forward_payload req + NIP + 0 PUSHINT + s2 POP // _34=0 req + 1 STU // req + }> + }> + generate_internal_message PROC:<{ + // bounce ton_amount init_state payload + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload ssrc sdest _9=1000 + DUP // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 + PUSHNULL // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 + 0 PUSHINT // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _14=0 + NEWC // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _14=0 _15 + 1 STU // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _17 + 1 STU // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _19 + s1 s10 XCHG // _12=0 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 bounce _19 + 1 STU // _12=0 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _21 + s1 s9 XCHG // _11 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _12=0 _21 + 1 STU // _11 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _23 + s0 s4 XCHG2 // _11 ton_amount init_state payload _10=1000 sdest _9=1000 _23 ssrc + STSLICER // _11 ton_amount init_state payload _10=1000 sdest _9=1000 _24 + ROT // _11 ton_amount init_state payload _10=1000 _9=1000 _24 sdest + STSLICER // _11 ton_amount init_state payload _10=1000 _9=1000 _25 + s0 s5 XCHG2 // _11 _9=1000 init_state payload _10=1000 _25 ton_amount + STGRAMS // _11 _9=1000 init_state payload _10=1000 _26 + s1 s5 XCHG // _10=1000 _9=1000 init_state payload _11 _26 + STDICT // _10=1000 _9=1000 init_state payload _27 + 0 PUSHINT // _10=1000 _9=1000 init_state payload _27 _28=0 + STGRAMS // _10=1000 _9=1000 init_state payload _29 + 0 PUSHINT // _10=1000 _9=1000 init_state payload _29 _30=0 + STGRAMS // _10=1000 _9=1000 init_state payload _31 + s1 s4 XCHG // payload _9=1000 init_state _10=1000 _31 + 64 STU // payload _9=1000 init_state _33 + s1 s2 XCHG // payload init_state _9=1000 _33 + 32 STU // payload init_state _35 + s1 s(-1) PUXC // payload init_state init_state _35 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _39 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _42 + OVER // payload msg init_state_builder _42 init_state_builder + BBITS // payload msg init_state_builder _42 _43 + ADD // payload msg init_state_builder _44 + 10 PUSHPOW2DEC // payload msg init_state_builder _44 _45=1023 + GEQ // payload msg init_state_builder _46 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _47 + 1 PUSHINT + ROT // payload _47 _48=1 msg + 1 STU // payload _47 _50 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _52=0 msg + 1 STU // payload init_state_builder _54 + SWAP // payload _54 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _56 + s2 PUSH // payload msg _56 payload + BBITS // payload msg _56 _57 + ADD // payload msg _58 + 10 PUSHPOW2DEC // payload msg _58 _59=1023 + GEQ // payload msg _60 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _61 + 1 PUSHINT + ROT // _61 _62=1 msg + 1 STU // _61 _64 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _66=0 + SWAP // payload _66=0 msg + 1 STU // payload _68 + SWAP // _68 payload + STBR // msg + }> + ENDC // _70 + }> + generate_internal_message_relaxed PROC:<{ + // bounce ton_amount init_state payload typeOfAnyAddress + generate_any_address CALLDICT // bounce ton_amount init_state payload ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload ssrc sdest _10=1000 + DUP // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 + PUSHNULL // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 + 0 PUSHINT // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _15=0 + NEWC // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _15=0 _16 + 1 STU // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _18 + 1 STU // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _20 + s1 s10 XCHG // _13=0 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 bounce _20 + 1 STU // _13=0 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _22 + s1 s9 XCHG // _12 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _13=0 _22 + 1 STU // _12 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _24 + s0 s4 XCHG2 // _12 ton_amount init_state payload _11=1000 sdest _10=1000 _24 ssrc + STSLICER // _12 ton_amount init_state payload _11=1000 sdest _10=1000 _25 + ROT // _12 ton_amount init_state payload _11=1000 _10=1000 _25 sdest + STSLICER // _12 ton_amount init_state payload _11=1000 _10=1000 _26 + s0 s5 XCHG2 // _12 _10=1000 init_state payload _11=1000 _26 ton_amount + STGRAMS // _12 _10=1000 init_state payload _11=1000 _27 + s1 s5 XCHG // _11=1000 _10=1000 init_state payload _12 _27 + STDICT // _11=1000 _10=1000 init_state payload _28 + 0 PUSHINT // _11=1000 _10=1000 init_state payload _28 _29=0 + STGRAMS // _11=1000 _10=1000 init_state payload _30 + 0 PUSHINT // _11=1000 _10=1000 init_state payload _30 _31=0 + STGRAMS // _11=1000 _10=1000 init_state payload _32 + s1 s4 XCHG // payload _10=1000 init_state _11=1000 _32 + 64 STU // payload _10=1000 init_state _34 + s1 s2 XCHG // payload init_state _10=1000 _34 + 32 STU // payload init_state _36 + s1 s(-1) PUXC // payload init_state init_state _36 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _40 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _43 + OVER // payload msg init_state_builder _43 init_state_builder + BBITS // payload msg init_state_builder _43 _44 + ADD // payload msg init_state_builder _45 + 10 PUSHPOW2DEC // payload msg init_state_builder _45 _46=1023 + GEQ // payload msg init_state_builder _47 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _48 + 1 PUSHINT + ROT // payload _48 _49=1 msg + 1 STU // payload _48 _51 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _53=0 msg + 1 STU // payload init_state_builder _55 + SWAP // payload _55 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _57 + s2 PUSH // payload msg _57 payload + BBITS // payload msg _57 _58 + ADD // payload msg _59 + 10 PUSHPOW2DEC // payload msg _59 _60=1023 + GEQ // payload msg _61 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _62 + 1 PUSHINT + ROT // _62 _63=1 msg + 1 STU // _62 _65 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _67=0 + SWAP // payload _67=0 msg + 1 STU // payload _69 + SWAP // _69 payload + STBR // msg + }> + ENDC // _71 + }> + generate_external_in_message PROC:<{ + // import_fee init_state payload + 8 PUSHPOW2 // import_fee init_state payload _4=256 + generate_external_address CALLDICT // import_fee init_state payload ssrc + generate_internal_address CALLDICT // import_fee init_state payload ssrc sdest + 2 PUSHINT // import_fee init_state payload ssrc sdest _9=2 + NEWC // import_fee init_state payload ssrc sdest _9=2 _10 + 2 STU // import_fee init_state payload ssrc sdest _12 + ROT // import_fee init_state payload sdest _12 ssrc + STSLICER // import_fee init_state payload sdest _13 + SWAP // import_fee init_state payload _13 sdest + STSLICER // import_fee init_state payload _14 + s0 s3 XCHG2 // payload init_state _14 import_fee + STGRAMS // payload init_state _15 + s1 s(-1) PUXC // payload init_state init_state _15 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _19 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _22 + OVER // payload msg init_state_builder _22 init_state_builder + BBITS // payload msg init_state_builder _22 _23 + ADD // payload msg init_state_builder _24 + 10 PUSHPOW2DEC // payload msg init_state_builder _24 _25=1023 + GEQ // payload msg init_state_builder _26 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _27 + 1 PUSHINT + ROT // payload _27 _28=1 msg + 1 STU // payload _27 _30 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _32=0 msg + 1 STU // payload init_state_builder _34 + SWAP // payload _34 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _36 + s2 PUSH // payload msg _36 payload + BBITS // payload msg _36 _37 + ADD // payload msg _38 + 10 PUSHPOW2DEC // payload msg _38 _39=1023 + GREATER // payload msg _40 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _41 + 1 PUSHINT + ROT // _41 _42=1 msg + 1 STU // _41 _44 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _46=0 + SWAP // payload _46=0 msg + 1 STU // payload _48 + SWAP // _48 payload + STBR // msg + }> + ENDC // _50 + }> + generate_external_in_message_with_empty_source_address PROC:<{ + // import_fee init_state payload + generate_empty_address CALLDICT // import_fee init_state payload ssrc + generate_internal_address CALLDICT // import_fee init_state payload ssrc sdest + 2 PUSHINT // import_fee init_state payload ssrc sdest _8=2 + NEWC // import_fee init_state payload ssrc sdest _8=2 _9 + 2 STU // import_fee init_state payload ssrc sdest _11 + ROT // import_fee init_state payload sdest _11 ssrc + STSLICER // import_fee init_state payload sdest _12 + SWAP // import_fee init_state payload _12 sdest + STSLICER // import_fee init_state payload _13 + s0 s3 XCHG2 // payload init_state _13 import_fee + STGRAMS // payload init_state _14 + s1 s(-1) PUXC // payload init_state init_state _14 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _18 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _21 + OVER // payload msg init_state_builder _21 init_state_builder + BBITS // payload msg init_state_builder _21 _22 + ADD // payload msg init_state_builder _23 + 10 PUSHPOW2DEC // payload msg init_state_builder _23 _24=1023 + GEQ // payload msg init_state_builder _25 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _26 + 1 PUSHINT + ROT // payload _26 _27=1 msg + 1 STU // payload _26 _29 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _31=0 msg + 1 STU // payload init_state_builder _33 + SWAP // payload _33 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _35 + s2 PUSH // payload msg _35 payload + BBITS // payload msg _35 _36 + ADD // payload msg _37 + 10 PUSHPOW2DEC // payload msg _37 _38=1023 + GEQ // payload msg _39 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _40 + 1 PUSHINT + ROT // _40 _41=1 msg + 1 STU // _40 _43 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _45=0 + SWAP // payload _45=0 msg + 1 STU // payload _47 + SWAP // _47 payload + STBR // msg + }> + ENDC // _49 + }> + generate_external_out_message PROC:<{ + // import_fee init_state payload + s2 POP // payload init_state + generate_internal_address CALLDICT // payload init_state ssrc + 8 PUSHPOW2 // payload init_state ssrc _6=256 + generate_external_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _9=1000 + DUP // payload init_state ssrc sdest _9=1000 _10=1000 + 3 PUSHINT // payload init_state ssrc sdest _9=1000 _10=1000 _11=3 + NEWC // payload init_state ssrc sdest _9=1000 _10=1000 _11=3 _12 + 2 STU // payload init_state ssrc sdest _9=1000 _10=1000 _14 + s0 s4 XCHG2 // payload init_state _10=1000 sdest _9=1000 _14 ssrc + STSLICER // payload init_state _10=1000 sdest _9=1000 _15 + ROT // payload init_state _10=1000 _9=1000 _15 sdest + STSLICER // payload init_state _10=1000 _9=1000 _16 + s1 s2 XCHG // payload init_state _9=1000 _10=1000 _16 + 64 STU // payload init_state _9=1000 _18 + 32 STU // payload init_state _20 + s1 s(-1) PUXC // payload init_state init_state _20 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _24 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _27 + OVER // payload msg init_state_builder _27 init_state_builder + BBITS // payload msg init_state_builder _27 _28 + ADD // payload msg init_state_builder _29 + 10 PUSHPOW2DEC // payload msg init_state_builder _29 _30=1023 + GEQ // payload msg init_state_builder _31 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _32 + 1 PUSHINT + ROT // payload _32 _33=1 msg + 1 STU // payload _32 _35 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _37=0 msg + 1 STU // payload init_state_builder _39 + SWAP // payload _39 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _41 + s2 PUSH // payload msg _41 payload + BBITS // payload msg _41 _42 + ADD // payload msg _43 + 10 PUSHPOW2DEC // payload msg _43 _44=1023 + GEQ // payload msg _45 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _46 + 1 PUSHINT + ROT // _46 _47=1 msg + 1 STU // _46 _49 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _51=0 + SWAP // payload _51=0 msg + 1 STU // payload _53 + SWAP // _53 payload + STBR // msg + }> + ENDC // _55 + }> + generate_external_out_message_with_empty_destination_address PROC:<{ + // import_fee init_state payload + s2 POP // payload init_state + generate_internal_address CALLDICT // payload init_state ssrc + generate_empty_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _8=1000 + DUP // payload init_state ssrc sdest _8=1000 _9=1000 + 3 PUSHINT // payload init_state ssrc sdest _8=1000 _9=1000 _10=3 + NEWC // payload init_state ssrc sdest _8=1000 _9=1000 _10=3 _11 + 2 STU // payload init_state ssrc sdest _8=1000 _9=1000 _13 + s0 s4 XCHG2 // payload init_state _9=1000 sdest _8=1000 _13 ssrc + STSLICER // payload init_state _9=1000 sdest _8=1000 _14 + ROT // payload init_state _9=1000 _8=1000 _14 sdest + STSLICER // payload init_state _9=1000 _8=1000 _15 + s1 s2 XCHG // payload init_state _8=1000 _9=1000 _15 + 64 STU // payload init_state _8=1000 _17 + 32 STU // payload init_state _19 + s1 s(-1) PUXC // payload init_state init_state _19 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _23 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _26 + OVER // payload msg init_state_builder _26 init_state_builder + BBITS // payload msg init_state_builder _26 _27 + ADD // payload msg init_state_builder _28 + 10 PUSHPOW2DEC // payload msg init_state_builder _28 _29=1023 + GEQ // payload msg init_state_builder _30 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _31 + 1 PUSHINT + ROT // payload _31 _32=1 msg + 1 STU // payload _31 _34 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _36=0 msg + 1 STU // payload init_state_builder _38 + SWAP // payload _38 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _40 + s2 PUSH // payload msg _40 payload + BBITS // payload msg _40 _41 + ADD // payload msg _42 + 10 PUSHPOW2DEC // payload msg _42 _43=1023 + GEQ // payload msg _44 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _45 + 1 PUSHINT + ROT // _45 _46=1 msg + 1 STU // _45 _48 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _50=0 + SWAP // payload _50=0 msg + 1 STU // payload _52 + SWAP // _52 payload + STBR // msg + }> + ENDC // _54 + }> + generate_external_out_message_relaxed PROC:<{ + // ton_amount init_state payload typeOfAnyAddress + s3 POP // typeOfAnyAddress init_state payload + s0 s2 XCHG // payload init_state typeOfAnyAddress + generate_any_address CALLDICT // payload init_state ssrc + 8 PUSHPOW2 // payload init_state ssrc _7=256 + generate_external_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _10=1000 + DUP // payload init_state ssrc sdest _10=1000 _11=1000 + 3 PUSHINT // payload init_state ssrc sdest _10=1000 _11=1000 _12=3 + NEWC // payload init_state ssrc sdest _10=1000 _11=1000 _12=3 _13 + 2 STU // payload init_state ssrc sdest _10=1000 _11=1000 _15 + s0 s4 XCHG2 // payload init_state _11=1000 sdest _10=1000 _15 ssrc + STSLICER // payload init_state _11=1000 sdest _10=1000 _16 + ROT // payload init_state _11=1000 _10=1000 _16 sdest + STSLICER // payload init_state _11=1000 _10=1000 _17 + s1 s2 XCHG // payload init_state _10=1000 _11=1000 _17 + 64 STU // payload init_state _10=1000 _19 + 32 STU // payload init_state _21 + s1 s(-1) PUXC // payload init_state init_state _21 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _25 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _28 + OVER // payload msg init_state_builder _28 init_state_builder + BBITS // payload msg init_state_builder _28 _29 + ADD // payload msg init_state_builder _30 + 10 PUSHPOW2DEC // payload msg init_state_builder _30 _31=1023 + GEQ // payload msg init_state_builder _32 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _33 + 1 PUSHINT + ROT // payload _33 _34=1 msg + 1 STU // payload _33 _36 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _38=0 msg + 1 STU // payload init_state_builder _40 + SWAP // payload _40 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _42 + s2 PUSH // payload msg _42 payload + BBITS // payload msg _42 _43 + ADD // payload msg _44 + 10 PUSHPOW2DEC // payload msg _44 _45=1023 + GEQ // payload msg _46 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _47 + 1 PUSHINT + ROT // _47 _48=1 msg + 1 STU // _47 _50 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _52=0 + SWAP // payload _52=0 msg + 1 STU // payload _54 + SWAP // _54 payload + STBR // msg + }> + ENDC // _56 + }> + parse_internal_message PROC:<{ + // message + CTOS // cs + 112 PUSHINT // cs _3 + SWAP // _3 cs + 1 LDU // _3 _4 cs + SWAP // _3 cs _4 + 0 NEQINT // _3 cs _8 + s1 s2 XCHG // cs _3 _8 + THROWANYIF + 1 LDU // ihr_disabled cs + 1 LDU // ihr_disabled bounce cs + 1 LDU // ihr_disabled bounce bounced cs + LDMSGADDR // ihr_disabled bounce bounced src cs + LDMSGADDR // ihr_disabled bounce bounced src to_address cs + LDVARUINT16 // ihr_disabled bounce bounced src to_address money cs + LDDICT // ihr_disabled bounce bounced src to_address money _86 _85 + NIP // ihr_disabled bounce bounced src to_address money cs + LDGRAMS // ihr_disabled bounce bounced src to_address money _88 _87 + NIP // ihr_disabled bounce bounced src to_address money cs + LDGRAMS // ihr_disabled bounce bounced src to_address money _90 _89 + NIP // ihr_disabled bounce bounced src to_address money cs + 96 LDU // ihr_disabled bounce bounced src to_address money timestamps cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps maybe_init_state cs + NIL // ihr_disabled bounce bounced src to_address money timestamps maybe_init_state cs init_state + s0 s2 XCHG // ihr_disabled bounce bounced src to_address money timestamps init_state cs maybe_init_state + 1 EQINT // ihr_disabled bounce bounced src to_address money timestamps init_state cs _50 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps init_state cs + NIP // ihr_disabled bounce bounced src to_address money timestamps cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps _51 cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps cs _51 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps cs + LDREF // ihr_disabled bounce bounced src to_address money timestamps _54 cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps cs _54 + CTOS // ihr_disabled bounce bounced src to_address money timestamps cs _56 + parse_init_state CALLDICT // ihr_disabled bounce bounced src to_address money timestamps cs init_state + }>ELSE<{ // ihr_disabled bounce bounced src to_address money timestamps cs + DUP // ihr_disabled bounce bounced src to_address money timestamps cs cs + parse_init_state CALLDICT // ihr_disabled bounce bounced src to_address money timestamps cs init_state + }> + SWAP // ihr_disabled bounce bounced src to_address money timestamps init_state cs + }> // ihr_disabled bounce bounced src to_address money timestamps init_state cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps init_state body_flag cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps init_state cs body_flag + 0 EQINT // ihr_disabled bounce bounced src to_address money timestamps init_state cs _66 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps init_state body + }>ELSE<{ // ihr_disabled bounce bounced src to_address money timestamps init_state cs + LDREF // ihr_disabled bounce bounced src to_address money timestamps init_state _102 _101 + DROP // ihr_disabled bounce bounced src to_address money timestamps init_state _67 + CTOS // ihr_disabled bounce bounced src to_address money timestamps init_state body + }> + 9 TUPLE // _70 + }> + parse_external_message PROC:<{ + // message + CTOS // cs + 2 LDU // msg_info cs + 113 PUSHINT // msg_info cs _7 + s2 PUSH // msg_info cs _7 msg_info + 2 NEQINT // msg_info cs _7 _9 + s3 PUSH // msg_info cs _7 _9 msg_info + 3 NEQINT // msg_info cs _7 _9 _11 + AND // msg_info cs _7 _12 + THROWANYIF + LDMSGADDR // msg_info src cs + LDMSGADDR // msg_info src to_address cs + 0 PUSHINT // msg_info src to_address cs import_fee=0 + s0 s4 PUXC // timestamps=0 src to_address cs import_fee=0 msg_info + 2 EQINT // timestamps=0 src to_address cs import_fee=0 _25 + IF:<{ // timestamps=0 src to_address cs import_fee=0 + DROP // timestamps=0 src to_address cs + LDGRAMS // timestamps=0 src to_address import_fee cs + }>ELSE<{ // timestamps=0 src to_address cs import_fee=0 + s4 POP // import_fee=0 src to_address cs + 96 LDU // import_fee=0 src to_address timestamps cs + s1 s4 XCHG // timestamps src to_address import_fee cs + }> + 1 LDU // timestamps src to_address import_fee maybe_init_state cs + NIL // timestamps src to_address import_fee maybe_init_state cs init_state + s0 s2 XCHG // timestamps src to_address import_fee init_state cs maybe_init_state + 1 EQINT // timestamps src to_address import_fee init_state cs _38 + IF:<{ // timestamps src to_address import_fee init_state cs + NIP // timestamps src to_address import_fee cs + DUP // timestamps src to_address import_fee cs cs + parse_init_state CALLDICT // timestamps src to_address import_fee cs init_state + SWAP // timestamps src to_address import_fee init_state cs + }> // timestamps src to_address import_fee init_state cs + 1 LDU // timestamps src to_address import_fee init_state body_flag cs + SWAP // timestamps src to_address import_fee init_state cs body_flag + 0 EQINT // timestamps src to_address import_fee init_state cs _47 + IF:<{ // timestamps src to_address import_fee init_state body + }>ELSE<{ // timestamps src to_address import_fee init_state cs + LDREF // timestamps src to_address import_fee init_state _67 _66 + DROP // timestamps src to_address import_fee init_state _48 + CTOS // timestamps src to_address import_fee init_state body + }> + s4 s5 XCHG + s3 s4 XCHG + s2 s3 XCHG // src to_address import_fee timestamps init_state body + 6 TUPLE // _51 + }> + init_environment PROC:<{ + // + PUSHNULL // _0 + NEWC // _0 _1 + STDICT // _2 + ENDC // _3 + c4 POP + }> + storage_key PROC:<{ + // tag + 2824609491042946229920590003095732224 PUSHINTX // tag _3 + SWAP // _3 tag + ADD // _4 + }> + load_storage_with_tag PROC:<{ + // tag + storage_key CALLDICT // _1 + c4 PUSH // _1 _2 + CTOS // _1 _3 + PLDDICT // _1 _4 + 8 PUSHPOW2 // _1 _4 _5=256 + DICTIGETOPTREF // _6 + }> + save_storage_with_tag PROC:<{ + // tag storage + c4 PUSH // tag storage _3 + CTOS // tag storage _4 + PLDDICT // tag storage dict + s0 s2 XCHG // dict storage tag + storage_key CALLDICT // dict storage _7 + ROT + 8 PUSHPOW2 // storage _7 dict _8=256 + DICTISETREF // dict + NEWC // dict _10 + STDICT // _11 + ENDC // _12 + c4 POP + }> + get_c7 PROCINLINE:<{ + // + 124711402 PUSHINT // _2=124711402 + 0 PUSHINT // _2=124711402 _3=0 + DUP // _2=124711402 _3=0 _4=0 + NOW // _2=124711402 _3=0 _4=0 _5 + 1 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 + DUP // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 + 239 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 + 1000000000 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _10=1000000000 + PUSHNULL // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _10=1000000000 _11 + PAIR // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 + MYADDR // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 _13 + CONFIGROOT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 _13 _14 + 10 TUPLE // _15 + SINGLE // _16 + }> + invoke_method PROC:<{ + // fun args + { + c7 PUSH DUP FIRST + GASLIMITSTEMP SWAP DROP + 11 SETINDEX 0 SETINDEX c7 POP + } : save-gas-remaining + { + GASLIMITSTEMP SWAP DROP + 11 GETPARAM SWAP SUB + 145 PUSHINT SUB + } : compute-gas-used + NEWC ENDC c5 POP + RESETLOADEDCELLS + 255 PUSHINT EXPLODEVAR + DUP INC ROLLX + <{ + <{ + save-gas-remaining + EXECUTE + compute-gas-used + DEPTH DEC ROLLREVX + DEPTH DEC TUPLEVAR + ZERO ROTREV + }> PUSHCONT + <{ + compute-gas-used + ROT DROP NIL + }> PUSHCONT + TRY + }> PUSHCONT + ROT INC -1 PUSHINT + CALLXVARARGS // exit_code gas_used return_values + s2 PUSH // exit_code gas_used return_values exit_code + 0 NEQINT // exit_code gas_used return_values _7 + s3 PUSH // exit_code gas_used return_values _7 exit_code + 1 NEQINT // exit_code gas_used return_values _7 _9 + AND // exit_code gas_used return_values _10 + s1 s3 XCHG // return_values gas_used exit_code _10 + THROWANYIF + SWAP // gas_used return_values + }> + invoke_method_expect_fail PROC:<{ + // fun args + { + c7 PUSH DUP FIRST + GASLIMITSTEMP SWAP DROP + 11 SETINDEX 0 SETINDEX c7 POP + } : save-gas-remaining + { + GASLIMITSTEMP SWAP DROP + 11 GETPARAM SWAP SUB + 145 PUSHINT SUB + } : compute-gas-used + NEWC ENDC c5 POP + RESETLOADEDCELLS + 255 PUSHINT EXPLODEVAR + DUP INC ROLLX + <{ + <{ + save-gas-remaining + EXECUTE + compute-gas-used + DEPTH DEC ROLLREVX + DEPTH DEC TUPLEVAR + ZERO ROTREV + }> PUSHCONT + <{ + compute-gas-used + ROT DROP NIL + }> PUSHCONT + TRY + }> PUSHCONT + ROT INC -1 PUSHINT + CALLXVARARGS // _13 _14 _15 + DROP // exit_code gas_used + OVER // exit_code gas_used exit_code + 0 EQINT // exit_code gas_used _8 + s0 s2 XCHG // _8 gas_used exit_code + 1 EQINT // _8 gas_used _10 + s1 s2 XCHG // gas_used _8 _10 + OR // gas_used _11 + 201 THROWIF + }> + assert_no_actions PROCINLINE:<{ + // + c5 PUSH CTOS // _1 + SEMPTY // _2 + NOT // _3 + 202 THROWIF + }> + token_snake_len PROCINLINE:<{ + // content + 0 PUSHINT // content len=0 + WHILE:<{ + OVER // content len content + ISNULL // content len _3 + NOT // content len _4 + }>DO<{ // content len + OVER // content len content + SBITS // content len _5 + ADD // content len + OVER // content len content + SREFS // content len _7 + IF:<{ // content len + SWAP // len content + LDREF // len _14 _13 + DROP // len _9 + CTOS // len _8 + }>ELSE<{ // content len + NIP // len + PUSHNULL // len _8 + }> // len content + SWAP // content len + }> // content len + NIP // len + }> + get_snake_tail PROCINLINE:<{ + // tail + WHILE:<{ + DUP // tail tail + ISNULL // tail _1 + NOT // tail _2 + }>DO<{ // tail + CTOS // tail_slice + DUP // tail_slice tail_slice + SREFS // tail_slice _5 + IF:<{ // tail_slice + LDREF // _11 _10 + DROP // _6 + }>ELSE<{ // tail_slice + DROP // + PUSHNULL // _6 + }> // tail + }> // tail + }> + snake_concat PROC:<{ + // head tail + SWAP // tail head + CTOS // tail head_sl + NEWC // tail head_sl _5 + OVER // tail head_sl _5 head_sl + SBITS // tail head_sl _5 _7 + s1 s2 XCHG // tail _5 head_sl _7 + LDSLICEX // tail _5 _6 head_sl + -ROT // tail head_sl _5 _6 + STSLICER // tail head_sl snake + OVER // tail head_sl snake head_sl + SREFS // tail head_sl snake _10 + IF:<{ // tail head_sl snake + SWAP // tail snake head_sl + LDREF // tail snake _20 _19 + DROP // tail snake _11 + ROT // snake _11 tail + snake_concat CALLDICT // snake _13 + SWAP // _13 snake + STREF // snake + }>ELSE<{ // tail head_sl snake + NIP // tail snake + STREF // snake + }> + ENDC // _16 + }> + snake_concat_tagged PROCINLINE:<{ + // tag head tail + OVER // tag head tail head + CTOS // tag head tail head_sl + s0 s3 XCHG + NEWC // head_sl head tail tag _6 + 8 STU // head_sl head tail snake + 1015 PUSHINT // head_sl head tail snake lbits + s4 PUSH // head_sl head tail snake lbits head_sl + SBITS // head_sl head tail snake lbits _15 + SWAP // head_sl head tail snake _15 lbits + GREATER // head_sl head tail snake _16 + IF:<{ // head_sl head tail snake + s3 POP // snake head tail + snake_concat CALLDICT // snake _17 + SWAP // _17 snake + STREF // _18 + ENDC // tagged + }>ELSE<{ // head_sl head tail snake + s2 POP // head_sl snake tail + s0 s2 XCHG // tail snake head_sl + STSLICER // tail _20 + ENDC // tail _21 + SWAP // _21 tail + snake_concat CALLDICT // tagged + }> + }> + snake_equal? PROCINLINE:<{ + // snake1 snake2 + TRUE // snake1 snake2 equal + UNTIL:<{ + s2 PUSH // snake1 snake2 equal snake1 + SBITS // snake1 snake2 equal s1_data + s2 PUSH // snake1 snake2 equal s1_data snake2 + SBITS // snake1 snake2 equal s1_data s2_data + 2DUP // snake1 snake2 equal s1_data s2_data s1_data s2_data + LEQ // snake1 snake2 equal s1_data s2_data _8 + IF:<{ // snake1 snake2 equal s1_data s2_data + OVER // snake1 snake2 equal s1_data s2_data s1_data + 0 GTINT // snake1 snake2 equal s1_data s2_data _10 + IF:<{ // snake1 snake2 equal s1_data s2_data + s2 POP // snake1 snake2 s2_data s1_data + s2 s2 XCPU // snake1 s1_data s2_data snake2 s1_data + LDSLICEX // snake1 s1_data s2_data _11 snake2 + s4 s1 PUXC // snake1 s1_data s2_data snake2 snake1 _11 + SDEQ // snake1 s1_data s2_data snake2 equal + 2SWAP // snake1 snake2 equal s1_data s2_data + }> // snake1 snake2 equal s1_data s2_data + s4 PUSH // snake1 snake2 equal s1_data s2_data snake1 + SREFS // snake1 snake2 equal s1_data s2_data _14 + IF:<{ // snake1 snake2 equal s1_data s2_data + s0 s4 XCHG // s2_data snake2 equal s1_data snake1 + LDREF // s2_data snake2 equal s1_data _48 _47 + DROP // s2_data snake2 equal s1_data _16 + CTOS // s2_data snake2 equal s1_data _15 + }>ELSE<{ // snake1 snake2 equal s1_data s2_data + s4 POP // s2_data snake2 equal s1_data + PUSHNULL // s2_data snake2 equal s1_data _15 + }> // s2_data snake2 equal s1_data snake1 + DUP // s2_data snake2 equal s1_data snake1 snake1 + ISNULL // s2_data snake2 equal s1_data snake1 _20 + s5 PUSH // s2_data snake2 equal s1_data snake1 _20 s2_data + AND // s2_data snake2 equal s1_data snake1 _21 + s2 PUSH // s2_data snake2 equal s1_data snake1 _21 s1_data + GREATER // s2_data snake2 equal s1_data snake1 _22 + IF:<{ // s2_data snake2 equal s1_data snake1 + s4 POP + 2DROP // snake1 snake2 + FALSE // snake1 snake2 equal + }>ELSE<{ // s2_data snake2 equal s1_data snake1 + s4 s4 XCHG2 // snake1 snake2 equal s2_data s1_data + EQUAL // snake1 snake2 equal _24 + IF:<{ // snake1 snake2 equal + OVER // snake1 snake2 equal snake2 + SREFS // snake1 snake2 equal _25 + IF:<{ // snake1 snake2 equal + SWAP // snake1 equal snake2 + LDREF // snake1 equal _50 _49 + DROP // snake1 equal _27 + CTOS // snake1 equal _26 + }>ELSE<{ // snake1 snake2 equal + NIP // snake1 equal + PUSHNULL // snake1 equal _26 + }> // snake1 equal snake2 + SWAP // snake1 snake2 equal + }> // snake1 snake2 equal + }> + }>ELSE<{ // snake1 snake2 equal s1_data s2_data + 2 1 BLKDROP2 // snake1 snake2 s2_data + s1 s2 XCHG // snake2 snake1 s2_data + LDSLICEX // snake2 _31 snake1 + s2 s1 PUXC // snake2 snake1 snake2 _31 + SDEQ // snake2 snake1 equal + s2 PUSH // snake2 snake1 equal snake2 + SREFS // snake2 snake1 equal _34 + IF:<{ // snake2 snake1 equal + s0 s2 XCHG // equal snake1 snake2 + LDREF // equal snake1 _54 _53 + DROP // equal snake1 _36 + CTOS // equal snake1 _35 + }>ELSE<{ // snake2 snake1 equal + s2 POP // equal snake1 + PUSHNULL // equal snake1 _35 + }> // equal snake1 snake2 + ROT // snake1 snake2 equal + }> + DUP // snake1 snake2 equal equal + NOT // snake1 snake2 equal _40 + s3 PUSH // snake1 snake2 equal _40 snake1 + ISNULL // snake1 snake2 equal _40 _41 + s3 PUSH // snake1 snake2 equal _40 _41 snake2 + ISNULL // snake1 snake2 equal _40 _41 _42 + AND // snake1 snake2 equal _40 _43 + OR // snake1 snake2 equal _44 + }> // snake1 snake2 equal + 2 1 BLKDROP2 // equal + }> + main PROC:<{ + // + 16 PUSHPOW2DEC // _0=65535 + THROWANY + }> + creator_address PROC:<{ + // + x{8016543D9EAA8BC0ED9A6D5CA2DD4FD7BE655D401195457095F30CD7D9641112B5B_} PUSHSLICE // _0 + }> + process_internal PROC:<{ + // balance msg_value in_msg in_msg_body + s1 s3 XCHG + 3 BLKDROP // in_msg + s0 DUMP // _5 + DROP // + }> + process_external PROC:<{ + // in_msg_body + s0 DUMP // _2 + DROP // + }> + novm::invoke PROCINLINE:<{ + // args method code + DUP // args method code code + ISNULL // args method code _4 + IF:<{ // args method code + DROP // args method + c3 PUSH // args method _5 + }>ELSE<{ // args method code + CTOS // args method _7 + BLESS // args method _5 + }> // args method _9 + -ROT // _9 args method + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // _10 + }> + __test_donations_fail_transfer PROC:<{ + // + CONT:<{ + main CALLDICT + }> // _0 + 0 TUPLE // _0 _1 + invoke_method_expect_fail CALLDICT // _2 + DROP // + }> + __test_creator_address PROC:<{ + // + CONT:<{ + creator_address CALLDICT + }> // _0 + 0 TUPLE // _0 _1 + invoke_method CALLDICT // _3 _4 + }> + __test_invoke_creator_address PROC:<{ + // + NIL // _0 + 119703 PUSHINT // _0 _1=119703 + PUSHNULL // _0 _1=119703 _2 + novm::invoke INLINECALLDICT // _3 + }> + __test_plugin_invoke_creator_address PROC:<{ + // + B{B5EE9C7201010601004F000114FF00F4A413F4BCF2C80B0102016202030002D002037B600405004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81B87D8040} + B>boc PUSHREF // _0 + NIL // _0 _1 + 119703 PUSHINT // _0 _1 _2=119703 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + DUMPSTK + CTOS 1 RUNVM + DEPTH 30 GETGLOB SUB TUPLEVAR + DUMPSTK // _3 + }> + __test_vminvoke_process_internal PROC:<{ + // + -1 PUSHINT // _1=-1 + DUP // _1=-1 _2=-1 + B{B5EE9C7201010601004F000114FF00F4A413F4BCF2C80B0102016202030002D002037B600405004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81B87D8040} + B>boc PUSHREF // _1=-1 _2=-1 _3 + x{617663} PUSHSLICE // _1=-1 _2=-1 _3 _4 + 4 TUPLE // _5 + 121535 PUSHINT // _5 _6=121535 + PUSHNULL // _5 _6=121535 _7 + novm::invoke INLINECALLDICT // _8 + }> + __test_c7_get PROC:<{ + // + get_c7 INLINECALLDICT // _0 + s0 DUMP // _1 + DROP // + }> + __test_c7_tenth_get PROC:<{ + // + get_c7 INLINECALLDICT // _0 + 10 PUSHINT // _0 _1=10 + INDEXVAR // _2 + }> + __test_config_8 PROC:<{ + // + 8 PUSHINT // _0=8 + CONFIGOPTPARAM // _1 + }> + __test_mycode_get PROC:<{ + // + MYCODE // _0 + }> + __test_mycode PROC:<{ + // + B{B5EE9C7201010601004F000114FF00F4A413F4BCF2C80B0102016202030002D002037B600405004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81B87D8040} + B>boc PUSHREF // _1 + HASHCU // _2 + MYCODE // _2 _3 + HASHCU // _2 _4 + EQUAL // _5 + 190 THROWIFNOT + }> + __test_test_address PROC:<{ + // + x{800EFD7E23EC462B062BE53FB98A4C2FD6AD81A0ACF00F5CB269BD17E106B1F7301_} PUSHSLICE // _0 + HASHSU // _1 + MYADDR // _1 _2 + HASHSU // _1 _3 + }> +}END>c diff --git a/build/registry.fif b/build/registry.fif new file mode 100644 index 0000000..3894a0d --- /dev/null +++ b/build/registry.fif @@ -0,0 +1,323 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `D:\TON_FunC\multisig-wallet-v5\func\registry.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + DECLPROC load_workchain + DECLPROC calc_storage_fee_raw + DECLPROC calc_storage_fee + DECLPROC main + 90629 DECLMETHOD get_fee + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + load_workchain PROCINLINE:<{ + // + MYADDR // _2 + REWRITESTDADDR // _4 _5 + DROP // workchain + }> + calc_storage_fee_raw PROCINLINE:<{ + // cells bits time + 18 PUSHINT // cells bits time _4=18 + CONFIGOPTPARAM // cells bits time prices_by_workchain + 0 PUSHINT // cells bits time prices_by_workchain _8=0 + SWAP + 32 PUSHINT // cells bits time _8=0 prices_by_workchain _9=32 + DICTIGET + NULLSWAPIFNOT // cells bits time _33 _34 + DROP // cells bits time prices + 40 PUSHINT // cells bits time prices _12=40 + SDSKIPFIRST // cells bits time prices + load_workchain INLINECALLDICT // cells bits time prices _14 + -1 EQINT // cells bits time prices _16 + IF:<{ // cells bits time prices + 7 PUSHPOW2 // cells bits time prices _18=128 + SDSKIPFIRST // cells bits time prices + }> // cells bits time prices + 64 LDU // cells bits time _21 prices + s0 s3 XCHG // cells prices time _21 bits + MUL // cells prices time base_fee + s0 s2 XCHG // cells base_fee time prices + 64 LDU // cells base_fee time _38 _37 + DROP // cells base_fee time _25 + s0 s3 XCHG2 // time base_fee _25 cells + MUL // time base_fee _28 + ADD // time base_fee + SWAP // base_fee time + MUL // _30 + 16 RSHIFT# // _32 + }> + calc_storage_fee PROCINLINE:<{ + // in time + SWAP + 100000 PUSHINT // time in _5=100000 + CDATASIZE // time _8 _9 _10 + DROP // time cells bits + ROT // cells bits time + calc_storage_fee_raw INLINECALLDICT // _7 + }> + main PROC:<{ + // new_balance msg_value in_msg in_msg_body + s3 POP // in_msg_body msg_value in_msg + s2 PUSH // in_msg_body msg_value in_msg in_msg_body + SBITS // in_msg_body msg_value in_msg _4 + 32 LESSINT // in_msg_body msg_value in_msg _6 + IFRETALT + CTOS // in_msg_body msg_value in_msg_full + 4 LDU // in_msg_body msg_value _10 in_msg_full + SWAP + 1 PUSHINT // in_msg_body msg_value in_msg_full _10 _13=1 + AND // in_msg_body msg_value in_msg_full _14 + IFRETALT + 16 PUSHPOW2DEC // in_msg_body msg_value in_msg_full _16=65535 + s0 s3 XCHG // _16=65535 msg_value in_msg_full in_msg_body + 32 LDU // _16=65535 msg_value in_msg_full _17 in_msg_body + SWAP + 1140839503 PUSHINT // _16=65535 msg_value in_msg_full in_msg_body _17 _20=1140839503 + EQUAL // _16=65535 msg_value in_msg_full in_msg_body _21 + s1 s4 XCHG // in_msg_body msg_value in_msg_full _16=65535 _21 + THROWANYIFNOT + s0 s2 XCHG // in_msg_full msg_value in_msg_body + LDREF // in_msg_full msg_value _98 _97 + DROP // in_msg_full msg_value library + DUP + 31536000 PUSHINT // in_msg_full msg_value library library _27=31536000 + calc_storage_fee INLINECALLDICT // in_msg_full msg_value library fee + 115000000 PUSHINT // in_msg_full msg_value library fee _33 + ADD // in_msg_full msg_value library _34 + s1 s2 XCHG // in_msg_full library msg_value _34 + SUB // in_msg_full library msg_value + DUP // in_msg_full library msg_value msg_value + -1 GTINT // in_msg_full library msg_value _38 + 130 THROWIFNOT + c4 PUSH // in_msg_full library msg_value stored + DUP // in_msg_full library msg_value stored stored + CTOS // in_msg_full library msg_value stored _42 + SEMPTY // in_msg_full library msg_value stored _43 + IF:<{ // in_msg_full library msg_value stored + DROP // in_msg_full library msg_value + PUSHNULL // in_msg_full library msg_value stored + }> // in_msg_full library msg_value stored + s2 PUSH // in_msg_full library msg_value stored library + HASHCU // in_msg_full library msg_value stored _46 + s3 PUSH + s0 s2 XCHG + 8 PUSHPOW2 // in_msg_full library msg_value library _46 stored _47=256 + DICTUSETREF // in_msg_full library msg_value stored + c4 POP + OVER // in_msg_full library msg_value library + 2 PUSHINT SETLIBCODE + NIL // in_msg_full library msg_value _52 + s2 s(-1) PUXC + 119703 PUSHINT // in_msg_full library msg_value library _52 _53=119703 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + CTOS 1 RUNVM + DEPTH 30 GETGLOB SUB TUPLEVAR // in_msg_full library msg_value bounty_addr_tuple + FIRST // in_msg_full library msg_value bounty_addr + DUP // in_msg_full library msg_value bounty_addr bounty_addr + REWRITESTDADDR // in_msg_full library msg_value bounty_addr _101 _102 + 2DROP // in_msg_full library msg_value bounty_addr + 0 PUSHINT // in_msg_full library msg_value bounty_addr _59=0 + 24 PUSHINT // in_msg_full library msg_value bounty_addr _59=0 _60=24 + NEWC // in_msg_full library msg_value bounty_addr _59=0 _60=24 _61 + 6 STU // in_msg_full library msg_value bounty_addr _59=0 _63 + ROT // in_msg_full library msg_value _59=0 _63 bounty_addr + STSLICER // in_msg_full library msg_value _59=0 _64 + 100000000 PUSHINT // in_msg_full library msg_value _59=0 _64 _65=100000000 + STVARUINT16 // in_msg_full library msg_value _59=0 _66 + 107 STU // in_msg_full library msg_value _68 + ENDC // in_msg_full library msg_value _69 + 0 PUSHINT // in_msg_full library msg_value _69 _70=0 + SENDRAWMSG + SWAP // in_msg_full msg_value library + HASHCU // in_msg_full msg_value _72 + 3288323151 PUSHINT // in_msg_full msg_value _72 _73=3288323151 + 24 PUSHINT // in_msg_full msg_value _72 _73=3288323151 _74=24 + NEWC // in_msg_full msg_value _72 _73=3288323151 _74=24 _75 + 6 STU // in_msg_full msg_value _72 _73=3288323151 _77 + s0 s4 XCHG // _77 msg_value _72 _73=3288323151 in_msg_full + LDMSGADDR // _77 msg_value _72 _73=3288323151 _104 _103 + DROP // _77 msg_value _72 _73=3288323151 _78 + s1 s4 XCHG // _73=3288323151 msg_value _72 _77 _78 + STSLICER // _73=3288323151 msg_value _72 _80 + ROT // _73=3288323151 _72 _80 msg_value + STVARUINT16 // _73=3288323151 _72 _81 + s1 s2 XCHG // _72 _73=3288323151 _81 + 143 STU // _72 _87 + 256 STU // _89 + ENDC // _90 + 0 PUSHINT // _90 _91=0 + SENDRAWMSG + }> + get_fee PROC:<{ + // library + 31536000 PUSHINT // library _1=31536000 + calc_storage_fee INLINECALLDICT // _2 + 115000000 PUSHINT // _2 _7 + ADD // _8 + }> +}END>c + +boc>B "build/boc/registry.boc" B>file \ No newline at end of file diff --git a/build/registry_tests.fif b/build/registry_tests.fif new file mode 100644 index 0000000..e46a5e2 --- /dev/null +++ b/build/registry_tests.fif @@ -0,0 +1,2314 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\1.address_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\bad_messages_generator.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\c5_parse_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\message_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\storage-test-helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\tests-helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\token-helpers.func` `D:\TON_FunC\multisig-wallet-v5\func\registry.fc` `D:\TON_FunC\multisig-wallet-v5\tests\registry.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + 114362 DECLMETHOD generate_empty_address + 103563 DECLMETHOD generate_internal_address + 71142 DECLMETHOD generate_internal_address_with_custom_data + 105789 DECLMETHOD generate_external_address + 77760 DECLMETHOD generate_external_address_with_custom_data + 119020 DECLMETHOD generate_var_address + 101577 DECLMETHOD generate_var_address_with_custom_data + DECLPROC generate_any_address + 76887 DECLMETHOD generate_external_out_message_with_bad_source_address + 113901 DECLMETHOD generate_external_out_message_with_bad_destination_address + 124331 DECLMETHOD generate_external_in_message_with_bad_source_address + 128854 DECLMETHOD generate_external_in_message_with_bad_destination_address + 122899 DECLMETHOD generate_internal_message_with_bad_grams_data + 105345 DECLMETHOD generate_internal_message_with_bad_init_state_data + DECLPROC parse_send_raw_message + DECLPROC parse_lib_code + DECLPROC parse_raw_reserve + DECLPROC parse_set_code + DECLPROC parse_c5 + DECLPROC generate_init_state + DECLPROC generate_init_state_with_data + DECLPROC parse_init_state + DECLPROC random_query_id + DECLPROC generate_internal_message_body + DECLPROC generate_internal_message_custom + DECLPROC generate_get_royalty_params + DECLPROC generate_nft_transfer_request + DECLPROC generate_nft_get_static_data_request + DECLPROC generate_nft_deploy_request + DECLPROC generate_jetton_burn_request + DECLPROC generate_jetton_burn_notification + DECLPROC generate_jetton_internal_transfer_request + DECLPROC generate_jetton_transfer_request + DECLPROC generate_internal_message + DECLPROC generate_internal_message_relaxed + DECLPROC generate_external_in_message + DECLPROC generate_external_in_message_with_empty_source_address + DECLPROC generate_external_out_message + DECLPROC generate_external_out_message_with_empty_destination_address + DECLPROC generate_external_out_message_relaxed + DECLPROC parse_internal_message + DECLPROC parse_external_message + 69682 DECLMETHOD init_environment + 104832 DECLMETHOD storage_key + 68533 DECLMETHOD load_storage_with_tag + 113134 DECLMETHOD save_storage_with_tag + 85860 DECLMETHOD get_c7 + 78457 DECLMETHOD invoke_method + 93676 DECLMETHOD invoke_method_expect_fail + 127733 DECLMETHOD assert_no_actions + DECLPROC token_snake_len + DECLPROC get_snake_tail + 103208 DECLMETHOD snake_concat + DECLPROC snake_concat_tagged + DECLPROC snake_equal? + DECLPROC load_workchain + DECLPROC calc_storage_fee_raw + DECLPROC calc_storage_fee + DECLPROC main + 90629 DECLMETHOD get_fee + DECLPROC init_config + DECLPROC __test_donation_transfer + DECLPROC __test_add_plugin_too_low_funds + DECLPROC __test_add_plugin_invalid_opcode + DECLPROC __test_add_plugin_no_config + DECLPROC __test_add_plugin_success + DECLPROC __test_plugin_total_fee_get + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + generate_empty_address PROC:<{ + // + 0 PUSHINT // _0=0 + NEWC // _0=0 _1 + 2 STU // _3 + ENDC // _4 + CTOS // _5 + }> + generate_internal_address PROC:<{ + // + RANDU256 // address + -1 PUSHINT // address _3=-1 + 0 PUSHINT // address _3=-1 _4=0 + 2 PUSHINT // address _3=-1 _4=0 _5=2 + NEWC // address _3=-1 _4=0 _5=2 _6 + 2 STU // address _3=-1 _4=0 _8 + 1 STU // address _3=-1 _10 + 8 STI // address _12 + 256 STU // _14 + ENDC // _15 + CTOS // address_cell + }> + generate_internal_address_with_custom_data PROC:<{ + // anycast workchain_id address + 2 PUSHINT // anycast workchain_id address _4=2 + NEWC // anycast workchain_id address _4=2 _5 + 2 STU // anycast workchain_id address _7 + s1 s3 XCHG // address workchain_id anycast _7 + 1 STU // address workchain_id _9 + 8 STI // address _11 + 256 STU // _13 + ENDC // _14 + CTOS // address_cell + }> + generate_external_address PROC:<{ + // address_length + RANDU256 // address_length address + 1 PUSHINT // address_length address _4=1 + NEWC // address_length address _4=1 _5 + 2 STU // address_length address _7 + s2 s(-1) PUXC // address_length address address_length _7 + 9 STU // address_length address _9 + ROT // address _9 address_length + STUX // _10 + ENDC // _11 + CTOS // address_cell + }> + generate_external_address_with_custom_data PROC:<{ + // address_length address + 1 PUSHINT // address_length address _3=1 + NEWC // address_length address _3=1 _4 + 2 STU // address_length address _6 + s2 s(-1) PUXC // address_length address address_length _6 + 9 STU // address_length address _8 + ROT // address _8 address_length + STUX // _9 + ENDC // _10 + CTOS // address_cell + }> + generate_var_address PROC:<{ + // address_length + DUP + 8 PUSHPOW2 // address_length address_length _1=256 + GREATER // address_length _2 + IFJMP:<{ // address_length + RANDU256 // address_length address + RANDU256 // address_length address address_secondpart + -1 PUSHINT // address_length address address_secondpart _8=-1 + 0 PUSHINT // address_length address address_secondpart _8=-1 _9=0 + 3 PUSHINT // address_length address address_secondpart _8=-1 _9=0 _10=3 + NEWC // address_length address address_secondpart _8=-1 _9=0 _10=3 _11 + 2 STU // address_length address address_secondpart _8=-1 _9=0 _13 + 1 STU // address_length address address_secondpart _8=-1 _15 + s1 s4 XCHG // _8=-1 address address_secondpart address_length _15 + 9 STU // _8=-1 address address_secondpart _17 + s1 s3 XCHG // address_secondpart address _8=-1 _17 + 8 STI // address_secondpart address _19 + 256 STU // address_secondpart _21 + 256 STU // _23 + ENDC // _24 + CTOS // address_cell + }> // address_length + RANDU256 // address_length address + -1 PUSHINT // address_length address _29=-1 + 0 PUSHINT // address_length address _29=-1 _30=0 + 3 PUSHINT // address_length address _29=-1 _30=0 _31=3 + NEWC // address_length address _29=-1 _30=0 _31=3 _32 + 2 STU // address_length address _29=-1 _30=0 _34 + 1 STU // address_length address _29=-1 _36 + s3 s(-1) PUXC // address_length address _29=-1 address_length _36 + 9 STU // address_length address _29=-1 _38 + 8 STI // address_length address _40 + ROT // address _40 address_length + STUX // _41 + ENDC // _42 + CTOS // address_cell + }> + generate_var_address_with_custom_data PROC:<{ + // anycast workchain_id address_length address_slice + OVER + 8 PUSHPOW2 // anycast workchain_id address_length address_slice address_length _4=256 + GREATER // anycast workchain_id address_length address_slice _5 + IFJMP:<{ // anycast workchain_id address_length address_slice + 256 LDU // anycast workchain_id address_length addr address_slice + 256 LDU // anycast workchain_id address_length addr _52 _51 + DROP // anycast workchain_id address_length addr addr_second_part + 3 PUSHINT // anycast workchain_id address_length addr addr_second_part _15=3 + NEWC // anycast workchain_id address_length addr addr_second_part _15=3 _16 + 2 STU // anycast workchain_id address_length addr addr_second_part _18 + s1 s5 XCHG // addr_second_part workchain_id address_length addr anycast _18 + 1 STU // addr_second_part workchain_id address_length addr _20 + s1 s2 XCHG // addr_second_part workchain_id addr address_length _20 + 9 STU // addr_second_part workchain_id addr _22 + s1 s2 XCHG // addr_second_part addr workchain_id _22 + 8 STI // addr_second_part addr _24 + 256 STU // addr_second_part _26 + 256 STU // _28 + ENDC // _29 + CTOS // address_cell + }> // anycast workchain_id address_length address_slice + 256 LDU // anycast workchain_id address_length _54 _53 + DROP // anycast workchain_id address_length addr + 3 PUSHINT // anycast workchain_id address_length addr _36=3 + NEWC // anycast workchain_id address_length addr _36=3 _37 + 2 STU // anycast workchain_id address_length addr _39 + s1 s4 XCHG // addr workchain_id address_length anycast _39 + 1 STU // addr workchain_id address_length _41 + s1 s(-1) PUXC // addr workchain_id address_length address_length _41 + 9 STU // addr workchain_id address_length _43 + s1 s2 XCHG // addr address_length workchain_id _43 + 8 STI // addr address_length _45 + SWAP // addr _45 address_length + STUX // _46 + ENDC // _47 + CTOS // address_cell + }> + generate_any_address PROC:<{ + // typeOfAddress + DUP // typeOfAddress typeOfAddress + 0 EQINT // typeOfAddress _2 + IFJMP:<{ // typeOfAddress + DROP // + generate_empty_address CALLDICT // _3 + }> // typeOfAddress + DUP // typeOfAddress typeOfAddress + 1 EQINT // typeOfAddress _5 + IFJMP:<{ // typeOfAddress + DROP // + generate_internal_address CALLDICT // _6 + }> // typeOfAddress + 2 EQINT // _8 + IFJMP:<{ // + 8 PUSHPOW2 // _9=256 + generate_external_address CALLDICT // _10 + }> // + 8 PUSHPOW2 // _11=256 + generate_var_address CALLDICT // _12 + }> + generate_external_out_message_with_bad_source_address PROC:<{ + // + 1 PUSHINT // _1=1 + -1 PUSHINT // _1=1 _2=-1 + 0 PUSHINT // _1=1 _2=-1 _3=0 + 2 PUSHINT // _1=1 _2=-1 _3=0 _4=2 + NEWC // _1=1 _2=-1 _3=0 _4=2 _5 + 2 STU // _1=1 _2=-1 _3=0 _7 + 1 STU // _1=1 _2=-1 _9 + 8 STI // _1=1 _11 + 10 STU // _13 + ENDC // _14 + CTOS // ssrc_invalid + 0 PUSHINT // ssrc_invalid _16=0 + 3 PUSHINT // ssrc_invalid _16=0 _17=3 + NEWC // ssrc_invalid _16=0 _17=3 _18 + 2 STU // ssrc_invalid _16=0 _20 + 1 STI // ssrc_invalid _22 + SWAP // _22 ssrc_invalid + STSLICER // _23 + ENDC // _24 + }> + generate_external_out_message_with_bad_destination_address PROC:<{ + // + generate_internal_address CALLDICT // ssrc + 0 PUSHINT // ssrc _2=0 + 3 PUSHINT // ssrc _2=0 _3=3 + NEWC // ssrc _2=0 _3=3 _4 + 2 STU // ssrc _2=0 _6 + ROT // _2=0 _6 ssrc + STSLICER // _2=0 _7 + 1 STI // _9 + ENDC // _10 + }> + generate_external_in_message_with_bad_source_address PROC:<{ + // + 0 PUSHINT // _1=0 + 7 PUSHPOW2 // _1=0 _2=128 + 1 PUSHINT // _1=0 _2=128 _3=1 + NEWC // _1=0 _2=128 _3=1 _4 + 2 STU // _1=0 _2=128 _6 + 9 STU // _1=0 _8 + 10 STU // _10 + ENDC // _11 + CTOS // ssrc_invalid + 2 PUSHINT // ssrc_invalid _13=2 + NEWC // ssrc_invalid _13=2 _14 + 2 STU // ssrc_invalid _16 + SWAP // _16 ssrc_invalid + STSLICER // _17 + ENDC // _18 + }> + generate_external_in_message_with_bad_destination_address PROC:<{ + // + 8 PUSHPOW2 // _1=256 + generate_external_address CALLDICT // ssrc + 0 PUSHINT // ssrc _3=0 + 2 PUSHINT // ssrc _3=0 _4=2 + NEWC // ssrc _3=0 _4=2 _5 + 2 STU // ssrc _3=0 _7 + ROT // _3=0 _7 ssrc + STSLICER // _3=0 _8 + 1 STI // _10 + ENDC // _11 + }> + generate_internal_message_with_bad_grams_data PROC:<{ + // + generate_internal_address CALLDICT // ssrc + generate_internal_address CALLDICT // ssrc sdest + 1 PUSHINT // ssrc sdest _4=1 + 8 PUSHINT // ssrc sdest _4=1 _5=8 + 0 PUSHINT // ssrc sdest _4=1 _5=8 _6=0 + s0 s0 s0 PUSH3 // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _9=0 + NEWC // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _9=0 _10 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _12 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _7=0 _14 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _16 + 1 STU // ssrc sdest _4=1 _5=8 _18 + s0 s4 XCHG2 // _5=8 sdest _4=1 _18 ssrc + STSLICER // _5=8 sdest _4=1 _19 + ROT // _5=8 _4=1 _19 sdest + STSLICER // _5=8 _4=1 _20 + s1 s2 XCHG // _4=1 _5=8 _20 + 4 STU // _4=1 _22 + 1 STU // _24 + ENDC // _25 + }> + generate_internal_message_with_bad_init_state_data PROC:<{ + // + generate_internal_address CALLDICT // ssrc + generate_internal_address CALLDICT // ssrc sdest + 1 PUSHINT // ssrc sdest _5=1 + s0 s0 PUSH2 // ssrc sdest _5=1 _6=1 _7=1 + 0 PUSHINT // ssrc sdest _5=1 _6=1 _7=1 _8=0 + s1 s1 s0 PUSH3 // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _11=0 + NEWC // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _11=0 _12 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _14 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _16 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _18 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _20 + 1 STU // ssrc sdest _5=1 _6=1 _22 + 1 STU // ssrc sdest _5=1 _24 + 1 STU // ssrc sdest init_state_with_bad_data + 0 PUSHINT // ssrc sdest init_state_with_bad_data _27=0 + SWAP // ssrc sdest _27=0 init_state_with_bad_data + ENDC // ssrc sdest _27=0 _28 + 1 PUSHINT // ssrc sdest _27=0 _28 _29=1 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 + 1000 PUSHINT // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 + PUSHNULL // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 + s6 s6 s6 PUSH3 // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _37=0 + NEWC // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _37=0 _38 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _40 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _42 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _44 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _46 + s0 s9 XCHG2 // _33 sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _46 ssrc + STSLICER // _33 sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _47 + s0 s7 XCHG2 // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _47 sdest + STSLICER // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _48 + s5 PUSH // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _48 _49=0 + STGRAMS // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _50 + s1 s7 XCHG // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _33 _50 + STDICT // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _51 + s4 PUSH // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _51 _52=0 + STGRAMS // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _53 + s4 PUSH // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _53 _54=0 + STGRAMS // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _55 + s1 s5 XCHG // _31=1000 _30=1 _27=0 _28 _29=1 _32=1000 _55 + 64 STU // _31=1000 _30=1 _27=0 _28 _29=1 _57 + s1 s5 XCHG // _29=1 _30=1 _27=0 _28 _31=1000 _57 + 32 STU // _29=1 _30=1 _27=0 _28 _59 + s1 s3 XCHG // _29=1 _28 _27=0 _30=1 _59 + 1 STU // _29=1 _28 _27=0 _61 + s1 s3 XCHG // _27=0 _28 _29=1 _61 + 1 STU // _27=0 _28 _63 + STREF // _27=0 _64 + 1 STU // _66 + ENDC // _67 + }> + parse_send_raw_message PROCINLINE:<{ + // out_action + 8 LDU // _1 out_action + LDREF // _1 _9 _8 + DROP // _1 _4 + }> + parse_lib_code PROCINLINE:<{ + // out_action + 7 LDU // mode out_action + DUP // mode out_action out_action + SREFS // mode out_action _5 + 0 GTINT // mode out_action _7 + IF:<{ // mode out_action + LDREF // mode _20 _19 + DROP // mode _8 + }>ELSE<{ // mode out_action + 256 LDSLICE // mode _22 _21 + DROP // mode loaded_bits + NEWC // mode loaded_bits _14 + SWAP // mode _14 loaded_bits + STSLICER // mode _15 + ENDC // mode _16 + }> + }> + parse_raw_reserve PROCINLINE:<{ + // out_action + 8 LDU // _1 out_action + LDDICT // _1 _9 _8 + DROP // _1 _4 + }> + parse_set_code PROCINLINE:<{ + // out_action + LDREF // _4 _3 + DROP // _1 + }> + parse_c5 PROCINLINE:<{ + // + NIL // list_of_actions_tuple + c5 PUSH // list_of_actions_tuple c5 + NIL // list_of_actions_tuple c5 actions + SWAP // list_of_actions_tuple actions c5 + CTOS // list_of_actions_tuple actions out_action_node + DUP // list_of_actions_tuple actions out_action_node out_action_node + SBITS // list_of_actions_tuple actions out_action_node _8 + 0 EQINT // list_of_actions_tuple actions out_action_node _10 + IF:<{ // list_of_actions_tuple actions out_action_node + 3 BLKDROP // + PUSHNULL // _11 + }>ELSE<{ // list_of_actions_tuple actions out_action_node + 0 PUSHINT // list_of_actions_tuple actions out_action_node num=0 + UNTIL:<{ + SWAP // list_of_actions_tuple actions num out_action_node + LDREF // list_of_actions_tuple actions num next out_action_node + s0 s3 XCHG2 // list_of_actions_tuple next num out_action_node actions + CONS // list_of_actions_tuple next num actions + s0 s2 XCHG // list_of_actions_tuple actions num next + CTOS // list_of_actions_tuple actions num out_action_node + SWAP // list_of_actions_tuple actions out_action_node num + INC // list_of_actions_tuple actions out_action_node num + OVER // list_of_actions_tuple actions out_action_node num out_action_node + SBITS // list_of_actions_tuple actions out_action_node num _23 + 0 EQINT // list_of_actions_tuple actions out_action_node num break + }> // list_of_actions_tuple actions out_action_node num + NIP // list_of_actions_tuple actions num + 0 PUSHINT // list_of_actions_tuple actions num i=0 + UNTIL:<{ + s0 s2 XCHG // list_of_actions_tuple i num actions + UNCONS // list_of_actions_tuple i num out_action actions + SWAP // list_of_actions_tuple i num actions out_action + 32 LDU // list_of_actions_tuple i num actions action_code out_action + OVER + 247711853 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _35=247711853 + EQUAL // list_of_actions_tuple i num actions action_code out_action _36 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_send_raw_message INLINECALLDICT // list_of_actions_tuple i num actions mode body + 0 PUSHINT // list_of_actions_tuple i num actions mode body _42=0 + s0 s2 XCHG // list_of_actions_tuple i num actions _42=0 body mode + TRIPLE // list_of_actions_tuple i num actions _41 + s1 s4 XCHG // actions i num list_of_actions_tuple _41 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + OVER + 2907562126 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _44=2907562126 + EQUAL // list_of_actions_tuple i num actions action_code out_action _45 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_set_code INLINECALLDICT // list_of_actions_tuple i num actions new_setcode + 1 PUSHINT // list_of_actions_tuple i num actions new_setcode _50=1 + SWAP + -1 PUSHINT // list_of_actions_tuple i num actions _50=1 new_setcode _51=-1 + TRIPLE // list_of_actions_tuple i num actions _49 + s1 s4 XCHG // actions i num list_of_actions_tuple _49 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + OVER + 921090057 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _53=921090057 + EQUAL // list_of_actions_tuple i num actions action_code out_action _54 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_raw_reserve INLINECALLDICT // list_of_actions_tuple i num actions mode currencies + 2 PUSHINT // list_of_actions_tuple i num actions mode currencies _60=2 + s0 s2 XCHG // list_of_actions_tuple i num actions _60=2 currencies mode + TRIPLE // list_of_actions_tuple i num actions _59 + s1 s4 XCHG // actions i num list_of_actions_tuple _59 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + SWAP + 653925844 PUSHINT // list_of_actions_tuple i num actions out_action action_code _62=653925844 + EQUAL // list_of_actions_tuple i num actions out_action _63 + IF:<{ // list_of_actions_tuple i num actions out_action + parse_lib_code INLINECALLDICT // list_of_actions_tuple i num actions mode lib_cell_or_lib_hash + 3 PUSHINT // list_of_actions_tuple i num actions mode lib_cell_or_lib_hash _69=3 + s0 s2 XCHG // list_of_actions_tuple i num actions _69=3 lib_cell_or_lib_hash mode + TRIPLE // list_of_actions_tuple i num actions _68 + s1 s4 XCHG // actions i num list_of_actions_tuple _68 + TPUSH // actions i num list_of_actions_tuple + s0 s3 XCHG // list_of_actions_tuple i num actions + }>ELSE<{ + DROP // list_of_actions_tuple i num actions + }> + s0 s3 XCHG // actions i num list_of_actions_tuple + }> + }> + }> + s0 s2 XCHG // actions list_of_actions_tuple num i + INC // actions list_of_actions_tuple num i + s0 s1 PUSH2 // actions list_of_actions_tuple num i i num + GEQ // actions list_of_actions_tuple num i _73 + s3 s4 XCHG // list_of_actions_tuple actions num i _73 + }> // list_of_actions_tuple actions num i + 3 BLKDROP // list_of_actions_tuple + }> + }> + generate_init_state PROC:<{ + // + 0 PUSHINT // _0=0 + s0 s0 s0 PUSH3 // _0=0 _1=0 _2=0 _3=0 + 1 PUSHINT // _0=0 _1=0 _2=0 _3=0 _4=1 + s0 s1 PUSH2 // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _6=0 + NEWC // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _6=0 _7 + 1 STU // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _9 + 1 STU // _0=0 _1=0 _2=0 _3=0 _4=1 _11 + 1 STU // _0=0 _1=0 _2=0 _3=0 _13 + 1 STU // _0=0 _1=0 _2=0 _15 + 1 STU // _0=0 _1=0 _17 + 1 STU // _0=0 _19 + 1 STU // _21 + }> + generate_init_state_with_data PROC:<{ + // code data library + 1 PUSHINT // code data library _3=1 + s0 s0 PUSH2 // code data library _3=1 _4=1 _5=1 + 0 PUSHINT // code data library _3=1 _4=1 _5=1 _6=0 + s1 s1 s0 PUSH3 // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _9=0 + NEWC // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _9=0 _10 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _12 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _14 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _16 + 1 STU // code data library _3=1 _4=1 _5=1 _18 + 1 STU // code data library _3=1 _4=1 _20 + s1 s5 XCHG // _4=1 data library _3=1 code _20 + STREF // _4=1 data library _3=1 _21 + s1 s4 XCHG // _3=1 data library _4=1 _21 + 1 STU // _3=1 data library _23 + s1 s2 XCHG // _3=1 library data _23 + STREF // _3=1 library _24 + s1 s2 XCHG // library _3=1 _24 + 1 STU // library _26 + STREF // _27 + }> + parse_init_state PROC:<{ + // cs + NIL // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_five cs + s2 s1 XCPU // cs maybe_five parsed_tuple maybe_five + TPUSH // cs maybe_five parsed_tuple + SWAP // cs parsed_tuple maybe_five + 1 EQINT // cs parsed_tuple _10 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + 5 LDU // parsed_tuple _12 cs + -ROT // cs parsed_tuple _12 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_tick_tock cs + s2 s1 XCPU // cs maybe_tick_tock parsed_tuple maybe_tick_tock + TPUSH // cs maybe_tick_tock parsed_tuple + SWAP // cs parsed_tuple maybe_tick_tock + 1 EQINT // cs parsed_tuple _23 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple _25 cs + -ROT // cs parsed_tuple _25 + TPUSH // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple _30 cs + -ROT // cs parsed_tuple _30 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_code cs + s2 s1 XCPU // cs maybe_code parsed_tuple maybe_code + TPUSH // cs maybe_code parsed_tuple + SWAP // cs parsed_tuple maybe_code + 1 EQINT // cs parsed_tuple _41 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _43 cs + -ROT // cs parsed_tuple _43 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_data cs + s2 s1 XCPU // cs maybe_data parsed_tuple maybe_data + TPUSH // cs maybe_data parsed_tuple + SWAP // cs parsed_tuple maybe_data + 1 EQINT // cs parsed_tuple _53 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _55 cs + -ROT // cs parsed_tuple _55 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_library cs + s2 s1 XCPU // cs maybe_library parsed_tuple maybe_library + TPUSH // cs maybe_library parsed_tuple + SWAP // cs parsed_tuple maybe_library + 1 EQINT // cs parsed_tuple _65 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _91 _90 + DROP // parsed_tuple _67 + TPUSH // parsed_tuple + }>ELSE<{ + NIP // parsed_tuple + }> + }> + random_query_id PROC:<{ + // + LTIME + ADDRAND + 64 PUSHPOW2 // _3 + RAND // _4 + INC // _6 + }> + generate_internal_message_body PROC:<{ + // op query_id + SWAP + NEWC // query_id op _3 + 32 STU // query_id body + OVER // query_id body query_id + 0 EQINT // query_id body _7 + IF:<{ // query_id body + NIP // body + random_query_id CALLDICT // body query_id + SWAP // query_id body + }> // query_id body + 64 STU // _10 + }> + generate_internal_message_custom PROC:<{ + // bounce ton_amount init_state payload src_addr dst_addr fwd_fee + s2 PUSH // bounce ton_amount init_state payload src_addr dst_addr fwd_fee src_addr + ISNULL // bounce ton_amount init_state payload src_addr dst_addr fwd_fee _8 + IF:<{ // bounce ton_amount init_state payload src_addr dst_addr fwd_fee + s2 POP // bounce ton_amount init_state payload fwd_fee dst_addr + generate_internal_address CALLDICT // bounce ton_amount init_state payload fwd_fee dst_addr _9 + }>ELSE<{ // bounce ton_amount init_state payload _9 dst_addr fwd_fee + s0 s2 XCHG // bounce ton_amount init_state payload fwd_fee dst_addr _9 + }> // bounce ton_amount init_state payload fwd_fee dst_addr ssrc + OVER // bounce ton_amount init_state payload fwd_fee dst_addr ssrc dst_addr + ISNULL // bounce ton_amount init_state payload fwd_fee dst_addr ssrc _12 + IF:<{ // bounce ton_amount init_state payload fwd_fee dst_addr ssrc + NIP // bounce ton_amount init_state payload fwd_fee ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload fwd_fee ssrc _13 + }>ELSE<{ // bounce ton_amount init_state payload fwd_fee _13 ssrc + SWAP // bounce ton_amount init_state payload fwd_fee ssrc _13 + }> // bounce ton_amount init_state payload fwd_fee ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 + DUP // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 + PUSHNULL // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 + 0 PUSHINT // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _21=0 + NEWC // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _21=0 _22 + 1 STU // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _24 + 1 STU // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _26 + s1 s11 XCHG // _19=0 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 bounce _26 + 1 STU // _19=0 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _28 + s1 s10 XCHG // _18 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _19=0 _28 + 1 STU // _18 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _30 + s0 s4 XCHG2 // _18 ton_amount init_state payload fwd_fee _17=1000 sdest _16=1000 _30 ssrc + STSLICER // _18 ton_amount init_state payload fwd_fee _17=1000 sdest _16=1000 _31 + ROT // _18 ton_amount init_state payload fwd_fee _17=1000 _16=1000 _31 sdest + STSLICER // _18 ton_amount init_state payload fwd_fee _17=1000 _16=1000 _32 + s0 s6 XCHG2 // _18 _16=1000 init_state payload fwd_fee _17=1000 _32 ton_amount + STGRAMS // _18 _16=1000 init_state payload fwd_fee _17=1000 _33 + s1 s6 XCHG // _17=1000 _16=1000 init_state payload fwd_fee _18 _33 + STDICT // _17=1000 _16=1000 init_state payload fwd_fee _34 + 0 PUSHINT // _17=1000 _16=1000 init_state payload fwd_fee _34 _35=0 + STGRAMS // _17=1000 _16=1000 init_state payload fwd_fee _36 + SWAP // _17=1000 _16=1000 init_state payload _36 fwd_fee + STGRAMS // _17=1000 _16=1000 init_state payload _37 + s1 s4 XCHG // payload _16=1000 init_state _17=1000 _37 + 64 STU // payload _16=1000 init_state _39 + s1 s2 XCHG // payload init_state _16=1000 _39 + 32 STU // payload init_state _41 + s1 s(-1) PUXC // payload init_state init_state _41 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _45 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _48 + OVER // payload msg init_state_builder _48 init_state_builder + BBITS // payload msg init_state_builder _48 _49 + ADD // payload msg init_state_builder _50 + 10 PUSHPOW2DEC // payload msg init_state_builder _50 _51=1023 + GEQ // payload msg init_state_builder _52 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _53 + 1 PUSHINT + ROT // payload _53 _54=1 msg + 1 STU // payload _53 _56 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _58=0 msg + 1 STU // payload init_state_builder _60 + SWAP // payload _60 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _62 + s2 PUSH // payload msg _62 payload + BBITS // payload msg _62 _63 + ADD // payload msg _64 + 10 PUSHPOW2DEC // payload msg _64 _65=1023 + GEQ // payload msg _66 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _67 + 1 PUSHINT + ROT // _67 _68=1 msg + 1 STU // _67 _70 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _72=0 + SWAP // payload _72=0 msg + 1 STU // payload _74 + SWAP // _74 payload + STBR // msg + }> + ENDC // _76 + }> + generate_get_royalty_params PROC:<{ + // query_id + 1765620048 PUSHINT // query_id _1=1765620048 + SWAP // _1=1765620048 query_id + generate_internal_message_body CALLDICT // _2 + }> + generate_nft_transfer_request PROC:<{ + // new_owner response_dst query_id custom_payload forward_amount forward_payload is_ref? + 1607220500 PUSHINT // new_owner response_dst query_id custom_payload forward_amount forward_payload is_ref? _8=1607220500 + s0 s5 XCHG2 // new_owner response_dst is_ref? custom_payload forward_amount forward_payload _8=1607220500 query_id + generate_internal_message_body CALLDICT // new_owner response_dst is_ref? custom_payload forward_amount forward_payload _9 + s0 s6 XCHG2 // forward_payload response_dst is_ref? custom_payload forward_amount _9 new_owner + STSLICER // forward_payload response_dst is_ref? custom_payload forward_amount _10 + s0 s4 XCHG2 // forward_payload forward_amount is_ref? custom_payload _10 response_dst + STSLICER // forward_payload forward_amount is_ref? custom_payload req + OVER // forward_payload forward_amount is_ref? custom_payload req custom_payload + ISNULL // forward_payload forward_amount is_ref? custom_payload req _12 + IF:<{ // forward_payload forward_amount is_ref? custom_payload req + 0 PUSHINT + s2 POP // forward_payload forward_amount is_ref? _13=0 req + 1 STU // forward_payload forward_amount is_ref? req + }>ELSE<{ // forward_payload forward_amount is_ref? custom_payload req + 1 PUSHINT // forward_payload forward_amount is_ref? custom_payload req _16=1 + SWAP // forward_payload forward_amount is_ref? custom_payload _16=1 req + 1 STU // forward_payload forward_amount is_ref? custom_payload _18 + STREF // forward_payload forward_amount is_ref? req + }> + ROT // forward_payload is_ref? req forward_amount + STGRAMS // forward_payload is_ref? req + s2 PUSH // forward_payload is_ref? req forward_payload + ISNULL // forward_payload is_ref? req _21 + NOT // forward_payload is_ref? req _22 + IF:<{ // forward_payload is_ref? req + SWAP // forward_payload req is_ref? + IF:<{ // forward_payload req + 1 PUSHINT // forward_payload req _23=1 + SWAP // forward_payload _23=1 req + 1 STU // forward_payload _25 + STREF // req + }>ELSE<{ // forward_payload req + 0 PUSHINT // forward_payload req _27=0 + SWAP // forward_payload _27=0 req + 1 STU // forward_payload _29 + SWAP // _29 forward_payload + CTOS // _29 _30 + STSLICER // req + }> + }>ELSE<{ // forward_payload is_ref? req + NIP + 0 PUSHINT + s2 POP // _32=0 req + 1 STU // req + }> + }> + generate_nft_get_static_data_request PROC:<{ + // query_id + 801842850 PUSHINT // query_id _1=801842850 + NEWC // query_id _1=801842850 _2 + 32 STU // query_id _4 + 64 STU // _6 + }> + generate_nft_deploy_request PROC:<{ + // idx content query_id forward_amount + 1 PUSHINT + ROT // idx content forward_amount _4=1 query_id + generate_internal_message_body CALLDICT // idx content forward_amount _5 + s1 s3 XCHG // forward_amount content idx _5 + 64 STU // forward_amount content _7 + ROT // content _7 forward_amount + STGRAMS // content _8 + STREF // _9 + }> + generate_jetton_burn_request PROC:<{ + // query_id amount dst custom_payload + 1499400124 PUSHINT // query_id amount dst custom_payload _5=1499400124 + s0 s4 XCHG2 // custom_payload amount dst _5=1499400124 query_id + generate_internal_message_body CALLDICT // custom_payload amount dst _6 + ROT // custom_payload dst _6 amount + STGRAMS // custom_payload dst _7 + SWAP // custom_payload _7 dst + STSLICER // custom_payload burn_msg + OVER // custom_payload burn_msg custom_payload + ISNULL // custom_payload burn_msg _9 + NOT // custom_payload burn_msg _10 + IF:<{ // custom_payload burn_msg + 1 PUSHINT // custom_payload burn_msg _11=1 + SWAP // custom_payload _11=1 burn_msg + 1 STU // custom_payload _13 + STREF // burn_msg + }>ELSE<{ // custom_payload burn_msg + 0 PUSHINT + s2 POP // _15=0 burn_msg + 1 STU // burn_msg + }> + }> + generate_jetton_burn_notification PROC:<{ + // query_id amount sender resp_dst + 2078119902 PUSHINT // query_id amount sender resp_dst _4=2078119902 + s0 s4 XCHG2 // resp_dst amount sender _4=2078119902 query_id + generate_internal_message_body CALLDICT // resp_dst amount sender _5 + ROT // resp_dst sender _5 amount + STGRAMS // resp_dst sender _6 + SWAP // resp_dst _6 sender + STSLICER // resp_dst _7 + SWAP // _7 resp_dst + STSLICER // _8 + }> + generate_jetton_internal_transfer_request PROC:<{ + // query_id amount from resp_addr forward_amount forward_payload is_ref? + 395134233 PUSHINT // query_id amount from resp_addr forward_amount forward_payload is_ref? _8=395134233 + s0 s7 XCHG2 // is_ref? amount from resp_addr forward_amount forward_payload _8=395134233 query_id + generate_internal_message_body CALLDICT // is_ref? amount from resp_addr forward_amount forward_payload _9 + s0 s5 XCHG2 // is_ref? forward_payload from resp_addr forward_amount _9 amount + STGRAMS // is_ref? forward_payload from resp_addr forward_amount _10 + s0 s3 XCHG2 // is_ref? forward_payload forward_amount resp_addr _10 from + STSLICER // is_ref? forward_payload forward_amount resp_addr _11 + SWAP // is_ref? forward_payload forward_amount _11 resp_addr + STSLICER // is_ref? forward_payload forward_amount _12 + SWAP // is_ref? forward_payload _12 forward_amount + STGRAMS // is_ref? forward_payload req + OVER // is_ref? forward_payload req forward_payload + ISNULL // is_ref? forward_payload req _14 + NOT // is_ref? forward_payload req _15 + IF:<{ // is_ref? forward_payload req + s0 s2 XCHG // req forward_payload is_ref? + IF:<{ // req forward_payload + 1 PUSHINT + ROT // forward_payload _16=1 req + 1 STU // forward_payload _18 + STREF // req + }>ELSE<{ // req forward_payload + 0 PUSHINT + ROT // forward_payload _20=0 req + 1 STU // forward_payload _22 + SWAP // _22 forward_payload + CTOS // _22 _23 + STSLICER // req + }> + }>ELSE<{ // is_ref? forward_payload req + NIP + 0 PUSHINT + s2 POP // _25=0 req + 1 STU // req + }> + }> + generate_jetton_transfer_request PROC:<{ + // query_id amount dst resp_dst custom_payload forward_amount forward_payload is_ref? + 260734629 PUSHINT // query_id amount dst resp_dst custom_payload forward_amount forward_payload is_ref? _9=260734629 + s0 s8 XCHG2 // is_ref? amount dst resp_dst custom_payload forward_amount forward_payload _9=260734629 query_id + generate_internal_message_body CALLDICT // is_ref? amount dst resp_dst custom_payload forward_amount forward_payload _10 + s0 s6 XCHG2 // is_ref? forward_payload dst resp_dst custom_payload forward_amount _10 amount + STGRAMS // is_ref? forward_payload dst resp_dst custom_payload forward_amount _11 + s0 s4 XCHG2 // is_ref? forward_payload forward_amount resp_dst custom_payload _11 dst + STSLICER // is_ref? forward_payload forward_amount resp_dst custom_payload _12 + ROT // is_ref? forward_payload forward_amount custom_payload _12 resp_dst + STSLICER // is_ref? forward_payload forward_amount custom_payload req + OVER // is_ref? forward_payload forward_amount custom_payload req custom_payload + ISNULL // is_ref? forward_payload forward_amount custom_payload req _14 + IF:<{ // is_ref? forward_payload forward_amount custom_payload req + 0 PUSHINT + s2 POP // is_ref? forward_payload forward_amount _15=0 req + 1 STU // is_ref? forward_payload forward_amount req + }>ELSE<{ // is_ref? forward_payload forward_amount custom_payload req + 1 PUSHINT // is_ref? forward_payload forward_amount custom_payload req _18=1 + SWAP // is_ref? forward_payload forward_amount custom_payload _18=1 req + 1 STU // is_ref? forward_payload forward_amount custom_payload _20 + STREF // is_ref? forward_payload forward_amount req + }> + SWAP // is_ref? forward_payload req forward_amount + STGRAMS // is_ref? forward_payload req + OVER // is_ref? forward_payload req forward_payload + ISNULL // is_ref? forward_payload req _23 + NOT // is_ref? forward_payload req _24 + IF:<{ // is_ref? forward_payload req + s0 s2 XCHG // req forward_payload is_ref? + IF:<{ // req forward_payload + 1 PUSHINT + ROT // forward_payload _25=1 req + 1 STU // forward_payload _27 + STREF // req + }>ELSE<{ // req forward_payload + 0 PUSHINT + ROT // forward_payload _29=0 req + 1 STU // forward_payload _31 + SWAP // _31 forward_payload + CTOS // _31 _32 + STSLICER // req + }> + }>ELSE<{ // is_ref? forward_payload req + NIP + 0 PUSHINT + s2 POP // _34=0 req + 1 STU // req + }> + }> + generate_internal_message PROC:<{ + // bounce ton_amount init_state payload + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload ssrc sdest _9=1000 + DUP // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 + PUSHNULL // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 + 0 PUSHINT // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _14=0 + NEWC // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _14=0 _15 + 1 STU // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _17 + 1 STU // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _19 + s1 s10 XCHG // _12=0 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 bounce _19 + 1 STU // _12=0 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _21 + s1 s9 XCHG // _11 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _12=0 _21 + 1 STU // _11 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _23 + s0 s4 XCHG2 // _11 ton_amount init_state payload _10=1000 sdest _9=1000 _23 ssrc + STSLICER // _11 ton_amount init_state payload _10=1000 sdest _9=1000 _24 + ROT // _11 ton_amount init_state payload _10=1000 _9=1000 _24 sdest + STSLICER // _11 ton_amount init_state payload _10=1000 _9=1000 _25 + s0 s5 XCHG2 // _11 _9=1000 init_state payload _10=1000 _25 ton_amount + STGRAMS // _11 _9=1000 init_state payload _10=1000 _26 + s1 s5 XCHG // _10=1000 _9=1000 init_state payload _11 _26 + STDICT // _10=1000 _9=1000 init_state payload _27 + 0 PUSHINT // _10=1000 _9=1000 init_state payload _27 _28=0 + STGRAMS // _10=1000 _9=1000 init_state payload _29 + 0 PUSHINT // _10=1000 _9=1000 init_state payload _29 _30=0 + STGRAMS // _10=1000 _9=1000 init_state payload _31 + s1 s4 XCHG // payload _9=1000 init_state _10=1000 _31 + 64 STU // payload _9=1000 init_state _33 + s1 s2 XCHG // payload init_state _9=1000 _33 + 32 STU // payload init_state _35 + s1 s(-1) PUXC // payload init_state init_state _35 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _39 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _42 + OVER // payload msg init_state_builder _42 init_state_builder + BBITS // payload msg init_state_builder _42 _43 + ADD // payload msg init_state_builder _44 + 10 PUSHPOW2DEC // payload msg init_state_builder _44 _45=1023 + GEQ // payload msg init_state_builder _46 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _47 + 1 PUSHINT + ROT // payload _47 _48=1 msg + 1 STU // payload _47 _50 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _52=0 msg + 1 STU // payload init_state_builder _54 + SWAP // payload _54 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _56 + s2 PUSH // payload msg _56 payload + BBITS // payload msg _56 _57 + ADD // payload msg _58 + 10 PUSHPOW2DEC // payload msg _58 _59=1023 + GEQ // payload msg _60 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _61 + 1 PUSHINT + ROT // _61 _62=1 msg + 1 STU // _61 _64 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _66=0 + SWAP // payload _66=0 msg + 1 STU // payload _68 + SWAP // _68 payload + STBR // msg + }> + ENDC // _70 + }> + generate_internal_message_relaxed PROC:<{ + // bounce ton_amount init_state payload typeOfAnyAddress + generate_any_address CALLDICT // bounce ton_amount init_state payload ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload ssrc sdest _10=1000 + DUP // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 + PUSHNULL // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 + 0 PUSHINT // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _15=0 + NEWC // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _15=0 _16 + 1 STU // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _18 + 1 STU // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _20 + s1 s10 XCHG // _13=0 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 bounce _20 + 1 STU // _13=0 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _22 + s1 s9 XCHG // _12 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _13=0 _22 + 1 STU // _12 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _24 + s0 s4 XCHG2 // _12 ton_amount init_state payload _11=1000 sdest _10=1000 _24 ssrc + STSLICER // _12 ton_amount init_state payload _11=1000 sdest _10=1000 _25 + ROT // _12 ton_amount init_state payload _11=1000 _10=1000 _25 sdest + STSLICER // _12 ton_amount init_state payload _11=1000 _10=1000 _26 + s0 s5 XCHG2 // _12 _10=1000 init_state payload _11=1000 _26 ton_amount + STGRAMS // _12 _10=1000 init_state payload _11=1000 _27 + s1 s5 XCHG // _11=1000 _10=1000 init_state payload _12 _27 + STDICT // _11=1000 _10=1000 init_state payload _28 + 0 PUSHINT // _11=1000 _10=1000 init_state payload _28 _29=0 + STGRAMS // _11=1000 _10=1000 init_state payload _30 + 0 PUSHINT // _11=1000 _10=1000 init_state payload _30 _31=0 + STGRAMS // _11=1000 _10=1000 init_state payload _32 + s1 s4 XCHG // payload _10=1000 init_state _11=1000 _32 + 64 STU // payload _10=1000 init_state _34 + s1 s2 XCHG // payload init_state _10=1000 _34 + 32 STU // payload init_state _36 + s1 s(-1) PUXC // payload init_state init_state _36 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _40 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _43 + OVER // payload msg init_state_builder _43 init_state_builder + BBITS // payload msg init_state_builder _43 _44 + ADD // payload msg init_state_builder _45 + 10 PUSHPOW2DEC // payload msg init_state_builder _45 _46=1023 + GEQ // payload msg init_state_builder _47 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _48 + 1 PUSHINT + ROT // payload _48 _49=1 msg + 1 STU // payload _48 _51 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _53=0 msg + 1 STU // payload init_state_builder _55 + SWAP // payload _55 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _57 + s2 PUSH // payload msg _57 payload + BBITS // payload msg _57 _58 + ADD // payload msg _59 + 10 PUSHPOW2DEC // payload msg _59 _60=1023 + GEQ // payload msg _61 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _62 + 1 PUSHINT + ROT // _62 _63=1 msg + 1 STU // _62 _65 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _67=0 + SWAP // payload _67=0 msg + 1 STU // payload _69 + SWAP // _69 payload + STBR // msg + }> + ENDC // _71 + }> + generate_external_in_message PROC:<{ + // import_fee init_state payload + 8 PUSHPOW2 // import_fee init_state payload _4=256 + generate_external_address CALLDICT // import_fee init_state payload ssrc + generate_internal_address CALLDICT // import_fee init_state payload ssrc sdest + 2 PUSHINT // import_fee init_state payload ssrc sdest _9=2 + NEWC // import_fee init_state payload ssrc sdest _9=2 _10 + 2 STU // import_fee init_state payload ssrc sdest _12 + ROT // import_fee init_state payload sdest _12 ssrc + STSLICER // import_fee init_state payload sdest _13 + SWAP // import_fee init_state payload _13 sdest + STSLICER // import_fee init_state payload _14 + s0 s3 XCHG2 // payload init_state _14 import_fee + STGRAMS // payload init_state _15 + s1 s(-1) PUXC // payload init_state init_state _15 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _19 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _22 + OVER // payload msg init_state_builder _22 init_state_builder + BBITS // payload msg init_state_builder _22 _23 + ADD // payload msg init_state_builder _24 + 10 PUSHPOW2DEC // payload msg init_state_builder _24 _25=1023 + GEQ // payload msg init_state_builder _26 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _27 + 1 PUSHINT + ROT // payload _27 _28=1 msg + 1 STU // payload _27 _30 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _32=0 msg + 1 STU // payload init_state_builder _34 + SWAP // payload _34 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _36 + s2 PUSH // payload msg _36 payload + BBITS // payload msg _36 _37 + ADD // payload msg _38 + 10 PUSHPOW2DEC // payload msg _38 _39=1023 + GREATER // payload msg _40 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _41 + 1 PUSHINT + ROT // _41 _42=1 msg + 1 STU // _41 _44 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _46=0 + SWAP // payload _46=0 msg + 1 STU // payload _48 + SWAP // _48 payload + STBR // msg + }> + ENDC // _50 + }> + generate_external_in_message_with_empty_source_address PROC:<{ + // import_fee init_state payload + generate_empty_address CALLDICT // import_fee init_state payload ssrc + generate_internal_address CALLDICT // import_fee init_state payload ssrc sdest + 2 PUSHINT // import_fee init_state payload ssrc sdest _8=2 + NEWC // import_fee init_state payload ssrc sdest _8=2 _9 + 2 STU // import_fee init_state payload ssrc sdest _11 + ROT // import_fee init_state payload sdest _11 ssrc + STSLICER // import_fee init_state payload sdest _12 + SWAP // import_fee init_state payload _12 sdest + STSLICER // import_fee init_state payload _13 + s0 s3 XCHG2 // payload init_state _13 import_fee + STGRAMS // payload init_state _14 + s1 s(-1) PUXC // payload init_state init_state _14 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _18 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _21 + OVER // payload msg init_state_builder _21 init_state_builder + BBITS // payload msg init_state_builder _21 _22 + ADD // payload msg init_state_builder _23 + 10 PUSHPOW2DEC // payload msg init_state_builder _23 _24=1023 + GEQ // payload msg init_state_builder _25 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _26 + 1 PUSHINT + ROT // payload _26 _27=1 msg + 1 STU // payload _26 _29 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _31=0 msg + 1 STU // payload init_state_builder _33 + SWAP // payload _33 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _35 + s2 PUSH // payload msg _35 payload + BBITS // payload msg _35 _36 + ADD // payload msg _37 + 10 PUSHPOW2DEC // payload msg _37 _38=1023 + GEQ // payload msg _39 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _40 + 1 PUSHINT + ROT // _40 _41=1 msg + 1 STU // _40 _43 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _45=0 + SWAP // payload _45=0 msg + 1 STU // payload _47 + SWAP // _47 payload + STBR // msg + }> + ENDC // _49 + }> + generate_external_out_message PROC:<{ + // import_fee init_state payload + s2 POP // payload init_state + generate_internal_address CALLDICT // payload init_state ssrc + 8 PUSHPOW2 // payload init_state ssrc _6=256 + generate_external_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _9=1000 + DUP // payload init_state ssrc sdest _9=1000 _10=1000 + 3 PUSHINT // payload init_state ssrc sdest _9=1000 _10=1000 _11=3 + NEWC // payload init_state ssrc sdest _9=1000 _10=1000 _11=3 _12 + 2 STU // payload init_state ssrc sdest _9=1000 _10=1000 _14 + s0 s4 XCHG2 // payload init_state _10=1000 sdest _9=1000 _14 ssrc + STSLICER // payload init_state _10=1000 sdest _9=1000 _15 + ROT // payload init_state _10=1000 _9=1000 _15 sdest + STSLICER // payload init_state _10=1000 _9=1000 _16 + s1 s2 XCHG // payload init_state _9=1000 _10=1000 _16 + 64 STU // payload init_state _9=1000 _18 + 32 STU // payload init_state _20 + s1 s(-1) PUXC // payload init_state init_state _20 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _24 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _27 + OVER // payload msg init_state_builder _27 init_state_builder + BBITS // payload msg init_state_builder _27 _28 + ADD // payload msg init_state_builder _29 + 10 PUSHPOW2DEC // payload msg init_state_builder _29 _30=1023 + GEQ // payload msg init_state_builder _31 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _32 + 1 PUSHINT + ROT // payload _32 _33=1 msg + 1 STU // payload _32 _35 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _37=0 msg + 1 STU // payload init_state_builder _39 + SWAP // payload _39 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _41 + s2 PUSH // payload msg _41 payload + BBITS // payload msg _41 _42 + ADD // payload msg _43 + 10 PUSHPOW2DEC // payload msg _43 _44=1023 + GEQ // payload msg _45 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _46 + 1 PUSHINT + ROT // _46 _47=1 msg + 1 STU // _46 _49 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _51=0 + SWAP // payload _51=0 msg + 1 STU // payload _53 + SWAP // _53 payload + STBR // msg + }> + ENDC // _55 + }> + generate_external_out_message_with_empty_destination_address PROC:<{ + // import_fee init_state payload + s2 POP // payload init_state + generate_internal_address CALLDICT // payload init_state ssrc + generate_empty_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _8=1000 + DUP // payload init_state ssrc sdest _8=1000 _9=1000 + 3 PUSHINT // payload init_state ssrc sdest _8=1000 _9=1000 _10=3 + NEWC // payload init_state ssrc sdest _8=1000 _9=1000 _10=3 _11 + 2 STU // payload init_state ssrc sdest _8=1000 _9=1000 _13 + s0 s4 XCHG2 // payload init_state _9=1000 sdest _8=1000 _13 ssrc + STSLICER // payload init_state _9=1000 sdest _8=1000 _14 + ROT // payload init_state _9=1000 _8=1000 _14 sdest + STSLICER // payload init_state _9=1000 _8=1000 _15 + s1 s2 XCHG // payload init_state _8=1000 _9=1000 _15 + 64 STU // payload init_state _8=1000 _17 + 32 STU // payload init_state _19 + s1 s(-1) PUXC // payload init_state init_state _19 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _23 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _26 + OVER // payload msg init_state_builder _26 init_state_builder + BBITS // payload msg init_state_builder _26 _27 + ADD // payload msg init_state_builder _28 + 10 PUSHPOW2DEC // payload msg init_state_builder _28 _29=1023 + GEQ // payload msg init_state_builder _30 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _31 + 1 PUSHINT + ROT // payload _31 _32=1 msg + 1 STU // payload _31 _34 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _36=0 msg + 1 STU // payload init_state_builder _38 + SWAP // payload _38 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _40 + s2 PUSH // payload msg _40 payload + BBITS // payload msg _40 _41 + ADD // payload msg _42 + 10 PUSHPOW2DEC // payload msg _42 _43=1023 + GEQ // payload msg _44 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _45 + 1 PUSHINT + ROT // _45 _46=1 msg + 1 STU // _45 _48 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _50=0 + SWAP // payload _50=0 msg + 1 STU // payload _52 + SWAP // _52 payload + STBR // msg + }> + ENDC // _54 + }> + generate_external_out_message_relaxed PROC:<{ + // ton_amount init_state payload typeOfAnyAddress + s3 POP // typeOfAnyAddress init_state payload + s0 s2 XCHG // payload init_state typeOfAnyAddress + generate_any_address CALLDICT // payload init_state ssrc + 8 PUSHPOW2 // payload init_state ssrc _7=256 + generate_external_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _10=1000 + DUP // payload init_state ssrc sdest _10=1000 _11=1000 + 3 PUSHINT // payload init_state ssrc sdest _10=1000 _11=1000 _12=3 + NEWC // payload init_state ssrc sdest _10=1000 _11=1000 _12=3 _13 + 2 STU // payload init_state ssrc sdest _10=1000 _11=1000 _15 + s0 s4 XCHG2 // payload init_state _11=1000 sdest _10=1000 _15 ssrc + STSLICER // payload init_state _11=1000 sdest _10=1000 _16 + ROT // payload init_state _11=1000 _10=1000 _16 sdest + STSLICER // payload init_state _11=1000 _10=1000 _17 + s1 s2 XCHG // payload init_state _10=1000 _11=1000 _17 + 64 STU // payload init_state _10=1000 _19 + 32 STU // payload init_state _21 + s1 s(-1) PUXC // payload init_state init_state _21 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _25 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _28 + OVER // payload msg init_state_builder _28 init_state_builder + BBITS // payload msg init_state_builder _28 _29 + ADD // payload msg init_state_builder _30 + 10 PUSHPOW2DEC // payload msg init_state_builder _30 _31=1023 + GEQ // payload msg init_state_builder _32 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _33 + 1 PUSHINT + ROT // payload _33 _34=1 msg + 1 STU // payload _33 _36 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _38=0 msg + 1 STU // payload init_state_builder _40 + SWAP // payload _40 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _42 + s2 PUSH // payload msg _42 payload + BBITS // payload msg _42 _43 + ADD // payload msg _44 + 10 PUSHPOW2DEC // payload msg _44 _45=1023 + GEQ // payload msg _46 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _47 + 1 PUSHINT + ROT // _47 _48=1 msg + 1 STU // _47 _50 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _52=0 + SWAP // payload _52=0 msg + 1 STU // payload _54 + SWAP // _54 payload + STBR // msg + }> + ENDC // _56 + }> + parse_internal_message PROC:<{ + // message + CTOS // cs + 112 PUSHINT // cs _3 + SWAP // _3 cs + 1 LDU // _3 _4 cs + SWAP // _3 cs _4 + 0 NEQINT // _3 cs _8 + s1 s2 XCHG // cs _3 _8 + THROWANYIF + 1 LDU // ihr_disabled cs + 1 LDU // ihr_disabled bounce cs + 1 LDU // ihr_disabled bounce bounced cs + LDMSGADDR // ihr_disabled bounce bounced src cs + LDMSGADDR // ihr_disabled bounce bounced src to_address cs + LDVARUINT16 // ihr_disabled bounce bounced src to_address money cs + LDDICT // ihr_disabled bounce bounced src to_address money _86 _85 + NIP // ihr_disabled bounce bounced src to_address money cs + LDGRAMS // ihr_disabled bounce bounced src to_address money _88 _87 + NIP // ihr_disabled bounce bounced src to_address money cs + LDGRAMS // ihr_disabled bounce bounced src to_address money _90 _89 + NIP // ihr_disabled bounce bounced src to_address money cs + 96 LDU // ihr_disabled bounce bounced src to_address money timestamps cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps maybe_init_state cs + NIL // ihr_disabled bounce bounced src to_address money timestamps maybe_init_state cs init_state + s0 s2 XCHG // ihr_disabled bounce bounced src to_address money timestamps init_state cs maybe_init_state + 1 EQINT // ihr_disabled bounce bounced src to_address money timestamps init_state cs _50 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps init_state cs + NIP // ihr_disabled bounce bounced src to_address money timestamps cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps _51 cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps cs _51 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps cs + LDREF // ihr_disabled bounce bounced src to_address money timestamps _54 cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps cs _54 + CTOS // ihr_disabled bounce bounced src to_address money timestamps cs _56 + parse_init_state CALLDICT // ihr_disabled bounce bounced src to_address money timestamps cs init_state + }>ELSE<{ // ihr_disabled bounce bounced src to_address money timestamps cs + DUP // ihr_disabled bounce bounced src to_address money timestamps cs cs + parse_init_state CALLDICT // ihr_disabled bounce bounced src to_address money timestamps cs init_state + }> + SWAP // ihr_disabled bounce bounced src to_address money timestamps init_state cs + }> // ihr_disabled bounce bounced src to_address money timestamps init_state cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps init_state body_flag cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps init_state cs body_flag + 0 EQINT // ihr_disabled bounce bounced src to_address money timestamps init_state cs _66 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps init_state body + }>ELSE<{ // ihr_disabled bounce bounced src to_address money timestamps init_state cs + LDREF // ihr_disabled bounce bounced src to_address money timestamps init_state _102 _101 + DROP // ihr_disabled bounce bounced src to_address money timestamps init_state _67 + CTOS // ihr_disabled bounce bounced src to_address money timestamps init_state body + }> + 9 TUPLE // _70 + }> + parse_external_message PROC:<{ + // message + CTOS // cs + 2 LDU // msg_info cs + 113 PUSHINT // msg_info cs _7 + s2 PUSH // msg_info cs _7 msg_info + 2 NEQINT // msg_info cs _7 _9 + s3 PUSH // msg_info cs _7 _9 msg_info + 3 NEQINT // msg_info cs _7 _9 _11 + AND // msg_info cs _7 _12 + THROWANYIF + LDMSGADDR // msg_info src cs + LDMSGADDR // msg_info src to_address cs + 0 PUSHINT // msg_info src to_address cs import_fee=0 + s0 s4 PUXC // timestamps=0 src to_address cs import_fee=0 msg_info + 2 EQINT // timestamps=0 src to_address cs import_fee=0 _25 + IF:<{ // timestamps=0 src to_address cs import_fee=0 + DROP // timestamps=0 src to_address cs + LDGRAMS // timestamps=0 src to_address import_fee cs + }>ELSE<{ // timestamps=0 src to_address cs import_fee=0 + s4 POP // import_fee=0 src to_address cs + 96 LDU // import_fee=0 src to_address timestamps cs + s1 s4 XCHG // timestamps src to_address import_fee cs + }> + 1 LDU // timestamps src to_address import_fee maybe_init_state cs + NIL // timestamps src to_address import_fee maybe_init_state cs init_state + s0 s2 XCHG // timestamps src to_address import_fee init_state cs maybe_init_state + 1 EQINT // timestamps src to_address import_fee init_state cs _38 + IF:<{ // timestamps src to_address import_fee init_state cs + NIP // timestamps src to_address import_fee cs + DUP // timestamps src to_address import_fee cs cs + parse_init_state CALLDICT // timestamps src to_address import_fee cs init_state + SWAP // timestamps src to_address import_fee init_state cs + }> // timestamps src to_address import_fee init_state cs + 1 LDU // timestamps src to_address import_fee init_state body_flag cs + SWAP // timestamps src to_address import_fee init_state cs body_flag + 0 EQINT // timestamps src to_address import_fee init_state cs _47 + IF:<{ // timestamps src to_address import_fee init_state body + }>ELSE<{ // timestamps src to_address import_fee init_state cs + LDREF // timestamps src to_address import_fee init_state _67 _66 + DROP // timestamps src to_address import_fee init_state _48 + CTOS // timestamps src to_address import_fee init_state body + }> + s4 s5 XCHG + s3 s4 XCHG + s2 s3 XCHG // src to_address import_fee timestamps init_state body + 6 TUPLE // _51 + }> + init_environment PROC:<{ + // + PUSHNULL // _0 + NEWC // _0 _1 + STDICT // _2 + ENDC // _3 + c4 POP + }> + storage_key PROC:<{ + // tag + 2824609491042946229920590003095732224 PUSHINTX // tag _3 + SWAP // _3 tag + ADD // _4 + }> + load_storage_with_tag PROC:<{ + // tag + storage_key CALLDICT // _1 + c4 PUSH // _1 _2 + CTOS // _1 _3 + PLDDICT // _1 _4 + 8 PUSHPOW2 // _1 _4 _5=256 + DICTIGETOPTREF // _6 + }> + save_storage_with_tag PROC:<{ + // tag storage + c4 PUSH // tag storage _3 + CTOS // tag storage _4 + PLDDICT // tag storage dict + s0 s2 XCHG // dict storage tag + storage_key CALLDICT // dict storage _7 + ROT + 8 PUSHPOW2 // storage _7 dict _8=256 + DICTISETREF // dict + NEWC // dict _10 + STDICT // _11 + ENDC // _12 + c4 POP + }> + get_c7 PROCINLINE:<{ + // + 124711402 PUSHINT // _2=124711402 + 0 PUSHINT // _2=124711402 _3=0 + DUP // _2=124711402 _3=0 _4=0 + NOW // _2=124711402 _3=0 _4=0 _5 + 1 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 + DUP // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 + 239 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 + 1000000000 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _10=1000000000 + PUSHNULL // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _10=1000000000 _11 + PAIR // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 + MYADDR // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 _13 + CONFIGROOT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 _13 _14 + 10 TUPLE // _15 + SINGLE // _16 + }> + invoke_method PROC:<{ + // fun args + { + c7 PUSH DUP FIRST + GASLIMITSTEMP SWAP DROP + 11 SETINDEX 0 SETINDEX c7 POP + } : save-gas-remaining + { + GASLIMITSTEMP SWAP DROP + 11 GETPARAM SWAP SUB + 145 PUSHINT SUB + } : compute-gas-used + NEWC ENDC c5 POP + RESETLOADEDCELLS + 255 PUSHINT EXPLODEVAR + DUP INC ROLLX + <{ + <{ + save-gas-remaining + EXECUTE + compute-gas-used + DEPTH DEC ROLLREVX + DEPTH DEC TUPLEVAR + ZERO ROTREV + }> PUSHCONT + <{ + compute-gas-used + ROT DROP NIL + }> PUSHCONT + TRY + }> PUSHCONT + ROT INC -1 PUSHINT + CALLXVARARGS // exit_code gas_used return_values + s2 PUSH // exit_code gas_used return_values exit_code + 0 NEQINT // exit_code gas_used return_values _7 + s3 PUSH // exit_code gas_used return_values _7 exit_code + 1 NEQINT // exit_code gas_used return_values _7 _9 + AND // exit_code gas_used return_values _10 + s1 s3 XCHG // return_values gas_used exit_code _10 + THROWANYIF + SWAP // gas_used return_values + }> + invoke_method_expect_fail PROC:<{ + // fun args + { + c7 PUSH DUP FIRST + GASLIMITSTEMP SWAP DROP + 11 SETINDEX 0 SETINDEX c7 POP + } : save-gas-remaining + { + GASLIMITSTEMP SWAP DROP + 11 GETPARAM SWAP SUB + 145 PUSHINT SUB + } : compute-gas-used + NEWC ENDC c5 POP + RESETLOADEDCELLS + 255 PUSHINT EXPLODEVAR + DUP INC ROLLX + <{ + <{ + save-gas-remaining + EXECUTE + compute-gas-used + DEPTH DEC ROLLREVX + DEPTH DEC TUPLEVAR + ZERO ROTREV + }> PUSHCONT + <{ + compute-gas-used + ROT DROP NIL + }> PUSHCONT + TRY + }> PUSHCONT + ROT INC -1 PUSHINT + CALLXVARARGS // _13 _14 _15 + DROP // exit_code gas_used + OVER // exit_code gas_used exit_code + 0 EQINT // exit_code gas_used _8 + s0 s2 XCHG // _8 gas_used exit_code + 1 EQINT // _8 gas_used _10 + s1 s2 XCHG // gas_used _8 _10 + OR // gas_used _11 + 201 THROWIF + }> + assert_no_actions PROCINLINE:<{ + // + c5 PUSH CTOS // _1 + SEMPTY // _2 + NOT // _3 + 202 THROWIF + }> + token_snake_len PROCINLINE:<{ + // content + 0 PUSHINT // content len=0 + WHILE:<{ + OVER // content len content + ISNULL // content len _3 + NOT // content len _4 + }>DO<{ // content len + OVER // content len content + SBITS // content len _5 + ADD // content len + OVER // content len content + SREFS // content len _7 + IF:<{ // content len + SWAP // len content + LDREF // len _14 _13 + DROP // len _9 + CTOS // len _8 + }>ELSE<{ // content len + NIP // len + PUSHNULL // len _8 + }> // len content + SWAP // content len + }> // content len + NIP // len + }> + get_snake_tail PROCINLINE:<{ + // tail + WHILE:<{ + DUP // tail tail + ISNULL // tail _1 + NOT // tail _2 + }>DO<{ // tail + CTOS // tail_slice + DUP // tail_slice tail_slice + SREFS // tail_slice _5 + IF:<{ // tail_slice + LDREF // _11 _10 + DROP // _6 + }>ELSE<{ // tail_slice + DROP // + PUSHNULL // _6 + }> // tail + }> // tail + }> + snake_concat PROC:<{ + // head tail + SWAP // tail head + CTOS // tail head_sl + NEWC // tail head_sl _5 + OVER // tail head_sl _5 head_sl + SBITS // tail head_sl _5 _7 + s1 s2 XCHG // tail _5 head_sl _7 + LDSLICEX // tail _5 _6 head_sl + -ROT // tail head_sl _5 _6 + STSLICER // tail head_sl snake + OVER // tail head_sl snake head_sl + SREFS // tail head_sl snake _10 + IF:<{ // tail head_sl snake + SWAP // tail snake head_sl + LDREF // tail snake _20 _19 + DROP // tail snake _11 + ROT // snake _11 tail + snake_concat CALLDICT // snake _13 + SWAP // _13 snake + STREF // snake + }>ELSE<{ // tail head_sl snake + NIP // tail snake + STREF // snake + }> + ENDC // _16 + }> + snake_concat_tagged PROCINLINE:<{ + // tag head tail + OVER // tag head tail head + CTOS // tag head tail head_sl + s0 s3 XCHG + NEWC // head_sl head tail tag _6 + 8 STU // head_sl head tail snake + 1015 PUSHINT // head_sl head tail snake lbits + s4 PUSH // head_sl head tail snake lbits head_sl + SBITS // head_sl head tail snake lbits _15 + SWAP // head_sl head tail snake _15 lbits + GREATER // head_sl head tail snake _16 + IF:<{ // head_sl head tail snake + s3 POP // snake head tail + snake_concat CALLDICT // snake _17 + SWAP // _17 snake + STREF // _18 + ENDC // tagged + }>ELSE<{ // head_sl head tail snake + s2 POP // head_sl snake tail + s0 s2 XCHG // tail snake head_sl + STSLICER // tail _20 + ENDC // tail _21 + SWAP // _21 tail + snake_concat CALLDICT // tagged + }> + }> + snake_equal? PROCINLINE:<{ + // snake1 snake2 + TRUE // snake1 snake2 equal + UNTIL:<{ + s2 PUSH // snake1 snake2 equal snake1 + SBITS // snake1 snake2 equal s1_data + s2 PUSH // snake1 snake2 equal s1_data snake2 + SBITS // snake1 snake2 equal s1_data s2_data + 2DUP // snake1 snake2 equal s1_data s2_data s1_data s2_data + LEQ // snake1 snake2 equal s1_data s2_data _8 + IF:<{ // snake1 snake2 equal s1_data s2_data + OVER // snake1 snake2 equal s1_data s2_data s1_data + 0 GTINT // snake1 snake2 equal s1_data s2_data _10 + IF:<{ // snake1 snake2 equal s1_data s2_data + s2 POP // snake1 snake2 s2_data s1_data + s2 s2 XCPU // snake1 s1_data s2_data snake2 s1_data + LDSLICEX // snake1 s1_data s2_data _11 snake2 + s4 s1 PUXC // snake1 s1_data s2_data snake2 snake1 _11 + SDEQ // snake1 s1_data s2_data snake2 equal + 2SWAP // snake1 snake2 equal s1_data s2_data + }> // snake1 snake2 equal s1_data s2_data + s4 PUSH // snake1 snake2 equal s1_data s2_data snake1 + SREFS // snake1 snake2 equal s1_data s2_data _14 + IF:<{ // snake1 snake2 equal s1_data s2_data + s0 s4 XCHG // s2_data snake2 equal s1_data snake1 + LDREF // s2_data snake2 equal s1_data _48 _47 + DROP // s2_data snake2 equal s1_data _16 + CTOS // s2_data snake2 equal s1_data _15 + }>ELSE<{ // snake1 snake2 equal s1_data s2_data + s4 POP // s2_data snake2 equal s1_data + PUSHNULL // s2_data snake2 equal s1_data _15 + }> // s2_data snake2 equal s1_data snake1 + DUP // s2_data snake2 equal s1_data snake1 snake1 + ISNULL // s2_data snake2 equal s1_data snake1 _20 + s5 PUSH // s2_data snake2 equal s1_data snake1 _20 s2_data + AND // s2_data snake2 equal s1_data snake1 _21 + s2 PUSH // s2_data snake2 equal s1_data snake1 _21 s1_data + GREATER // s2_data snake2 equal s1_data snake1 _22 + IF:<{ // s2_data snake2 equal s1_data snake1 + s4 POP + 2DROP // snake1 snake2 + FALSE // snake1 snake2 equal + }>ELSE<{ // s2_data snake2 equal s1_data snake1 + s4 s4 XCHG2 // snake1 snake2 equal s2_data s1_data + EQUAL // snake1 snake2 equal _24 + IF:<{ // snake1 snake2 equal + OVER // snake1 snake2 equal snake2 + SREFS // snake1 snake2 equal _25 + IF:<{ // snake1 snake2 equal + SWAP // snake1 equal snake2 + LDREF // snake1 equal _50 _49 + DROP // snake1 equal _27 + CTOS // snake1 equal _26 + }>ELSE<{ // snake1 snake2 equal + NIP // snake1 equal + PUSHNULL // snake1 equal _26 + }> // snake1 equal snake2 + SWAP // snake1 snake2 equal + }> // snake1 snake2 equal + }> + }>ELSE<{ // snake1 snake2 equal s1_data s2_data + 2 1 BLKDROP2 // snake1 snake2 s2_data + s1 s2 XCHG // snake2 snake1 s2_data + LDSLICEX // snake2 _31 snake1 + s2 s1 PUXC // snake2 snake1 snake2 _31 + SDEQ // snake2 snake1 equal + s2 PUSH // snake2 snake1 equal snake2 + SREFS // snake2 snake1 equal _34 + IF:<{ // snake2 snake1 equal + s0 s2 XCHG // equal snake1 snake2 + LDREF // equal snake1 _54 _53 + DROP // equal snake1 _36 + CTOS // equal snake1 _35 + }>ELSE<{ // snake2 snake1 equal + s2 POP // equal snake1 + PUSHNULL // equal snake1 _35 + }> // equal snake1 snake2 + ROT // snake1 snake2 equal + }> + DUP // snake1 snake2 equal equal + NOT // snake1 snake2 equal _40 + s3 PUSH // snake1 snake2 equal _40 snake1 + ISNULL // snake1 snake2 equal _40 _41 + s3 PUSH // snake1 snake2 equal _40 _41 snake2 + ISNULL // snake1 snake2 equal _40 _41 _42 + AND // snake1 snake2 equal _40 _43 + OR // snake1 snake2 equal _44 + }> // snake1 snake2 equal + 2 1 BLKDROP2 // equal + }> + load_workchain PROCINLINE:<{ + // + MYADDR // _2 + REWRITESTDADDR // _4 _5 + DROP // workchain + }> + calc_storage_fee_raw PROCINLINE:<{ + // cells bits time + 18 PUSHINT // cells bits time _4=18 + CONFIGOPTPARAM // cells bits time prices_by_workchain + 0 PUSHINT // cells bits time prices_by_workchain _8=0 + SWAP + 32 PUSHINT // cells bits time _8=0 prices_by_workchain _9=32 + DICTIGET + NULLSWAPIFNOT // cells bits time _33 _34 + DROP // cells bits time prices + 40 PUSHINT // cells bits time prices _12=40 + SDSKIPFIRST // cells bits time prices + load_workchain INLINECALLDICT // cells bits time prices _14 + -1 EQINT // cells bits time prices _16 + IF:<{ // cells bits time prices + 7 PUSHPOW2 // cells bits time prices _18=128 + SDSKIPFIRST // cells bits time prices + }> // cells bits time prices + 64 LDU // cells bits time _21 prices + s0 s3 XCHG // cells prices time _21 bits + MUL // cells prices time base_fee + s0 s2 XCHG // cells base_fee time prices + 64 LDU // cells base_fee time _38 _37 + DROP // cells base_fee time _25 + s0 s3 XCHG2 // time base_fee _25 cells + MUL // time base_fee _28 + ADD // time base_fee + SWAP // base_fee time + MUL // _30 + 16 RSHIFT# // _32 + }> + calc_storage_fee PROCINLINE:<{ + // in time + SWAP + 100000 PUSHINT // time in _5=100000 + CDATASIZE // time _8 _9 _10 + DROP // time cells bits + ROT // cells bits time + calc_storage_fee_raw INLINECALLDICT // _7 + }> + main PROC:<{ + // new_balance msg_value in_msg in_msg_body + s3 POP // in_msg_body msg_value in_msg + s2 PUSH // in_msg_body msg_value in_msg in_msg_body + SBITS // in_msg_body msg_value in_msg _4 + 32 LESSINT // in_msg_body msg_value in_msg _6 + IFRETALT + CTOS // in_msg_body msg_value in_msg_full + 4 LDU // in_msg_body msg_value _10 in_msg_full + SWAP + 1 PUSHINT // in_msg_body msg_value in_msg_full _10 _13=1 + AND // in_msg_body msg_value in_msg_full _14 + IFRETALT + 16 PUSHPOW2DEC // in_msg_body msg_value in_msg_full _16=65535 + s0 s3 XCHG // _16=65535 msg_value in_msg_full in_msg_body + 32 LDU // _16=65535 msg_value in_msg_full _17 in_msg_body + SWAP + 1140839503 PUSHINT // _16=65535 msg_value in_msg_full in_msg_body _17 _20=1140839503 + EQUAL // _16=65535 msg_value in_msg_full in_msg_body _21 + s1 s4 XCHG // in_msg_body msg_value in_msg_full _16=65535 _21 + THROWANYIFNOT + s0 s2 XCHG // in_msg_full msg_value in_msg_body + LDREF // in_msg_full msg_value _98 _97 + DROP // in_msg_full msg_value library + DUP + 31536000 PUSHINT // in_msg_full msg_value library library _27=31536000 + calc_storage_fee INLINECALLDICT // in_msg_full msg_value library fee + 115000000 PUSHINT // in_msg_full msg_value library fee _33 + ADD // in_msg_full msg_value library _34 + s1 s2 XCHG // in_msg_full library msg_value _34 + SUB // in_msg_full library msg_value + DUP // in_msg_full library msg_value msg_value + -1 GTINT // in_msg_full library msg_value _38 + 130 THROWIFNOT + c4 PUSH // in_msg_full library msg_value stored + DUP // in_msg_full library msg_value stored stored + CTOS // in_msg_full library msg_value stored _42 + SEMPTY // in_msg_full library msg_value stored _43 + IF:<{ // in_msg_full library msg_value stored + DROP // in_msg_full library msg_value + PUSHNULL // in_msg_full library msg_value stored + }> // in_msg_full library msg_value stored + s2 PUSH // in_msg_full library msg_value stored library + HASHCU // in_msg_full library msg_value stored _46 + s3 PUSH + s0 s2 XCHG + 8 PUSHPOW2 // in_msg_full library msg_value library _46 stored _47=256 + DICTUSETREF // in_msg_full library msg_value stored + c4 POP + OVER // in_msg_full library msg_value library + 2 PUSHINT SETLIBCODE + NIL // in_msg_full library msg_value _52 + s2 s(-1) PUXC + 119703 PUSHINT // in_msg_full library msg_value library _52 _53=119703 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + CTOS 1 RUNVM + DEPTH 30 GETGLOB SUB TUPLEVAR // in_msg_full library msg_value bounty_addr_tuple + FIRST // in_msg_full library msg_value bounty_addr + DUP // in_msg_full library msg_value bounty_addr bounty_addr + REWRITESTDADDR // in_msg_full library msg_value bounty_addr _101 _102 + 2DROP // in_msg_full library msg_value bounty_addr + 0 PUSHINT // in_msg_full library msg_value bounty_addr _59=0 + 24 PUSHINT // in_msg_full library msg_value bounty_addr _59=0 _60=24 + NEWC // in_msg_full library msg_value bounty_addr _59=0 _60=24 _61 + 6 STU // in_msg_full library msg_value bounty_addr _59=0 _63 + ROT // in_msg_full library msg_value _59=0 _63 bounty_addr + STSLICER // in_msg_full library msg_value _59=0 _64 + 100000000 PUSHINT // in_msg_full library msg_value _59=0 _64 _65=100000000 + STVARUINT16 // in_msg_full library msg_value _59=0 _66 + 107 STU // in_msg_full library msg_value _68 + ENDC // in_msg_full library msg_value _69 + 0 PUSHINT // in_msg_full library msg_value _69 _70=0 + SENDRAWMSG + SWAP // in_msg_full msg_value library + HASHCU // in_msg_full msg_value _72 + 3288323151 PUSHINT // in_msg_full msg_value _72 _73=3288323151 + 24 PUSHINT // in_msg_full msg_value _72 _73=3288323151 _74=24 + NEWC // in_msg_full msg_value _72 _73=3288323151 _74=24 _75 + 6 STU // in_msg_full msg_value _72 _73=3288323151 _77 + s0 s4 XCHG // _77 msg_value _72 _73=3288323151 in_msg_full + LDMSGADDR // _77 msg_value _72 _73=3288323151 _104 _103 + DROP // _77 msg_value _72 _73=3288323151 _78 + s1 s4 XCHG // _73=3288323151 msg_value _72 _77 _78 + STSLICER // _73=3288323151 msg_value _72 _80 + ROT // _73=3288323151 _72 _80 msg_value + STVARUINT16 // _73=3288323151 _72 _81 + s1 s2 XCHG // _72 _73=3288323151 _81 + 143 STU // _72 _87 + 256 STU // _89 + ENDC // _90 + 0 PUSHINT // _90 _91=0 + SENDRAWMSG + }> + get_fee PROC:<{ + // library + 31536000 PUSHINT // library _1=31536000 + calc_storage_fee INLINECALLDICT // _2 + 115000000 PUSHINT // _2 _7 + ADD // _8 + }> + init_config PROC:<{ + // + PUSHNULL // config + x{D06600000000000000000000000080000000000000FA00000000000001F4000000000003D0904_} s>c PUSHREF // config _3 + 18 PUSHINT + ROT + 32 PUSHINT // _3 _4=18 config _5=32 + DICTUSETREF // config + c7 PUSHCTR // config _7 + UNSINGLE // config _8 + SWAP + 9 PUSHINT // _8 config _9=9 + SETINDEXVAR // _10 + SINGLE // _11 + c7 POPCTR + }> + __test_donation_transfer PROC:<{ + // + CONT:<{ + main CALLDICT + }> // _0 + 0 PUSHINT // _0 _2=0 + 1000 PUSHINT // _0 _2=0 _3=1000 + NEWC // _0 _2=0 _3=1000 _4 + ENDC // _0 _2=0 _3=1000 _5 + NEWC // _0 _2=0 _3=1000 _5 _6 + ENDC // _0 _2=0 _3=1000 _5 _7 + CTOS // _0 _2=0 _3=1000 _5 _8 + 4 TUPLE // _0 _1 + invoke_method CALLDICT // _10 _11 + 2DROP // + }> + __test_add_plugin_too_low_funds PROC:<{ + // + init_config CALLDICT + 0 PUSHINT // _2=0 + NEWC // _2=0 _3 + 4 STU // _5 + MYADDR // _5 _6 + STSLICER // _7 + ENDC // in_msg_full + B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840} + B>boc PUSHREF // in_msg_full _10 + 1140839503 PUSHINT // in_msg_full _10 _11=1140839503 + NEWC // in_msg_full _10 _11=1140839503 _12 + 32 STU // in_msg_full _10 _14 + STREF // in_msg_full _15 + ENDC // in_msg_full _16 + CTOS // in_msg_full in_msg_body + CONT:<{ + main CALLDICT + }> // in_msg_full in_msg_body _18 + 0 PUSHINT // in_msg_full in_msg_body _18 _20=0 + s0 s2 XCHG + 1000 PUSHINT + s0 s4 s4 XCHG3 // _18 _20=0 _21=1000 in_msg_full in_msg_body + 4 TUPLE // _18 _19 + invoke_method_expect_fail CALLDICT // _22 + }> + __test_add_plugin_invalid_opcode PROC:<{ + // + init_config CALLDICT + 0 PUSHINT // _2=0 + NEWC // _2=0 _3 + 4 STU // _5 + MYADDR // _5 _6 + STSLICER // _7 + ENDC // in_msg_full + B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840} + B>boc PUSHREF // in_msg_full _10 + 1140839424 PUSHINT // in_msg_full _10 _11=1140839424 + NEWC // in_msg_full _10 _11=1140839424 _12 + 32 STU // in_msg_full _10 _14 + STREF // in_msg_full _15 + ENDC // in_msg_full _16 + CTOS // in_msg_full in_msg_body + CONT:<{ + main CALLDICT + }> // in_msg_full in_msg_body _18 + 0 PUSHINT // in_msg_full in_msg_body _18 _20=0 + s0 s2 XCHG + 1000 PUSHINT + s0 s4 s4 XCHG3 // _18 _20=0 _21=1000 in_msg_full in_msg_body + 4 TUPLE // _18 _19 + invoke_method_expect_fail CALLDICT // _22 + }> + __test_add_plugin_no_config PROC:<{ + // + 0 PUSHINT // _1=0 + NEWC // _1=0 _2 + 4 STU // _4 + MYADDR // _4 _5 + STSLICER // _6 + ENDC // in_msg_full + B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840} + B>boc PUSHREF // in_msg_full _9 + 1140839503 PUSHINT // in_msg_full _9 _10=1140839503 + NEWC // in_msg_full _9 _10=1140839503 _11 + 32 STU // in_msg_full _9 _13 + STREF // in_msg_full _14 + ENDC // in_msg_full _15 + CTOS // in_msg_full in_msg_body + CONT:<{ + main CALLDICT + }> // in_msg_full in_msg_body _17 + 0 PUSHINT // in_msg_full in_msg_body _17 _19=0 + s0 s2 XCHG + 10000000000 PUSHINT + s0 s4 s4 XCHG3 // _17 _19=0 _22 in_msg_full in_msg_body + 4 TUPLE // _17 _18 + invoke_method_expect_fail CALLDICT // _23 + }> + __test_add_plugin_success PROC:<{ + // + init_config CALLDICT + 0 PUSHINT // _2=0 + NEWC // _2=0 _3 + 4 STU // _5 + MYADDR // _5 _6 + STSLICER // _7 + ENDC // in_msg_full + B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840} + B>boc PUSHREF // in_msg_full _10 + 1140839503 PUSHINT // in_msg_full _10 _11=1140839503 + NEWC // in_msg_full _10 _11=1140839503 _12 + 32 STU // in_msg_full _10 _14 + STREF // in_msg_full _15 + ENDC // in_msg_full _16 + CTOS // in_msg_full in_msg_body + CONT:<{ + main CALLDICT + }> // in_msg_full in_msg_body _18 + 0 PUSHINT // in_msg_full in_msg_body _18 _20=0 + s0 s2 XCHG + 10000000000 PUSHINT + s0 s4 s4 XCHG3 // _18 _20=0 _23 in_msg_full in_msg_body + 4 TUPLE // _18 _19 + invoke_method CALLDICT // _25 _26 + }> + __test_plugin_total_fee_get PROC:<{ + // + init_config CALLDICT + B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840} + B>boc PUSHREF // _1 + get_fee CALLDICT // _2 + }> +}END>c diff --git a/build/wallet.fif b/build/wallet.fif new file mode 100644 index 0000000..bb1fc32 --- /dev/null +++ b/build/wallet.fif @@ -0,0 +1,690 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `D:\TON_FunC\multisig-wallet-v5\func\wallet.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + DECLPROC calc_storage_fee_raw + DECLPROC calc_storage_fee + DECLPROC load_contract + DECLPROC save_contract + 85143 DECLMETHOD seqno + 78748 DECLMETHOD get_public_key + 76407 DECLMETHOD is_plugin_installed + 99710 DECLMETHOD get_plugin_cell + 116329 DECLMETHOD get_plugin_storage + 108216 DECLMETHOD resolve_plugin + 107653 DECLMETHOD get_plugin_list + 127040 DECLMETHOD get_plugin_list_with_cell + 66326 DECLMETHOD get_plugin_list_resolved + 72101 DECLMETHOD get_plugin_list_resolved_with_storage + DECLPROC check_any_signature + 108438 DECLMETHOD uninstall_plugin + DECLPROC ~do + DECLPROC main + DECLPROC recv_external + DECLGLOBVAR plugins_storage + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + calc_storage_fee_raw PROCINLINE:<{ + // cells bits time + 0 PUSHINT // cells bits time _5=0 + 18 PUSHINT // cells bits time _5=0 _6=18 + CONFIGOPTPARAM // cells bits time _5=0 _7 + 32 PUSHINT // cells bits time _5=0 _7 _8=32 + DICTIGET + NULLSWAPIFNOT // cells bits time _26 _27 + DROP // cells bits time prices + 168 PUSHINT // cells bits time prices _11=168 + SDSKIPFIRST // cells bits time prices + 64 LDU // cells bits time _14 prices + s0 s3 XCHG // cells prices time _14 bits + MUL // cells prices time base_fee + s0 s2 XCHG // cells base_fee time prices + 64 LDU // cells base_fee time _31 _30 + DROP // cells base_fee time _18 + s0 s3 XCHG2 // time base_fee _18 cells + MUL // time base_fee _21 + ADD // time base_fee + SWAP // base_fee time + MUL // _23 + 16 RSHIFT# // _25 + }> + calc_storage_fee PROCINLINE:<{ + // in time + SWAP + 100000 PUSHINT // time in _5=100000 + CDATASIZE // time _8 _9 _10 + DROP // time cells bits + ROT // cells bits time + calc_storage_fee_raw INLINECALLDICT // _7 + }> + load_contract PROCINLINE:<{ + // + c4 PUSH // _1 + CTOS // ds + 64 LDU // uid ds + LDDICT // uid plugins ds + LDDICT // uid plugins _12 ds + SWAP // uid plugins ds _12 + plugins_storage SETGLOB + 32 LDU // uid plugins key_type ds + }> + save_contract PROCINLINE:<{ + // uid plugins key_type key + plugins_storage GETGLOB // uid plugins key_type key _4 + s0 s4 XCHG + NEWC // _4 plugins key_type key uid _5 + 64 STU // _4 plugins key_type key _7 + s1 s3 XCHG // _4 key key_type plugins _7 + STDICT // _4 key key_type _8 + s1 s3 XCHG // key_type key _4 _8 + STDICT // key_type key _9 + s1 s2 XCHG // key key_type _9 + 32 STU // key _11 + SWAP // _11 key + STSLICER // _12 + ENDC // _13 + c4 POP + }> + seqno PROC:<{ + // + load_contract INLINECALLDICT // _5 _6 _7 _8 + 3 BLKDROP // uid + }> + get_public_key PROC:<{ + // + load_contract INLINECALLDICT // _5 _6 _7 _8 + s3 POP + NIP // key key_type + }> + is_plugin_installed PROC:<{ + // hash + load_contract INLINECALLDICT // hash _10 _11 _12 _13 + s2 s3 XCHG + 3 BLKDROP // hash plugins + 8 PUSHPOW2 // hash plugins _8=256 + DICTUGETREF // _14 _15 + NIP // found + }> + get_plugin_cell PROC:<{ + // hash + load_contract INLINECALLDICT // hash _10 _11 _12 _13 + s2 s3 XCHG + 3 BLKDROP // hash plugins + 8 PUSHPOW2 // hash plugins _8=256 + DICTUGETREF // _14 _15 + DROP // plugin + }> + get_plugin_storage PROC:<{ + // hash + load_contract INLINECALLDICT // hash _7 _8 _9 _10 + 4 BLKDROP // hash + plugins_storage GETGLOB // hash _4 + 8 PUSHPOW2 // hash _4 _5=256 + DICTUGETREF // _11 _12 + DROP // plugin_data + }> + resolve_plugin PROC:<{ + // hash + load_contract INLINECALLDICT // hash _11 _12 _13 _14 + s2 s3 XCHG + 3 BLKDROP // hash plugins + 8 PUSHPOW2 // hash plugins _8=256 + DICTUGETREF // _15 _16 + DROP // plugin + CTOS // _10 + }> + get_plugin_list PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _16 _17 _18 _19 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _23 _25 _24 _26 + DROP + NIP // list plugins hash + ROT // plugins hash list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + get_plugin_list_with_cell PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _18 _19 _20 _21 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _25 _27 _26 _28 + DROP // list plugins plugin hash + SWAP // list plugins hash plugin + PLDREF // list plugins hash _15 + PAIR // list plugins _16 + ROT // plugins _16 list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + get_plugin_list_resolved PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _19 _20 _21 _22 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _26 _28 _27 _29 + DROP // list plugins plugin hash + SWAP // list plugins hash plugin + PLDREF // list plugins hash _15 + CTOS // list plugins hash _16 + PAIR // list plugins _17 + ROT // plugins _17 list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + get_plugin_list_resolved_with_storage PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _24 _25 _26 _27 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _31 _33 _32 _34 + DROP // list plugins plugin hash + plugins_storage GETGLOB // list plugins plugin hash _17 + s1 s(-1) PUXC + 8 PUSHPOW2 // list plugins plugin hash hash _17 _18=256 + DICTUGETREF // list plugins plugin hash _35 _36 + DROP // list plugins plugin hash data + s0 s2 XCHG // list plugins data hash plugin + PLDREF // list plugins data hash _20 + CTOS // list plugins data hash _21 + ROT // list plugins hash _21 data + TRIPLE // list plugins _22 + ROT // plugins _22 list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + check_any_signature PROCINLINE:<{ + // in_msg_body key_type key + s0 s2 XCHG // key key_type in_msg_body + LDREF // key key_type request in_msg_body + OVER // key key_type request in_msg_body request + HASHCU // key key_type request in_msg_body request_hash + s3 PUSH + 8445519 PUSHINT // key key_type request in_msg_body request_hash key_type _8=8445519 + EQUAL // key key_type request in_msg_body request_hash _9 + IF:<{ // key key_type request in_msg_body request_hash + s3 POP // key request_hash request in_msg_body + s0 s3 XCHG // in_msg_body request_hash request key + 256 PLDU // in_msg_body request_hash request _12 + s1 s3 XCHG // request request_hash in_msg_body _12 + CHKSIGNU // request _13 + 310 THROWIFNOT + }>ELSE<{ // key key_type request in_msg_body request_hash + s0 s3 XCHG + 1692265451 PUSHINT // key request_hash request in_msg_body key_type _15=1692265451 + EQUAL // key request_hash request in_msg_body _16 + IF:<{ // key request_hash request in_msg_body + s0 s3 XCHG2 // request request_hash in_msg_body key + P256_CHKSIGNU // request _18 + 310 THROWIFNOT + }>ELSE<{ // key request_hash request in_msg_body + s1 s3 XCHG + 3 BLKDROP // request + 311 THROW + }> + }> + }> + uninstall_plugin PROCINLINE:<{ + // plugins plugin_id + s0 s1 PUXC + 8 PUSHPOW2 // plugin_id plugin_id plugins _3=256 + DICTUDEL // plugin_id _10 _11 + DROP // plugin_id plugins + plugins_storage GETGLOB // plugin_id plugins _6 + s1 s2 XCHG + 8 PUSHPOW2 // plugins plugin_id _6 _7=256 + DICTUDEL // plugins _12 _13 + DROP // plugins _9 + plugins_storage SETGLOB + }> + ~do PROC:<{ + // action plugins + SWAP // plugins action + CTOS // plugins action + 32 LDU // plugins op action + OVER + 1055474673 PUSHINT // plugins op action op _8=1055474673 + EQUAL // plugins op action _9 + IF:<{ // plugins op action + NIP // plugins action + LDREF // plugins _10 action + DUP // plugins _10 action action + 8 PLDU // plugins _10 action _13 + s1 s2 XCHG // plugins action _10 _13 + SENDRAWMSG + }>ELSE<{ // plugins op action + OVER + 33210358 PUSHINT // plugins op action op _15=33210358 + EQUAL // plugins op action _16 + IF:<{ // plugins op action + NIP // plugins action + DUP // plugins action action + 256 PLDU // plugins action _18 + s1 s2 XCHG // action plugins _18 + uninstall_plugin INLINECALLDICT // action plugins + }>ELSE<{ // plugins op action + OVER + 2041458079 PUSHINT // plugins op action op _20=2041458079 + EQUAL // plugins op action _21 + IF:<{ // plugins op action + NIP // plugins action + LDREF // plugins plugin action + OVER // plugins plugin action plugin + HASHCU // plugins plugin action plugin_hash + s2 s0 s3 PUXC2 + 8 PUSHPOW2 // action plugin plugin plugin_hash plugins _28=256 + DICTUSETREF // action plugin plugins + 1140839503 PUSHINT // action plugin plugins _30=1140839503 + 24 PUSHINT // action plugin plugins _30=1140839503 _31=24 + NEWC // action plugin plugins _30=1140839503 _31=24 _32 + 6 STU // action plugin plugins _30=1140839503 _34 + x{9FFCA257FD2130F9E1A12835B5DFD3CE4922057EFD623585D454EDA67FC424FE531_} PUSHSLICE // action plugin plugins _30=1140839503 _34 _35 + STSLICER // action plugin plugins _30=1140839503 _36 + 160000000 PUSHINT // action plugin plugins _30=1140839503 _36 _39 + s4 PUSH + 31536000 PUSHINT // action plugin plugins _30=1140839503 _36 _39 plugin _40=31536000 + calc_storage_fee INLINECALLDICT // action plugin plugins _30=1140839503 _36 _39 _41 + ADD // action plugin plugins _30=1140839503 _36 _42 + STVARUINT16 // action plugin plugins _30=1140839503 _43 + 139 STU // action plugin plugins _47 + s1 s2 XCHG // action plugins plugin _47 + STREF // action plugins _48 + ENDC // action plugins _49 + 0 PUSHINT // action plugins _49 _50=0 + SENDRAWMSG + }>ELSE<{ // plugins op action + SWAP + 1762183572 PUSHINT // plugins action op _52=1762183572 + EQUAL // plugins action _53 + IF:<{ // plugins action + LDREF // plugins code action + SWAP // plugins action code + CTOS // plugins action _57 + BLESS // plugins action _58 + NIL // plugins action _58 _59 + 0 PUSHINT // plugins action _58 _59 _60=0 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // plugins action _61 + DROP // plugins action + }>ELSE<{ // plugins action + 303 THROW + }> + SWAP // action plugins + }> + }> + SWAP // plugins action + }> + PLDOPTREF // plugins _64 + SWAP // _64 plugins + }> + main PROC:<{ + // balance msg_value in_msg in_msg_body + DUP // balance msg_value in_msg in_msg_body in_msg_body + SEMPTY // balance msg_value in_msg in_msg_body _4 + IFJMP:<{ // balance msg_value in_msg in_msg_body + 4 BLKDROP // + }> // balance msg_value in_msg in_msg_body + OVER // balance msg_value in_msg in_msg_body in_msg + CTOS // balance msg_value in_msg in_msg_body in_msg_full + 4 LDU // balance msg_value in_msg in_msg_body _7 in_msg_full + SWAP + 1 PUSHINT // balance msg_value in_msg in_msg_body in_msg_full _7 _10=1 + AND // balance msg_value in_msg in_msg_body in_msg_full _11 + IFJMP:<{ // balance msg_value in_msg in_msg_body in_msg_full + 5 BLKDROP // + }> // balance msg_value in_msg in_msg_body in_msg_full + SWAP // balance msg_value in_msg in_msg_full in_msg_body + 32 LDU // balance msg_value in_msg in_msg_full op in_msg_body + OVER + 3288323151 PUSHINT // balance msg_value in_msg in_msg_full op in_msg_body op _16=3288323151 + EQUAL // balance msg_value in_msg in_msg_full op in_msg_body _17 + IF:<{ // balance msg_value in_msg in_msg_full op in_msg_body + NIP + 2 2 BLKDROP2 + s2 POP // in_msg_body in_msg_full + LDMSGADDR // in_msg_body _80 _79 + DROP // in_msg_body _18 + x{9FFCA257FD2130F9E1A12835B5DFD3CE4922057EFD623585D454EDA67FC424FE531_} PUSHSLICE // in_msg_body _18 _20 + SDEQ // in_msg_body _21 + NOT // in_msg_body _22 + IFRETALT + load_contract INLINECALLDICT // in_msg_body uid plugins key_type key + s0 s4 XCHG // key uid plugins key_type in_msg_body + 256 LDU // key uid plugins key_type _86 _85 + DROP // key uid plugins key_type plugin_id + s0 s2 PUSH2 + 8 PUSHPOW2 // key uid plugins key_type plugin_id plugin_id plugins _35=256 + DICTUGETREF // key uid plugins key_type plugin_id _87 _88 + NIP // key uid plugins key_type plugin_id found + NOT // key uid plugins key_type plugin_id _37 + IFRETALT + 2 PUSHINT // key uid plugins key_type plugin_id _40=2 + NEWC // key uid plugins key_type plugin_id _40=2 _41 + 8 STU // key uid plugins key_type plugin_id _43 + s1 s(-1) PUXC // key uid plugins key_type plugin_id plugin_id _43 + 256 STU // key uid plugins key_type plugin_id _45 + ONE ENDXC // key uid plugins key_type plugin_id exotic_plugin + s0 s2 XCHG + 8 PUSHPOW2 + s4 s2 XCHG2 // key uid key_type exotic_plugin _48=256 plugins plugin_id + DICTUSETREF // key uid key_type plugins + s0 s1 s3 XCHG3 // uid plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ // balance msg_value in_msg in_msg_full op in_msg_body + s2 POP // balance msg_value in_msg in_msg_body op + 1154835125 PUSHINT // balance msg_value in_msg in_msg_body op _51=1154835125 + EQUAL // balance msg_value in_msg in_msg_body _52 + IF:<{ // balance msg_value in_msg in_msg_body + load_contract INLINECALLDICT // balance msg_value in_msg in_msg_body uid plugins key_type key + s0 s4 XCHG // balance msg_value in_msg key uid plugins key_type in_msg_body + 256 LDU // balance msg_value in_msg key uid plugins key_type plugin_id in_msg_body + s1 s3 XCPU + 8 PUSHPOW2 // balance msg_value in_msg key uid plugins key_type in_msg_body plugin_id plugins _64=256 + DICTUGETREF // balance msg_value in_msg key uid plugins key_type in_msg_body plugin found + 300 THROWIFNOT + CTOS // balance msg_value in_msg key uid plugins key_type in_msg_body _68 + BLESS // balance msg_value in_msg key uid plugins key_type in_msg_body _69 + s3 s8 XCHG + s7 s6 s6 XCHG3 // plugins key_type _69 key uid balance msg_value in_msg in_msg_body + 4 TUPLE // plugins key_type _69 key uid _71 + s1 s3 XCHG + 121535 PUSHINT // plugins key_type uid key _69 _71 _72=121535 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // plugins key_type uid key _73 + DROP // plugins key_type uid key + s3 s3 s0 XCHG3 // uid plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ + 4 BLKDROP // + }> + }> + }> + recv_external PROC:<{ + // in_msg_body + 32 LDU // op in_msg_body + OVER + 1158237173 PUSHINT // op in_msg_body op _6=1158237173 + EQUAL // op in_msg_body _7 + IF:<{ // op in_msg_body + NIP // in_msg_body + load_contract INLINECALLDICT // in_msg_body uid plugins key_type key + s4 s1 s4 XCPU2 // key uid plugins key_type in_msg_body key_type key + check_any_signature INLINECALLDICT // key uid plugins key_type _14 + CTOS // key uid plugins key_type request + 64 LDU // key uid plugins key_type _17 request + s1 s4 XCPU // key uid plugins key_type request _17 uid + EQUAL // key uid plugins key_type request _20 + 312 THROWIFNOT + s3 PUSH // key uid plugins key_type request uid + INC // key uid plugins key_type request _23 + s3 s2 s5 PUSH3 // key uid plugins key_type request _23 plugins key_type key + save_contract INLINECALLDICT + COMMIT + ACCEPT + PLDOPTREF // key uid plugins key_type action + WHILE:<{ + DUP // key uid plugins key_type action action + ISNULL // key uid plugins key_type action _30 + NOT // key uid plugins key_type action _31 + }>DO<{ // key uid plugins key_type action + ROT // key uid key_type action plugins + ~do CALLDICT // key uid key_type action plugins + -ROT // key uid plugins key_type action + }> // key uid plugins key_type action + DROP // key uid plugins key_type + s0 s2 XCHG // key key_type plugins uid + INC // key key_type plugins _35 + s2 s3 XCHG2 // _35 plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ // op in_msg_body + SWAP + 1154835125 PUSHINT // in_msg_body op _37=1154835125 + EQUAL // in_msg_body _38 + IF:<{ // in_msg_body + load_contract INLINECALLDICT // in_msg_body uid plugins key_type key + s0 s4 XCHG // key uid plugins key_type in_msg_body + 256 LDU // key uid plugins key_type plugin_id in_msg_body + s1 s3 XCPU + 8 PUSHPOW2 // key uid plugins key_type in_msg_body plugin_id plugins _50=256 + DICTUGETREF // key uid plugins key_type in_msg_body plugin found + 300 THROWIFNOT + CTOS // key uid plugins key_type in_msg_body _54 + BLESS // key uid plugins key_type in_msg_body _55 + SWAP // key uid plugins key_type _55 in_msg_body + SINGLE // key uid plugins key_type _55 _57 + 89430 PUSHINT // key uid plugins key_type _55 _57 _58=89430 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // key uid plugins key_type _59 + DROP // key uid plugins key_type + 3 ROLL // uid plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ + DROP // + }> + }> + }> +}END>c + +boc>B "build/boc/wallet.boc" B>file \ No newline at end of file diff --git a/build/wallet_tests.fif b/build/wallet_tests.fif new file mode 100644 index 0000000..0d9acef --- /dev/null +++ b/build/wallet_tests.fif @@ -0,0 +1,2734 @@ +"Asm.fif" include +// automatically generated from `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\error_codes.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\math.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\func-libs\stdlib.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\1.address_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\bad_messages_generator.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\c5_parse_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\message_helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\storage-test-helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\tests-helpers.func` `C:\Users\Tigr\AppData\Local\toncli\toncli\test-libs\token-helpers.func` `D:\TON_FunC\multisig-wallet-v5\func\wallet.fc` `D:\TON_FunC\multisig-wallet-v5\tests\wallet.fc` +PROGRAM{ + DECLPROC power + DECLPROC sqrt + DECLPROC avg + DECLPROC exp + DECLPROC log2 + 114362 DECLMETHOD generate_empty_address + 103563 DECLMETHOD generate_internal_address + 71142 DECLMETHOD generate_internal_address_with_custom_data + 105789 DECLMETHOD generate_external_address + 77760 DECLMETHOD generate_external_address_with_custom_data + 119020 DECLMETHOD generate_var_address + 101577 DECLMETHOD generate_var_address_with_custom_data + DECLPROC generate_any_address + 76887 DECLMETHOD generate_external_out_message_with_bad_source_address + 113901 DECLMETHOD generate_external_out_message_with_bad_destination_address + 124331 DECLMETHOD generate_external_in_message_with_bad_source_address + 128854 DECLMETHOD generate_external_in_message_with_bad_destination_address + 122899 DECLMETHOD generate_internal_message_with_bad_grams_data + 105345 DECLMETHOD generate_internal_message_with_bad_init_state_data + DECLPROC parse_send_raw_message + DECLPROC parse_lib_code + DECLPROC parse_raw_reserve + DECLPROC parse_set_code + DECLPROC parse_c5 + DECLPROC generate_init_state + DECLPROC generate_init_state_with_data + DECLPROC parse_init_state + DECLPROC random_query_id + DECLPROC generate_internal_message_body + DECLPROC generate_internal_message_custom + DECLPROC generate_get_royalty_params + DECLPROC generate_nft_transfer_request + DECLPROC generate_nft_get_static_data_request + DECLPROC generate_nft_deploy_request + DECLPROC generate_jetton_burn_request + DECLPROC generate_jetton_burn_notification + DECLPROC generate_jetton_internal_transfer_request + DECLPROC generate_jetton_transfer_request + DECLPROC generate_internal_message + DECLPROC generate_internal_message_relaxed + DECLPROC generate_external_in_message + DECLPROC generate_external_in_message_with_empty_source_address + DECLPROC generate_external_out_message + DECLPROC generate_external_out_message_with_empty_destination_address + DECLPROC generate_external_out_message_relaxed + DECLPROC parse_internal_message + DECLPROC parse_external_message + 69682 DECLMETHOD init_environment + 104832 DECLMETHOD storage_key + 68533 DECLMETHOD load_storage_with_tag + 113134 DECLMETHOD save_storage_with_tag + 85860 DECLMETHOD get_c7 + 78457 DECLMETHOD invoke_method + 93676 DECLMETHOD invoke_method_expect_fail + 127733 DECLMETHOD assert_no_actions + DECLPROC token_snake_len + DECLPROC get_snake_tail + 103208 DECLMETHOD snake_concat + DECLPROC snake_concat_tagged + DECLPROC snake_equal? + DECLPROC calc_storage_fee_raw + DECLPROC calc_storage_fee + DECLPROC load_contract + DECLPROC save_contract + 85143 DECLMETHOD seqno + 78748 DECLMETHOD get_public_key + 76407 DECLMETHOD is_plugin_installed + 99710 DECLMETHOD get_plugin_cell + 116329 DECLMETHOD get_plugin_storage + 108216 DECLMETHOD resolve_plugin + 107653 DECLMETHOD get_plugin_list + 127040 DECLMETHOD get_plugin_list_with_cell + 66326 DECLMETHOD get_plugin_list_resolved + 72101 DECLMETHOD get_plugin_list_resolved_with_storage + DECLPROC check_any_signature + 108438 DECLMETHOD uninstall_plugin + DECLPROC ~do + DECLPROC main + DECLPROC recv_external + DECLPROC init + DECLPROC init_config + DECLPROC __test_void_external + DECLPROC __test_external_noinit + DECLPROC __test_short_external + DECLPROC __test_short2_external + DECLPROC __test_accepted_external + DECLPROC __test_add_plugin + DECLPROC __test_transfer + DECLGLOBVAR plugins_storage + power PROCREF:<{ + // x exponent + OVER // x exponent x + 0 EQINT // x exponent _3 + IFJMP:<{ // x exponent + 2DROP // + 0 PUSHINT // _4=0 + }> // x exponent + DUP // x exponent exponent + 0 EQINT // x exponent _6 + IFJMP:<{ // x exponent + 2DROP // + 1 PUSHINT // _7=1 + }> // x exponent + OVER // x counter result + WHILE:<{ + OVER // x counter result counter + 1 GTINT // x counter result _11 + }>DO<{ // x counter result + s2 PUSH // x counter result x + MUL // x counter result + SWAP // x result counter + DEC // x result counter + SWAP // x counter result + }> // x counter result + 2 1 BLKDROP2 // result + }> + sqrt PROCREF:<{ + // x + DUP // x x + 0 EQINT // x _2 + IFJMP:<{ // x + DROP // + 0 PUSHINT // _3=0 + }> // x + DUP // x x + 4 LESSINT // x _5 + IFJMP:<{ // x + DROP // + 1 PUSHINT // _6=1 + }> // x + DUP // x x + INC // x _9 + 1 RSHIFT# // x z + OVER // x z y + WHILE:<{ + 2DUP // x z y z y + LESS // x z y _13 + }>DO<{ // x z y + DROP // x z + s0 s1 s0 PUSH3 // x z y x z + DIV // x z y _14 + ROT // x y _14 z + ADD // x y _15 + 1 RSHIFT# // x y z + SWAP // x z y + }> // x z y + 2 1 BLKDROP2 // y + }> + avg PROCREF:<{ + // x y + ADD // _2 + 1 RSHIFT# // _4 + }> + exp PROCREF:<{ + // x + DUP // x x + -1 GTINT // x _2 + IF:<{ // x + POW2 // _3 + }>ELSE<{ // x + 1 PUSHINT // x _6=1 + SWAP // _6=1 x + NEGATE // _6=1 _8 + RSHIFT // _3 + }> + }> + log2 PROCREF:<{ + // x + 0 PUSHINT // x n=0 + 7 PUSHPOW2 // x n=0 _3=128 + exp INLINECALLDICT // x n=0 _4 + s2 s(-1) PUXC // x n=0 x _4 + GEQ // x n=0 _5 + IF:<{ // x n=0 + DROP // x + 128 RSHIFT# // x + 7 PUSHPOW2 // x n + }> // x n + 64 PUSHINT // x n _10=64 + exp INLINECALLDICT // x n _11 + s2 s(-1) PUXC // x n x _11 + GEQ // x n _12 + IF:<{ // x n + SWAP // n x + 64 RSHIFT# // n x + SWAP // x n + 64 ADDCONST // x n + }> // x n + 32 PUSHINT // x n _17=32 + exp INLINECALLDICT // x n _18 + s2 s(-1) PUXC // x n x _18 + GEQ // x n _19 + IF:<{ // x n + SWAP // n x + 32 RSHIFT# // n x + SWAP // x n + 32 ADDCONST // x n + }> // x n + 16 PUSHINT // x n _24=16 + exp INLINECALLDICT // x n _25 + s2 s(-1) PUXC // x n x _25 + GEQ // x n _26 + IF:<{ // x n + SWAP // n x + 16 RSHIFT# // n x + SWAP // x n + 16 ADDCONST // x n + }> // x n + 8 PUSHINT // x n _31=8 + exp INLINECALLDICT // x n _32 + s2 s(-1) PUXC // x n x _32 + GEQ // x n _33 + IF:<{ // x n + SWAP // n x + 8 RSHIFT# // n x + SWAP // x n + 8 ADDCONST // x n + }> // x n + 4 PUSHINT // x n _38=4 + exp INLINECALLDICT // x n _39 + s2 s(-1) PUXC // x n x _39 + GEQ // x n _40 + IF:<{ // x n + SWAP // n x + 4 RSHIFT# // n x + SWAP // x n + 4 ADDCONST // x n + }> // x n + 2 PUSHINT // x n _45=2 + exp INLINECALLDICT // x n _46 + s2 s(-1) PUXC // x n x _46 + GEQ // x n _47 + IF:<{ // x n + SWAP // n x + 2 RSHIFT# // n x + SWAP // x n + 2 ADDCONST // x n + }> // x n + 1 PUSHINT // x n _52=1 + exp INLINECALLDICT // x n _53 + s1 s2 XCHG // n x _53 + GEQ // n _54 + IF:<{ // n + INC // n + }> // n + }> + generate_empty_address PROC:<{ + // + 0 PUSHINT // _0=0 + NEWC // _0=0 _1 + 2 STU // _3 + ENDC // _4 + CTOS // _5 + }> + generate_internal_address PROC:<{ + // + RANDU256 // address + -1 PUSHINT // address _3=-1 + 0 PUSHINT // address _3=-1 _4=0 + 2 PUSHINT // address _3=-1 _4=0 _5=2 + NEWC // address _3=-1 _4=0 _5=2 _6 + 2 STU // address _3=-1 _4=0 _8 + 1 STU // address _3=-1 _10 + 8 STI // address _12 + 256 STU // _14 + ENDC // _15 + CTOS // address_cell + }> + generate_internal_address_with_custom_data PROC:<{ + // anycast workchain_id address + 2 PUSHINT // anycast workchain_id address _4=2 + NEWC // anycast workchain_id address _4=2 _5 + 2 STU // anycast workchain_id address _7 + s1 s3 XCHG // address workchain_id anycast _7 + 1 STU // address workchain_id _9 + 8 STI // address _11 + 256 STU // _13 + ENDC // _14 + CTOS // address_cell + }> + generate_external_address PROC:<{ + // address_length + RANDU256 // address_length address + 1 PUSHINT // address_length address _4=1 + NEWC // address_length address _4=1 _5 + 2 STU // address_length address _7 + s2 s(-1) PUXC // address_length address address_length _7 + 9 STU // address_length address _9 + ROT // address _9 address_length + STUX // _10 + ENDC // _11 + CTOS // address_cell + }> + generate_external_address_with_custom_data PROC:<{ + // address_length address + 1 PUSHINT // address_length address _3=1 + NEWC // address_length address _3=1 _4 + 2 STU // address_length address _6 + s2 s(-1) PUXC // address_length address address_length _6 + 9 STU // address_length address _8 + ROT // address _8 address_length + STUX // _9 + ENDC // _10 + CTOS // address_cell + }> + generate_var_address PROC:<{ + // address_length + DUP + 8 PUSHPOW2 // address_length address_length _1=256 + GREATER // address_length _2 + IFJMP:<{ // address_length + RANDU256 // address_length address + RANDU256 // address_length address address_secondpart + -1 PUSHINT // address_length address address_secondpart _8=-1 + 0 PUSHINT // address_length address address_secondpart _8=-1 _9=0 + 3 PUSHINT // address_length address address_secondpart _8=-1 _9=0 _10=3 + NEWC // address_length address address_secondpart _8=-1 _9=0 _10=3 _11 + 2 STU // address_length address address_secondpart _8=-1 _9=0 _13 + 1 STU // address_length address address_secondpart _8=-1 _15 + s1 s4 XCHG // _8=-1 address address_secondpart address_length _15 + 9 STU // _8=-1 address address_secondpart _17 + s1 s3 XCHG // address_secondpart address _8=-1 _17 + 8 STI // address_secondpart address _19 + 256 STU // address_secondpart _21 + 256 STU // _23 + ENDC // _24 + CTOS // address_cell + }> // address_length + RANDU256 // address_length address + -1 PUSHINT // address_length address _29=-1 + 0 PUSHINT // address_length address _29=-1 _30=0 + 3 PUSHINT // address_length address _29=-1 _30=0 _31=3 + NEWC // address_length address _29=-1 _30=0 _31=3 _32 + 2 STU // address_length address _29=-1 _30=0 _34 + 1 STU // address_length address _29=-1 _36 + s3 s(-1) PUXC // address_length address _29=-1 address_length _36 + 9 STU // address_length address _29=-1 _38 + 8 STI // address_length address _40 + ROT // address _40 address_length + STUX // _41 + ENDC // _42 + CTOS // address_cell + }> + generate_var_address_with_custom_data PROC:<{ + // anycast workchain_id address_length address_slice + OVER + 8 PUSHPOW2 // anycast workchain_id address_length address_slice address_length _4=256 + GREATER // anycast workchain_id address_length address_slice _5 + IFJMP:<{ // anycast workchain_id address_length address_slice + 256 LDU // anycast workchain_id address_length addr address_slice + 256 LDU // anycast workchain_id address_length addr _52 _51 + DROP // anycast workchain_id address_length addr addr_second_part + 3 PUSHINT // anycast workchain_id address_length addr addr_second_part _15=3 + NEWC // anycast workchain_id address_length addr addr_second_part _15=3 _16 + 2 STU // anycast workchain_id address_length addr addr_second_part _18 + s1 s5 XCHG // addr_second_part workchain_id address_length addr anycast _18 + 1 STU // addr_second_part workchain_id address_length addr _20 + s1 s2 XCHG // addr_second_part workchain_id addr address_length _20 + 9 STU // addr_second_part workchain_id addr _22 + s1 s2 XCHG // addr_second_part addr workchain_id _22 + 8 STI // addr_second_part addr _24 + 256 STU // addr_second_part _26 + 256 STU // _28 + ENDC // _29 + CTOS // address_cell + }> // anycast workchain_id address_length address_slice + 256 LDU // anycast workchain_id address_length _54 _53 + DROP // anycast workchain_id address_length addr + 3 PUSHINT // anycast workchain_id address_length addr _36=3 + NEWC // anycast workchain_id address_length addr _36=3 _37 + 2 STU // anycast workchain_id address_length addr _39 + s1 s4 XCHG // addr workchain_id address_length anycast _39 + 1 STU // addr workchain_id address_length _41 + s1 s(-1) PUXC // addr workchain_id address_length address_length _41 + 9 STU // addr workchain_id address_length _43 + s1 s2 XCHG // addr address_length workchain_id _43 + 8 STI // addr address_length _45 + SWAP // addr _45 address_length + STUX // _46 + ENDC // _47 + CTOS // address_cell + }> + generate_any_address PROC:<{ + // typeOfAddress + DUP // typeOfAddress typeOfAddress + 0 EQINT // typeOfAddress _2 + IFJMP:<{ // typeOfAddress + DROP // + generate_empty_address CALLDICT // _3 + }> // typeOfAddress + DUP // typeOfAddress typeOfAddress + 1 EQINT // typeOfAddress _5 + IFJMP:<{ // typeOfAddress + DROP // + generate_internal_address CALLDICT // _6 + }> // typeOfAddress + 2 EQINT // _8 + IFJMP:<{ // + 8 PUSHPOW2 // _9=256 + generate_external_address CALLDICT // _10 + }> // + 8 PUSHPOW2 // _11=256 + generate_var_address CALLDICT // _12 + }> + generate_external_out_message_with_bad_source_address PROC:<{ + // + 1 PUSHINT // _1=1 + -1 PUSHINT // _1=1 _2=-1 + 0 PUSHINT // _1=1 _2=-1 _3=0 + 2 PUSHINT // _1=1 _2=-1 _3=0 _4=2 + NEWC // _1=1 _2=-1 _3=0 _4=2 _5 + 2 STU // _1=1 _2=-1 _3=0 _7 + 1 STU // _1=1 _2=-1 _9 + 8 STI // _1=1 _11 + 10 STU // _13 + ENDC // _14 + CTOS // ssrc_invalid + 0 PUSHINT // ssrc_invalid _16=0 + 3 PUSHINT // ssrc_invalid _16=0 _17=3 + NEWC // ssrc_invalid _16=0 _17=3 _18 + 2 STU // ssrc_invalid _16=0 _20 + 1 STI // ssrc_invalid _22 + SWAP // _22 ssrc_invalid + STSLICER // _23 + ENDC // _24 + }> + generate_external_out_message_with_bad_destination_address PROC:<{ + // + generate_internal_address CALLDICT // ssrc + 0 PUSHINT // ssrc _2=0 + 3 PUSHINT // ssrc _2=0 _3=3 + NEWC // ssrc _2=0 _3=3 _4 + 2 STU // ssrc _2=0 _6 + ROT // _2=0 _6 ssrc + STSLICER // _2=0 _7 + 1 STI // _9 + ENDC // _10 + }> + generate_external_in_message_with_bad_source_address PROC:<{ + // + 0 PUSHINT // _1=0 + 7 PUSHPOW2 // _1=0 _2=128 + 1 PUSHINT // _1=0 _2=128 _3=1 + NEWC // _1=0 _2=128 _3=1 _4 + 2 STU // _1=0 _2=128 _6 + 9 STU // _1=0 _8 + 10 STU // _10 + ENDC // _11 + CTOS // ssrc_invalid + 2 PUSHINT // ssrc_invalid _13=2 + NEWC // ssrc_invalid _13=2 _14 + 2 STU // ssrc_invalid _16 + SWAP // _16 ssrc_invalid + STSLICER // _17 + ENDC // _18 + }> + generate_external_in_message_with_bad_destination_address PROC:<{ + // + 8 PUSHPOW2 // _1=256 + generate_external_address CALLDICT // ssrc + 0 PUSHINT // ssrc _3=0 + 2 PUSHINT // ssrc _3=0 _4=2 + NEWC // ssrc _3=0 _4=2 _5 + 2 STU // ssrc _3=0 _7 + ROT // _3=0 _7 ssrc + STSLICER // _3=0 _8 + 1 STI // _10 + ENDC // _11 + }> + generate_internal_message_with_bad_grams_data PROC:<{ + // + generate_internal_address CALLDICT // ssrc + generate_internal_address CALLDICT // ssrc sdest + 1 PUSHINT // ssrc sdest _4=1 + 8 PUSHINT // ssrc sdest _4=1 _5=8 + 0 PUSHINT // ssrc sdest _4=1 _5=8 _6=0 + s0 s0 s0 PUSH3 // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _9=0 + NEWC // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _9=0 _10 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _7=0 _8=0 _12 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _7=0 _14 + 1 STU // ssrc sdest _4=1 _5=8 _6=0 _16 + 1 STU // ssrc sdest _4=1 _5=8 _18 + s0 s4 XCHG2 // _5=8 sdest _4=1 _18 ssrc + STSLICER // _5=8 sdest _4=1 _19 + ROT // _5=8 _4=1 _19 sdest + STSLICER // _5=8 _4=1 _20 + s1 s2 XCHG // _4=1 _5=8 _20 + 4 STU // _4=1 _22 + 1 STU // _24 + ENDC // _25 + }> + generate_internal_message_with_bad_init_state_data PROC:<{ + // + generate_internal_address CALLDICT // ssrc + generate_internal_address CALLDICT // ssrc sdest + 1 PUSHINT // ssrc sdest _5=1 + s0 s0 PUSH2 // ssrc sdest _5=1 _6=1 _7=1 + 0 PUSHINT // ssrc sdest _5=1 _6=1 _7=1 _8=0 + s1 s1 s0 PUSH3 // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _11=0 + NEWC // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _11=0 _12 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _10=1 _14 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _9=1 _16 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _8=0 _18 + 1 STU // ssrc sdest _5=1 _6=1 _7=1 _20 + 1 STU // ssrc sdest _5=1 _6=1 _22 + 1 STU // ssrc sdest _5=1 _24 + 1 STU // ssrc sdest init_state_with_bad_data + 0 PUSHINT // ssrc sdest init_state_with_bad_data _27=0 + SWAP // ssrc sdest _27=0 init_state_with_bad_data + ENDC // ssrc sdest _27=0 _28 + 1 PUSHINT // ssrc sdest _27=0 _28 _29=1 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 + 1000 PUSHINT // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 + PUSHNULL // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 + s6 s6 s6 PUSH3 // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 + DUP // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _37=0 + NEWC // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _37=0 _38 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _36=0 _40 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _35=0 _42 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _34=0 _44 + 1 STU // ssrc sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _33 _46 + s0 s9 XCHG2 // _33 sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _46 ssrc + STSLICER // _33 sdest _27=0 _28 _29=1 _30=1 _31=1000 _32=1000 _47 + s0 s7 XCHG2 // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _47 sdest + STSLICER // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _48 + s5 PUSH // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _48 _49=0 + STGRAMS // _33 _32=1000 _27=0 _28 _29=1 _30=1 _31=1000 _50 + s1 s7 XCHG // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _33 _50 + STDICT // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _51 + s4 PUSH // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _51 _52=0 + STGRAMS // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _53 + s4 PUSH // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _53 _54=0 + STGRAMS // _31=1000 _32=1000 _27=0 _28 _29=1 _30=1 _55 + s1 s5 XCHG // _31=1000 _30=1 _27=0 _28 _29=1 _32=1000 _55 + 64 STU // _31=1000 _30=1 _27=0 _28 _29=1 _57 + s1 s5 XCHG // _29=1 _30=1 _27=0 _28 _31=1000 _57 + 32 STU // _29=1 _30=1 _27=0 _28 _59 + s1 s3 XCHG // _29=1 _28 _27=0 _30=1 _59 + 1 STU // _29=1 _28 _27=0 _61 + s1 s3 XCHG // _27=0 _28 _29=1 _61 + 1 STU // _27=0 _28 _63 + STREF // _27=0 _64 + 1 STU // _66 + ENDC // _67 + }> + parse_send_raw_message PROCINLINE:<{ + // out_action + 8 LDU // _1 out_action + LDREF // _1 _9 _8 + DROP // _1 _4 + }> + parse_lib_code PROCINLINE:<{ + // out_action + 7 LDU // mode out_action + DUP // mode out_action out_action + SREFS // mode out_action _5 + 0 GTINT // mode out_action _7 + IF:<{ // mode out_action + LDREF // mode _20 _19 + DROP // mode _8 + }>ELSE<{ // mode out_action + 256 LDSLICE // mode _22 _21 + DROP // mode loaded_bits + NEWC // mode loaded_bits _14 + SWAP // mode _14 loaded_bits + STSLICER // mode _15 + ENDC // mode _16 + }> + }> + parse_raw_reserve PROCINLINE:<{ + // out_action + 8 LDU // _1 out_action + LDDICT // _1 _9 _8 + DROP // _1 _4 + }> + parse_set_code PROCINLINE:<{ + // out_action + LDREF // _4 _3 + DROP // _1 + }> + parse_c5 PROCINLINE:<{ + // + NIL // list_of_actions_tuple + c5 PUSH // list_of_actions_tuple c5 + NIL // list_of_actions_tuple c5 actions + SWAP // list_of_actions_tuple actions c5 + CTOS // list_of_actions_tuple actions out_action_node + DUP // list_of_actions_tuple actions out_action_node out_action_node + SBITS // list_of_actions_tuple actions out_action_node _8 + 0 EQINT // list_of_actions_tuple actions out_action_node _10 + IF:<{ // list_of_actions_tuple actions out_action_node + 3 BLKDROP // + PUSHNULL // _11 + }>ELSE<{ // list_of_actions_tuple actions out_action_node + 0 PUSHINT // list_of_actions_tuple actions out_action_node num=0 + UNTIL:<{ + SWAP // list_of_actions_tuple actions num out_action_node + LDREF // list_of_actions_tuple actions num next out_action_node + s0 s3 XCHG2 // list_of_actions_tuple next num out_action_node actions + CONS // list_of_actions_tuple next num actions + s0 s2 XCHG // list_of_actions_tuple actions num next + CTOS // list_of_actions_tuple actions num out_action_node + SWAP // list_of_actions_tuple actions out_action_node num + INC // list_of_actions_tuple actions out_action_node num + OVER // list_of_actions_tuple actions out_action_node num out_action_node + SBITS // list_of_actions_tuple actions out_action_node num _23 + 0 EQINT // list_of_actions_tuple actions out_action_node num break + }> // list_of_actions_tuple actions out_action_node num + NIP // list_of_actions_tuple actions num + 0 PUSHINT // list_of_actions_tuple actions num i=0 + UNTIL:<{ + s0 s2 XCHG // list_of_actions_tuple i num actions + UNCONS // list_of_actions_tuple i num out_action actions + SWAP // list_of_actions_tuple i num actions out_action + 32 LDU // list_of_actions_tuple i num actions action_code out_action + OVER + 247711853 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _35=247711853 + EQUAL // list_of_actions_tuple i num actions action_code out_action _36 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_send_raw_message INLINECALLDICT // list_of_actions_tuple i num actions mode body + 0 PUSHINT // list_of_actions_tuple i num actions mode body _42=0 + s0 s2 XCHG // list_of_actions_tuple i num actions _42=0 body mode + TRIPLE // list_of_actions_tuple i num actions _41 + s1 s4 XCHG // actions i num list_of_actions_tuple _41 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + OVER + 2907562126 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _44=2907562126 + EQUAL // list_of_actions_tuple i num actions action_code out_action _45 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_set_code INLINECALLDICT // list_of_actions_tuple i num actions new_setcode + 1 PUSHINT // list_of_actions_tuple i num actions new_setcode _50=1 + SWAP + -1 PUSHINT // list_of_actions_tuple i num actions _50=1 new_setcode _51=-1 + TRIPLE // list_of_actions_tuple i num actions _49 + s1 s4 XCHG // actions i num list_of_actions_tuple _49 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + OVER + 921090057 PUSHINT // list_of_actions_tuple i num actions action_code out_action action_code _53=921090057 + EQUAL // list_of_actions_tuple i num actions action_code out_action _54 + IF:<{ // list_of_actions_tuple i num actions action_code out_action + NIP // list_of_actions_tuple i num actions out_action + parse_raw_reserve INLINECALLDICT // list_of_actions_tuple i num actions mode currencies + 2 PUSHINT // list_of_actions_tuple i num actions mode currencies _60=2 + s0 s2 XCHG // list_of_actions_tuple i num actions _60=2 currencies mode + TRIPLE // list_of_actions_tuple i num actions _59 + s1 s4 XCHG // actions i num list_of_actions_tuple _59 + TPUSH // actions i num list_of_actions_tuple + }>ELSE<{ // list_of_actions_tuple i num actions action_code out_action + SWAP + 653925844 PUSHINT // list_of_actions_tuple i num actions out_action action_code _62=653925844 + EQUAL // list_of_actions_tuple i num actions out_action _63 + IF:<{ // list_of_actions_tuple i num actions out_action + parse_lib_code INLINECALLDICT // list_of_actions_tuple i num actions mode lib_cell_or_lib_hash + 3 PUSHINT // list_of_actions_tuple i num actions mode lib_cell_or_lib_hash _69=3 + s0 s2 XCHG // list_of_actions_tuple i num actions _69=3 lib_cell_or_lib_hash mode + TRIPLE // list_of_actions_tuple i num actions _68 + s1 s4 XCHG // actions i num list_of_actions_tuple _68 + TPUSH // actions i num list_of_actions_tuple + s0 s3 XCHG // list_of_actions_tuple i num actions + }>ELSE<{ + DROP // list_of_actions_tuple i num actions + }> + s0 s3 XCHG // actions i num list_of_actions_tuple + }> + }> + }> + s0 s2 XCHG // actions list_of_actions_tuple num i + INC // actions list_of_actions_tuple num i + s0 s1 PUSH2 // actions list_of_actions_tuple num i i num + GEQ // actions list_of_actions_tuple num i _73 + s3 s4 XCHG // list_of_actions_tuple actions num i _73 + }> // list_of_actions_tuple actions num i + 3 BLKDROP // list_of_actions_tuple + }> + }> + generate_init_state PROC:<{ + // + 0 PUSHINT // _0=0 + s0 s0 s0 PUSH3 // _0=0 _1=0 _2=0 _3=0 + 1 PUSHINT // _0=0 _1=0 _2=0 _3=0 _4=1 + s0 s1 PUSH2 // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _6=0 + NEWC // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _6=0 _7 + 1 STU // _0=0 _1=0 _2=0 _3=0 _4=1 _5=1 _9 + 1 STU // _0=0 _1=0 _2=0 _3=0 _4=1 _11 + 1 STU // _0=0 _1=0 _2=0 _3=0 _13 + 1 STU // _0=0 _1=0 _2=0 _15 + 1 STU // _0=0 _1=0 _17 + 1 STU // _0=0 _19 + 1 STU // _21 + }> + generate_init_state_with_data PROC:<{ + // code data library + 1 PUSHINT // code data library _3=1 + s0 s0 PUSH2 // code data library _3=1 _4=1 _5=1 + 0 PUSHINT // code data library _3=1 _4=1 _5=1 _6=0 + s1 s1 s0 PUSH3 // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _9=0 + NEWC // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _9=0 _10 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _8=1 _12 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _7=1 _14 + 1 STU // code data library _3=1 _4=1 _5=1 _6=0 _16 + 1 STU // code data library _3=1 _4=1 _5=1 _18 + 1 STU // code data library _3=1 _4=1 _20 + s1 s5 XCHG // _4=1 data library _3=1 code _20 + STREF // _4=1 data library _3=1 _21 + s1 s4 XCHG // _3=1 data library _4=1 _21 + 1 STU // _3=1 data library _23 + s1 s2 XCHG // _3=1 library data _23 + STREF // _3=1 library _24 + s1 s2 XCHG // library _3=1 _24 + 1 STU // library _26 + STREF // _27 + }> + parse_init_state PROC:<{ + // cs + NIL // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_five cs + s2 s1 XCPU // cs maybe_five parsed_tuple maybe_five + TPUSH // cs maybe_five parsed_tuple + SWAP // cs parsed_tuple maybe_five + 1 EQINT // cs parsed_tuple _10 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + 5 LDU // parsed_tuple _12 cs + -ROT // cs parsed_tuple _12 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_tick_tock cs + s2 s1 XCPU // cs maybe_tick_tock parsed_tuple maybe_tick_tock + TPUSH // cs maybe_tick_tock parsed_tuple + SWAP // cs parsed_tuple maybe_tick_tock + 1 EQINT // cs parsed_tuple _23 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple _25 cs + -ROT // cs parsed_tuple _25 + TPUSH // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple _30 cs + -ROT // cs parsed_tuple _30 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_code cs + s2 s1 XCPU // cs maybe_code parsed_tuple maybe_code + TPUSH // cs maybe_code parsed_tuple + SWAP // cs parsed_tuple maybe_code + 1 EQINT // cs parsed_tuple _41 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _43 cs + -ROT // cs parsed_tuple _43 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_data cs + s2 s1 XCPU // cs maybe_data parsed_tuple maybe_data + TPUSH // cs maybe_data parsed_tuple + SWAP // cs parsed_tuple maybe_data + 1 EQINT // cs parsed_tuple _53 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _55 cs + -ROT // cs parsed_tuple _55 + TPUSH // cs parsed_tuple + }> // cs parsed_tuple + SWAP // parsed_tuple cs + 1 LDU // parsed_tuple maybe_library cs + s2 s1 XCPU // cs maybe_library parsed_tuple maybe_library + TPUSH // cs maybe_library parsed_tuple + SWAP // cs parsed_tuple maybe_library + 1 EQINT // cs parsed_tuple _65 + IF:<{ // cs parsed_tuple + SWAP // parsed_tuple cs + LDREF // parsed_tuple _91 _90 + DROP // parsed_tuple _67 + TPUSH // parsed_tuple + }>ELSE<{ + NIP // parsed_tuple + }> + }> + random_query_id PROC:<{ + // + LTIME + ADDRAND + 64 PUSHPOW2 // _3 + RAND // _4 + INC // _6 + }> + generate_internal_message_body PROC:<{ + // op query_id + SWAP + NEWC // query_id op _3 + 32 STU // query_id body + OVER // query_id body query_id + 0 EQINT // query_id body _7 + IF:<{ // query_id body + NIP // body + random_query_id CALLDICT // body query_id + SWAP // query_id body + }> // query_id body + 64 STU // _10 + }> + generate_internal_message_custom PROC:<{ + // bounce ton_amount init_state payload src_addr dst_addr fwd_fee + s2 PUSH // bounce ton_amount init_state payload src_addr dst_addr fwd_fee src_addr + ISNULL // bounce ton_amount init_state payload src_addr dst_addr fwd_fee _8 + IF:<{ // bounce ton_amount init_state payload src_addr dst_addr fwd_fee + s2 POP // bounce ton_amount init_state payload fwd_fee dst_addr + generate_internal_address CALLDICT // bounce ton_amount init_state payload fwd_fee dst_addr _9 + }>ELSE<{ // bounce ton_amount init_state payload _9 dst_addr fwd_fee + s0 s2 XCHG // bounce ton_amount init_state payload fwd_fee dst_addr _9 + }> // bounce ton_amount init_state payload fwd_fee dst_addr ssrc + OVER // bounce ton_amount init_state payload fwd_fee dst_addr ssrc dst_addr + ISNULL // bounce ton_amount init_state payload fwd_fee dst_addr ssrc _12 + IF:<{ // bounce ton_amount init_state payload fwd_fee dst_addr ssrc + NIP // bounce ton_amount init_state payload fwd_fee ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload fwd_fee ssrc _13 + }>ELSE<{ // bounce ton_amount init_state payload fwd_fee _13 ssrc + SWAP // bounce ton_amount init_state payload fwd_fee ssrc _13 + }> // bounce ton_amount init_state payload fwd_fee ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 + DUP // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 + PUSHNULL // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 + 0 PUSHINT // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _21=0 + NEWC // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _21=0 _22 + 1 STU // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _20=0 _24 + 1 STU // bounce ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _19=0 _26 + s1 s11 XCHG // _19=0 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 bounce _26 + 1 STU // _19=0 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _18 _28 + s1 s10 XCHG // _18 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _19=0 _28 + 1 STU // _18 ton_amount init_state payload fwd_fee ssrc sdest _16=1000 _17=1000 _30 + s0 s4 XCHG2 // _18 ton_amount init_state payload fwd_fee _17=1000 sdest _16=1000 _30 ssrc + STSLICER // _18 ton_amount init_state payload fwd_fee _17=1000 sdest _16=1000 _31 + ROT // _18 ton_amount init_state payload fwd_fee _17=1000 _16=1000 _31 sdest + STSLICER // _18 ton_amount init_state payload fwd_fee _17=1000 _16=1000 _32 + s0 s6 XCHG2 // _18 _16=1000 init_state payload fwd_fee _17=1000 _32 ton_amount + STGRAMS // _18 _16=1000 init_state payload fwd_fee _17=1000 _33 + s1 s6 XCHG // _17=1000 _16=1000 init_state payload fwd_fee _18 _33 + STDICT // _17=1000 _16=1000 init_state payload fwd_fee _34 + 0 PUSHINT // _17=1000 _16=1000 init_state payload fwd_fee _34 _35=0 + STGRAMS // _17=1000 _16=1000 init_state payload fwd_fee _36 + SWAP // _17=1000 _16=1000 init_state payload _36 fwd_fee + STGRAMS // _17=1000 _16=1000 init_state payload _37 + s1 s4 XCHG // payload _16=1000 init_state _17=1000 _37 + 64 STU // payload _16=1000 init_state _39 + s1 s2 XCHG // payload init_state _16=1000 _39 + 32 STU // payload init_state _41 + s1 s(-1) PUXC // payload init_state init_state _41 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _45 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _48 + OVER // payload msg init_state_builder _48 init_state_builder + BBITS // payload msg init_state_builder _48 _49 + ADD // payload msg init_state_builder _50 + 10 PUSHPOW2DEC // payload msg init_state_builder _50 _51=1023 + GEQ // payload msg init_state_builder _52 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _53 + 1 PUSHINT + ROT // payload _53 _54=1 msg + 1 STU // payload _53 _56 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _58=0 msg + 1 STU // payload init_state_builder _60 + SWAP // payload _60 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _62 + s2 PUSH // payload msg _62 payload + BBITS // payload msg _62 _63 + ADD // payload msg _64 + 10 PUSHPOW2DEC // payload msg _64 _65=1023 + GEQ // payload msg _66 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _67 + 1 PUSHINT + ROT // _67 _68=1 msg + 1 STU // _67 _70 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _72=0 + SWAP // payload _72=0 msg + 1 STU // payload _74 + SWAP // _74 payload + STBR // msg + }> + ENDC // _76 + }> + generate_get_royalty_params PROC:<{ + // query_id + 1765620048 PUSHINT // query_id _1=1765620048 + SWAP // _1=1765620048 query_id + generate_internal_message_body CALLDICT // _2 + }> + generate_nft_transfer_request PROC:<{ + // new_owner response_dst query_id custom_payload forward_amount forward_payload is_ref? + 1607220500 PUSHINT // new_owner response_dst query_id custom_payload forward_amount forward_payload is_ref? _8=1607220500 + s0 s5 XCHG2 // new_owner response_dst is_ref? custom_payload forward_amount forward_payload _8=1607220500 query_id + generate_internal_message_body CALLDICT // new_owner response_dst is_ref? custom_payload forward_amount forward_payload _9 + s0 s6 XCHG2 // forward_payload response_dst is_ref? custom_payload forward_amount _9 new_owner + STSLICER // forward_payload response_dst is_ref? custom_payload forward_amount _10 + s0 s4 XCHG2 // forward_payload forward_amount is_ref? custom_payload _10 response_dst + STSLICER // forward_payload forward_amount is_ref? custom_payload req + OVER // forward_payload forward_amount is_ref? custom_payload req custom_payload + ISNULL // forward_payload forward_amount is_ref? custom_payload req _12 + IF:<{ // forward_payload forward_amount is_ref? custom_payload req + 0 PUSHINT + s2 POP // forward_payload forward_amount is_ref? _13=0 req + 1 STU // forward_payload forward_amount is_ref? req + }>ELSE<{ // forward_payload forward_amount is_ref? custom_payload req + 1 PUSHINT // forward_payload forward_amount is_ref? custom_payload req _16=1 + SWAP // forward_payload forward_amount is_ref? custom_payload _16=1 req + 1 STU // forward_payload forward_amount is_ref? custom_payload _18 + STREF // forward_payload forward_amount is_ref? req + }> + ROT // forward_payload is_ref? req forward_amount + STGRAMS // forward_payload is_ref? req + s2 PUSH // forward_payload is_ref? req forward_payload + ISNULL // forward_payload is_ref? req _21 + NOT // forward_payload is_ref? req _22 + IF:<{ // forward_payload is_ref? req + SWAP // forward_payload req is_ref? + IF:<{ // forward_payload req + 1 PUSHINT // forward_payload req _23=1 + SWAP // forward_payload _23=1 req + 1 STU // forward_payload _25 + STREF // req + }>ELSE<{ // forward_payload req + 0 PUSHINT // forward_payload req _27=0 + SWAP // forward_payload _27=0 req + 1 STU // forward_payload _29 + SWAP // _29 forward_payload + CTOS // _29 _30 + STSLICER // req + }> + }>ELSE<{ // forward_payload is_ref? req + NIP + 0 PUSHINT + s2 POP // _32=0 req + 1 STU // req + }> + }> + generate_nft_get_static_data_request PROC:<{ + // query_id + 801842850 PUSHINT // query_id _1=801842850 + NEWC // query_id _1=801842850 _2 + 32 STU // query_id _4 + 64 STU // _6 + }> + generate_nft_deploy_request PROC:<{ + // idx content query_id forward_amount + 1 PUSHINT + ROT // idx content forward_amount _4=1 query_id + generate_internal_message_body CALLDICT // idx content forward_amount _5 + s1 s3 XCHG // forward_amount content idx _5 + 64 STU // forward_amount content _7 + ROT // content _7 forward_amount + STGRAMS // content _8 + STREF // _9 + }> + generate_jetton_burn_request PROC:<{ + // query_id amount dst custom_payload + 1499400124 PUSHINT // query_id amount dst custom_payload _5=1499400124 + s0 s4 XCHG2 // custom_payload amount dst _5=1499400124 query_id + generate_internal_message_body CALLDICT // custom_payload amount dst _6 + ROT // custom_payload dst _6 amount + STGRAMS // custom_payload dst _7 + SWAP // custom_payload _7 dst + STSLICER // custom_payload burn_msg + OVER // custom_payload burn_msg custom_payload + ISNULL // custom_payload burn_msg _9 + NOT // custom_payload burn_msg _10 + IF:<{ // custom_payload burn_msg + 1 PUSHINT // custom_payload burn_msg _11=1 + SWAP // custom_payload _11=1 burn_msg + 1 STU // custom_payload _13 + STREF // burn_msg + }>ELSE<{ // custom_payload burn_msg + 0 PUSHINT + s2 POP // _15=0 burn_msg + 1 STU // burn_msg + }> + }> + generate_jetton_burn_notification PROC:<{ + // query_id amount sender resp_dst + 2078119902 PUSHINT // query_id amount sender resp_dst _4=2078119902 + s0 s4 XCHG2 // resp_dst amount sender _4=2078119902 query_id + generate_internal_message_body CALLDICT // resp_dst amount sender _5 + ROT // resp_dst sender _5 amount + STGRAMS // resp_dst sender _6 + SWAP // resp_dst _6 sender + STSLICER // resp_dst _7 + SWAP // _7 resp_dst + STSLICER // _8 + }> + generate_jetton_internal_transfer_request PROC:<{ + // query_id amount from resp_addr forward_amount forward_payload is_ref? + 395134233 PUSHINT // query_id amount from resp_addr forward_amount forward_payload is_ref? _8=395134233 + s0 s7 XCHG2 // is_ref? amount from resp_addr forward_amount forward_payload _8=395134233 query_id + generate_internal_message_body CALLDICT // is_ref? amount from resp_addr forward_amount forward_payload _9 + s0 s5 XCHG2 // is_ref? forward_payload from resp_addr forward_amount _9 amount + STGRAMS // is_ref? forward_payload from resp_addr forward_amount _10 + s0 s3 XCHG2 // is_ref? forward_payload forward_amount resp_addr _10 from + STSLICER // is_ref? forward_payload forward_amount resp_addr _11 + SWAP // is_ref? forward_payload forward_amount _11 resp_addr + STSLICER // is_ref? forward_payload forward_amount _12 + SWAP // is_ref? forward_payload _12 forward_amount + STGRAMS // is_ref? forward_payload req + OVER // is_ref? forward_payload req forward_payload + ISNULL // is_ref? forward_payload req _14 + NOT // is_ref? forward_payload req _15 + IF:<{ // is_ref? forward_payload req + s0 s2 XCHG // req forward_payload is_ref? + IF:<{ // req forward_payload + 1 PUSHINT + ROT // forward_payload _16=1 req + 1 STU // forward_payload _18 + STREF // req + }>ELSE<{ // req forward_payload + 0 PUSHINT + ROT // forward_payload _20=0 req + 1 STU // forward_payload _22 + SWAP // _22 forward_payload + CTOS // _22 _23 + STSLICER // req + }> + }>ELSE<{ // is_ref? forward_payload req + NIP + 0 PUSHINT + s2 POP // _25=0 req + 1 STU // req + }> + }> + generate_jetton_transfer_request PROC:<{ + // query_id amount dst resp_dst custom_payload forward_amount forward_payload is_ref? + 260734629 PUSHINT // query_id amount dst resp_dst custom_payload forward_amount forward_payload is_ref? _9=260734629 + s0 s8 XCHG2 // is_ref? amount dst resp_dst custom_payload forward_amount forward_payload _9=260734629 query_id + generate_internal_message_body CALLDICT // is_ref? amount dst resp_dst custom_payload forward_amount forward_payload _10 + s0 s6 XCHG2 // is_ref? forward_payload dst resp_dst custom_payload forward_amount _10 amount + STGRAMS // is_ref? forward_payload dst resp_dst custom_payload forward_amount _11 + s0 s4 XCHG2 // is_ref? forward_payload forward_amount resp_dst custom_payload _11 dst + STSLICER // is_ref? forward_payload forward_amount resp_dst custom_payload _12 + ROT // is_ref? forward_payload forward_amount custom_payload _12 resp_dst + STSLICER // is_ref? forward_payload forward_amount custom_payload req + OVER // is_ref? forward_payload forward_amount custom_payload req custom_payload + ISNULL // is_ref? forward_payload forward_amount custom_payload req _14 + IF:<{ // is_ref? forward_payload forward_amount custom_payload req + 0 PUSHINT + s2 POP // is_ref? forward_payload forward_amount _15=0 req + 1 STU // is_ref? forward_payload forward_amount req + }>ELSE<{ // is_ref? forward_payload forward_amount custom_payload req + 1 PUSHINT // is_ref? forward_payload forward_amount custom_payload req _18=1 + SWAP // is_ref? forward_payload forward_amount custom_payload _18=1 req + 1 STU // is_ref? forward_payload forward_amount custom_payload _20 + STREF // is_ref? forward_payload forward_amount req + }> + SWAP // is_ref? forward_payload req forward_amount + STGRAMS // is_ref? forward_payload req + OVER // is_ref? forward_payload req forward_payload + ISNULL // is_ref? forward_payload req _23 + NOT // is_ref? forward_payload req _24 + IF:<{ // is_ref? forward_payload req + s0 s2 XCHG // req forward_payload is_ref? + IF:<{ // req forward_payload + 1 PUSHINT + ROT // forward_payload _25=1 req + 1 STU // forward_payload _27 + STREF // req + }>ELSE<{ // req forward_payload + 0 PUSHINT + ROT // forward_payload _29=0 req + 1 STU // forward_payload _31 + SWAP // _31 forward_payload + CTOS // _31 _32 + STSLICER // req + }> + }>ELSE<{ // is_ref? forward_payload req + NIP + 0 PUSHINT + s2 POP // _34=0 req + 1 STU // req + }> + }> + generate_internal_message PROC:<{ + // bounce ton_amount init_state payload + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload ssrc sdest _9=1000 + DUP // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 + PUSHNULL // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 + 0 PUSHINT // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _14=0 + NEWC // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _14=0 _15 + 1 STU // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _13=0 _17 + 1 STU // bounce ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _12=0 _19 + s1 s10 XCHG // _12=0 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 bounce _19 + 1 STU // _12=0 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _11 _21 + s1 s9 XCHG // _11 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _12=0 _21 + 1 STU // _11 ton_amount init_state payload ssrc sdest _9=1000 _10=1000 _23 + s0 s4 XCHG2 // _11 ton_amount init_state payload _10=1000 sdest _9=1000 _23 ssrc + STSLICER // _11 ton_amount init_state payload _10=1000 sdest _9=1000 _24 + ROT // _11 ton_amount init_state payload _10=1000 _9=1000 _24 sdest + STSLICER // _11 ton_amount init_state payload _10=1000 _9=1000 _25 + s0 s5 XCHG2 // _11 _9=1000 init_state payload _10=1000 _25 ton_amount + STGRAMS // _11 _9=1000 init_state payload _10=1000 _26 + s1 s5 XCHG // _10=1000 _9=1000 init_state payload _11 _26 + STDICT // _10=1000 _9=1000 init_state payload _27 + 0 PUSHINT // _10=1000 _9=1000 init_state payload _27 _28=0 + STGRAMS // _10=1000 _9=1000 init_state payload _29 + 0 PUSHINT // _10=1000 _9=1000 init_state payload _29 _30=0 + STGRAMS // _10=1000 _9=1000 init_state payload _31 + s1 s4 XCHG // payload _9=1000 init_state _10=1000 _31 + 64 STU // payload _9=1000 init_state _33 + s1 s2 XCHG // payload init_state _9=1000 _33 + 32 STU // payload init_state _35 + s1 s(-1) PUXC // payload init_state init_state _35 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _39 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _42 + OVER // payload msg init_state_builder _42 init_state_builder + BBITS // payload msg init_state_builder _42 _43 + ADD // payload msg init_state_builder _44 + 10 PUSHPOW2DEC // payload msg init_state_builder _44 _45=1023 + GEQ // payload msg init_state_builder _46 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _47 + 1 PUSHINT + ROT // payload _47 _48=1 msg + 1 STU // payload _47 _50 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _52=0 msg + 1 STU // payload init_state_builder _54 + SWAP // payload _54 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _56 + s2 PUSH // payload msg _56 payload + BBITS // payload msg _56 _57 + ADD // payload msg _58 + 10 PUSHPOW2DEC // payload msg _58 _59=1023 + GEQ // payload msg _60 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _61 + 1 PUSHINT + ROT // _61 _62=1 msg + 1 STU // _61 _64 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _66=0 + SWAP // payload _66=0 msg + 1 STU // payload _68 + SWAP // _68 payload + STBR // msg + }> + ENDC // _70 + }> + generate_internal_message_relaxed PROC:<{ + // bounce ton_amount init_state payload typeOfAnyAddress + generate_any_address CALLDICT // bounce ton_amount init_state payload ssrc + generate_internal_address CALLDICT // bounce ton_amount init_state payload ssrc sdest + 1000 PUSHINT // bounce ton_amount init_state payload ssrc sdest _10=1000 + DUP // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 + PUSHNULL // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 + 0 PUSHINT // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 + s0 s0 PUSH2 // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _15=0 + NEWC // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _15=0 _16 + 1 STU // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _14=0 _18 + 1 STU // bounce ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _13=0 _20 + s1 s10 XCHG // _13=0 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 bounce _20 + 1 STU // _13=0 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _12 _22 + s1 s9 XCHG // _12 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _13=0 _22 + 1 STU // _12 ton_amount init_state payload ssrc sdest _10=1000 _11=1000 _24 + s0 s4 XCHG2 // _12 ton_amount init_state payload _11=1000 sdest _10=1000 _24 ssrc + STSLICER // _12 ton_amount init_state payload _11=1000 sdest _10=1000 _25 + ROT // _12 ton_amount init_state payload _11=1000 _10=1000 _25 sdest + STSLICER // _12 ton_amount init_state payload _11=1000 _10=1000 _26 + s0 s5 XCHG2 // _12 _10=1000 init_state payload _11=1000 _26 ton_amount + STGRAMS // _12 _10=1000 init_state payload _11=1000 _27 + s1 s5 XCHG // _11=1000 _10=1000 init_state payload _12 _27 + STDICT // _11=1000 _10=1000 init_state payload _28 + 0 PUSHINT // _11=1000 _10=1000 init_state payload _28 _29=0 + STGRAMS // _11=1000 _10=1000 init_state payload _30 + 0 PUSHINT // _11=1000 _10=1000 init_state payload _30 _31=0 + STGRAMS // _11=1000 _10=1000 init_state payload _32 + s1 s4 XCHG // payload _10=1000 init_state _11=1000 _32 + 64 STU // payload _10=1000 init_state _34 + s1 s2 XCHG // payload init_state _10=1000 _34 + 32 STU // payload init_state _36 + s1 s(-1) PUXC // payload init_state init_state _36 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _40 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _43 + OVER // payload msg init_state_builder _43 init_state_builder + BBITS // payload msg init_state_builder _43 _44 + ADD // payload msg init_state_builder _45 + 10 PUSHPOW2DEC // payload msg init_state_builder _45 _46=1023 + GEQ // payload msg init_state_builder _47 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _48 + 1 PUSHINT + ROT // payload _48 _49=1 msg + 1 STU // payload _48 _51 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _53=0 msg + 1 STU // payload init_state_builder _55 + SWAP // payload _55 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _57 + s2 PUSH // payload msg _57 payload + BBITS // payload msg _57 _58 + ADD // payload msg _59 + 10 PUSHPOW2DEC // payload msg _59 _60=1023 + GEQ // payload msg _61 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _62 + 1 PUSHINT + ROT // _62 _63=1 msg + 1 STU // _62 _65 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _67=0 + SWAP // payload _67=0 msg + 1 STU // payload _69 + SWAP // _69 payload + STBR // msg + }> + ENDC // _71 + }> + generate_external_in_message PROC:<{ + // import_fee init_state payload + 8 PUSHPOW2 // import_fee init_state payload _4=256 + generate_external_address CALLDICT // import_fee init_state payload ssrc + generate_internal_address CALLDICT // import_fee init_state payload ssrc sdest + 2 PUSHINT // import_fee init_state payload ssrc sdest _9=2 + NEWC // import_fee init_state payload ssrc sdest _9=2 _10 + 2 STU // import_fee init_state payload ssrc sdest _12 + ROT // import_fee init_state payload sdest _12 ssrc + STSLICER // import_fee init_state payload sdest _13 + SWAP // import_fee init_state payload _13 sdest + STSLICER // import_fee init_state payload _14 + s0 s3 XCHG2 // payload init_state _14 import_fee + STGRAMS // payload init_state _15 + s1 s(-1) PUXC // payload init_state init_state _15 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _19 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _22 + OVER // payload msg init_state_builder _22 init_state_builder + BBITS // payload msg init_state_builder _22 _23 + ADD // payload msg init_state_builder _24 + 10 PUSHPOW2DEC // payload msg init_state_builder _24 _25=1023 + GEQ // payload msg init_state_builder _26 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _27 + 1 PUSHINT + ROT // payload _27 _28=1 msg + 1 STU // payload _27 _30 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _32=0 msg + 1 STU // payload init_state_builder _34 + SWAP // payload _34 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _36 + s2 PUSH // payload msg _36 payload + BBITS // payload msg _36 _37 + ADD // payload msg _38 + 10 PUSHPOW2DEC // payload msg _38 _39=1023 + GREATER // payload msg _40 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _41 + 1 PUSHINT + ROT // _41 _42=1 msg + 1 STU // _41 _44 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _46=0 + SWAP // payload _46=0 msg + 1 STU // payload _48 + SWAP // _48 payload + STBR // msg + }> + ENDC // _50 + }> + generate_external_in_message_with_empty_source_address PROC:<{ + // import_fee init_state payload + generate_empty_address CALLDICT // import_fee init_state payload ssrc + generate_internal_address CALLDICT // import_fee init_state payload ssrc sdest + 2 PUSHINT // import_fee init_state payload ssrc sdest _8=2 + NEWC // import_fee init_state payload ssrc sdest _8=2 _9 + 2 STU // import_fee init_state payload ssrc sdest _11 + ROT // import_fee init_state payload sdest _11 ssrc + STSLICER // import_fee init_state payload sdest _12 + SWAP // import_fee init_state payload _12 sdest + STSLICER // import_fee init_state payload _13 + s0 s3 XCHG2 // payload init_state _13 import_fee + STGRAMS // payload init_state _14 + s1 s(-1) PUXC // payload init_state init_state _14 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _18 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _21 + OVER // payload msg init_state_builder _21 init_state_builder + BBITS // payload msg init_state_builder _21 _22 + ADD // payload msg init_state_builder _23 + 10 PUSHPOW2DEC // payload msg init_state_builder _23 _24=1023 + GEQ // payload msg init_state_builder _25 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _26 + 1 PUSHINT + ROT // payload _26 _27=1 msg + 1 STU // payload _26 _29 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _31=0 msg + 1 STU // payload init_state_builder _33 + SWAP // payload _33 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _35 + s2 PUSH // payload msg _35 payload + BBITS // payload msg _35 _36 + ADD // payload msg _37 + 10 PUSHPOW2DEC // payload msg _37 _38=1023 + GEQ // payload msg _39 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _40 + 1 PUSHINT + ROT // _40 _41=1 msg + 1 STU // _40 _43 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _45=0 + SWAP // payload _45=0 msg + 1 STU // payload _47 + SWAP // _47 payload + STBR // msg + }> + ENDC // _49 + }> + generate_external_out_message PROC:<{ + // import_fee init_state payload + s2 POP // payload init_state + generate_internal_address CALLDICT // payload init_state ssrc + 8 PUSHPOW2 // payload init_state ssrc _6=256 + generate_external_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _9=1000 + DUP // payload init_state ssrc sdest _9=1000 _10=1000 + 3 PUSHINT // payload init_state ssrc sdest _9=1000 _10=1000 _11=3 + NEWC // payload init_state ssrc sdest _9=1000 _10=1000 _11=3 _12 + 2 STU // payload init_state ssrc sdest _9=1000 _10=1000 _14 + s0 s4 XCHG2 // payload init_state _10=1000 sdest _9=1000 _14 ssrc + STSLICER // payload init_state _10=1000 sdest _9=1000 _15 + ROT // payload init_state _10=1000 _9=1000 _15 sdest + STSLICER // payload init_state _10=1000 _9=1000 _16 + s1 s2 XCHG // payload init_state _9=1000 _10=1000 _16 + 64 STU // payload init_state _9=1000 _18 + 32 STU // payload init_state _20 + s1 s(-1) PUXC // payload init_state init_state _20 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _24 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _27 + OVER // payload msg init_state_builder _27 init_state_builder + BBITS // payload msg init_state_builder _27 _28 + ADD // payload msg init_state_builder _29 + 10 PUSHPOW2DEC // payload msg init_state_builder _29 _30=1023 + GEQ // payload msg init_state_builder _31 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _32 + 1 PUSHINT + ROT // payload _32 _33=1 msg + 1 STU // payload _32 _35 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _37=0 msg + 1 STU // payload init_state_builder _39 + SWAP // payload _39 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _41 + s2 PUSH // payload msg _41 payload + BBITS // payload msg _41 _42 + ADD // payload msg _43 + 10 PUSHPOW2DEC // payload msg _43 _44=1023 + GEQ // payload msg _45 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _46 + 1 PUSHINT + ROT // _46 _47=1 msg + 1 STU // _46 _49 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _51=0 + SWAP // payload _51=0 msg + 1 STU // payload _53 + SWAP // _53 payload + STBR // msg + }> + ENDC // _55 + }> + generate_external_out_message_with_empty_destination_address PROC:<{ + // import_fee init_state payload + s2 POP // payload init_state + generate_internal_address CALLDICT // payload init_state ssrc + generate_empty_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _8=1000 + DUP // payload init_state ssrc sdest _8=1000 _9=1000 + 3 PUSHINT // payload init_state ssrc sdest _8=1000 _9=1000 _10=3 + NEWC // payload init_state ssrc sdest _8=1000 _9=1000 _10=3 _11 + 2 STU // payload init_state ssrc sdest _8=1000 _9=1000 _13 + s0 s4 XCHG2 // payload init_state _9=1000 sdest _8=1000 _13 ssrc + STSLICER // payload init_state _9=1000 sdest _8=1000 _14 + ROT // payload init_state _9=1000 _8=1000 _14 sdest + STSLICER // payload init_state _9=1000 _8=1000 _15 + s1 s2 XCHG // payload init_state _8=1000 _9=1000 _15 + 64 STU // payload init_state _8=1000 _17 + 32 STU // payload init_state _19 + s1 s(-1) PUXC // payload init_state init_state _19 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _23 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _26 + OVER // payload msg init_state_builder _26 init_state_builder + BBITS // payload msg init_state_builder _26 _27 + ADD // payload msg init_state_builder _28 + 10 PUSHPOW2DEC // payload msg init_state_builder _28 _29=1023 + GEQ // payload msg init_state_builder _30 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _31 + 1 PUSHINT + ROT // payload _31 _32=1 msg + 1 STU // payload _31 _34 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _36=0 msg + 1 STU // payload init_state_builder _38 + SWAP // payload _38 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _40 + s2 PUSH // payload msg _40 payload + BBITS // payload msg _40 _41 + ADD // payload msg _42 + 10 PUSHPOW2DEC // payload msg _42 _43=1023 + GEQ // payload msg _44 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _45 + 1 PUSHINT + ROT // _45 _46=1 msg + 1 STU // _45 _48 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _50=0 + SWAP // payload _50=0 msg + 1 STU // payload _52 + SWAP // _52 payload + STBR // msg + }> + ENDC // _54 + }> + generate_external_out_message_relaxed PROC:<{ + // ton_amount init_state payload typeOfAnyAddress + s3 POP // typeOfAnyAddress init_state payload + s0 s2 XCHG // payload init_state typeOfAnyAddress + generate_any_address CALLDICT // payload init_state ssrc + 8 PUSHPOW2 // payload init_state ssrc _7=256 + generate_external_address CALLDICT // payload init_state ssrc sdest + 1000 PUSHINT // payload init_state ssrc sdest _10=1000 + DUP // payload init_state ssrc sdest _10=1000 _11=1000 + 3 PUSHINT // payload init_state ssrc sdest _10=1000 _11=1000 _12=3 + NEWC // payload init_state ssrc sdest _10=1000 _11=1000 _12=3 _13 + 2 STU // payload init_state ssrc sdest _10=1000 _11=1000 _15 + s0 s4 XCHG2 // payload init_state _11=1000 sdest _10=1000 _15 ssrc + STSLICER // payload init_state _11=1000 sdest _10=1000 _16 + ROT // payload init_state _11=1000 _10=1000 _16 sdest + STSLICER // payload init_state _11=1000 _10=1000 _17 + s1 s2 XCHG // payload init_state _10=1000 _11=1000 _17 + 64 STU // payload init_state _10=1000 _19 + 32 STU // payload init_state _21 + s1 s(-1) PUXC // payload init_state init_state _21 + 1 STU // payload init_state msg + SWAP // payload msg init_state + 1 EQINT // payload msg _25 + IF:<{ // payload msg + generate_init_state CALLDICT // payload msg init_state_builder + OVER // payload msg init_state_builder msg + BBITS // payload msg init_state_builder _28 + OVER // payload msg init_state_builder _28 init_state_builder + BBITS // payload msg init_state_builder _28 _29 + ADD // payload msg init_state_builder _30 + 10 PUSHPOW2DEC // payload msg init_state_builder _30 _31=1023 + GEQ // payload msg init_state_builder _32 + IF:<{ // payload msg init_state_builder + ENDC // payload msg _33 + 1 PUSHINT + ROT // payload _33 _34=1 msg + 1 STU // payload _33 _36 + STREF // payload msg + }>ELSE<{ // payload msg init_state_builder + 0 PUSHINT + ROT // payload init_state_builder _38=0 msg + 1 STU // payload init_state_builder _40 + SWAP // payload _40 init_state_builder + STBR // payload msg + }> + }> // payload msg + DUP // payload msg msg + BBITS // payload msg _42 + s2 PUSH // payload msg _42 payload + BBITS // payload msg _42 _43 + ADD // payload msg _44 + 10 PUSHPOW2DEC // payload msg _44 _45=1023 + GEQ // payload msg _46 + IF:<{ // payload msg + SWAP // msg payload + ENDC // msg _47 + 1 PUSHINT + ROT // _47 _48=1 msg + 1 STU // _47 _50 + STREF // msg + }>ELSE<{ // payload msg + 0 PUSHINT // payload msg _52=0 + SWAP // payload _52=0 msg + 1 STU // payload _54 + SWAP // _54 payload + STBR // msg + }> + ENDC // _56 + }> + parse_internal_message PROC:<{ + // message + CTOS // cs + 112 PUSHINT // cs _3 + SWAP // _3 cs + 1 LDU // _3 _4 cs + SWAP // _3 cs _4 + 0 NEQINT // _3 cs _8 + s1 s2 XCHG // cs _3 _8 + THROWANYIF + 1 LDU // ihr_disabled cs + 1 LDU // ihr_disabled bounce cs + 1 LDU // ihr_disabled bounce bounced cs + LDMSGADDR // ihr_disabled bounce bounced src cs + LDMSGADDR // ihr_disabled bounce bounced src to_address cs + LDVARUINT16 // ihr_disabled bounce bounced src to_address money cs + LDDICT // ihr_disabled bounce bounced src to_address money _86 _85 + NIP // ihr_disabled bounce bounced src to_address money cs + LDGRAMS // ihr_disabled bounce bounced src to_address money _88 _87 + NIP // ihr_disabled bounce bounced src to_address money cs + LDGRAMS // ihr_disabled bounce bounced src to_address money _90 _89 + NIP // ihr_disabled bounce bounced src to_address money cs + 96 LDU // ihr_disabled bounce bounced src to_address money timestamps cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps maybe_init_state cs + NIL // ihr_disabled bounce bounced src to_address money timestamps maybe_init_state cs init_state + s0 s2 XCHG // ihr_disabled bounce bounced src to_address money timestamps init_state cs maybe_init_state + 1 EQINT // ihr_disabled bounce bounced src to_address money timestamps init_state cs _50 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps init_state cs + NIP // ihr_disabled bounce bounced src to_address money timestamps cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps _51 cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps cs _51 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps cs + LDREF // ihr_disabled bounce bounced src to_address money timestamps _54 cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps cs _54 + CTOS // ihr_disabled bounce bounced src to_address money timestamps cs _56 + parse_init_state CALLDICT // ihr_disabled bounce bounced src to_address money timestamps cs init_state + }>ELSE<{ // ihr_disabled bounce bounced src to_address money timestamps cs + DUP // ihr_disabled bounce bounced src to_address money timestamps cs cs + parse_init_state CALLDICT // ihr_disabled bounce bounced src to_address money timestamps cs init_state + }> + SWAP // ihr_disabled bounce bounced src to_address money timestamps init_state cs + }> // ihr_disabled bounce bounced src to_address money timestamps init_state cs + 1 LDU // ihr_disabled bounce bounced src to_address money timestamps init_state body_flag cs + SWAP // ihr_disabled bounce bounced src to_address money timestamps init_state cs body_flag + 0 EQINT // ihr_disabled bounce bounced src to_address money timestamps init_state cs _66 + IF:<{ // ihr_disabled bounce bounced src to_address money timestamps init_state body + }>ELSE<{ // ihr_disabled bounce bounced src to_address money timestamps init_state cs + LDREF // ihr_disabled bounce bounced src to_address money timestamps init_state _102 _101 + DROP // ihr_disabled bounce bounced src to_address money timestamps init_state _67 + CTOS // ihr_disabled bounce bounced src to_address money timestamps init_state body + }> + 9 TUPLE // _70 + }> + parse_external_message PROC:<{ + // message + CTOS // cs + 2 LDU // msg_info cs + 113 PUSHINT // msg_info cs _7 + s2 PUSH // msg_info cs _7 msg_info + 2 NEQINT // msg_info cs _7 _9 + s3 PUSH // msg_info cs _7 _9 msg_info + 3 NEQINT // msg_info cs _7 _9 _11 + AND // msg_info cs _7 _12 + THROWANYIF + LDMSGADDR // msg_info src cs + LDMSGADDR // msg_info src to_address cs + 0 PUSHINT // msg_info src to_address cs import_fee=0 + s0 s4 PUXC // timestamps=0 src to_address cs import_fee=0 msg_info + 2 EQINT // timestamps=0 src to_address cs import_fee=0 _25 + IF:<{ // timestamps=0 src to_address cs import_fee=0 + DROP // timestamps=0 src to_address cs + LDGRAMS // timestamps=0 src to_address import_fee cs + }>ELSE<{ // timestamps=0 src to_address cs import_fee=0 + s4 POP // import_fee=0 src to_address cs + 96 LDU // import_fee=0 src to_address timestamps cs + s1 s4 XCHG // timestamps src to_address import_fee cs + }> + 1 LDU // timestamps src to_address import_fee maybe_init_state cs + NIL // timestamps src to_address import_fee maybe_init_state cs init_state + s0 s2 XCHG // timestamps src to_address import_fee init_state cs maybe_init_state + 1 EQINT // timestamps src to_address import_fee init_state cs _38 + IF:<{ // timestamps src to_address import_fee init_state cs + NIP // timestamps src to_address import_fee cs + DUP // timestamps src to_address import_fee cs cs + parse_init_state CALLDICT // timestamps src to_address import_fee cs init_state + SWAP // timestamps src to_address import_fee init_state cs + }> // timestamps src to_address import_fee init_state cs + 1 LDU // timestamps src to_address import_fee init_state body_flag cs + SWAP // timestamps src to_address import_fee init_state cs body_flag + 0 EQINT // timestamps src to_address import_fee init_state cs _47 + IF:<{ // timestamps src to_address import_fee init_state body + }>ELSE<{ // timestamps src to_address import_fee init_state cs + LDREF // timestamps src to_address import_fee init_state _67 _66 + DROP // timestamps src to_address import_fee init_state _48 + CTOS // timestamps src to_address import_fee init_state body + }> + s4 s5 XCHG + s3 s4 XCHG + s2 s3 XCHG // src to_address import_fee timestamps init_state body + 6 TUPLE // _51 + }> + init_environment PROC:<{ + // + PUSHNULL // _0 + NEWC // _0 _1 + STDICT // _2 + ENDC // _3 + c4 POP + }> + storage_key PROC:<{ + // tag + 2824609491042946229920590003095732224 PUSHINTX // tag _3 + SWAP // _3 tag + ADD // _4 + }> + load_storage_with_tag PROC:<{ + // tag + storage_key CALLDICT // _1 + c4 PUSH // _1 _2 + CTOS // _1 _3 + PLDDICT // _1 _4 + 8 PUSHPOW2 // _1 _4 _5=256 + DICTIGETOPTREF // _6 + }> + save_storage_with_tag PROC:<{ + // tag storage + c4 PUSH // tag storage _3 + CTOS // tag storage _4 + PLDDICT // tag storage dict + s0 s2 XCHG // dict storage tag + storage_key CALLDICT // dict storage _7 + ROT + 8 PUSHPOW2 // storage _7 dict _8=256 + DICTISETREF // dict + NEWC // dict _10 + STDICT // _11 + ENDC // _12 + c4 POP + }> + get_c7 PROCINLINE:<{ + // + 124711402 PUSHINT // _2=124711402 + 0 PUSHINT // _2=124711402 _3=0 + DUP // _2=124711402 _3=0 _4=0 + NOW // _2=124711402 _3=0 _4=0 _5 + 1 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 + DUP // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 + 239 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 + 1000000000 PUSHINT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _10=1000000000 + PUSHNULL // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _10=1000000000 _11 + PAIR // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 + MYADDR // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 _13 + CONFIGROOT // _2=124711402 _3=0 _4=0 _5 _6=1 _7=1 _8=239 _12 _13 _14 + 10 TUPLE // _15 + SINGLE // _16 + }> + invoke_method PROC:<{ + // fun args + { + c7 PUSH DUP FIRST + GASLIMITSTEMP SWAP DROP + 11 SETINDEX 0 SETINDEX c7 POP + } : save-gas-remaining + { + GASLIMITSTEMP SWAP DROP + 11 GETPARAM SWAP SUB + 145 PUSHINT SUB + } : compute-gas-used + NEWC ENDC c5 POP + RESETLOADEDCELLS + 255 PUSHINT EXPLODEVAR + DUP INC ROLLX + <{ + <{ + save-gas-remaining + EXECUTE + compute-gas-used + DEPTH DEC ROLLREVX + DEPTH DEC TUPLEVAR + ZERO ROTREV + }> PUSHCONT + <{ + compute-gas-used + ROT DROP NIL + }> PUSHCONT + TRY + }> PUSHCONT + ROT INC -1 PUSHINT + CALLXVARARGS // exit_code gas_used return_values + s2 PUSH // exit_code gas_used return_values exit_code + 0 NEQINT // exit_code gas_used return_values _7 + s3 PUSH // exit_code gas_used return_values _7 exit_code + 1 NEQINT // exit_code gas_used return_values _7 _9 + AND // exit_code gas_used return_values _10 + s1 s3 XCHG // return_values gas_used exit_code _10 + THROWANYIF + SWAP // gas_used return_values + }> + invoke_method_expect_fail PROC:<{ + // fun args + { + c7 PUSH DUP FIRST + GASLIMITSTEMP SWAP DROP + 11 SETINDEX 0 SETINDEX c7 POP + } : save-gas-remaining + { + GASLIMITSTEMP SWAP DROP + 11 GETPARAM SWAP SUB + 145 PUSHINT SUB + } : compute-gas-used + NEWC ENDC c5 POP + RESETLOADEDCELLS + 255 PUSHINT EXPLODEVAR + DUP INC ROLLX + <{ + <{ + save-gas-remaining + EXECUTE + compute-gas-used + DEPTH DEC ROLLREVX + DEPTH DEC TUPLEVAR + ZERO ROTREV + }> PUSHCONT + <{ + compute-gas-used + ROT DROP NIL + }> PUSHCONT + TRY + }> PUSHCONT + ROT INC -1 PUSHINT + CALLXVARARGS // _13 _14 _15 + DROP // exit_code gas_used + OVER // exit_code gas_used exit_code + 0 EQINT // exit_code gas_used _8 + s0 s2 XCHG // _8 gas_used exit_code + 1 EQINT // _8 gas_used _10 + s1 s2 XCHG // gas_used _8 _10 + OR // gas_used _11 + 201 THROWIF + }> + assert_no_actions PROCINLINE:<{ + // + c5 PUSH CTOS // _1 + SEMPTY // _2 + NOT // _3 + 202 THROWIF + }> + token_snake_len PROCINLINE:<{ + // content + 0 PUSHINT // content len=0 + WHILE:<{ + OVER // content len content + ISNULL // content len _3 + NOT // content len _4 + }>DO<{ // content len + OVER // content len content + SBITS // content len _5 + ADD // content len + OVER // content len content + SREFS // content len _7 + IF:<{ // content len + SWAP // len content + LDREF // len _14 _13 + DROP // len _9 + CTOS // len _8 + }>ELSE<{ // content len + NIP // len + PUSHNULL // len _8 + }> // len content + SWAP // content len + }> // content len + NIP // len + }> + get_snake_tail PROCINLINE:<{ + // tail + WHILE:<{ + DUP // tail tail + ISNULL // tail _1 + NOT // tail _2 + }>DO<{ // tail + CTOS // tail_slice + DUP // tail_slice tail_slice + SREFS // tail_slice _5 + IF:<{ // tail_slice + LDREF // _11 _10 + DROP // _6 + }>ELSE<{ // tail_slice + DROP // + PUSHNULL // _6 + }> // tail + }> // tail + }> + snake_concat PROC:<{ + // head tail + SWAP // tail head + CTOS // tail head_sl + NEWC // tail head_sl _5 + OVER // tail head_sl _5 head_sl + SBITS // tail head_sl _5 _7 + s1 s2 XCHG // tail _5 head_sl _7 + LDSLICEX // tail _5 _6 head_sl + -ROT // tail head_sl _5 _6 + STSLICER // tail head_sl snake + OVER // tail head_sl snake head_sl + SREFS // tail head_sl snake _10 + IF:<{ // tail head_sl snake + SWAP // tail snake head_sl + LDREF // tail snake _20 _19 + DROP // tail snake _11 + ROT // snake _11 tail + snake_concat CALLDICT // snake _13 + SWAP // _13 snake + STREF // snake + }>ELSE<{ // tail head_sl snake + NIP // tail snake + STREF // snake + }> + ENDC // _16 + }> + snake_concat_tagged PROCINLINE:<{ + // tag head tail + OVER // tag head tail head + CTOS // tag head tail head_sl + s0 s3 XCHG + NEWC // head_sl head tail tag _6 + 8 STU // head_sl head tail snake + 1015 PUSHINT // head_sl head tail snake lbits + s4 PUSH // head_sl head tail snake lbits head_sl + SBITS // head_sl head tail snake lbits _15 + SWAP // head_sl head tail snake _15 lbits + GREATER // head_sl head tail snake _16 + IF:<{ // head_sl head tail snake + s3 POP // snake head tail + snake_concat CALLDICT // snake _17 + SWAP // _17 snake + STREF // _18 + ENDC // tagged + }>ELSE<{ // head_sl head tail snake + s2 POP // head_sl snake tail + s0 s2 XCHG // tail snake head_sl + STSLICER // tail _20 + ENDC // tail _21 + SWAP // _21 tail + snake_concat CALLDICT // tagged + }> + }> + snake_equal? PROCINLINE:<{ + // snake1 snake2 + TRUE // snake1 snake2 equal + UNTIL:<{ + s2 PUSH // snake1 snake2 equal snake1 + SBITS // snake1 snake2 equal s1_data + s2 PUSH // snake1 snake2 equal s1_data snake2 + SBITS // snake1 snake2 equal s1_data s2_data + 2DUP // snake1 snake2 equal s1_data s2_data s1_data s2_data + LEQ // snake1 snake2 equal s1_data s2_data _8 + IF:<{ // snake1 snake2 equal s1_data s2_data + OVER // snake1 snake2 equal s1_data s2_data s1_data + 0 GTINT // snake1 snake2 equal s1_data s2_data _10 + IF:<{ // snake1 snake2 equal s1_data s2_data + s2 POP // snake1 snake2 s2_data s1_data + s2 s2 XCPU // snake1 s1_data s2_data snake2 s1_data + LDSLICEX // snake1 s1_data s2_data _11 snake2 + s4 s1 PUXC // snake1 s1_data s2_data snake2 snake1 _11 + SDEQ // snake1 s1_data s2_data snake2 equal + 2SWAP // snake1 snake2 equal s1_data s2_data + }> // snake1 snake2 equal s1_data s2_data + s4 PUSH // snake1 snake2 equal s1_data s2_data snake1 + SREFS // snake1 snake2 equal s1_data s2_data _14 + IF:<{ // snake1 snake2 equal s1_data s2_data + s0 s4 XCHG // s2_data snake2 equal s1_data snake1 + LDREF // s2_data snake2 equal s1_data _48 _47 + DROP // s2_data snake2 equal s1_data _16 + CTOS // s2_data snake2 equal s1_data _15 + }>ELSE<{ // snake1 snake2 equal s1_data s2_data + s4 POP // s2_data snake2 equal s1_data + PUSHNULL // s2_data snake2 equal s1_data _15 + }> // s2_data snake2 equal s1_data snake1 + DUP // s2_data snake2 equal s1_data snake1 snake1 + ISNULL // s2_data snake2 equal s1_data snake1 _20 + s5 PUSH // s2_data snake2 equal s1_data snake1 _20 s2_data + AND // s2_data snake2 equal s1_data snake1 _21 + s2 PUSH // s2_data snake2 equal s1_data snake1 _21 s1_data + GREATER // s2_data snake2 equal s1_data snake1 _22 + IF:<{ // s2_data snake2 equal s1_data snake1 + s4 POP + 2DROP // snake1 snake2 + FALSE // snake1 snake2 equal + }>ELSE<{ // s2_data snake2 equal s1_data snake1 + s4 s4 XCHG2 // snake1 snake2 equal s2_data s1_data + EQUAL // snake1 snake2 equal _24 + IF:<{ // snake1 snake2 equal + OVER // snake1 snake2 equal snake2 + SREFS // snake1 snake2 equal _25 + IF:<{ // snake1 snake2 equal + SWAP // snake1 equal snake2 + LDREF // snake1 equal _50 _49 + DROP // snake1 equal _27 + CTOS // snake1 equal _26 + }>ELSE<{ // snake1 snake2 equal + NIP // snake1 equal + PUSHNULL // snake1 equal _26 + }> // snake1 equal snake2 + SWAP // snake1 snake2 equal + }> // snake1 snake2 equal + }> + }>ELSE<{ // snake1 snake2 equal s1_data s2_data + 2 1 BLKDROP2 // snake1 snake2 s2_data + s1 s2 XCHG // snake2 snake1 s2_data + LDSLICEX // snake2 _31 snake1 + s2 s1 PUXC // snake2 snake1 snake2 _31 + SDEQ // snake2 snake1 equal + s2 PUSH // snake2 snake1 equal snake2 + SREFS // snake2 snake1 equal _34 + IF:<{ // snake2 snake1 equal + s0 s2 XCHG // equal snake1 snake2 + LDREF // equal snake1 _54 _53 + DROP // equal snake1 _36 + CTOS // equal snake1 _35 + }>ELSE<{ // snake2 snake1 equal + s2 POP // equal snake1 + PUSHNULL // equal snake1 _35 + }> // equal snake1 snake2 + ROT // snake1 snake2 equal + }> + DUP // snake1 snake2 equal equal + NOT // snake1 snake2 equal _40 + s3 PUSH // snake1 snake2 equal _40 snake1 + ISNULL // snake1 snake2 equal _40 _41 + s3 PUSH // snake1 snake2 equal _40 _41 snake2 + ISNULL // snake1 snake2 equal _40 _41 _42 + AND // snake1 snake2 equal _40 _43 + OR // snake1 snake2 equal _44 + }> // snake1 snake2 equal + 2 1 BLKDROP2 // equal + }> + calc_storage_fee_raw PROCINLINE:<{ + // cells bits time + 0 PUSHINT // cells bits time _5=0 + 18 PUSHINT // cells bits time _5=0 _6=18 + CONFIGOPTPARAM // cells bits time _5=0 _7 + 32 PUSHINT // cells bits time _5=0 _7 _8=32 + DICTIGET + NULLSWAPIFNOT // cells bits time _26 _27 + DROP // cells bits time prices + 168 PUSHINT // cells bits time prices _11=168 + SDSKIPFIRST // cells bits time prices + 64 LDU // cells bits time _14 prices + s0 s3 XCHG // cells prices time _14 bits + MUL // cells prices time base_fee + s0 s2 XCHG // cells base_fee time prices + 64 LDU // cells base_fee time _31 _30 + DROP // cells base_fee time _18 + s0 s3 XCHG2 // time base_fee _18 cells + MUL // time base_fee _21 + ADD // time base_fee + SWAP // base_fee time + MUL // _23 + 16 RSHIFT# // _25 + }> + calc_storage_fee PROCINLINE:<{ + // in time + SWAP + 100000 PUSHINT // time in _5=100000 + CDATASIZE // time _8 _9 _10 + DROP // time cells bits + ROT // cells bits time + calc_storage_fee_raw INLINECALLDICT // _7 + }> + load_contract PROCINLINE:<{ + // + c4 PUSH // _1 + CTOS // ds + 64 LDU // uid ds + LDDICT // uid plugins ds + LDDICT // uid plugins _12 ds + SWAP // uid plugins ds _12 + plugins_storage SETGLOB + 32 LDU // uid plugins key_type ds + }> + save_contract PROCINLINE:<{ + // uid plugins key_type key + plugins_storage GETGLOB // uid plugins key_type key _4 + s0 s4 XCHG + NEWC // _4 plugins key_type key uid _5 + 64 STU // _4 plugins key_type key _7 + s1 s3 XCHG // _4 key key_type plugins _7 + STDICT // _4 key key_type _8 + s1 s3 XCHG // key_type key _4 _8 + STDICT // key_type key _9 + s1 s2 XCHG // key key_type _9 + 32 STU // key _11 + SWAP // _11 key + STSLICER // _12 + ENDC // _13 + c4 POP + }> + seqno PROC:<{ + // + load_contract INLINECALLDICT // _5 _6 _7 _8 + 3 BLKDROP // uid + }> + get_public_key PROC:<{ + // + load_contract INLINECALLDICT // _5 _6 _7 _8 + s3 POP + NIP // key key_type + }> + is_plugin_installed PROC:<{ + // hash + load_contract INLINECALLDICT // hash _10 _11 _12 _13 + s2 s3 XCHG + 3 BLKDROP // hash plugins + 8 PUSHPOW2 // hash plugins _8=256 + DICTUGETREF // _14 _15 + NIP // found + }> + get_plugin_cell PROC:<{ + // hash + load_contract INLINECALLDICT // hash _10 _11 _12 _13 + s2 s3 XCHG + 3 BLKDROP // hash plugins + 8 PUSHPOW2 // hash plugins _8=256 + DICTUGETREF // _14 _15 + DROP // plugin + }> + get_plugin_storage PROC:<{ + // hash + load_contract INLINECALLDICT // hash _7 _8 _9 _10 + 4 BLKDROP // hash + plugins_storage GETGLOB // hash _4 + 8 PUSHPOW2 // hash _4 _5=256 + DICTUGETREF // _11 _12 + DROP // plugin_data + }> + resolve_plugin PROC:<{ + // hash + load_contract INLINECALLDICT // hash _11 _12 _13 _14 + s2 s3 XCHG + 3 BLKDROP // hash plugins + 8 PUSHPOW2 // hash plugins _8=256 + DICTUGETREF // _15 _16 + DROP // plugin + CTOS // _10 + }> + get_plugin_list PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _16 _17 _18 _19 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _23 _25 _24 _26 + DROP + NIP // list plugins hash + ROT // plugins hash list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + get_plugin_list_with_cell PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _18 _19 _20 _21 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _25 _27 _26 _28 + DROP // list plugins plugin hash + SWAP // list plugins hash plugin + PLDREF // list plugins hash _15 + PAIR // list plugins _16 + ROT // plugins _16 list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + get_plugin_list_resolved PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _19 _20 _21 _22 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _26 _28 _27 _29 + DROP // list plugins plugin hash + SWAP // list plugins hash plugin + PLDREF // list plugins hash _15 + CTOS // list plugins hash _16 + PAIR // list plugins _17 + ROT // plugins _17 list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + get_plugin_list_resolved_with_storage PROC:<{ + // + NIL // list + load_contract INLINECALLDICT // list _24 _25 _26 _27 + s2 s3 XCHG + 3 BLKDROP // list plugins + WHILE:<{ + DUP // list plugins plugins + ISNULL // list plugins _7 + NOT // list plugins _8 + }>DO<{ // list plugins + 8 PUSHPOW2 // list plugins _13=256 + DICTUREMMIN + NULLSWAPIFNOT2 // list _31 _33 _32 _34 + DROP // list plugins plugin hash + plugins_storage GETGLOB // list plugins plugin hash _17 + s1 s(-1) PUXC + 8 PUSHPOW2 // list plugins plugin hash hash _17 _18=256 + DICTUGETREF // list plugins plugin hash _35 _36 + DROP // list plugins plugin hash data + s0 s2 XCHG // list plugins data hash plugin + PLDREF // list plugins data hash _20 + CTOS // list plugins data hash _21 + ROT // list plugins hash _21 data + TRIPLE // list plugins _22 + ROT // plugins _22 list + CONS // plugins list + SWAP // list plugins + }> // list plugins + DROP // list + }> + check_any_signature PROCINLINE:<{ + // in_msg_body key_type key + s0 s2 XCHG // key key_type in_msg_body + LDREF // key key_type request in_msg_body + OVER // key key_type request in_msg_body request + HASHCU // key key_type request in_msg_body request_hash + s3 PUSH + 8445519 PUSHINT // key key_type request in_msg_body request_hash key_type _8=8445519 + EQUAL // key key_type request in_msg_body request_hash _9 + IF:<{ // key key_type request in_msg_body request_hash + s3 POP // key request_hash request in_msg_body + s0 s3 XCHG // in_msg_body request_hash request key + 256 PLDU // in_msg_body request_hash request _12 + s1 s3 XCHG // request request_hash in_msg_body _12 + CHKSIGNU // request _13 + 310 THROWIFNOT + }>ELSE<{ // key key_type request in_msg_body request_hash + s0 s3 XCHG + 1692265451 PUSHINT // key request_hash request in_msg_body key_type _15=1692265451 + EQUAL // key request_hash request in_msg_body _16 + IF:<{ // key request_hash request in_msg_body + s0 s3 XCHG2 // request request_hash in_msg_body key + P256_CHKSIGNU // request _18 + 310 THROWIFNOT + }>ELSE<{ // key request_hash request in_msg_body + s1 s3 XCHG + 3 BLKDROP // request + 311 THROW + }> + }> + }> + uninstall_plugin PROCINLINE:<{ + // plugins plugin_id + s0 s1 PUXC + 8 PUSHPOW2 // plugin_id plugin_id plugins _3=256 + DICTUDEL // plugin_id _10 _11 + DROP // plugin_id plugins + plugins_storage GETGLOB // plugin_id plugins _6 + s1 s2 XCHG + 8 PUSHPOW2 // plugins plugin_id _6 _7=256 + DICTUDEL // plugins _12 _13 + DROP // plugins _9 + plugins_storage SETGLOB + }> + ~do PROC:<{ + // action plugins + SWAP // plugins action + CTOS // plugins action + 32 LDU // plugins op action + OVER + 1055474673 PUSHINT // plugins op action op _8=1055474673 + EQUAL // plugins op action _9 + IF:<{ // plugins op action + NIP // plugins action + LDREF // plugins _10 action + DUP // plugins _10 action action + 8 PLDU // plugins _10 action _13 + s1 s2 XCHG // plugins action _10 _13 + SENDRAWMSG + }>ELSE<{ // plugins op action + OVER + 33210358 PUSHINT // plugins op action op _15=33210358 + EQUAL // plugins op action _16 + IF:<{ // plugins op action + NIP // plugins action + DUP // plugins action action + 256 PLDU // plugins action _18 + s1 s2 XCHG // action plugins _18 + uninstall_plugin INLINECALLDICT // action plugins + }>ELSE<{ // plugins op action + OVER + 2041458079 PUSHINT // plugins op action op _20=2041458079 + EQUAL // plugins op action _21 + IF:<{ // plugins op action + NIP // plugins action + LDREF // plugins plugin action + OVER // plugins plugin action plugin + HASHCU // plugins plugin action plugin_hash + s2 s0 s3 PUXC2 + 8 PUSHPOW2 // action plugin plugin plugin_hash plugins _28=256 + DICTUSETREF // action plugin plugins + 1140839503 PUSHINT // action plugin plugins _30=1140839503 + 24 PUSHINT // action plugin plugins _30=1140839503 _31=24 + NEWC // action plugin plugins _30=1140839503 _31=24 _32 + 6 STU // action plugin plugins _30=1140839503 _34 + x{9FFCA257FD2130F9E1A12835B5DFD3CE4922057EFD623585D454EDA67FC424FE531_} PUSHSLICE // action plugin plugins _30=1140839503 _34 _35 + STSLICER // action plugin plugins _30=1140839503 _36 + 160000000 PUSHINT // action plugin plugins _30=1140839503 _36 _39 + s4 PUSH + 31536000 PUSHINT // action plugin plugins _30=1140839503 _36 _39 plugin _40=31536000 + calc_storage_fee INLINECALLDICT // action plugin plugins _30=1140839503 _36 _39 _41 + ADD // action plugin plugins _30=1140839503 _36 _42 + STVARUINT16 // action plugin plugins _30=1140839503 _43 + 139 STU // action plugin plugins _47 + s1 s2 XCHG // action plugins plugin _47 + STREF // action plugins _48 + ENDC // action plugins _49 + 0 PUSHINT // action plugins _49 _50=0 + SENDRAWMSG + }>ELSE<{ // plugins op action + SWAP + 1762183572 PUSHINT // plugins action op _52=1762183572 + EQUAL // plugins action _53 + IF:<{ // plugins action + LDREF // plugins code action + SWAP // plugins action code + CTOS // plugins action _57 + BLESS // plugins action _58 + NIL // plugins action _58 _59 + 0 PUSHINT // plugins action _58 _59 _60=0 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // plugins action _61 + DROP // plugins action + }>ELSE<{ // plugins action + 303 THROW + }> + SWAP // action plugins + }> + }> + SWAP // plugins action + }> + PLDOPTREF // plugins _64 + SWAP // _64 plugins + }> + main PROC:<{ + // balance msg_value in_msg in_msg_body + DUP // balance msg_value in_msg in_msg_body in_msg_body + SEMPTY // balance msg_value in_msg in_msg_body _4 + IFJMP:<{ // balance msg_value in_msg in_msg_body + 4 BLKDROP // + }> // balance msg_value in_msg in_msg_body + OVER // balance msg_value in_msg in_msg_body in_msg + CTOS // balance msg_value in_msg in_msg_body in_msg_full + 4 LDU // balance msg_value in_msg in_msg_body _7 in_msg_full + SWAP + 1 PUSHINT // balance msg_value in_msg in_msg_body in_msg_full _7 _10=1 + AND // balance msg_value in_msg in_msg_body in_msg_full _11 + IFJMP:<{ // balance msg_value in_msg in_msg_body in_msg_full + 5 BLKDROP // + }> // balance msg_value in_msg in_msg_body in_msg_full + SWAP // balance msg_value in_msg in_msg_full in_msg_body + 32 LDU // balance msg_value in_msg in_msg_full op in_msg_body + OVER + 3288323151 PUSHINT // balance msg_value in_msg in_msg_full op in_msg_body op _16=3288323151 + EQUAL // balance msg_value in_msg in_msg_full op in_msg_body _17 + IF:<{ // balance msg_value in_msg in_msg_full op in_msg_body + NIP + 2 2 BLKDROP2 + s2 POP // in_msg_body in_msg_full + LDMSGADDR // in_msg_body _80 _79 + DROP // in_msg_body _18 + x{9FFCA257FD2130F9E1A12835B5DFD3CE4922057EFD623585D454EDA67FC424FE531_} PUSHSLICE // in_msg_body _18 _20 + SDEQ // in_msg_body _21 + NOT // in_msg_body _22 + IFRETALT + load_contract INLINECALLDICT // in_msg_body uid plugins key_type key + s0 s4 XCHG // key uid plugins key_type in_msg_body + 256 LDU // key uid plugins key_type _86 _85 + DROP // key uid plugins key_type plugin_id + s0 s2 PUSH2 + 8 PUSHPOW2 // key uid plugins key_type plugin_id plugin_id plugins _35=256 + DICTUGETREF // key uid plugins key_type plugin_id _87 _88 + NIP // key uid plugins key_type plugin_id found + NOT // key uid plugins key_type plugin_id _37 + IFRETALT + 2 PUSHINT // key uid plugins key_type plugin_id _40=2 + NEWC // key uid plugins key_type plugin_id _40=2 _41 + 8 STU // key uid plugins key_type plugin_id _43 + s1 s(-1) PUXC // key uid plugins key_type plugin_id plugin_id _43 + 256 STU // key uid plugins key_type plugin_id _45 + ONE ENDXC // key uid plugins key_type plugin_id exotic_plugin + s0 s2 XCHG + 8 PUSHPOW2 + s4 s2 XCHG2 // key uid key_type exotic_plugin _48=256 plugins plugin_id + DICTUSETREF // key uid key_type plugins + s0 s1 s3 XCHG3 // uid plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ // balance msg_value in_msg in_msg_full op in_msg_body + s2 POP // balance msg_value in_msg in_msg_body op + 1154835125 PUSHINT // balance msg_value in_msg in_msg_body op _51=1154835125 + EQUAL // balance msg_value in_msg in_msg_body _52 + IF:<{ // balance msg_value in_msg in_msg_body + load_contract INLINECALLDICT // balance msg_value in_msg in_msg_body uid plugins key_type key + s0 s4 XCHG // balance msg_value in_msg key uid plugins key_type in_msg_body + 256 LDU // balance msg_value in_msg key uid plugins key_type plugin_id in_msg_body + s1 s3 XCPU + 8 PUSHPOW2 // balance msg_value in_msg key uid plugins key_type in_msg_body plugin_id plugins _64=256 + DICTUGETREF // balance msg_value in_msg key uid plugins key_type in_msg_body plugin found + 300 THROWIFNOT + CTOS // balance msg_value in_msg key uid plugins key_type in_msg_body _68 + BLESS // balance msg_value in_msg key uid plugins key_type in_msg_body _69 + s3 s8 XCHG + s7 s6 s6 XCHG3 // plugins key_type _69 key uid balance msg_value in_msg in_msg_body + 4 TUPLE // plugins key_type _69 key uid _71 + s1 s3 XCHG + 121535 PUSHINT // plugins key_type uid key _69 _71 _72=121535 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // plugins key_type uid key _73 + DROP // plugins key_type uid key + s3 s3 s0 XCHG3 // uid plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ + 4 BLKDROP // + }> + }> + }> + recv_external PROC:<{ + // in_msg_body + 32 LDU // op in_msg_body + OVER + 1158237173 PUSHINT // op in_msg_body op _6=1158237173 + EQUAL // op in_msg_body _7 + IF:<{ // op in_msg_body + NIP // in_msg_body + load_contract INLINECALLDICT // in_msg_body uid plugins key_type key + s4 s1 s4 XCPU2 // key uid plugins key_type in_msg_body key_type key + check_any_signature INLINECALLDICT // key uid plugins key_type _14 + CTOS // key uid plugins key_type request + 64 LDU // key uid plugins key_type _17 request + s1 s4 XCPU // key uid plugins key_type request _17 uid + EQUAL // key uid plugins key_type request _20 + 312 THROWIFNOT + s3 PUSH // key uid plugins key_type request uid + INC // key uid plugins key_type request _23 + s3 s2 s5 PUSH3 // key uid plugins key_type request _23 plugins key_type key + save_contract INLINECALLDICT + COMMIT + ACCEPT + PLDOPTREF // key uid plugins key_type action + WHILE:<{ + DUP // key uid plugins key_type action action + ISNULL // key uid plugins key_type action _30 + NOT // key uid plugins key_type action _31 + }>DO<{ // key uid plugins key_type action + ROT // key uid key_type action plugins + ~do CALLDICT // key uid key_type action plugins + -ROT // key uid plugins key_type action + }> // key uid plugins key_type action + DROP // key uid plugins key_type + s0 s2 XCHG // key key_type plugins uid + INC // key key_type plugins _35 + s2 s3 XCHG2 // _35 plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ // op in_msg_body + SWAP + 1154835125 PUSHINT // in_msg_body op _37=1154835125 + EQUAL // in_msg_body _38 + IF:<{ // in_msg_body + load_contract INLINECALLDICT // in_msg_body uid plugins key_type key + s0 s4 XCHG // key uid plugins key_type in_msg_body + 256 LDU // key uid plugins key_type plugin_id in_msg_body + s1 s3 XCPU + 8 PUSHPOW2 // key uid plugins key_type in_msg_body plugin_id plugins _50=256 + DICTUGETREF // key uid plugins key_type in_msg_body plugin found + 300 THROWIFNOT + CTOS // key uid plugins key_type in_msg_body _54 + BLESS // key uid plugins key_type in_msg_body _55 + SWAP // key uid plugins key_type _55 in_msg_body + SINGLE // key uid plugins key_type _55 _57 + 89430 PUSHINT // key uid plugins key_type _55 _57 _58=89430 + TPUSH + DEPTH DEC DEC 30 SETGLOB + 255 PUSHINT EXPLODEVAR + DUP INC + ROLLX + SWAP + TRUE + CALLXVARARGS + DEPTH 30 GETGLOB SUB TUPLEVAR // key uid plugins key_type _59 + DROP // key uid plugins key_type + 3 ROLL // uid plugins key_type key + save_contract INLINECALLDICT + }>ELSE<{ + DROP // + }> + }> + }> + init PROC:<{ + // + 8445519 PUSHINT // _0=8445519 + NEWC // _0=8445519 _1 + 98 STU // _3 + B priv>pub B, b> + init_config PROC:<{ + // + PUSHNULL // config + x{D06600000000000000000000000080000000000000FA00000000000001F4000000000003D0904_} s>c PUSHREF // config _3 + 18 PUSHINT + ROT + 32 PUSHINT // _3 _4=18 config _5=32 + DICTUSETREF // config + c7 PUSHCTR // config _7 + UNSINGLE // config _8 + SWAP + 9 PUSHINT // _8 config _9=9 + SETINDEXVAR // _10 + SINGLE // _11 + c7 POPCTR + }> + __test_void_external PROC:<{ + // + CONT:<{ + recv_external CALLDICT + }> // _0 + NEWC // _0 _2 + ENDC // _0 _3 + CTOS // _0 _4 + SINGLE // _0 _1 + invoke_method_expect_fail CALLDICT // _5 + DROP // + }> + __test_external_noinit PROC:<{ + // + 1158237173 PUSHINT // _1=1158237173 + NEWC // _1=1158237173 _2 + 32 STU // _4 + ENDC // ext + CONT:<{ + recv_external CALLDICT + }> // ext _6 + SWAP // _6 ext + CTOS // _6 _8 + SINGLE // _6 _7 + invoke_method_expect_fail CALLDICT // _9 + DROP // + }> + __test_short_external PROC:<{ + // + init CALLDICT + 1158237173 PUSHINT // _2=1158237173 + NEWC // _2=1158237173 _3 + 32 STU // _5 + ENDC // ext + CONT:<{ + recv_external CALLDICT + }> // ext _7 + SWAP // _7 ext + CTOS // _7 _9 + SINGLE // _7 _8 + invoke_method_expect_fail CALLDICT // _10 + DROP // + }> + __test_short2_external PROC:<{ + // + init CALLDICT + 0 PUSHINT // _2=0 + NEWC // _2=0 _3 + 64 STU // _5 + ENDC // request + 1158237173 PUSHINT // request _8=1158237173 + NEWC // request _8=1158237173 _9 + 32 STU // request _11 + STREF // _12 + ENDC // ext + CONT:<{ + recv_external CALLDICT + }> // ext _14 + SWAP // _14 ext + CTOS // _14 _16 + SINGLE // _14 _15 + invoke_method_expect_fail CALLDICT // _17 + DROP // + }> + __test_accepted_external PROC:<{ + // + init CALLDICT + 0 PUSHINT // _2=0 + NEWC // _2=0 _3 + 65 STU // _5 + ENDC // request + DUP // request request + HASHCU // request _8 + 20230610 PUSHINT // request _8 _9=20230610 + SIGN // request signature + 1158237173 PUSHINT // request signature _12=1158237173 + NEWC // request signature _12=1158237173 _13 + 32 STU // request signature _15 + SWAP // request _15 signature + STSLICER // request _16 + STREF // _17 + ENDC // ext + CONT:<{ + recv_external CALLDICT + }> // ext _19 + SWAP // _19 ext + CTOS // _19 _21 + SINGLE // _19 _20 + invoke_method CALLDICT // _23 _24 + 2DROP // + }> + __test_add_plugin PROC:<{ + // + init CALLDICT + init_config CALLDICT + B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840} + B>boc PUSHREF // _3 + 4082916158 PUSHINT // _3 _6 + NEWC // _3 _6 _7 + 33 STU // _3 _9 + STREF // _10 + ENDC // action + 1 PUSHINT // action _13=1 + NEWC // action _13=1 _14 + 65 STU // action _16 + STREF // _17 + ENDC // request + DUP // request request + HASHCU // request _20 + 20230610 PUSHINT // request _20 _21=20230610 + SIGN // request signature + 1158237173 PUSHINT // request signature _24=1158237173 + NEWC // request signature _24=1158237173 _25 + 32 STU // request signature _27 + SWAP // request _27 signature + STSLICER // request _28 + STREF // _29 + ENDC // ext + CONT:<{ + recv_external CALLDICT + }> // ext _31 + SWAP // _31 ext + CTOS // _31 _33 + SINGLE // _31 _32 + invoke_method CALLDICT // _35 _36 + 2DROP // + }> + __test_transfer PROC:<{ + // + init CALLDICT + init_config CALLDICT + 0 PUSHINT // _3=0 + 96 PUSHINT // _3=0 _6 + NEWC // _3=0 _6 _7 + 8 STU // _3=0 _9 + 1000 PUSHINT // _3=0 _9 _10=1000 + STVARUINT16 // _3=0 _11 + 107 STU // _13 + ENDC // message + 2 PUSHINT // message _18 + 1055474673 PUSHINT // message _18 _19=1055474673 + NEWC // message _18 _19=1055474673 _20 + 32 STU // message _18 _22 + 9 STU // message _24 + STREF // _25 + ENDC // action + 1 PUSHINT // action _28=1 + NEWC // action _28=1 _29 + 65 STU // action _31 + STREF // _32 + ENDC // request + DUP // request request + HASHCU // request _35 + 20230610 PUSHINT // request _35 _36=20230610 + SIGN // request signature + 1158237173 PUSHINT // request signature _39=1158237173 + NEWC // request signature _39=1158237173 _40 + 32 STU // request signature _42 + SWAP // request _42 signature + STSLICER // request _43 + STREF // _44 + ENDC // ext + CONT:<{ + recv_external CALLDICT + }> // ext _46 + SWAP // _46 ext + CTOS // _46 _48 + SINGLE // _46 _47 + invoke_method CALLDICT // _50 _51 + 2DROP // + }> +}END>c diff --git a/fift/block-sigs-raw.txt b/fift/block-sigs-raw.txt new file mode 100644 index 0000000..63de65b --- /dev/null +++ b/fift/block-sigs-raw.txt @@ -0,0 +1,168 @@ +CyM9CFWsk9pxgt2/qTFdU30CBCtwiPewXJuY6bhvdjM= +CTPazfrPNtOl6FbA+qulsN/FVUFGbXth86/4RiMNS3utvqwsAme8oLYNRGWubhid05xv5F+GrCCJc51dBZAaDw== +9mD9jxS9aHcGEwOPwTGobhPbaqciCtVfuox3lgCcRr4= +6p8yjm95L+gQlLsxZaqPHXotfRyR3Ijm7PKwzUv/MFo+okvIqpin0SYveFiBtu9fO1lpjGXEIW4GKgL5Gz5YAg== +bp/IEJpPJuUqlOkT5JF1Mo2lXBWMjJIFJR8Sxs0H7dI= +7LVwCo/+U7L3Cc/OlDx3wOcE5GBaRKh5hlqMdLG9JVuuDvnc3ipMb41y6iM0433wzbD78fshxhODjl+0Ni7GAw== +cEs8Apwt/X7qir/B2TTEVAciditVW7d5U0cR3KID19U= +MWTIpOgyg/qzsWvL6yMxHlIE6WiyHjfHtPqsEt3zQbfD+iv2pHGTUMXm3Ny74XM4lqB9dulcjNWcuVlU9KUVBQ== +XMSAD3CbgGRMM+GDAmbaHjDWkMby0pgOoOqh/D1dmFo= +7rvscOjjijuwm79T2RHeieVJnK4hOlQqDw44/TvTr2MMwOuJdXolXQpy9Vr/IvuhMe7hbi6YtrUL330tXeTDBQ== +G9LyYsZaBVKdI1Qtjl76fZXy7PzmS69lAPXyuNtJ/2E= +s78bJTq4xdfyk76wb5XSwyDHCbkEXiOjMkv1rDtjmn8ywntLHS9hxmaMrf5wxKQ0IwbrLh7X4LA1XO9UQtaGDg== +pluFhuciDQKOBm8uoJBjdHyXV4YIea/490jndZI2qOw= +xFUpCSz2wtL1G8215rRTczCnMLd1HrLbjuQ/N3qg/yw6e1dngYjapfxv9ecWxTJFPxLgPJcmbHzXjvJ78Zu1AA== +JprZPi5ETAj0A5zEjTQp5DvpmI9lYfV6L6rqGI96UuU= +tghq5GwIJEkbPCF8zfN/Qn4fk7emmYKkV4qR7Uy538gK48amSUv0IIX2HS3ViFL+UnBtGwcR5qH2znEYzCxEDA== +ILtAgwFE27eLh9f47hY7xlDnHjB6CrvPWQdpble98Qk= +zwRRUS/hxF7hwaEpp9uv2G2qc+h8V6bDbEG3KsdfSefnm8jlk7d7rTXvHfZdwWvFYigQXmVJEYkKrybbt7AxDw== +zrdLfs98s3rYPulSs1CVybgmt8xDfI3WkU40nj4qVAE= +ueQ3CHsjyd/X/SrbgxcD3KAuI4aSwd+7trJQO46+47vEkndS29DclIwiZSfWfvSmePRn17P50B8fdT+gCBWjDQ== +JH7j54dzQqp9NMTgZDJTIN4cX7FfWA2PidYCRfD3uEM= +Gis6mRb4P/T0X+DFCI8P0U+MQCUY3i8DYFBv4Ox9tatUdbPvmQr24c/7bODB+PeTQMSllPnq69SV0N6mtGJMCA== ++UxbkUw6s0iL+ot5Hs2PaHnX7XPggllOSDFmy8X+bLw= +juwPHL7MiAGKeZNehY2Js5qggTYsV969wyOj3i0jQ2ZUbthZzaBvT/Tvk7y8O1NH1wC/bw3way/zfX5wc2MVDw== +i7gtxKY8UqVj7HCRmstgvyJNhr5KZZgBKWul0maZS2Y= +hoGA7xL8qDixe4pXpR0qOnlycyz+Q98zYEOBbZJc9ZkC16btOsqrdV4lUFLwVcqElcFmaGRP7BGhwL2WLE/pCA== +fWlPDW5zWEvDWlI7kaDTKEEvkOvjie8o2idcLQrXP40= +VVcuENVWPgsfLfxjBv6093ZA3QCwc/snP2B5lMRYeHTh9Qkl95ExaifIg1Ccz69mezMJ8vWDzW/Q9s+c8BsXBQ== +P/3GfeGdkLMaDHfIIfPHnQla8PiCfNPWWg8sOm7B6N8= +WQo0JonfjhD/MIo/7gs9JuIB8Hz4vvFmRItlj+vEGIYEAQ6up5rn7iefVhZXrnMdwRh7ojLRamZ77/YSAt0QBg== +veqmrCGiJnJRSnjwc9C9knIbSoAN0pZgLGETpFhIgTk= +uIRbQ+cKeXF5RXoi62Empgr+34GouuGgwd6dqYcRDRMp2LyZE4Slh/eCD5L31F2qu8I/azi0YvM/lZ3ZHK5gBg== +MDYQQkmK1/GT2Do/1s1Hv77X4BZ/CgIrpKOkaDfQpu8= +kwqcQEce/MCfS2vK0EafXm39QQZYc3iBtH3Z5eB7oYcgnvzYFEK+scL1JILbfx/k4XOt1oBotBhvyXdZAOI8BA== +6dKceVaATKFG3mVdaKh2+E25NqIsa2e/D2ZWbOwLUvw= +KDhrXgT46h+UnPBeJN1Ao4iZMEcayld3WPooPhZ3oo7E7Y4Wr/lFmxI+nuJbIV6bLCiIbG+DQE/WS4PGbaZDCQ== +a6hW5D3KZiRKfphLNTsKnfDA2rRCv90+DwZlnkKnz0o= +T48ZE0/Z7rAM7EW5Fnzifu5yAUgZ0WAb2epUYWCp+niFbHLvD5bys1YElldSxlNDQ7ZAwSKtACZrIkRFUE3pAQ== +cKregPmdgElm5wpp4uwz0TPw0WZiJ9xqlX6uNdQHhYo= +4/kBVmLouiFYBqfmtOjBIj5CRH96MQ/2Q+/d+WZ3zwpzyeR1hOahD2nFKIZEmRc+N9xsrfAL+mkRqTGYvsoYCg== +PwTxyvc0HCK73Y+VGMPEqOjtnkTFMuKEI0IqpVcoT8o= +O3ggdldp08SXE+7DTLF4Zp0u/ImrI3Yr9Oe35zA2EMuG3nYf7ZS1I9EWbWaoHygZiPssiowoxf5uusfD9GqqDA== +WsCEZI2+Z+KAwo3Fm4wOq41pAqN4zOSfU/79r1SowXs= +5b5kxJFCZ/3qy2eCVGgOHWMtwZOxxgeyyck3uw8zNgFZZtuUs8sgW9EW+PyMdU4RrZPLWcJFTVEOcs32PkJ+BA== +EN0n0y9fIwWJs09WEYRM4GmYt484kyU8ara35xU6LaY= +QvLHHT2tdjjRllD6hH+nXcYNiIWsqu+ChzfkkE0jfnrIXEC+1QtD3MWjceiV2eVt3gTjj4SxhJtkSWMW6D63CQ== +Rl21urIEM7hfU7QTn5GDe5BVPfyfT6rsHhz5C7IgVgc= +xVZ5eAzamsLodKKRAvxYxBoAEDMn54mCphIQ4lstOKqPvDJZR2B+NVXXXzbrD/6hpM0snYTsTFcUfnxdiqPFDg== +L4hbJ7TBFlpNQpSdd8sbAIdyBwm1jD+7PgRO26PCVgk= +FcZij2P8pAXhOmMLOso0n7MhI9PaHc4/TplCJdip2/EAjDIrFzYC7PpiYLg5bFZf7fJ8M/PaI65SCwvBB/uvDA== +ikwuA6v+57FnWhdoCsIIv8mbYpXLZTCUf+ZjMZq16OM= +7YPoa3qKmMKDBUrRmlv7s/TXLbzivYs24alwq29luI/5sYfn+G3eA8vWmIKCxRwRYSBQ6caztnAuZjd0CxLeDA== +QgVH/hBUMKLWBPFooCvS77np+aT/RQg/qm1bwINYLIs= +dq+1XoT9eiYbs51op81QboudePJBk+hnpEGn0bOXqR9FsO0/emLjjBS7dnZp/b/O51SG7h3dR1+jjcOgrW/eDg== +3Gjj69Q/EeFKAner4S3QfwsvUzRa1mUhsA4pW/W11T0= +I6lX16WV3bZsDJZb5z4nLcndNj0lvxt38V7c1VyhySwZ8+0ieRiUR8NjsRthr2XHA7d76yIzbdjwnhZA2fZsAw== +ekstDPjwPXBIewcTvO4XF3kHQk/RohNynz+DvCgs1OE= +KkdevWriyUO598GHDLzJJSdUtPSewuRoW3ft6yYX3SfUdk0Ix2JxWpiTRJu2ZVfJnEYUTPLRE1x0DiiRcWw8DQ== +rl2gfF7wCL+tedXvSeFLWjcwJHKJo0XeWrJGlu+tghw= +4nx6OyNupFoddlD6szS+4lJI8aMOAEtWK4+xypsxttpKdepgmm30U9D93GCPV/lzZw4vtBJtawu/0Bs9fnxjCQ== +RiNJVAt9YGi6eHDMjcruVIBBVIp9Y8ZUTSNVNv5APNM= +8/dc8gK84E8Ydz+VMzo34BrzD3jhtXFoCJOzLWu+BSyUxzJd03BcPK98Er2gGAFgyNawy3s1hKJFLz80laK+DQ== +92hg40CnQcAWZPFxUxHqbPU5vhQnRdM2tWv+eIygOVQ= +deQ9B+F5qx7t55yqFuek3cMunPPcSqZFzRy0us6d5SECKWNQHvHMFEJVtMB5JUj5waWZkuheZat6Hvdg24RRBw== +0xMNF8NSKvqg7cLH4qnYm8U41QkoO9zmnNL029H8uE8= +A6eoN/l1txc3EmBLrZ4bJz7aH3bXn7LW/sazk4qoLAOotQpIGo/94ccaf3kLdJ2WfCeNoaFrE5jVDIMeycwWBg== +lcEReRTao0+SxuwIT+wnnKOkpGGSXNuR8ILdSy4oxbg= +s4/xh8b9UhctDXDyAt2wLnZJg82j1lxfVwOOLF1Sy2JcBse5pn6dfSFsDgfdSs4LIQHpOQJKca0lFtGi4cn8Cw== +w9MzCIctk+3y5QiH2HqgVaDGnSP2eu0zec3yJb/Kin4= +lH4nY4B9FrDbARzY0ZepW0RSK0uLppdtWMrLDaV6X78kDEevxHUFS4WDDqcOxEVFzwh0l3t2IOprXI+FzS9QDQ== +VHw1TE2V5HRSpigtOfu370M2WfZuI5HNC/inJ42iLIg= +TXC0joWXW05dcX7N7Wv263K3OACbSZA/AS2MBVoEMcnWdrm1yk4TiDtFyclVSusA+HD56s3ov8w3HK4mYBnKDQ== +4Gmwlbme2SIQhFzpvPkuUMwaFP6L5xvlrzr45bVKtIQ= +Wb6Lea2lBnLck3he7pYVTQKSysgiTYRveq3h7fHA5Dhd3/1LZRUgz0o/nyFFAHDjsE4HhvipVvLi46NHXknrDA== +juG+HxBRK54E0lrs6jlPgw+RqPs7I56bXhMuRG+J2/M= +LCdBFleBxTdm5ioAOAIvtHUisgGglFWIOXj6svMVV115uLZ0beYQ/V0aFwaf0aDb9IEbEIfQgFWmh0eRXZIgBQ== +OroaFyyK/oOL1rMCRP6zwcgFqGQT+4T80hT8EJqHZWo= +AwCLoOPbvBP9AuSd31krrNWnrRa/yPh9e9JpgXaOijRZpGMDukjovJ5wvkCd09KZrW9rCaOOGzXV5pH1/Rq+Bg== +rHNk8OM1ZS7GbOGaEAPDklINnEmxaajqTjQvOzKuP3g= +CjOXzib3j90DeW7NGa7Ef/l4NVxXT82eJUxnkt8Bi5zl/dtRfpIpPwyNn7A1NML13iHR3kACK/Zyj0IlguseBA== +OvQ1bRiDV/8CKDG2HSESgbyw01g49FdL2NnlwPjax2k= +ok2U3c8Ki8x6zV09UyECE1DRJwHYMjp79/rpc7SpiuOOge87qz08uqcyL8YFhy/5PzrGJK8arrzICaRfelbXDg== +78gzUTU8Q587BfFm/YLtVZBKRt6pI/3WskM4zUK9KMY= +Xv3H3XMD6R2BbWGyr7iKYhVAg7n4v92ByJ7T2wUBatxYj+0V24qyzOygT1M9mn8Ch2JMe2DyNYroB4pv3RC8Ag== +l3LPbUj8RJGYQjk+PHvR26tEKjviBJbjcGrmyLYQ0A4= ++92VUta7wdhm7UYy7GxIQFUB3z9W0qD9op69rm2edPlv25LlaDqyJ7+lY3hppsB54cEwSkP7c+lAFUn9XE12Bg== +HsDyZLsLETluM3SWPXlvERUNQkwDAPpx+qL7wlOcB30= +3qZW4V8KeGgJlzSJ8jfK5qdh6m0o+OIiIRbHyDVSxY+NphYgJVPzfv5WIKxAZrDCJ5nplw72VXZgC8tVOWY9Dw== +jYzh7u6MMC9pinDbYb6oSBjvT8oPDK9Gs+gt/9w6Kcs= +LrMH6NUM5eZCIvvf/LTCQ6DeXx1vD3C+z5KtU2oMmpr7StiHsxfnFKjdAE7M1RzKXuxF+D+YCsf0X7DtZxeKDA== +k5DPVXYA5Wti7vXm8BtPlQCiIxVqqXJyIzw5Vje6yD0= +dtYCJoUbiZyMSLh9YWUaTrCx7oO0IbGOjeJoHGASkSg3CPDGAXX75R2hGOkF+dP6BqHvy2p10NFvuzkR9zpaCg== +rEthxtUWq1KSfCwGILbblg52aoId9tTUqQI+Sj11R6E= +AM1gujXl3UDpC8SmVqH9DQxyRxMCS3HlGshloOzUafHe8/R2l1NVfF9YcTAoHLX7nwGKCs/6EFmw2ovgTvDUCg== +4riBnCM0ynzNXDgbZRkyA9LVNSWlHn9oV+wghLRh2jw= +ozA7t9ZwNPyEps4XTJfimA2OcYLmMnjm704eFiseJWi4/eX9awPfMZYPRaBGhObO1FLANdjf/Z/qjxHWma2kCw== +rWCuyOUSneH6dC3nkOAHgn3NW/jVmXdt156gv//O2qo= +4MRDsFerhfzbr59SyZ9Ga3qS6vh6CNUL3ns5GLrxwIEJuBXo6B7WZEmOZ6M6dIkpBHrq519IPdjXbsr9crbQBw== +FSYhSKI/qnNNRRlWe5j4M8PGgnWuZQbSAS3iwh5kVDo= +q/ZJOe8xV0/uJRIk06Je29uFhoVrU9fzczlWk7Y0Cs+0MvuyMLytR1sse1OyB2FZKQfmvfaLnFsy5Xay3OpDDg== +j0M5fC177jrTzbP/1DuULcYltSZLyb9xMYNEYu7USY8= +sQVnAaPO/vOvRe6ZEpI2HsnSkQM3w5ERzH5muJG0rroqDvPggWFfYP0CXYudYHbWGtGzLqvMxSRqwBy4jvBqDQ== +lzZrarP87NnaF9bogxEvPeKlIFAGUUM+hkG4om5lVJc= +gCr6D4aipWew8ZvS04AQyzjQYmvYhXLSG2jBpu0X8Hn7BeBzvyiyeCpqWtW9aQac+cGqomk9K41Iowys/fmyDw== +UtlaPS4Ziq3qe+engnJ7UrKcTrA6rDYyrzw0y8ewMgg= +84t/X26SSNusIW0Fy9T0B4YjSN7eF9q08+/f1Q6EFPJfnlU9gaZqJvqvyUACaRCH/HYkfWW3Kb1nv2q5cAvFCg== +F5aA66TYMFy55TTdqrNlefhId0uWOJf8v7jFEhKtEjQ= +H1LWsBpRC0P6h6wK2fBxtrYhC+TUbNsK3jT3IiC+14pQXczGjIXdHnFY4e5ltX+cueH6RYxwK/5iicwM3LewCQ== +7TeBMHi1ss+v+pd9hwb2LX0EM9QIXcG7+pYgBSkhj2E= +iiN7hd+kMEg/tFi9ylO8z5vhuU/zP/IpfMSq6nZ8rlqJjK/VeuBtOAyyCCQtuO3OpaxiStI4A3BvdRSA/FQTCw== +K3nQExZTWMlaFqJlbJmWEZfHCkJmmFaqv45mUXfE7CM= +tBFZd43PpXUOQPZKYYyiG4XEbEMuDdqmY6TUdVDhiTZ7LTZbYFkoslVaiOJ0OADkJvFvkUkX/w9eC3PWVckKBw== +FbL4s2TnSdq/VVsr7Lp60My607xDItbN/LIDrZ9Skmc= +BInbuubfs7LtDpxmUcUprpV6GlZ5Nymtj/oTfZ5VwNkx9aY97rrdUIfgtUlByXoi2QB6Q43mv/QEYRA4rnyhBg== +2poJf+YnHQ1k6eDLOwNmymPcrDoaMUNAXNXZQ3SrrHk= +3sPfkwga3i3m7RYj7oDY4+Mro0m/xHbld9+m6BFXkmGetYgnMSXOavx8ISTHQRGcWLi8lG3kIjswiD7jK9rWAA== +jXQ7nszs4S2QZhkJkId7zB6JUk3bKV3+TbGUI8fOPqE= +gydwIF5cfB+xs2bYEIniSKK7ZcUwF7Vp/MzZehCaEefecS8MCIq490Zl/Pj+k8Dq/UhKslI0Uz2pAA3rvQxOBQ== +O8hrrtTdg0mhvQ4p/vNgOsw4WVKGoSdeg5OZJqz9PLc= ++VEhH0Ch2FKA7O0FZ0jnnSxY8Lpz+/R2kavV9o4I9m2+q76YcYHWiWmcr9Q+8stIN0y+IFOWI6D4k2IMvYKyCA== +lTpQOhrk8ttpN6Z16/gjHNhW70HUM1WYlAKzYkW4WY8= +2+Pzh4uP/01+9h2fTyhubk4RTW+ovh0TKQHpUEU9/bvytRchPYrW4ohWDp8Y1Z/uB2rE8Xn+/6fI53t0eS0gCw== +B6m67Xyck/RzPyuEfpesbvSZjpIVsd6rpXrq47duoHQ= +lSRiRqvL6FeH5IC7dg5btE8co6zG7diVmQpSeukQsEveN5reQ8mb+XK15hYcDX2CgQufAzhOYvjNlqCAHumCCA== +RcY3glk1R5LcVcELsmiIBVJWT8YRav3nkLGE4ekXEKA= +j9y4Qml7rncvKEpt9u9hOESSW0eCW4irra4x2au2e0tsSUgpX49NTQ5avUxj0kd+nHw3sS7wN35ieh5cc7abAQ== +ffgq+v7LE/9V+oWpQc1blgoZ13vmfS+bkT1sanqMTVc= +0XiKQp6IxWdjSBOPcbMeU26IQiu+giJJ3ttipp4TdLmZJ/qjmZCX7fHKQSLO350N6YoN968mtQgSPAYJgl63Ag== +dN23THVWNPtBov4bVpRTgzocZlaqAQVZLoTLDsQDUVY= +JARj0YZyKMpMN0C7tw3aLKCi47bF41evgILqJW9BAuOwXmppFzDvzfCDv1q3kBsloNZn+tnn5M97cb8KssNqDA== ++sk9c8mIg0n4rJzHMHN+cJeOMh4UN0HcWSjPTxGgz1s= +r9jQngxsByEUgRmhswbkWj7M7bkPHEfUG8cC+CHf2DS/iSXXOf9z3gc+K5P63s89iQozW3oLYmc7/Grb9ZldAA== +nWZJNDgHt6lrBjXbVOJoJKwkGV3bMTspI7s+MnNdXAk= +wqddPC1NbI1eU04tnE0CixlpTpGVNsIXDqL46LTLZV/bKbFkOmtjHG4h387jxae1tVjWWt6e/zXOv82hHEibAg== ++sK96qZKNoA3OPa2YNbnVavaxk0JijnkpSQQ1FTrOBc= +HuakSrpxT7crSjk5kZPoeen2wy4GythDia2gnYtfdkRy23wZMQB1CUEFg+CnG+twz2VkdxuIAsDCWm27JsiHDA== +FjKVeFhMplececmoREXeoIH2Eq1UXtycw+uFeqol81Q= +RuRDZsdLN0trGdRUjiSYgwXsejOC2c+8AxY1D7iapcNdOOTgLoa4lJTkEV3xHZBY+b0zj5tOiavDclU3j/VJAg== +GHe0p6zV04lwt31MbUZQUin1zdga2N3cY6JeyKIcT1g= +MpmJCjIyEDuuRJ4MimK545K2VYkcTp5SB//95ARC37hAMv3nPnFHr5gWEV7cPtSyfIPM/AGj4OjJWSM4BcpoDg== +DH3WyePdtzp4ayJioFpwXdXU8kM0uarIC3R+CBOv+r0= +bI6LckUHD+LF4t/N1RYl+8Ly1cADqzAB3ASeRhqQ/iJVMFSkzJRht5LMCDncB5ERvPJ+rgwXHeeppt192s7/Bg== +scI5HOizPwsgPrvCuto3kNh1jgoG3JiqVp110LDkiA4= +MABuQsmLKhNYMvdTVgBMrbDoVvQBg9XC5lQTftZluqGq8FwdauwcB3UK55W9sUT38e6xodLrWogjCEoa7n28Cg== +LdCbG4Xe0+gkLdAEyuSusmKeTq6+Msiu6YaPBf5XFjQ= +UB8JjCAPDITcxrWdAQwcmbCqSoK9emeJUc0N+FJ6eiIaxm1XaAqUuotY4Oh1roiYJFRULcMdnErBXhokDVJbDQ== +TELBhJYd14VJNHBeNSWx2Opw3uDqnkQXkkaUkzv86hw= +tGfAbFx99l3hEStEyklLwZ6XoIMa2EOHgM1mHJwgEZIoezZhE0r+U/60df53wPmO9WddNFqp3h44woTioru8Aw== +cQMhQu5I3B7fR7O194Y0W6P8+wHUrgXHzofzxUXfDd0= +g8Hn83RsIkyvhNPwbLrPRFyLH7fjuaJ1Hm9+0bRbNITUBZI+8PTbUkYAgPVZFXKsCOnm7mfeXrCM8VraPTjHDA== +aHm+IB+8Dd5iAFypUTKetadoNcJZyJQzd68CJlIema8= +yW4wrVaM6qH9IRD0do4p0x/ok8EBLqky0770sD05djpy8TUzWQ2HRsw6EbZ9ac1h/IAtmXi3YYLfjJmS+LqiCw== +c1CJE5OpNn4TCOqOmbnlX0T95ywO1/L2VXzX6IL+1lU= +4JtoTWcnOzs+RZuqp1ALEJ439swIY90ArXJgOiBuo9LzEHaQAFHmGC9+y5uetxA+yA/7bpRtGq/p6TZgJi1aBA== +B+EcELk0KqRBpX+7/SUUxPB2+YtfgTtyHL5PWgN/dvs= +IWZqTMySUbzWFGlaww/QRfGx34Dm9bDZO14HOKi5v/t4UTeavNQ/mpoD8E7gNtThkR+24HN+uiQ7UC+qa+hbBQ== +LblhQquT3fbGUgEo/Iub1jdZxUsj37EgJgUoaUOZLi0= +yevOs1vNcS9rrSdqWuVllUpa4/KWAAnl8Jl3Ubml7WzFLVCfSr3t+9s8nm8iy9Bm08djlO3XnhqrYI1saWtADg== +hzv/rR8A1xwOODlPYR0KM/FQ324G1/lKJWFATAemqxs= +h+MGGJSDe1Bx0ascGGx0JdXb2PpUSNGo1nWyIH81x4Hi0PVAnmUSFUQ9WPhvpINmU0+Xh8hhqJlMC3xSYgfeCA== +HKB6fCaS3f4wvnFxZh7A4izIQEAp0xgbTnLjYIa+lVU= +8A2bDCXNnKTBtIkFCvbFsjtUT0IiTnjtbjkzCB/GUHZzBZv3ifB7h8SGYeLKDYziNNnPm+/dyJbBQsF9Af1sBQ== +dj8vSiEhIzy7UnH860UoGl1Sq3XvJhcPLoYCtDMox2U= +oEcIo51MQH1qCzEWKWQqflR3B1hONkV7EKXsNBXkj/hZ0HjXZclhLw9LFB+CdfNtV9EYdjfcTurirMtpwkTICQ== +X7ZHZDF9X6yLJsTIgOUy3qFjuc9UvS6RklsVeT0w22o= +kcDAMN4wo4acKwDhqg+FH5OaQW8c4cA5W7mDGme/xFQboJt/VSsitAwd9IelzWFWsaOuGuR3KYMMq9pQ8yKDBw== +KnFTMVeUhUqH+WpCaL1OS5d/1sSPcYlqHFKtLDoHm6I= +SvWlDCnJubkSLkZpuT95Obh3KPZUrdC2cNYY8sozRc80FkYi5UaHsHRzqQZTOGcAH6mDcPAPOhqBsuygDxc8CA== diff --git a/fift/config-validators.boc b/fift/config-validators.boc new file mode 100644 index 0000000000000000000000000000000000000000..2fe0d09360d44110beaef22f6d93be1af00e17a5 GIT binary patch literal 20136 zcmX_{bx@Sw--e%s1*8!WrIC>CkY)+#ZlpV;TXN}cq`SMj8%Yr)l@^o`L=Xgt_q)Ek zKmNIf8RmZO&vnioW@pc~p5(YnAc1B95CABr0sx2^-`w?vz})SI0Qd%2;6D8Oi5>tz zNJ#GiBmfx+LD!TrQL8 zd;f?FOT9%l;a)6&=LNsnrE43Ci5Fqa`!<>stk@=5$Ry!Qa}&(1)aUFR=Kfz^DCotn z&1V6-5E|pxQ6BBsDI9H|>)ecPh57KZTRA1G2YJ@;jSzVaU}blDJ(5t#H@|SrTw6)f z1vt95-2!K3c2D=2P&QSdNUBqRU1axrvu$lC?O4rK-Ri1VgrB3`9hj$ZdNTKpL|L&y zBPmNv;QgxJI3F`IoL~@4`O3ar*x|q+Y2dIJOSg=sk0jB>-sgcJDTMEok#MrRQWr7Q z7}(uneP>f)Mja5FW|@9`mf()Z`YlgAK%|)prjZ071+r!MzvFvX@>w5kvf;e(F|LXE zCM=-j_VA_7!)EjL`Db;V5kvkv2oS-C-WdGwZI#{mZ$kgY!g!6~vFN;@HJ*SyUV~|d z|M?{L#a=pY2E1m+j%bHH%NmH>D+$SjqOtcu@XML%%$dxygsH#e-Cuq}k+>_A9cX?R zhU`lF2BFn{Uls^?%=g|UjPxlX$erj)hRE~Jg??=m6+ExG^2aQahP$sut1ic~3N8~? z*w@`3+V+DdQ{=3t)JCtNNKC&eWrU=jxHMOXCCNf)BRk`B*C;=#rA3+_xh_3nSdCge zUwuPl0vnqGpoBpf5P^XTcn$*_zzzd7Km!8L#|?ai}LY=e=eOM zkQHBt9{XdTla;TRRn#JJEk~XOf~pD9N4B#Q@jE~rO`umVyVu>(y zDLTn1>0&JkA`fNjLox41;g~NhZSNH|q==VF3O>$D1RDFj5mDcJ8F;e=pSSbp%U~sB zI$@{t;>Q=rC8?Yz93;!qH!7TaHTwk8G0ze6iV~8PUI7CYaaoXv#5t^7+g$ z*sMVoJ1kdT`)|830n9L)EC4G!Jw2(Q+PS6up`0ScsOjgpoq=}pUQ<}(VUCG)sjvBZ z4ir8;PjJ*Ah0n7(~QfrzXzXC7}kk^y^V z)*=SKOg-9v(5Q?-!DY}tJ_>;6p%sFspBg-%<@tZ{^#3*(^$KFQ_k3Hv6&A`HXSc*Rel`8X4Bp;nxCl0W+ks;@-JDRwdWtX$w15q2ku@m z^b#iQg#xJRb){BF;xjXy3L1=C5Bz^6=||nsG+8k}c#u&MNevtabZ(B@hZevzasZq# z@BuGj-~zZ|-~o8yZd=&MWPG;*Flj3^)5y@?XDwb^;OG`i~lMYd=`=HrW>F z5pFYSI%bnT_(`y=xJB2^rEaYc(PWpXp>I`weJm9r@e1o-9(QsieT)igh>+o}z3e=7 z?QVWa<(v2J`^-eOTP&(IS^|s*h`h2lCNbds)z|t`p-pYRb|mB}1U!roQ@8Y3jfGX6 z*6x4va&u}9`2uMh3KLojN*KqePn^l4k>ZmnpOy-B@PF|h!ez2XN7Z~UyY8cWhWivAce9c;@8g7j>0IN_BIWRTyy-zD@g=1d;UAt{ zdwUaQE(a)zz4>)WMJn3WS^&>`SEC^sAPgxHc=F(JIF%-~opGrM;`l}F^xN_Bc;fc! z0Bm*Wj|f|trvLo(*G9p)OK9Gz$yy6GV)>=R9l49toyyCLi>5qi&`~RM-LslD?xT|UQ z7QwXgjO z5qXs~ctb8#H=C=HTC+dVn^qY2s}eSy9Ol+lP(OsMC$bEnGQKpbbfhST@~#M^3#CXV z86QiFM>L=>34IJBs+{OP!>9D!k+my;_siYd(Fw8D2u6NEe(ivERg(1Z_(#RnnKRp* z=FP=6l{5sEGU2PzYR|A@!pm68@}fU4-`nM&lH2{2?2dY=1&-dA^*qRB#$x?FZ&$7Vk=gt*xV zp%&gY{@S8sv&76Pp&vlslv!bx5k%CO0Tn7+X6u{o{>KL^Fzd6y)0YKFA7d>=HE;>yhB$bt1yic<^pDEVYi|>3thL8V$c3IB$D&Zd z`-Og$*ZpxWQblg|8|7viKckhQn2yS0#q@z!L(8!<;xQBzM}&)=i*1nTacmjk69Rty zS%O_98_kc7dl==Loketqb{?MbRS(3Q# zh(rqP zGyyFbQ~@;@)Bz3nv!E7?m#n-T!EqCnhaNrH5bF5>TI9fM_q>Krf!b^re+N);_`SJj zLM(&mRhjISB$`0!7*fT6?M-G%;-}3}I=9{pGo@<`I7k3e(8|D%JyoIZi7LU5TxDw$~94nO{pbp{4=Fmcs=H3C5^Z@0x^B z@b{1cc)yZNe`KxH#o)4{`Gqy@k~_- zi|R&y@}?#a!nPOV*c_ppG-z78(jTiZ5~&eu)hSCysQ=uo)afk~N{8`m)zMy@{6>ww z1>W_Ziww4GH2}-gRy}er;}BicHp=iGZKqFUO_`}7$;sj69JQ19j8awIUZnodtu~+o zv#AT{!P~a&>y>f$=mrWsdeAageJ|zm@##Fd!#(DtYEWwS00kZd6%~rk6G+=bKLc&P z!;x-w`{up60V&j9=i%~qPNyApz~6rxf+>u!S;S6n@yda_z@(K8%cREqs-$#uN4OWo z7i~eVJ)*^Y6N+*>eeQtlrE?A$DSXkv!cU?(nsAv$4i73J`n?TSqJru7%TF~Vke z6;Ptf=Iz95av+@WQ$vHUiqS0fFG4>6<<{oUd{UdwwY8Cred0Y65+k;x z64yaQUlYYlMcjx(_c1Qr%imjD@OkqyW?0%Hl3#GO-ED1V3H8vcpWo)*(riv{HB@fD zdXNE7b}gy=H_9>`N^$#6HXfogKTKS8d#KLcBY-@saQcwxs79v9Juo&_n<&=^C^RrQef zg6KO@79>B$fap)(VO(dX*rg2QrLP!{^4!7NPbkVFpM(g53)(`wYut*VJsuMIk00n} zV+LMV5>#Zrcl>FBcW2a%IT7CDZ0y8R!`rx8qmx`CS;wZ^g|_oFMK38 zlNI`&4U2=FK*a+3YeME_aaRxXQRkft6lJ=|fQ|^sMX_1f-)Sp#TwOhH+u)#tCwTeb zgOjJO=sCY98tQxHf4kTQu!Y&Q1Kz;XBT^OLy5KfPGA-FeY|j}hUFS&zdO%C?%k1oe zj4C>@0F-HYpU1c{&VHDeXCwqh+hgz5KD~C6osy(XawTBfrL}70Z&WufGeNXHNz&_Djxuf#%;2d=rF{0`VeF*2G=|C{uea=l1Wv6$=j<1T=x*QDCS)X*XM3St0C2DTC;24_-juuW;?bY zNpgInL7n^R7>Y7^I6LiWO~OsLWZMw-_(!4U4aJfzUsnXEvf=qpqoF@#E2-grXt(#ZV3s{=l%w z?h9HA_NMLh@qckp9+q#I`}xiJq{K7(1_;U+C1#Zx8o{l&ZYq{EUPSs6VKxo@(6LW< zSGcLh;SS7=>F&jGI{!`xPrwUi(;IjTZ(FuJk%X2dyyiRiO;y!pt2FR>mtSUU$mrZN zQEWXeR}VmGEA`tesj&-ta%nAJ{ilpkXRMCt2{SM9l-SOmR{DEpzRnc4O}+wnUTD}e zztpp*d~fj;3GS&KT0mvr(Nhv?9#vDy3hUebwuhpWV(CS%)3*lGRVb9<5R#I}UEriC zTu49`HvP^?qlv{i~tIBt|OIcuhZ$e zqc&DDzJ5gQPDbAAz`e1*c(+v0P%|g=+){>wb_76JyYQpyJflE|g12qIp zh`d-6+wtlZ2R3?=>V1unWWvlJ0cN&3Le*{z_ZjN|t`Zal+PGgMYL*!uKpyLI`Si6> zk#FgTiS79SGoF3pWez(&Q4I3k(Z~PJgm54NW-}6qg13zbSF5OEDoOlv-I0bqb+BBg zz0gX31jzj;xSPo$&~^MTo#Q2%(B_FU$Vn~8kek0cmT{{WISTi%^SkNK+qU=>UJ<0W z23o|vNKqr_!LabSr=Y|aPLB5;<`ygx(5=;4GiuoSdiXr{6$IribJR-*P&L?)7ngn5 z@~DK1;b7>J{>#c^+qG(A3un|-DLc+pdPH8wx2#lmw#ObHO*?3i&s;q{lp~(lo4@N( zz%~lcd;KC6K=FKjYAQM-_Rb5+*!Q-j(%}xnJ8kH!i9=MH*k$$TkRw%0v8NAG0H3$5 zC62SJC+Vf4JHB;0D3tct}g=V~e`!*JcgV{_5QecP&5@1LKlHkt@9&auCtnxwBM}PgG zQ1*qqL4Ks6+7W}M3kkt;wxlr;fMV-98c@3M{X<>WV~(T_#fbW?+!SD;r8KeayK+o_ zk>8_9?2T?~DtKNyeb#*2Ek%^3bBXMv{c-|lvZS=1d7epVynZ!C;@ZIgifNtJkJLJ@ zPV&lykJkt+{dX-d?-{ z_`Gd)-FnxT0cQLJOc!?sMCQQl(6}+VbG1$@t#8-IT-$c{AnGGICkQQ1)Q2t|_e?ULriz z7(@v5vV<)CU?NWZiKpV7p0GUqRmZ9pa;tSUk$RT}MZtAVdatp~cn>;J%&6iVVKw7V zPhGDgO5Tbyd7_MI7w*1XVt;4)zjfq~Jb8PnSFokf%_u&OF?rzBZ=X1@os?ZO3fUDA zdISMKV5_r=g6N)Zu|y9`w?;$>_zRl6ypqCn}xjXhhp$%7ynq%^Dsro^SN8#U3g0cu!EM=O6wmq+)SE z%MJ_#z&9)%t`^&idY(=}iYNG~M#Ce8_KWun9aTv_)dPCkIVeec)$u2YypAgN|Mohx zCvMCxruh7)qSfkGa*csgiLKgkoX*$BArSDT^vKTXjH&J;C+D(lK6|B2?msWY?>%vU z7=%``@5faXr}^%`@j~PU+u4)gM`vfb+Jgr9>cYyRBfqkp;pU(cpgTZ_QD+qac%FXo z@l0W1nJ4nJ(tbtrhKiHKSd1)bleTp&E|YAqZNR@>Tm#g?Y&HSSFw_C{Ff;&-aJQMW zk5$phSbU3K+s6c$jS>`UJ+mp@Aer=Ns^n2vMm`*XKg*0&G$s$}(KwePaCn&=P{#VZ zOQkfO@WOIqzv8XN$_N!auO;Eh*H?E>lg`j-cA_T?UVzeyQ&ykL`|+VmhWg?!7$frB z*jZ#^ohg!NUl*^$E$Tk~s^~U1!dm(3ySV9c4*d{K0X(mtpriVGPj;o5OX)IchDd7g zSMM)IDm2^Gli8FZ7^*6WJjLt^S-&-w>Bv=n?a{ zSouv!Rg~7FD`Vw24x9WtZ(D#?n9Vkz9p1JghffrJj$_n8h-@-72R!SNC{`ymv;YgX|uYTCf=4wVgJ;PSQC6U5QYR+wWg6BibhWhqRxY(VIss zhtDNm#TzLk1dfP&eQ6u{m;m=6Oz?XOS~u;3Ly67 zpcjTAU>JrzpdW?-U=Th@B2TPdMC?z&t;A7c`=iTb^)ZZqF0nVdVXgn2b+{N-h)Lui zH`cc=2dKKD4ZeM={0g`st5BgFXmV*pC*-=8q%~~8^U6lQ9;B^mHWvx@!}QkH~Aa zGtTLqw#EEZ>evCj^cQAQ!2#n87?at>D6Pm zD^{Q9w0My*EAGOnU4^^-1KSA*iVV+1jsD0iHl`C(o7=9=7sx$;ZuL$KSa zysyefTcm#{>?AM+vpENRgkc((fngT-0Do5e%&ou2bia@o8N>$ZBrXhhen@kAyh1>p zV19<5>zEnwENvSsJEqigHKXtN(~*`HA6hVW#2E%IgE^Le3MXm}t|45!3+^@}!yxsk zkfr$`o%W1J2({JgUVfY}jAP0C+`hize{L;WN~5AmO+HgFdn=F0vn-$OQaXEuJXza+XZq>xS%4Wjh}o!n{;b zOolzE)b}i8frpg;&!erIx(X>UwNdFKdh`u+$l^rslI)jfI2BQ|+|l3@bgu!8e<$ob zumH3930Q=;?L1u*)+YFF&#|cW%B>ak99b{gHRS_02IY-YE$UvCHRNAgil;$+b8QJ1 z{o;>)y@=>kNo_7M(5{Sq%_tDwU{*BFqV&JZ3@J_1!uF^36fS{9Gr!ks*y+uljHc_-96|4L!295v(;6*WZzQd<+`ordodVG> z*;Wk(_wyr_hXc56FV6x3y4?6T2T8xU8eq@GHvQ`t5QtuJ2qGV6*X#(0k(`j%8~c)ra@=iVq+1%6E8IBvKa7S|M+vHV(!a-u`lXU=k1df*k4!``OoGGunMzz30%Rj27HF$ zJ8%HQ7hoNR9bgxR4PX<7Enpk&y?!z+>;lA|7-g5`mc~J6IZy70-1yY(W7_?(;YRv9 zCIGw(=(3BRw_W#!EjECh91L$V=S5p<6rOn0qkJa+u~b={|CE5>)&!o{gMU>;9ux8A zwLq@xmYTZPSZQT#SSDjuoC?>gyBPu*0KBQ;Gli8PA$FQ`ktEl&Q+(%t?7t>RiH(o7 z{({~9N49HUW_s8ZBCmy-8}n?ue3#ahA{>pxSi&Xf=YIN}<@+yc<(eC;c-aHsjpLq% zFAomWPq2vYAEnb$Krh6(1?IQJjcy8)U^FKB6MIv&z=B%}Si|9smz6*k}rf@fY~!{pd0oDRsq_0w2*3FQ(Rj zZU@q*lDh^q2708kx8QjNx8VG~+?F=a`ycUvYHpNL;ZuhNblj+tZ8x$PxS=Oda0dmU zQR|Ay-Tg;Sacl1Jx8{FFu8G|@`Rn7Cd#RY^6IMbwGDDLQdAZh<-wJ>ByX2|juF8>} zU}jx66*BO|KaDT`G-*qpZ2$qc^$d*~OBQu!CNqJ&EULldV;LxSi+ljPA9+xLp9uY+mExioBO6Xn<0>b|6 zfr>)e{01(>Hd`=_zkqWXE`Zb=r20TJqgO7MSx)Z^jtlj!Z=Cp~ z)c#9%+ff+(MNM^P`PC(WQhj#vHuP%*o*(r1je_NBO6Ln28AktQc|_afE67`}LGNj% zl9PS$82ui_g|Gal5kIw9{a;>B;b`6dmuLR1OTqr@yQ4PmW~XpkgLml+J48-=z=B0{ zC|9VJ52Lf`X=ek%W{4kH{V+al*5`@o{^mBPv!q$9)}w12tie5#_p7y}To7>GwQ-;g zT_w%c-^TGk+CIa>-irN>6jYBn50au4Zo~J>cvHz45{Q1ef4oFBiIV2d+Wn)-)HF21BlvOAvW3)r zO{{g@zn%IAxc<*32o;0|lX?UEh5ZJAK(OC#fjb!Pfd{zhj%gAF%Jc*-TmiR@9U+CY z#tgq;Fk{dk3ZtXj;YbJS0dU>!S7e?Qnm(Z(?|EW>ln2Fb;jddPBEwjCUFr1#P1um3 zGcsOBDtKPQ93@k{QV-pPT4Vr%a|z32sxPhoO|t8OoH!oxXPUmk z+Q(oXTU3FY7Bew%_PO1I*>zB`22x^#bC&A=%y0yTbX7rowPf=2hZ_XVF5ecSAC|g$ zD45cxu9|OPLE(9wt)Wt={^9&-zxlC#P%mm?lA-*4!*b%?ZJyo`AUQu=0PmM;`|#W~ z(?>v-J_V%M%64q*fER*MIE}_8n3;pRcQE_kymhQRwp(_h1%vwT{W+!P6|+;6brUt8 z%}{g-Ld)NqZRh@!{UcfclZpgFh5-yhfv2a^+~Rz=7pOK|uDrF=CFL>1a{15^tLj&o zHPy5z+nF!`uGw_gQcl60N8aVxFs;7*qfb-l=M)hpl38VQGA0f7=`Feq@%e57&+9MG z$5QWY2X}p74~;tw!U_)F-daij+a2fMj@$HXs}};U;hPuC^A9c@-JLKgKkjPZ}fAWos3?{8E4=@mcUOA?QuSXkKNoM|685%GN*uQOQv7c zsl|%TJop9cJU)-G8t&f_gpF-n*zN-0Dqiqc)&@dAF@U-9%4LN6q>9x-Y?a@L_|3k@ zT8o8b@7k2?7qx#jAA!(eHgQ0>FkpZ%VZZ`m!(DW?Y2>&yF|XmhApX;X^=2c5fOAx3 zHd1kuWgczWk(31SEPVDdY^yQM0k_jV+}gSIX>EMhU*(&@$nHL8PQ>6W5yVbN>*Pfp z&<$!xepEvd1`(9l5BTz1KQDROX69-v8}C{c02{OxS?DV^dj!fi`o_XkUU#$RrJlJ}~t)@&tI_+20J(y5;OG|cqlF#(|e z<&l#NFZDQ6);-f5Ss&Vu4&L7Bw{;~_>ZkP`Yx(kb)i`g{HxuDD|4Hxb;ud?sIA7E9{1HhGyg%mcP6)hY=yuPwwS4(9+o=lN=6r4yVoF5#= zdMFPVJ&_Go{<*~iJ%-uD2NA$+#yu(!WoSsrT&qr`{6u;0I}Tx(rFMC_2U}SIZA{+@9*Z!<=6n-x9CwA?o2vN7!tWr0c8KFQ@0C zx~F+T5R>11&+XI^#TtG`9kR2Zja37{^Z41Wj14o;GtQT;U7xv0ZwU`glbE4#F?|~D z7EQg?`+%?+?njCoh@N66Zz8Yw$<(4N*OqPVT~0fGLfCL7CZj~yfBgbhXr7-3Lro;- z8)a(U%}s5tS$G5v-fNYYu~U3WJZ{~X3Qdwg^h=~+pj^E&cP^f1c($6A1`7F0era7v z$HXnq$s;b05)Xyv75G(j>3*C^nkx+{w|UH}#%QQ~mw%9~_w&=*YY}^1{C_ryKu=*d zc|g1{JOdHK@B%~+0||%}1}e~V7|1~6Fi?Of;ojRsJ9^}lbZM)e9+P6R<}QAI(-nPQ}TxjGaL}D@HwaCHq zdYgDY08T_|O=}PSE6y2}w)B0LC)ww9t40AuvE}X4%+PRYEuv3%5*QU>2=5`^Sz>rK za4~~~7o@B23aOv1QuY$Rj6&POz@I6ZD_;k|k?fI=zc31J>hNWL;msp^l9t%a9yTJ~ zv2w+yR#Sx1U}^F*=p!W+Od~aj1_oLX9o%LV-Kc2!pi$fR4k-;|(v3 zVEmUl-P{g(>mR!QTm> zU70f;E8xa6t?}hPPDvyCZQ1DVIdswlfIV**gqz2duHBQ0QoLQPUN{MhP8@J2{;WE3 zZ+LsaI%cb!H|`#|1=Gj?VuXPW#0~=!h#3YJ5aNz zAY6p$`Agyx=C_r(Q71cEnWkI}Z~XpLB>P;h4SK16oZA6_?bl~Del{4a(&}-p-#Vzq zh?BH{qTY>O(yMQ2LWT2#KWc{c0h9%Bw-FI2$zkR%U$z95@8-N>qUoK6WWkm7lmD(O}Cz zTl-t+2esO?#C}bjzih}B1<4iR`V+atbi`jo-vQC;ZR3%c8jjY=~;g@ zo@*X|kagg3m!@zn@!21@lhg|_eF&s?#ouIK-S5UPuMf}X7xp@{4g1`W1qnSP^eNSO z9ssO>_Pe8|K+-)>{pk3tiUHePaqfN%vG=sAo%B1QmSV-VYV8d8jwwDYS2v$|41lG~5(GAkU(L&zXDq+VmlR~-v)9%>wWw&^ zQsKI2$r0DKG8!z>Er4m{1HFVn3iJvFevkkRq98FC1VKVD2!ll6PflIv?^b}eKT=_c z2~S_nu=M{j(M4;k;8u&XB=K$1m<0l64N*CPoP9jE%l7EB34AMZ{M_EeQOxhnN_8K} z4WuY?7klR&&e;|`51OE&!AxUoQBqPd#Gi`Q*lE5!U-`ITFN*!*>5VVXZwQz%!hGdr zj(JJe)$gc#1HLe{HXruxO$J%J>z6DNWhzM=PiJhiZxCieqR1Gv-u<+0u4=tKv@A?= zZeJ7X)qK@Jb%FD6Qb2?Z0n<-7&2oMsAvmKve}>^J^3gFwSWuiS=c8Yw-oQ{KdMxw? z+Tv@CSh>uZzxmGQlbm;wipI`gWWRI?j>i5u+o|v50;Yu>ChDPJYWm)kjx8dQRrw5b z-Ysz3vrCRgjnp1GpDd>RemOe7j>b!RG;;dyOn`vIVKyZ|lJM!nU4*1*24Bb9j$B<}#Pl&Y`1<~2xTq{>`u7JxujunMU$uEku{+i^pV1Qcq&|XxNgqwRZ0jSZ z^3wewqKrOfZ{_7S9_nta#+0!kMxK)Lo3ss9A_bc;fZF)|~f=_WHukZ;Ns3(@Zp~>e# z^y_PHJlQnGSt3%6Z2GW)V(d1`dD;#a2}d_0`l1`CXwuX{_;V z@HF}gX2SwwG4(t81={0KGYXsZG5(zb(jXa_O+}Cr46-0O800~SJIZa*)m5N}KYchD zSH@m`;TU7*G83#sWTjt?4S43JEQ26m;14pMzWg6NtSxJ+!{rTfB&z0YL&muGs_NfI*|l*R4+W_rnD6miXE!t!$7o{o0ruI0P-CxFOTEP zH1nh1jru6-QSR0j5z|xL_e+o-d7G9*Glz`dkXtf8gxeynF_mbn4J)_76P1-iBWA{& zw5Cog(@^{!v)cy^v=;#K@3R+~xfasm&h+8XC>6)D*s{EZI6o+OwPwuBc9eChNfj}IE zK?16ZwHQ)CD`{qpk<^lHWzQl0Use_m_q6|Zsxn9gW>XcU22XF^Z2Pt-P%mhp)+=nZYPC0v;bo5B2yYAG4kJ>9(qFq zGsX%~oeK}d^yTRMG`fYCp?mEzqAd4CxQqB(_S*t@zYy(A_j&6J>iU70ZVU+1n_Z4! zmzaIyV|S18meBV_Dg(%SJC6gMh_(4N7!7?enjgMl#0#`=g6&iGN{Ky>InMloo{%uK z(Ne+lDrcqevU0jG)Q+d7=p7_pPoykP4SQnGXg)+=bueYkQU6QE65E7ZIBKO79dL)bU}JB7=eso zcn#8r!2o0k?@?2`Pn%Ien&)55Ia9q;z3Cx(aN(_15O7!fIa{#ocpi$p^g7Uh{~@Bt zzni#=S4f9A=~Dk;ukPc8C(dB&&O?*Pgd~n2=KpS1HuV#$GQ9hBz}cilsi~yLz}23q z+7`__&bNs1O&2Hp2tXb=5^)Osn!2FKomU?#C`hbn+4}-Vyi}A#s`&`MP2TvTjqkUO;B9>%PRIyL7P zLLVVf+J11)>&@Wky2so1(s^MdK#zJN%wMyFXdB0BCEb)1iO&Dic!{_dbFfv8ZtJrI z`y$%2x8x*M`Fq`%u z2N-NXwlLU%5O99yfE+=fZS5iD3yNm zNHIgZj=xDID=j>Mw3y)5{CZ$7^)^0dkih=U69SFLCU6%S{vWvGZ(TD#ugNL>5EDK5 zx1^?23xwnq@cNz&h>b|O@`o$;_o>Hc-P|Dh1&1f`vFwa7bW{uu4xKLDiNrNRKYB5A zS$%Gm_q?I!8$b^4BUd!HJSMi+Cu{2g*M4&BJVJY2DZ&|SZ`&$+ddAWCtcntS-UO!6 z5#$7eGsp!#eTVi~#rv494<=kZmIBlip11whPW0w{c0k83W1sQO8-<9PcxJFx`UZH7{PjeQK>E+!0%fC&iU0V;;R< zPgf=LEL_vr(oLt_9fEA6kUpJ?5lbtI(V=Mnol8z&J2Lvv+`LEV5xL#R_(?hTj;tWM z353n!>2mQ9uvePrgVr~K7}k$P3)r0I!sso-HuKhyCSVglR$gsRw`CJUFPu~hzA6l1 z&9u0yvkw0#t0^r(5SK%qG;D<-G^vZ|*P~cNoZt22wkgz-Q1iX=5E zsojf3au8$%&v47~blU|sGlH6ceN8gYq!2x=*5QzT3VNSO@-A7rm5#lJynnBIcaR6n zW-urO22YR|41OSg7`#DmVekR@!p(FMT@?_k9AhS|c2Fw~g|(Ztt*e}9`RhChlkLuL z!P6N)77!u#pS7mfE&O0*{33t_#aU*?LTILY{f1StO6F1cdPc_e{a*(vcwX+hFTG9v zH_}(mTq?zU9usdL_A@fD8D{u(*tf~DUw8bMCom{W#Jtn>bvCEC$xlINwExot#YajL zrE{q8&%X5*Nni8v>AxoMygW3+l4LMFLAHUqvfixDRXWa1Mn>9YDbXU*CTwS7R9$s;iFT!*V_)|*VWp}grN+@*S zi^$eRvG&0}Ie+Hoo{183YSso6`I&A*?3Wh@hpdF1Z;7Lluf#5NORzofIdx9lN6Vqx zbJG+l=PywHnGOI2!fZl8LGZTOsGW(9QrQm1gvQ&?R%LDz*6-QCCzTA%d1n}LB7&h1 zWTfM1!H!*_NN2-nl4Rf1Cy#HGCcYS|&aEk4{cQnBNLy_h9O*sLxpeA0J0f+Df~ zB=bExuF-l>i$$S@)*(Pk3*3Bg+y{_$41d?n=b~8bw8Cq0M{5KTs5tZuAP`EE>o1Kh;HxqF)x1Zm6hX?9Ua z^M(LWQ$@>FmIr zLH%QM>r-=DH&Ox#+t|?0!UBF>6Lf*Q)l? zseAuUflyEw%w{ww28M7@1PqZN#2w{6cZX9E?0xP5Pa=yKv!2u?0Z~gRIrQ%54D2l; zx@V6EkQO)oyCrF}!llF+lx9arruK?v2x+H?HTnk~YJ+1hdRz6@=7ZQB!bJl!R?I8p z*n?-+80KD!vd+UlS1t*;1Lk#E$>{{|voat^pGHjl1*LfBi8Vy*a{0wDh$k=C#f@^L zls7TF1Rg!*9<|DHolq`7tbOWW(~W1u@a!+V76VFF{=aSo*K~fDW7PWk6e$Ag<^a-y z#z22VL;iuyzI#~crx1aRYTW0~Zt;jRw;Y5}^|)A06|HQLj<(==HL-f(Ogry~>r!7( zPgb}{h?cijyzZgsLdgo9pFb{%j2o5vtg=mr;?Vi7O(?Mw5QxNd?bqt~KI2LXM3* z1b(sWUYv@5e90oYrrMijBUn_S( zbyq#c_|8U;osp7U#PltuX_%^)(W3{l?-~KOzO~35u|Vd&A2=oHv$D1RZv-Jo10xMf zN(Ie*KEED+6e4=LQsW#xdU1kV<*6d_j#%=)Pfs;%#;u+rRwpHzyt?;%sz1l47P+mc z6~Mll<_(E#P_{j}G7V8^68bOC0M~2b^>jnP%|cmOQ=|X2O;k|xe|LVT^+#my@(e#{ zzvceq{^Os`WKassW&@}ZhE&iy7>Yo}Fr1=;lxkNLLlNF%eYM&?^uCsS**qRqO!j1B zuaD=IAU5S*M8Yo|YtK|^C{iOs+T>hjHzl9rdn#6J^0_OC=mZ)Y>nH&)!#hbXHsPu} z_AJ{P6ZpJc>Q&?B$J~%Rt#9prhjBtA8Eww0&h<5Q3f9!pJV1^BQmIz$-fUZY z`f*ug9hj<&Ry>ap9FyzLv;T(r-}g6y^(}F(_O?(Es}o6dA=1~s!y6WnBlJD0pj&|Y zS4&Y(nxp=KNgF8p;~s#N3mTPDtgF$gBBWtUWh_6-m%;;cb=gA4r38)l?Do`~HWuS5xDnN)k%Au^4W<5_+ zURT(1%QTEf_fj2w*ZQ27{a$zdQ5=3|*7N{U>SlDonj!t0Y4!%%XJfUuT}*zZIotCg(YTh`lkmP)rq+bA8dM`yfb( zUxoCJ^tvAoAr-}dM}?2g>LX-ry$k}%AHKRkry7E`F77& zCF0#tt$~8-SjzZYLT!`DIm=Mh|MC`cX-#E#IoK?TKM8L>y#9qh5z)n$`{z9fMc(MK zq?7no&So~B3EXX1*xwwf+nGqIp7;mqJBlSoY0(^NWQo;lG7#-fN z7Kg7HXQBai?{JI}!vqn|@-nd=DZ@m!ULh^vw~UZ~ZfiibFq?ItdU$&AK^tY6;l{GB zlAlvL`^FFKfdM>CZ!IWN%yk2K zh}S#lYpclofow_9#>w}1qv={eP(1$otvVc`FX--`@p%RCe$_8`km}xx$h4Mhd)vMe zO5Gh_v};&y?rN;oob4-}TKF$7ZjgJjJ*u}2%@$yZUs@h7)9$)J6k`Z_jFZ9f7F=}CY1=l+rWc==uGRqxZwe3#n?eOS4) z`rN%Y3{NlYmOph4;=ZDVKOS?R*`u)GRvP!&gKXzEdEUwlK7H9XUHI9Oi&;(rd}`oy zyN7WvC^Yvm?uUlvO#1?{6A=Mt)=6)gJLT7_=q0Du=4b_6j(fQB#;P-)FU(~CyEZec zCFrx<^IV_irLXU#s%6gD8Fu}6-89q5FTBoJ`25(?248!$z_Urq^N_@Q&9c;zCZ|35!q6zkVFzKL3qNoa3ZDoop{= z86~)EKd^r8iL3Hktp6x3d+_!=ql7|>1uQh@u}J5>NuDUgWw?8)!Gf4KTi#zgIs5ZV z?i*4{Edd$pcpSj~^%l7mQrmpe!r=5hmHh%fmlm&^CU7L;O~b*(Tw1(mJj}{f7J!2B z5aVGGb%OCEh&sY}6hs|kgsoAY=qdNUe5$+snHhT~@JVR+wp%M~c$Ub2lrK-$>H0#c zTu4|rH5*^iK9FZs{(F(&kr)5>@2W_Rzrv90wjxO)~44_wY?yoVMrm0jAo` z_qzKfBkF}?QylhYRZjCLzSVf?!1m2$i}Kl39U>)a9wl9AJphZV))_&;{(0vv{S&e^ zo-esgO5*Eftyzc7xjdI?7Pw5mo6x{iQukt!wMqCQE$uz|Qq~=heeDh_rEq+^Z?pc} zW%kw!)fWRK6Bk?ohwUlG)1c5i!*~|z`^hU`Is2?#_G)wRZT)A}rq)j+wN1V)`~UW8 zkZ74y!cB$-rmXjw8`kUj>{#)8hlhfswXcGQ;=VP?M|*a>(K;;h-}G&8)H{X>_$f`( z1uRo<_dZFz()gfU#qib>enVp!#shbS%0FF6I$+EE{{T}~+#JW{Yv#(X(V4$cy2$u< z|J#Py37b^(8hn=?E;v4M!bF2(-%KyUe80D$EzR`!uHY>UzEhP~u|I2&OZva_WWeR? ze^ZbD*LquVfGOkM#+N$3CYaB=Qp&78#pqeDKy8ZGE#;@TJtpoGvGM(S`%wscUkNOB zHkH*UY=7wg@8qq>hyDk}fBi2FWnI2zd(MZ0=e&dd_jEKcg&)%VwLgB3K;7r{r(cWC id%*jecX8wSzV&sFk2*!X+4;}Z=eOB B>boc ref, b> B dup Bx. cr - -."wallet:" cr - -"wallet-v4-code.fif" include -2 boc+>B dup Bx. cr diff --git a/func/registry.fc b/func/registry.fc new file mode 100644 index 0000000..70ec696 --- /dev/null +++ b/func/registry.fc @@ -0,0 +1,104 @@ +;; -------------------------- STORAGE FEE CALCULATION -------------------------- + +int load_workchain() inline { + (int workchain, _) = parse_std_addr(my_address()); + return workchain; +} +int calc_storage_fee_raw(int cells, int bits, int time) inline { + cell prices_by_workchain = config_param(18); + ;; (slice prices, _) = prices_by_workchain.idict_get?(32, load_workchain()); + (slice prices, _) = prices_by_workchain.idict_get?(32, 0); + + ;; _#cc utime_since:uint32 bit_price_ps:uint64 cell_price_ps:uint64 ... + prices~skip_bits(40); + + if (load_workchain() == -1) { ;; ... mc_bit_price_ps:uint64 mc_cell_price_ps:uint64 + prices~skip_bits(128); + } + + int base_fee = prices~load_uint(64) * bits; + base_fee += prices~load_uint(64) * cells; + return base_fee * time / 65536; ;; to be optimized with MULRSHIFT +} +int calc_storage_fee(cell in, int time) inline { + (int cells, int bits, _) = in.compute_data_size(100000); + return calc_storage_fee_raw(cells, bits, time); +} + +const int storage_time = 86400 * 365; +const int milliton = 1000000; +const int bounty = 100 * milliton; + + +;; ----------------- TERMINATION PRIMITIVES NOT CLEANING STACK ----------------- + +() terminate() impure asm "RETALT"; +() terminate_if(int) impure asm "IFRETALT"; + + +;; --------------------------- VM ISOLATED EXECUTION --------------------------- + +tuple vm::invoke(tuple args, int method, cell f) asm(f args method) + "TPUSH" "DEPTH DEC DEC 30 SETGLOB" "255 PUSHINT EXPLODEVAR" "DUP INC" "ROLLX" + "CTOS 1 RUNVM" "DEPTH 30 GETGLOB SUB TUPLEVAR"; + + +;; ------------------------------ MISC PRIMITIVES ------------------------------ + +() publish_library(cell lib) impure asm "2 PUSHINT SETLIBCODE"; +forall X, Y -> (X, Y) impure_touch_dup(X, Y) impure asm "NOP"; + + +;; ------------------------------- RECV_INTERNAL ------------------------------- +;; _ stored_libraries:(Hashmap 256 ^Cell) = ContractData; +;; request_store#43ffd44f library:^Cell = InMsgBody; +;; store_success#c3ffd44f hash:uint256 = OutMsgBody; +;; store_failure#ffffffff _#43ffd44f = OutMsgBody; + +() main(int new_balance, int msg_value, cell in_msg, slice in_msg_body) { + terminate_if(in_msg_body.slice_bits() < 32); + + slice in_msg_full = in_msg.begin_parse(); + terminate_if(in_msg_full~load_uint(4) & 1); ;; bounced + + throw_unless(65535, in_msg_body~load_uint(32) == 0x43ffd44f); + + cell library = in_msg_body~load_ref(); + int fee = calc_storage_fee(library, storage_time); + msg_value -= fee + (bounty + 15 * milliton); + throw_unless(130, msg_value >= 0); + + ;; updating storage + ;; exotic cells cannot rewrite standard ones because they have different infinite-level hashes + cell stored = get_data(); + if (stored.begin_parse().slice_empty?()) { stored = null(); } + stored~udict_set_ref(256, library.cell_hash(), library); + set_data(stored); + + ;; publishing library (if this contract is in masterchain, this makes it accessible to the whole blockchain) + library.publish_library(); + + ;; sending bounty to the library creator + tuple bounty_addr_tuple = vm::invoke(empty_tuple(), 119703, library); + slice bounty_addr = bounty_addr_tuple.first(); + impure_touch_dup(bounty_addr.parse_std_addr()); ;; ensuring that the address is valid and not rewriting amount to send + send_raw_message(begin_cell() + .store_uint(0x18, 6) + .store_slice(bounty_addr) + .store_coins(bounty) + .store_uint(0, 107) + .end_cell(), 0); + + ;; responding to sender + send_raw_message(begin_cell() + .store_uint(0x18, 6) + .store_slice(in_msg_full~load_msg_addr()) + .store_coins(msg_value) + .store_uint(0xc3ffd44f, 4 + 107 + 32) + .store_uint(library.cell_hash(), 256) + .end_cell(), 0); +} + +int get_fee(cell library) method_id { + return calc_storage_fee(library, storage_time) + (bounty + 15 * milliton); +} diff --git a/func/simple-subscription-plugin.fc b/func/simple-subscription-plugin.fc deleted file mode 100644 index 018328d..0000000 --- a/func/simple-subscription-plugin.fc +++ /dev/null @@ -1,179 +0,0 @@ -#pragma version =0.2.0; -;; Simple subscription plugin for wallet-v4 -;; anyone can ask to send a subscription payment - -(int) slice_data_equal?(slice s1, slice s2) asm "SDEQ"; - -int op:destruct() asm "0x64737472 PUSHINT"; -int op:payment_request() asm "0x706c7567 PUSHINT"; -int op:fallback() asm "0x756e6b77 PUSHINT"; -int op:subscription() asm "0x73756273 PUSHINT"; -int max_failed_attempts() asm "2 PUSHINT"; -int max_reserved_funds() asm "67108864 PUSHINT"; ;; 0.0671 TON - -int short_msg_fwd_fee(int workchain) inline { - int config_index = 25 + workchain; - int lump_price = config_param(config_index).begin_parse().skip_bits(8).preload_uint(64); - return lump_price; -} - -int gas_to_coins(int workchain, int gas) inline_ref { - int config_index = 21 + workchain; - var cs = config_param(config_index).begin_parse(); - if (cs.preload_uint(8) == 0xd1) { ;; gas_flat_pfx - cs~skip_bits(8 + 64 + 64); - } - int tag = cs~load_uint(8); - throw_unless(71, (tag == 0xdd) | (tag == 0xde)); ;; gas_prices or gas_prices_ext - int gas_price = cs~load_uint(64); - return (gas * gas_price) >> 16; -} - -;; storage$_ wallet:MsgAddressInt -;; beneficiary:MsgAddressInt -;; amount:Grams -;; period:uint32 start_time:uint32 timeout:uint32 -;; last_payment_time:uint32 -;; last_request_time:uint32 -;; failed_attempts:uint8 -;; subscription_id:uint32 = Storage; - -(slice, slice, int, int, int, int, int, int, int, int) load_storage() impure inline_ref { - var ds = get_data().begin_parse(); - return (ds~load_msg_addr(), ds~load_msg_addr(), ds~load_grams(), - ds~load_uint(32), ds~load_uint(32), ds~load_uint(32), - ds~load_uint(32), ds~load_uint(32), ds~load_uint(8), ds~load_uint(32)); -} - -() save_storage(slice wallet, slice beneficiary, int amount, - int period, int start_time, int timeout, int last_payment_time, - int last_request_time, int failed_attempts, int subscription_id) impure inline_ref { - set_data(begin_cell() - .store_slice(wallet) - .store_slice(beneficiary) - .store_grams(amount) - .store_uint(period, 32) - .store_uint(start_time, 32) - .store_uint(timeout, 32) - .store_uint(last_payment_time, 32) - .store_uint(last_request_time, 32) - .store_uint(failed_attempts, 8) - .store_uint(subscription_id, 32) ;; to differ subscriptions to the same beneficiary (acts as a nonce) - .end_cell()); -} - -() forward_funds(slice beneficiary, int self_destruct?, int op) impure inline_ref { - if ~(self_destruct?) { - raw_reserve(max_reserved_funds(), 2); ;; reserve at most `max_reserved_funds` nanocoins - } - var msg = begin_cell() - .store_uint(0x10, 6) ;; non-bounce message - .store_slice(beneficiary) - .store_grams(0) - .store_dict(pair_second(get_balance())) - .store_uint(0, 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(op, 32); - int mode = 128; ;; carry all the remaining balance of the current smart contract - if (self_destruct?) { - mode += 32; ;; must be destroyed if its resulting balance is zero - } - send_raw_message(msg.end_cell(), mode); -} - -() request_payment(slice wallet, int requested_amount) impure inline_ref { - (int wc, _) = wallet.parse_std_addr(); - int amount = gas_to_coins(wc, 15000) + short_msg_fwd_fee(wc); - - var msg = begin_cell().store_uint(0x18, 6) - .store_slice(wallet) - .store_grams(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(op:payment_request(), 32) ;; request op - .store_uint(cur_lt(), 64) ;; query_id - .store_grams(requested_amount) - .store_uint(0, 1); ;; empty extra - send_raw_message(msg.end_cell(), 3); -} - -() self_destruct(slice wallet, slice beneficiary) impure { - ;; send event to wallet - (int wc, _) = wallet.parse_std_addr(); - int amount = gas_to_coins(wc, 10000); - - var msg = begin_cell().store_uint(0x10, 6) ;; non-bounce - we dont need answer from wallet - .store_slice(wallet) - .store_grams(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(op:destruct(), 32) ;; request op - .store_uint(cur_lt(), 64); ;; query_id - send_raw_message(msg.end_cell(), 3); - - ;; forward all the remaining funds to the beneficiary & destroy - - forward_funds(beneficiary, true, op:destruct()); -} - -() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { - var (wallet, beneficiary, amount, period, start_time, timeout, last_payment_time, last_request_time, failed_attempts, subscription_id) = load_storage(); - var cs = in_msg_cell.begin_parse(); - var flags = cs~load_uint(4); - slice s_addr = cs~load_msg_addr(); - - if (slice_data_equal?(s_addr, beneficiary)) { - int op = in_msg~load_uint(32); - if (op == op:destruct()) { - ;; end subscription - return self_destruct(wallet, beneficiary); - } - return forward_funds(beneficiary, false, op:fallback()); - } - if (~ slice_data_equal?(s_addr, wallet)) { - return forward_funds(beneficiary, false, op:fallback()); - } - if (in_msg.slice_bits() < 32) { - return forward_funds(beneficiary, false, op:fallback()); - } - int op = in_msg~load_uint(32); - - if (op == (op:payment_request() | 0x80000000)) { - int last_timeslot = (last_payment_time - start_time) / period; - int cur_timeslot = (now() - start_time) / period; - throw_if(49, last_timeslot >= cur_timeslot); - (int from_wc, _) = s_addr.parse_std_addr(); - - if (msg_value >= amount - short_msg_fwd_fee(from_wc) ) { - last_payment_time = now(); - failed_attempts = 0; - forward_funds(beneficiary, false, op:subscription()); - } - - return save_storage(wallet, beneficiary, amount, period, start_time, timeout, last_payment_time, last_request_time, failed_attempts, subscription_id); - } - if (op == op:destruct()) { ;; self-destruct - ;; forward all the remaining funds to the beneficiary & destroy - return forward_funds(beneficiary, true, op:destruct()); - } -} - -() recv_external(slice in_msg) impure { - var (wallet, beneficiary, amount, period, start_time, timeout, last_payment_time, last_request_time, failed_attempts, subscription_id) = load_storage(); - int last_timeslot = (last_payment_time - start_time) / period; - int cur_timeslot = (now() - start_time) / period; - throw_unless(30, (cur_timeslot > last_timeslot) & (last_request_time + timeout < now())); ;; too early request - accept_message(); - if (failed_attempts >= max_failed_attempts()) { - self_destruct(wallet, beneficiary); - } else { - request_payment(wallet, amount); - failed_attempts += 1; - } - save_storage(wallet, beneficiary, amount, period, start_time, timeout, last_payment_time, now(), failed_attempts, subscription_id); -} - -;; Get methods - -([int, int], [int, int], int, int, int, int, int, int, int, int) get_subscription_data() method_id { - var (wallet, beneficiary, amount, period, start_time, timeout, last_payment_time, last_request_time, failed_attempts, subscription_id) = load_storage(); - return (pair(parse_std_addr(wallet)), pair(parse_std_addr(beneficiary)), - amount, period, start_time, timeout, last_payment_time, last_request_time, failed_attempts, subscription_id); -} diff --git a/func/stdlib.fc b/func/stdlib.fc index 1d14404..92c4454 100644 --- a/func/stdlib.fc +++ b/func/stdlib.fc @@ -1,132 +1,525 @@ ;; Standard library for funC ;; +{- + # Tuple manipulation primitives + The names and the types are mostly self-explaining. + See [polymorhism with forall](https://ton.org/docs/#/func/functions?id=polymorphism-with-forall) + for more info on the polymorphic functions. + + Note that currently values of atomic type `tuple` can't be cast to composite tuple type (e.g. `[int, cell]`) + and vise versa. +-} + +{- + # Lisp-style lists + + Lists can be represented as nested 2-elements tuples. + Empty list is conventionally represented as TVM `null` value (it can be obtained by calling [null()]). + For example, tuple `(1, (2, (3, null)))` represents list `[1, 2, 3]`. Elements of a list can be of different types. +-} + +;;; Adds an element to the beginning of lisp-style list. forall X -> tuple cons(X head, tuple tail) asm "CONS"; + +;;; Extracts the head and the tail of lisp-style list. forall X -> (X, tuple) uncons(tuple list) asm "UNCONS"; + +;;; Extracts the tail and the head of lisp-style list. forall X -> (tuple, X) list_next(tuple list) asm( -> 1 0) "UNCONS"; + +;;; Returns the head of lisp-style list. forall X -> X car(tuple list) asm "CAR"; + +;;; Returns the tail of lisp-style list. tuple cdr(tuple list) asm "CDR"; + +;;; Creates tuple with zero elements. tuple empty_tuple() asm "NIL"; + +;;; Appends a value `x` to a `Tuple t = (x1, ..., xn)`, but only if the resulting `Tuple t' = (x1, ..., xn, x)` +;;; is of length at most 255. Otherwise throws a type check exception. forall X -> tuple tpush(tuple t, X value) asm "TPUSH"; forall X -> (tuple, ()) ~tpush(tuple t, X value) asm "TPUSH"; + +;;; Creates a tuple of length one with given argument as element. forall X -> [X] single(X x) asm "SINGLE"; + +;;; Unpacks a tuple of length one forall X -> X unsingle([X] t) asm "UNSINGLE"; + +;;; Creates a tuple of length two with given arguments as elements. forall X, Y -> [X, Y] pair(X x, Y y) asm "PAIR"; + +;;; Unpacks a tuple of length two forall X, Y -> (X, Y) unpair([X, Y] t) asm "UNPAIR"; + +;;; Creates a tuple of length three with given arguments as elements. forall X, Y, Z -> [X, Y, Z] triple(X x, Y y, Z z) asm "TRIPLE"; + +;;; Unpacks a tuple of length three forall X, Y, Z -> (X, Y, Z) untriple([X, Y, Z] t) asm "UNTRIPLE"; + +;;; Creates a tuple of length four with given arguments as elements. forall X, Y, Z, W -> [X, Y, Z, W] tuple4(X x, Y y, Z z, W w) asm "4 TUPLE"; + +;;; Unpacks a tuple of length four forall X, Y, Z, W -> (X, Y, Z, W) untuple4([X, Y, Z, W] t) asm "4 UNTUPLE"; + +;;; Returns the first element of a tuple (with unknown element types). forall X -> X first(tuple t) asm "FIRST"; + +;;; Returns the second element of a tuple (with unknown element types). forall X -> X second(tuple t) asm "SECOND"; + +;;; Returns the third element of a tuple (with unknown element types). forall X -> X third(tuple t) asm "THIRD"; + +;;; Returns the fourth element of a tuple (with unknown element types). forall X -> X fourth(tuple t) asm "3 INDEX"; + +;;; Returns the first element of a pair tuple. forall X, Y -> X pair_first([X, Y] p) asm "FIRST"; + +;;; Returns the second element of a pair tuple. forall X, Y -> Y pair_second([X, Y] p) asm "SECOND"; + +;;; Returns the first element of a triple tuple. forall X, Y, Z -> X triple_first([X, Y, Z] p) asm "FIRST"; + +;;; Returns the second element of a triple tuple. forall X, Y, Z -> Y triple_second([X, Y, Z] p) asm "SECOND"; + +;;; Returns the third element of a triple tuple. forall X, Y, Z -> Z triple_third([X, Y, Z] p) asm "THIRD"; + + +;;; Push null element (casted to given type) +;;; By the TVM type `Null` FunC represents absence of a value of some atomic type. +;;; So `null` can actually have any atomic type. forall X -> X null() asm "PUSHNULL"; + +;;; Moves a variable [x] to the top of the stack forall X -> (X, ()) ~impure_touch(X x) impure asm "NOP"; + + +;;; Returns the current Unix time as an Integer int now() asm "NOW"; + +;;; Returns the internal address of the current smart contract as a Slice with a `MsgAddressInt`. +;;; If necessary, it can be parsed further using primitives such as [parse_std_addr]. slice my_address() asm "MYADDR"; + +;;; Returns the balance of the smart contract as a tuple consisting of an int +;;; (balance in nanotoncoins) and a `cell` +;;; (a dictionary with 32-bit keys representing the balance of "extra currencies") +;;; at the start of Computation Phase. +;;; Note that RAW primitives such as [send_raw_message] do not update this field. [int, cell] get_balance() asm "BALANCE"; + +;;; Returns the logical time of the current transaction. int cur_lt() asm "LTIME"; + +;;; Returns the starting logical time of the current block. int block_lt() asm "BLOCKLT"; +;;; Computes the representation hash of a `cell` [c] and returns it as a 256-bit unsigned integer `x`. +;;; Useful for signing and checking signatures of arbitrary entities represented by a tree of cells. int cell_hash(cell c) asm "HASHCU"; + +;;; Computes the hash of a `slice s` and returns it as a 256-bit unsigned integer `x`. +;;; The result is the same as if an ordinary cell containing only data and references from `s` had been created +;;; and its hash computed by [cell_hash]. int slice_hash(slice s) asm "HASHSU"; + +;;; Computes sha256 of the data bits of `slice` [s]. If the bit length of `s` is not divisible by eight, +;;; throws a cell underflow exception. The hash value is returned as a 256-bit unsigned integer `x`. int string_hash(slice s) asm "SHA256U"; +{- + # Signature checks +-} + +;;; Checks the Ed25519-`signature` of a `hash` (a 256-bit unsigned integer, usually computed as the hash of some data) +;;; using [public_key] (also represented by a 256-bit unsigned integer). +;;; The signature must contain at least 512 data bits; only the first 512 bits are used. +;;; The result is `−1` if the signature is valid, `0` otherwise. +;;; Note that `CHKSIGNU` creates a 256-bit slice with the hash and calls `CHKSIGNS`. +;;; That is, if [hash] is computed as the hash of some data, these data are hashed twice, +;;; the second hashing occurring inside `CHKSIGNS`. int check_signature(int hash, slice signature, int public_key) asm "CHKSIGNU"; + +;;; Checks whether [signature] is a valid Ed25519-signature of the data portion of `slice data` using `public_key`, +;;; similarly to [check_signature]. +;;; If the bit length of [data] is not divisible by eight, throws a cell underflow exception. +;;; The verification of Ed25519 signatures is the standard one, +;;; with sha256 used to reduce [data] to the 256-bit number that is actually signed. int check_data_signature(slice data, slice signature, int public_key) asm "CHKSIGNS"; +{--- + # Computation of boc size + The primitives below may be useful for computing storage fees of user-provided data. +-} + +;;; Returns `(x, y, z, -1)` or `(null, null, null, 0)`. +;;; Recursively computes the count of distinct cells `x`, data bits `y`, and cell references `z` +;;; in the DAG rooted at `cell` [c], effectively returning the total storage used by this DAG taking into account +;;; the identification of equal cells. +;;; The values of `x`, `y`, and `z` are computed by a depth-first traversal of this DAG, +;;; with a hash table of visited cell hashes used to prevent visits of already-visited cells. +;;; The total count of visited cells `x` cannot exceed non-negative [max_cells]; +;;; otherwise the computation is aborted before visiting the `(max_cells + 1)`-st cell and +;;; a zero flag is returned to indicate failure. If [c] is `null`, returns `x = y = z = 0`. (int, int, int) compute_data_size(cell c, int max_cells) impure asm "CDATASIZE"; + +;;; Similar to [compute_data_size?], but accepting a `slice` [s] instead of a `cell`. +;;; The returned value of `x` does not take into account the cell that contains the `slice` [s] itself; +;;; however, the data bits and the cell references of [s] are accounted for in `y` and `z`. (int, int, int) slice_compute_data_size(slice s, int max_cells) impure asm "SDATASIZE"; + +;;; A non-quiet version of [compute_data_size?] that throws a cell overflow exception (`8`) on failure. (int, int, int, int) compute_data_size?(cell c, int max_cells) asm "CDATASIZEQ NULLSWAPIFNOT2 NULLSWAPIFNOT"; + +;;; A non-quiet version of [slice_compute_data_size?] that throws a cell overflow exception (8) on failure. (int, int, int, int) slice_compute_data_size?(cell c, int max_cells) asm "SDATASIZEQ NULLSWAPIFNOT2 NULLSWAPIFNOT"; +;;; Throws an exception with exit_code excno if cond is not 0 (commented since implemented in compilator) ;; () throw_if(int excno, int cond) impure asm "THROWARGIF"; +{-- + # Debug primitives + Only works for local TVM execution with debug level verbosity +-} +;;; Dumps the stack (at most the top 255 values) and shows the total stack depth. () dump_stack() impure asm "DUMPSTK"; +{- + # Persistent storage save and load +-} + +;;; Returns the persistent contract storage cell. It can be parsed or modified with slice and builder primitives later. cell get_data() asm "c4 PUSH"; + +;;; Sets `cell` [c] as persistent contract data. You can update persistent contract storage with this primitive. () set_data(cell c) impure asm "c4 POP"; + +{- + # Continuation primitives +-} +;;; Usually `c3` has a continuation initialized by the whole code of the contract. It is used for function calls. +;;; The primitive returns the current value of `c3`. cont get_c3() impure asm "c3 PUSH"; + +;;; Updates the current value of `c3`. Usually, it is used for updating smart contract code in run-time. +;;; Note that after execution of this primitive the current code +;;; (and the stack of recursive function calls) won't change, +;;; but any other function call will use a function from the new code. () set_c3(cont c) impure asm "c3 POP"; + +;;; Transforms a `slice` [s] into a simple ordinary continuation `c`, with `c.code = s` and an empty stack and savelist. cont bless(slice s) impure asm "BLESS"; +{--- + # Gas related primitives +-} + +;;; Sets current gas limit `gl` to its maximal allowed value `gm`, and resets the gas credit `gc` to zero, +;;; decreasing the value of `gr` by `gc` in the process. +;;; In other words, the current smart contract agrees to buy some gas to finish the current transaction. +;;; This action is required to process external messages, which bring no value (hence no gas) with themselves. +;;; +;;; For more details check [accept_message effects](https://ton.org/docs/#/smart-contracts/accept). () accept_message() impure asm "ACCEPT"; + +;;; Sets current gas limit `gl` to the minimum of limit and `gm`, and resets the gas credit `gc` to zero. +;;; If the gas consumed so far (including the present instruction) exceeds the resulting value of `gl`, +;;; an (unhandled) out of gas exception is thrown before setting new gas limits. +;;; Notice that [set_gas_limit] with an argument `limit ≥ 2^63 − 1` is equivalent to [accept_message]. () set_gas_limit(int limit) impure asm "SETGASLIMIT"; + +;;; Commits the current state of registers `c4` (“persistent data”) and `c5` (“actions”) +;;; so that the current execution is considered “successful” with the saved values even if an exception +;;; in Computation Phase is thrown later. () commit() impure asm "COMMIT"; -() buy_gas(int gram) impure asm "BUYGAS"; +;;; Not implemented +;;() buy_gas(int gram) impure asm "BUYGAS"; + +;;; Computes the amount of gas that can be bought for `amount` nanoTONs, +;;; and sets `gl` accordingly in the same way as [set_gas_limit]. +() buy_gas(int amount) impure asm "BUYGAS"; + +;;; Computes the minimum of two integers [x] and [y]. int min(int x, int y) asm "MIN"; + +;;; Computes the maximum of two integers [x] and [y]. int max(int x, int y) asm "MAX"; + +;;; Sorts two integers. (int, int) minmax(int x, int y) asm "MINMAX"; + +;;; Computes the absolute value of an integer [x]. int abs(int x) asm "ABS"; +{- + # Slice primitives + + It is said that a primitive _loads_ some data, + if it returns the data and the remainder of the slice + (so it can also be used as [modifying method](https://ton.org/docs/#/func/statements?id=modifying-methods)). + + It is said that a primitive _preloads_ some data, if it returns only the data + (it can be used as [non-modifying method](https://ton.org/docs/#/func/statements?id=non-modifying-methods)). + + Unless otherwise stated, loading and preloading primitives read the data from a prefix of the slice. +-} + + +;;; Converts a `cell` [c] into a `slice`. Notice that [c] must be either an ordinary cell, +;;; or an exotic cell (see [TVM.pdf](https://ton-blockchain.github.io/docs/tvm.pdf), 3.1.2) +;;; which is automatically loaded to yield an ordinary cell `c'`, converted into a `slice` afterwards. slice begin_parse(cell c) asm "CTOS"; + +;;; Checks if [s] is empty. If not, throws an exception. () end_parse(slice s) impure asm "ENDS"; + +;;; Loads the first reference from the slice. (slice, cell) load_ref(slice s) asm( -> 1 0) "LDREF"; + +;;; Preloads the first reference from the slice. cell preload_ref(slice s) asm "PLDREF"; + + {- Functions below are commented because are implemented on compilator level for optimisation -} + +;;; Loads a signed [len]-bit integer from a slice [s]. ;; (slice, int) ~load_int(slice s, int len) asm(s len -> 1 0) "LDIX"; + +;;; Loads an unsigned [len]-bit integer from a slice [s]. ;; (slice, int) ~load_uint(slice s, int len) asm( -> 1 0) "LDUX"; + +;;; Preloads a signed [len]-bit integer from a slice [s]. ;; int preload_int(slice s, int len) asm "PLDIX"; + +;;; Preloads an unsigned [len]-bit integer from a slice [s]. ;; int preload_uint(slice s, int len) asm "PLDUX"; + +;;; Loads the first `0 ≤ len ≤ 1023` bits from slice [s] into a separate `slice s''`. ;; (slice, slice) load_bits(slice s, int len) asm(s len -> 1 0) "LDSLICEX"; + +;;; Preloads the first `0 ≤ len ≤ 1023` bits from slice [s] into a separate `slice s''`. ;; slice preload_bits(slice s, int len) asm "PLDSLICEX"; + +;;; Loads serialized amount of TonCoins (any unsigned integer up to `2^128 - 1`). (slice, int) load_grams(slice s) asm( -> 1 0) "LDGRAMS"; +(slice, int) load_coins(slice s) asm( -> 1 0) "LDGRAMS"; + +;;; Returns all but the first `0 ≤ len ≤ 1023` bits of `slice` [s]. slice skip_bits(slice s, int len) asm "SDSKIPFIRST"; (slice, ()) ~skip_bits(slice s, int len) asm "SDSKIPFIRST"; + +;;; Returns the first `0 ≤ len ≤ 1023` bits of `slice` [s]. slice first_bits(slice s, int len) asm "SDCUTFIRST"; + +;;; Returns all but the last `0 ≤ len ≤ 1023` bits of `slice` [s]. slice skip_last_bits(slice s, int len) asm "SDSKIPLAST"; (slice, ()) ~skip_last_bits(slice s, int len) asm "SDSKIPLAST"; + +;;; Returns the last `0 ≤ len ≤ 1023` bits of `slice` [s]. slice slice_last(slice s, int len) asm "SDCUTLAST"; + +;;; Loads a dictionary `D` (HashMapE) from `slice` [s]. +;;; (returns `null` if `nothing` constructor is used). (slice, cell) load_dict(slice s) asm( -> 1 0) "LDDICT"; + +;;; Preloads a dictionary `D` from `slice` [s]. cell preload_dict(slice s) asm "PLDDICT"; + +;;; Loads a dictionary as [load_dict], but returns only the remainder of the slice. slice skip_dict(slice s) asm "SKIPDICT"; +;;; Loads (Maybe ^Cell) from `slice` [s]. +;;; In other words loads 1 bit and if it is true +;;; loads first ref and return it with slice remainder +;;; otherwise returns `null` and slice remainder (slice, cell) load_maybe_ref(slice s) asm( -> 1 0) "LDOPTREF"; + +;;; Preloads (Maybe ^Cell) from `slice` [s]. cell preload_maybe_ref(slice s) asm "PLDOPTREF"; -builder store_maybe_ref(builder b, cell c) asm(c b) "STOPTREF"; + +;;; Returns the depth of `cell` [c]. +;;; If [c] has no references, then return `0`; +;;; otherwise the returned value is one plus the maximum of depths of cells referred to from [c]. +;;; If [c] is a `null` instead of a cell, returns zero. int cell_depth(cell c) asm "CDEPTH"; + +{- + # Slice size primitives +-} + +;;; Returns the number of references in `slice` [s]. int slice_refs(slice s) asm "SREFS"; + +;;; Returns the number of data bits in `slice` [s]. int slice_bits(slice s) asm "SBITS"; + +;;; Returns both the number of data bits and the number of references in `slice` [s]. (int, int) slice_bits_refs(slice s) asm "SBITREFS"; + +;;; Checks whether a `slice` [s] is empty (i.e., contains no bits of data and no cell references). int slice_empty?(slice s) asm "SEMPTY"; + +;;; Checks whether `slice` [s] has no bits of data. int slice_data_empty?(slice s) asm "SDEMPTY"; + +;;; Checks whether `slice` [s] has no references. int slice_refs_empty?(slice s) asm "SREMPTY"; + +;;; Returns the depth of `slice` [s]. +;;; If [s] has no references, then returns `0`; +;;; otherwise the returned value is one plus the maximum of depths of cells referred to from [s]. int slice_depth(slice s) asm "SDEPTH"; +{- + # Builder size primitives +-} + +;;; Returns the number of cell references already stored in `builder` [b] int builder_refs(builder b) asm "BREFS"; + +;;; Returns the number of data bits already stored in `builder` [b]. int builder_bits(builder b) asm "BBITS"; + +;;; Returns the depth of `builder` [b]. +;;; If no cell references are stored in [b], then returns 0; +;;; otherwise the returned value is one plus the maximum of depths of cells referred to from [b]. int builder_depth(builder b) asm "BDEPTH"; +{- + # Builder primitives + It is said that a primitive _stores_ a value `x` into a builder `b` + if it returns a modified version of the builder `b'` with the value `x` stored at the end of it. + It can be used as [non-modifying method](https://ton.org/docs/#/func/statements?id=non-modifying-methods). + + All the primitives below first check whether there is enough space in the `builder`, + and only then check the range of the value being serialized. +-} + +;;; Creates a new empty `builder`. builder begin_cell() asm "NEWC"; + +;;; Converts a `builder` into an ordinary `cell`. cell end_cell(builder b) asm "ENDC"; + +;;; Stores a reference to `cell` [c] into `builder` [b]. builder store_ref(builder b, cell c) asm(c b) "STREF"; + +;;; Stores an unsigned [len]-bit integer `x` into `b` for `0 ≤ len ≤ 256`. ;; builder store_uint(builder b, int x, int len) asm(x b len) "STUX"; + +;;; Stores a signed [len]-bit integer `x` into `b` for` 0 ≤ len ≤ 257`. ;; builder store_int(builder b, int x, int len) asm(x b len) "STIX"; + + +;;; Stores `slice` [s] into `builder` [b] builder store_slice(builder b, slice s) asm "STSLICER"; + +;;; Stores (serializes) an integer [x] in the range `0..2^128 − 1` into `builder` [b]. +;;; The serialization of [x] consists of a 4-bit unsigned big-endian integer `l`, +;;; which is the smallest integer `l ≥ 0`, such that `x < 2^8l`, +;;; followed by an `8l`-bit unsigned big-endian representation of [x]. +;;; If [x] does not belong to the supported range, a range check exception is thrown. +;;; +;;; Store amounts of TonCoins to the builder as VarUInteger 16 builder store_grams(builder b, int x) asm "STGRAMS"; +builder store_coins(builder b, int x) asm "STGRAMS"; + +;;; Stores dictionary `D` represented by `cell` [c] or `null` into `builder` [b]. +;;; In other words, stores a `1`-bit and a reference to [c] if [c] is not `null` and `0`-bit otherwise. builder store_dict(builder b, cell c) asm(c b) "STDICT"; +;;; Stores (Maybe ^Cell) to builder: +;;; if cell is null store 1 zero bit +;;; otherwise store 1 true bit and ref to cell +builder store_maybe_ref(builder b, cell c) asm(c b) "STOPTREF"; + + +{- + # Address manipulation primitives + The address manipulation primitives listed below serialize and deserialize values according to the following TL-B scheme: + ```TL-B + addr_none$00 = MsgAddressExt; + addr_extern$01 len:(## 8) external_address:(bits len) + = MsgAddressExt; + anycast_info$_ depth:(#<= 30) { depth >= 1 } + rewrite_pfx:(bits depth) = Anycast; + addr_std$10 anycast:(Maybe Anycast) + workchain_id:int8 address:bits256 = MsgAddressInt; + addr_var$11 anycast:(Maybe Anycast) addr_len:(## 9) + workchain_id:int32 address:(bits addr_len) = MsgAddressInt; + _ _:MsgAddressInt = MsgAddress; + _ _:MsgAddressExt = MsgAddress; + + int_msg_info$0 ihr_disabled:Bool bounce:Bool bounced:Bool + src:MsgAddress dest:MsgAddressInt + value:CurrencyCollection ihr_fee:Grams fwd_fee:Grams + created_lt:uint64 created_at:uint32 = CommonMsgInfoRelaxed; + ext_out_msg_info$11 src:MsgAddress dest:MsgAddressExt + created_lt:uint64 created_at:uint32 = CommonMsgInfoRelaxed; + ``` + A deserialized `MsgAddress` is represented by a tuple `t` as follows: + + - `addr_none` is represented by `t = (0)`, + i.e., a tuple containing exactly one integer equal to zero. + - `addr_extern` is represented by `t = (1, s)`, + where slice `s` contains the field `external_address`. In other words, ` + t` is a pair (a tuple consisting of two entries), containing an integer equal to one and slice `s`. + - `addr_std` is represented by `t = (2, u, x, s)`, + where `u` is either a `null` (if `anycast` is absent) or a slice `s'` containing `rewrite_pfx` (if anycast is present). + Next, integer `x` is the `workchain_id`, and slice `s` contains the address. + - `addr_var` is represented by `t = (3, u, x, s)`, + where `u`, `x`, and `s` have the same meaning as for `addr_std`. +-} + +;;; Loads from slice [s] the only prefix that is a valid `MsgAddress`, +;;; and returns both this prefix `s'` and the remainder `s''` of [s] as slices. (slice, slice) load_msg_addr(slice s) asm( -> 1 0) "LDMSGADDR"; + +;;; Decomposes slice [s] containing a valid `MsgAddress` into a `tuple t` with separate fields of this `MsgAddress`. +;;; If [s] is not a valid `MsgAddress`, a cell deserialization exception is thrown. tuple parse_addr(slice s) asm "PARSEMSGADDR"; + +;;; Parses slice [s] containing a valid `MsgAddressInt` (usually a `msg_addr_std`), +;;; applies rewriting from the anycast (if present) to the same-length prefix of the address, +;;; and returns both the workchain and the 256-bit address as integers. +;;; If the address is not 256-bit, or if [s] is not a valid serialization of `MsgAddressInt`, +;;; throws a cell deserialization exception. (int, int) parse_std_addr(slice s) asm "REWRITESTDADDR"; + +;;; A variant of [parse_std_addr] that returns the (rewritten) address as a slice [s], +;;; even if it is not exactly 256 bit long (represented by a `msg_addr_var`). (int, slice) parse_var_addr(slice s) asm "REWRITEVARADDR"; +{- + # Dictionary primitives +-} + + +;;; Sets the value associated with [key_len]-bit key signed index in dictionary [dict] to [value] (cell), +;;; and returns the resulting dictionary. cell idict_set_ref(cell dict, int key_len, int index, cell value) asm(value index dict key_len) "DICTISETREF"; (cell, ()) ~idict_set_ref(cell dict, int key_len, int index, cell value) asm(value index dict key_len) "DICTISETREF"; + +;;; Sets the value associated with [key_len]-bit key unsigned index in dictionary [dict] to [value] (cell), +;;; and returns the resulting dictionary. cell udict_set_ref(cell dict, int key_len, int index, cell value) asm(value index dict key_len) "DICTUSETREF"; (cell, ()) ~udict_set_ref(cell dict, int key_len, int index, cell value) asm(value index dict key_len) "DICTUSETREF"; + cell idict_get_ref(cell dict, int key_len, int index) asm(index dict key_len) "DICTIGETOPTREF"; -(cell, int) idict_get_ref?(cell dict, int key_len, int index) asm(index dict key_len) "DICTIGETREF"; -(cell, int) udict_get_ref?(cell dict, int key_len, int index) asm(index dict key_len) "DICTUGETREF"; +(cell, int) idict_get_ref?(cell dict, int key_len, int index) asm(index dict key_len) "DICTIGETREF" "NULLSWAPIFNOT"; +(cell, int) udict_get_ref?(cell dict, int key_len, int index) asm(index dict key_len) "DICTUGETREF" "NULLSWAPIFNOT"; (cell, cell) idict_set_get_ref(cell dict, int key_len, int index, cell value) asm(value index dict key_len) "DICTISETGETOPTREF"; (cell, cell) udict_set_get_ref(cell dict, int key_len, int index, cell value) asm(value index dict key_len) "DICTUSETGETOPTREF"; (cell, int) idict_delete?(cell dict, int key_len, int index) asm(index dict key_len) "DICTIDEL"; @@ -185,25 +578,47 @@ cell dict_set_builder(cell dict, int key_len, slice index, builder value) asm(va (int, slice, int) idict_get_nexteq?(cell dict, int key_len, int pivot) asm(pivot dict key_len -> 1 0 2) "DICTIGETNEXTEQ" "NULLSWAPIFNOT2"; (int, slice, int) idict_get_prev?(cell dict, int key_len, int pivot) asm(pivot dict key_len -> 1 0 2) "DICTIGETPREV" "NULLSWAPIFNOT2"; (int, slice, int) idict_get_preveq?(cell dict, int key_len, int pivot) asm(pivot dict key_len -> 1 0 2) "DICTIGETPREVEQ" "NULLSWAPIFNOT2"; + +;;; Creates an empty dictionary, which is actually a null value. Equivalent to PUSHNULL cell new_dict() asm "NEWDICT"; +;;; Checks whether a dictionary is empty. Equivalent to cell_null?. int dict_empty?(cell c) asm "DICTEMPTY"; + +{- Prefix dictionary primitives -} (slice, slice, slice, int) pfxdict_get?(cell dict, int key_len, slice key) asm(key dict key_len) "PFXDICTGETQ" "NULLSWAPIFNOT2"; (cell, int) pfxdict_set?(cell dict, int key_len, slice key, slice value) asm(value key dict key_len) "PFXDICTSET"; (cell, int) pfxdict_delete?(cell dict, int key_len, slice key) asm(key dict key_len) "PFXDICTDEL"; +;;; Returns the value of the global configuration parameter with integer index `i` as a `cell` or `null` value. cell config_param(int x) asm "CONFIGOPTPARAM"; +;;; Checks whether c is a null. Note, that FunC also has polymorphic null? built-in. int cell_null?(cell c) asm "ISNULL"; +;;; Creates an output action which would reserve exactly amount nanotoncoins (if mode = 0), at most amount nanotoncoins (if mode = 2), or all but amount nanotoncoins (if mode = 1 or mode = 3), from the remaining balance of the account. It is roughly equivalent to creating an outbound message carrying amount nanotoncoins (or b − amount nanotoncoins, where b is the remaining balance) to oneself, so that the subsequent output actions would not be able to spend more money than the remainder. Bit +2 in mode means that the external action does not fail if the specified amount cannot be reserved; instead, all remaining balance is reserved. Bit +8 in mode means `amount <- -amount` before performing any further actions. Bit +4 in mode means that amount is increased by the original balance of the current account (before the compute phase), including all extra currencies, before performing any other checks and actions. Currently, amount must be a non-negative integer, and mode must be in the range 0..15. () raw_reserve(int amount, int mode) impure asm "RAWRESERVE"; +;;; Similar to raw_reserve, but also accepts a dictionary extra_amount (represented by a cell or null) with extra currencies. In this way currencies other than TonCoin can be reserved. () raw_reserve_extra(int amount, cell extra_amount, int mode) impure asm "RAWRESERVEX"; +;;; Sends a raw message contained in msg, which should contain a correctly serialized object Message X, with the only exception that the source address is allowed to have dummy value addr_none (to be automatically replaced with the current smart contract address), and ihr_fee, fwd_fee, created_lt and created_at fields can have arbitrary values (to be rewritten with correct values during the action phase of the current transaction). Integer parameter mode contains the flags. Currently mode = 0 is used for ordinary messages; mode = 128 is used for messages that are to carry all the remaining balance of the current smart contract (instead of the value originally indicated in the message); mode = 64 is used for messages that carry all the remaining value of the inbound message in addition to the value initially indicated in the new message (if bit 0 is not set, the gas fees are deducted from this amount); mode' = mode + 1 means that the sender wants to pay transfer fees separately; mode' = mode + 2 means that any errors arising while processing this message during the action phase should be ignored. Finally, mode' = mode + 32 means that the current account must be destroyed if its resulting balance is zero. This flag is usually employed together with +128. () send_raw_message(cell msg, int mode) impure asm "SENDRAWMSG"; +;;; Creates an output action that would change this smart contract code to that given by cell new_code. Notice that this change will take effect only after the successful termination of the current run of the smart contract () set_code(cell new_code) impure asm "SETCODE"; +;;; Generates a new pseudo-random unsigned 256-bit integer x. The algorithm is as follows: if r is the old value of the random seed, considered as a 32-byte array (by constructing the big-endian representation of an unsigned 256-bit integer), then its sha512(r) is computed; the first 32 bytes of this hash are stored as the new value r' of the random seed, and the remaining 32 bytes are returned as the next random value x. int random() impure asm "RANDU256"; +;;; Generates a new pseudo-random integer z in the range 0..range−1 (or range..−1, if range < 0). More precisely, an unsigned random value x is generated as in random; then z := x * range / 2^256 is computed. int rand(int range) impure asm "RAND"; +;;; Returns the current random seed as an unsigned 256-bit Integer. int get_seed() impure asm "RANDSEED"; -int set_seed() impure asm "SETRAND"; +;;; Sets the random seed to unsigned 256-bit seed. +() set_seed(int) impure asm "SETRAND"; +;;; Mixes unsigned 256-bit integer x into the random seed r by setting the random seed to sha256 of the concatenation of two 32-byte strings: the first with the big-endian representation of the old seed r, and the second with the big-endian representation of x. () randomize(int x) impure asm "ADDRAND"; +;;; Equivalent to randomize(cur_lt());. () randomize_lt() impure asm "LTIME" "ADDRAND"; +;;; Checks whether the data parts of two slices coinside +int equal_slices(slice a, slice b) asm "SDEQ"; + +;;; Concatenates two builders +builder store_builder(builder to, builder from) asm "STBR"; diff --git a/func/wallet-v4-code.fc b/func/wallet-v4-code.fc deleted file mode 100644 index 6fc2f40..0000000 --- a/func/wallet-v4-code.fc +++ /dev/null @@ -1,198 +0,0 @@ -#pragma version =0.2.0; -;; Wallet smart contract with plugins - -(slice, int) dict_get?(cell dict, int key_len, slice index) asm(index dict key_len) "DICTGET" "NULLSWAPIFNOT"; -(cell, int) dict_add_builder?(cell dict, int key_len, slice index, builder value) asm(value index dict key_len) "DICTADDB"; -(cell, int) dict_delete?(cell dict, int key_len, slice index) asm(index dict key_len) "DICTDEL"; - -() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { - var cs = in_msg_cell.begin_parse(); - var flags = cs~load_uint(4); ;; int_msg_info$0 ihr_disabled:Bool bounce:Bool bounced:Bool - if (flags & 1) { - ;; ignore all bounced messages - return (); - } - if (in_msg.slice_bits() < 32) { - ;; ignore simple transfers - return (); - } - int op = in_msg~load_uint(32); - if (op != 0x706c7567) & (op != 0x64737472) { ;; "plug" & "dstr" - ;; ignore all messages not related to plugins - return (); - } - slice s_addr = cs~load_msg_addr(); - (int wc, int addr_hash) = parse_std_addr(s_addr); - slice wc_n_address = begin_cell().store_int(wc, 8).store_uint(addr_hash, 256).end_cell().begin_parse(); - var ds = get_data().begin_parse().skip_bits(32 + 32 + 256); - var plugins = ds~load_dict(); - var (_, success?) = plugins.dict_get?(8 + 256, wc_n_address); - if ~(success?) { - ;; it may be a transfer - return (); - } - int query_id = in_msg~load_uint(64); - var msg = begin_cell(); - if (op == 0x706c7567) { ;; request funds - - (int r_toncoins, cell r_extra) = (in_msg~load_grams(), in_msg~load_dict()); - - [int my_balance, _] = get_balance(); - throw_unless(80, my_balance - msg_value >= r_toncoins); - - msg = msg.store_uint(0x18, 6) - .store_slice(s_addr) - .store_grams(r_toncoins) - .store_dict(r_extra) - .store_uint(0, 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x706c7567 | 0x80000000, 32) - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 64); - - } - - if (op == 0x64737472) { ;; remove plugin by its request - - plugins~dict_delete?(8 + 256, wc_n_address); - var ds = get_data().begin_parse().first_bits(32 + 32 + 256); - set_data(begin_cell().store_slice(ds).store_dict(plugins).end_cell()); - ;; return coins only if bounce expected - if (flags & 2) { - msg = msg.store_uint(0x18, 6) - .store_slice(s_addr) - .store_grams(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x64737472 | 0x80000000, 32) - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 64); - } - } -} - -() recv_external(slice in_msg) impure { - var signature = in_msg~load_bits(512); - var cs = in_msg; - var (subwallet_id, valid_until, msg_seqno) = (cs~load_uint(32), cs~load_uint(32), cs~load_uint(32)); - throw_if(36, valid_until <= now()); - var ds = get_data().begin_parse(); - var (stored_seqno, stored_subwallet, public_key, plugins) = (ds~load_uint(32), ds~load_uint(32), ds~load_uint(256), ds~load_dict()); - ds.end_parse(); - throw_unless(33, msg_seqno == stored_seqno); - throw_unless(34, subwallet_id == stored_subwallet); - throw_unless(35, check_signature(slice_hash(in_msg), signature, public_key)); - accept_message(); - set_data(begin_cell() - .store_uint(stored_seqno + 1, 32) - .store_uint(stored_subwallet, 32) - .store_uint(public_key, 256) - .store_dict(plugins) - .end_cell()); - commit(); - cs~touch(); - int op = cs~load_uint(8); - - if (op == 0) { ;; simple send - while (cs.slice_refs()) { - var mode = cs~load_uint(8); - send_raw_message(cs~load_ref(), mode); - } - return (); ;; have already saved the storage - } - - if (op == 1) { ;; deploy and install plugin - int plugin_workchain = cs~load_int(8); - int plugin_balance = cs~load_grams(); - (cell state_init, cell body) = (cs~load_ref(), cs~load_ref()); - int plugin_address = cell_hash(state_init); - slice wc_n_address = begin_cell().store_int(plugin_workchain, 8).store_uint(plugin_address, 256).end_cell().begin_parse(); - var msg = begin_cell() - .store_uint(0x18, 6) - .store_uint(4, 3).store_slice(wc_n_address) - .store_grams(plugin_balance) - .store_uint(4 + 2 + 1, 1 + 4 + 4 + 64 + 32 + 1 + 1 + 1) - .store_ref(state_init) - .store_ref(body); - send_raw_message(msg.end_cell(), 3); - (plugins, int success?) = plugins.dict_add_builder?(8 + 256, wc_n_address, begin_cell()); - throw_unless(39, success?); - } - - if (op == 2) { ;; install plugin - slice wc_n_address = cs~load_bits(8 + 256); - int amount = cs~load_grams(); - int query_id = cs~load_uint(64); - - (plugins, int success?) = plugins.dict_add_builder?(8 + 256, wc_n_address, begin_cell()); - throw_unless(39, success?); - - builder msg = begin_cell() - .store_uint(0x18, 6) - .store_uint(4, 3).store_slice(wc_n_address) - .store_grams(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x6e6f7465, 32) ;; op - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 3); - } - - if (op == 3) { ;; remove plugin - slice wc_n_address = cs~load_bits(8 + 256); - int amount = cs~load_grams(); - int query_id = cs~load_uint(64); - - (plugins, int success?) = plugins.dict_delete?(8 + 256, wc_n_address); - throw_unless(39, success?); - - builder msg = begin_cell() - .store_uint(0x18, 6) - .store_uint(4, 3).store_slice(wc_n_address) - .store_grams(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x64737472, 32) ;; op - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 3); - } - - set_data(begin_cell() - .store_uint(stored_seqno + 1, 32) - .store_uint(stored_subwallet, 32) - .store_uint(public_key, 256) - .store_dict(plugins) - .end_cell()); -} - -;; Get methods - -int seqno() method_id { - return get_data().begin_parse().preload_uint(32); -} - -int get_subwallet_id() method_id { - return get_data().begin_parse().skip_bits(32).preload_uint(32); -} - -int get_public_key() method_id { - var cs = get_data().begin_parse().skip_bits(64); - return cs.preload_uint(256); -} - -int is_plugin_installed(int wc, int addr_hash) method_id { - var ds = get_data().begin_parse().skip_bits(32 + 32 + 256); - var plugins = ds~load_dict(); - var (_, success?) = plugins.dict_get?(8 + 256, begin_cell().store_int(wc, 8).store_uint(addr_hash, 256).end_cell().begin_parse()); - return success?; -} - -tuple get_plugin_list() method_id { - var list = null(); - var ds = get_data().begin_parse().skip_bits(32 + 32 + 256); - var plugins = ds~load_dict(); - do { - var (wc_n_address, _, f) = plugins~dict::delete_get_min(8 + 256); - if (f) { - (int wc, int addr) = (wc_n_address~load_int(8), wc_n_address~load_uint(256)); - list = cons(pair(wc, addr), list); - } - } until (~ f); - return list; -} diff --git a/func/wallet-v5-code.fc b/func/wallet-v5-code.fc deleted file mode 100644 index 871e63c..0000000 --- a/func/wallet-v5-code.fc +++ /dev/null @@ -1,200 +0,0 @@ -#pragma version >=0.4.0; -;; Wallet smart contract with plugins - -(slice, int) dict_get?(cell dict, int key_len, slice index) asm(index dict key_len) "DICTGET" "NULLSWAPIFNOT"; -(cell, int) dict_add_builder?(cell dict, int key_len, slice index, builder value) asm(value index dict key_len) "DICTADDB"; -(cell, int) dict_delete?(cell dict, int key_len, slice index) asm(index dict key_len) "DICTDEL"; - -() terminate_if(int cond) impure asm "IFRETALT"; -() terminate() impure asm "RETALT"; -() call_cont(cont) impure asm "CALLX"; - - -() recv_internal(int msg_value, cell in_msg_cell, slice in_msg) impure { - var cs = in_msg_cell.begin_parse(); - var flags = cs~load_uint(4); ;; int_msg_info$0 ihr_disabled:Bool bounce:Bool bounced:Bool - terminate_if(flags & 1); ;; ignore all bounced messages - terminate_if(in_msg.slice_bits() < 32); ;; ignore simple transfers - - int op = in_msg~load_uint(32); - terminate_if((op != 0x706c7567) & (op != 0x65786563) & (op != 0x64737472)); - ;; ignore all messages not related to plugins ("plug"/"exec"/"dstr") - - slice sender_addr = cs~load_msg_addr(); - terminate_if(s_addr~load_bits(3) != 4); ;; addr_std$10 anycast:0 - var ds = get_data().begin_parse().skip_bits(32 + 32 + 256); - var plugins = ds~load_dict(); - var (_, success?) = plugins.dict_get?(8 + 256, sender_addr); - terminate_if(~ success?); - - int query_id = in_msg~load_uint(64); - var msg = begin_cell(); - if (op == 0x706c7567) { ;; request funds - (int r_toncoins, cell r_extra) = (in_msg~load_grams(), in_msg~load_dict()); - - [int my_balance, _] = get_balance(); - throw_unless(80, my_balance - msg_value >= r_toncoins); - - msg = msg.store_uint(0x18, 6) - .store_slice(sender_addr) - .store_grams(r_toncoins) - .store_dict(r_extra) - .store_uint(0, 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x706c7567 | 0x80000000, 32) - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 64); - } - if (op == 0x65786563) { ;; execute arbitrary code by plugin request - in_msg.preload_ref().begin_parse().bless().call_cont(); - } - if (op == 0x64737472) { ;; remove plugin by its request - plugins~dict_delete?(8 + 256, sender_addr); - var ds = get_data().begin_parse().first_bits(32 + 32 + 256); - set_data(begin_cell().store_slice(ds).store_dict(plugins).end_cell()); - ;; return coins only if bounce expected - if (flags & 2) { - msg = msg.store_uint(0x18, 6) - .store_slice(sender_addr) - .store_grams(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x64737472 | 0x80000000, 32) - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 64); - } - } -} - -() recv_external(slice in_msg) impure { - var signature = in_msg~load_bits(512); - var cs = in_msg; - var (subwallet_id, valid_until, msg_seqno) = (cs~load_uint(32), cs~load_uint(32), cs~load_uint(32)); - throw_if(36, valid_until <= now()); - var ds = get_data().begin_parse(); - var (stored_seqno, stored_subwallet, public_key, plugins) = (ds~load_uint(32), ds~load_uint(32), ds~load_uint(256), ds~load_dict()); - ds.end_parse(); - throw_unless(33, msg_seqno == stored_seqno); - throw_unless(34, subwallet_id == stored_subwallet); - throw_unless(35, check_signature(slice_hash(in_msg), signature, public_key)); - accept_message(); - set_data(begin_cell() - .store_uint(stored_seqno + 1, 32) - .store_uint(stored_subwallet, 32) - .store_uint(public_key, 256) - .store_dict(plugins) - .end_cell()); - commit(); - cs~touch(); - int op = cs~load_uint(8); - - if (op == 0) { ;; simple send - while (cs.slice_refs()) { - var mode = cs~load_uint(8); - send_raw_message(cs~load_ref(), mode); - } - terminate(); ;; have already saved the storage - } - - if (op == 1) { ;; deploy and install plugin - int plugin_workchain = cs~load_int(8); - int plugin_balance = cs~load_grams(); - (cell state_init, cell body) = (cs~load_ref(), cs~load_ref()); - int plugin_address = cell_hash(state_init); - slice wc_n_address = begin_cell().store_int(plugin_workchain, 8).store_uint(plugin_address, 256).end_cell().begin_parse(); - var msg = begin_cell() - .store_uint((0x18 << 3) + 4, 6 + 3) - .store_slice(wc_n_address) - .store_grams(plugin_balance) - .store_uint(4 + 2 + 1, 1 + 4 + 4 + 64 + 32 + 1 + 1 + 1) - .store_ref(state_init) - .store_ref(body); - send_raw_message(msg.end_cell(), 3); - (plugins, int success?) = plugins.dict_add_builder?(8 + 256, wc_n_address, begin_cell()); - throw_unless(39, success?); - } - - if (op == 2) { ;; install plugin - slice wc_n_address = cs~load_bits(8 + 256); - int amount = cs~load_grams(); - int query_id = cs~load_uint(64); - - (plugins, int success?) = plugins.dict_add_builder?(8 + 256, wc_n_address, begin_cell()); - throw_unless(39, success?); - - builder msg = begin_cell() - .store_uint(0x18, 6) - .store_uint(4, 3).store_slice(wc_n_address) - .store_grams(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x6e6f7465, 32) ;; op - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 3); - } - - if (op == 3) { ;; remove plugin - slice wc_n_address = cs~load_bits(8 + 256); - int amount = cs~load_grams(); - int query_id = cs~load_uint(64); - - (plugins, int success?) = plugins.dict_delete?(8 + 256, wc_n_address); - throw_unless(39, success?); - - builder msg = begin_cell() - .store_uint(0x18, 6) - .store_uint(4, 3).store_slice(wc_n_address) - .store_grams(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_uint(0x64737472, 32) ;; op - .store_uint(query_id, 64); - send_raw_message(msg.end_cell(), 3); - } - - if (op == 4) { ;; execute arbitrary code onchain - cell code = cs~load_ref(); - cs.end_parse(); - - code.begin_parse().bless().call_cont(); - } - - set_data(begin_cell() - .store_uint(stored_seqno + 1, 32) - .store_uint(stored_subwallet, 32) - .store_uint(public_key, 256) - .store_dict(plugins) - .end_cell()); -} - -;; Get methods - -int seqno() method_id { - return get_data().begin_parse().preload_uint(32); -} - -int get_subwallet_id() method_id { - return get_data().begin_parse().skip_bits(32).preload_uint(32); -} - -int get_public_key() method_id { - var cs = get_data().begin_parse().skip_bits(64); - return cs.preload_uint(256); -} - -int is_plugin_installed(int wc, int addr_hash) method_id { - var ds = get_data().begin_parse().skip_bits(32 + 32 + 256); - var plugins = ds~load_dict(); - var (_, success?) = plugins.dict_get?(8 + 256, begin_cell().store_int(wc, 8).store_uint(addr_hash, 256).end_cell().begin_parse()); - return success?; -} - -tuple get_plugin_list() method_id { - var list = null(); - var ds = get_data().begin_parse().skip_bits(32 + 32 + 256); - var plugins = ds~load_dict(); - do { - var (wc_n_address, _, f) = plugins~dict::delete_get_min(8 + 256); - if (f) { - (int wc, int addr) = (wc_n_address~load_int(8), wc_n_address~load_uint(256)); - list = cons(pair(wc, addr), list); - } - } until (~ f); - return list; -} diff --git a/func/wallet.fc b/func/wallet.fc new file mode 100644 index 0000000..b83ec74 --- /dev/null +++ b/func/wallet.fc @@ -0,0 +1,285 @@ +cell end_exotic(builder b) impure asm "ONE ENDXC"; +forall X, Y -> Y unsafe::transmute(X) asm "NOP"; +int equal_slices(slice a, slice b) asm "SDEQ"; +() terminate_if(int) impure asm "IFRETALT"; +() terminate() impure asm "RETALT"; + +() _dump_used_gas() impure asm "GASCONSUMED s0 DUMP DROP" + "4445 PUSHINT s0 DUMP DROP" + "137416471408024662391516318541024342064 PUSHINT s0 DUMP DROP"; +() dump_used_gas() asm "NOP"; + +;; -------------------------- STORAGE FEE CALCULATION -------------------------- + +int calc_storage_fee_raw(int cells, int bits, int time) inline { + (slice prices, _) = config_param(18).idict_get?(32, 0); + ;; _#cc utime_since:uint32 bit_price_ps:uint64 cell_price_ps:uint64 + ;; mc_bit_price_ps:uint64 mc_cell_price_ps:uint64 + prices~skip_bits(168); + int base_fee = prices~load_uint(64) * bits; + base_fee += prices~load_uint(64) * cells; + return base_fee * time / 65536; +} +int calc_storage_fee(cell in, int time) inline { + (int cells, int bits, _) = in.compute_data_size(100000); + return calc_storage_fee_raw(cells, bits, time); +} + +const int storage_time = 86400 * 365; +const int milliton = 1000000; + +;; -------------------------- NON-ISOLATED EXECUTION --------------------------- + +;; no need to RUNVM; the plugin is trusted code anyway +tuple invoke(cont f, tuple args, int method) impure asm + "TPUSH" "DEPTH DEC DEC 30 SETGLOB" "255 PUSHINT EXPLODEVAR" "DUP INC" "ROLLX" + "SWAP" "TRUE" "CALLXVARARGS" + "DEPTH 30 GETGLOB SUB TUPLEVAR"; + +;; ---------------------------------- STORAGE ---------------------------------- + +const int op::invoke_onchain = 0x6908c994; +const int op::install_plugin = 0x79ae2d9f; +const int op::uninstall_plugin = 0x01fabff6; + +const int op::invoke_plugin = 0x44d562b5; +const int op::do_signed = 0x45094bf5; +const int op::store_success = 0xc3ffd44f; + +const slice lib_registry = "Ef_lEr_pCYfPDQlBra7-nnJJECv36xGsLqKnbTP-ISfymP0e"a; + +global cell plugins_storage; + +;; invoke_onchain#6908c994 code:^Cell next:(Maybe ^Action) = Action; +;; install_plugin#79ae2d9f code:^Cell next:(Maybe ^Action) = Action; +;; uninstall_plugin#01fabff6 id:uint256 next:(Maybe ^Action) = Action; +;; transfer#3ee943f1 message:^Cell mode:uint8 next:(Maybe ^Action) = Action; + +;; do_signed#45094bf5 signature:? request:^[uid:uint64 do:(Maybe ^Action)] = ExtInMsgBody; +;; invoke_plugin#44d562b5 id:uint256 data:Any = ExtInMsgBody; + +;; store_success#c3ffd44f id:uint256 = IntInMsgBody; +;; invoke_plugin#44d562b5 id:uint256 data:Any = IntInMsgBody; + +;; request_store#43ffd44f library:^Cell = OutMsgBody; + +(int, cell, int, slice) load_contract() impure inline { + ;; key::public::ed25519#0080de4f key:bits256 = Key; + ;; key::public::bls#4d54d8d4 key:bits384 = Key; + ;; key::public::secp256r1#64ddebeb key:bits264 = Key; + + ;; recommended for plugins: + ;; key::hash::sha256#c8a47409 hash:bits256 = Key; + ;; key::hash::sha512#aeea6391 hash:bits512 = Key; + ;; key::hash::blake2b#ec478dd9 hash:bits512 = Key; + ;; key::hash::keccak256#88b8de30 hash:bits256 = Key; + ;; key::hash::keccak512#eef6c9a8 hash:bits512 = Key; + + ;; _ uid:{subwallet_id:uint32 seqno:uint32} plugins:(HashmapE 256 ^Cell) + ;; plugins_storage:(HashmapE 256 ^Cell) owner_key:Key = Storage; + slice ds = get_data().begin_parse(); + int uid = ds~load_uint(64); + cell plugins = ds~load_dict(); + plugins_storage = ds~load_dict(); + int key_type = ds~load_uint(32); + return (uid, plugins, key_type, ds); +} + +() save_contract(int uid, cell plugins, int key_type, slice key) impure inline { + set_data(begin_cell().store_uint(uid, 64).store_dict(plugins).store_dict(plugins_storage).store_uint(key_type, 32).store_slice(key).end_cell()); +} +;; -------------------------------- GET-METHODS -------------------------------- + +int seqno() method_id { + (int uid, _, _, _) = load_contract(); + return uid; +} +(slice, int) get_public_key() method_id { + (_, _, int key_type, slice key) = load_contract(); + return (key, key_type); +} +int is_plugin_installed(int hash) method_id { + (_, cell plugins, _, _) = load_contract(); + (_, int found) = plugins.udict_get_ref?(256, hash); + return found; +} +cell get_plugin_cell(int hash) method_id { + (_, cell plugins, _, _) = load_contract(); + (cell plugin, _) = plugins.udict_get_ref?(256, hash); + return plugin; +} +cell get_plugin_storage(int hash) method_id { + load_contract(); + (cell plugin_data, _) = plugins_storage.udict_get_ref?(256, hash); + return plugin_data; +} +slice resolve_plugin(int hash) method_id { + (_, cell plugins, _, _) = load_contract(); + (cell plugin, _) = plugins.udict_get_ref?(256, hash); + return plugin.begin_parse(); +} +tuple get_plugin_list() method_id { + tuple list = empty_tuple(); (_, cell plugins, _, _) = load_contract(); + while (~ cell_null?(plugins)) { + (int hash, _, _) = plugins~udict::delete_get_min(256); + list = cons(hash, list); + } + return list; +} +tuple get_plugin_list_with_cell() method_id { + tuple list = empty_tuple(); (_, cell plugins, _, _) = load_contract(); + while (~ cell_null?(plugins)) { + (int hash, slice plugin, _) = plugins~udict::delete_get_min(256); + list = cons(pair(hash, plugin.preload_ref()), list); + } + return list; +} +tuple get_plugin_list_resolved() method_id { + tuple list = empty_tuple(); (_, cell plugins, _, _) = load_contract(); + while (~ cell_null?(plugins)) { + (int hash, slice plugin, _) = plugins~udict::delete_get_min(256); + list = cons(pair(hash, plugin.preload_ref().begin_parse()), list); + } + return list; +} +tuple get_plugin_list_resolved_with_storage() method_id { + tuple list = empty_tuple(); (_, cell plugins, _, _) = load_contract(); + while (~ cell_null?(plugins)) { + (int hash, slice plugin, _) = plugins~udict::delete_get_min(256); + (cell data, _) = plugins_storage.udict_get_ref?(256, hash); + list = cons(triple(hash, plugin.preload_ref().begin_parse(), data), list); + } + return list; +} + +;; ------------------------- SIGNATURE CHECKING METHOD ------------------------- + +int check_secp256r1(int signed, slice signature, slice key) asm "P256_CHKSIGNU"; +int check_bls(slice signed, slice signature, slice key) asm "-ROLL ONE SWAP BLS_AGGREGATEVERIFY"; + +cell check_any_signature(slice in_msg_body, int key_type, slice key) impure inline { + cell request = in_msg_body~load_ref(); + int request_hash = request.cell_hash(); + + if (key_type == 0x0080de4f) { + throw_unless(310, check_signature(request_hash, in_msg_body, key.preload_uint(256))); + } elseif (key_type == 0x64ddebeb) { + throw_unless(310, check_secp256r1(request_hash, in_msg_body, key)); + ;; } elseif (key_type == 0x4d54d8d4) { + ;; slice request_hash = begin_cell().store_uint(request_hash, 256).end_cell().begin_parse(); + ;; throw_unless(310, check_bls(request_hash, in_msg_body~load_bits(768), key)); + } else { + throw(311); + } + + return request; +} + +;; ------------------------ PLUGIN MANAGEMENT FUNCTIONS ------------------------ + +cell uninstall_plugin(cell plugins, int plugin_id) inline method_id(108438) { + (plugins, _) = udict_delete?(plugins, 256, plugin_id); + (plugins_storage, _) = udict_delete?(plugins_storage, 256, plugin_id); + return plugins; +} + +;; ------------------------------- ACTION METHOD ------------------------------- + +(cell, cell) ~do(cell action, cell plugins) { + slice action = action.begin_parse(); + int op = action~load_uint(32); + + if (op == 0x3ee943f1) { + send_raw_message(action~load_ref(), action.preload_uint(8)); + } elseif (op == 0x01fabff6) { + plugins = uninstall_plugin(plugins, action.preload_uint(256)); + } elseif (op == 0x79ae2d9f) { + cell plugin = action~load_ref(); + int plugin_hash = plugin.cell_hash(); + plugins~udict_set_ref(256, plugin_hash, plugin); + + send_raw_message(begin_cell() + .store_uint(0x18, 6) + .store_slice(lib_registry) + .store_coins(160 * milliton + plugin.calc_storage_fee(storage_time)) + .store_uint(0x43ffd44f, 107 + 32) + .store_ref(plugin) + .end_cell(), 0); + } elseif (op == 0x6908c994) { + cell code = action~load_ref(); + code.begin_parse().bless().invoke(empty_tuple(), 0); + } else { + throw(303); + } + + return (action.preload_maybe_ref(), plugins); +} + +;; ----------------------- RECV_INTERNAL + RECV_EXTERNAL ----------------------- + +() main(int balance, int msg_value, cell in_msg, slice in_msg_body) { + if (in_msg_body.slice_empty?()) { return (); } + slice in_msg_full = in_msg.begin_parse(); + if (in_msg_full~load_uint(4) & 1) { return (); } + + int op = in_msg_body~load_uint(32); + if (op == op::store_success) { + terminate_if(~ equal_slices(in_msg_full~load_msg_addr(), lib_registry)); + ;; we accept the message if it is from wrong sender, though don't react to it + + ;; if the sender is right, the registry stored plugin as a library + ;; if the plugin is still installed, we may replace it with a library cell + + (int uid, cell plugins, int key_type, slice key) = load_contract(); + + int plugin_id = in_msg_body~load_uint(256); + (_, int found) = plugins.udict_get_ref?(256, plugin_id); + terminate_if(~ found); + + cell exotic_plugin = begin_cell().store_uint(2, 8).store_uint(plugin_id, 256).end_exotic(); + plugins~udict_set_ref(plugin_id, 256, exotic_plugin); + + save_contract(uid, plugins, key_type, key); + } elseif (op == op::invoke_plugin) { + (int uid, cell plugins, int key_type, slice key) = load_contract(); + int plugin_id = in_msg_body~load_uint(256); + (cell plugin, int found) = plugins.udict_get_ref?(256, plugin_id); + throw_unless(300, found); + + plugin.begin_parse().bless().invoke( + [balance, msg_value, in_msg, in_msg_body].unsafe::transmute(), + 121535 + ); + + save_contract(uid, plugins, key_type, key); + } +} + +() recv_external(slice in_msg_body) { + dump_used_gas(); + int op = in_msg_body~load_uint(32); + if (op == op::do_signed) { + (int uid, cell plugins, int key_type, slice key) = load_contract(); + slice request = in_msg_body.check_any_signature(key_type, key).begin_parse(); + throw_unless(312, request~load_uint(64) == uid); + + save_contract(uid + 1, plugins, key_type, key); + commit(); accept_message(); dump_used_gas(); + + cell action = request.preload_maybe_ref(); + while (~ cell_null?(action)) { + plugins = action~do(plugins); + } + + save_contract(uid + 1, plugins, key_type, key); + } elseif (op == op::invoke_plugin) { + (int uid, cell plugins, int key_type, slice key) = load_contract(); + int plugin_id = in_msg_body~load_uint(256); + (cell plugin, int found) = plugins.udict_get_ref?(256, plugin_id); + throw_unless(300, found); + + plugin.begin_parse().bless().invoke([in_msg_body].unsafe::transmute(), 89430); + + save_contract(uid, plugins, key_type, key); + } +} diff --git a/project.yaml b/project.yaml new file mode 100644 index 0000000..ea5b636 --- /dev/null +++ b/project.yaml @@ -0,0 +1,24 @@ +plugin: + fift: + - fift/exotic.fif + func: + - func/plugin.fc + tests: + - tests/plugin.fc + +registry: + fift: + - fift/exotic.fif + func: + - func/registry.fc + tests: + - tests/registry.fc + +wallet: + fift: + - fift/exotic.fif + func: + - func/wallet.fc + tests: + - tests/wallet.fc + diff --git a/show-log.py b/show-log.py new file mode 100644 index 0000000..569c69d --- /dev/null +++ b/show-log.py @@ -0,0 +1,120 @@ +import sys +import os + +os.system('') + +print('\x1b[37m') + +need_load_err = True + +exit_codes = { + '2': 'ERR_STACK_UNDERFLOW', + '3': 'ERR_STACK_OVERFLOW', + '4': 'ERR_INTEGER_OVERFLOW', + '5': 'ERR_INTEGER_OUT_OF_RANGE', + '6': 'ERR_INVALID_OPCODE', + '7': 'ERR_TYPE_CHECK', + '8': 'ERR_CELL_OVERFLOW', + '9': 'ERR_CELL_UNDERFLOW', + '10': 'ERR_DICT', + '13': 'ERR_OUT_OF_GAS', + '32': 'ERR_INVALID_ACTION_LIST', + '34': 'ERR_ACTION_UNSUPPORTED', + '37': 'ERR_NOT_ENOUGH_TON', + '38': 'ERR_NOT_ENOUGH_CURRENCY' +} + +with open(__file__ + '/../toncli.log', 'r', encoding='utf-8') as f: + debug_line_tostr = False + + for line in f: + # if not line.strip(): continue + if '_io.TextIO' in line: continue + if 'detached' in line: continue + + need_load_err = False + + for d in (31, 32, 36, 0): + line = line.replace('\x1b[%dm' % d, '') + if '[ 3]' in line: + continue + line = ('\x1b[36m' + + line.removeprefix('[ 3][t 0]') + .replace('9223372036854775807', 'UMAX') + .replace('[vm.cpp:558]', '[vm558]') + '\x1b[37m') + + line = line.removeprefix('INFO: ') + + for (code, desc) in exit_codes.items(): + c2 = int(code) + 200 + line = line.replace(f'code: [{code}]', f'code: [{code} | {desc}]') + line = line.replace(f'code: [{c2}]', f'code: [{c2} | CALLEE_{desc}]') + + if line.strip() == '#DEBUG#: s0 = 4445': + debug_line_tostr = True + continue + elif line.startswith('#DEBUG#') and debug_line_tostr: + debug_line_tostr = False + try: + n = int(line.removeprefix('#DEBUG#: s0 = ').rstrip()) + s = '' + while n: + s = s + chr(n % 256) + n //= 256 + line = '\x1b[36m DEBUG : ' + s[::-1] + '\x1b[37m\n' + except: + pass + + if 'Test' in line and 'AsmTests' not in line: + color = '\x1b[37m' + if 'SUCCESS' in line: color = '\x1b[32m' + if 'FAIL' in line: color = '\x1b[33m' + + line = (line + .replace('[SUCCESS] Test', 'OK,') + .replace('[FAIL]', 'RE') + .replace(' Total gas used (including testing code)', ', gas usage') + ) + + gas_usage = int(line[line.rfind('[')+1:line.rfind(']')]) + ton_usage = gas_usage * 10**-6 + if '_get]' in line: + ton_s = ' (offchain request)' + elif '_transfer]' in line: + ton_s = ' (money transfer)' + elif 'init_contract]' in line: + ton_s = ' (one-time initialization)' + elif ton_usage > 0.01: + ton_s = '\x1b[33m (%.5f TON == %.2f req/TON)' % (ton_usage, 1/ton_usage) + else: + ton_s = '\x1b[32m (%.5f TON == %.2f req/TON)' % (ton_usage, 1/ton_usage) + + line = color + line.rstrip().replace('__test_', '', 1).replace('status: ', '', 1) + ton_s + '\x1b[37m\n' + + print(line.replace('\r', ''), end='') + +red_border = '\n\x1b[41m\x1b[30m \x1b[40m\x1b[37m\n' + +with open(__file__ + '/../toncli.err', 'r', encoding='utf-8') as f: + skipping_traceback = False + + for line in f: + if '--- Logging error ---' in line: continue + + if line.startswith('Traceback'): + skipping_traceback = True + elif line.startswith('Arguments') or line.startswith('subprocess'): + skipping_traceback = False + continue + + if skipping_traceback: continue + + if red_border: + print(red_border) + red_border = '' + + if 'func/' in line or 'func\\' in line: + path, remainder = line.split(': ', 1) + print(('\x1b[33m%s: \x1b[37m%s' % (path, remainder))) + else: + print(line, end='') diff --git a/test-wallet-v5.ts b/test-wallet-v5.ts new file mode 100644 index 0000000..7ba2d25 --- /dev/null +++ b/test-wallet-v5.ts @@ -0,0 +1,37 @@ +import { Blockchain } from "@ton-community/sandbox"; +import { SendMode, toNano } from "ton-core"; +import { randomTestKey } from "ton/dist/utils/randomTestKey"; +import { makeSender, WalletContractV5R1 } from "./wallet-v5"; + + +function expect(a: any) { + return { + toBe: function(b: any) { + if (a === b) return; + throw new Error("mismatch between " + a + " " + b); + } + } +} + +(async () => { + const blockchain = await Blockchain.create(); + const deployer = await blockchain.treasury('deployer'); + let key = randomTestKey('v5r1-treasure'); + + let contract = blockchain.openContract(WalletContractV5R1.create({ workchain: 0, publicKey: key.publicKey })); + let balance = await contract.getBalance(); + expect(contract.address.toString()).toBe('EQCYcccF6VVg72UeDXeinJ7Xt_tErqinE53K-W-ynuhTFvyz'); + expect(balance).toBe(0n); + + await contract.sendDeploy(deployer.getSender(), '0.5'); + balance = await contract.getBalance(); + expect(balance <= toNano('0.50')).toBe(true); + expect(balance >= toNano('0.49')).toBe(true); + + await makeSender(contract, key.secretKey).send({ + to: deployer.address, value: toNano('0.25'), sendMode: SendMode.NONE + }); + balance = await contract.getBalance(); + expect(balance <= toNano('0.25')).toBe(true); + expect(balance >= toNano('0.22')).toBe(true); +})(); diff --git a/tests/plugin.fc b/tests/plugin.fc new file mode 100644 index 0000000..574be43 --- /dev/null +++ b/tests/plugin.fc @@ -0,0 +1,71 @@ +forall X, Y -> Y unsafe::transmute(X) asm "NOP"; + +forall X -> tuple __invoke_internal((int -> X) f, tuple args, int method) asm + "TPUSH" + "DEPTH DEC DEC 30 SETGLOB" + "255 PUSHINT EXPLODEVAR" + "DUP INC" + "ROLLX" + "SWAP" + "TRUE" + "CALLXVARARGS" + "DEPTH 30 GETGLOB SUB TUPLEVAR"; + +tuple novm::invoke(tuple args, int method, cell code) inline { + cont f = (code.cell_null?()) ? get_c3() : code.begin_parse().bless(); + return f.unsafe::transmute().__invoke_internal(args, method); +} + +tuple vm::invoke(tuple args, int method, cell f) asm(f args method) + "TPUSH" + "DEPTH DEC DEC 30 SETGLOB" + "255 PUSHINT EXPLODEVAR" + "DUP INC" + "ROLLX" + "DUMPSTK" + "CTOS 1 RUNVM" + "DEPTH 30 GETGLOB SUB TUPLEVAR" + "DUMPSTK"; + +cell plugin_code() asm + "B{B5EE9C7201010601004F000114FF00F4A413F4BCF2C80B0102016202030002D002037B600405004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81B87D8040}" + "B>boc PUSHREF"; + +cell my_code() asm "MYCODE"; +forall X -> X tuple_index_var(tuple, int) asm "INDEXVAR"; + + +() __test_donations_fail_transfer() { + invoke_method_expect_fail(main, []); +} +_ __test_creator_address() { + return invoke_method(creator_address, []); +} +tuple __test_invoke_creator_address() { + return novm::invoke(empty_tuple(), 119703, null()); +} +tuple __test_plugin_invoke_creator_address() { + return vm::invoke(empty_tuple(), 119703, plugin_code()); +} +tuple __test_vminvoke_process_internal() { + return novm::invoke(unsafe::transmute([-1, -1, plugin_code(), "avc"]), 121535, null()); +} +() __test_c7_get() { + ~dump(get_c7()); +} +_ __test_c7_tenth_get() { + return get_c7().tuple_index_var(10); +} +_ __test_config_8() { + return config_param(8); +} +_ __test_mycode_get() { + return my_code(); +} +() __test_mycode() { + throw_unless(190, cell_hash(plugin_code()) == cell_hash(my_code())); +} +(int, int) __test_test_address() { + return (slice_hash("EQB36_EfYjFYMV8p_cxSYX61bA0FZ4B65ZNN6L8INY-5gL6w"a), + slice_hash(my_address())); +} diff --git a/tests/registry.fc b/tests/registry.fc new file mode 100644 index 0000000..6d2c35e --- /dev/null +++ b/tests/registry.fc @@ -0,0 +1,47 @@ +cell plugin_code() asm + "B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840}" + "B>boc PUSHREF"; + +forall X -> tuple tuple_set_index(tuple t, X value, int index) asm "SETINDEXVAR"; +[tuple] ::get_c7() asm "c7 PUSHCTR"; +() ::set_c7([tuple]) impure asm "c7 POPCTR"; + +cell param18() asm "x{D06600000000000000000000000080000000000000FA00000000000001F4000000000003D0904_} s>c PUSHREF"; +() init_config() impure { + cell config = null(); + config~udict_set_ref(32, 18, param18()); + + ::get_c7().unsingle().tuple_set_index(config, 9).single().::set_c7(); +} + + +() __test_donation_transfer() { + invoke_method(main, [0, 1000, begin_cell().end_cell(), begin_cell().end_cell().begin_parse()]); +} +_ __test_add_plugin_too_low_funds() { + init_config(); + cell in_msg_full = begin_cell().store_uint(0, 4).store_slice(my_address()).end_cell(); + slice in_msg_body = begin_cell().store_uint(0x43ffd44f, 32).store_ref(plugin_code()).end_cell().begin_parse(); + return invoke_method_expect_fail(main, [0, 1000, in_msg_full, in_msg_body]); +} +_ __test_add_plugin_invalid_opcode() { + init_config(); + cell in_msg_full = begin_cell().store_uint(0, 4).store_slice(my_address()).end_cell(); + slice in_msg_body = begin_cell().store_uint(0x43ffd400, 32).store_ref(plugin_code()).end_cell().begin_parse(); + return invoke_method_expect_fail(main, [0, 1000, in_msg_full, in_msg_body]); +} +_ __test_add_plugin_no_config() { + cell in_msg_full = begin_cell().store_uint(0, 4).store_slice(my_address()).end_cell(); + slice in_msg_body = begin_cell().store_uint(0x43ffd44f, 32).store_ref(plugin_code()).end_cell().begin_parse(); + return invoke_method_expect_fail(main, [0, 10 * 1000000000, in_msg_full, in_msg_body]); +} +_ __test_add_plugin_success() { + init_config(); + cell in_msg_full = begin_cell().store_uint(0, 4).store_slice(my_address()).end_cell(); + slice in_msg_body = begin_cell().store_uint(0x43ffd44f, 32).store_ref(plugin_code()).end_cell().begin_parse(); + return invoke_method(main, [0, 10 * 1000000000, in_msg_full, in_msg_body]); +} +_ __test_plugin_total_fee_get() { + init_config(); + return get_fee(plugin_code()); +} diff --git a/tests/wallet.fc b/tests/wallet.fc new file mode 100644 index 0000000..cec3d60 --- /dev/null +++ b/tests/wallet.fc @@ -0,0 +1,69 @@ +slice public_ed25519_key() asm "B priv>pub B, b> tuple tuple_set_index(tuple t, X value, int index) asm "SETINDEXVAR"; +[tuple] ::get_c7() asm "c7 PUSHCTR"; +() ::set_c7([tuple]) impure asm "c7 POPCTR"; + +cell plugin_code() asm + "B{B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840}" + "B>boc PUSHREF"; + +() init() impure { + set_data(begin_cell() + ;; .store_uint(0, 64) + ;; .store_uint(0, 2) + ;; .store_uint(0x0080de4f, 32) + .store_uint(0x0080de4f, 98) + .store_slice(public_ed25519_key()) + .end_cell()); +} +cell param18() asm "x{D06600000000000000000000000080000000000000FA00000000000001F4000000000003D0904_} s>c PUSHREF"; +() init_config() impure { + cell config = null(); + config~udict_set_ref(32, 18, param18()); + + ::get_c7().unsingle().tuple_set_index(config, 9).single().::set_c7(); +} + +() __test_void_external() { + invoke_method_expect_fail(recv_external, [begin_cell().end_cell().begin_parse()]); +} +() __test_external_noinit() { + cell ext = begin_cell().store_uint(op::do_signed, 32).end_cell(); + invoke_method_expect_fail(recv_external, [ext.begin_parse()]); +} +() __test_short_external() { + init(); + cell ext = begin_cell().store_uint(op::do_signed, 32).end_cell(); + invoke_method_expect_fail(recv_external, [ext.begin_parse()]); +} +() __test_short2_external() { + init(); + cell request = begin_cell().store_uint(0, 64).end_cell(); + cell ext = begin_cell().store_uint(op::do_signed, 32).store_ref(request).end_cell(); + invoke_method_expect_fail(recv_external, [ext.begin_parse()]); +} +() __test_accepted_external() { + init(); + cell request = begin_cell().store_uint(0, 65).end_cell(); + slice signature = sign(request.cell_hash(), 20230610); + cell ext = begin_cell().store_uint(op::do_signed, 32).store_slice(signature).store_ref(request).end_cell(); + invoke_method(recv_external, [ext.begin_parse()]); +} +() __test_add_plugin() { + init(); init_config(); + cell action = begin_cell().store_uint(0x79ae2d9f << 1, 33).store_ref(plugin_code()).end_cell(); + cell request = begin_cell().store_uint(1, 65).store_ref(action).end_cell(); + slice signature = sign(request.cell_hash(), 20230610); + cell ext = begin_cell().store_uint(op::do_signed, 32).store_slice(signature).store_ref(request).end_cell(); + invoke_method(recv_external, [ext.begin_parse()]); +} +() __test_transfer() { + init(); init_config(); + cell message = begin_cell().store_uint(0x18 << 2, 8).store_coins(1000).store_uint(0, 107).end_cell(); + cell action = begin_cell().store_uint(0x3ee943f1, 32).store_uint(1 << 1, 9).store_ref(message).end_cell(); + cell request = begin_cell().store_uint(1, 65).store_ref(action).end_cell(); + slice signature = sign(request.cell_hash(), 20230610); + cell ext = begin_cell().store_uint(op::do_signed, 32).store_slice(signature).store_ref(request).end_cell(); + invoke_method(recv_external, [ext.begin_parse()]); +} diff --git a/wallet-v5.ts b/wallet-v5.ts new file mode 100644 index 0000000..9fce01f --- /dev/null +++ b/wallet-v5.ts @@ -0,0 +1,198 @@ +import { SandboxContract } from "@ton-community/sandbox"; +import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, internal, MessageRelaxed, Sender, SenderArguments, SendMode, storeMessageRelaxed, toNano } from "ton-core"; +import { sign } from "ton-crypto"; + +export type Transfer = {action: 'transfer', message: MessageRelaxed, sendMode: SendMode}; +export type UninstallPlugin = {action: 'uninstall', hash: Buffer}; +export type InstallPlugin = {action: 'install', code: Cell}; +export type InvokeCode = {action: 'invoke', code: Cell}; +export type Action = InstallPlugin | InvokeCode | Transfer | UninstallPlugin; + +export class WalletContractV5R1 implements Contract { + readonly workchain: number; + readonly publicKey: Buffer; + readonly address: Address; + readonly walletId: number; + readonly init: { data: Cell, code: Cell }; + + static create(args: {workchain: number, publicKey: Buffer, walletId?: number}) { + let {workchain, publicKey, walletId} = args; + return new WalletContractV5R1(workchain, publicKey, walletId); + } + + private constructor(workchain: number, publicKey: Buffer, walletId?: number) { + this.workchain = workchain; + this.publicKey = publicKey; + if (walletId !== undefined) { + this.walletId = walletId; + } else { + this.walletId = 698983191 + workchain; + } + + let code = Cell.fromBase64('te6ccgECIgEABNsAART/APSkE/S88sgLAQIBIAIDAgFIBAUB4vLTHyGCEEUJS/W6jmIBghBE1WK1uo5V7UTQ0z/0BPQEAfhh0x8E0/9RE4MH9A/y4SzQ7R4BbwGCAV1Wb4xopaX4foEA/2+EIKRhAX/bOGj4XqFvgDBVAvhBBMjLPxP0ABP0ABLLHwHPFsntVJEw4uMNIAICzAYHAgEgDA0CP9kGOASS+CcBDoaYGAuNhJL4LwAOmPkMEIYf/qJ91xh8CAkC97YDoaY+QwQgfdKH43UyY6hBrhYOJfYBHcRDBBP1f+11HC5iQa4X/iSkBQYP6LZh8IIlBg/otmHwwx18QwQg81xbP3UcZAMEINIRkyl1HEWoA6HaPN4A4N8Y0UtL8P0CAf7fCEFIwgL/tnDR8L1C3wBhJ+WCX8QDxhvEA8UKCwDqMWwiMvpAMI0IZ/8olf9ITD54aEoNbXf085JIgV+/WI1hdRU7aZ/xCT+UxMcFs+MI7UTQ0z/0BPQEAfhh0x8E0/8wUwKDB/QPMbPjCHLIywdSEMv/cc8jAoMHUEL0F0AT+EEEyMs/E/QAE/QAEssfAc8Wye1UAM4yghBE1WK1uo5Z7UTQ0z/0BPQEAfhh0x8E0/9RE4MH9A/y4SzQ7R4QOEdmbwQTggHav2+MaKWl+H6BAP9vhCCkYQF/2zho+F6hb4AwQzD4QQTIyz8T9AAT9AASyx8BzxbJ7VSSXwTiAPwx1CH5AFRCFIMH9BeCEEP/1E+AGMjLBY0IZ/8olf9ITD54aEoNbXf085JIgV+/WI1hdRU7aZ/xCT+UxM8WghAJiWgAJIIJ4TOAAYIBhqD5QTBYcIAS+DOAIPQMb6EwgQCo1yHTPwOoAtM/MFADqKABqKsPoPoCy4oSzMlw+wAABvQFAQIBIA4PAgEgFhcCASAQEQAluMl+1E0NM/9AT0BAH4YdMfXwOAIBIBITAgEgFBUAX7DFm8A7UTQ0z/0BPQEAfhh0x8QI18DkyBus44Rgwf0lm+lMAHXTNBvAlhvAgHoMIABzsmlbwDtRNDTP/QE9AQB+GHTHxAjXwOTIG6zjhuDB/SWb6Uw+EFSEIMH9A8wAtdM0FhvA1hvAgHoMIAAzsp37UTQ0z/0BPQEAfhh0x8QI18Dgwf0DzGAAJbDnO1E0NM/9AT0BAH4YdMfMzGACASAYGQIBIB4fADO0r92omhpn/oCegIA/DDpj4gRr4HBg/oHmEAICcRobAFGlCt4B2omhpn/oCegIA/DDpj4gRr4HJkDdZzkGD+ks30pgYrDeBAPQYQIBIBwdADOi47UTQ0z/0BPQEAfhh0x8QI18Dgwf0DzDQgAlollICgwf0WzD4QRKDB/RbMPhhgAztM09qJoaZ/6AnoCAPww6Y+vgnwgwYP6B5hAAXbYIDeAdqJoaZ/6AnoCAPww6Y+IEa+ByZA3WccIQYP6SzfSmADrpjeBLDeBAPQYQAfox7UTQ0z/0BPQEAfhh0x9UNBQC1CH5ACOCCIDeT7qbMwPXC/8T+RDy4TaOGAOCEGTd6+u6l1AD+RTy4TaWE18D8sE34uLQ0z9RFLry4TgjpFRzJfhBBMjLPxP0ABP0ABLLHwHPFsntVPgP+AD0BZMgbrOUWPALWegwAqRQIyEAKvhBBMjLPxP0ABP0ABLLHwHPFsntVA=='); + + let data = beginCell() + .storeUint(this.walletId, 32) // subwallet_id -\ uid + .storeUint(0, 32) // seqno _/ + .storeUint(0, 2) // plugins code and data + .storeUint(0x0080de4f, 32) // key::public::ed25519 + .storeBuffer(this.publicKey) + .endCell(); + this.init = { code, data }; + this.address = contractAddress(workchain, { code, data }); + } + + async getBalance(provider: ContractProvider) { + let state = await provider.getState(); + return state.balance; + } + + async _nowrapGetSeqno(provider: ContractProvider): Promise { + let state = await provider.getState(); + if (state.state.type === 'active') { + let res = await provider.get('seqno', []); + return res.stack.readBigNumber(); + } else { + return BigInt(this.walletId) * 4294967296n + 0n; + } + } + + async getSeqno(provider: ContractProvider): Promise { + return this._nowrapGetSeqno(provider); + } + + async sendExternal(provider: ContractProvider, message: Cell) { + await provider.external(message); + } + + async sendTransfer(provider: ContractProvider, args: { + seqno: bigint, + secretKey: Buffer, + messages: MessageRelaxed[] + sendMode?: SendMode, + timeout?: number, + }) { + let transfer = this.createTransfer(args); + await this.sendExternal(provider, transfer); + } + + _storeAction(nextAction: Cell | null, add: Action): Cell | null { + if (add.action == 'install') { + return beginCell() + .storeUint(0x79ae2d9f, 32) + .storeRef(add.code) + .storeMaybeRef(nextAction) + .endCell(); + } else if (add.action == 'transfer') { + return beginCell() + .storeUint(0x3ee943f1, 32) + .storeUint(add.sendMode | SendMode.IGNORE_ERRORS, 8) + .storeRef(beginCell().store(storeMessageRelaxed(add.message))) + .storeMaybeRef(nextAction) + .endCell(); + } else if (add.action == 'invoke') { + return beginCell() + .storeUint(0x6908c994, 32) + .storeRef(add.code) + .storeMaybeRef(nextAction) + .endCell(); + } else if (add.action == 'uninstall') { + return beginCell() + .storeUint(0x01fabff6, 32) + .storeBuffer(add.hash) + .storeMaybeRef(nextAction) + .endCell(); + } else { + throw new Error("trying to store unsupported action"); + } + } + + signMultiAction(args: { + seqno: bigint, + secretKey: Buffer, + actions: Action[], + }): Cell { + let {seqno, secretKey, actions} = args; + + if (actions.length > 255) { + throw Error("Maximum number of messages in a single transfer is 255"); + } + actions.reverse(); + + let lastActionRepr: Cell | null = null; + for (let a of actions) { + lastActionRepr = this._storeAction(lastActionRepr, a); + } + const request = beginCell().storeUint(seqno, 64).storeMaybeRef(lastActionRepr).endCell(); + const signature: Buffer = sign(request.hash(), secretKey); + const body = beginCell().storeUint(0x45094bf5, 32).storeBuffer(signature).storeRef(request).endCell(); + return body; + } + + createTransfer(args: { + seqno: bigint, + secretKey: Buffer, + messages: MessageRelaxed[], + sendMode?: SendMode | null, + }): Cell { + let {seqno, secretKey, messages, sendMode} = args; + let fixedSendMode : SendMode = (sendMode ?? SendMode.PAY_GAS_SEPARATELY) | SendMode.IGNORE_ERRORS; + + const actions: Action[] = messages.map( + m => {return {action: 'transfer', message: m, sendMode: fixedSendMode};} + ); + return this.signMultiAction({seqno, actions, secretKey}); + } + + async sendInstallPlugin(provider: ContractProvider, args: { + seqno?: bigint, + secretKey: Buffer, + code: Cell + }): Promise { + let transfer = this.signMultiAction({ + seqno: args.seqno ?? await this._nowrapGetSeqno(provider), + secretKey: args.secretKey, + actions: [{action: 'install', code: args.code}] + }) + await this.sendExternal(provider, transfer); + return args.code.hash(); + } + + async sendUninstallPlugin(provider: ContractProvider, args: { + seqno?: bigint, + secretKey: Buffer, + hash?: Buffer, + code?: Cell + }) { + let hash: Buffer = args.hash ?? args.code!!.hash(); + let transfer = this.signMultiAction({ + seqno: args.seqno ?? await this._nowrapGetSeqno(provider), + secretKey: args.secretKey, + actions: [{action: 'uninstall', hash}] + }) + await this.sendExternal(provider, transfer); + } + + async sendDeploy(provider: ContractProvider, via: Sender, value?: string) { + await provider.internal(via, { + value: toNano(value ?? '0.01'), + bounce: false, + sendMode: SendMode.PAY_GAS_SEPARATELY + }); + } +} + +export function makeSender(contract: SandboxContract, secretKey: Buffer) : Sender { + return { + send: async (args: SenderArguments) => { + let seqno = await contract.getSeqno(); + let transfer = contract.createTransfer({ + seqno, + secretKey, + sendMode: args.sendMode, + messages: [internal(args)] + }); + await contract.sendExternal(transfer); + } + }; +}