forked from ton-blockchain/wallet-contract
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec87bc2
commit 5bcadf1
Showing
37 changed files
with
10,234 additions
and
608 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea/ | ||
func/*.boc | ||
*.pk | ||
toncli.log | ||
toncli.err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 =================') |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
B5EE9C7201010201003D000114FF00F4A413F4BCF2C80B01005CD382F0D3C03D232FEE50CBEF989BDE30BF37F749F35849DDB6777A45585F49335BBAB672C8CB07CBFF71CF23FB04 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
B5EE9C7201010801005F000114FF00F4A413F4BCF2C80B010201620203000AD0840FF2F00201200405000BBEEAB7F101840202750607004DADCBC6843002CA87B3D551781DB34DAB945BA9FAF7CCABA80232A8AE12BE619AFB2C822256B6400011AD5F89AF81FF101840 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
B5EE9C7201020501000147000114FF00F4A413F4BCF2C80B01020162020301F6D03322D749C120E308D0D3030171B0E308840F03D31F01821043FFD44FBA14F2F402D430208209E1338001820186A0F94130588012F83370018020F40C6FA1308028D721F828FA4430C0FF948306D721DED33F03A802D33F305003A8A001A8AB0F821006DAC2C0A012A120C2FFF2E082ED4420D0C70092306DDE2204008BA0C40B0413C267000304030D41F28260B10025F066E0030041E818DF42610051AE43F051F4886181FF29060DAE43BDA67E075005A67E60A00751400351561F04200DB585814100DAF90023028307F417ED542172FB066F0052208201D3976F8C68A5A5F87E8100FF6F8420A461D0DB400168F85EA16F806F1020FA445B708018C8CB0558CF16821005F5E100FA02CB6AC970FB0001F9008210C3FFD44F8018C8CB0504FA403014CF1658FA0212CB8ECBFFC970FB00 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
B5EE9C72010222010004DB000114FF00F4A413F4BCF2C80B010201200203020148040501E2F2D31F21821045094BF5BA8E6201821044D562B5BA8E55ED44D0D33FF404F40401F861D31F04D3FF51138307F40FF2E12CD0ED1E016F0182015D566F8C68A5A5F87E8100FF6F8420A461017FDB3868F85EA16F80305502F84104C8CB3F13F40013F40012CB1F01CF16C9ED549130E2E30D200202CC06070201200C0D023FD906380492F827010E8698180B8D8492F82F000E98F90C10861FFEA27DD7187C080902F7B603A1A63E4304207DD287E3753263A841AE160E25F6011DC4430413F57FED751C2E6241AE17FE24A405060FE8B661F08225060FE8B661F0C31D7C430420F35C5B3F751C64030420D2119329751C45A803A1DA3CDE00E0DF18D14B4BF0FD0201FEDF084148C202FFB670D1F0BD42DF006127E5825FC403C61BC403C50A0B00EA316C2232FA40308D0867FF2895FF484C3E78684A0D6D77F4F39248815FBF588D6175153B699FF1093F94C4C705B3E308ED44D0D33FF404F40401F861D31F04D3FF3053028307F40F31B3E30872C8CB075210CBFF71CF230283075042F4174013F84104C8CB3F13F40013F40012CB1F01CF16C9ED5400CE32821044D562B5BA8E59ED44D0D33FF404F40401F861D31F04D3FF51138307F40FF2E12CD0ED1E103847666F04138201DABF6F8C68A5A5F87E8100FF6F8420A461017FDB3868F85EA16F80304330F84104C8CB3F13F40013F40012CB1F01CF16C9ED54925F04E200FC31D421F9005442148307F417821043FFD44F8018C8CB058D0867FF2895FF484C3E78684A0D6D77F4F39248815FBF588D6175153B699FF1093F94C4CF16821009896800248209E1338001820186A0F9413058708012F8338020F40C6FA1308100A8D721D33F03A802D33F305003A8A001A8AB0FA0FA02CB8A12CCC970FB000006F405010201200E0F020120161702012010110025B8C97ED44D0D33FF404F40401F861D31F5F03802012012130201201415005FB0C59BC03B513434CFFD013D01007E1874C7C408D7C0E4C81BACE38460C1FD259BE94C0075D3341BC0961BC0807A0C200073B2695BC03B513434CFFD013D01007E1874C7C408D7C0E4C81BACE386E0C1FD259BE94C3E10548420C1FD03CC00B5D334161BC0D61BC0807A0C200033B29DFB513434CFFD013D01007E1874C7C408D7C0E0C1FD03CC600025B0E73B513434CFFD013D01007E1874C7CCCC6002012018190201201E1F0033B4AFDDA89A1A67FE809E80803F0C3A63E2046BE07060FE81E6100202711A1B0051A50ADE01DA89A1A67FE809E80803F0C3A63E2046BE072640DD6739060FE92CDF4A6062B0DE0403D0610201201C1D0033A2E3B513434CFFD013D01007E1874C7C408D7C0E0C1FD03CC3420025A259480A0C1FD16CC3E1044A0C1FD16CC3E1860033B4CD3DA89A1A67FE809E80803F0C3A63EBE09F083060FE81E610005DB6080DE01DA89A1A67FE809E80803F0C3A63E2046BE072640DD671C21060FE92CDF4A6003AE98DE04B0DE0403D061001FA31ED44D0D33FF404F40401F861D31F54341402D421F90023820880DE4FBA9B3303D70BFF13F910F2E1368E1803821064DDEBEBBA975003F914F2E13696135F03F2C137E2E2D0D33F5114BAF2E13823A4547325F84104C8CB3F13F40013F40012CB1F01CF16C9ED54F80FF800F40593206EB39458F00B59E83002A4502321002AF84104C8CB3F13F40013F40012CB1F01CF16C9ED54 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.