-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest_dex.fif
58 lines (40 loc) · 1.38 KB
/
test_dex.fif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env fift -s
"TonUtil.fif" include
"Asm.fif" include
"owner.addr" load-address 2dup 2constant owner_addr
variable storage
variable exit_code
{ storage ! exit_code ! } : finish_run
{ exit_code @ 0 = not abort"command failed" } : exit_grace
{
."Exit code " exit_code @ . cr
."Updated storage: " cr storage @ <s csr. cr
."Stack:" cr .s
} : print_result
"token.fif" include =: code
100000000000000000000000000 =: total_supply
<b total_supply Gram, b> <s <b owner_addr addr, b> <s dictnew 264 sdict! drop =: balances
dictnew =: allowed
// init storage
<b "RUB" $len 8 u,
"RUB" $,
"R" $len 8 u,
"R" $,
18 8 u,
total_supply Gram,
balances dict,
allowed dict,
0 1 u,
b> storage !
// receive external - init
<b b> <s
124838 code <s storage @ runvm
finish_run print_result exit_grace
// action = 2 - transfer from hex
0
// 00000001000000000000000000B2BFAC4461DDF2B0D7BD78316F906085A749DC1B0FE3D6F553F6A10CFBCE36F3405F5E10040BEBC2000100B2BFAC4461DDF2B0D7BD78316F906085A749DC1B0FE3D6F553F6A10CFBCE36F3
<b 0 1 i, b{000100} s, owner_addr addr, 3 Gram, b>
<b "F553F6A10CFBCE36F3405F5E10040BEBC2000100B2BFAC4461DDF2B0D7BD78316F906085A749DC1B0FE3D6F553F6A10CFBCE36F3" $>s s, b> =: REF
<b 0 32 u, "00000001000000000000000000B2BFAC4461DDF2B0D7BD78316F906085A749DC1B0FE3D6" $>s s, REF ref, b> <s
90191 code <s storage @ runvm
finish_run print_result exit_grace